From 710751e3b0d03ec456324b9dd095772b34246c0e Mon Sep 17 00:00:00 2001 From: Arnelle Balane Date: Tue, 26 Feb 2019 05:12:15 +0800 Subject: [PATCH] Fix linting issues in app/views/admin (#1871) [ci skip] --- .../admin/application/_collection.html.erb | 68 +++++++++++-------- app/views/admin/application/index.html.erb | 40 +++++------ 2 files changed, 59 insertions(+), 49 deletions(-) diff --git a/app/views/admin/application/_collection.html.erb b/app/views/admin/application/_collection.html.erb index 3ada53c7c..563cafcbe 100644 --- a/app/views/admin/application/_collection.html.erb +++ b/app/views/admin/application/_collection.html.erb @@ -28,21 +28,23 @@ to display a collection of resources in an HTML table. scope="col" role="columnheader" aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"> - <%= link_to(sanitized_order_params(page, collection_field_name).merge( - collection_presenter.order_params_for(attr_name, key: collection_field_name) - )) do %> - <%= t( - "helpers.label.#{collection_presenter.resource_name}.#{attr_name}", - default: attr_name.to_s, - ).titleize %> - <% if collection_presenter.ordered_by?(attr_name) %> - - - - <% end %> + <%= link_to(sanitized_order_params( + page, collection_field_name + ).merge( + collection_presenter.order_params_for(attr_name, key: collection_field_name), + )) do %> + <%= t( + "helpers.label.#{collection_presenter.resource_name}.#{attr_name}", + default: attr_name.to_s, + ).titleize %> + <% if collection_presenter.ordered_by?(attr_name) %> + + + <% end %> + <% end %> <% end %> <% [valid_action?(:edit, collection_presenter.resource_name), @@ -58,14 +60,12 @@ to display a collection of resources in an HTML table. tabindex="0" <% if valid_action? :show, collection_presenter.resource_name %> <%= %(role=link data-url=#{polymorphic_path([namespace, resource])}) %> - <% end %> - > + <% end %>> <% collection_presenter.attributes_for(resource).each do |attribute| %> <% if show_action? :show, resource -%> + class="action-show"> <%= render_field attribute %> <% end -%> @@ -73,21 +73,29 @@ to display a collection of resources in an HTML table. <% end %> <% if valid_action? :edit, collection_presenter.resource_name %> - <%= link_to( - t("administrate.actions.edit"), - [:edit, namespace, resource], - class: "action-edit", - ) if show_action? :edit, resource %> + + <% if show_action? :edit, resource %> + <%= link_to( + t("administrate.actions.edit"), + [:edit, namespace, resource], + class: "action-edit", + ) %> + <% end %> + <% end %> <% if valid_action? :destroy, collection_presenter.resource_name %> - <%= link_to( - t("administrate.actions.destroy"), - [namespace, resource], - class: "text-color-red", - method: :delete, - data: { confirm: t("administrate.actions.confirm") } - ) if show_action? :destroy, resource %> + + <% if show_action? :destroy, resource %> + <%= link_to( + t("administrate.actions.destroy"), + [namespace, resource], + class: "text-color-red", + method: :delete, + data: { confirm: t("administrate.actions.confirm") }, + ) %> + <% end %> + <% end %> <% end %> diff --git a/app/views/admin/application/index.html.erb b/app/views/admin/application/index.html.erb index 80a5ae24c..f0485be57 100644 --- a/app/views/admin/application/index.html.erb +++ b/app/views/admin/application/index.html.erb @@ -34,33 +34,35 @@ It renders the `_table` partial to display details about the resources. <% if show_search_bar %> <%= render( - "search", - search_term: search_term, - resource_name: display_resource_name(page.resource_name) - ) %> + "search", + search_term: search_term, + resource_name: display_resource_name(page.resource_name), + ) %> <% end %>
- <%= link_to( - t( - "administrate.actions.new_resource", - name: page.resource_name.titleize.downcase - ), - [:new, namespace, page.resource_path], - class: "button", - ) if valid_action?(:new) && show_action?(:new, new_resource) %> + <% if valid_action?(:new) && show_action?(:new, new_resource) %> + <%= link_to( + t( + "administrate.actions.new_resource", + name: page.resource_name.titleize.downcase, + ), + [:new, namespace, page.resource_path], + class: "button", + ) %> + <% end %>
<%= render( - "collection", - collection_presenter: page, - collection_field_name: resource_name, - page: page, - resources: resources, - table_title: "page-title" - ) %> + "collection", + collection_presenter: page, + collection_field_name: resource_name, + page: page, + resources: resources, + table_title: "page-title", + ) %> <%= paginate resources %>