Skip to content

Commit c51d1b9

Browse files
committed
[#66124] [WIP] Lay out Budget widgets
1 parent a23b9e8 commit c51d1b9

File tree

11 files changed

+285
-16
lines changed

11 files changed

+285
-16
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
widget_wrapper do |_container|
32+
helpers.angular_component_tag(
33+
"opce-wp-overview-graph",
34+
inputs: {
35+
"global-scope": true,
36+
"initial-filters": helpers.version_wp_overview_graph_initial_filters(Version.last)
37+
}
38+
)
39+
end
40+
%>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# frozen_string_literal: true
2+
3+
#-- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
#++
30+
31+
module Grids
32+
module Widgets
33+
class ActualCosts < Grids::WidgetComponent
34+
param :project
35+
36+
def title
37+
t('.title')
38+
end
39+
end
40+
end
41+
end
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
widget_wrapper do |_container|
32+
helpers.angular_component_tag(
33+
"opce-wp-overview-graph",
34+
inputs: {
35+
"global-scope": true,
36+
"initial-filters": helpers.version_wp_overview_graph_initial_filters(Version.last)
37+
}
38+
)
39+
end
40+
%>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
module Grids
4+
module Widgets
5+
class BudgetByCostType < Grids::WidgetComponent
6+
param :project
7+
8+
def title
9+
t('.title')
10+
end
11+
end
12+
end
13+
end
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<%#-- copyright
2+
OpenProject is an open source project management software.
3+
Copyright (C) the OpenProject GmbH
4+
5+
This program is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU General Public License version 3.
7+
8+
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
9+
Copyright (C) 2006-2013 Jean-Philippe Lang
10+
Copyright (C) 2010-2013 the ChiliProject Team
11+
12+
This program is free software; you can redistribute it and/or
13+
modify it under the terms of the GNU General Public License
14+
as published by the Free Software Foundation; either version 2
15+
of the License, or (at your option) any later version.
16+
17+
This program is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program; if not, write to the Free Software
24+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25+
26+
See COPYRIGHT and LICENSE files for more details.
27+
28+
++#%>
29+
30+
<%=
31+
widget_wrapper do |_container|
32+
flex_layout(align_items: :center, justify_content: :space_between, style: "gap:1.2rem") do |flex|
33+
flex.with_column(flex: 1) do
34+
render(border_box_container) do |border_box|
35+
border_box.with_header_content(t(".total_actual_costs"))
36+
border_box.with_body do
37+
render(Primer::Beta::Text.new(font_weight: :bold, font_size: 1)) { "€2000" }
38+
end
39+
end
40+
end
41+
42+
flex.with_column(flex: 1) do
43+
render(border_box_container) do |border_box|
44+
border_box.with_header_content(t(".total_planned_budget"))
45+
border_box.with_body do
46+
render(Primer::Beta::Text.new(font_weight: :bold, font_size: 1)) { "€2000" }
47+
end
48+
end
49+
end
50+
51+
flex.with_column(flex: 1) do
52+
render(border_box_container) do |border_box|
53+
border_box.with_header_content(t(".spent_budget"))
54+
border_box.with_body do
55+
render(Primer::Beta::Text.new(font_weight: :bold, font_size: 1)) { "62.5%" }
56+
end
57+
end
58+
end
59+
60+
flex.with_column(flex: 1) do
61+
render(border_box_container) do |border_box|
62+
border_box.with_header_content(t(".remaining_budget"))
63+
border_box.with_body do
64+
render(Primer::Beta::Text.new(font_weight: :bold, font_size: 1)) { "€2000" }
65+
end
66+
end
67+
end
68+
end
69+
end
70+
%>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# frozen_string_literal: true
2+
3+
#-- copyright
4+
# OpenProject is an open source project management software.
5+
# Copyright (C) the OpenProject GmbH
6+
#
7+
# This program is free software; you can redistribute it and/or
8+
# modify it under the terms of the GNU General Public License version 3.
9+
#
10+
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
11+
# Copyright (C) 2006-2013 Jean-Philippe Lang
12+
# Copyright (C) 2010-2013 the ChiliProject Team
13+
#
14+
# This program is free software; you can redistribute it and/or
15+
# modify it under the terms of the GNU General Public License
16+
# as published by the Free Software Foundation; either version 2
17+
# of the License, or (at your option) any later version.
18+
#
19+
# This program is distributed in the hope that it will be useful,
20+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
# GNU General Public License for more details.
23+
#
24+
# You should have received a copy of the GNU General Public License
25+
# along with this program; if not, write to the Free Software
26+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27+
#
28+
# See COPYRIGHT and LICENSE files for more details.
29+
#++
30+
31+
module Grids
32+
module Widgets
33+
class BudgetTotals < Grids::WidgetComponent
34+
param :project
35+
36+
def title
37+
nil
38+
end
39+
40+
def wrapper_arguments
41+
{ content_padding: :none, full_width: true }
42+
end
43+
end
44+
end
45+
end

modules/grids/app/components/grids/widgets/members.html.erb

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,32 @@ See COPYRIGHT and LICENSE files for more details.
3333
flex_layout(style: "gap: var(--base-size-8, 8px)") do |flex|
3434
spacer_component = Primer::Beta::Text.new(mr: 1).with_content(", ")
3535

36-
members_by_role.each_with_index do |role_data, i|
36+
members_by_role.each_with_index do |role_data, _i|
3737
flex.with_row do
3838
render(Primer::Beta::Text.new(font_weight: :semibold)) { role_data[:role].name }
3939
end
4040

4141
flex.with_row(mb: 2) do
4242
concat render(
43-
Users::AvatarComponent
44-
.with_collection(
45-
role_data[:members],
46-
size: :mini,
47-
link: false,
48-
show_name: true,
49-
spacer_component:
50-
)
51-
)
43+
Users::AvatarComponent
44+
.with_collection(
45+
role_data[:members],
46+
size: :mini,
47+
link: false,
48+
show_name: true,
49+
spacer_component:
50+
)
51+
)
5252

5353
if role_data[:has_more]
5454
concat render(
55-
Primer::Beta::Link.new(
56-
href: project_members_path(@project, role_id: role_data[:role].id),
57-
ml: 1,
58-
font_weight: :semibold,
59-
classes: "op-principal"
60-
).with_content(t('.x_more', count: role_data[:remaining])))
55+
Primer::Beta::Link.new(
56+
href: project_members_path(@project, role_id: role_data[:role].id),
57+
ml: 1,
58+
font_weight: :semibold,
59+
classes: "op-principal"
60+
).with_content(t(".x_more", count: role_data[:remaining]))
61+
)
6162
end
6263
end
6364
end

modules/grids/config/locales/en.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ en:
33
label_widget_in_grid: "Widget contained in Grid %{grid_name}"
44

55
widgets:
6+
actual_costs:
7+
title: "Actual costs"
8+
budget_totals:
9+
title: "Budget totals"
10+
remaining_budget: "Remaining budget"
11+
spent_budget: "Spent budget"
12+
total_actual_costs: "Total actual costs"
13+
total_planned_budget: "Total planned budget"
14+
budget_by_cost_type:
15+
title: "Budget by cost type"
616
subitems:
717
title: "Subitems"
818
no_results: "There are no visible children."

modules/overviews/app/components/overviews/workspaces/portfolio_overview_grid_component.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ See COPYRIGHT and LICENSE files for more details.
3333
grid.with_widget(Grids::Widgets::ProjectStatus, @portfolio)
3434
grid.with_widget(Grids::Widgets::Subitems, @portfolio)
3535
grid.with_widget(Grids::Widgets::Members, @portfolio)
36+
grid.with_widget(Grids::Widgets::BudgetTotals, @portfolio)
37+
grid.with_widget(Grids::Widgets::BudgetByCostType, @portfolio)
38+
grid.with_widget(Grids::Widgets::ActualCosts, @portfolio)
3639
end
3740
%>

modules/overviews/app/components/overviews/workspaces/program_overview_grid_component.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ See COPYRIGHT and LICENSE files for more details.
3333
grid.with_widget(Grids::Widgets::ProjectStatus, @program)
3434
grid.with_widget(Grids::Widgets::Subitems, @program)
3535
grid.with_widget(Grids::Widgets::Members, @program)
36+
grid.with_widget(Grids::Widgets::BudgetTotals, @program)
37+
grid.with_widget(Grids::Widgets::BudgetByCostType, @program)
38+
grid.with_widget(Grids::Widgets::ActualCosts, @program)
3639
end
3740
%>

0 commit comments

Comments
 (0)