Merge remote-tracking branch 'origin/rails3'

Conflicts:
	Gemfile
	Gemfile.lock
This commit is contained in:
Manuel Wiedenmann 2013-06-10 01:53:31 +02:00
commit 7a63394dac
6 changed files with 22 additions and 10 deletions

View File

@ -65,4 +65,6 @@ group :development do
gem 'capistrano', '2.13.5'
gem 'capistrano-ext'
#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

View File

@ -80,7 +80,7 @@ GEM
commonjs (0.2.6)
daemons (1.1.9)
erubis (2.7.0)
eventmachine (1.0.0)
eventmachine (1.0.3)
exception_notification (2.6.1)
actionmailer (>= 3.0.4)
execjs (1.4.0)
@ -288,6 +288,7 @@ DEPENDENCIES
sqlite3
test-unit
therubyracer
thin
twitter-bootstrap-rails
uglifier (>= 1.0.3)
whenever

View File

@ -35,11 +35,14 @@ $(function() {
// Check/Uncheck all checkboxes for a specific form
$('input[data-check-all]').live('click', function() {
var status = $(this).is(':checked')
$($(this).data('check-all')).find('input[type="checkbox"]').each(function() {
$(this).attr('checked', status);
highlightRow($(this));
});
var status = $(this).is(':checked');
var context = $(this).data('check-all');
var elms = $('input[type="checkbox"]', context);
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.
@ -102,7 +105,7 @@ $(function() {
// gives the row an yellow background
function highlightRow(checkbox) {
var row = checkbox.parents('tr');
var row = checkbox.closest('tr');
if (checkbox.is(':checked')) {
row.addClass('selected');
} else {

View File

@ -18,7 +18,7 @@ class SuppliersController < ApplicationController
def new
if 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
@supplier = Supplier.new
end

View File

@ -11,7 +11,7 @@ module DeliveriesHelper
end
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

View File

@ -7,6 +7,12 @@ class SharedSupplier < ActiveRecord::Base
has_one :supplier
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