Merge branch 'master' into tests-rspec
Conflicts: Gemfile Gemfile.lock
This commit is contained in:
commit
bb20e9abea
48 changed files with 1039 additions and 251 deletions
8
Gemfile
8
Gemfile
|
@ -17,6 +17,7 @@ group :assets do
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
gem 'select2-rails'
|
||||||
gem 'bootstrap-datepicker-rails'
|
gem 'bootstrap-datepicker-rails'
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ gem 'simple-navigation-bootstrap'
|
||||||
gem 'meta_search'
|
gem 'meta_search'
|
||||||
gem 'acts_as_versioned', git: 'git://github.com/technoweenie/acts_as_versioned.git' # Use this instead of rubygem
|
gem 'acts_as_versioned', git: 'git://github.com/technoweenie/acts_as_versioned.git' # Use this instead of rubygem
|
||||||
gem 'acts_as_tree'
|
gem 'acts_as_tree'
|
||||||
gem 'acts_as_configurable', git: 'git://github.com/bwalding/acts_as_configurable.git'
|
gem "rails-settings-cached", "0.2.4"
|
||||||
gem 'resque'
|
gem 'resque'
|
||||||
gem 'whenever', require: false # For defining cronjobs, see config/schedule.rb
|
gem 'whenever', require: false # For defining cronjobs, see config/schedule.rb
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ group :development do
|
||||||
# Better error output
|
# Better error output
|
||||||
gem 'better_errors'
|
gem 'better_errors'
|
||||||
gem 'binding_of_caller'
|
gem 'binding_of_caller'
|
||||||
|
# gem "rails-i18n-debug"
|
||||||
|
|
||||||
# Get infos when not using proper eager loading
|
# Get infos when not using proper eager loading
|
||||||
gem 'bullet'
|
gem 'bullet'
|
||||||
|
@ -67,6 +69,7 @@ group :development do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
gem 'ruby-prof'
|
||||||
gem 'rspec-rails'
|
gem 'rspec-rails'
|
||||||
gem 'factory_girl_rails', '~> 4.0'
|
gem 'factory_girl_rails', '~> 4.0'
|
||||||
gem 'faker'
|
gem 'faker'
|
||||||
|
@ -74,3 +77,6 @@ group :development, :test do
|
||||||
# webkit and poltergeist don't seem to work yet
|
# webkit and poltergeist don't seem to work yet
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Gems left for backwards compatibility
|
||||||
|
gem 'acts_as_configurable', git: 'git://github.com/bwalding/acts_as_configurable.git' # user settings migration needs it
|
||||||
|
|
15
Gemfile.lock
15
Gemfile.lock
|
@ -116,7 +116,7 @@ GEM
|
||||||
has_scope (0.5.1)
|
has_scope (0.5.1)
|
||||||
hashery (2.0.1)
|
hashery (2.0.1)
|
||||||
highline (1.6.19)
|
highline (1.6.19)
|
||||||
hike (1.2.1)
|
hike (1.2.3)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
inherited_resources (1.3.1)
|
inherited_resources (1.3.1)
|
||||||
has_scope (~> 0.5.0)
|
has_scope (~> 0.5.0)
|
||||||
|
@ -155,7 +155,7 @@ GEM
|
||||||
polyamorous (~> 0.5.0)
|
polyamorous (~> 0.5.0)
|
||||||
mime-types (1.21)
|
mime-types (1.21)
|
||||||
mono_logger (1.1.0)
|
mono_logger (1.1.0)
|
||||||
multi_json (1.7.3)
|
multi_json (1.7.6)
|
||||||
mysql2 (0.3.11)
|
mysql2 (0.3.11)
|
||||||
net-scp (1.1.1)
|
net-scp (1.1.1)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
|
@ -194,6 +194,8 @@ GEM
|
||||||
activesupport (= 3.2.13)
|
activesupport (= 3.2.13)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.13)
|
railties (= 3.2.13)
|
||||||
|
rails-settings-cached (0.2.4)
|
||||||
|
rails (>= 3.0.0)
|
||||||
railties (3.2.13)
|
railties (3.2.13)
|
||||||
actionpack (= 3.2.13)
|
actionpack (= 3.2.13)
|
||||||
activesupport (= 3.2.13)
|
activesupport (= 3.2.13)
|
||||||
|
@ -226,6 +228,7 @@ GEM
|
||||||
rspec-core (~> 2.14.0)
|
rspec-core (~> 2.14.0)
|
||||||
rspec-expectations (~> 2.14.0)
|
rspec-expectations (~> 2.14.0)
|
||||||
rspec-mocks (~> 2.14.0)
|
rspec-mocks (~> 2.14.0)
|
||||||
|
ruby-prof (0.13.0)
|
||||||
ruby-rc4 (0.1.5)
|
ruby-rc4 (0.1.5)
|
||||||
rubyzip (0.9.9)
|
rubyzip (0.9.9)
|
||||||
sass (3.2.1)
|
sass (3.2.1)
|
||||||
|
@ -233,6 +236,9 @@ GEM
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
|
select2-rails (3.4.2)
|
||||||
|
sass-rails
|
||||||
|
thor (~> 0.14)
|
||||||
selenium-webdriver (2.31.0)
|
selenium-webdriver (2.31.0)
|
||||||
childprocess (>= 0.2.5)
|
childprocess (>= 0.2.5)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
@ -242,7 +248,7 @@ GEM
|
||||||
activesupport (>= 2.3.2)
|
activesupport (>= 2.3.2)
|
||||||
simple-navigation-bootstrap (0.0.4)
|
simple-navigation-bootstrap (0.0.4)
|
||||||
simple-navigation (>= 3.7.0)
|
simple-navigation (>= 3.7.0)
|
||||||
simple_form (2.0.3)
|
simple_form (2.1.0)
|
||||||
actionpack (~> 3.0)
|
actionpack (~> 3.0)
|
||||||
activemodel (~> 3.0)
|
activemodel (~> 3.0)
|
||||||
sinatra (1.3.6)
|
sinatra (1.3.6)
|
||||||
|
@ -324,9 +330,12 @@ DEPENDENCIES
|
||||||
prawn
|
prawn
|
||||||
quiet_assets
|
quiet_assets
|
||||||
rails (~> 3.2.9)
|
rails (~> 3.2.9)
|
||||||
|
rails-settings-cached (= 0.2.4)
|
||||||
resque
|
resque
|
||||||
rspec-rails
|
rspec-rails
|
||||||
|
ruby-prof
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
|
select2-rails
|
||||||
simple-navigation
|
simple-navigation
|
||||||
simple-navigation-bootstrap
|
simple-navigation-bootstrap
|
||||||
simple_form
|
simple_form
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery-ui
|
//= require jquery-ui
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
|
//= require select2
|
||||||
//= require twitter/bootstrap
|
//= require twitter/bootstrap
|
||||||
//= require jquery.tokeninput
|
//= require jquery.tokeninput
|
||||||
//= require bootstrap-datepicker/core
|
//= require bootstrap-datepicker/core
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
//= require rails.validations
|
//= require rails.validations
|
||||||
//= require_self
|
//= require_self
|
||||||
//= require ordering
|
//= require ordering
|
||||||
|
//= require stupidtable
|
||||||
|
|
||||||
// allow touch devices to work on click events
|
// allow touch devices to work on click events
|
||||||
// http://stackoverflow.com/a/16221066
|
// http://stackoverflow.com/a/16221066
|
||||||
|
@ -114,8 +116,15 @@ $(function() {
|
||||||
|
|
||||||
// Use bootstrap datepicker for dateinput
|
// Use bootstrap datepicker for dateinput
|
||||||
$('.datepicker').datepicker({format: 'yyyy-mm-dd', language: I18n.locale});
|
$('.datepicker').datepicker({format: 'yyyy-mm-dd', language: I18n.locale});
|
||||||
|
|
||||||
|
// See stupidtable.js for initialization of local table sorting
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// retrigger last local table sorting
|
||||||
|
function updateSort(table) {
|
||||||
|
$('.sorting-asc, .sorting-desc', table).toggleClass('.sorting-asc .sorting-desc')
|
||||||
|
.removeData('sort-dir').trigger('click'); // CAUTION: removing data field of plugin
|
||||||
|
}
|
||||||
|
|
||||||
// gives the row an yellow background
|
// gives the row an yellow background
|
||||||
function highlightRow(checkbox) {
|
function highlightRow(checkbox) {
|
||||||
|
|
186
app/assets/javascripts/stupidtable.js
Normal file
186
app/assets/javascripts/stupidtable.js
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
// Stupid jQuery table plugin.
|
||||||
|
|
||||||
|
// Call on a table
|
||||||
|
// sortFns: Sort functions for your datatypes.
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
$.fn.stupidtable = function(sortFns) {
|
||||||
|
return this.each(function() {
|
||||||
|
var $table = $(this);
|
||||||
|
sortFns = sortFns || {};
|
||||||
|
|
||||||
|
// ==================================================== //
|
||||||
|
// Utility functions //
|
||||||
|
// ==================================================== //
|
||||||
|
|
||||||
|
// Merge sort functions with some default sort functions.
|
||||||
|
sortFns = $.extend({}, {
|
||||||
|
"int": function(a, b) {
|
||||||
|
return parseInt(a, 10) - parseInt(b, 10);
|
||||||
|
},
|
||||||
|
"float": function(a, b) {
|
||||||
|
return parseFloat(a) - parseFloat(b);
|
||||||
|
},
|
||||||
|
"string": function(a, b) {
|
||||||
|
if (a < b) return -1;
|
||||||
|
if (a > b) return +1;
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
"string-ins": function(a, b) {
|
||||||
|
a = a.toLowerCase();
|
||||||
|
b = b.toLowerCase();
|
||||||
|
if (a < b) return -1;
|
||||||
|
if (a > b) return +1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}, sortFns);
|
||||||
|
|
||||||
|
// Return the resulting indexes of a sort so we can apply
|
||||||
|
// this result elsewhere. This returns an array of index numbers.
|
||||||
|
// return[0] = x means "arr's 0th element is now at x"
|
||||||
|
var sort_map = function(arr, sort_function, reverse_column) {
|
||||||
|
var map = [];
|
||||||
|
var index = 0;
|
||||||
|
if (reverse_column) {
|
||||||
|
for (var i = arr.length-1; i >= 0; i--) {
|
||||||
|
map.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var sorted = arr.slice(0).sort(sort_function);
|
||||||
|
for (var i=0; i<arr.length; i++) {
|
||||||
|
index = $.inArray(arr[i], sorted);
|
||||||
|
|
||||||
|
// If this index is already in the map, look for the next index.
|
||||||
|
// This handles the case of duplicate entries.
|
||||||
|
while ($.inArray(index, map) != -1) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
map.push(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Apply a sort map to the array.
|
||||||
|
var apply_sort_map = function(arr, map) {
|
||||||
|
var clone = arr.slice(0),
|
||||||
|
newIndex = 0;
|
||||||
|
for (var i=0; i<map.length; i++) {
|
||||||
|
newIndex = map[i];
|
||||||
|
clone[newIndex] = arr[i];
|
||||||
|
}
|
||||||
|
return clone;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ==================================================== //
|
||||||
|
// Begin execution! //
|
||||||
|
// ==================================================== //
|
||||||
|
|
||||||
|
// Do sorting when THs are clicked
|
||||||
|
$table.on("click", "th", function() {
|
||||||
|
var trs = $table.children("tbody").children("tr");
|
||||||
|
var $this = $(this);
|
||||||
|
var th_index = 0;
|
||||||
|
var dir = $.fn.stupidtable.dir;
|
||||||
|
|
||||||
|
$table.find("th").slice(0, $this.index()).each(function() {
|
||||||
|
var cols = $(this).attr("colspan") || 1;
|
||||||
|
th_index += parseInt(cols,10);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Determine (and/or reverse) sorting direction, default `asc`
|
||||||
|
var sort_dir = $this.data("sort-dir") === dir.ASC ? dir.DESC : dir.ASC;
|
||||||
|
|
||||||
|
// Choose appropriate sorting function. If we're sorting descending, check
|
||||||
|
// for a `data-sort-desc` attribute.
|
||||||
|
if ( sort_dir == dir.DESC )
|
||||||
|
var type = $this.data("sort-desc") || $this.data("sort") || null;
|
||||||
|
else
|
||||||
|
var type = $this.data("sort") || null;
|
||||||
|
|
||||||
|
// Prevent sorting if no type defined
|
||||||
|
if (type === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger `beforetablesort` event that calling scripts can hook into;
|
||||||
|
// pass parameters for sorted column index and sorting direction
|
||||||
|
$table.trigger("beforetablesort", {column: th_index, direction: sort_dir});
|
||||||
|
// More reliable method of forcing a redraw
|
||||||
|
$table.css("display");
|
||||||
|
|
||||||
|
// Run sorting asynchronously on a timout to force browser redraw after
|
||||||
|
// `beforetablesort` callback. Also avoids locking up the browser too much.
|
||||||
|
setTimeout(function() {
|
||||||
|
// Gather the elements for this column
|
||||||
|
var column = [];
|
||||||
|
var sortMethod = sortFns[type];
|
||||||
|
|
||||||
|
// Push either the value of the `data-order-by` attribute if specified
|
||||||
|
// or just the text() value in this column to column[] for comparison.
|
||||||
|
trs.each(function(index,tr) {
|
||||||
|
var $e = $(tr).children().eq(th_index);
|
||||||
|
var sort_val = $e.data("sort-value");
|
||||||
|
var order_by = typeof(sort_val) !== "undefined" ? sort_val : $e.text();
|
||||||
|
column.push(order_by);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create the sort map. This column having a sort-dir implies it was
|
||||||
|
// the last column sorted. As long as no data-sort-desc is specified,
|
||||||
|
// we're free to just reverse the column.
|
||||||
|
var reverse_column = !!$this.data("sort-dir") && !$this.data("sort-desc");
|
||||||
|
var theMap = sort_map(column, sortMethod, reverse_column);
|
||||||
|
|
||||||
|
// Reset siblings
|
||||||
|
$table.find("th").data("sort-dir", null).removeClass("sorting-desc sorting-asc");
|
||||||
|
$this.data("sort-dir", sort_dir).addClass("sorting-"+sort_dir);
|
||||||
|
|
||||||
|
// Replace the content of tbody with the sortedTRs. Strangely (and
|
||||||
|
// conveniently!) enough, .append accomplishes this for us.
|
||||||
|
var sortedTRs = $(apply_sort_map(trs, theMap));
|
||||||
|
$table.children("tbody").append(sortedTRs);
|
||||||
|
|
||||||
|
// Trigger `aftertablesort` event. Similar to `beforetablesort`
|
||||||
|
$table.trigger("aftertablesort", {column: th_index, direction: sort_dir});
|
||||||
|
// More reliable method of forcing a redraw
|
||||||
|
$table.css("display");
|
||||||
|
}, 10);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Enum containing sorting directions
|
||||||
|
$.fn.stupidtable.dir = {ASC: "asc", DESC: "desc"};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// own additions for automatic initialization of table sorting
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
$(function() {
|
||||||
|
var stupidtables = $('table.stupidtable');
|
||||||
|
|
||||||
|
if(stupidtables.length) {
|
||||||
|
// Add pseudo links just for matching foodsoft style
|
||||||
|
$('th[data-sort]', stupidtables).wrapInner('<a href="#" class="stupidlink"></a>');
|
||||||
|
$('.stupidlink', stupidtables).on('click', function(e) {e.preventDefault();});
|
||||||
|
|
||||||
|
// Init stupidtable sorting
|
||||||
|
stupidtables.stupidtable();
|
||||||
|
|
||||||
|
// Update class of sort link after sort to match foodsoft style
|
||||||
|
stupidtables.on('aftertablesort', function(e, data) {
|
||||||
|
// Ignore data and use the updated classes in DOM
|
||||||
|
var stupidthead = $('thead', this);
|
||||||
|
$('a.stupidlink', stupidthead).removeClass('sortup sortdown');
|
||||||
|
$('th.sorting-asc a.stupidlink', stupidthead).addClass('sortup');
|
||||||
|
$('th.sorting-desc a.stupidlink', stupidthead).addClass('sortdown');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sort tables with a default sort
|
||||||
|
$('.default-sort', stupidtables).trigger('click');
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
*= require bootstrap_and_overrides
|
*= require bootstrap_and_overrides
|
||||||
|
*= require select2
|
||||||
*= require token-input-bootstrappy
|
*= require token-input-bootstrappy
|
||||||
*= require bootstrap-datepicker
|
*= require bootstrap-datepicker
|
||||||
*/
|
*/
|
|
@ -38,6 +38,22 @@ body {
|
||||||
dd { .clearfix(); }
|
dd { .clearfix(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not use additional margin for input in table
|
||||||
|
.form-horizontal .control-group.control-group-intable,
|
||||||
|
.form-horizontal .controls.controls-intable {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Light tooltips without empty space below tables
|
||||||
|
.tooltip-inner {
|
||||||
|
color: #000;
|
||||||
|
background-color: rgb(245,245,245);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
.tooltip-inner .table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@mainRedColor: #ED0606;
|
@mainRedColor: #ED0606;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
@ -204,3 +220,21 @@ tr.unavailable {
|
||||||
dt { width: 160px; }
|
dt { width: 160px; }
|
||||||
dd { margin-left: 170px; }
|
dd { margin-left: 170px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings {
|
||||||
|
.settings-group {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
.control-label {
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.control-group {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.control-group.h_wrapper {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.control-group.select {
|
||||||
|
margin-bottom: 15px
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
include Foodsoft::ControllerExtensions::Locale
|
||||||
|
helper_method :available_locales
|
||||||
|
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
before_filter :select_language, :select_foodcoop, :authenticate, :store_controller, :items_per_page, :set_redirect_to
|
before_filter :select_foodcoop, :authenticate, :store_controller, :items_per_page, :set_redirect_to
|
||||||
after_filter :remove_controller
|
after_filter :remove_controller
|
||||||
|
|
||||||
|
|
||||||
# Returns the controller handling the current request.
|
# Returns the controller handling the current request.
|
||||||
def self.current
|
def self.current
|
||||||
Thread.current[:application_controller]
|
Thread.current[:application_controller]
|
||||||
|
@ -142,8 +145,4 @@ class ApplicationController < ActionController::Base
|
||||||
{foodcoop: FoodsoftConfig.scope}
|
{foodcoop: FoodsoftConfig.scope}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used to prevent accidently switching to :en in production mode.
|
|
||||||
def select_language
|
|
||||||
I18n.locale = :de
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,43 +5,25 @@ class DeliveriesController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@deliveries = @supplier.deliveries.all :order => 'delivered_on DESC'
|
@deliveries = @supplier.deliveries.all :order => 'delivered_on DESC'
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.xml { render :xml => @deliveries }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@delivery = Delivery.find(params[:id])
|
@delivery = Delivery.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # show.html.erb
|
|
||||||
format.xml { render :xml => @delivery }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@delivery = @supplier.deliveries.build
|
@delivery = @supplier.deliveries.build
|
||||||
|
@delivery.delivered_on = Date.today #TODO: move to model/database
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.xml { render :xml => @delivery }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@delivery = Delivery.new(params[:delivery])
|
@delivery = Delivery.new(params[:delivery])
|
||||||
|
|
||||||
respond_to do |format|
|
if @delivery.save
|
||||||
if @delivery.save
|
flash[:notice] = I18n.t('deliveries.create.notice')
|
||||||
flash[:notice] = I18n.t('deliveries.create.notice')
|
redirect_to [@supplier, @delivery]
|
||||||
format.html { redirect_to([@supplier,@delivery]) }
|
else
|
||||||
format.xml { render :xml => @delivery, :status => :created, :location => @delivery }
|
render :action => "new"
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,15 +34,11 @@ class DeliveriesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@delivery = Delivery.find(params[:id])
|
@delivery = Delivery.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
if @delivery.update_attributes(params[:delivery])
|
||||||
if @delivery.update_attributes(params[:delivery])
|
flash[:notice] = I18n.t('deliveries.update.notice')
|
||||||
flash[:notice] = I18n.t('deliveries.update.notice')
|
redirect_to [@supplier,@delivery]
|
||||||
format.html { redirect_to([@supplier,@delivery]) }
|
else
|
||||||
format.xml { head :ok }
|
render :action => "edit"
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,40 +47,60 @@ class DeliveriesController < ApplicationController
|
||||||
@delivery.destroy
|
@delivery.destroy
|
||||||
|
|
||||||
flash[:notice] = I18n.t('deliveries.destroy.notice')
|
flash[:notice] = I18n.t('deliveries.destroy.notice')
|
||||||
respond_to do |format|
|
redirect_to supplier_deliveries_url(@supplier)
|
||||||
format.html { redirect_to(supplier_deliveries_url(@supplier)) }
|
end
|
||||||
format.xml { head :ok }
|
|
||||||
|
# three possibilites to fill a new_stock_article form
|
||||||
|
# (1) start from blank or use params
|
||||||
|
def new_stock_article
|
||||||
|
@stock_article = @supplier.stock_articles.build(params[:stock_article])
|
||||||
|
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
# (2) StockArticle as template
|
||||||
|
def copy_stock_article
|
||||||
|
@stock_article = StockArticle.find(params[:old_stock_article_id]).dup
|
||||||
|
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
# (3) non-stock Article as template
|
||||||
|
def derive_stock_article
|
||||||
|
@stock_article = Article.find(params[:old_article_id]).becomes(StockArticle).dup
|
||||||
|
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_stock_article
|
||||||
|
@stock_article = StockArticle.new(params[:stock_article])
|
||||||
|
|
||||||
|
if @stock_article.valid? and @stock_article.save
|
||||||
|
render :layout => false
|
||||||
|
else
|
||||||
|
render :action => 'new_stock_article', :layout => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_stock_article
|
def edit_stock_article
|
||||||
article = @supplier.stock_articles.build(params[:stock_article])
|
@stock_article = StockArticle.find(params[:stock_article_id])
|
||||||
render :update do |page|
|
render :layout => false
|
||||||
if article.save
|
end
|
||||||
logger.debug "new StockArticle: #{article.id}"
|
|
||||||
page.insert_html :bottom, 'stock_changes', :partial => 'stock_change',
|
|
||||||
:locals => {:stock_change => article.stock_changes.build, :supplier => @supplier}
|
|
||||||
|
|
||||||
page.replace_html 'new_stock_article', :partial => 'stock_article_form',
|
def update_stock_article
|
||||||
:locals => {:stock_article => @supplier.stock_articles.build}
|
@stock_article = StockArticle.find(params[:stock_article][:id])
|
||||||
else
|
|
||||||
page.replace_html 'new_stock_article', :partial => 'stock_article_form',
|
if @stock_article.update_attributes(params[:stock_article])
|
||||||
:locals => {:stock_article => article}
|
render :layout => false
|
||||||
end
|
else
|
||||||
|
render :action => 'edit_stock_article', :layout => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_stock_change
|
def add_stock_change
|
||||||
|
@stock_change = StockChange.new
|
||||||
|
@stock_change.stock_article = StockArticle.find(params[:stock_article_id])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def fill_new_stock_article_form
|
|
||||||
article = Article.find(params[:article_id])
|
|
||||||
@supplier = article.supplier
|
|
||||||
stock_article = @supplier.stock_articles.build(
|
|
||||||
article.attributes.reject { |attr| attr == ('id' || 'type')}
|
|
||||||
)
|
|
||||||
|
|
||||||
render :partial => 'stock_article_form', :locals => {:stock_article => stock_article}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,6 +16,7 @@ class HomeController < ApplicationController
|
||||||
|
|
||||||
def update_profile
|
def update_profile
|
||||||
if @current_user.update_attributes(params[:user])
|
if @current_user.update_attributes(params[:user])
|
||||||
|
session[:locale] = @current_user.locale
|
||||||
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
||||||
else
|
else
|
||||||
render :profile
|
render :profile
|
||||||
|
|
|
@ -58,6 +58,7 @@ class LoginController < ApplicationController
|
||||||
if @user.save
|
if @user.save
|
||||||
Membership.new(:user => @user, :group => @invite.group).save!
|
Membership.new(:user => @user, :group => @invite.group).save!
|
||||||
@invite.destroy
|
@invite.destroy
|
||||||
|
session[:locale] = @user.locale
|
||||||
redirect_to login_url, notice: I18n.t('login.controller.accept_invitation.notice')
|
redirect_to login_url, notice: I18n.t('login.controller.accept_invitation.notice')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,8 @@ class SessionsController < ApplicationController
|
||||||
if user
|
if user
|
||||||
session[:user_id] = user.id
|
session[:user_id] = user.id
|
||||||
session[:scope] = FoodsoftConfig.scope # Save scope in session to not allow switching between foodcoops with one account
|
session[:scope] = FoodsoftConfig.scope # Save scope in session to not allow switching between foodcoops with one account
|
||||||
|
session[:locale] = user.locale
|
||||||
|
|
||||||
if session[:return_to].present?
|
if session[:return_to].present?
|
||||||
redirect_to_url = session[:return_to]
|
redirect_to_url = session[:return_to]
|
||||||
session[:return_to] = nil
|
session[:return_to] = nil
|
||||||
|
|
|
@ -159,4 +159,12 @@ module ApplicationHelper
|
||||||
flash_messages.join("\n").html_safe
|
flash_messages.join("\n").html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# render base errors in a form after failed validation
|
||||||
|
# http://railsapps.github.io/twitter-bootstrap-rails.html
|
||||||
|
def base_errors resource
|
||||||
|
return '' if (resource.errors.empty?) or (resource.errors[:base].empty?)
|
||||||
|
messages = resource.errors[:base].map { |msg| content_tag(:li, msg) }.join
|
||||||
|
render :partial => 'shared/base_errors', :locals => {:error_messages => messages}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,8 +10,28 @@ module DeliveriesHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def stock_articles_for_select(supplier)
|
def articles_for_select2(supplier)
|
||||||
supplier.stock_articles.undeleted.reorder('articles.name ASC').map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
supplier.articles.undeleted.reorder('articles.name ASC').map {|a| {:id => a.id, :text => "#{a.name} (#{number_to_currency a.price}/#{a.unit})"} }
|
||||||
|
end
|
||||||
|
|
||||||
|
def stock_articles_for_table(supplier)
|
||||||
|
supplier.stock_articles.undeleted.reorder('articles.name ASC')
|
||||||
|
end
|
||||||
|
|
||||||
|
def stock_change_remove_link(stock_change_form)
|
||||||
|
return link_to t('.remove_article'), "#", :class => 'remove_new_stock_change btn btn-small' if stock_change_form.object.new_record?
|
||||||
|
output = stock_change_form.hidden_field :_destroy
|
||||||
|
output += link_to t('.remove_article'), "#", :class => 'destroy_stock_change btn btn-small'
|
||||||
|
return output.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
|
def stock_article_price_hint(stock_article)
|
||||||
|
t('simple_form.hints.stock_article.edit_stock_article.price',
|
||||||
|
:stock_article_copy_link => link_to(t('.copy_stock_article'),
|
||||||
|
copy_stock_article_supplier_deliveries_path(@supplier, :old_stock_article_id => stock_article.id),
|
||||||
|
:remote => true
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,11 +2,15 @@ class Delivery < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
has_one :invoice
|
has_one :invoice
|
||||||
has_many :stock_changes, :dependent => :destroy
|
has_many :stock_changes,
|
||||||
|
:dependent => :destroy,
|
||||||
|
:include => 'stock_article',
|
||||||
|
:order => 'articles.name ASC'
|
||||||
|
|
||||||
scope :recent, :order => 'created_at DESC', :limit => 10
|
scope :recent, :order => 'created_at DESC', :limit => 10
|
||||||
|
|
||||||
validates_presence_of :supplier_id
|
validates_presence_of :supplier_id, :delivered_on
|
||||||
|
validate :stock_articles_must_be_unique
|
||||||
|
|
||||||
accepts_nested_attributes_for :stock_changes, :allow_destroy => :true
|
accepts_nested_attributes_for :stock_changes, :allow_destroy => :true
|
||||||
|
|
||||||
|
@ -16,6 +20,18 @@ class Delivery < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def includes_article?(article)
|
||||||
|
self.stock_changes.map{|stock_change| stock_change.stock_article.id}.include? article.id
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def stock_articles_must_be_unique
|
||||||
|
unless stock_changes.reject{|sc| sc.marked_for_destruction?}.map {|sc| sc.stock_article.id}.uniq!.nil?
|
||||||
|
errors.add(:base, I18n.t('model.delivery.each_stock_article_must_be_unique'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
require 'digest/sha1'
|
require 'digest/sha1'
|
||||||
# specific user rights through memberships (see Group)
|
# specific user rights through memberships (see Group)
|
||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
|
include RailsSettings::Extend
|
||||||
#TODO: acts_as_paraniod ??
|
#TODO: acts_as_paraniod ??
|
||||||
|
|
||||||
has_many :memberships, :dependent => :destroy
|
has_many :memberships, :dependent => :destroy
|
||||||
|
@ -19,7 +20,10 @@ class User < ActiveRecord::Base
|
||||||
has_many :pages, :foreign_key => 'updated_by'
|
has_many :pages, :foreign_key => 'updated_by'
|
||||||
has_many :created_orders, :class_name => 'Order', :foreign_key => 'created_by_user_id', :dependent => :nullify
|
has_many :created_orders, :class_name => 'Order', :foreign_key => 'created_by_user_id', :dependent => :nullify
|
||||||
|
|
||||||
attr_accessor :password, :setting_attributes
|
attr_accessor :password, :settings_attributes
|
||||||
|
|
||||||
|
# makes the current_user (logged-in-user) available in models
|
||||||
|
cattr_accessor :current_user
|
||||||
|
|
||||||
validates_presence_of :nick, :email
|
validates_presence_of :nick, :email
|
||||||
validates_presence_of :password, :on => :create
|
validates_presence_of :password, :on => :create
|
||||||
|
@ -32,53 +36,37 @@ class User < ActiveRecord::Base
|
||||||
validates_length_of :password, :in => 5..25, :allow_blank => true
|
validates_length_of :password, :in => 5..25, :allow_blank => true
|
||||||
|
|
||||||
before_validation :set_password
|
before_validation :set_password
|
||||||
after_save :update_settings
|
after_initialize do
|
||||||
|
settings.defaults['profile'] = { 'language' => I18n.default_locale } unless settings.profile
|
||||||
# Adds support for configuration settings (through "settings" attribute).
|
settings.defaults['messages'] = { 'send_as_email' => true } unless settings.messages
|
||||||
acts_as_configurable
|
settings.defaults['notify'] = { 'upcoming_tasks' => true } unless settings.notify
|
||||||
|
|
||||||
# makes the current_user (logged-in-user) available in models
|
|
||||||
cattr_accessor :current_user
|
|
||||||
|
|
||||||
# User settings keys
|
|
||||||
# returns the User-settings and the translated description
|
|
||||||
def self.setting_keys
|
|
||||||
{
|
|
||||||
"notify.orderFinished" => I18n.t('model.user.notify.order_finished'),
|
|
||||||
"notify.negativeBalance" => I18n.t('model.user.notify.negative_balance'),
|
|
||||||
"notify.upcoming_tasks" => I18n.t('model.user.notify.upcoming_tasks'),
|
|
||||||
"messages.sendAsEmail" => I18n.t('model.user.notify.send_as_email'),
|
|
||||||
"profile.phoneIsPublic" => I18n.t('model.user.notify.phone_is_public'),
|
|
||||||
"profile.emailIsPublic" => I18n.t('model.user.notify.email_is_public'),
|
|
||||||
"profile.nameIsPublic" => I18n.t('model.user.notify.name_is_public')
|
|
||||||
}
|
|
||||||
end
|
|
||||||
# retuns the default setting for a NEW user
|
|
||||||
# for old records nil will returned
|
|
||||||
# TODO: integrate default behaviour in acts_as_configurable plugin
|
|
||||||
def settings_default(setting)
|
|
||||||
# define a default for the settings
|
|
||||||
defaults = {
|
|
||||||
"messages.sendAsEmail" => true,
|
|
||||||
"notify.upcoming_tasks" => true
|
|
||||||
}
|
|
||||||
return true if self.new_record? && defaults[setting]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_settings
|
after_save do
|
||||||
unless setting_attributes.nil?
|
return if settings_attributes.nil?
|
||||||
for setting in User::setting_keys.keys
|
settings_attributes.each do |key, value|
|
||||||
self.settings[setting] = setting_attributes[setting] && setting_attributes[setting] == '1' ? '1' : nil
|
value.each do |k, v|
|
||||||
|
case v
|
||||||
|
when '1'
|
||||||
|
value[k] = true
|
||||||
|
when '0'
|
||||||
|
value[k] = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
self.settings.merge!(key, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def locale
|
||||||
|
settings.profile['language']
|
||||||
|
end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
[first_name, last_name].join(" ")
|
[first_name, last_name].join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive_email?
|
def receive_email?
|
||||||
settings['messages.sendAsEmail'] == "1" && email.present?
|
settings.messages['send_as_email'] == "1" && email.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets the user's password. It will be stored encrypted along with a random salt.
|
# Sets the user's password. It will be stored encrypted along with a random salt.
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
.well
|
.well
|
||||||
%h4= t '.preference'
|
%h4= t '.preference'
|
||||||
%table.table
|
%table.table
|
||||||
- for setting in User::setting_keys.keys
|
- @user.settings.profile.each do |key, setting|
|
||||||
%tr
|
%tr
|
||||||
%td= User::setting_keys[setting]
|
%td= t("simple_form.labels.settings.profile.#{key}")
|
||||||
%td= @user.settings[setting] == '1' ? t('simple_form.yes') : t('simple_form.no')
|
%td= (setting != true and setting != false) ? setting : (setting === true ? t('simple_form.yes') : t('simple_form.no'))
|
||||||
.span3
|
.span3
|
||||||
.well
|
.well
|
||||||
%h4= t '.groupabos'
|
%h4= t '.groupabos'
|
||||||
|
|
|
@ -1,45 +1,134 @@
|
||||||
- content_for :javascript do
|
- content_for :javascript do
|
||||||
:javascript
|
:javascript
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.destroy_stock_change').live('click', function() {
|
$('#stock_changes').on('click', '.destroy_stock_change', function() {
|
||||||
$(this).prev('input').val('1').parent().hide();
|
$(this).prev('input').val('1'); // check for destruction
|
||||||
|
|
||||||
|
var stock_change = $(this).closest('tr');
|
||||||
|
stock_change.hide(); // do not remove (to ensure destruction)
|
||||||
|
stock_change.removeAttr('id'); // remove id to allow re-adding
|
||||||
|
mark_article_for_delivery( stock_change.data('id') );
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.remove_new_stock_change').live('click', function() {
|
$('#stock_changes').on('click', '.remove_new_stock_change', function() {
|
||||||
$(this).parent().remove();
|
var stock_change = $(this).closest('tr');
|
||||||
|
stock_change.remove();
|
||||||
|
mark_article_for_delivery( stock_change.data('id') );
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('#new_stock_article').removeAttr('disabled').select2({
|
||||||
|
placeholder: '#{t '.create_stock_article'}',
|
||||||
|
data: #{articles_for_select2(@supplier).to_json},
|
||||||
|
createSearchChoice: function(term) {
|
||||||
|
return {
|
||||||
|
id: 'new',
|
||||||
|
text: term
|
||||||
|
};
|
||||||
|
},
|
||||||
|
formatResult: function(result, container, query, escapeMarkup) {
|
||||||
|
if(result.id == 'new') {
|
||||||
|
return result.text + ' (#{t '.create_from_blank'})';
|
||||||
|
}
|
||||||
|
var markup=[];
|
||||||
|
Select2.util.markMatch(result.text, query.term, markup, escapeMarkup);
|
||||||
|
return markup.join("");
|
||||||
|
}
|
||||||
|
}).on('change', function(e) {
|
||||||
|
var selectedArticle = $(e.currentTarget).select2('data');
|
||||||
|
if(!selectedArticle) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if('new' == selectedArticle.id) {
|
||||||
|
$.ajax({
|
||||||
|
url: '#{new_stock_article_supplier_deliveries_path(@supplier)}',
|
||||||
|
type: 'get',
|
||||||
|
data: {stock_article: {name: selectedArticle.text}},
|
||||||
|
contentType: 'application/json; charset=UTF-8'
|
||||||
|
});
|
||||||
|
$('#new_stock_article').select2('data', null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if('' != selectedArticle.id) {
|
||||||
|
$.ajax({
|
||||||
|
url: '#{derive_stock_article_supplier_deliveries_path(@supplier)}',
|
||||||
|
type: 'get',
|
||||||
|
data: {old_article_id: selectedArticle.id},
|
||||||
|
contentType: 'application/json; charset=UTF-8'
|
||||||
|
});
|
||||||
|
$('#new_stock_article').select2('data', null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
enablePriceTooltips();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function mark_article_for_delivery(stock_article_id) {
|
||||||
|
var articleTr = $('#stock_article_' + stock_article_id);
|
||||||
|
if( is_article_available_for_delivery(stock_article_id) ) {
|
||||||
|
articleTr.removeClass('unavailable');
|
||||||
|
$('.button-add-stock-change', articleTr).removeAttr('disabled');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
articleTr.addClass('unavailable');
|
||||||
|
$('.button-add-stock-change', articleTr).attr('disabled', 'disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function is_article_available_for_delivery(stock_article_id) {
|
||||||
|
return ( 0 == $('#stock_change_stock_article_' + stock_article_id).length );
|
||||||
|
}
|
||||||
|
|
||||||
|
function enablePriceTooltips(context) {
|
||||||
|
$('[data-toggle~="tooltip"]', context).tooltip({
|
||||||
|
animation: false,
|
||||||
|
html: true,
|
||||||
|
placement: 'left'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
||||||
= f.hidden_field :supplier_id
|
= f.error_notification
|
||||||
#stock_changes
|
= base_errors f.object
|
||||||
= f.fields_for :stock_changes do |stock_change_form|
|
= f.association :supplier, :as => :hidden
|
||||||
%p
|
|
||||||
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
|
%h2= t '.title_select_stock_articles'
|
||||||
Menge
|
%table#stock_articles_for_adding.table.table-hover.stupidtable
|
||||||
= stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
|
%thead
|
||||||
= stock_change_form.hidden_field :_destroy
|
%tr
|
||||||
= link_to t('.remove_article'), "#", class: 'destroy_stock_change'
|
%th.default-sort{:data => {:sort => 'string'}}= t '.article'
|
||||||
%p
|
%th= t '.price'
|
||||||
= link_to t('.add_article'), {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
|
%th= t '.unit'
|
||||||
%p
|
%th= t '.category'
|
||||||
%small= t('.note_new_article', new_link: link_to(t('.note_new_article_link'), new_stock_article_path)).html_safe
|
%th= t '.actions'
|
||||||
%hr/
|
%tfoot
|
||||||
|
%tr
|
||||||
|
%th{:colspan => 5}
|
||||||
|
- if articles_for_select2(@supplier).empty?
|
||||||
|
= link_to t('.create_stock_article'), new_stock_article_supplier_deliveries_path(@supplier), :remote => true, :class => 'btn'
|
||||||
|
- else
|
||||||
|
%input#new_stock_article{:style => 'width: 500px;'}
|
||||||
|
%tbody
|
||||||
|
- for article in stock_articles_for_table(@supplier)
|
||||||
|
= render :partial => 'stock_article_for_adding', :locals => {:article => article}
|
||||||
|
|
||||||
|
%h2= t '.title_fill_quantities'
|
||||||
|
%table.table#stock_changes.stupidtable
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th.default-sort{:data => {:sort => 'string'}}= t '.article'
|
||||||
|
%th= t '.price'
|
||||||
|
%th= t '.unit'
|
||||||
|
%th= t '.quantity'
|
||||||
|
%th= t '.actions'
|
||||||
|
%tbody
|
||||||
|
= f.simple_fields_for :stock_changes do |stock_change_form|
|
||||||
|
= render :partial => 'stock_change_fields', :locals => {:f => stock_change_form}
|
||||||
|
|
||||||
|
%h2= t '.title_finish_delivery'
|
||||||
= f.input :delivered_on, as: :date_picker
|
= f.input :delivered_on, as: :date_picker
|
||||||
= f.input :note, input_html: {size: '35x4'}
|
= f.input :note, input_html: {size: '35x4'}
|
||||||
.form-actions
|
.form-actions
|
||||||
= f.submit class: 'btn btn-primary'
|
= f.submit class: 'btn btn-primary'
|
||||||
= link_to t('ui.or_cancel'), supplier_deliveries_path(@supplier)
|
= link_to t('ui.or_cancel'), supplier_deliveries_path(@supplier)
|
||||||
|
|
||||||
/
|
|
||||||
TODO: Fix this!!
|
|
||||||
.span6
|
|
||||||
%h2= t '.new_article.title'
|
|
||||||
%p
|
|
||||||
= t('.new_article.search', supplier: @supplier.name).html_safe + ': '
|
|
||||||
= text_field_tag 'article_name'
|
|
||||||
%hr/
|
|
||||||
#stock_article_form
|
|
||||||
= render 'stock_article_form', stock_article: @supplier.stock_articles.build
|
|
||||||
|
|
11
app/views/deliveries/_stock_article_for_adding.html.haml
Normal file
11
app/views/deliveries/_stock_article_for_adding.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
- css_class = ( @delivery and @delivery.includes_article? article ) ? ( 'unavailable' ) : ( false )
|
||||||
|
%tr{:id => "stock_article_#{article.id}", :class => css_class}
|
||||||
|
%td= article.name
|
||||||
|
%td{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => article})}}= number_to_currency article.price
|
||||||
|
%td= article.unit
|
||||||
|
%td= article.article_category.name
|
||||||
|
%td
|
||||||
|
= link_to t('.action_edit'), edit_stock_article_supplier_deliveries_path(@supplier, :stock_article_id => article.id), remote: true, class: 'btn btn-mini'
|
||||||
|
= link_to t('.action_other_price'), copy_stock_article_supplier_deliveries_path(@supplier, :old_stock_article_id => article.id), remote: true, class: 'btn btn-mini'
|
||||||
|
- deliver_button_disabled = ( @delivery and @delivery.includes_article? article ) ? ( 'disabled' ) : ( false )
|
||||||
|
= link_to t('.action_add_to_delivery'), add_stock_change_supplier_deliveries_path(@supplier, :stock_article_id => article.id), :method => :post, remote: true, class: 'button-add-stock-change btn btn-mini btn-primary', disabled: deliver_button_disabled
|
|
@ -1,14 +1,23 @@
|
||||||
= simple_form_for stock_article, url: add_stock_article_supplier_deliveries_path(@supplier), remote: true,
|
- url = ( stock_article.new_record? ) ? ( create_stock_article_supplier_deliveries_path(@supplier) ) : ( update_stock_article_supplier_deliveries_path(@supplier) )
|
||||||
validate: true do |f|
|
= simple_form_for stock_article, url: url, remote: true, validate: true do |f|
|
||||||
= f.hidden_field :supplier_id
|
= f.association :supplier, :as => :hidden
|
||||||
= f.input :name
|
= f.hidden_field :id unless stock_article.new_record?
|
||||||
= f.input :unit
|
.modal-header
|
||||||
= f.input :note
|
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
|
||||||
= f.input :price
|
%h3= t 'activerecord.models.stock_article'
|
||||||
= f.input :tax, :wrapper => :append do
|
.modal-body
|
||||||
= f.input_field :tax
|
= f.input :name
|
||||||
%span.add-on %
|
= f.input :unit
|
||||||
-# untested, because this view is currently not included (?)
|
= f.input :note
|
||||||
= f.input :deposit
|
- if stock_article.new_record?
|
||||||
= f.association :article_category
|
= f.input :price
|
||||||
= f.submit class: 'btn'
|
= f.input :tax, :wrapper => :append do
|
||||||
|
= f.input_field :tax
|
||||||
|
%span.add-on %
|
||||||
|
= f.input :deposit
|
||||||
|
- else
|
||||||
|
= f.input :price, :input_html => {:disabled => 'disabled'}, :hint => stock_article_price_hint(stock_article)
|
||||||
|
= f.association :article_category
|
||||||
|
.modal-footer
|
||||||
|
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||||
|
= f.submit :class => 'btn btn-primary', 'data-disable-with' => t('ui.please_wait')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%p
|
- if stock_change.stock_article.new_record?
|
||||||
= fields_for "delivery[new_stock_changes][]", stock_change do |form|
|
= simple_fields_for "delivery[new_stock_changes_new_stock_article][]", stock_change do |f|
|
||||||
= form.select :stock_article_id, stock_articles_for_select(supplier)
|
= render :partial => 'stock_change_fields', :locals => {:f => f}
|
||||||
Menge
|
- else
|
||||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
= simple_fields_for "delivery[new_stock_changes][]", stock_change do |f|
|
||||||
= link_to t('.remove_article'), "#", :class => 'remove_new_stock_change'
|
= render :partial => 'stock_change_fields', :locals => {:f => f}
|
||||||
|
|
10
app/views/deliveries/_stock_change_fields.html.haml
Normal file
10
app/views/deliveries/_stock_change_fields.html.haml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
- stock_change = f.object
|
||||||
|
- stock_article = stock_change.stock_article
|
||||||
|
%tr{:id => "stock_change_stock_article_#{stock_article.id}", :data => {:id => stock_article.id}}
|
||||||
|
%td
|
||||||
|
%span.stock_article_name= stock_change.stock_article.name
|
||||||
|
= f.association :stock_article, :as => :hidden
|
||||||
|
%td.price{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => stock_article})}}= number_to_currency stock_article.price
|
||||||
|
%td.unit= stock_change.stock_article.unit
|
||||||
|
%td= f.input :quantity, :wrapper => :intable, :input_html => {:class => 'stock-change-quantity', :autocomplete => :off}
|
||||||
|
%td= stock_change_remove_link f
|
25
app/views/deliveries/add_stock_change.js.erb
Normal file
25
app/views/deliveries/add_stock_change.js.erb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
(function(w) {
|
||||||
|
if(!is_article_available_for_delivery(<%= @stock_change.stock_article.id %>)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#stock_changes tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_change = $(
|
||||||
|
'<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>'
|
||||||
|
).addClass('success');
|
||||||
|
enablePriceTooltips(stock_change);
|
||||||
|
|
||||||
|
$('#stock_changes').append(stock_change);
|
||||||
|
mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
|
||||||
|
updateSort('#stock_changes');
|
||||||
|
|
||||||
|
var quantity = w.prompt('<%= j(t('.how_many_units', :unit => @stock_change.stock_article.unit, :name => @stock_change.stock_article.name)) %>'); <%# how to properly escape here? %>
|
||||||
|
if(null === quantity) {
|
||||||
|
stock_change.remove();
|
||||||
|
mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$('input.stock-change-quantity', stock_change).val(quantity);
|
||||||
|
|
||||||
|
})(window);
|
|
@ -1 +0,0 @@
|
||||||
$('#stock_changes').append('#{escape_javascript(render(:partial => 'stock_change', :locals => {:stock_change => StockChange.new, :supplier => @supplier}))}');
|
|
5
app/views/deliveries/copy_stock_article.js.erb
Normal file
5
app/views/deliveries/copy_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
17
app/views/deliveries/create_stock_article.js.erb
Normal file
17
app/views/deliveries/create_stock_article.js.erb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
$('div.container-fluid').prepend(
|
||||||
|
'<%= j(render(:partial => 'shared/alert_success', :locals => {:alert_message => t('.notice', :name => @stock_article.name)})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
$('#stock_articles_for_adding tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_article_for_adding = $(
|
||||||
|
'<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article})) %>'
|
||||||
|
).addClass('success');
|
||||||
|
enablePriceTooltips(stock_article_for_adding);
|
||||||
|
|
||||||
|
$('#stock_articles_for_adding tbody').append(stock_article_for_adding);
|
||||||
|
updateSort('#stock_articles_for_adding');
|
||||||
|
})();
|
||||||
|
|
||||||
|
$('#modalContainer').modal('hide');
|
5
app/views/deliveries/derive_stock_article.js.erb
Normal file
5
app/views/deliveries/derive_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
5
app/views/deliveries/edit_stock_article.js.erb
Normal file
5
app/views/deliveries/edit_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
5
app/views/deliveries/new_stock_article.js.erb
Normal file
5
app/views/deliveries/new_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
33
app/views/deliveries/update_stock_article.js.erb
Normal file
33
app/views/deliveries/update_stock_article.js.erb
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
$('div.container-fluid').prepend(
|
||||||
|
'<%= j(render(:partial => 'shared/alert_success', :locals => {:alert_message => t('.notice', :name => @stock_article.name)})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// update entry in stock_article table
|
||||||
|
|
||||||
|
$('#stock_articles_for_adding tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_article_for_adding = $(
|
||||||
|
'<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article, :delivery => @delivery})) %>'
|
||||||
|
).addClass('success');
|
||||||
|
enablePriceTooltips(stock_article_for_adding);
|
||||||
|
|
||||||
|
$('#stock_article_<%= @stock_article.id %>').replaceWith(stock_article_for_adding);
|
||||||
|
updateSort('#stock_articles_for_adding');
|
||||||
|
|
||||||
|
mark_article_for_delivery(<%= @stock_article.id %>);
|
||||||
|
|
||||||
|
// update entry in stock_changes table
|
||||||
|
|
||||||
|
$('#stock_changes tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_change_entry = $('#stock_change_stock_article_<%= @stock_article.id %>');
|
||||||
|
$('.stock_article_name', stock_change_entry).text('<%= j(@stock_article.name) %>');
|
||||||
|
$('.unit', stock_change_entry).text('<%= j(@stock_article.unit) %>');
|
||||||
|
|
||||||
|
stock_change_entry.addClass('success');
|
||||||
|
|
||||||
|
updateSort('#stock_changes');
|
||||||
|
})();
|
||||||
|
|
||||||
|
$('#modalContainer').modal('hide');
|
|
@ -14,9 +14,9 @@
|
||||||
- for user in @users
|
- for user in @users
|
||||||
%tr
|
%tr
|
||||||
%td= user.nick
|
%td= user.nick
|
||||||
%td= user.name if @current_user.role_admin? || user.settings["profile.nameIsPublic"] == '1'
|
%td= user.name if @current_user.role_admin? || user.settings.profile["name_is_public"]
|
||||||
%td= user.email if @current_user.role_admin? || user.settings["profile.emailIsPublic"] == '1'
|
%td= user.email if @current_user.role_admin? || user.settings.profile["email_is_public"]
|
||||||
%td= user.phone if @current_user.role_admin? || user.settings["profile.phoneIsPublic"] == '1'
|
%td= user.phone if @current_user.role_admin? || user.settings.profile["phone_is_public"]
|
||||||
%td= user.ordergroup_name
|
%td= user.ordergroup_name
|
||||||
%td= user.workgroups.collect(&:name).join(', ')
|
%td= user.workgroups.collect(&:name).join(', ')
|
||||||
%td= link_to_new_message(message_params: {mail_to: user.id})
|
%td= link_to_new_message(message_params: {mail_to: user.id})
|
||||||
|
|
5
app/views/shared/_alert_success.haml
Normal file
5
app/views/shared/_alert_success.haml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.alert.fade.in.alert-success
|
||||||
|
%a.close{:href => '#', :data => {:dismiss => 'alert'}}
|
||||||
|
= t('ui.marks.close').html_safe
|
||||||
|
= t('ui.marks.success').html_safe
|
||||||
|
= alert_message
|
17
app/views/shared/_article_price_info.html.haml
Normal file
17
app/views/shared/_article_price_info.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
%table.table.table-condensed
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.price'
|
||||||
|
%td.numeric= number_to_currency article.price
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.deposit'
|
||||||
|
%td.numeric= number_to_currency article.deposit
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.tax'
|
||||||
|
%td.numeric= number_to_percentage article.tax
|
||||||
|
- unless article.fc_price == article.gross_price
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.fc_share'
|
||||||
|
%td.numeric= number_to_currency(article.fc_price-article.gross_price)
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.fc_price'
|
||||||
|
%td.numeric= number_to_currency article.fc_price
|
5
app/views/shared/_base_errors.haml
Normal file
5
app/views/shared/_base_errors.haml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.alert.alert-error.alert-block
|
||||||
|
%a.close{:href => '#', :data => {:dismiss => 'alert'}}
|
||||||
|
= t('ui.marks.close').html_safe
|
||||||
|
%ul
|
||||||
|
= error_messages.html_safe
|
|
@ -5,11 +5,31 @@
|
||||||
= f.input :phone
|
= f.input :phone
|
||||||
= f.input :password, :required => f.object.new_record?
|
= f.input :password, :required => f.object.new_record?
|
||||||
= f.input :password_confirmation
|
= f.input :password_confirmation
|
||||||
.control-group
|
|
||||||
.controls
|
= f.simple_fields_for :settings_attributes do |s|
|
||||||
- for setting in User::setting_keys.keys
|
= s.simple_fields_for :profile, defaults: { inline_label: true } do |profile|
|
||||||
%label.checkbox{:for => "user[setting_attributes][#{setting}]"}
|
= profile.input 'language', as: :select, collection: available_locales, required: false, selected: f.object.settings.profile['language']
|
||||||
= hidden_field_tag "user[setting_attributes][#{setting}]", '0'
|
|
||||||
= check_box_tag "user[setting_attributes][#{setting}]", '1',
|
.settings
|
||||||
f.object.settings[setting] == '1' || f.object.settings_default(setting)
|
.settings-group
|
||||||
= User::setting_keys[setting]
|
= s.simple_fields_for :profile, defaults: { inline_label: true } do |profile|
|
||||||
|
|
||||||
|
%div{class: 'control-group h_wrapper'}
|
||||||
|
%h5{class: 'controls'}
|
||||||
|
= t 'simple_form.labels.settings.settings_group.privacy'
|
||||||
|
= profile.input 'phone_is_public', as: :boolean, label: false, input_html: { checked: f.object.settings.profile['phone_is_public'] }
|
||||||
|
= profile.input 'email_is_public', as: :boolean, label: false, input_html: { checked: f.object.settings.profile['email_is_public'] }
|
||||||
|
= profile.input 'name_is_public', as: :boolean, label: false, input_html: { checked: f.object.settings.profile['name_is_public'] }
|
||||||
|
|
||||||
|
.settings-group
|
||||||
|
%div{class: 'control-group'}
|
||||||
|
%h5{class: 'controls'}
|
||||||
|
= t 'simple_form.labels.settings.settings_group.messages'
|
||||||
|
|
||||||
|
= s.simple_fields_for :messages, defaults: { inline_label: true, label: false } do |messages|
|
||||||
|
= messages.input 'send_as_email', as: :boolean, input_html: { checked: f.object.settings.messages['send_as_email'] }
|
||||||
|
= s.simple_fields_for :notify, defaults: { inline_label: true, label: false } do |notify|
|
||||||
|
= notify.input 'order_finished', as: :boolean, input_html: { checked: f.object.settings.notify['order_finished'] }
|
||||||
|
= notify.input 'negative_balance', as: :boolean, input_html: { checked: f.object.settings.notify['negative_balance'] }
|
||||||
|
= notify.input 'upcoming_tasks', as: :boolean, input_html: { checked: f.object.settings.notify['upcoming_tasks'] }
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,5 @@ var successDiv = $('<div class="alert fade in alert-success"><a class="close" da
|
||||||
successDiv.append(document.createTextNode('#{escape_javascript(t('.notice', name: @article.name))}'));
|
successDiv.append(document.createTextNode('#{escape_javascript(t('.notice', name: @article.name))}'));
|
||||||
$('div.container-fluid').prepend(successDiv);
|
$('div.container-fluid').prepend(successDiv);
|
||||||
|
|
||||||
-# WARNING: If you try to use the escape j(...) here, an error occurs:
|
|
||||||
-# Ein Fehler ist aufgetreten: undefined method `gsub' for 50:Fixnum
|
|
||||||
-# However, it should work without without escaping.
|
|
||||||
-# Note that article names which are purely numeric, e.g. 12345, are escaped correctly (see above).
|
|
||||||
|
|
||||||
$('#stockArticle-#{@article.id}').remove();
|
$('#stockArticle-#{@article.id}').remove();
|
||||||
|
|
||||||
-# WARNING: Do not use a simple .fadeOut() above, because it conflicts with the show/hide function of unavailable articles.
|
-# WARNING: Do not use a simple .fadeOut() above, because it conflicts with the show/hide function of unavailable articles.
|
||||||
|
|
|
@ -18,7 +18,7 @@ class UserNotifier
|
||||||
Order.find(order_id).group_orders.each do |group_order|
|
Order.find(order_id).group_orders.each do |group_order|
|
||||||
group_order.ordergroup.users.each do |user|
|
group_order.ordergroup.users.each do |user|
|
||||||
begin
|
begin
|
||||||
Mailer.order_result(user, group_order).deliver if user.settings["notify.orderFinished"] == '1'
|
Mailer.order_result(user, group_order).deliver if user.settings.notify["order_finished"]
|
||||||
rescue
|
rescue
|
||||||
Rails.logger.warn "Can't deliver mail to #{user.email}"
|
Rails.logger.warn "Can't deliver mail to #{user.email}"
|
||||||
end
|
end
|
||||||
|
@ -34,7 +34,7 @@ class UserNotifier
|
||||||
|
|
||||||
Ordergroup.find(ordergroup_id).users.each do |user|
|
Ordergroup.find(ordergroup_id).users.each do |user|
|
||||||
begin
|
begin
|
||||||
Mailer.negative_balance(user, transaction).deliver if user.settings["notify.negativeBalance"] == '1'
|
Mailer.negative_balance(user, transaction).deliver if user.settings.notify["negative_balance"]
|
||||||
rescue
|
rescue
|
||||||
Rails.logger.warn "Can't deliver mail to #{user.email}"
|
Rails.logger.warn "Can't deliver mail to #{user.email}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ module Foodsoft
|
||||||
|
|
||||||
# Internationalization.
|
# Internationalization.
|
||||||
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
|
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
|
||||||
config.i18n.default_locale = :de
|
config.i18n.default_locale = :en
|
||||||
|
|
||||||
# Configure the default encoding used in templates for Ruby 1.9.
|
# Configure the default encoding used in templates for Ruby 1.9.
|
||||||
config.encoding = "utf-8"
|
config.encoding = "utf-8"
|
||||||
|
|
|
@ -37,6 +37,17 @@ SimpleForm.setup do |config|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Do not use the label in tables
|
||||||
|
config.wrappers :intable, :tag => 'div', :class => 'control-group control-group-intable', :error_class => 'error' do |b|
|
||||||
|
b.use :html5
|
||||||
|
b.use :placeholder
|
||||||
|
b.wrapper :tag => 'div', :class => 'controls controls-intable' do |ba|
|
||||||
|
ba.use :input
|
||||||
|
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
||||||
|
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
||||||
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
||||||
# to learn about the different styles for forms and inputs,
|
# to learn about the different styles for forms and inputs,
|
||||||
|
|
|
@ -39,6 +39,8 @@ de:
|
||||||
article_category: Kategorie
|
article_category: Kategorie
|
||||||
availability: Artikel ist verfügbar?
|
availability: Artikel ist verfügbar?
|
||||||
deposit: Pfand
|
deposit: Pfand
|
||||||
|
fc_price: Endpreis
|
||||||
|
fc_share: FC-Aufschlag
|
||||||
gross_price: Bruttopreis
|
gross_price: Bruttopreis
|
||||||
price: Nettopreis
|
price: Nettopreis
|
||||||
tax: MwSt
|
tax: MwSt
|
||||||
|
@ -421,20 +423,28 @@ de:
|
||||||
second: Sekunden
|
second: Sekunden
|
||||||
year: Jahr
|
year: Jahr
|
||||||
deliveries:
|
deliveries:
|
||||||
|
add_stock_change:
|
||||||
|
how_many_units: Wie viele Einheiten (%{unit}) des Artikels »%{name}« liefern?
|
||||||
create:
|
create:
|
||||||
notice: Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen!
|
notice: Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen!
|
||||||
|
create_stock_article:
|
||||||
|
notice: Neuer Lagerartikel »%{name}« gespeichert.
|
||||||
destroy:
|
destroy:
|
||||||
notice: Lieferung wurde gelöscht.
|
notice: Lieferung wurde gelöscht.
|
||||||
edit:
|
edit:
|
||||||
title: Lieferung bearbeiten
|
title: Lieferung bearbeiten
|
||||||
form:
|
form:
|
||||||
add_article: Lagerartikel der Lieferung hinzufügen
|
actions: Optionen
|
||||||
new_article:
|
article: Artikel
|
||||||
search: Suche nach Artikeln aus dem <i>%{supplier}</i> Katalog
|
category: Kategorie
|
||||||
title: Neuen Lagerartikel anlegen
|
create_from_blank: Ohne Vorlage anlegen
|
||||||
note_new_article: Ist ein Artikel noch nicht in der Lagerverwaltung, muss er erst %{new_link} werden.
|
create_stock_article: Lagerartikel anlegen
|
||||||
note_new_article_link: neu angelegt
|
price: Nettopreis
|
||||||
remove_article: Artikel aus Lieferung entfernen
|
quantity: Menge
|
||||||
|
title_fill_quantities: 2. Liefermenge angeben
|
||||||
|
title_finish_delivery: 3. Lieferung abschließen
|
||||||
|
title_select_stock_articles: 1. Lagerartikel auswählen
|
||||||
|
unit: Einheit
|
||||||
index:
|
index:
|
||||||
confirm_delete: Bist Du sicher?
|
confirm_delete: Bist Du sicher?
|
||||||
new_delivery: Neue Lieferung für %{supplier} anlegen
|
new_delivery: Neue Lieferung für %{supplier} anlegen
|
||||||
|
@ -454,11 +464,19 @@ de:
|
||||||
title: Lieferung anzeigen
|
title: Lieferung anzeigen
|
||||||
title_articles: Artikel
|
title_articles: Artikel
|
||||||
unit: Einheit
|
unit: Einheit
|
||||||
stock_change:
|
stock_article_for_adding:
|
||||||
|
action_add_to_delivery: Liefern
|
||||||
|
action_edit: Bearbeiten
|
||||||
|
action_other_price: Kopieren
|
||||||
|
stock_article_form:
|
||||||
|
copy_stock_article: Lagerartikel kopieren
|
||||||
|
stock_change_fields:
|
||||||
remove_article: Artikel aus Lieferung entfernen
|
remove_article: Artikel aus Lieferung entfernen
|
||||||
suppliers_overview: Lieferantenübersicht
|
suppliers_overview: Lieferantenübersicht
|
||||||
update:
|
update:
|
||||||
notice: Lieferung wurde aktualisiert.
|
notice: Lieferung wurde aktualisiert.
|
||||||
|
update_stock_article:
|
||||||
|
notice: Lagerartikel »%{name}« aktualisiert.
|
||||||
documents:
|
documents:
|
||||||
order_by_articles:
|
order_by_articles:
|
||||||
filename: Bestellung %{name}-%{date} - Artikelsortierung
|
filename: Bestellung %{name}-%{date} - Artikelsortierung
|
||||||
|
@ -1151,6 +1169,8 @@ de:
|
||||||
subject: ! 'Betreff:'
|
subject: ! 'Betreff:'
|
||||||
title: Nachricht anzeigen
|
title: Nachricht anzeigen
|
||||||
model:
|
model:
|
||||||
|
delivery:
|
||||||
|
each_stock_article_must_be_unique: Lieferung darf jeden Lagerartikel höchstens einmal auflisten.
|
||||||
membership:
|
membership:
|
||||||
no_admin_delete: Mitgliedschaft kann nicht beendet werden. Du bist die letzte Administratorin
|
no_admin_delete: Mitgliedschaft kann nicht beendet werden. Du bist die letzte Administratorin
|
||||||
order_article:
|
order_article:
|
||||||
|
@ -1159,14 +1179,6 @@ de:
|
||||||
redirect: Weiterleiting auf [[%{title}]]...
|
redirect: Weiterleiting auf [[%{title}]]...
|
||||||
user:
|
user:
|
||||||
no_ordergroup: keine Bestellgruppe
|
no_ordergroup: keine Bestellgruppe
|
||||||
notify:
|
|
||||||
email_is_public: E-Mail ist für Mitglieder sichtbar
|
|
||||||
name_is_public: Name ist für Mitglieder sichtbar
|
|
||||||
negative_balance: Informiere mich, falls meine Bestellgruppe ins Minus rutscht.
|
|
||||||
order_finished: Informier mich über meine Bestellergebnisse (nach Ende der Bestellung).
|
|
||||||
phone_is_public: Telefon ist für Mitglieder sichtbar
|
|
||||||
send_as_email: Bekomme Nachrichten als Emails.
|
|
||||||
upcoming_tasks: Erinnere mich an anstehende Aufgaben.
|
|
||||||
navigation:
|
navigation:
|
||||||
admin:
|
admin:
|
||||||
home: Übersicht
|
home: Übersicht
|
||||||
|
@ -1514,6 +1526,10 @@ de:
|
||||||
units_to_order: Anzahl gelieferter Gebinde
|
units_to_order: Anzahl gelieferter Gebinde
|
||||||
update_current_price: Ändert auch den Preis für aktuelle Bestellungen
|
update_current_price: Ändert auch den Preis für aktuelle Bestellungen
|
||||||
stock_article:
|
stock_article:
|
||||||
|
copy_stock_article:
|
||||||
|
name: Bitte ändern
|
||||||
|
edit_stock_article:
|
||||||
|
price: <ul><li>Preisänderung gesperrt.</li><li>Bei Bedarf %{stock_article_copy_link}.</li></ul>
|
||||||
supplier:
|
supplier:
|
||||||
supplier:
|
supplier:
|
||||||
min_order_quantity: Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren
|
min_order_quantity: Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren
|
||||||
|
@ -1589,6 +1605,21 @@ de:
|
||||||
page:
|
page:
|
||||||
body: Inhalt
|
body: Inhalt
|
||||||
parent_id: Oberseite
|
parent_id: Oberseite
|
||||||
|
settings:
|
||||||
|
messages:
|
||||||
|
send_as_email: Bekomme Nachrichten als Emails.
|
||||||
|
notify:
|
||||||
|
negative_balance: Informiere mich, falls meine Bestellgruppe ins Minus rutscht.
|
||||||
|
order_finished: Informier mich über meine Bestellergebnisse (nach Ende der Bestellung).
|
||||||
|
upcoming_tasks: Erinnere mich an anstehende Aufgaben.
|
||||||
|
profile:
|
||||||
|
email_is_public: E-Mail ist für Mitglieder sichtbar.
|
||||||
|
language: Sprache
|
||||||
|
name_is_public: Name ist für Mitglieder sichtbar.
|
||||||
|
phone_is_public: Telefon ist für Mitglieder sichtbar.
|
||||||
|
settings_group:
|
||||||
|
messages: Nachrichten
|
||||||
|
privacy: Privatsphäre
|
||||||
stock_article:
|
stock_article:
|
||||||
supplier: Lieferant
|
supplier: Lieferant
|
||||||
supplier:
|
supplier:
|
||||||
|
@ -1632,6 +1663,13 @@ de:
|
||||||
role_orders: Bestellverwaltung
|
role_orders: Bestellverwaltung
|
||||||
role_suppliers: Lieferanten
|
role_suppliers: Lieferanten
|
||||||
'no': Nein
|
'no': Nein
|
||||||
|
options:
|
||||||
|
settings:
|
||||||
|
profile:
|
||||||
|
language:
|
||||||
|
de: Deutsch
|
||||||
|
en: English
|
||||||
|
nl: Niederländisch
|
||||||
required:
|
required:
|
||||||
mark: ! '*'
|
mark: ! '*'
|
||||||
text: benötigt
|
text: benötigt
|
||||||
|
@ -1834,7 +1872,9 @@ de:
|
||||||
history: Verlauf anzeigen
|
history: Verlauf anzeigen
|
||||||
marks:
|
marks:
|
||||||
close: ! '×'
|
close: ! '×'
|
||||||
|
success: <i class="icon icon-ok"></i>
|
||||||
or_cancel: oder abbrechen
|
or_cancel: oder abbrechen
|
||||||
|
please_wait: Bitte warten...
|
||||||
save: Speichern
|
save: Speichern
|
||||||
show: Anzeigen
|
show: Anzeigen
|
||||||
views:
|
views:
|
||||||
|
|
|
@ -39,6 +39,8 @@ en:
|
||||||
article_category: article category
|
article_category: article category
|
||||||
availability: Is article available?
|
availability: Is article available?
|
||||||
deposit: deposit
|
deposit: deposit
|
||||||
|
fc_price: FC price
|
||||||
|
fc_share: FC share
|
||||||
gross_price: gross price
|
gross_price: gross price
|
||||||
price: price
|
price: price
|
||||||
tax: VAT
|
tax: VAT
|
||||||
|
@ -423,20 +425,28 @@ en:
|
||||||
second: seconds
|
second: seconds
|
||||||
year: years
|
year: years
|
||||||
deliveries:
|
deliveries:
|
||||||
|
add_stock_change:
|
||||||
|
how_many_units: ! 'How many units (%{unit}) to deliver? Stock article name: %{name}.'
|
||||||
create:
|
create:
|
||||||
notice: Delivery was created. Please don’t forget to create invoice!
|
notice: Delivery was created. Please don’t forget to create invoice!
|
||||||
|
create_stock_article:
|
||||||
|
notice: The new stock article »%{name}« was saved.
|
||||||
destroy:
|
destroy:
|
||||||
notice: Delivery was deleted.
|
notice: Delivery was deleted.
|
||||||
edit:
|
edit:
|
||||||
title: Edit suppliers
|
title: Edit delivery
|
||||||
form:
|
form:
|
||||||
add_article: Add stock article to delivery
|
actions: Tasks
|
||||||
new_article:
|
article: Article
|
||||||
search: Search for articles in the <i>%{supplier}</i> catalogue
|
category: Category
|
||||||
title: Create new stock article
|
create_from_blank: Create new article
|
||||||
note_new_article: When an article is not yet in the inventory, you have to %{new_link} it first.
|
create_stock_article: Create stock articles
|
||||||
note_new_article_link: create
|
price: Netprice
|
||||||
remove_article: Remove article from delivery
|
quantity: Quantity
|
||||||
|
title_fill_quantities: 2. Set delivery quantities
|
||||||
|
title_finish_delivery: 3. Finish delivery
|
||||||
|
title_select_stock_articles: 1. Select stock articles
|
||||||
|
unit: Unit
|
||||||
index:
|
index:
|
||||||
confirm_delete: Are you sure?
|
confirm_delete: Are you sure?
|
||||||
new_delivery: ! 'Create new delivery for %{supplier} '
|
new_delivery: ! 'Create new delivery for %{supplier} '
|
||||||
|
@ -456,11 +466,19 @@ en:
|
||||||
title: Show delivery
|
title: Show delivery
|
||||||
title_articles: Article
|
title_articles: Article
|
||||||
unit: Unit
|
unit: Unit
|
||||||
stock_change:
|
stock_article_for_adding:
|
||||||
remove_article: Remove articles from delivery
|
action_add_to_delivery: Add to delivery
|
||||||
|
action_edit: Edit
|
||||||
|
action_other_price: Copy
|
||||||
|
stock_article_form:
|
||||||
|
copy_stock_article: Copy stock article
|
||||||
|
stock_change_fields:
|
||||||
|
remove_article: Remove article from delivery
|
||||||
suppliers_overview: Supplier overview
|
suppliers_overview: Supplier overview
|
||||||
update:
|
update:
|
||||||
notice: Delivery was updated.
|
notice: Delivery was updated.
|
||||||
|
update_stock_article:
|
||||||
|
notice: The stock article »%{name}« was updated.
|
||||||
documents:
|
documents:
|
||||||
order_by_articles:
|
order_by_articles:
|
||||||
filename: Order %{name}-%{date} - by articles
|
filename: Order %{name}-%{date} - by articles
|
||||||
|
@ -1153,6 +1171,8 @@ en:
|
||||||
subject: ! 'Subject:'
|
subject: ! 'Subject:'
|
||||||
title: Show message
|
title: Show message
|
||||||
model:
|
model:
|
||||||
|
delivery:
|
||||||
|
each_stock_article_must_be_unique: Each stock article must not be listed more than once.
|
||||||
membership:
|
membership:
|
||||||
no_admin_delete: Membership can not be withdrawn as you are the last administrator.
|
no_admin_delete: Membership can not be withdrawn as you are the last administrator.
|
||||||
order_article:
|
order_article:
|
||||||
|
@ -1161,14 +1181,6 @@ en:
|
||||||
redirect: Redirect to [[%{title}]]...
|
redirect: Redirect to [[%{title}]]...
|
||||||
user:
|
user:
|
||||||
no_ordergroup: no order group
|
no_ordergroup: no order group
|
||||||
notify:
|
|
||||||
email_is_public: Email is visible for other members.
|
|
||||||
name_is_public: Name is visible for other members.
|
|
||||||
negative_balance: inform me when by order group has a negative balance.
|
|
||||||
order_finished: Inform me about my order result (when the order is closed).
|
|
||||||
phone_is_public: Phone number is visible for other members.
|
|
||||||
send_as_email: Receive messages as emails.
|
|
||||||
upcoming_tasks: Remind me of upcoming tasks.
|
|
||||||
navigation:
|
navigation:
|
||||||
admin:
|
admin:
|
||||||
home: Overview
|
home: Overview
|
||||||
|
@ -1516,6 +1528,10 @@ en:
|
||||||
units_to_order: Amount of delivered units
|
units_to_order: Amount of delivered units
|
||||||
update_current_price: Also update the price of the current order
|
update_current_price: Also update the price of the current order
|
||||||
stock_article:
|
stock_article:
|
||||||
|
copy_stock_article:
|
||||||
|
name: Please modify
|
||||||
|
edit_stock_article:
|
||||||
|
price: <ul><li>Price changes are forbidden.</li><li>If necessary, %{stock_article_copy_link}.</li></ul>
|
||||||
supplier:
|
supplier:
|
||||||
supplier:
|
supplier:
|
||||||
min_order_quantity: The minimum amount which has to be orderd will be shown during the order process and should motivate ordering
|
min_order_quantity: The minimum amount which has to be orderd will be shown during the order process and should motivate ordering
|
||||||
|
@ -1591,6 +1607,21 @@ en:
|
||||||
page:
|
page:
|
||||||
body: Body
|
body: Body
|
||||||
parent_id: Parent page
|
parent_id: Parent page
|
||||||
|
settings:
|
||||||
|
messages:
|
||||||
|
send_as_email: Receive messages as emails.
|
||||||
|
notify:
|
||||||
|
negative_balance: Inform me when my order group has a negative balance.
|
||||||
|
order_finished: Inform me about my order result (when the order is closed).
|
||||||
|
upcoming_tasks: Remind me of upcoming tasks.
|
||||||
|
profile:
|
||||||
|
email_is_public: Email is visible for other members.
|
||||||
|
language: Language
|
||||||
|
name_is_public: Name is visible for other members.
|
||||||
|
phone_is_public: Phone number is visible for other members.
|
||||||
|
settings_group:
|
||||||
|
messages: Messages
|
||||||
|
privacy: Privacy
|
||||||
stock_article:
|
stock_article:
|
||||||
supplier: Supplier
|
supplier: Supplier
|
||||||
supplier:
|
supplier:
|
||||||
|
@ -1634,6 +1665,13 @@ en:
|
||||||
role_orders: Order management
|
role_orders: Order management
|
||||||
role_suppliers: Suppliers
|
role_suppliers: Suppliers
|
||||||
'no': 'No'
|
'no': 'No'
|
||||||
|
options:
|
||||||
|
settings:
|
||||||
|
profile:
|
||||||
|
language:
|
||||||
|
de: German
|
||||||
|
en: English
|
||||||
|
nl: Dutch
|
||||||
required:
|
required:
|
||||||
mark: ! '*'
|
mark: ! '*'
|
||||||
text: required
|
text: required
|
||||||
|
@ -1836,7 +1874,9 @@ en:
|
||||||
history: Show history
|
history: Show history
|
||||||
marks:
|
marks:
|
||||||
close: ! '×'
|
close: ! '×'
|
||||||
|
success: <i class="icon icon-ok"></i>
|
||||||
or_cancel: or cancel
|
or_cancel: or cancel
|
||||||
|
please_wait: Please wait...
|
||||||
save: Save
|
save: Save
|
||||||
show: Show
|
show: Show
|
||||||
views:
|
views:
|
||||||
|
|
|
@ -39,6 +39,8 @@ nl:
|
||||||
article_category: categorie
|
article_category: categorie
|
||||||
availability: Artikel leverbaar?
|
availability: Artikel leverbaar?
|
||||||
deposit: statiegeld
|
deposit: statiegeld
|
||||||
|
fc_price:
|
||||||
|
fc_share:
|
||||||
gross_price: bruto prijs
|
gross_price: bruto prijs
|
||||||
price: netto prijs
|
price: netto prijs
|
||||||
tax: BTW
|
tax: BTW
|
||||||
|
@ -421,20 +423,28 @@ nl:
|
||||||
second: seconden
|
second: seconden
|
||||||
year: jaren
|
year: jaren
|
||||||
deliveries:
|
deliveries:
|
||||||
|
add_stock_change:
|
||||||
|
how_many_units:
|
||||||
create:
|
create:
|
||||||
notice:
|
notice:
|
||||||
|
create_stock_article:
|
||||||
|
notice:
|
||||||
destroy:
|
destroy:
|
||||||
notice:
|
notice:
|
||||||
edit:
|
edit:
|
||||||
title:
|
title:
|
||||||
form:
|
form:
|
||||||
add_article:
|
actions:
|
||||||
new_article:
|
article:
|
||||||
search:
|
category:
|
||||||
title:
|
create_from_blank:
|
||||||
note_new_article:
|
create_stock_article:
|
||||||
note_new_article_link:
|
price:
|
||||||
remove_article:
|
quantity:
|
||||||
|
title_fill_quantities:
|
||||||
|
title_finish_delivery:
|
||||||
|
title_select_stock_articles:
|
||||||
|
unit:
|
||||||
index:
|
index:
|
||||||
confirm_delete:
|
confirm_delete:
|
||||||
new_delivery:
|
new_delivery:
|
||||||
|
@ -454,11 +464,19 @@ nl:
|
||||||
title:
|
title:
|
||||||
title_articles:
|
title_articles:
|
||||||
unit:
|
unit:
|
||||||
stock_change:
|
stock_article_for_adding:
|
||||||
|
action_add_to_delivery:
|
||||||
|
action_edit:
|
||||||
|
action_other_price:
|
||||||
|
stock_article_form:
|
||||||
|
copy_stock_article:
|
||||||
|
stock_change_fields:
|
||||||
remove_article:
|
remove_article:
|
||||||
suppliers_overview:
|
suppliers_overview:
|
||||||
update:
|
update:
|
||||||
notice:
|
notice:
|
||||||
|
update_stock_article:
|
||||||
|
notice:
|
||||||
documents:
|
documents:
|
||||||
order_by_articles:
|
order_by_articles:
|
||||||
filename:
|
filename:
|
||||||
|
@ -1044,6 +1062,8 @@ nl:
|
||||||
subject:
|
subject:
|
||||||
title:
|
title:
|
||||||
model:
|
model:
|
||||||
|
delivery:
|
||||||
|
each_stock_article_must_be_unique:
|
||||||
membership:
|
membership:
|
||||||
no_admin_delete:
|
no_admin_delete:
|
||||||
order_article:
|
order_article:
|
||||||
|
@ -1052,14 +1072,6 @@ nl:
|
||||||
redirect:
|
redirect:
|
||||||
user:
|
user:
|
||||||
no_ordergroup:
|
no_ordergroup:
|
||||||
notify:
|
|
||||||
email_is_public:
|
|
||||||
name_is_public:
|
|
||||||
negative_balance:
|
|
||||||
order_finished: Informeer me over mijn bestelresultaat (wanneer de bestelling gesloten wordt).
|
|
||||||
phone_is_public:
|
|
||||||
send_as_email:
|
|
||||||
upcoming_tasks:
|
|
||||||
navigation:
|
navigation:
|
||||||
admin:
|
admin:
|
||||||
home: Overzicht
|
home: Overzicht
|
||||||
|
@ -1405,6 +1417,10 @@ nl:
|
||||||
units_to_order:
|
units_to_order:
|
||||||
update_current_price:
|
update_current_price:
|
||||||
stock_article:
|
stock_article:
|
||||||
|
copy_stock_article:
|
||||||
|
name:
|
||||||
|
edit_stock_article:
|
||||||
|
price:
|
||||||
supplier:
|
supplier:
|
||||||
supplier:
|
supplier:
|
||||||
min_order_quantity:
|
min_order_quantity:
|
||||||
|
@ -1480,6 +1496,21 @@ nl:
|
||||||
page:
|
page:
|
||||||
body:
|
body:
|
||||||
parent_id:
|
parent_id:
|
||||||
|
settings:
|
||||||
|
messages:
|
||||||
|
send_as_email: Berichten als emails ontvangen.
|
||||||
|
notify:
|
||||||
|
negative_balance: Informeer me wanneer mijn huishouden een negatief saldo krijgt.
|
||||||
|
order_finished: Informeer me over mijn bestelresultaat (wanneer de bestelling gesloten wordt).
|
||||||
|
upcoming_tasks: Herinner me aan aankomende taken.
|
||||||
|
profile:
|
||||||
|
email_is_public: E-mail is zichtbaar voor andere leden.
|
||||||
|
language: Taal
|
||||||
|
name_is_public: Naam is zichtbaar voor andere leden.
|
||||||
|
phone_is_public: Telefoonnummer is zichtbaar voor andere leden.
|
||||||
|
settings_group:
|
||||||
|
messages: Berichten
|
||||||
|
privacy: Privacy
|
||||||
stock_article:
|
stock_article:
|
||||||
supplier:
|
supplier:
|
||||||
supplier:
|
supplier:
|
||||||
|
@ -1523,6 +1554,13 @@ nl:
|
||||||
role_orders:
|
role_orders:
|
||||||
role_suppliers: Leveranciers
|
role_suppliers: Leveranciers
|
||||||
'no': Nee
|
'no': Nee
|
||||||
|
options:
|
||||||
|
settings:
|
||||||
|
profile:
|
||||||
|
language:
|
||||||
|
de: Duits
|
||||||
|
en: Engels
|
||||||
|
nl: Nederlands
|
||||||
required:
|
required:
|
||||||
mark: ! '*'
|
mark: ! '*'
|
||||||
text: verplicht
|
text: verplicht
|
||||||
|
@ -1725,7 +1763,9 @@ nl:
|
||||||
history:
|
history:
|
||||||
marks:
|
marks:
|
||||||
close: ! '×'
|
close: ! '×'
|
||||||
|
success:
|
||||||
or_cancel: of annuleren
|
or_cancel: of annuleren
|
||||||
|
please_wait:
|
||||||
save: Opslaan
|
save: Opslaan
|
||||||
show: Tonen
|
show: Tonen
|
||||||
views:
|
views:
|
||||||
|
|
|
@ -8,6 +8,7 @@ Foodsoft::Application.routes.draw do
|
||||||
|
|
||||||
root :to => redirect("/#{FoodsoftConfig.scope}")
|
root :to => redirect("/#{FoodsoftConfig.scope}")
|
||||||
|
|
||||||
|
|
||||||
scope '/:foodcoop' do
|
scope '/:foodcoop' do
|
||||||
|
|
||||||
# Root path
|
# Root path
|
||||||
|
@ -104,8 +105,15 @@ Foodsoft::Application.routes.draw do
|
||||||
get :shared_suppliers, :on => :collection
|
get :shared_suppliers, :on => :collection
|
||||||
|
|
||||||
resources :deliveries do
|
resources :deliveries do
|
||||||
post :drop_stock_change, :on => :member
|
post :add_stock_change, :on => :collection
|
||||||
post :add_stock_article, :on => :collection
|
|
||||||
|
get :new_stock_article, :on => :collection
|
||||||
|
get :copy_stock_article, :on => :collection
|
||||||
|
get :derive_stock_article, :on => :collection
|
||||||
|
post :create_stock_article, :on => :collection
|
||||||
|
|
||||||
|
get :edit_stock_article, :on => :collection
|
||||||
|
put :update_stock_article, :on => :collection
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :articles do
|
resources :articles do
|
||||||
|
|
17
db/migrate/20130718183100_create_settings.rb
Normal file
17
db/migrate/20130718183100_create_settings.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
class CreateSettings < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
create_table :settings do |t|
|
||||||
|
t.string :var, null: false
|
||||||
|
t.text :value, null: true
|
||||||
|
t.integer :thing_id, null: true
|
||||||
|
t.string :thing_type, limit: 30, null: true
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :settings, [ :thing_type, :thing_id, :var ], unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
drop_table :settings
|
||||||
|
end
|
||||||
|
end
|
34
db/migrate/20130718183101_migrate_user_settings.rb
Normal file
34
db/migrate/20130718183101_migrate_user_settings.rb
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
class MigrateUserSettings < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
old_settings = ConfigurableSetting.all
|
||||||
|
|
||||||
|
old_settings.each do |old_setting|
|
||||||
|
# get target (user)
|
||||||
|
type = old_setting.configurable_type
|
||||||
|
id = old_setting.configurable_id
|
||||||
|
user = type.constantize.find(id)
|
||||||
|
|
||||||
|
# get the data (settings)
|
||||||
|
name = old_setting.name
|
||||||
|
namespace = name.split('.')[0]
|
||||||
|
key = name.split('.')[1].underscore # Camelcase to underscore
|
||||||
|
|
||||||
|
# prepare value
|
||||||
|
value = YAML.load(old_setting.value)
|
||||||
|
value = value.nil? ? false : value
|
||||||
|
|
||||||
|
# set the settings_attributes (thanks to settings.merge! we can set them one by one)
|
||||||
|
user.settings_attributes = {
|
||||||
|
"#{namespace}" => {
|
||||||
|
"#{key}" => value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# save the user to apply after_save callback
|
||||||
|
user.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
13
db/schema.rb
13
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130624085246) do
|
ActiveRecord::Schema.define(:version => 20130718183101) do
|
||||||
|
|
||||||
create_table "article_categories", :force => true do |t|
|
create_table "article_categories", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
|
@ -268,6 +268,17 @@ ActiveRecord::Schema.define(:version => 20130624085246) do
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "settings", :force => true do |t|
|
||||||
|
t.string "var", :null => false
|
||||||
|
t.text "value"
|
||||||
|
t.integer "thing_id"
|
||||||
|
t.string "thing_type", :limit => 30
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "settings", ["thing_type", "thing_id", "var"], :name => "index_settings_on_thing_type_and_thing_id_and_var", :unique => true
|
||||||
|
|
||||||
create_table "stock_changes", :force => true do |t|
|
create_table "stock_changes", :force => true do |t|
|
||||||
t.integer "delivery_id"
|
t.integer "delivery_id"
|
||||||
t.integer "order_id"
|
t.integer "order_id"
|
||||||
|
|
55
lib/foodsoft/controller_extensions.rb
Normal file
55
lib/foodsoft/controller_extensions.rb
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
module Foodsoft
|
||||||
|
module ControllerExtensions
|
||||||
|
module Locale
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
before_filter :set_locale
|
||||||
|
end
|
||||||
|
|
||||||
|
def explicitly_requested_language
|
||||||
|
params[:locale]
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_settings_language
|
||||||
|
current_user.locale if current_user
|
||||||
|
end
|
||||||
|
|
||||||
|
def session_language
|
||||||
|
session[:locale]
|
||||||
|
end
|
||||||
|
|
||||||
|
def browser_language
|
||||||
|
request.env['HTTP_ACCEPT_LANGUAGE'] ? request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first : nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_language
|
||||||
|
::I18n.default_locale
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def select_language_according_to_priority
|
||||||
|
language = explicitly_requested_language || session_language || user_settings_language || browser_language
|
||||||
|
language.to_sym unless language.blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
def available_locales
|
||||||
|
::I18n.available_locales
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_locale
|
||||||
|
if available_locales.include?(select_language_according_to_priority)
|
||||||
|
::I18n.locale = select_language_according_to_priority
|
||||||
|
else
|
||||||
|
::I18n.locale = default_language
|
||||||
|
end
|
||||||
|
|
||||||
|
locale = session[:locale] = ::I18n.locale
|
||||||
|
logger.info("Set locale to #{locale}")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -8,7 +8,7 @@ namespace :foodsoft do
|
||||||
puts "Send notifications for #{task.name} to .."
|
puts "Send notifications for #{task.name} to .."
|
||||||
for user in task.users
|
for user in task.users
|
||||||
begin
|
begin
|
||||||
Mailer.upcoming_tasks(user, task).deliver if user.settings['notify.upcoming_tasks'] == 1
|
Mailer.upcoming_tasks(user, task).deliver if user.settings.notify['upcoming_tasks'] == 1
|
||||||
rescue
|
rescue
|
||||||
puts "deliver aborted for #{user.email}.."
|
puts "deliver aborted for #{user.email}.."
|
||||||
end
|
end
|
||||||
|
@ -23,7 +23,7 @@ namespace :foodsoft do
|
||||||
unless task.enough_users_assigned?
|
unless task.enough_users_assigned?
|
||||||
puts "Notify workgroup: #{workgroup.name} for task #{task.name}"
|
puts "Notify workgroup: #{workgroup.name} for task #{task.name}"
|
||||||
for user in workgroup.users
|
for user in workgroup.users
|
||||||
if user.settings['messages.sendAsEmail'] == "1" && !user.email.blank?
|
if user.settings.messages['send_as_email'] == "1" && !user.email.blank?
|
||||||
begin
|
begin
|
||||||
Mailer.not_enough_users_assigned(task, user).deliver
|
Mailer.not_enough_users_assigned(task, user).deliver
|
||||||
rescue
|
rescue
|
||||||
|
|
|
@ -55,10 +55,10 @@ fi
|
||||||
sed -i "s|^\\(\\s*gem\\s\\+'sqlite3'\\)|#\1|" Gemfile
|
sed -i "s|^\\(\\s*gem\\s\\+'sqlite3'\\)|#\1|" Gemfile
|
||||||
sed -i "s|^\\(\\s*sqlite3\\b\)|#\1|" Gemfile.lock
|
sed -i "s|^\\(\\s*sqlite3\\b\)|#\1|" Gemfile.lock
|
||||||
# make sure postgresql db is present, as it is the default heroku db
|
# make sure postgresql db is present, as it is the default heroku db
|
||||||
echo "\ngem 'pg'" >>Gemfile
|
echo $'\ngem "pg"' >>Gemfile
|
||||||
echo "\ngem 'localeapp'" >>Gemfile
|
echo $'\ngem "localeapp"' >>Gemfile
|
||||||
# always use unicorn
|
# always use unicorn
|
||||||
echo "\ngem 'unicorn'" >>Gemfile
|
echo $'\ngem "unicorn"' >>Gemfile
|
||||||
echo 'web: bundle exec unicorn -p $PORT -E $RACK_ENV' >Procfile
|
echo 'web: bundle exec unicorn -p $PORT -E $RACK_ENV' >Procfile
|
||||||
bundle install --quiet # to update Gemfile.lock
|
bundle install --quiet # to update Gemfile.lock
|
||||||
# do not ignore deployment files
|
# do not ignore deployment files
|
||||||
|
|
Loading…
Reference in a new issue