Merge remote-tracking branch 'origin/rails3'
Conflicts: Gemfile Gemfile.lock
This commit is contained in:
commit
7a63394dac
6 changed files with 22 additions and 10 deletions
2
Gemfile
2
Gemfile
|
@ -65,4 +65,6 @@ group :development do
|
||||||
gem 'capistrano', '2.13.5'
|
gem 'capistrano', '2.13.5'
|
||||||
gem 'capistrano-ext'
|
gem 'capistrano-ext'
|
||||||
#gem 'common_deploy', require: false, path: '../../common_deploy' # pending foodcoops/foodsoft#34, git: 'git://github.com/fsmanuel/common_deploy.git'
|
#gem 'common_deploy', require: false, path: '../../common_deploy' # pending foodcoops/foodsoft#34, git: 'git://github.com/fsmanuel/common_deploy.git'
|
||||||
|
# Avoid having content-length warnings
|
||||||
|
gem 'thin'
|
||||||
end
|
end
|
||||||
|
|
|
@ -80,7 +80,7 @@ GEM
|
||||||
commonjs (0.2.6)
|
commonjs (0.2.6)
|
||||||
daemons (1.1.9)
|
daemons (1.1.9)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (1.0.0)
|
eventmachine (1.0.3)
|
||||||
exception_notification (2.6.1)
|
exception_notification (2.6.1)
|
||||||
actionmailer (>= 3.0.4)
|
actionmailer (>= 3.0.4)
|
||||||
execjs (1.4.0)
|
execjs (1.4.0)
|
||||||
|
@ -288,6 +288,7 @@ DEPENDENCIES
|
||||||
sqlite3
|
sqlite3
|
||||||
test-unit
|
test-unit
|
||||||
therubyracer
|
therubyracer
|
||||||
|
thin
|
||||||
twitter-bootstrap-rails
|
twitter-bootstrap-rails
|
||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
whenever
|
whenever
|
||||||
|
|
|
@ -35,11 +35,14 @@ $(function() {
|
||||||
|
|
||||||
// Check/Uncheck all checkboxes for a specific form
|
// Check/Uncheck all checkboxes for a specific form
|
||||||
$('input[data-check-all]').live('click', function() {
|
$('input[data-check-all]').live('click', function() {
|
||||||
var status = $(this).is(':checked')
|
var status = $(this).is(':checked');
|
||||||
$($(this).data('check-all')).find('input[type="checkbox"]').each(function() {
|
var context = $(this).data('check-all');
|
||||||
$(this).attr('checked', status);
|
var elms = $('input[type="checkbox"]', context);
|
||||||
highlightRow($(this));
|
for(i=elms.length-1; i>=0; --i) { // performance can be an issue here, so use native loop
|
||||||
});
|
var elm = elms[i];
|
||||||
|
elm.checked = status;
|
||||||
|
highlightRow($(elm));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Submit form when changing a select menu.
|
// Submit form when changing a select menu.
|
||||||
|
@ -102,7 +105,7 @@ $(function() {
|
||||||
|
|
||||||
// gives the row an yellow background
|
// gives the row an yellow background
|
||||||
function highlightRow(checkbox) {
|
function highlightRow(checkbox) {
|
||||||
var row = checkbox.parents('tr');
|
var row = checkbox.closest('tr');
|
||||||
if (checkbox.is(':checked')) {
|
if (checkbox.is(':checked')) {
|
||||||
row.addClass('selected');
|
row.addClass('selected');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SuppliersController < ApplicationController
|
||||||
def new
|
def new
|
||||||
if params[:shared_supplier_id]
|
if params[:shared_supplier_id]
|
||||||
shared_supplier = SharedSupplier.find(params[:shared_supplier_id])
|
shared_supplier = SharedSupplier.find(params[:shared_supplier_id])
|
||||||
@supplier = shared_supplier.build_supplier(shared_supplier.attributes)
|
@supplier = shared_supplier.build_supplier(shared_supplier.autofill_attributes)
|
||||||
else
|
else
|
||||||
@supplier = Supplier.new
|
@supplier = Supplier.new
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ module DeliveriesHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def stock_articles_for_select(supplier)
|
def stock_articles_for_select(supplier)
|
||||||
supplier.stock_articles.undeleted.map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
supplier.stock_articles.undeleted.reorder('articles.name ASC').map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,12 @@ class SharedSupplier < ActiveRecord::Base
|
||||||
|
|
||||||
has_one :supplier
|
has_one :supplier
|
||||||
has_many :shared_articles, :foreign_key => :supplier_id
|
has_many :shared_articles, :foreign_key => :supplier_id
|
||||||
|
|
||||||
|
# These set of attributes are used to autofill attributes of new supplier,
|
||||||
|
# when created by import from shared supplier feature.
|
||||||
|
def autofill_attributes
|
||||||
|
whitelist = %w(name address phone fax email url delivery_days note)
|
||||||
|
attributes.select { |k,_v| whitelist.include?(k) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue