Skip to content

Commit

Permalink
Update admin pages style views
Browse files Browse the repository at this point in the history
  • Loading branch information
jtapia committed Mar 6, 2018
1 parent 5c7e28c commit 84d91f8
Show file tree
Hide file tree
Showing 10 changed files with 276 additions and 165 deletions.
181 changes: 101 additions & 80 deletions app/views/spree/admin/pages/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,98 +1,119 @@
<div data-hook="admin_page_form_fields">
<div class="left eight columns alpha" data-hook="admin_page_form_left">

<%= f.field_container :title do %>
<%= f.label :title %> <span class="required">*</span><br />
<%= f.text_field :title, :class => 'fullwidth title' %>
<%= f.error_message_on :title %>
<% end %>
<%= f.field_container :slug do %>
<%= f.label :slug %> <span class="required">*</span><br />
<%= f.text_field :slug, :class => 'fullwidth title' %>
<%= f.error_message_on :slug %>
<% end %>
<div data-hook='admin_page_form_fields'>
<div class='row'>
<div class='col-12'>
<%= f.field_container :title do %>
<%= f.label :title, class: 'required' %>
<%= f.text_field :title, required: true, class: 'fullwidth title' %>
<%= f.error_message_on :title %>
<% end %>
</div>

<%= f.field_container :body do %>
<%= f.label :body %> <span class="required">*</span><br />
<%= f.text_area :body, {rows: 12, :class => 'fullwidth'} %>
<%= f.error_message_on :body %>
<% end %>
<div class='col-12'>
<%= f.field_container :slug do %>
<%= f.label :slug, class: 'required' %>
<%= f.text_field :slug, required: true, class: 'fullwidth title' %>
<%= f.error_message_on :slug %>
<% end %>
</div>

<div class='col-12'>
<%= f.field_container :body do %>
<%= f.label :body, class: 'required' %>
<%= f.text_area :body, class: 'fullwidth', rows: 12 %>
<%= f.error_message_on :body %>
<% end %>
</div>
</div>
<div class="right four columns omega" data-hook="admin_page_form_right">

<%= f.field_container :layout do %>
<%= f.label :layout %><br />
<%= f.text_field :layout, :class => 'fullwidth title' %>
<% end %>
<%= f.field_container :foreign_link do %>
<%= f.label :foreign_link %><br />
<%= f.text_field :foreign_link, :class => 'fullwidth title' %>
<% end %>
<%= f.field_container :position do %>
<%= f.label :position %><br />
<%= f.number_field :position, :min => 0, :class => 'fullwidth title' %>
<% end %>
<div class='row'>
<div class='col-6'>
<%= f.field_container :layout do %>
<%= f.label :layout %>
<%= f.text_field :layout, class: 'fullwidth title' %>
<% end %>
</div>

<%= f.field_container :show_in_sidebar do %>
<%= f.check_box :show_in_sidebar %>
<%= f.label :show_in_sidebar %>
<% end %>
<div class='col-6'>
<%= f.field_container :foreign_link do %>
<%= f.label :foreign_link %>
<%= f.text_field :foreign_link, class: 'fullwidth title' %>
<% end %>
</div>
</div>

<%= f.field_container :show_in_heade do %>
<%= f.check_box :show_in_header %>
<%= f.label :show_in_header %>
<% end %>
<div class='row'>
<div class='col-2'>
<%= f.field_container :show_in_sidebar do %>
<%= f.check_box :show_in_sidebar %>
<%= f.label :show_in_sidebar %>
<% end %>
</div>

<%= f.field_container :show_in_footer do %>
<%= f.check_box :show_in_footer %>
<%= f.label :show_in_footer %>
<% end %>
<div class='col-2'>
<%= f.field_container :show_in_heade do %>
<%= f.check_box :show_in_header %>
<%= f.label :show_in_header %>
<% end %>
</div>

<%= f.field_container :visible do %>
<%= f.check_box :visible %>
<%= f.label :visible %>
<% end %>
<div class='col-2'>
<%= f.field_container :show_in_footer do %>
<%= f.check_box :show_in_footer %>
<%= f.label :show_in_footer %>
<% end %>
</div>

<%= f.field_container :render_layout_as_partial do %>
<%= f.check_box :render_layout_as_partial %>
<%= f.label :render_layout_as_partial %>
<% end %>
<div class='col-2'>
<%= f.field_container :visible do %>
<%= f.check_box :visible %>
<%= f.label :visible %>
<% end %>
</div>

<%= f.field_container :stores do %>
<%= f.label :stores, Spree.t(:stores)%><br />
<% Spree::Store.all.each do |store| %>
<%= check_box_tag "page[store_ids][]", store.id, @page.stores.include?(store) %> <%= store.name %>
<div class='col-2'>
<%= f.field_container :render_layout_as_partial do %>
<%= f.check_box :render_layout_as_partial %>
<%= f.label :render_layout_as_partial %>
<% end %>
<% end %>

</div>
</div>

<div data-hook="admin_page_form_meta" class="alpha omega twelve columns">

<%= f.field_container :meta_title do %>
<%= f.label :meta_title %><br />
<%= f.text_field :meta_title, :class => 'fullwidth title' %>
<%= f.error_message_on :meta_title %>
<% end %>
<div class='row'>
<div class='col-2'>
<%= f.field_container :stores do %>
<%= f.label :stores, Spree.t(:stores) %>
<br>
<% Spree::Store.all.each do |store| %>
<%= check_box_tag 'page[store_ids][]', store.id, @page.stores.include?(store) %>
<%= label_tag store.name %>
<% end %>
<% end %>
</div>
</div>

<%= f.field_container :meta_keywords do %>
<%= f.label :meta_keywords %><br />
<%= f.text_field :meta_keywords, :class => 'fullwidth title' %>
<%= f.error_message_on :meta_keywords %>
<% end %>
<div class='row'>
<div class='col-12'>
<%= f.field_container :meta_title do %>
<%= f.label :meta_title %>
<%= f.text_field :meta_title, class: 'fullwidth title' %>
<%= f.error_message_on :meta_title %>
<% end %>
</div>

<%= f.field_container :meta_description do %>
<%= f.label :meta_description %><br />
<%= f.text_field :meta_description, :class => 'fullwidth title' %>
<%= f.error_message_on :meta_description %>
<% end %>
<div class='col-12'>
<%= f.field_container :meta_keywords do %>
<%= f.label :meta_keywords %>
<%= f.text_field :meta_keywords, class: 'fullwidth title' %>
<%= f.error_message_on :meta_keywords %>
<% end %>
</div>

<div class='col-12'>
<%= f.field_container :meta_description do %>
<%= f.label :meta_description %>
<%= f.text_field :meta_description, class: 'fullwidth title' %>
<%= f.error_message_on :meta_description %>
<% end %>
</div>
</div>
<div class="clear"></div>
<div data-hook="admin_page_form_additional_fields"></div>
<div class="clear"></div>
</div>
44 changes: 33 additions & 11 deletions app/views/spree/admin/pages/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
<%= render 'spree/admin/shared/configuration_menu' %>
<% if SolidusSupport.solidus_gem_version > Gem::Version.new('1.3.x') %>
<%= render 'spree/admin/shared/pages_tabs' %>
<% content_for :page_title do %>
<%= Spree.t("static_content.static_pages") %> <i class="icon-arrow-right"></i> <%= Spree.t("static_content.editing_page") %> "<%= @page.title%>"
<% end %>
<% admin_breadcrumb(Spree.t('settings')) %>
<% admin_breadcrumb(link_to plural_resource_name(Spree::Page), spree.admin_pages_path) %>
<% admin_breadcrumb(@page.title) %>
<% content_for :page_actions do %>
<% end %>
<% else %>
<%= render partial: 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t('static_content.editing_shipping_category') %>
<% end %>
<% content_for :page_actions do %>
<li><%= button_link_to Spree.t(:back_to_static_pages_list), spree.admin_pages_url %></li>
<% content_for :page_actions do %>
<li>
<%= button_link_to Spree.t(:back_to_static_pages_list), spree.admin_pages_path, icon: 'arrow-left' %>
</li>
<% end %>
<% end %>

<%= render "spree/shared/error_messages", :target => @page %>
<div data-hook='admin_page_edit_form_header'>
<%= render partial: 'spree/shared/error_messages', locals: { target: @page } %>
</div>

<%= form_for [:admin, @page], as: :page, url: admin_page_path(@page) do |f| %>
<fieldset class='no-border-top'>
<%= render partial: 'form', locals: { f: f } %>

<div class='clear'></div>

<%= form_for [:admin, @page] do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
<div data-hook='admin_page_edit_form_buttons'>
<% if can?(:update, @page) %>
<%= render partial: 'spree/admin/shared/edit_resource_links' %>
<% end %>
</div>
</fieldset>
<% end %>
121 changes: 80 additions & 41 deletions app/views/spree/admin/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,51 +1,90 @@
<% content_for :page_actions do %>
<li><%= button_link_to Spree.t("static_content.new_page"), new_object_url, id: 'admin_new_page' %></li>
<% if SolidusSupport.solidus_gem_version > Gem::Version.new('1.3.x') %>
<%= render 'spree/admin/shared/pages_tabs' %>
<% admin_breadcrumb(Spree.t('settings')) %>
<% admin_breadcrumb(plural_resource_name(Spree::Page)) %>
<% content_for :page_actions do %>
<li>
<%= link_to Spree.t('static_content.new_page'), new_object_url, id: 'admin_new_page', class: 'btn btn-primary' %>
</li>
<% end if can?(:create, Spree::Page) %>
<% else %>
<%= render 'spree/admin/shared/configuration_menu' %>
<% content_for :page_actions do %>
<% if can?(:create, Spree::Page) %>
<li>
<%= button_link_to Spree.t(:new_page), new_object_url, icon: 'plus' %>
</li>
<% end %>
<% end %>
<% end %>
<% content_for :page_title do %>
<%= Spree.t("static_content.static_pages") %>
<%= Spree.t('static_content.static_pages') %>
<% end %>
<% if @pages.any? %>
<table class="index responsive" id="listing_pages" data-hook>
<colgroup>
<col style="width: 40%">
<col style="width: 35%">
<col style="width: 10%">
<col style="width: 15%">
</colgroup>
<thead>
<tr data-hook="admin_pages_index_headers">
<th><%= Spree::Page.human_attribute_name(:title) %></th>
<th><%= Spree.t("static_content.link") %></th>
<th><%= Spree::Page.human_attribute_name(:visible) %></th>
<th data-hook="admin_pages_index_header_actions" class="actions"></th>
</tr>
</thead>
<table class='index sortable responsive' id='listing_pages' data-hook data-sortable-link='<%= update_positions_admin_pages_url %>'>
<colgroup>
<col style='width: 10%'>
<col style='width: 40%'>
<col style='width: 35%'>
<col style='width: 10%'>
<col style='width: 15%'>
</colgroup>

<tbody>
<% @pages.each do |page| %>
<tr data-hook="admin_pages_index_rows" class="<%= cycle('odd', 'even') %>" id="<%= dom_id page %>">
<td>
<%= page.title %>
</td>
<td>
<%= link_to page.link, page.link, :target => '_blank' %>
</td>
<td class="align-center">
<%= content_tag(:i, '', :class => 'icon-ok green') if page.visible %>
</td>
<td class="actions" data-hook="admin_pages_index_row_actions">
<%= link_to_edit page, :no_text => true %>
<%= link_to_delete page, :no_text => true %>
</td>
<thead>
<tr data-hook='admin_pages_index_headers'>
<th></th>
<th><%= Spree::Page.human_attribute_name(:title) %></th>
<th><%= Spree.t('static_content.link') %></th>
<th><%= Spree::Page.human_attribute_name(:visible) %></th>
<th data-hook='admin_pages_index_header_actions' class='actions'></th>
</tr>
<% end %>
</tbody>
</table>
</thead>

<tbody class='ui-sortable'>
<% @pages.each do |page| %>
<tr data-hook='admin_pages_index_rows' class="<%= cycle('odd', 'even') %>' id='<%= dom_id page %>">
<td>
<% if can?(:update_positions, Spree::StockLocation) %>
<span class='handle ui-sortable-handle'></span>
<% end %>
</td>
<td>
<%= page.title %>
</td>
<td>
<%= link_to page.link, page.link, target: '_blank' %>
</td>
<td>
<span class='pill pill-<%= page.visible ? 'active' : 'inactive' %>'>
<%= Spree.t(page.visible? ? :active : :inactive) %>
</span>
</td>
<td class='actions' data-hook='admin_pages_index_row_actions'>
<%= link_to_edit page, no_text: true %>
<%= link_to_delete page, no_text: true %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="alpha twelve columns no-objects-found">
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/page')) %>,
<%= link_to Spree.t(:add_one), spree.new_admin_page_path %>!
</div>
<% if SolidusSupport.solidus_gem_version > Gem::Version.new('1.3.x') %>
<div class='no-objects-found'>
<%= render 'spree/admin/shared/no_objects_found',
resource: Spree::Page,
new_resource_url: new_object_url %>
</div>
<% else %>
<div class='alpha twelve columns no-objects-found'>
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/page')) %>
<% if can?(:create, Spree::Page) %>
<%= link_to Spree.t('static_content.add_one'), spree.new_admin_page_path %>
<% end %>
</div>
<% end %>
<% end %>
Loading

0 comments on commit 84d91f8

Please sign in to comment.