Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Use background image for banner

Oliver Günthera92a91d644ca
diff --git a/app/assets/images/enterprise/exact-time-tracking.png b/app/assets/images/enterprise/exact-time-tracking.png
new file mode 100644
index 00000000000..7ba58341f8d
Binary files /dev/null and b/app/assets/images/enterprise/exact-time-tracking.png differ
diff --git a/app/components/enterprise_edition/banner_component.html.erb b/app/components/enterprise_edition/banner_component.html.erb
index 37c77f2f067..db2499efcb8 100644
--- a/app/components/enterprise_edition/banner_component.html.erb
+++ b/app/components/enterprise_edition/banner_component.html.erb
@@ -46,13 +46,6 @@
end
end
- if medium?
- grid.with_area(:graphic) do
- image_tag @image,
- class: "op-enterprise-banner--image"
- end
- end
-
if @dismissable
grid.with_area(:dismiss) do
classes = medium? ? "op-enterprise-banner--close-icon_hovering" : ""
diff --git a/app/components/enterprise_edition/banner_component.rb b/app/components/enterprise_edition/banner_component.rb
index 81be2a00859..b95589ec9dd 100644
--- a/app/components/enterprise_edition/banner_component.rb
+++ b/app/components/enterprise_edition/banner_component.rb
@@ -35,6 +35,7 @@ module EnterpriseEdition
class BannerComponent < ApplicationComponent
include Primer::FetchOrFallbackHelper
include Primer::ClassNameHelper
+ include Primer::JoinStyleArgumentsHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
include PlanForFeature
@@ -87,6 +88,13 @@ module EnterpriseEdition
super
end
+ def before_render
+ @system_arguments[:style] = join_style_arguments(
+ @system_arguments[:style],
+ medium? ? "background-image: url(#{helpers.image_path(@image)})" : nil
+ )
+ end
+
def medium?
@variant == :medium
end
diff --git a/app/components/enterprise_edition/banner_component.sass b/app/components/enterprise_edition/banner_component.sass
index 52935f0df9c..ad3799c3cd2 100644
--- a/app/components/enterprise_edition/banner_component.sass
+++ b/app/components/enterprise_edition/banner_component.sass
@@ -40,12 +40,16 @@ $op-enterprise-banner-fixed-height: 220px
border-radius: var(--borderRadius-medium)
background: var(--body-background)
padding: var(--base-size-8)
+ overflow: hidden
&_medium
padding: 0
grid-template-areas: "content graphic"
- grid-template-columns: 1fr 1fr
+ grid-template-columns: 2fr 1fr
height: $op-enterprise-banner-fixed-height
+ background-size: contain
+ background-repeat: no-repeat
+ background-position: center right
&_medium &
padding: 0
@@ -56,9 +60,6 @@ $op-enterprise-banner-fixed-height: 220px
align-self: center
padding: var(--base-size-16)
- &--graphic
- height: $op-enterprise-banner-fixed-height
-
&--image
width: 100%
height: 100%
diff --git a/modules/costs/app/views/admin/costs_settings/show.html.erb b/modules/costs/app/views/admin/costs_settings/show.html.erb
index ab34f601b16..df8384eea0c 100644
--- a/modules/costs/app/views/admin/costs_settings/show.html.erb
+++ b/modules/costs/app/views/admin/costs_settings/show.html.erb
@@ -42,32 +42,36 @@ See COPYRIGHT and LICENSE files for more details.
end
%>
-<%=
-render(Primer::Alpha::TabPanels.new(label: I18n.t(:project_module_costs))) do |component|
- component.with_tab(selected: true, id: "tab-time") do |tab|
- tab.with_text { I18n.t(:label_time) }
- tab.with_panel do
- admin_settings_primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|
- render_inline_settings_form(time_form) do |form|
- form.html_content do
- render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|
- subhead.with_heading(size: :medium) { I18n.t(:label_mandatory_fields) }
- subhead.with_description { I18n.t(:description_time_settings) }
+<%= render(Primer::Alpha::TabPanels.new(label: I18n.t(:project_module_costs))) do |component| %>
+ <%= component.with_tab(selected: true, id: "tab-time") do |tab| %>
+ <%= tab.with_text { I18n.t(:label_time) } %>
+ <%= tab.with_panel do %>
+ <%=
+ render(::EnterpriseEdition::BannerComponent.new(:time_entry_time_restrictions,
+ variant: :medium,
+ image: "enterprise/exact-time-tracking.png",
+ dismissable: false))
+ %>
+ <%=
+ admin_settings_primer_form_with(scope: :settings, action: :update, method: :patch) do |time_form|
+ render_inline_settings_form(time_form) do |form|
+ form.html_content do
+ render(Primer::Beta::Subhead.new(hide_border: true)) do |subhead|
+ subhead.with_heading(size: :medium) { I18n.t(:label_mandatory_fields) }
+ subhead.with_description { I18n.t(:description_time_settings) }
+ end
end
- end
-
- form.html_content do
- render(::EnterpriseEdition::BannerComponent.new(:time_entry_time_restrictions, dismissable: false))
- end
- form.check_box(name: :allow_tracking_start_and_end_times)
- form.check_box(name: :enforce_tracking_start_and_end_times, disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions))
+ form.check_box(name: :allow_tracking_start_and_end_times)
+ form.check_box(name: :enforce_tracking_start_and_end_times, disabled: !EnterpriseToken.allows_to?(:time_entry_time_restrictions))
- form.submit
+ form.submit
+ end
end
- end
- end
- end
+ %>
+ <% end %>
+ <% end %>
+<%
component.with_tab(id: "tab-costs") do |tab|
tab.with_text { I18n.t(:label_costs) }
@@ -88,5 +92,5 @@ render(Primer::Alpha::TabPanels.new(label: I18n.t(:project_module_costs))) do |c
end
end
end
-end
+ end
%>