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

erb_lint auto fix part of style 1/3

Ivan Kuchin7c24cf604838
diff --git a/app/components/attribute_help_texts/index_page_header_component.html.erb b/app/components/attribute_help_texts/index_page_header_component.html.erb
index 602390526de..ae9aa78a362 100644
--- a/app/components/attribute_help_texts/index_page_header_component.html.erb
+++ b/app/components/attribute_help_texts/index_page_header_component.html.erb
@@ -31,12 +31,14 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { I18n.t(:"attribute_help_texts.label_plural") }
header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: :normal)
- header.with_tab_nav(label: nil) do |tab_nav|
- @tabs.each do |tab|
- tab_nav.with_tab(selected: currently_selected_tab == tab, href: tab[:path]) do |t|
- t.with_text { I18n.t(tab[:label]) }
+ if @tabs.present?
+ header.with_tab_nav(label: nil) do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: currently_selected_tab == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t(tab[:label]) }
+ end
end
end
- end if @tabs.present?
+ end
end
%>
diff --git a/app/components/custom_fields/index_page_header_component.html.erb b/app/components/custom_fields/index_page_header_component.html.erb
index f91e3f13d79..d865ec68f3f 100644
--- a/app/components/custom_fields/index_page_header_component.html.erb
+++ b/app/components/custom_fields/index_page_header_component.html.erb
@@ -31,12 +31,14 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { I18n.t(:label_custom_field_plural) }
header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: :normal)
- header.with_tab_nav(label: nil, test_selector: "custom-fields--tab-nav") do |tab_nav|
- @tabs.each do |tab|
- tab_nav.with_tab(selected: currently_selected_tab == tab, href: tab[:path]) do |t|
- t.with_text { I18n.t(tab[:label]) }
+ if @tabs.present?
+ header.with_tab_nav(label: nil, test_selector: "custom-fields--tab-nav") do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: currently_selected_tab == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t(tab[:label]) }
+ end
end
end
- end if @tabs.present?
+ end
end
%>
diff --git a/app/components/groups/edit_page_header_component.html.erb b/app/components/groups/edit_page_header_component.html.erb
index 1ceaa46e320..fa6d94f276c 100644
--- a/app/components/groups/edit_page_header_component.html.erb
+++ b/app/components/groups/edit_page_header_component.html.erb
@@ -64,12 +64,14 @@ See COPYRIGHT and LICENSE files for more details.
end
end
- header.with_tab_nav(label: nil) do |tab_nav|
- @tabs.each do |tab|
- tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
- t.with_text { I18n.t("js.#{tab[:label]}") }
+ if @tabs.present?
+ header.with_tab_nav(label: nil) do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t("js.#{tab[:label]}") }
+ end
end
end
- end if @tabs.present?
+ end
end
%>
diff --git a/app/components/placeholder_users/edit_page_header_component.html.erb b/app/components/placeholder_users/edit_page_header_component.html.erb
index d69189005cb..559f0a885ac 100644
--- a/app/components/placeholder_users/edit_page_header_component.html.erb
+++ b/app/components/placeholder_users/edit_page_header_component.html.erb
@@ -63,12 +63,14 @@ See COPYRIGHT and LICENSE files for more details.
end
end
- header.with_tab_nav(label: nil) do |tab_nav|
- @tabs.each do |tab|
- tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
- t.with_text { I18n.t("js.#{tab[:label]}") }
+ if @tabs.present?
+ header.with_tab_nav(label: nil) do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t("js.#{tab[:label]}") }
+ end
end
end
- end if @tabs.present?
+ end
end
%>
diff --git a/app/components/projects/index_sub_header_component.html.erb b/app/components/projects/index_sub_header_component.html.erb
index 158ebd120df..949586caf4b 100644
--- a/app/components/projects/index_sub_header_component.html.erb
+++ b/app/components/projects/index_sub_header_component.html.erb
@@ -17,18 +17,20 @@
render(Projects::ProjectFilterButtonComponent.new(query: @query, disabled: @disable_buttons))
end
- subheader.with_action_button(
- tag: :a,
- href: new_project_path,
- scheme: :primary,
- disabled: @disable_buttons,
- size: :medium,
- aria: { label: I18n.t(:label_project_new) },
- data: { 'test-selector': "project-new-button" }
- ) do |button|
- button.with_leading_visual_icon(icon: :plus)
- Project.model_name.human
- end if @current_user.allowed_globally?(:add_project)
+ if @current_user.allowed_globally?(:add_project)
+ subheader.with_action_button(
+ tag: :a,
+ href: new_project_path,
+ scheme: :primary,
+ disabled: @disable_buttons,
+ size: :medium,
+ aria: { label: I18n.t(:label_project_new) },
+ data: { 'test-selector': "project-new-button" }
+ ) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ Project.model_name.human
+ end
+ end
subheader.with_bottom_pane_component(mt: 0) do
render(Projects::ProjectsFiltersComponent.new(query: @query))
diff --git a/app/components/projects/settings/project_custom_field_sections/index_page_header_component.html.erb b/app/components/projects/settings/project_custom_field_sections/index_page_header_component.html.erb
index 8d21ab6761b..51fb1e74bcc 100644
--- a/app/components/projects/settings/project_custom_field_sections/index_page_header_component.html.erb
+++ b/app/components/projects/settings/project_custom_field_sections/index_page_header_component.html.erb
@@ -1,11 +1,11 @@
<%= render Primer::OpenProject::PageHeader.new do |header| %>
<%= header.with_title { t("projects.settings.project_custom_fields.header.title") } %>
- <%= header.with_description {
+ <%= header.with_description do
t(
"projects.settings.project_custom_fields.header.description_html",
overview_url: project_path(project),
admin_settings_url: admin_settings_project_custom_fields_path
)
- } %>
+ end %>
<%= header.with_breadcrumbs(breadcrumb_items) %>
<% end %>
diff --git a/app/components/types/edit_page_header_component.html.erb b/app/components/types/edit_page_header_component.html.erb
index 27e38756b3c..ae9f50512ba 100644
--- a/app/components/types/edit_page_header_component.html.erb
+++ b/app/components/types/edit_page_header_component.html.erb
@@ -32,12 +32,14 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { @type.name }
header.with_breadcrumbs(breadcrumb_items)
- header.with_tab_nav(label: nil) do |tab_nav|
- @tabs.each do |tab|
- tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
- t.with_text { I18n.t(tab[:label]) }
+ if @tabs.present?
+ header.with_tab_nav(label: nil) do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t(tab[:label]) }
+ end
end
end
- end if @tabs.present?
+ end
end
%>
diff --git a/app/components/users/edit_page_header_component.html.erb b/app/components/users/edit_page_header_component.html.erb
index 092887dd6af..ccdb9aaf95b 100644
--- a/app/components/users/edit_page_header_component.html.erb
+++ b/app/components/users/edit_page_header_component.html.erb
@@ -97,12 +97,14 @@ See COPYRIGHT and LICENSE files for more details.
end
end
- header.with_tab_nav(label: nil) do |tab_nav|
- @tabs.each do |tab|
- tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
- t.with_text { I18n.t("js.#{tab[:label]}") }
+ if @tabs.present?
+ header.with_tab_nav(label: nil) do |tab_nav|
+ @tabs.each do |tab|
+ tab_nav.with_tab(selected: selected_tab(@tabs) == tab, href: tab[:path]) do |t|
+ t.with_text { I18n.t("js.#{tab[:label]}") }
+ end
end
end
- end if @tabs.present?
+ end
end
%>
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.html.erb b/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
index e4118e12793..c1dcbc7499f 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.html.erb
@@ -19,16 +19,10 @@
render_details(details_container)
end
else
- if has_details?
- if journal.notes.present?
- render_details(details_container)
- else
- render_details_header(details_container)
- render_details(details_container)
- end
- else
- render_details(details_container)
+ if has_details? && !journal.notes.present?
+ render_details_header(details_container)
end
+ render_details(details_container)
end
end
end
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index d8313a45edc..bfe068e77f1 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -61,16 +61,18 @@ See COPYRIGHT and LICENSE files for more details.
) %>
</div>
<div style="float:right;">
- <%= link_to_content_update(
- t(:label_next),
- {
- from: (@date_to + @days - 1),
- with_subprojects: @with_subprojects ? "1" : "0",
- user_id: params[:user_id]
- }.compact,
- { title: t(:label_date_from_to, start: format_date(@date_to), end: format_date(@date_to + @days - 1)),
- class: "navigate-right" }
- ) unless @date_to >= Date.today %>
+ <%= unless @date_to >= Date.today
+ link_to_content_update(
+ t(:label_next),
+ {
+ from: (@date_to + @days - 1),
+ with_subprojects: @with_subprojects ? "1" : "0",
+ user_id: params[:user_id]
+ }.compact,
+ { title: t(:label_date_from_to, start: format_date(@date_to), end: format_date(@date_to + @days - 1)),
+ class: "navigate-right" }
+ )
+ end %>
</div>
&nbsp;
<%= other_formats_links do |f| %>
diff --git a/app/views/admin/custom_fields/custom_field_projects/index.html.erb b/app/views/admin/custom_fields/custom_field_projects/index.html.erb
index 97b7fb11fd2..f66a2cec7e0 100644
--- a/app/views/admin/custom_fields/custom_field_projects/index.html.erb
+++ b/app/views/admin/custom_fields/custom_field_projects/index.html.erb
@@ -39,21 +39,23 @@ See COPYRIGHT and LICENSE files for more details.
%>
<%=
- render(Primer::OpenProject::SubHeader.new(test_selector: "add-projects-sub-header")) do |component|
- component.with_action_component do
- render(
- Primer::Beta::Button.new(
- scheme: :primary,
- tag: :a,
- href: new_custom_field_project_path(@custom_field),
- data: { controller: "async-dialog" }
- )
- ) do |button|
- button.with_leading_visual_icon(icon: "op-include-projects")
- I18n.t(:label_add_projects)
+ unless @custom_field.is_for_all?
+ render(Primer::OpenProject::SubHeader.new(test_selector: "add-projects-sub-header")) do |component|
+ component.with_action_component do
+ render(
+ Primer::Beta::Button.new(
+ scheme: :primary,
+ tag: :a,
+ href: new_custom_field_project_path(@custom_field),
+ data: { controller: "async-dialog" }
+ )
+ ) do |button|
+ button.with_leading_visual_icon(icon: "op-include-projects")
+ I18n.t(:label_add_projects)
+ end
end
end
- end unless @custom_field.is_for_all?
+ end
%>
<%=
diff --git a/app/views/admin/settings/project_custom_fields/project_mappings.html.erb b/app/views/admin/settings/project_custom_fields/project_mappings.html.erb
index 44d55eea517..ae054b4369c 100644
--- a/app/views/admin/settings/project_custom_fields/project_mappings.html.erb
+++ b/app/views/admin/settings/project_custom_fields/project_mappings.html.erb
@@ -37,21 +37,23 @@ See COPYRIGHT and LICENSE files for more details.
%>
<%=
- render(Primer::OpenProject::SubHeader.new(test_selector: "add-projects-sub-header")) do |component|
- component.with_action_component do
- render(
- Primer::Beta::Button.new(
- scheme: :primary,
- tag: :a,
- href: new_link_admin_settings_project_custom_field_path(@custom_field),
- data: { controller: "async-dialog" }
- )
- ) do |button|
- button.with_leading_visual_icon(icon: "op-include-projects")
- I18n.t(:label_add_projects)
+ unless @custom_field.required?
+ render(Primer::OpenProject::SubHeader.new(test_selector: "add-projects-sub-header")) do |component|
+ component.with_action_component do
+ render(
+ Primer::Beta::Button.new(
+ scheme: :primary,
+ tag: :a,
+ href: new_link_admin_settings_project_custom_field_path(@custom_field),
+ data: { controller: "async-dialog" }
+ )
+ ) do |button|
+ button.with_leading_visual_icon(icon: "op-include-projects")
+ I18n.t(:label_add_projects)
+ end
end
end
- end unless @custom_field.required?
+ end
%>
<%=
diff --git a/app/views/common/list_attachments.json.erb b/app/views/common/list_attachments.json.erb
index 3b5ecbd988d..f8f26dad3fb 100644
--- a/app/views/common/list_attachments.json.erb
+++ b/app/views/common/list_attachments.json.erb
@@ -28,10 +28,10 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%= attachments.select { |a| a.readable? and a.visible? }
- .map { |a|
+ .map do |a|
{ content_type: CGI::escape_html(a.content_type),
filename: CGI::escape_html(a.filename),
description: CGI::escape_html(a.description),
url: url_for(controller: "/attachments", action: "show", id: a, filename: a.filename),
is_image: !!a.image? } # doing the !! as image? for whatever reason returns null or a number
- }.to_json.html_safe %>
+ end.to_json.html_safe %>
diff --git a/app/views/enterprises/_current.html.erb b/app/views/enterprises/_current.html.erb
index 40fb2783375..4a0ae52a6bb 100644
--- a/app/views/enterprises/_current.html.erb
+++ b/app/views/enterprises/_current.html.erb
@@ -5,7 +5,7 @@
data-domain="<%= @current_token.try(:domain) %>"
data-user-count="<%= @current_token.restrictions.nil? ? t("js.admin.enterprise.upsale.unlimited") : @current_token.restrictions[:active_user_count] %>"
data-starts-at="<%= format_date @current_token.starts_at %>"
- data-expires-at="<%= (!@current_token.will_expire?) ? t("js.admin.enterprise.upsale.unlimited") : (format_date @current_token.expires_at) %>"
+ data-expires-at="<%= (@current_token.will_expire?) ? (format_date @current_token.expires_at) : t("js.admin.enterprise.upsale.unlimited") %>"
data-is-expired="<%= @current_token.expired?(reprieve: false) %>"
data-reprieve-days-left="<%= @current_token.reprieve_days_left %>">
</opce-enterprise-active-saved-trial>
diff --git a/app/views/highlighting/styles.css.erb b/app/views/highlighting/styles.css.erb
index 468fe82d0e4..6a6f835c6fb 100644
--- a/app/views/highlighting/styles.css.erb
+++ b/app/views/highlighting/styles.css.erb
@@ -5,7 +5,7 @@
<%# Color coded icons %>
<%= resource_color_css("life_cycle_step_definition", Project::LifeCycleStepDefinition, inline_foreground: true) %>
-<%= color_css() %>
+<%= color_css %>
<%# Overdue tasks %>
.__hl_date_due_today { color: #F76707 !important; }
diff --git a/app/views/projects/settings/repository/_vendor_form.html.erb b/app/views/projects/settings/repository/_vendor_form.html.erb
index 681aa98e5d2..6f1727d1c04 100644
--- a/app/views/projects/settings/repository/_vendor_form.html.erb
+++ b/app/views/projects/settings/repository/_vendor_form.html.erb
@@ -37,7 +37,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field-container">
<%= styled_radio_button_tag "scm_type",
type,
- scm_types.length == 1 ? true : false,
+ scm_types.length == 1,
id: type,
autofocus: true,
data: {
diff --git a/app/views/projects/settings/repository/shared/_managed.html.erb b/app/views/projects/settings/repository/shared/_managed.html.erb
index 3d3ad35d0b1..a46dc47797b 100644
--- a/app/views/projects/settings/repository/shared/_managed.html.erb
+++ b/app/views/projects/settings/repository/shared/_managed.html.erb
@@ -44,8 +44,11 @@ See COPYRIGHT and LICENSE files for more details.
<%= form.text_field(
:url,
label: t("repositories.managed_url"),
- value: repository.new_record? ? repository.managed_repository_url :
- repository.url,
+ value: if repository.new_record?
+ repository.managed_repository_url
+ else
+ repository.url
+ end,
disabled: true,
"aria-disabled" => true,
container_class: "-wide"
diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb
index d265e8cd2c1..c8a2d6e27b4 100644
--- a/app/views/repositories/_dir_list_content.html.erb
+++ b/app/views/repositories/_dir_list_content.html.erb
@@ -81,7 +81,9 @@ See COPYRIGHT and LICENSE files for more details.
<% changeset = @project.repository.find_changeset_by_name(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
<td class="revision"><%= link_to_revision(changeset, @project) if changeset %></td>
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
- <td class="author"><%= changeset.nil? ? h(replace_invalid_utf8(entry.lastrev.author.to_s.split("<").first)) : h(changeset.author) if entry.lastrev %></td>
+ <td class="author"><%= if entry.lastrev
+ changeset.nil? ? h(replace_invalid_utf8(entry.lastrev.author.to_s.split("<").first)) : h(changeset.author)
+ end %></td>
<td class="comments"><%= h truncate(Changeset.to_utf8(changeset.comments, changeset.repository.repo_log_encoding), length: 50) unless changeset.nil? %></td>
</tr>
<% end %>
diff --git a/app/views/repositories/changes.html.erb b/app/views/repositories/changes.html.erb
index bbf71963d54..456895382bc 100644
--- a/app/views/repositories/changes.html.erb
+++ b/app/views/repositories/changes.html.erb
@@ -39,9 +39,11 @@ See COPYRIGHT and LICENSE files for more details.
<%= render_properties(@properties) %>
-<%= render(
- partial: "revisions",
- locals: { project: @project, path: @path, revisions: @changesets, entry: @entry }
- ) unless @changesets.empty? %>
+<%= unless @changesets.empty?
+ render(
+ partial: "revisions",
+ locals: { project: @project, path: @path, revisions: @changesets, entry: @entry }
+ )
+ end %>
<% html_title(t(:label_change_plural)) -%>
diff --git a/app/views/roles/_form.html.erb b/app/views/roles/_form.html.erb
index 2e27d0b90e8..9969e42436a 100644
--- a/app/views/roles/_form.html.erb
+++ b/app/views/roles/_form.html.erb
@@ -60,7 +60,7 @@ See COPYRIGHT and LICENSE files for more details.
<div data-admin--roles-target="memberAttributes"
hidden>
- <%= render partial: "member_attributes", locals: { f: f, role: role, roles: roles&.select { |r| !r.is_a?(GlobalRole) } } %>
+ <%= render partial: "member_attributes", locals: { f: f, role: role, roles: roles&.reject { |r| r.is_a?(GlobalRole) } } %>
</div>
<div data-admin--roles-target="globalPermissions"
diff --git a/app/views/roles/_member_attributes.html.erb b/app/views/roles/_member_attributes.html.erb
index d1852872552..c3df7ef90aa 100644
--- a/app/views/roles/_member_attributes.html.erb
+++ b/app/views/roles/_member_attributes.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field">
<%= styled_label_tag :copy_workflow_from, t(:label_copy_workflow_from) %>
<div class="form--field-container">
- <%= styled_select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles.select { |r| !r.is_a?(GlobalRole) }, :id, :name), container_class: "-slim") %>
+ <%= styled_select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles.reject { |r| r.is_a?(GlobalRole) }, :id, :name), container_class: "-slim") %>
</div>
</div>
<% end %>
diff --git a/app/views/roles/index.html.erb b/app/views/roles/index.html.erb
index 2a6ebeee8c9..3c750339de2 100644
--- a/app/views/roles/index.html.erb
+++ b/app/views/roles/index.html.erb
@@ -111,13 +111,15 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
</td>
<td class="buttons">
- <%= link_to(
- "", role_path(role),
- method: :delete,
- data: { confirm: t(:text_are_you_sure) },
- class: "icon icon-delete",
- title: t(:button_delete)
- ) unless role.builtin? %>
+ <%= unless role.builtin?
+ link_to(
+ "", role_path(role),
+ method: :delete,
+ data: { confirm: t(:text_are_you_sure) },
+ class: "icon icon-delete",
+ title: t(:button_delete)
+ )
+ end %>
</td>
</tr>
<% end %>
diff --git a/app/views/user_mailer/backup_token_reset.html.erb b/app/views/user_mailer/backup_token_reset.html.erb
index 4c01501a3a3..e6c3a8a2097 100644
--- a/app/views/user_mailer/backup_token_reset.html.erb
+++ b/app/views/user_mailer/backup_token_reset.html.erb
@@ -28,9 +28,11 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<p>
- <%= @admin_notification ?
- t(:mail_body_backup_token_reset_admin_info, user: @user_login) :
- t(:mail_body_backup_token_reset_user_info) %>
+ <%= if @admin_notification
+ t(:mail_body_backup_token_reset_admin_info, user: @user_login)
+ else
+ t(:mail_body_backup_token_reset_user_info)
+ end %>
<% if @waiting_period %>
&nbsp;
<%= t(:mail_body_backup_waiting_period, hours: @waiting_period.in_hours.to_i) %>
diff --git a/app/views/user_mailer/backup_token_reset.text.erb b/app/views/user_mailer/backup_token_reset.text.erb
index 5e9fc174a8e..4896710fe15 100644
--- a/app/views/user_mailer/backup_token_reset.text.erb
+++ b/app/views/user_mailer/backup_token_reset.text.erb
@@ -27,9 +27,11 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= @admin_notification ?
- t(:mail_body_backup_token_reset_admin_info, user: @user_login) :
- t(:mail_body_backup_token_reset_user_info)
+<%= if @admin_notification
+ t(:mail_body_backup_token_reset_admin_info, user: @user_login)
+ else
+ t(:mail_body_backup_token_reset_user_info)
+ end
%><% if @waiting_period %> <%= t(:mail_body_backup_waiting_period, hours: @waiting_period.in_hours.to_i) %><% end %>
<% if !@admin_notification %><%= t(:mail_body_backup_token_warning) %><% end %>
diff --git a/modules/costs/app/views/cost_types/edit.html.erb b/modules/costs/app/views/cost_types/edit.html.erb
index 9668e5be7c7..37dfeb05875 100644
--- a/modules/costs/app/views/cost_types/edit.html.erb
+++ b/modules/costs/app/views/cost_types/edit.html.erb
@@ -100,12 +100,11 @@ See COPYRIGHT and LICENSE files for more details.
<tbody id="rates_body" class="subform-container" data-subform-target="table">
<%= render partial: "rate", object: CostRate.new(valid_from: Date.current), locals: { templated: true } %>
<% @cost_type.rates.sort do |a, b|
- case
- when !a.valid? && !b.valid?
+ if !a.valid? && !b.valid?
0
- when !a.valid?
+ elsif !a.valid?
-1
- when !b.valid?
+ elsif !b.valid?
1
else
b.valid_from <=> a.valid_from
diff --git a/modules/costs/app/views/costlog/edit.html.erb b/modules/costs/app/views/costlog/edit.html.erb
index b0968a01953..b463e8b2641 100644
--- a/modules/costs/app/views/costlog/edit.html.erb
+++ b/modules/costs/app/views/costlog/edit.html.erb
@@ -30,13 +30,17 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_log_costs) %>
<h2><%= t(:label_log_costs) %></h2>
-<% url = @cost_entry.new_record? ?
- { action: "create", project_id: @project.id } :
- { action: "update", id: @cost_entry } %>
-
-<% method = @cost_entry.new_record? ?
- :post :
- :put %>
+<% url = if @cost_entry.new_record?
+ { action: "create", project_id: @project.id }
+ else
+ { action: "update", id: @cost_entry }
+ end %>
+
+<% method = if @cost_entry.new_record?
+ :post
+ else
+ :put
+ end %>
<%= labelled_tabular_form_for @cost_entry, url: url, html: { method: method } do |f| %>
<%= error_messages_for "cost_entry" %>
diff --git a/modules/costs/app/views/hourly_rates/_list_default.html.erb b/modules/costs/app/views/hourly_rates/_list_default.html.erb
index d86621aa5f9..58c4c650d07 100644
--- a/modules/costs/app/views/hourly_rates/_list_default.html.erb
+++ b/modules/costs/app/views/hourly_rates/_list_default.html.erb
@@ -74,7 +74,7 @@ See COPYRIGHT and LICENSE files for more details.
</tr>
</thead>
<tbody id="rates_body">
- <% current_rate = @user.current_default_rate() %>
+ <% current_rate = @user.current_default_rate %>
<%- @rates_default.each do |rate| -%>
<tr>
<td style="padding-right: 1em;"><%= rate.valid_from %></td>
diff --git a/modules/costs/app/views/hourly_rates/_list_project.html.erb b/modules/costs/app/views/hourly_rates/_list_project.html.erb
index 76681eb901c..66be31271b2 100644
--- a/modules/costs/app/views/hourly_rates/_list_project.html.erb
+++ b/modules/costs/app/views/hourly_rates/_list_project.html.erb
@@ -28,8 +28,8 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%
- rates = @rates unless rates
- project = @project unless project
+ rates ||= @rates
+ project ||= @project
current_rate = if @all_rates
at_date_in_project_with_ancestors(Date.today, all_rates, project)
diff --git a/modules/job_status/app/components/job_status/dialog/body_component.html.erb b/modules/job_status/app/components/job_status/dialog/body_component.html.erb
index 4f9773110f7..670495bddba 100644
--- a/modules/job_status/app/components/job_status/dialog/body_component.html.erb
+++ b/modules/job_status/app/components/job_status/dialog/body_component.html.erb
@@ -15,7 +15,7 @@
end
end
if redirect_url.present?
- flex.with_row {
+ flex.with_row do
render(
Primer::Beta::Link.new(
href: redirect_url,
@@ -25,12 +25,12 @@
}
)
) { I18n.t("job_status_dialog.redirect_link") }
- }
+ end
end
if download_url.present?
flex.with_row { render(Primer::Beta::Text.new) { I18n.t("job_status_dialog.download_starts") } }
- flex.with_row {
- render(Primer::Beta::Text.new) {
+ flex.with_row do
+ render(Primer::Beta::Text.new) do
I18n.t(
"job_status_dialog.link_to_download",
link: (render(
@@ -47,8 +47,8 @@
)
) { I18n.t("job_status_dialog.click_here") })
).html_safe
- }
- }
+ end
+ end
end
if job_html.present?
flex.with_row(text_align: :left) { job_html.html_safe }
diff --git a/modules/meeting/app/components/meetings/header_component.html.erb b/modules/meeting/app/components/meetings/header_component.html.erb
index ca69e5f785c..c449d683f7f 100644
--- a/modules/meeting/app/components/meetings/header_component.html.erb
+++ b/modules/meeting/app/components/meetings/header_component.html.erb
@@ -56,15 +56,17 @@
classes: "hide-when-print",
test_selector: "op-meetings-header-action-trigger" }
) do |menu|
- menu.with_item(
- label: t("label_meeting_edit_title"),
- href: edit_meeting_path(@meeting),
- content_arguments: {
- data: { 'turbo-stream': true }
- }
- ) do |item|
- item.with_leading_visual_icon(icon: :pencil)
- end if @meeting.editable? && !@series
+ if @meeting.editable? && !@series
+ menu.with_item(
+ label: t("label_meeting_edit_title"),
+ href: edit_meeting_path(@meeting),
+ content_arguments: {
+ data: { 'turbo-stream': true }
+ }
+ ) do |item|
+ item.with_leading_visual_icon(icon: :pencil)
+ end
+ end
unless @meeting.template?
menu.with_item(
@@ -107,17 +109,19 @@
item.with_leading_visual_icon(icon: :clock) # or :check TBD
end
- menu.with_item(
- label: delete_label,
- scheme: :danger,
- href: polymorphic_path([:delete_dialog, @project, @meeting.becomes(Meeting)]),
- tag: :a,
- content_arguments: {
- data: { controller: "async-dialog" }
- }
- ) do |item|
- item.with_leading_visual_icon(icon: :trash)
- end if delete_enabled?
+ if delete_enabled?
+ menu.with_item(
+ label: delete_label,
+ scheme: :danger,
+ href: polymorphic_path([:delete_dialog, @project, @meeting.becomes(Meeting)]),
+ tag: :a,
+ content_arguments: {
+ data: { controller: "async-dialog" }
+ }
+ ) do |item|
+ item.with_leading_visual_icon(icon: :trash)
+ end
+ end
end
end
end
diff --git a/modules/meeting/app/views/meeting_contents/_show.html.erb b/modules/meeting/app/views/meeting_contents/_show.html.erb
index 835dde375e2..f85c74fcbab 100644
--- a/modules/meeting/app/views/meeting_contents/_show.html.erb
+++ b/modules/meeting/app/views/meeting_contents/_show.html.erb
@@ -29,7 +29,10 @@ See COPYRIGHT and LICENSE files for more details.
<%
tab ||= locals[:tab_contents] if defined? locals
- content, content_type = tab[:content], tab[:content_type] if tab && tab.present?
+ if tab && tab.present?
+ content = tab[:content]
+ content_type = tab[:content_type]
+ end
-%>
<div data-controller="meeting-content"
diff --git a/modules/meeting/app/views/meeting_contents/history.html.erb b/modules/meeting/app/views/meeting_contents/history.html.erb
index 7db9d3e62e5..8179bda0acc 100644
--- a/modules/meeting/app/views/meeting_contents/history.html.erb
+++ b/modules/meeting/app/views/meeting_contents/history.html.erb
@@ -98,9 +98,11 @@ See COPYRIGHT and LICENSE files for more details.
<% @content_versions.each_with_index do |content_version,index| %>
<tr>
<td class="id -short">
- <%= content_version.version == @content.last_journal.version ?
- link_to(content_version.version, tab_meeting_path(@meeting, tab: @content_type.sub(/^meeting_/, "")), id: "version-#{content_version.version}") :
- link_to(content_version.version, send(:"#{@content_type}_version_path", @meeting, content_version.version), id: "version-#{content_version.version}") %>
+ <%= if content_version.version == @content.last_journal.version
+ link_to(content_version.version, tab_meeting_path(@meeting, tab: @content_type.sub(/^meeting_/, "")), id: "version-#{content_version.version}")
+ else
+ link_to(content_version.version, send(:"#{@content_type}_version_path", @meeting, content_version.version), id: "version-#{content_version.version}")
+ end %>
</td>
<td class="checkbox -short">
<% if show_diff && (index < @content_versions.size-1) %>
diff --git a/modules/meeting/app/views/meetings/new.html.erb b/modules/meeting/app/views/meetings/new.html.erb
index 4d52e044baa..0e0c4e3e2f9 100644
--- a/modules/meeting/app/views/meetings/new.html.erb
+++ b/modules/meeting/app/views/meetings/new.html.erb
@@ -41,9 +41,11 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { page_title }
header.with_breadcrumbs(
- [@project.present? ?
- { href: project_overview_path(@project.id), text: @project.name } :
- { href: home_path, text: organization_name },
+ [if @project.present?
+ { href: project_overview_path(@project.id), text: @project.name }
+ else
+ { href: home_path, text: organization_name }
+ end,
{ href: @project.present? ? project_meetings_path(@project.id) : meetings_path,
text: I18n.t(:label_meeting_plural) },
breadcrumb_element.html_safe]
diff --git a/modules/meeting/app/views/recurring_meetings/new.html.erb b/modules/meeting/app/views/recurring_meetings/new.html.erb
index 5be2516b428..0784a8ebd36 100644
--- a/modules/meeting/app/views/recurring_meetings/new.html.erb
+++ b/modules/meeting/app/views/recurring_meetings/new.html.erb
@@ -31,9 +31,11 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { t(:label_recurring_meeting_new) }
header.with_breadcrumbs(
- [@project.present? ?
- { href: project_overview_path(@project.id), text: @project.name } :
- { href: home_path, text: I18n.t(:label_home) },
+ [if @project.present?
+ { href: project_overview_path(@project.id), text: @project.name }
+ else
+ { href: home_path, text: I18n.t(:label_home) }
+ end,
{ href: @project.present? ? project_recurring_meetings_path(@project.id) : recurring_meetings_path,
text: I18n.t(:label_meeting_plural) },
t(:label_recurring_meeting_new)]
diff --git a/modules/openid_connect/app/components/openid_connect/providers/sections/metadata_form_component.html.erb b/modules/openid_connect/app/components/openid_connect/providers/sections/metadata_form_component.html.erb
index cbc8da6cada..d628fd03d1c 100644
--- a/modules/openid_connect/app/components/openid_connect/providers/sections/metadata_form_component.html.erb
+++ b/modules/openid_connect/app/components/openid_connect/providers/sections/metadata_form_component.html.erb
@@ -20,15 +20,15 @@
end
flex.with_row do
- render(Primer::Beta::Text.new(tag: :p, font_weight: :bold)) {
+ render(Primer::Beta::Text.new(tag: :p, font_weight: :bold)) do
I18n.t("openid_connect.providers.label_metadata")
- }
+ end
end
flex.with_row do
- render(Primer::Beta::Text.new(tag: :p)) {
+ render(Primer::Beta::Text.new(tag: :p)) do
I18n.t("openid_connect.providers.section_texts.metadata_form_description")
- }
+ end
end
flex.with_row do
diff --git a/modules/overviews/app/components/project_custom_fields/sections/project_custom_fields/show_component.html.erb b/modules/overviews/app/components/project_custom_fields/sections/project_custom_fields/show_component.html.erb
index d56fbe3630a..16ef2cd67d8 100644
--- a/modules/overviews/app/components/project_custom_fields/sections/project_custom_fields/show_component.html.erb
+++ b/modules/overviews/app/components/project_custom_fields/sections/project_custom_fields/show_component.html.erb
@@ -25,7 +25,7 @@
custom_field_value_container.with_row(w: :full) do
if not_set?
- render(Primer::Beta::Text.new()) { t("placeholders.default") }
+ render(Primer::Beta::Text.new) { t("placeholders.default") }
else
render_value
end
diff --git a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb
index 1ce3cc8b74e..38d0f41491a 100644
--- a/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb
+++ b/modules/overviews/app/components/project_life_cycles/sections/project_life_cycles/show_component.html.erb
@@ -21,7 +21,7 @@
life_cycle_container.with_row(w: :full) do
if not_set?
- render(Primer::Beta::Text.new()) { t("placeholders.default") }
+ render(Primer::Beta::Text.new) { t("placeholders.default") }
else
render_value
end
diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erb
index 73a2dfd57cf..45ad95e3073 100644
--- a/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erb
+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erb
@@ -23,7 +23,7 @@
t("two_factor_authentication.label_device")
end
- @available_devices.each do |key, _device_class|
+ @available_devices.each_key do |key|
menu.with_item(
label: t("two_factor_authentication.devices.#{key}.title"),
href: url_for(action: :new, type: key),