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

harmonize header of classical widget and grid

ulferts2690759a31d6
diff --git a/app/assets/stylesheets/content/_grid.sass b/app/assets/stylesheets/content/_grid.sass
index 5c23d40f262..46e602ce3e9 100644
--- a/app/assets/stylesheets/content/_grid.sass
+++ b/app/assets/stylesheets/content/_grid.sass
@@ -69,16 +69,6 @@ $grid--widget-padding: 20px
.widget-box--header
display: flex
- .widget-box--header-title
- flex-grow: 1
- align-self: center
-
- // Ensure style for read-only widget headers
- .editable-toolbar-title--fixed
- color: #5F5F5F
- font-size: 18px
- font-weight: normal
-
icon-triggered-context-menu
visibility: hidden
@@ -133,12 +123,8 @@ $grid--widget-padding: 20px
height: 100%
input[type="text"].toolbar--editable-toolbar
- font-size: 18px
font-weight: normal
- .title-container
- margin-bottom: 0px
-
.grid--widget-content
height: 100%
overflow-x: auto
diff --git a/app/assets/stylesheets/content/_widget_box.sass b/app/assets/stylesheets/content/_widget_box.sass
index b50edcee9e9..fbdef2c11c3 100644
--- a/app/assets/stylesheets/content/_widget_box.sass
+++ b/app/assets/stylesheets/content/_widget_box.sass
@@ -64,7 +64,7 @@ $widget-box--enumeration-width: 20px
.widget-box
position: relative
@include widget-box--style
- padding: 10px 20px 30px 20px
+ padding: 20px
min-height: 250px
word-wrap: break-word
overflow: hidden
@@ -79,18 +79,6 @@ $widget-box--enumeration-width: 20px
padding: 0
border: 0
- .widget-box--header
- font-weight: bold
- font-size: 1.25rem
- border: none
-
- .widget-box--header-title
- vertical-align: middle
- .icon:before,
- .icon-context:before
- display: inline-block
- padding-top: 0
- vertical-align: middle
.widget-box--enumeration
margin-left: 1.5rem
@@ -120,6 +108,30 @@ $widget-box--enumeration-width: 20px
margin-left: auto
margin-right: auto
+.widget-box--header
+ font-weight: bold
+ font-size: 1.25rem
+ display: flex
+
+.widget-box--header-title
+ vertical-align: middle
+ margin-bottom: 0
+ flex-grow: 1
+ align-self: center
+
+ .widget-box--header-icon + &
+ padding-left: 5px
+
+ // Ensure style for read-only widget headers
+ .editable-toolbar-title--fixed
+ color: #5F5F5F
+ font-size: 20px
+ font-weight: normal
+
+.widget-box--header-icon
+ align-self: center
+ line-height: 28px
+
.widget-box--additional-info
font-style: italic
margin-bottom: 0.5rem
diff --git a/app/helpers/homescreen_helper.rb b/app/helpers/homescreen_helper.rb
index 9232bd60a36..7668b3db09b 100644
--- a/app/helpers/homescreen_helper.rb
+++ b/app/helpers/homescreen_helper.rb
@@ -40,12 +40,6 @@ module HomescreenHelper
op_icon('icon-context icon-enterprise')
end
- ##
- # Returns the user avatar or a default image
- def homescreen_user_avatar
- op_icon('icon-context icon-user')
- end
-
##
# Render a static link defined in OpenProject::Static::Links
def static_link_to(key)
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index e1f32fbe485..c7e3f3125cf 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -98,6 +98,12 @@ module UsersHelper
result
end
+ ##
+ # Returns the user avatar or a default image
+ def user_avatar_icon
+ op_icon('icon-context icon-user')
+ end
+
def change_user_status_buttons(user)
build_change_user_status_action(user) do |title, name|
submit_tag(title, name: name, class: 'button')
diff --git a/app/views/homescreen/blocks/_administration.html.erb b/app/views/homescreen/blocks/_administration.html.erb
index 92bb5f8b8ed..75f71e37c5b 100644
--- a/app/views/homescreen/blocks/_administration.html.erb
+++ b/app/views/homescreen/blocks/_administration.html.erb
@@ -1,7 +1,4 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-context icon-settings') %>
- <span class="widget-box--header-title"><%= l(:label_administration) %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'settings', title: t(:label_administration) %>
<ul class="widget-box--arrow-links">
<li>
diff --git a/app/views/homescreen/blocks/_community.html.erb b/app/views/homescreen/blocks/_community.html.erb
index ebe75733ae0..4938bc68fa9 100644
--- a/app/views/homescreen/blocks/_community.html.erb
+++ b/app/views/homescreen/blocks/_community.html.erb
@@ -1,7 +1,4 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-context icon-openproject') %>
- <span class="widget-box--header-title"><%= l('homescreen.blocks.community') %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'openproject', title: t('homescreen.blocks.community') %>
<ul class="widget-box--arrow-links">
<li>
diff --git a/app/views/homescreen/blocks/_header.html.erb b/app/views/homescreen/blocks/_header.html.erb
new file mode 100644
index 00000000000..2a657969526
--- /dev/null
+++ b/app/views/homescreen/blocks/_header.html.erb
@@ -0,0 +1,6 @@
+<h3 class="widget-box--header">
+ <%= op_icon("icon-context icon-#{icon} widget-box--header-icon") %>
+ <div class="widget-box--header-title title-container">
+ <h2 class="editable-toolbar-title--fixed"><%= title %></h2>
+ </div>
+</h3>
diff --git a/app/views/homescreen/blocks/_my_account.html.erb b/app/views/homescreen/blocks/_my_account.html.erb
index 460bbe0f0bf..e39e03121d1 100644
--- a/app/views/homescreen/blocks/_my_account.html.erb
+++ b/app/views/homescreen/blocks/_my_account.html.erb
@@ -1,7 +1,4 @@
-<h3 class="widget-box--header">
- <%= homescreen_user_avatar %>
- <span class="widget-box--header-title"><%= l(:label_my_account) %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'user', title: t('label_my_account') %>
<ul class="widget-box--arrow-links">
<li>
diff --git a/app/views/homescreen/blocks/_new_features.html.erb b/app/views/homescreen/blocks/_new_features.html.erb
index 61a823a0629..e2588a89fa0 100644
--- a/app/views/homescreen/blocks/_new_features.html.erb
+++ b/app/views/homescreen/blocks/_new_features.html.erb
@@ -1,6 +1,3 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-star') %>
- <span class="widget-box--header-title"><%= t(:label_new_features) %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'star', title: t(:label_new_features) %>
<homescreen-new-features-block></homescreen-new-features-block>
diff --git a/app/views/homescreen/blocks/_news.html.erb b/app/views/homescreen/blocks/_news.html.erb
index b7779499ee2..81eda8f6f4a 100644
--- a/app/views/homescreen/blocks/_news.html.erb
+++ b/app/views/homescreen/blocks/_news.html.erb
@@ -1,7 +1,4 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-context icon-news') %>
- <span class="widget-box--header-title"><%= l(:label_news_latest) %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'news', title: t(:label_news_latest) %>
<% unless @news.empty? %>
<ul class="widget-box--arrow-links">
diff --git a/app/views/homescreen/blocks/_projects.html.erb b/app/views/homescreen/blocks/_projects.html.erb
index 9e735ec48a1..ee4e4482743 100644
--- a/app/views/homescreen/blocks/_projects.html.erb
+++ b/app/views/homescreen/blocks/_projects.html.erb
@@ -1,7 +1,4 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-context icon-projects') %>
- <span class="widget-box--header-title"><%= l(:label_project_plural) %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'projects', title: t(:label_project_plural) %>
<% if @newest_projects.empty? %>
<p class="widget-box--additional-info">
diff --git a/app/views/homescreen/blocks/_upsale.html.erb b/app/views/homescreen/blocks/_upsale.html.erb
index 558876ad0e2..9985ad2b9c8 100644
--- a/app/views/homescreen/blocks/_upsale.html.erb
+++ b/app/views/homescreen/blocks/_upsale.html.erb
@@ -1,7 +1,4 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-context icon-cart') %>
- <span class="widget-box--header-title"><%= t('homescreen.blocks.upsale.title') %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'cart', title: t('homescreen.blocks.upsale.title') %>
<%= image_tag "enterprise_edition.png", class: "widget-box--teaser-image" %>
diff --git a/app/views/homescreen/blocks/_users.html.erb b/app/views/homescreen/blocks/_users.html.erb
index 58648dcf9e3..a966fd65f9b 100644
--- a/app/views/homescreen/blocks/_users.html.erb
+++ b/app/views/homescreen/blocks/_users.html.erb
@@ -1,7 +1,5 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-context icon-group') %>
- <span class="widget-box--header-title"><%= l(:label_user_plural) %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'group', title: t(:label_user_plural) %>
+
<p class="widget-box--additional-info"><%= l('homescreen.additional.users') %></p>
<% unless @newest_users.empty? %>
diff --git a/app/views/homescreen/blocks/_welcome.html.erb b/app/views/homescreen/blocks/_welcome.html.erb
index ec296f08773..b74d7a2c299 100644
--- a/app/views/homescreen/blocks/_welcome.html.erb
+++ b/app/views/homescreen/blocks/_welcome.html.erb
@@ -1,7 +1,5 @@
-<h3 class="widget-box--header">
- <%= op_icon('icon-context icon-projects') %>
- <span class="widget-box--header-title"><%= Setting.welcome_title.presence || organization_name %></span>
-</h3>
+<%= render 'homescreen/blocks/header', icon: 'projects', title: Setting.welcome_title.presence || organization_name %>
+
<div class="wiki">
<%= format_text(Setting.welcome_text, headings: false) %>
</div>
diff --git a/app/views/onboarding/_configuration_modal.html.erb b/app/views/onboarding/_configuration_modal.html.erb
index 6c8d0bd869c..343f18ea31c 100644
--- a/app/views/onboarding/_configuration_modal.html.erb
+++ b/app/views/onboarding/_configuration_modal.html.erb
@@ -31,7 +31,7 @@ See docs/COPYRIGHT.rdoc for more details.
<%= labelled_tabular_form_for current_user, url: { action: 'user_settings', controller: 'onboarding' }, html: { id: 'user-form' } do |f| %>
<div class="onboarding--start-modal">
<div class="onboarding--top-menu op-modal--modal-header">
- <%= homescreen_user_avatar %>
+ <%= user_avatar_icon %>
<h2><%= I18n.t('onboarding.welcome') %>, <%= current_user.name %></h2>
<a class="op-modal--modal-close-button dynamic-content-modal--close-button"
title="<%= t('js.close_popup_title') %>"
diff --git a/app/views/onboarding/_onboarding_video_modal.html.erb b/app/views/onboarding/_onboarding_video_modal.html.erb
index 80289aff0e0..d8af7e63a9f 100644
--- a/app/views/onboarding/_onboarding_video_modal.html.erb
+++ b/app/views/onboarding/_onboarding_video_modal.html.erb
@@ -30,7 +30,7 @@ See docs/COPYRIGHT.rdoc for more details.
<div class="modal-wrapper--content">
<div class="onboarding--start-modal">
<div class="onboarding--top-menu op-modal--modal-header">
- <%= homescreen_user_avatar %>
+ <%= user_avatar_icon %>
<h2><%= I18n.t('onboarding.welcome') %></h2>
<a class="op-modal--modal-close-button dynamic-content-modal--close-button"
title="<%= t('js.close_popup_title') %>"
diff --git a/frontend/src/app/modules/grids/widgets/header/header.component.sass b/frontend/src/app/modules/grids/widgets/header/header.component.sass
index 256bbfe126b..30104095955 100644
--- a/frontend/src/app/modules/grids/widgets/header/header.component.sass
+++ b/frontend/src/app/modules/grids/widgets/header/header.component.sass
@@ -5,10 +5,7 @@
margin-top: 0
.widget-box--header-icon
- padding-top: 5px
-
-.widget-box--header-icon
- align-self: center
+ line-height: 34px
.widget-box--header-title
padding-right: 5px