From 9297cbc6421c45b140e9c569cf38d902a8aa8135 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 7 Feb 2018 13:31:46 +0100 Subject: [PATCH] Manager: regenerate views template to match the new version --- .../stylesheets/new_design/manager.scss | 8 --- .../_show.html.haml | 2 +- .../layouts/manager/application.html.haml | 33 ----------- .../manager/administrateurs/index.html.haml | 16 ------ .../manager/administrateurs/show.html.erb | 57 +++++++++++++++++++ .../manager/application/_collection.html.haml | 20 ------- .../manager/application/_flashes.html.haml | 5 -- .../manager/application/_javascript.html.haml | 9 --- .../manager/application/_navigation.html.erb | 26 +++++++++ .../manager/application/_sidebar.html.haml | 16 ------ app/views/manager/application/index.html.haml | 15 ----- app/views/manager/application/show.html.haml | 13 ----- app/views/manager/procedures/show.html.erb | 57 +++++++++++++++++++ app/views/manager/procedures/show.html.haml | 16 ------ 14 files changed, 141 insertions(+), 152 deletions(-) delete mode 100644 app/assets/stylesheets/new_design/manager.scss delete mode 100644 app/views/layouts/manager/application.html.haml delete mode 100644 app/views/manager/administrateurs/index.html.haml create mode 100644 app/views/manager/administrateurs/show.html.erb delete mode 100644 app/views/manager/application/_collection.html.haml delete mode 100644 app/views/manager/application/_flashes.html.haml delete mode 100644 app/views/manager/application/_javascript.html.haml create mode 100644 app/views/manager/application/_navigation.html.erb delete mode 100644 app/views/manager/application/_sidebar.html.haml delete mode 100644 app/views/manager/application/index.html.haml delete mode 100644 app/views/manager/application/show.html.haml create mode 100644 app/views/manager/procedures/show.html.erb delete mode 100644 app/views/manager/procedures/show.html.haml diff --git a/app/assets/stylesheets/new_design/manager.scss b/app/assets/stylesheets/new_design/manager.scss deleted file mode 100644 index f2f140f26..000000000 --- a/app/assets/stylesheets/new_design/manager.scss +++ /dev/null @@ -1,8 +0,0 @@ -.types-de-champs-table { - table-layout: fixed; - - td { - white-space: normal; - vertical-align: top; - } -} diff --git a/app/views/fields/types_de_champ_collection_field/_show.html.haml b/app/views/fields/types_de_champ_collection_field/_show.html.haml index 849a79af9..c54bb1c64 100644 --- a/app/views/fields/types_de_champ_collection_field/_show.html.haml +++ b/app/views/fields/types_de_champ_collection_field/_show.html.haml @@ -1,5 +1,5 @@ - if field.data.any? - %table.collection-data.types-de-champs-table{ "aria-labelledby": "page-title" } + %table.collection-data{ "aria-labelledby": "page-title" } %thead %tr %td.cell-label Libelle diff --git a/app/views/layouts/manager/application.html.haml b/app/views/layouts/manager/application.html.haml deleted file mode 100644 index 9ab026a33..000000000 --- a/app/views/layouts/manager/application.html.haml +++ /dev/null @@ -1,33 +0,0 @@ --# # Application Layout --# --# This view template is used as the layout --# for every page that Administrate generates. --# --# By default, it renders: --# - Sidebar for navigation --# - Content for a search bar --# (if provided by a `content_for` block in a nested page) --# - Flashes --# - Links to stylesheets and Javascripts - -!!! -%html{ lang: I18n.locale } - %head - %meta{ charset: "utf-8" } - %meta{ content: "NOODP", :name => "ROBOTS" } - %meta{ content: "initial-scale=1", :name => "viewport" } - %title - = content_for(:title) - | #{Rails.application.class.parent_name.titlecase} - = render "stylesheet" - = stylesheet_link_tag "new_design/manager", media: "all", "data-turbolinks-track": true - = csrf_meta_tags - %body - .app-container - .sidebar - = render "sidebar" - %main.main-content{ role: "main" } - = content_for(:search) - = render "flashes" - = yield - = render "javascript" diff --git a/app/views/manager/administrateurs/index.html.haml b/app/views/manager/administrateurs/index.html.haml deleted file mode 100644 index 17b5ad587..000000000 --- a/app/views/manager/administrateurs/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -- content_for(:title) do - = display_resource_name(page.resource_name) - -- content_for(:search) do - - if show_search_bar - = render "search", search_term: search_term - -%header.header - %h1.header__heading#page-title - = content_for(:title) - .header__actions - = link_to 'nouveau', new_manager_administrateur_path, class: 'button' - -= render "collection", collection_presenter: page, resources: resources - -= paginate resources diff --git a/app/views/manager/administrateurs/show.html.erb b/app/views/manager/administrateurs/show.html.erb new file mode 100644 index 000000000..df139d013 --- /dev/null +++ b/app/views/manager/administrateurs/show.html.erb @@ -0,0 +1,57 @@ +<%# +# Show + +This view is the template for the show page. +It renders the attributes of a resource, +as well as a link to its edit page. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Show][1]. + Contains methods for accessing the resource to be displayed on the page, + as well as helpers for describing how each attribute of the resource + should be displayed. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show +%> + +<% content_for(:title) { "#{t("administrate.actions.show")} #{page.page_title}" } %> +<% procedure = page.resource %> + + + +
+
+ <% page.attributes.each do |attribute| %> +
+ <%= t( + "helpers.label.#{resource_name}.#{attribute.name}", + default: attribute.name.titleize, + ) %> +
+ +
<%= render_field attribute %>
+ <% end %> +
+
diff --git a/app/views/manager/application/_collection.html.haml b/app/views/manager/application/_collection.html.haml deleted file mode 100644 index ca18cdcd2..000000000 --- a/app/views/manager/application/_collection.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%table.collection-data{ "aria-labelledby": "page-title" } - %thead - %tr - - collection_presenter.attribute_types.each do |attr_name, attr_type| - %th.cell-label{ class: "cell-label--#{attr_type.html_class} cell-label--#{collection_presenter.ordered_html_class(attr_name)}", scope: "col" } - = link_to(sanitized_order_params.merge(collection_presenter.order_params_for(attr_name))) do - = t("helpers.label.#{resource_name}.#{attr_name}", default: attr_name.to_s).titleize - - - if collection_presenter.ordered_by?(attr_name) - %span.cell-label__sort-indicator{ class: "cell-label__sort-indicator--#{collection_presenter.ordered_html_class(attr_name)}" } - = svg_tag("administrate/sort_arrow.svg", "sort_arrow", width: "13", height: "13") - %th{ colspan: "2", scope: "col" } - - %tbody - - resources.each do |resource| - %tr.table__row{ role: "link", tabindex: "0", "data-url": polymorphic_path([namespace, resource]) } - - collection_presenter.attributes_for(resource).each do |attribute| - %td.cell-data{ class: "cell-data--#{attribute.html_class}" } - = link_to polymorphic_path([namespace, resource]), class: "action-show table__link-plain" do - = render_field attribute diff --git a/app/views/manager/application/_flashes.html.haml b/app/views/manager/application/_flashes.html.haml deleted file mode 100644 index f5fd0ebc9..000000000 --- a/app/views/manager/application/_flashes.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- if flash.any? - .flashes - - flash.each do |key, value| - .flash{ class: "flash--#{key}" } - = value diff --git a/app/views/manager/application/_javascript.html.haml b/app/views/manager/application/_javascript.html.haml deleted file mode 100644 index de1850bf7..000000000 --- a/app/views/manager/application/_javascript.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- Administrate::Engine.javascripts.each do |js_path| - = javascript_include_tag js_path - -= yield :javascript - -- if Rails.env.test? - = javascript_tag do - $.fx.off = true; - $.ajaxSetup({ async: false }); diff --git a/app/views/manager/application/_navigation.html.erb b/app/views/manager/application/_navigation.html.erb new file mode 100644 index 000000000..ba8850049 --- /dev/null +++ b/app/views/manager/application/_navigation.html.erb @@ -0,0 +1,26 @@ +<%# +# Navigation + +This partial is used to display the navigation in Administrate. +By default, the navigation contains navigation links +for all resources in the admin dashboard, +as defined by the routes in the `admin/` namespace +%> + + diff --git a/app/views/manager/application/_sidebar.html.haml b/app/views/manager/application/_sidebar.html.haml deleted file mode 100644 index feb738b62..000000000 --- a/app/views/manager/application/_sidebar.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%ul.sidebar__list - %li - = link_to "Se déconnecter", manager_sign_out_path, method: :delete, class: "sidebar__link" - -%hr{ style: "margin-bottom: 0;" } - -%ul.sidebar__list - - Administrate::Namespace.new(namespace).resources.each do |resource| - %li - = link_to(display_resource_name(resource), [namespace, resource], class: "sidebar__link sidebar__link--#{nav_link_state(resource)}") - -%hr{ style: "margin-bottom: 0;" } - -%ul.sidebar__list - %li - = link_to "Delayed Job", manager_delayed_job_path, class: "sidebar__link" diff --git a/app/views/manager/application/index.html.haml b/app/views/manager/application/index.html.haml deleted file mode 100644 index ce051bf66..000000000 --- a/app/views/manager/application/index.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- content_for(:title) do - = display_resource_name(page.resource_name) - -- content_for(:search) do - - if show_search_bar - = render "search", search_term: search_term - -%header.header - %h1.header__heading#page-title - = content_for(:title) - .header__actions - -= render "collection", collection_presenter: page, resources: resources - -= paginate resources diff --git a/app/views/manager/application/show.html.haml b/app/views/manager/application/show.html.haml deleted file mode 100644 index a17f35005..000000000 --- a/app/views/manager/application/show.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -- content_for(:title) { page.page_title } - -%header.header - %h1.header__heading= content_for(:title) - .header__actions - -%dl - - page.attributes.each do |attribute| - %dt.attribute-label - = t("helpers.label.#{resource_name}.#{attribute.name}", default: attribute.name.titleize) - - %dd.attribute-data{ class: "attribute-data--#{attribute.html_class}" } - = render_field attribute diff --git a/app/views/manager/procedures/show.html.erb b/app/views/manager/procedures/show.html.erb new file mode 100644 index 000000000..fda6239e9 --- /dev/null +++ b/app/views/manager/procedures/show.html.erb @@ -0,0 +1,57 @@ +<%# +# Show + +This view is the template for the show page. +It renders the attributes of a resource, +as well as a link to its edit page. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Show][1]. + Contains methods for accessing the resource to be displayed on the page, + as well as helpers for describing how each attribute of the resource + should be displayed. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show +%> + +<% content_for(:title) { "#{t("administrate.actions.show")} #{page.page_title}" } %> +<% procedure = page.resource %> + + + +
+
+ <% page.attributes.each do |attribute| %> +
+ <%= t( + "helpers.label.#{resource_name}.#{attribute.name}", + default: attribute.name.titleize, + ) %> +
+ +
<%= render_field attribute %>
+ <% end %> +
+
diff --git a/app/views/manager/procedures/show.html.haml b/app/views/manager/procedures/show.html.haml deleted file mode 100644 index 1627fa667..000000000 --- a/app/views/manager/procedures/show.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -- content_for(:title) { page.page_title } -- procedure = page.resource - -%header.header - %h1.header__heading= content_for(:title) - .header__actions - - if !procedure.whitelisted? - = link_to 'whitelister', whitelist_manager_procedure_path(procedure), method: :post, class: 'button' - -%dl - - page.attributes.each do |attribute| - %dt.attribute-label - = t("helpers.label.#{resource_name}.#{attribute.name}", default: attribute.name.titleize) - - %dd.attribute-data{ class: "attribute-data--#{attribute.html_class}" } - = render_field attribute