Skip to content

Commit

Permalink
Replace some more PageHeaders with the Primer component
Browse files Browse the repository at this point in the history
  • Loading branch information
HDinger committed Nov 25, 2024
1 parent a581547 commit 087dad8
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 31 deletions.
10 changes: 9 additions & 1 deletion app/views/account/lost_password.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_password_lost) %>
<%= toolbar title: t(:label_password_lost) %>

<%=
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t(:label_password_lost) }
header.with_breadcrumbs([{ href: home_path, text: organization_name },
t(:label_password_lost)])
end
%>

<section class="form--section">
<%= styled_form_tag({action: "lost_password"}) do %>
<div class="form--field -required">
Expand Down
10 changes: 9 additions & 1 deletion app/views/account/password_recovery.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title t(:label_password_lost) %>
<%= toolbar title: t(:label_password_lost) %>

<%=
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t(:label_password_lost) }
header.with_breadcrumbs([{ href: home_path, text: organization_name },
t(:label_password_lost)])
end
%>

<%= error_messages_for 'user' %>
<%= styled_form_tag({token: @token.value}, autocomplete: 'off') do %>
<section class="form--section">
Expand Down
11 changes: 10 additions & 1 deletion app/views/colors/confirm_destroy.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
<%= toolbar title: @color.name %>

<%=
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { @color.name }
header.with_breadcrumbs([{ href: admin_index_path, text: t(:label_administration) },
{ href: colors_path, text: t(:label_color_plural) },
@color.name])
end
%>

<%= labelled_tabular_form_for @color,
url: color_url(@color),
html: {method: 'delete'},
Expand Down
2 changes: 1 addition & 1 deletion app/views/messages/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name },
{ href: project_forums_path(@project), text: t(:label_forum_plural) },
{ href: project_forum_path(@project, @forum), text: @forum.name },
"#{ @message.subject }: <b>#{t(:label_edit)}</b>".html_safe], selected_item_font_weight: :normal)
@message.subject])
end %>

<%= labelled_tabular_form_for @message,
Expand Down
10 changes: 9 additions & 1 deletion modules/budgets/app/views/budgets/destroy_info.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ See COPYRIGHT and LICENSE files for more details.
++#%>

<% html_title "#{t(:button_delete)} #{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %>
<%= toolbar title: "#{t(:button_delete)} #{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %>

<%=
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { "#{t(:button_delete)} #{@budget.subject}" }
header.with_breadcrumbs([{href: project_overview_path(@project.identifier), text: @project.name},
{href: projects_budgets_path(@project.identifier), text: I18n.t(:label_budget_plural)},
"#{t(:button_delete)} #{@budget.subject}"])
end
%>

<%= styled_form_tag(budget_path(@budget), method: :delete) do %>
<section class="form--section">
Expand Down
18 changes: 17 additions & 1 deletion modules/costs/app/views/hourly_rates/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,23 @@ See COPYRIGHT and LICENSE files for more details.

<% html_title t(:label_administration), "#{t(:label_edit)} #{I18n.t((@project.nil? ? :caption_default_rate_history_for : :caption_rate_history_for), user: ' ')} #{@user.name}" %>

<%= toolbar title: (@project.nil? ? t(:caption_default_rate_history_for, user: @user.name) : t(:caption_rate_history_for_project, user: @user.name, project: @project.name) ) %>
<%
breadcrumb_items = if @project
[{href: project_overview_path(@project.identifier), text: @project.name},
{href: projects_budgets_path(@project.identifier), text: I18n.t(:label_budget_plural)}]
else
[{ href: home_path, text: organization_name}]
end
%>

<%=
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t(:caption_default_rate_history_for, user: @user.name) }
header.with_breadcrumbs([*(breadcrumb_items),
t(:caption_default_rate_history_for, user: @user.name)])
end
%>


<%- default_rate = @user.current_default_rate -%>
<% if default_rate%>
Expand Down
19 changes: 16 additions & 3 deletions modules/costs/app/views/hourly_rates/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,28 @@ See COPYRIGHT and LICENSE files for more details.

<% html_title t(:label_administration), t(:caption_rate_history_for, user: @user.name) %>

<%= toolbar title: t(:caption_rate_history_for, :user => @user.name) %>
<%
breadcrumb_items = if @project
[{href: project_overview_path(@project.identifier), text: @project.name},
{href: projects_budgets_path(@project.identifier), text: I18n.t(:label_budget_plural)}]
else
[{ href: home_path, text: organization_name}]
end
%>

<%=
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t(:caption_default_rate_history_for, user: @user.name) }
header.with_breadcrumbs([*(breadcrumb_items),
t(:caption_default_rate_history_for, user: @user.name)])
end
%>

<% if @project %>
<% html_title t(:caption_rate_history_for, user: @user.name) %>

<%= render :partial => 'list_project' %>
<% else %>
<% html_title t(:label_administration), t(:caption_rate_history_for, user: @user.name) %>

<%= render :partial => 'list_default' %>
<%= render :partial => 'list' %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
t('two_factor_authentication.devices.add_new')])
end
%>
<%= toolbar title: t('two_factor_authentication.devices.add_new') %>

<div class="mobile-otp-new-devices">
<% @available_devices.each do |key, device_class| %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,21 @@
</section>

<section class="admin--edit-section">
<%= toolbar title: t('two_factor_authentication.label_devices') do %>
<% unless devices.empty? %>
<li class="toolbar-item">
<%= link_to delete_all_user_2fa_devices_path(@user),
method: :post,
data: { confirm: t('two_factor_authentication.admin.delete_all_are_you_sure') },
class: "button -danger" do %>
<%= op_icon 'button--icon icon-delete' %>
<span class="button--text"><%= t 'two_factor_authentication.admin.button_delete_all_devices' %></span>
<% end %>
</li>
<% end %>
<% if ::OpenProject::TwoFactorAuthentication::TokenStrategyManager.admin_register_sms_strategy.present? %>
<li class="toolbar-item">
<%= link_to new_user_2fa_device_path(@user, type: :sms), class: 'button -primary' do %>
<%= op_icon 'button--icon icon-add' %>
<span class="button--text"><%= t 'two_factor_authentication.admin.button_register_mobile_phone_for_user' %></span>
<% end %>
</li>
<% end %>
<% unless devices.empty? %>
<%= link_to delete_all_user_2fa_devices_path(@user),
method: :post,
data: { confirm: t('two_factor_authentication.admin.delete_all_are_you_sure') },
class: "button -danger" do %>
<%= op_icon 'button--icon icon-delete' %>
<span class="button--text"><%= t 'two_factor_authentication.admin.button_delete_all_devices' %></span>
<% end %>
<% end %>
<% if ::OpenProject::TwoFactorAuthentication::TokenStrategyManager.admin_register_sms_strategy.present? %>
<%= link_to new_user_2fa_device_path(@user, type: :sms), class: 'button -primary' do %>
<%= op_icon 'button--icon icon-add' %>
<span class="button--text"><%= t 'two_factor_authentication.admin.button_register_mobile_phone_for_user' %></span>
<% end %>
<% end %>

<%= render ::TwoFactorAuthentication::Devices::TableComponent.new(rows: devices, admin_table: true || @user != User.current) %>
</div>
</section>

0 comments on commit 087dad8

Please sign in to comment.