-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1282 from jhawthorn/edit_multiple_stores
Allow editing multiple Stores
- Loading branch information
Showing
14 changed files
with
174 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 1 addition & 27 deletions
28
backend/app/controllers/spree/admin/general_settings_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Spree | ||
module Admin | ||
class StoresController < Spree::Admin::ResourceController | ||
def index | ||
if Spree::Store.count == 1 | ||
redirect_to edit_admin_store_path(Spree::Store.first) | ||
else | ||
@stores = Spree::Store.all | ||
end | ||
end | ||
|
||
private | ||
|
||
def store_params | ||
params.require(:store).permit(permitted_params) | ||
end | ||
|
||
def permitted_params | ||
Spree::PermittedAttributes.store_attributes | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 0 additions & 80 deletions
80
backend/app/views/spree/admin/general_settings/edit.html.erb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
backend/app/views/spree/admin/shared/_settings_sub_menu.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<%= f.field_container :name do %> | ||
<%= f.label :name, class: 'required' %> | ||
<%= f.text_field :name, required: true, class: 'fullwidth' %> | ||
<%= f.error_message_on :name %> | ||
<% end %> | ||
|
||
<%= f.field_container :code do %> | ||
<%= f.label :code, class: 'required' %> | ||
<%= f.text_field :code, required: true, class: 'fullwidth' %> | ||
<%= f.error_message_on :code %> | ||
<% end %> | ||
|
||
<%= f.field_container :seo_title do %> | ||
<%= f.label :seo_title %> | ||
<%= f.field_hint :seo_title %> | ||
<%= f.text_field :seo_title, class: 'fullwidth' %> | ||
<%= f.error_message_on :seo_title %> | ||
<% end %> | ||
|
||
<%= f.field_container :meta_keywords do %> | ||
<%= f.label :meta_keywords %> | ||
<%= f.text_field :meta_keywords, class: 'fullwidth' %> | ||
<%= f.error_message_on :meta_keywords %> | ||
<% end %> | ||
|
||
<%= f.field_container :meta_description do %> | ||
<%= f.label :meta_description %> | ||
<%= f.text_field :meta_description, class: 'fullwidth' %> | ||
<%= f.error_message_on :meta_description %> | ||
<% end %> | ||
|
||
<%= f.field_container :url do %> | ||
<%= f.label :url, class: 'required' %> | ||
<%= f.text_field :url, required: true, class: 'fullwidth' %> | ||
<%= f.error_message_on :url %> | ||
<% end %> | ||
|
||
<%= f.field_container :mail_from_address do %> | ||
<%= f.label :mail_from_address, class: 'required' %> | ||
<%= f.text_field :mail_from_address, required: true, class: 'fullwidth' %> | ||
<%= f.error_message_on :mail_from_address %> | ||
<% end %> | ||
|
||
<%= f.field_container :cart_tax_country_iso do %> | ||
<%= f.label :cart_tax_country_iso %> | ||
<%= f.field_hint :cart_tax_country_iso %> | ||
<%= f.select :cart_tax_country_iso, | ||
Spree::Country.all.map { |c| [c.name, c.iso] }, | ||
{ include_blank: t(".no_cart_tax_country") }, | ||
{ class: "select2 fullwidth" } %> | ||
<%= f.error_message_on :cart_tax_country_iso %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<%= render 'spree/admin/shared/general_tabs' %> | ||
|
||
<% admin_breadcrumb(link_to(plural_resource_name(Spree::Store), admin_stores_path)) %> | ||
<% admin_breadcrumb(@store.name) %> | ||
|
||
<% content_for :page_actions do %> | ||
<li> | ||
<%= button_link_to Spree.t(:new_store), new_admin_store_url %> | ||
</li> | ||
<% end %> | ||
|
||
<%= form_for [:admin, @store] do |f| %> | ||
<fieldset class="no-border-top"> | ||
<%= render 'form', f: f %> | ||
<% if can? :update, @store %> | ||
<%= render 'spree/admin/shared/edit_resource_links' %> | ||
<% end %> | ||
</fieldset> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<%= render 'spree/admin/shared/general_tabs' %> | ||
|
||
<% content_for :page_title do %> | ||
<%= plural_resource_name(Spree::Store) %> | ||
<% end %> | ||
|
||
<% content_for :page_actions do %> | ||
<% if can?(:create, Spree::Store) %> | ||
<li> | ||
<%= link_to Spree.t(:new_store), new_admin_store_url, class: 'button' %> | ||
</li> | ||
<% end %> | ||
<% end %> | ||
|
||
<table class="index"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Url</th> | ||
<th class="actions"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @stores.each do |store| %> | ||
<tr> | ||
<td> | ||
<%= store.name %> | ||
<% if store.default? %> | ||
<span class="label label-default">default</span> | ||
<% end %> | ||
</td> | ||
<td><%= store.url %></td> | ||
<td class="actions"> | ||
<% if can?(:edit, store) %> | ||
<%= link_to_edit store, :no_text => true %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<%= render 'spree/admin/shared/general_tabs' %> | ||
|
||
<% admin_breadcrumb(link_to(plural_resource_name(Spree::Store), admin_stores_path)) %> | ||
<% admin_breadcrumb(Spree.t(:new_store)) %> | ||
|
||
<% content_for :page_actions do %> | ||
<% end %> | ||
|
||
<%= form_for [:admin, @store] do |f| %> | ||
<%= render 'form', f: f %> | ||
|
||
<% if can? :create, @store %> | ||
<%= render 'spree/admin/shared/new_resource_links' %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.