Edit long description field in admin for suppliers and distributors

This commit is contained in:
Rohan Mitchell
2012-10-10 11:57:49 +11:00
parent d080aa49d5
commit c07a33d88c
6 changed files with 68 additions and 18 deletions

View File

@@ -5,6 +5,9 @@
%tr{"data-hook" => "description"}
%td Description:
%td= f.text_field :description
%tr{'data-hook' => "long_description"}
%td Extended Description:
%td= f.text_area :long_description
%tr{"data-hook" => "contact"}
%td Contact:
%td= f.text_field :contact

View File

@@ -6,6 +6,9 @@
%tr
%th Description:
%td= @distributor.description
%tr
%th Extended Description:
%td= @distributor.long_description
%tr
%th Contact person:
%td= @distributor.contact

View File

@@ -5,6 +5,9 @@
%tr{'data-hook' => "description"}
%td Description:
%td= f.text_field :description
%tr{'data-hook' => "long_description"}
%td Extended Description:
%td= f.text_area :long_description
= f.fields_for :address do |address_form|
= render 'spree/admin/shared/address_form', :f => address_form
%tr{'data-hook' => "email"}

View File

@@ -6,6 +6,9 @@
%tr
%th Description:
%td= @supplier.description
%tr
%th Extended Description:
%td= @supplier.long_description
%tr
%th Address:
%td= render 'spree/shared/address', :address => @supplier.address

View File

@@ -8,6 +8,25 @@ feature %q{
include WebHelper
scenario "listing distributors" do
d = create(:distributor)
login_to_admin_section
click_link 'Distributors'
page.should have_content d.name
end
scenario "viewing a distributor" do
d = create(:distributor)
login_to_admin_section
click_link 'Distributors'
click_link d.name
page.should have_content d.name
end
scenario "creating a new distributor" do
login_to_admin_section
@@ -16,6 +35,7 @@ feature %q{
fill_in 'distributor_name', :with => 'Eaterprises'
fill_in 'distributor_description', :with => 'Connecting farmers and eaters'
fill_in 'distributor_long_description', :with => 'Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro.'
fill_in 'distributor_contact', :with => 'Kirsten or Ren'
fill_in 'distributor_phone', :with => '0413 897 321'

View File

@@ -10,29 +10,47 @@ feature %q{
background do
end
context "setting up suppliers" do
scenario "creating a new supplier" do
login_to_admin_section
scenario "listing suppliers" do
s = create(:supplier)
click_link 'Suppliers'
click_link 'New Supplier'
login_to_admin_section
click_link 'Suppliers'
fill_in 'supplier_name', :with => 'David Arnold'
fill_in 'supplier_description', :with => 'A farmer with a difference'
page.should have_content s.name
end
fill_in 'supplier_address_attributes_address1', :with => '35 Byron Ave'
fill_in 'supplier_address_attributes_city', :with => 'Ararat'
fill_in 'supplier_address_attributes_zipcode', :with => '1112'
select('Australia', :from => 'supplier_address_attributes_country_id')
select('Victoria', :from => 'supplier_address_attributes_state_id')
scenario "viewing a supplier" do
s = create(:supplier)
fill_in 'supplier_email', :with => 'david@here.com'
fill_in 'supplier_website', :with => 'http://somewhere.com'
fill_in 'supplier_twitter', :with => 'davida'
login_to_admin_section
click_link 'Suppliers'
click_link s.name
click_button 'Create'
page.should have_content s.name
end
flash_message.should == 'Supplier "David Arnold" has been successfully created!'
end
scenario "creating a new supplier" do
login_to_admin_section
click_link 'Suppliers'
click_link 'New Supplier'
fill_in 'supplier_name', :with => 'David Arnold'
fill_in 'supplier_description', :with => 'A farmer with a difference'
fill_in 'supplier_long_description', :with => 'Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro.'
fill_in 'supplier_address_attributes_address1', :with => '35 Byron Ave'
fill_in 'supplier_address_attributes_city', :with => 'Ararat'
fill_in 'supplier_address_attributes_zipcode', :with => '1112'
select('Australia', :from => 'supplier_address_attributes_country_id')
select('Victoria', :from => 'supplier_address_attributes_state_id')
fill_in 'supplier_email', :with => 'david@here.com'
fill_in 'supplier_website', :with => 'http://somewhere.com'
fill_in 'supplier_twitter', :with => 'davida'
click_button 'Create'
flash_message.should == 'Supplier "David Arnold" has been successfully created!'
end
end