Skip to content

Commit

Permalink
Merge branch 'dev' into implementation/59988-on-mweb-there-is-no-remi…
Browse files Browse the repository at this point in the history
…nder-set-status-shown
  • Loading branch information
jjabari-op authored Dec 13, 2024
2 parents 44f747c + 91b2da3 commit 2ad28a0
Show file tree
Hide file tree
Showing 449 changed files with 6,574 additions and 1,957 deletions.
112 changes: 56 additions & 56 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -226,35 +226,35 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (2.0.1)
actioncable (7.1.5)
actionpack (= 7.1.5)
activesupport (= 7.1.5)
actioncable (7.1.5.1)
actionpack (= 7.1.5.1)
activesupport (= 7.1.5.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.5)
actionpack (= 7.1.5)
activejob (= 7.1.5)
activerecord (= 7.1.5)
activestorage (= 7.1.5)
activesupport (= 7.1.5)
actionmailbox (7.1.5.1)
actionpack (= 7.1.5.1)
activejob (= 7.1.5.1)
activerecord (= 7.1.5.1)
activestorage (= 7.1.5.1)
activesupport (= 7.1.5.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.5)
actionpack (= 7.1.5)
actionview (= 7.1.5)
activejob (= 7.1.5)
activesupport (= 7.1.5)
actionmailer (7.1.5.1)
actionpack (= 7.1.5.1)
actionview (= 7.1.5.1)
activejob (= 7.1.5.1)
activesupport (= 7.1.5.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.5)
actionview (= 7.1.5)
activesupport (= 7.1.5)
actionpack (7.1.5.1)
actionview (= 7.1.5.1)
activesupport (= 7.1.5.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
Expand All @@ -265,31 +265,31 @@ GEM
actionpack-xml_parser (2.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
actiontext (7.1.5)
actionpack (= 7.1.5)
activerecord (= 7.1.5)
activestorage (= 7.1.5)
activesupport (= 7.1.5)
actiontext (7.1.5.1)
actionpack (= 7.1.5.1)
activerecord (= 7.1.5.1)
activestorage (= 7.1.5.1)
activesupport (= 7.1.5.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.5)
activesupport (= 7.1.5)
actionview (7.1.5.1)
activesupport (= 7.1.5.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.5)
activesupport (= 7.1.5)
activejob (7.1.5.1)
activesupport (= 7.1.5.1)
globalid (>= 0.3.6)
activemodel (7.1.5)
activesupport (= 7.1.5)
activemodel (7.1.5.1)
activesupport (= 7.1.5.1)
activemodel-serializers-xml (1.0.3)
activemodel (>= 5.0.0.a)
activesupport (>= 5.0.0.a)
builder (~> 3.1)
activerecord (7.1.5)
activemodel (= 7.1.5)
activesupport (= 7.1.5)
activerecord (7.1.5.1)
activemodel (= 7.1.5.1)
activesupport (= 7.1.5.1)
timeout (>= 0.4.0)
activerecord-import (1.8.1)
activerecord (>= 4.2)
Expand All @@ -302,13 +302,13 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 4)
railties (>= 6.1)
activestorage (7.1.5)
actionpack (= 7.1.5)
activejob (= 7.1.5)
activerecord (= 7.1.5)
activesupport (= 7.1.5)
activestorage (7.1.5.1)
actionpack (= 7.1.5.1)
activejob (= 7.1.5.1)
activerecord (= 7.1.5.1)
activesupport (= 7.1.5.1)
marcel (~> 1.0)
activesupport (7.1.5)
activesupport (7.1.5.1)
base64
benchmark (>= 0.3)
bigdecimal
Expand Down Expand Up @@ -344,7 +344,7 @@ GEM
awesome_nested_set (3.8.0)
activerecord (>= 4.0.0, < 8.1)
aws-eventstream (1.3.0)
aws-partitions (1.1017.0)
aws-partitions (1.1022.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
Expand All @@ -353,7 +353,7 @@ GEM
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.176.0)
aws-sdk-s3 (1.176.1)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -916,20 +916,20 @@ GEM
rackup (1.0.1)
rack (< 3)
webrick
rails (7.1.5)
actioncable (= 7.1.5)
actionmailbox (= 7.1.5)
actionmailer (= 7.1.5)
actionpack (= 7.1.5)
actiontext (= 7.1.5)
actionview (= 7.1.5)
activejob (= 7.1.5)
activemodel (= 7.1.5)
activerecord (= 7.1.5)
activestorage (= 7.1.5)
activesupport (= 7.1.5)
rails (7.1.5.1)
actioncable (= 7.1.5.1)
actionmailbox (= 7.1.5.1)
actionmailer (= 7.1.5.1)
actionpack (= 7.1.5.1)
actiontext (= 7.1.5.1)
actionview (= 7.1.5.1)
activejob (= 7.1.5.1)
activemodel (= 7.1.5.1)
activerecord (= 7.1.5.1)
activestorage (= 7.1.5.1)
activesupport (= 7.1.5.1)
bundler (>= 1.15.0)
railties (= 7.1.5)
railties (= 7.1.5.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -944,9 +944,9 @@ GEM
rails-i18n (7.0.10)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.1.5)
actionpack (= 7.1.5)
activesupport (= 7.1.5)
railties (7.1.5.1)
actionpack (= 7.1.5.1)
activesupport (= 7.1.5.1)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down Expand Up @@ -1015,7 +1015,7 @@ GEM
rspec-support (3.13.1)
rspec-wait (1.0.1)
rspec (>= 3.4)
rubocop (1.69.1)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down
1 change: 1 addition & 0 deletions app/components/_index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
@import "work_packages/exports/modal_dialog_component"
@import "work_package_relations_tab/index_component"
@import "users/hover_card_component"
@import "enterprise_edition/banner_component"
19 changes: 19 additions & 0 deletions app/components/enterprise_edition/banner_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<%=
grid_layout("op-ee-banner", **@system_arguments) do |grid|
grid.with_area(:'icon-container') do
content_tag :div, class: "op-ee-banner--shield" do
render(Primer::Beta::Octicon.new(icon: 'op-enterprise-addons',
size: :medium,
classes: "op-ee-banner--icon"))
end
end
grid.with_area(:'title-container') { render(Primer::Beta::Text.new) { title } }
grid.with_area(:'description-container') { render(Primer::Beta::Text.new) { description } }
grid.with_area(:'link-container') do
render(Primer::Beta::Link.new(href: href)) do |link|
link.with_trailing_visual_icon(icon: 'link-external')
link_title
end
end
end
%>
107 changes: 107 additions & 0 deletions app/components/enterprise_edition/banner_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module EnterpriseEdition
# Add a general description of component here
# Add additional usage considerations or best practices that may aid the user to use the component correctly.
# @accessibility Add any accessibility considerations
class BannerComponent < ApplicationComponent
include OpPrimer::ComponentHelpers

# @param feature_key [Symbol, NilClass] The key of the feature to show the banner for.
# @param title [String] The title of the banner.
# @param description [String] The description of the banner.
# @param href [String] The URL to link to.
# @param skip_render [Boolean] Whether to skip rendering the banner.
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
def initialize(feature_key,
title: nil,
description: nil,
link_title: nil,
href: nil,
skip_render: !EnterpriseToken.show_banners?,
**system_arguments)
@system_arguments = system_arguments
@system_arguments[:tag] = "div"
super

@feature_key = feature_key
@title = title
@description = description
@link_title = link_title
@href = href
@skip_render = skip_render
end

private

attr_reader :skip_render,
:feature_key

def title
@title || I18n.t("ee.upsale.#{feature_key}.title", default: I18n.t("ee.upsale.title"))
end

def description
@description || begin
I18n.t("ee.upsale.#{feature_key}.description")
rescue StandardError
I18n.t("ee.upsale.#{feature_key}.description_html")
end
rescue I18n::MissingTranslationData => e
raise e.exception(
<<~TEXT.squish
The expected '#{I18n.locale}.ee.upsale.#{feature_key}.description' key does not exist.
Ideally, provide it in the locale file.
If that isn't applicable, a description parameter needs to be provided.
TEXT
)
end

def link_title
@link_title || I18n.t("ee.upsale.#{feature_key}.link_title", default: I18n.t("ee.upsale.link_title"))
end

def href
href_value = @href || OpenProject::Static::Links.links.dig(:enterprise_docs, feature_key, :href)

unless href_value
raise "Neither a custom href is provided nor is a value set " \
"in OpenProject::Static::Links.enterprise_docs[#{feature_key}][:href]"
end

href_value
end

def render?
!skip_render
end
end
end
68 changes: 68 additions & 0 deletions app/components/enterprise_edition/banner_component.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*!
/ -- copyright
/ OpenProject is an open source project management software.
/ Copyright (C) 2024 the OpenProject GmbH
/
/ This program is free software; you can redistribute it and/or
/ modify it under the terms of the GNU General Public License version 3.
/
/ OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
/ Copyright (C) 2006-2013 Jean-Philippe Lang
/ Copyright (C) 2010-2013 the ChiliProject Team
/
/ This program is free software; you can redistribute it and/or
/ modify it under the terms of the GNU General Public License
/ as published by the Free Software Foundation; either version 2
/ of the License, or (at your option) any later version.
/
/ This program is distributed in the hope that it will be useful,
/ but WITHOUT ANY WARRANTY; without even the implied warranty of
/ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ GNU General Public License for more details.
/
/ You should have received a copy of the GNU General Public License
/ along with this program; if not, write to the Free Software
/ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/
/ See COPYRIGHT and LICENSE files for more details.
/ ++
/
$op-ee-banner--shield-width: 32px

// This is not named op-enterprise-banner because as of now, there is still a legacy angular component that uses that block name.
.op-ee-banner
display: grid
grid-template-columns: $op-ee-banner--shield-width auto auto
grid-template-areas: "icon-container title-container" "icon-container description-container" "icon-container link-container"
grid-column-gap: 0.5rem
justify-content: left
@media screen and (min-width: $breakpoint-md)
grid-template-areas: "icon-container title-container title-container" "icon-container description-container link-container"

&--icon-container
@extend .upsale-colored
align-self: start
justify-self: center

&--shield
@extend .upsale-border-colored
width: $op-ee-banner--shield-width
height: 42px
border-width: 10px 5px 10px 5px
border-radius: 0 0 10px 10px
border-style: solid
display: flex
align-items: center
justify-content: center

&--icon
width: $op-ee-banner--shield-width
height: $op-ee-banner--shield-width

&--title-container
@extend .upsale-colored
font-weight: bold

&--link-container
align-self: end
Loading

0 comments on commit 2ad28a0

Please sign in to comment.