-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into implementation/59988-on-mweb-there-is-no-remi…
…nder-set-status-shown
- Loading branch information
Showing
449 changed files
with
6,574 additions
and
1,957 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/components/enterprise_edition/banner_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.