Skip to content

Commit

Permalink
Enable setting a customized user guide link in general settings for a…
Browse files Browse the repository at this point in the history
…dmin
  • Loading branch information
HugsDaniel committed Sep 12, 2018
1 parent 5e0997d commit 030730b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module GeneralSettingsEditPreferences
def edit
super
@preferences_general << :bugherd_api_key
@preferences_general << :user_guide_link
end
end
GeneralSettingsController.send(:prepend, GeneralSettingsEditPreferences)
Expand Down
3 changes: 3 additions & 0 deletions app/models/spree/app_configuration_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# we can allow to be modified in the UI by adding appropriate form
# elements to existing or new configuration pages.

# General Preferences
preference :user_guide_link, :string, default: nil

# Embedded Shopfronts
preference :enable_embedded_shopfronts, :boolean, default: false
preference :embedded_shopfronts_whitelist, :text, default: nil
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/shared/_user_guide_link.html.haml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
= button_link_to t('.user_guide'), "http://www.openfoodnetwork.org/platform/user-guide/", icon: 'icon-external-link', target: '_blank'
= button_link_to t('.user_guide'), Spree::Config.user_guide_link, icon: 'icon-external-link', target: '_blank'
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ To activate your Profile we need to confirm this email address."
email_confirmation_link_label: "Confirm this email address »"
email_confirmation_help_html: "After confirming your email you can access your administration account for this enterprise.
See the %{link} to find out more about %{sitename}'s features and to start using your profile or online store."
email_confirmation_notice_unexpected: "You received this message because you signed up on %{sitename}, or were invited to sign up by someone you probably know. If you don't understand why you are receiving this email, please write to %{contact}."
email_confirmation_notice_unexpected: "You received this message because you signed up on %{sitename}, or were invited to sign up by someone you probably know. If you don't understand why you are receiving this email, please write to %{contact}."
email_social: "Connect with Us:"
email_contact: "Email us:"
email_signoff: "Cheers,"
Expand Down Expand Up @@ -2382,6 +2382,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
order_information: "Order Information"
date_completed: "Date Completed"
amount: "Amount"
user_guide_link: "User Guide Link"
state_names:
ready: Ready
pending: Pending
Expand Down
22 changes: 22 additions & 0 deletions spec/features/admin/general_settings_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'spec_helper'

feature 'General Settings' do
include AuthenticationWorkflow

describe "update" do
before do
Spree::Config.user_guide_link = nil
login_to_admin_section
end

it 'lets me set the instance user guide link' do
visit spree.edit_admin_general_settings_path

fill_in 'user_guide_link', with: 'http://www.openfoodnetwork.org/platform/user-guide/'
click_button 'Update'

expect(page).to have_content 'General Settings has been successfully updated!'
expect(Spree::Config.user_guide_link).to eq 'http://www.openfoodnetwork.org/platform/user-guide/'
end
end
end

0 comments on commit 030730b

Please sign in to comment.