mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-29 06:21:16 +00:00
Allow updating of account settings from account tabs interface
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
%script{ type: "text/ng-template", id: "account/details.html" }
|
||||
Details
|
||||
6
app/views/spree/users/_form.html.haml
Normal file
6
app/views/spree/users/_form.html.haml
Normal file
@@ -0,0 +1,6 @@
|
||||
= render :partial => 'spree/shared/error_messages', :locals => { :target => @user }
|
||||
%h3= t('.account_settings')
|
||||
= form_for Spree::User.new, :as => @user, :url => spree.user_path(@user), :method => :put do |f|
|
||||
= render :partial => 'spree/shared/user_form', :locals => { :f => f }
|
||||
%p
|
||||
= f.submit t(:update), :class => 'button primary'
|
||||
2
app/views/spree/users/_settings.html.haml
Normal file
2
app/views/spree/users/_settings.html.haml
Normal file
@@ -0,0 +1,2 @@
|
||||
%script{ type: "text/ng-template", id: "account/settings.html" }
|
||||
= render 'form'
|
||||
@@ -1,8 +1,3 @@
|
||||
.darkswarm
|
||||
.row
|
||||
= render :partial => 'spree/shared/error_messages', :locals => { :target => @user }
|
||||
%h1= t(:editing_user)
|
||||
= form_for Spree::User.new, :as => @user, :url => spree.user_path(@user), :method => :put do |f|
|
||||
= render :partial => 'spree/shared/user_form', :locals => { :f => f }
|
||||
%p
|
||||
= f.submit t(:update), :class => 'button primary'
|
||||
= render 'form'
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
= accurate_title
|
||||
%span.account-summary{"data-hook" => "account_summary"}
|
||||
= @user.email
|
||||
(#{link_to t(:edit), spree.edit_account_path})
|
||||
|
||||
= render 'orders'
|
||||
= render 'cards'
|
||||
= render 'transactions'
|
||||
= render 'cards'
|
||||
= render 'settings'
|
||||
|
||||
.row.tabset-ctrl#account-tabs{ style: 'margin-bottom: 100px', navigate: 'true', selected: 'orders', prefix: 'account' }
|
||||
.small.12.medium-3.columns.tab{ name: "orders" }
|
||||
@@ -26,8 +25,8 @@
|
||||
%a{ href: 'javascript:void(0)' }=t('.tabs.cards')
|
||||
.small.12.medium-3.columns.tab{ name: "transactions" }
|
||||
%a{ href: 'javascript:void(0)' }=t('.tabs.transactions')
|
||||
.small.12.medium-3.columns.tab{ name: "details" }
|
||||
%a{ href: 'javascript:void(0)' }=t('.tabs.details')
|
||||
.small.12.medium-3.columns.tab{ name: "settings" }
|
||||
%a{ href: 'javascript:void(0)' }=t('.tabs.settings')
|
||||
.small-12.columns.tab-view
|
||||
|
||||
= render partial: "shared/footer"
|
||||
|
||||
@@ -2187,12 +2187,14 @@ Please follow the instructions there to make your enterprise visible on the Open
|
||||
weight: Weight (per kg)
|
||||
zipcode: Postcode
|
||||
users:
|
||||
form:
|
||||
account_settings: Account Settings
|
||||
show:
|
||||
tabs:
|
||||
orders: Orders
|
||||
cards: Credit Cards
|
||||
transactions: Transactions
|
||||
details: Details
|
||||
settings: Account Settings
|
||||
orders:
|
||||
open_orders: Open Orders
|
||||
past_orders: Past Orders
|
||||
|
||||
27
spec/features/consumer/account/settings_spec.rb
Normal file
27
spec/features/consumer/account/settings_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature "Account Settings", js: true do
|
||||
include AuthenticationWorkflow
|
||||
|
||||
describe "as a logged in user" do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
before do
|
||||
quick_login_as user
|
||||
end
|
||||
|
||||
it "allows me to update my account details" do
|
||||
visit "/account"
|
||||
|
||||
click_link I18n.t('spree.users.show.tabs.settings')
|
||||
expect(page).to have_content I18n.t('spree.users.form.account_settings')
|
||||
fill_in 'user_email', with: 'new@email.com'
|
||||
|
||||
click_button I18n.t(:update)
|
||||
|
||||
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t(:account_updated)} ×"
|
||||
user.reload
|
||||
expect(user.email).to eq 'new@email.com'
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user