diff --git a/app/views/spree/admin/states/_form.html.erb b/app/views/spree/admin/states/_form.html.erb deleted file mode 100644 index c9dff9e35c..0000000000 --- a/app/views/spree/admin/states/_form.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -
-
- <%= f.field_container :name do %> - <%= f.label :name, Spree.t(:name) %> - <%= f.text_field :name, :class => 'fullwidth' %> - <% end %> -
-
- <%= f.field_container :abbr do %> - <%= f.label :abbr, Spree.t(:abbreviation) %> - <%= f.text_field :abbr, :class => 'fullwidth' %> - <% end %> -
-
diff --git a/app/views/spree/admin/states/_form.html.haml b/app/views/spree/admin/states/_form.html.haml new file mode 100644 index 0000000000..9f56da37d9 --- /dev/null +++ b/app/views/spree/admin/states/_form.html.haml @@ -0,0 +1,9 @@ +.row + .alpha.six.columns + = f.field_container :name do + = f.label :name, t("spree.name") + = f.text_field :name, class: 'fullwidth' + .omega.six.columns + = f.field_container :abbr do + = f.label :abbr, t("spree.abbreviation") + = f.text_field :abbr, class: 'fullwidth' diff --git a/app/views/spree/admin/states/_state_list.html.erb b/app/views/spree/admin/states/_state_list.html.erb deleted file mode 100644 index 177921eadb..0000000000 --- a/app/views/spree/admin/states/_state_list.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -
- - - - - - - - - - - - - - - - <% @states.each do |state| %> - - - - - - <% end %> - <% if @states.empty? %> - - <% end %> - -
<%= Spree.t(:name) %><%= Spree.t(:abbreviation) %>
<%= state.name %><%= state.abbr %> - <%= link_to_with_icon 'icon-edit', Spree.t(:edit), edit_admin_country_state_url(@country, state), :no_text => true %> - <%= link_to_delete state, :no_text => true %> -
<%= Spree.t(:none) %>
diff --git a/app/views/spree/admin/states/_state_list.html.haml b/app/views/spree/admin/states/_state_list.html.haml new file mode 100644 index 0000000000..688a08f114 --- /dev/null +++ b/app/views/spree/admin/states/_state_list.html.haml @@ -0,0 +1,24 @@ +#new_state +%table#listing_states.index + %colgroup + %col{:style => "width: 70%"}/ + %col{:style => "width: 15%"}/ + %col{:style => "width: 15%"}/ + %thead + %tr + %th= t("spree.name") + %th= t("spree.abbreviation") + %th.actions + %tbody + - @states.each do |state| + - tr_class = cycle('odd', 'even') + - tr_id = spree_dom_id(state) + %tr{class: tr_class, id: tr_id} + %td= state.name + %td.align-center= state.abbr + %td.actions + = link_to_with_icon 'icon-edit', t("spree.edit"), edit_admin_country_state_url(@country, state), no_text: true + = link_to_delete state, no_text: true + - if @states.empty? + %tr + %td{colspan: "3"}= t("spree.none") diff --git a/app/views/spree/admin/states/edit.html.erb b/app/views/spree/admin/states/edit.html.erb deleted file mode 100644 index a83c9d0f5e..0000000000 --- a/app/views/spree/admin/states/edit.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:editing_state) %> <%= @state.name %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:back_to_states_list), spree.admin_country_states_url(@country), :icon => 'icon-arrow-left' %> -
  • -<% end %> - -<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @state } %> - -<%= form_for [:admin, @country, @state] do |f| %> -
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> -
    -<% end %> diff --git a/app/views/spree/admin/states/edit.html.haml b/app/views/spree/admin/states/edit.html.haml new file mode 100644 index 0000000000..636d1d022d --- /dev/null +++ b/app/views/spree/admin/states/edit.html.haml @@ -0,0 +1,16 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = t("spree.editing_state") + %i.icon-arrow-right + = @state.name + +- content_for :page_actions do + %li + = button_link_to t("spree.back_to_states_list"), spree.admin_country_states_url(@country), icon: 'icon-arrow-left' + += render partial: 'spree/shared/error_messages', locals: { target: @state } += form_for [:admin, @country, @state] do |f| + %fieldset.no-border-top + = render partial: 'form', locals: { f: f } + = render partial: 'spree/admin/shared/edit_resource_links' diff --git a/app/views/spree/admin/states/index.html.erb b/app/views/spree/admin/states/index.html.erb deleted file mode 100644 index 3eba92daea..0000000000 --- a/app/views/spree/admin/states/index.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:states) %> -<% end %> - -<% content_for :page_actions do %> - -<% end %> - -
    - <%= label_tag :country, Spree.t(:country) %> - -
    - -<%= image_tag 'select2-spinner.gif', :plugin => 'spree', :style => 'display:none;', :id => 'busy_indicator' %> - -
    - <%= render :partial => 'state_list'%> -
    diff --git a/app/views/spree/admin/states/index.html.haml b/app/views/spree/admin/states/index.html.haml new file mode 100644 index 0000000000..9010f8a94c --- /dev/null +++ b/app/views/spree/admin/states/index.html.haml @@ -0,0 +1,16 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = t("spree.states") + +- content_for :page_actions do + %li#new_state_link + = button_link_to t("spree.new_state"), new_admin_country_state_url(@country), { remote: true, icon: 'icon-plus', id: 'new_state_link' } +.field.row + = label_tag :country, t("spree.country") + - databaseurl = "#{admin_states_path(format: :js)}?country_id=" + %select#country.observe_field.select2.fullwidth{"data-base-url": databaseurl, "data-update": "#state-list"} + = options_from_collection_for_select(@countries, :id, :name, @country.id) += image_tag 'select2-spinner.gif', plugin: 'spree', style: 'display:none;', id: 'busy_indicator' +#state-list + = render partial: 'state_list' diff --git a/app/views/spree/admin/states/new.html.erb b/app/views/spree/admin/states/new.html.erb deleted file mode 100644 index 1db852502c..0000000000 --- a/app/views/spree/admin/states/new.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @state } %> - -<% content_for :page_title do %> - <%= Spree.t(:new_state) %> -<% end %> - -<%= form_for [:admin, @country, @state] do |f| %> -
    - <%= Spree.t(:new_state) %> - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> -
    -<% end %> diff --git a/app/views/spree/admin/states/new.html.haml b/app/views/spree/admin/states/new.html.haml new file mode 100644 index 0000000000..f7b988b24c --- /dev/null +++ b/app/views/spree/admin/states/new.html.haml @@ -0,0 +1,12 @@ += render partial: 'spree/admin/shared/configuration_menu' + += render partial: 'spree/shared/error_messages', locals: { target: @state } + +- content_for :page_title do + = t("spree.new_state") + += form_for [:admin, @country, @state] do |f| + %fieldset + %legend= t("spree.new_state") + = render partial: 'form', locals: { f: f } + = render partial: 'spree/admin/shared/new_resource_links'