mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add spree_backend views related to admin/configuration menu that are missing in ofn
This commit is contained in:
22
app/views/spree/admin/countries/_form.html.erb
Normal file
22
app/views/spree/admin/countries/_form.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<div data-hook="admin_country_form_fields" class="row">
|
||||
<div class="alpha four columns">
|
||||
<div data-hook="name" class="field">
|
||||
<%= f.label :name, Spree.t(:name) %>
|
||||
<%= f.text_field :name, :class => 'fullwidth' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="four columns">
|
||||
<div data-hook="iso_name" class="field">
|
||||
<%= f.label :iso_name, Spree.t(:iso_name) %>
|
||||
<%= f.text_field :iso_name, :class => 'fullwidth' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="omega four columns">
|
||||
<div data-hook="states_required" class="field checkbox">
|
||||
<label>
|
||||
<%= f.check_box :states_required %>
|
||||
<%= Spree.t(:states_required) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
21
app/views/spree/admin/countries/edit.html.erb
Normal file
21
app/views/spree/admin/countries/edit.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
||||
|
||||
<% content_for :page_title do %>
|
||||
<%= Spree.t(:editing_country) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :page_actions do %>
|
||||
<li>
|
||||
<%= button_link_to Spree.t(:back_to_countries_list), spree.admin_countries_path, :icon => 'icon-arrow-left' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @country } %>
|
||||
|
||||
<%= form_for [:admin, @country] do |f| %>
|
||||
<fieldset class="no-border-top">
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<div class="clear"></div>
|
||||
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
34
app/views/spree/admin/countries/index.html.erb
Normal file
34
app/views/spree/admin/countries/index.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
||||
|
||||
<% content_for :page_title do %>
|
||||
<%= Spree.t(:listing_countries) %>
|
||||
<% end %>
|
||||
|
||||
<table class="index" id='listing_countries' data-hook>
|
||||
<colgroup>
|
||||
<col style="width: 35%" />
|
||||
<col style="width: 35%" />
|
||||
<col style="width: 20%" />
|
||||
<col style="width: 10%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr data-hook="tax_header">
|
||||
<th><%= Spree.t(:country_name) %></th>
|
||||
<th><%= Spree.t(:iso_name) %></th>
|
||||
<th><%= Spree.t(:states_required) %></th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @countries.each do |country| %>
|
||||
<tr id="<%= spree_dom_id country %>" data-hook="country_row" class="<%= cycle('odd', 'even')%>">
|
||||
<td><%= country.name %></td>
|
||||
<td><%= country.iso_name %></td>
|
||||
<td class="align-center"><%= country.states_required.to_s.titleize %></td>
|
||||
<td class="actions">
|
||||
<%= link_to_edit country, :no_text => true %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
14
app/views/spree/admin/states/_form.html.erb
Normal file
14
app/views/spree/admin/states/_form.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<div data-hook="admin_state_form_fields" class="row">
|
||||
<div class="alpha six columns">
|
||||
<%= f.field_container :name do %>
|
||||
<%= f.label :name, Spree.t(:name) %>
|
||||
<%= f.text_field :name, :class => 'fullwidth' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="omega six columns">
|
||||
<%= f.field_container :abbr do %>
|
||||
<%= f.label :abbr, Spree.t(:abbreviation) %>
|
||||
<%= f.text_field :abbr, :class => 'fullwidth' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
31
app/views/spree/admin/states/_state_list.html.erb
Normal file
31
app/views/spree/admin/states/_state_list.html.erb
Normal file
@@ -0,0 +1,31 @@
|
||||
<div id="new_state" data-hook></div>
|
||||
|
||||
<table class="index" id='listing_states' data-hook>
|
||||
<colgroup>
|
||||
<col style="width: 70%" />
|
||||
<col style="width: 15%" />
|
||||
<col style="width: 15%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr data-hook="states_header">
|
||||
<th><%= Spree.t(:name) %></th>
|
||||
<th><%= Spree.t(:abbreviation) %></th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @states.each do |state| %>
|
||||
<tr id="<%= spree_dom_id state %>" data-hook="states_row" class="<%= cycle('odd', 'even')%>">
|
||||
<td><%= state.name %></td>
|
||||
<td class="align-center"><%= state.abbr %></td>
|
||||
<td class="actions">
|
||||
<%= 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 %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @states.empty? %>
|
||||
<tr><td colspan="3"><%= Spree.t(:none) %></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
20
app/views/spree/admin/states/edit.html.erb
Normal file
20
app/views/spree/admin/states/edit.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
||||
|
||||
<% content_for :page_title do %>
|
||||
<%= Spree.t(:editing_state) %> <i class="icon-arrow-right"></i> <%= @state.name %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :page_actions do %>
|
||||
<li>
|
||||
<%= button_link_to Spree.t(:back_to_states_list), spree.admin_country_states_url(@country), :icon => 'icon-arrow-left' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @state } %>
|
||||
|
||||
<%= form_for [:admin, @country, @state] do |f| %>
|
||||
<fieldset class="no-border-top">
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
24
app/views/spree/admin/states/index.html.erb
Normal file
24
app/views/spree/admin/states/index.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
||||
|
||||
<% content_for :page_title do %>
|
||||
<%= Spree.t(:states) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :page_actions do %>
|
||||
<li id="new_state_link">
|
||||
<%= button_link_to Spree.t(:new_state), new_admin_country_state_url(@country), { :remote => true, :icon => 'icon-plus', :id => 'new_state_link' } %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div data-hook="country" class="field row">
|
||||
<%= label_tag :country, Spree.t(:country) %>
|
||||
<select id="country" class='observe_field select2 fullwidth' data-base-url="<%=admin_states_path(:format => :js) %>?country_id=" data-update="#state-list">
|
||||
<%= options_from_collection_for_select(@countries, :id, :name, @country.id) %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<%= image_tag 'select2-spinner.gif', :plugin => 'spree', :style => 'display:none;', :id => 'busy_indicator' %>
|
||||
|
||||
<div id="state-list" data-hook>
|
||||
<%= render :partial => 'state_list'%>
|
||||
</div>
|
||||
15
app/views/spree/admin/states/new.html.erb
Normal file
15
app/views/spree/admin/states/new.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<%= 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| %>
|
||||
<fieldset>
|
||||
<legend><%= Spree.t(:new_state) %></legend>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
2
app/views/spree/admin/states/new.js.erb
Normal file
2
app/views/spree/admin/states/new.js.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
$("#new_state").html("<%= escape_javascript(render :template => 'spree/admin/states/new', :formats => [:html], :handlers => [:erb]) %>");
|
||||
$("#new_state_link").parent().hide();
|
||||
5
app/views/spree/admin/zones/_country_member.html.erb
Normal file
5
app/views/spree/admin/zones/_country_member.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<li data-hook="country_member">
|
||||
<%= f.hidden_field :zoneable_type, :value => 'Spree::Country' %>
|
||||
<%= f.collection_select(:zoneable_id, @countries, :id, :name, {:include_blank => true}, {:class => 'select2 fullwidth'}) %>
|
||||
<%= remove_nested f %>
|
||||
</li>
|
||||
34
app/views/spree/admin/zones/_form.html.erb
Normal file
34
app/views/spree/admin/zones/_form.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="alpha six columns" data-hook="admin_zone_form_fields">
|
||||
<fieldset class="no-border-bottom">
|
||||
<legend align="center"><%= Spree.t(:general_settings)%></legend>
|
||||
|
||||
<%= zone_form.field_container :name do %>
|
||||
<%= zone_form.label :name, Spree.t(:name) %><br />
|
||||
<%= zone_form.text_field :name, :class => 'fullwidth' %>
|
||||
<% end %>
|
||||
|
||||
<%= zone_form.field_container :description do %>
|
||||
<%= zone_form.label :description, Spree.t(:description) %><br />
|
||||
<%= zone_form.text_field :description, :class => 'fullwidth' %>
|
||||
<% end %>
|
||||
|
||||
<div data-hook="default" class="field">
|
||||
<%= zone_form.check_box :default_tax %>
|
||||
<%= label_tag Spree.t(:default_tax_zone) %>
|
||||
</div>
|
||||
|
||||
<div data-hook="type" class="field">
|
||||
<%= label_tag Spree.t(:type) %>
|
||||
<ul>
|
||||
<li>
|
||||
<%= zone_form.radio_button('kind', 'country', { :id => 'country_based' }) %>
|
||||
<%= label_tag :country_based, Spree.t(:country_based) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= zone_form.radio_button('kind', 'state', { :id => 'state_based' }) %>
|
||||
<%= label_tag :state_based, Spree.t(:state_based) %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
19
app/views/spree/admin/zones/_member_type.html.erb
Normal file
19
app/views/spree/admin/zones/_member_type.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<%= javascript_tag "var #{type}_member='#{generate_template(zone_form, :zone_members, {:partial => type + "_member"})}';" %>
|
||||
|
||||
|
||||
<div id="<%= type %>_members" data-hook="member" class="omega six columns">
|
||||
<fieldset class="no-border-bottom">
|
||||
<legend align="center"><%= Spree.t(type) %></legend>
|
||||
|
||||
<ul id="ul-nested-<%= type.dasherize %>" class="member-list fields">
|
||||
<% members_of_type = zone_form.object.zone_members.select { |member| member.zoneable_type && member.zoneable_type == "Spree::#{type.camelize}" } %>
|
||||
<%= zone_form.fields_for :zone_members, members_of_type do |member_form| %>
|
||||
<%= render :partial => "#{type}_member", :locals => { :f => member_form } %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div data-hook="buttons" class="field align-center">
|
||||
<%= button_link_to Spree.t("add_#{type}"), "##{type}_member", { :icon => 'icon-plus', :id => "nested-#{type.dasherize}" } %>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
5
app/views/spree/admin/zones/_state_member.html.erb
Normal file
5
app/views/spree/admin/zones/_state_member.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<li data-hook="state_member" class="field">
|
||||
<%= f.hidden_field :zoneable_type, :value => 'Spree::State' %>
|
||||
<%= f.collection_select(:zoneable_id, @states, :id, :name, {:include_blank => true}, {:class => 'select2 fullwidth'}) %>
|
||||
<%= remove_nested f %>
|
||||
</li>
|
||||
23
app/views/spree/admin/zones/edit.html.erb
Normal file
23
app/views/spree/admin/zones/edit.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
||||
|
||||
<% content_for :page_title do %>
|
||||
<%= Spree.t(:editing_zone) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :page_actions do %>
|
||||
<li>
|
||||
<%= button_link_to Spree.t(:back_to_zones_list), admin_zones_path, :icon => 'icon-arrow-left' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @zone } %>
|
||||
|
||||
<%= form_for [:admin, @zone] do |zone_form| %>
|
||||
<fieldset class="no-border-top">
|
||||
<%= render :partial => 'form', :locals => { :zone_form => zone_form } %>
|
||||
<%= render :partial => 'member_type', :locals => { :type => 'country', :zone_form => zone_form }%>
|
||||
<%= render :partial => 'member_type', :locals => { :type => 'state', :zone_form => zone_form } %>
|
||||
<div class="clear"></div>
|
||||
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
53
app/views/spree/admin/zones/index.html.erb
Normal file
53
app/views/spree/admin/zones/index.html.erb
Normal file
@@ -0,0 +1,53 @@
|
||||
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
||||
|
||||
<% content_for :page_title do %>
|
||||
<%= Spree.t(:zones) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :page_actions do %>
|
||||
<li>
|
||||
<%= button_link_to Spree.t(:new_zone), new_object_url, :icon => 'icon-plus', :id => 'admin_new_zone_link' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<%= paginate @zones %>
|
||||
|
||||
<% if @zones.empty? %>
|
||||
<div class="no-objects-found">
|
||||
<%= Spree.t(:none) %>
|
||||
</div>
|
||||
<% else %>
|
||||
<table class="index" id='listing_zones' data-hook>
|
||||
<colgroup>
|
||||
<col style="width: 30%" />
|
||||
<col style="width: 40%" />
|
||||
<col style="width: 15%" />
|
||||
<col style="width: 15%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr data-hook="zones_header">
|
||||
<th><%= sort_link @search,:name, Spree.t(:name), :title => 'zones_order_by_name_title' %></th>
|
||||
<th>
|
||||
<%= sort_link @search,:description, Spree.t(:description), {}, {:title => 'zones_order_by_description_title'} %>
|
||||
</th>
|
||||
<th><%= Spree.t(:default_tax) %></th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @zones.each do |zone| %>
|
||||
<tr id="<%= spree_dom_id zone %>" data-hook="zones_row" class="<%= cycle('odd', 'even')%>">
|
||||
<td><%=zone.name %></td>
|
||||
<td><%=zone.description %></td>
|
||||
<td class="align-center"><%=zone.default_tax %></td>
|
||||
<td class="actions">
|
||||
<%=link_to_edit zone, :no_text => true %>
|
||||
<%=link_to_delete zone, :no_text => true %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end%>
|
||||
|
||||
<%= paginate @zones %>
|
||||
21
app/views/spree/admin/zones/new.html.erb
Normal file
21
app/views/spree/admin/zones/new.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
||||
|
||||
<% content_for :page_title do %>
|
||||
<%= Spree.t(:new_zone) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :page_actions do %>
|
||||
<li>
|
||||
<%= button_link_to Spree.t(:back_to_zones_list), spree.admin_zones_path, :icon => 'icon-arrow-left' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @zone } %>
|
||||
|
||||
<%= form_for [:admin, @zone] do |zone_form| %>
|
||||
<%= render :partial => 'form', :locals => { :zone_form => zone_form } %>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user