Remove including helpers in ViewComponents, use the #helpers method instead (#12709)

* Remove including helpers in ViewComponents, and use the #helpers method instead
This commit is contained in:
Dombi Attila
2023-05-30 07:43:37 +03:00
committed by GitHub
parent e9efc18000
commit 804462f00c
47 changed files with 117 additions and 196 deletions
@@ -32,7 +32,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="on-off-status-cell">
<% if enabled? %>
<span class="on-off-status -enabled">
<%= op_icon 'icon-yes' %>
<%= helpers.op_icon 'icon-yes' %>
<%= model[:on_text] %>
</span>
<p>
@@ -40,7 +40,7 @@ See COPYRIGHT and LICENSE files for more details.
</p>
<% else %>
<span class="on-off-status -disabled">
<%= op_icon 'icon-not-supported' %>
<%= helpers.op_icon 'icon-not-supported' %>
<%= model[:off_text] %>
</span>
<p><%= model[:off_description] %></p>
@@ -29,9 +29,6 @@
#++
class IndividualPrincipalBaseFilterComponent < RailsComponent
include UsersHelper
include ActionView::Helpers::FormOptionsHelper
class << self
def query(params)
q = base_query.new
@@ -30,8 +30,6 @@
module Members
class RoleFormComponent < ::RailsComponent
include RemovedJsHelpersHelper
options :row, :params, :roles
def member
+4 -7
View File
@@ -30,9 +30,6 @@
module Members
class RowComponent < ::RowComponent
include AvatarHelper
include UsersHelper
property :principal
def member
@@ -48,7 +45,7 @@ module Members
end
def name
icon = avatar principal, size: :mini
icon = helpers.avatar principal, size: :mini
icon + principal_link
end
@@ -105,7 +102,7 @@ module Members
end
def status
translate_user_status(model.principal.status)
helpers.translate_user_status(model.principal.status)
end
def may_update?
@@ -128,7 +125,7 @@ module Members
def edit_link
link_to(
op_icon('icon icon-edit'),
helpers.op_icon('icon icon-edit'),
'#',
class: "toggle-membership-button #{toggle_item_class_name}",
'data-action': 'members-form#toggleMembershipEdit',
@@ -148,7 +145,7 @@ module Members
def delete_link
if model.deletable?
link_to(
op_icon('icon icon-delete'),
helpers.op_icon('icon icon-delete'),
{ controller: '/members', action: 'destroy', id: model, page: params[:page] },
method: :delete,
data: { confirm: delete_link_confirmation, disable_with: I18n.t(:label_loading) },
@@ -31,9 +31,6 @@
module OAuth
module Applications
class RowComponent < ::RowComponent
include ::IconsHelper
include ::OAuthHelper
include ::OpenProject::ObjectLinking
property :confidential
@@ -51,7 +48,7 @@ module OAuth
def confidential
if application.confidential?
op_icon 'icon icon-checkmark'
helpers.op_icon 'icon icon-checkmark'
end
end
@@ -77,7 +74,7 @@ module OAuth
end
def button_links
[edit_link, delete_link(oauth_application_path(application))]
[edit_link, helpers.delete_link(oauth_application_path(application))]
end
end
end
@@ -54,7 +54,7 @@ module OAuth
aria: { label: t('oauth.application.new') },
class: 'wp-inline-create--add-link',
title: t('oauth.application.new') do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
@@ -28,11 +28,6 @@
module PlaceholderUsers
class RowComponent < ::RowComponent
include AvatarHelper
include UsersHelper
include PlaceholderUsersHelper
include TooltipHelper
def placeholder_user
model
end
@@ -42,7 +37,7 @@ module PlaceholderUsers
end
def created_at
format_time placeholder_user.created_at
helpers.format_time placeholder_user.created_at
end
def button_links
@@ -50,12 +45,12 @@ module PlaceholderUsers
end
def delete_link
if can_delete_placeholder_user?(placeholder_user, User.current)
if helpers.can_delete_placeholder_user?(placeholder_user, User.current)
link_to deletion_info_placeholder_user_path(placeholder_user) do
tooltip_tag I18n.t('placeholder_users.delete_tooltip'), icon: 'icon-delete'
helpers.tooltip_tag I18n.t('placeholder_users.delete_tooltip'), icon: 'icon-delete'
end
else
tooltip_tag I18n.t('placeholder_users.right_to_manage_members_missing'), icon: 'icon-help2'
helpers.tooltip_tag I18n.t('placeholder_users.right_to_manage_members_missing'), icon: 'icon-help2'
end
end
@@ -37,7 +37,7 @@ See COPYRIGHT and LICENSE files for more details.
</td>
<% end %>
<td class="buttons">
<% items = project_more_menu_items(project) %>
<% items = helpers.project_more_menu_items(project) %>
<% if items.any? %>
<ul class="project-actions">
<li aria-haspopup="true" title="<%= I18n.t(:label_open_menu) %>" class="drop-down">
@@ -63,7 +63,7 @@ See COPYRIGHT and LICENSE files for more details.
<td></td>
<td colspan="<%= columns.length%>" class="project--hierarchy">
<div class="description-container wiki">
<%= format_text(short_project_description(project), project: project) %>
<%= helpers.format_text(short_project_description(project), project: project) %>
</div>
</td>
</tr>
+7 -11
View File
@@ -30,10 +30,6 @@
module Projects
class RowComponent < ::RowComponent
include ProjectsHelper
include ProjectStatusHelper
include ::Redmine::I18n
def project
model.first
end
@@ -69,11 +65,11 @@ module Projects
end
def created_at
format_date(project.created_at)
helpers.format_date(project.created_at)
end
def latest_activity_at
format_date(project.latest_activity_at)
helpers.format_date(project.latest_activity_at)
end
def required_disk_space
@@ -91,7 +87,7 @@ module Projects
end
content << ' '
content << link_to_project(project, {}, {}, false)
content << helpers.link_to_project(project, {}, {}, false)
content
end
@@ -101,9 +97,9 @@ module Projects
status_code = project.status_code
if status_code
classes = project_status_css_class(status_code)
classes = helpers.project_status_css_class(status_code)
content << content_tag(:span, '', class: "project-status--bulb -inline #{classes}")
content << content_tag(:span, project_status_name(status_code), class: "project-status--name #{classes}")
content << content_tag(:span, helpers.project_status_name(status_code), class: "project-status--name #{classes}")
end
content
@@ -111,12 +107,12 @@ module Projects
def status_explanation
if project.status_explanation
content_tag :div, format_text(project.status_explanation), class: 'wiki'
content_tag :div, helpers.format_text(project.status_explanation), class: 'wiki'
end
end
def public
checked_image project.public?
helpers.checked_image project.public?
end
def row_css_class
@@ -45,7 +45,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="generic-table--sort-header-outer generic-table--sort-header-outer_no-highlighting">
<div class="generic-table--sort-header">
<%= content_tag :a,
op_icon("icon-hierarchy"),
helpers.op_icon("icon-hierarchy"),
href: href_only_when_not_sort_lft,
class: "spot-link #{deactivate_class_on_lft_sort}",
title: t(:label_sort_by, value: %("#{t(:label_project_hierarchy)}")) %>
@@ -70,9 +70,9 @@ See COPYRIGHT and LICENSE files for more details.
<div class="generic-table--header-outer">
<div class="generic-table--header">
<% if params[:expand] == 'all' %>
<%= link_to t(:button_collapse_all), { params: safe_query_params(%w{filters page per_page sortBy}).except(:expand) } %>
<%= link_to t(:button_collapse_all), { params: helpers.safe_query_params(%w{filters page per_page sortBy}).except(:expand) } %>
<% else %>
<%= link_to t(:button_expand_all), { params: safe_query_params(%w{filters page per_page sortBy}).merge(expand: 'all') } %>
<%= link_to t(:button_expand_all), { params: helpers.safe_query_params(%w{filters page per_page sortBy}).merge(expand: 'all') } %>
<% end %>
</div>
</div>
@@ -96,6 +96,6 @@ See COPYRIGHT and LICENSE files for more details.
</div>
</div>
<% if paginated? %>
<%= pagination_links_full model %>
<%= helpers.pagination_links_full model %>
<% end %>
</div>
+10 -9
View File
@@ -30,8 +30,6 @@
module Projects
class TableComponent < ::TableComponent
include ProjectsHelper
options :params # We read collapsed state from params
options :current_user # adds this option to those of the base class
@@ -46,21 +44,24 @@ module Projects
##
# The project sort by is handled differently
def build_sort_header(column, options)
projects_sort_header_tag(column, options.merge(param: :json))
helpers.projects_sort_header_tag(column, options.merge(param: :json))
end
# We don't return the project row
# but the [project, level] array from the helper
def rows
@rows ||= to_enum(:projects_with_levels_order_sensitive, model).to_a # rubocop:disable Lint/ToEnumArguments
@rows ||= begin
projects_enumerator = ->(model) { to_enum(:projects_with_levels_order_sensitive, model).to_a } # rubocop:disable Lint/ToEnumArguments
helpers.instance_exec(model, &projects_enumerator)
end
end
def initialize_sorted_model
sort_clear
helpers.sort_clear
orders = options[:orders]
sort_init orders
sort_update orders.map(&:first)
helpers.sort_init orders
helpers.sort_update orders.map(&:first)
end
def paginated?
@@ -68,13 +69,13 @@ module Projects
end
def deactivate_class_on_lft_sort
if sorted_by_lft?
if helpers.sorted_by_lft?
'spot-link_inactive'
end
end
def href_only_when_not_sort_lft
unless sorted_by_lft?
unless helpers.sorted_by_lft?
projects_path(sortBy: JSON::dump([['lft', 'asc']]))
end
end
-2
View File
@@ -29,8 +29,6 @@
#++
class RailsComponent < ViewComponent::Base
include ApplicationHelper
attr_reader :model, :options
def initialize(model = nil, **options)
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="form--field">
<%=
setting_text_field(
helpers.setting_text_field(
name,
size: size,
unit: t("label_#{unit.singularize}_plural"),
@@ -32,8 +32,6 @@ module Settings
##
# A text field to enter numeric values.
class NumericSettingComponent < ::RailsComponent
include SettingsHelper
options :unit, :title
options size: 3
@@ -36,7 +36,7 @@ See COPYRIGHT and LICENSE files for more details.
<%=
styled_select_tag(
"lang",
options_for_select(lang_options_for_select(false), current_language.to_s),
options_for_select(helpers.lang_options_for_select(false), current_language.to_s),
id: "lang-for-#{name}",
class: "lang-select-switch",
container_class: '-slim'
@@ -32,10 +32,7 @@ module Settings
##
# A language switch and text area for updating a localized text setting.
class TextSettingComponent < ::RailsComponent
include ActionView::Helpers::JavaScriptHelper
include ActionView::Helpers::FormOptionsHelper
include OpenProject::FormTagHelper
include TextFormattingHelper
options :name # name of setting and tag to differentiate between different language selects
@@ -32,9 +32,6 @@ module Settings
##
# A text field to enter numeric values.
class TimeZoneSettingComponent < ::RailsComponent
include ActionView::Helpers::FormOptionsHelper
include SettingsHelper
options :form, :title
options container_class: "-wide"
options include_blank: true
@@ -63,7 +60,7 @@ module Settings
end
def render_setting_select
setting_select(
helpers.setting_select(
name,
time_zone_entries,
include_blank:,
+1 -5
View File
@@ -30,10 +30,6 @@
module Statuses
class RowComponent < ::RowComponent
include ::IconsHelper
include ::ColorsHelper
include ReorderLinksHelper
def status
model
end
@@ -76,7 +72,7 @@ module Statuses
def delete_link
link_to(
op_icon('icon icon-delete'),
helpers.op_icon('icon icon-delete'),
status_path(status),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
+1 -1
View File
@@ -47,7 +47,7 @@ module Statuses
aria: { label: t(:label_work_package_status_new) },
class: 'wp-inline-create--add-link',
title: t(:label_work_package_status_new) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
+2 -2
View File
@@ -40,7 +40,7 @@ See COPYRIGHT and LICENSE files for more details.
<tr>
<% headers.each do |name, options| %>
<% if sortable_column?(name) %>
<%= sort_header_tag name, options %>
<%= helpers.sort_header_tag name, options %>
<% else %>
<th>
<div class="generic-table--sort-header-outer">
@@ -76,5 +76,5 @@ See COPYRIGHT and LICENSE files for more details.
</div>
</div>
<% if paginated? %>
<%= pagination_links_full rows %>
<%= helpers.pagination_links_full rows %>
<% end %>
+10 -9
View File
@@ -31,9 +31,6 @@
##
# Abstract view component. Subclass this for a concrete table.
class TableComponent < RailsComponent
include SortHelper
include PaginationHelper
def initialize(rows: [], **options)
super(rows, **options)
end
@@ -94,18 +91,22 @@ class TableComponent < RailsComponent
end
def initialize_sorted_model
sort_init *initial_sort.map(&:to_s)
sort_update sortable_columns.map(&:to_s)
helpers.sort_init *initial_sort.map(&:to_s)
helpers.sort_update sortable_columns.map(&:to_s)
@model = paginate_collection apply_sort(model)
end
def sort_criteria
helpers.instance_variable_get(:@sort_criteria)
end
def apply_sort(model)
case model
when ActiveRecord::QueryMethods
sort_collection(model, sort_clause)
sort_collection(model, helpers.sort_clause)
when Queries::BaseQuery
model
.order(@sort_criteria.to_query_hash)
.order(sort_criteria.to_query_hash)
.results
else
raise ArgumentError, "Cannot sort the given model class #{model.class}"
@@ -125,8 +126,8 @@ class TableComponent < RailsComponent
def paginate_collection(query)
query
.page(page_param(controller.params))
.per_page(per_page_param)
.page(helpers.page_param(controller.params))
.per_page(helpers.per_page_param)
end
def rows
+1 -1
View File
@@ -73,7 +73,7 @@ class UserFilterComponent < IndividualPrincipalBaseFilterComponent
end
def user_status_options
users_status_options_for_select status, extra: extra_user_status_options
helpers.users_status_options_for_select status, extra: extra_user_status_options
end
def extra_user_status_options
+6 -9
View File
@@ -30,9 +30,6 @@
module Users
class RowComponent < ::RowComponent
include AvatarHelper
include UsersHelper
property :firstname, :lastname
def user
@@ -47,7 +44,7 @@ module Users
end
def login
icon = avatar user, size: :mini
icon = helpers.avatar user, size: :mini
link = link_to h(user.login), edit_user_path(user)
icon + link
@@ -58,19 +55,19 @@ module Users
end
def admin
checked_image user.admin?
helpers.checked_image user.admin?
end
def last_login_on
format_time user.last_login_on unless user.last_login_on.nil?
helpers.format_time user.last_login_on unless user.last_login_on.nil?
end
def created_at
format_time user.created_at
helpers.format_time user.created_at
end
def status
full_user_status user
helpers.full_user_status user
end
def button_links
@@ -84,7 +81,7 @@ module Users
# Don't show if non-admin
return unless table.current_user.admin?
change_user_status_links user
helpers.change_user_status_links user
end
def column_css_class(column)
+19 -21
View File
@@ -30,8 +30,6 @@
module Versions
class RowComponent < ::RowComponent
include VersionsHelper
# Overriding cell's method to set the project instance variable.
# A lot of helpers rely on the existence of it.
def setup!(model, options)
@@ -53,15 +51,15 @@ module Versions
end
def name
link_to_version version, {}, project: version.project
helpers.link_to_version version, {}, project: version.project
end
def start_date
format_date(version.start_date)
helpers.format_date(version.start_date)
end
def effective_date
format_date(version.effective_date)
helpers.format_date(version.effective_date)
end
def description
@@ -73,17 +71,17 @@ module Versions
end
def sharing
h(format_version_sharing(version.sharing))
helpers.format_version_sharing(version.sharing)
end
def wiki_page
return '' if wiki_page_title.blank? || version.project.wiki.nil?
link_to_if_authorized(wiki_page_title,
controller: '/wiki',
action: 'show',
project_id: version.project,
id: wiki_page_title) || h(wiki_page_title)
helpers.link_to_if_authorized(wiki_page_title,
controller: '/wiki',
action: 'show',
project_id: version.project,
id: wiki_page_title) || h(wiki_page_title)
end
def button_links
@@ -99,21 +97,21 @@ module Versions
def edit_link
return unless version.project == table.project
link_to_if_authorized '',
{ controller: '/versions', action: 'edit', id: version },
class: 'icon icon-edit',
title: t(:button_edit)
helpers.link_to_if_authorized '',
{ controller: '/versions', action: 'edit', id: version },
class: 'icon icon-edit',
title: t(:button_edit)
end
def delete_link
return unless version.project == table.project
link_to_if_authorized '',
{ controller: '/versions', action: 'destroy', id: version },
data: { confirm: t(:text_are_you_sure) },
method: :delete,
class: 'icon icon-delete',
title: t(:button_delete)
helpers.link_to_if_authorized '',
{ controller: '/versions', action: 'destroy', id: version },
data: { confirm: t(:text_are_you_sure) },
method: :delete,
class: 'icon icon-delete',
title: t(:button_delete)
end
def column_css_class(column)
@@ -36,9 +36,9 @@ module OpenProject::Backlogs::Patches::Versions::RowComponentPatch
def backlogs_edit_link
return if version.project == table.project || !table.project.module_enabled?("backlogs")
link_to_if_authorized '',
{ controller: '/versions', action: 'edit', id: version, project_id: table.project.id },
class: 'icon icon-edit',
title: t(:button_edit)
helpers.link_to_if_authorized '',
{ controller: '/versions', action: 'edit', id: version, project_id: table.project.id },
class: 'icon icon-edit',
title: t(:button_edit)
end
end
@@ -1,10 +1,6 @@
module Bim
module IfcModels
class RowComponent < ::RowComponent
include ::IconsHelper
include ::AvatarHelper
include ::Redmine::I18n
property :created_at
def title
@@ -18,16 +14,16 @@ module Bim
def default?
if model.is_default?
op_icon 'icon icon-checkmark'
helpers.op_icon 'icon icon-checkmark'
end
end
def updated_at
format_date(model.updated_at)
helpers.format_date(model.updated_at)
end
def uploader
icon = avatar model.uploader, size: :mini
icon = helpers.avatar model.uploader, size: :mini
icon + model.uploader.name
end
@@ -89,7 +85,7 @@ module Bim
link_to '',
edit_bcf_project_ifc_model_path(model.project, model),
class: 'icon icon-edit',
accesskey: accesskey(:edit),
accesskey: helpers.accesskey(:edit),
title: I18n.t(:button_edit)
end
end
@@ -1,7 +1,6 @@
module Bim
module IfcModels
class TableComponent < ::TableComponent
include ::IconsHelper
columns :title, :default?, :created_at, :updated_at, :uploader, :processing
def initial_sort
@@ -16,7 +15,7 @@ module Bim
link_to(new_bcf_project_ifc_model_path,
class: 'wp-inline-create--add-link',
title: I18n.t('ifc_models.label_new_ifc_model')) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
@@ -30,10 +30,8 @@
module Boards
class RowComponent < ::RowComponent
include ApplicationHelper
def project_id
link_to_project model.project, {}, {}, false
helpers.link_to_project model.project, {}, {}, false
end
def name
@@ -41,7 +39,7 @@ module Boards
end
def created_at
safe_join([format_date(model.created_at), format_time(model.created_at, false)], " ")
safe_join([helpers.format_date(model.created_at), helpers.format_time(model.created_at, false)], " ")
end
def type
@@ -28,9 +28,6 @@
module Calendar
class RowComponent < ::RowComponent
include ApplicationHelper
include ::Redmine::I18n
def query
model
end
@@ -42,7 +39,7 @@ module Calendar
end
def created_at
format_time(query.created_at)
helpers.format_time(query.created_at)
end
def button_links
@@ -42,7 +42,7 @@ module LdapGroups
end
def added
format_date(membership.updated_at)
helpers.format_date(membership.updated_at)
end
end
end
@@ -31,9 +31,6 @@
module LdapGroups
module SynchronizedFilters
class RowComponent < ::RowComponent
include ::IconsHelper
include ::PasswordHelper
property :base_dn
def synchronized_filter
@@ -53,7 +50,7 @@ module LdapGroups
end
def sync_users
checked_image synchronized_filter.sync_users
helpers.checked_image synchronized_filter.sync_users
end
def button_links
@@ -49,7 +49,7 @@ module LdapGroups
link_to({ controller: target_controller, action: :new },
class: 'budget-add-row wp-inline-create--add-link',
title: I18n.t('ldap_groups.synchronized_filters.add_new')) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
@@ -31,9 +31,6 @@
module LdapGroups
module SynchronizedGroups
class RowComponent < ::RowComponent
include ::IconsHelper
include ::PasswordHelper
def synchronized_group
model
end
@@ -51,7 +48,7 @@ module LdapGroups
end
def sync_users
checked_image synchronized_group.sync_users
helpers.checked_image synchronized_group.sync_users
end
def users
@@ -53,7 +53,7 @@ module LdapGroups
link_to({ controller: target_controller, action: :new },
class: 'budget-add-row wp-inline-create--add-link',
title: I18n.t('ldap_groups.synchronized_groups.add_new')) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
@@ -30,10 +30,8 @@
module Meetings
class RowComponent < ::RowComponent
include ApplicationHelper
def project
link_to_project model.project, {}, {}, false
helpers.link_to_project model.project, {}, {}, false
end
def title
@@ -41,7 +39,7 @@ module Meetings
end
def start_time
safe_join([format_date(model.start_time), format_time(model.start_time, false)], " ")
safe_join([helpers.format_date(model.start_time), helpers.format_time(model.start_time, false)], " ")
end
def duration
@@ -1,8 +1,6 @@
module OpenIDConnect
module Providers
class RowComponent < ::RowComponent
include ::IconsHelper
def provider
model
end
@@ -29,7 +27,7 @@ module OpenIDConnect
def edit_link
link_to(
op_icon('icon icon-edit button--link'),
helpers.op_icon('icon icon-edit button--link'),
url_for(action: :edit, id: provider.id),
title: t(:button_edit)
)
@@ -37,7 +35,7 @@ module OpenIDConnect
def delete_link
link_to(
op_icon('icon icon-delete button--link'),
helpers.op_icon('icon icon-delete button--link'),
url_for(action: :destroy, id: provider.id),
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
@@ -30,11 +30,6 @@
# Used by: Storages table in table_component.rb
module Storages::Admin
class RowComponent < ::RowComponent
include ::IconsHelper # Global helper for icons, defines op_icon and icon_wrapper?
include ::AvatarHelper # Global helper for avatar (image of a user)
include ::Redmine::I18n # Internationalization support (defines I18n.t(...) translation)
include ::ApplicationHelper # For `accesskey` method
def storage
row
end
@@ -51,7 +46,7 @@ module Storages::Admin
delegate :provider_type, to: :storage
def creator
icon = avatar storage.creator, size: :mini
icon = helpers.avatar storage.creator, size: :mini
icon + storage.creator.name
end
@@ -72,7 +67,7 @@ module Storages::Admin
link_to '',
edit_admin_settings_storage_path(storage),
class: 'icon icon-edit',
accesskey: accesskey(:edit),
accesskey: helpers.accesskey(:edit),
title: I18n.t(:button_edit)
end
end
@@ -33,8 +33,6 @@
# See also: row_component.rb defining the rows of the table
module Storages::Admin
class TableComponent < ::TableComponent
include ::IconsHelper # Global helper for icons, defines op_icon(...)
# Defines the list of columns in the table using symbols.
# These symbols are used below to define header (top of the table)
# and contents of the components
@@ -56,7 +54,7 @@ module Storages::Admin
link_to(new_admin_settings_storage_path,
class: 'wp-inline-create--add-link',
title: I18n.t('storages.label_new_storage')) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
@@ -30,9 +30,6 @@
# associated with a project
module Storages::ProjectsStorages
class RowComponent < ::RowComponent
include ::IconsHelper
include ::AvatarHelper
include ::Redmine::I18n
def project_storage
row
end
@@ -48,7 +45,7 @@ module Storages::ProjectsStorages
end
def creator
icon = avatar project_storage.creator, size: :mini
icon = helpers.avatar project_storage.creator, size: :mini
icon + project_storage.creator.name
end
@@ -33,8 +33,6 @@
# for every "column" defined below.
module Storages::ProjectsStorages
class TableComponent < ::TableComponent
include ::IconsHelper
columns :name,
:provider_type,
:creator,
@@ -52,7 +50,7 @@ module Storages::ProjectsStorages
link_to(new_project_settings_projects_storage_path,
class: 'wp-inline-create--add-link',
title: I18n.t('storages.label_new_storage')) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
@@ -28,9 +28,6 @@
module TeamPlanner
class RowComponent < ::RowComponent
include ApplicationHelper
include ::Redmine::I18n
def query
model
end
@@ -42,7 +39,7 @@ module TeamPlanner
end
def created_at
format_time(query.created_at)
helpers.format_time(query.created_at)
end
def assignees
@@ -1,9 +1,6 @@
module ::TwoFactorAuthentication
module Devices
class RowComponent < ::RowComponent
include ::IconsHelper
include ::PasswordHelper
def device
model
end
@@ -20,7 +17,7 @@ module ::TwoFactorAuthentication
def default
if device.default
op_icon 'icon-yes'
helpers.op_icon 'icon-yes'
else
'-'
end
@@ -28,13 +25,13 @@ module ::TwoFactorAuthentication
def confirmed
if device.active
op_icon 'icon-yes'
helpers.op_icon 'icon-yes'
elsif table.self_table?
link_to t('two_factor_authentication.devices.confirm_now'),
{ controller: table.target_controller, action: :confirm, device_id: device.id }
else
op_icon 'icon-no'
helpers.op_icon 'icon-no'
end
end
@@ -48,7 +45,7 @@ module ::TwoFactorAuthentication
end
def make_default_link
password_confirmation_form_for(
helpers.password_confirmation_form_for(
device,
url: { controller: table.target_controller, action: :make_default, device_id: device.id },
method: :post,
@@ -67,7 +64,7 @@ module ::TwoFactorAuthentication
I18n.t(:button_delete)
end
password_confirmation_form_for(
helpers.password_confirmation_form_for(
device,
url: { controller: table.target_controller, action: :destroy, device_id: device.id },
method: :delete,
@@ -33,7 +33,7 @@ module ::TwoFactorAuthentication
link_to({ controller: target_controller, action: :new },
class: 'budget-add-row wp-inline-create--add-link',
title: I18n.t('two_factor_authentication.devices.add_new')) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end
end
@@ -4,7 +4,7 @@
data-modal-class-name="webhooks--response-body-modal"
>
<a class="log-response-<%= id %>-modal--activation-link" title="<%= title %>">
<%= op_icon('icon-info1') %>
<%= helpers.op_icon('icon-info1') %>
<%= t(:button_show) %>
</a>
<div class="modal-delivery-element">
@@ -2,8 +2,6 @@ module ::Webhooks
module Outgoing
module Deliveries
class RowComponent < ::RowComponent
include ::IconsHelper
property :id, :description, :event_name, :response_code
def log
@@ -2,8 +2,6 @@ module ::Webhooks
module Outgoing
module Webhooks
class RowComponent < ::RowComponent
include ::IconsHelper
property :description
def webhook
@@ -17,7 +15,7 @@ module ::Webhooks
def enabled
if webhook.enabled?
op_icon 'icon-yes'
helpers.op_icon 'icon-yes'
end
end
@@ -73,7 +71,7 @@ module ::Webhooks
def edit_link
link_to(
op_icon('icon icon-edit button--link'),
helpers.op_icon('icon icon-edit button--link'),
{ controller: table.target_controller, action: :edit, webhook_id: webhook.id },
title: t(:button_edit)
)
@@ -81,7 +79,7 @@ module ::Webhooks
def delete_link
link_to(
op_icon('icon icon-delete button--link'),
helpers.op_icon('icon icon-delete button--link'),
{ controller: table.target_controller, action: :destroy, webhook_id: webhook.id },
method: :delete,
data: { confirm: I18n.t(:text_are_you_sure) },
@@ -20,7 +20,7 @@ module ::Webhooks
link_to({ controller: target_controller, action: :new },
class: 'webhooks--add-row wp-inline-create--add-link',
title: I18n.t('webhooks.outgoing.label_add_new')) do
op_icon('icon icon-add')
helpers.op_icon('icon icon-add')
end
end