-
-
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.
- Loading branch information
Showing
13 changed files
with
169 additions
and
131 deletions.
There are no files selected for viewing
35 changes: 0 additions & 35 deletions
35
backend/app/controllers/spree/admin/general_settings_controller.rb
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
|
||
context "visiting general store settings" do | ||
it "should have the right content" do | ||
expect(page).to have_content("SettingsStore") | ||
expect(page).to have_field("store_name", with: "Test Store") | ||
expect(page).to have_field("store_url", with: "test.example.org") | ||
expect(page).to have_field("store_mail_from_address", with: "[email protected]") | ||
|
@@ -33,7 +32,7 @@ | |
fill_in "store_mail_from_address", with: "[email protected]" | ||
click_button "Update" | ||
|
||
assert_successful_update_message(:general_settings) | ||
expect(page).to have_content "successfully updated" | ||
expect(page).to have_field("store_name", with: "Spree Demo Site99") | ||
expect(page).to have_field("store_mail_from_address", with: "[email protected]") | ||
end | ||
|
@@ -44,18 +43,18 @@ | |
select "Germany", from: "Tax Country for Empty Carts" | ||
click_button "Update" | ||
|
||
assert_successful_update_message(:general_settings) | ||
expect(page).to have_content("has been successfully updated") | ||
expect(page).to have_select("Tax Country for Empty Carts", selected: "Germany") | ||
end | ||
end | ||
|
||
context "update fails" do | ||
it "should display the error" do | ||
fill_in "Site Name", with: "" | ||
fill_in "Site Name", with: " " | ||
click_button "Update" | ||
|
||
expect(page).to have_content("can't be blank") | ||
expect(page).to have_field("Site Name", with: "") | ||
expect(page).to have_field("Site Name", with: " ") | ||
end | ||
end | ||
end |
Oops, something went wrong.