mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
add supplier to product on admin views.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
Spree::Product.class_eval do
|
||||
attr_accessible :supplier_id
|
||||
|
||||
belongs_to :supplier
|
||||
end
|
||||
9
app/overrides/add_supplier_to_product.rb
Normal file
9
app/overrides/add_supplier_to_product.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
Deface::Override.new(:virtual_path => "spree/admin/products/_form",
|
||||
:insert_top => "[data-hook='admin_product_form_right']",
|
||||
:partial => "spree/admin/products/supplier",
|
||||
:name => "supplier")
|
||||
|
||||
Deface::Override.new(:virtual_path => "spree/admin/products/new",
|
||||
:insert_bottom => ".left",
|
||||
:partial => "spree/admin/products/supplier",
|
||||
:name => "supplier")
|
||||
5
app/views/spree/admin/products/_supplier.html.haml
Normal file
5
app/views/spree/admin/products/_supplier.html.haml
Normal file
@@ -0,0 +1,5 @@
|
||||
= f.field_container :supplier do
|
||||
= f.label :supplier
|
||||
%br
|
||||
= f.collection_select(:supplier_id, Spree::Supplier.all, :id, :name, :include_blank => true)
|
||||
= f.error_message_on :supplier
|
||||
36
spec/request/product_spec.rb
Normal file
36
spec/request/product_spec.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
require "spec_helper"
|
||||
|
||||
feature %q{
|
||||
As a supplier
|
||||
I want to myself as the supplier of a product
|
||||
} do
|
||||
# include AuthenticationWorkflow
|
||||
# include WebHelper
|
||||
|
||||
background do
|
||||
# @booking = Booking.make_booking
|
||||
# @product_manager = User.make(:product_manager)
|
||||
end
|
||||
|
||||
context "Given I am editing a booking" do
|
||||
scenario "I should be able to add a new note", :js =>true do
|
||||
# user = Factory(:admin_user, :email => "c@example.com")
|
||||
# sign_in_as!(user)
|
||||
|
||||
visit spree.admin_path
|
||||
click_link 'New Product'
|
||||
# page.should have_content 'Notes'
|
||||
# fill_in 'booking_note_comment', :with => 'A new note !!!'
|
||||
# click_button 'Add note'
|
||||
|
||||
# #flash_message.should == 'Booking Note successfully created.'
|
||||
|
||||
# within('.notes-list') do
|
||||
# page.should have_content('A new note !!!')
|
||||
# page.should have_content(@product_manager.name)
|
||||
# end
|
||||
# click_link 'Back to Dashboard'
|
||||
# page.should have_content 'Booking details'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test'
|
||||
require File.expand_path("../../config/environment", __FILE__)
|
||||
require 'rspec/rails'
|
||||
require 'rspec/autorun'
|
||||
require 'capybara'
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||
# in spec/support/ and its subdirectories.
|
||||
@@ -29,4 +30,6 @@ RSpec.configure do |config|
|
||||
# automatically. This will be the default behavior in future versions of
|
||||
# rspec-rails.
|
||||
config.infer_base_class_for_anonymous_controllers = false
|
||||
|
||||
config.include Spree::UrlHelpers
|
||||
end
|
||||
|
||||
7
spec/support/spree/url_helpers.rb
Normal file
7
spec/support/spree/url_helpers.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Spree
|
||||
module UrlHelpers
|
||||
def spree
|
||||
Spree::Core::Engine.routes.url_helpers
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user