diff --git a/.travis.yml b/.travis.yml index 383dac1c..003c0985 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ rvm: - 1.9.3 services: - redis-server +env: COVERALLS=1 before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..2d5fb822 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# Foodsoft 3.2.0 +(16 December 2013) + +It's been a year since the previous release. Much has changed. Big changes have been: +* Translations to English, Dutch and French. +* Improved usability of delivery creation. +* The possibility to extend foodsoft with plugins (the wiki is now optional). +* Article search in the ordering screen. +* Foodcoops can choose to use full names and emails instead of nicknames. +* Foodcoops that don't use prepaid can set their minimum ordergroup balance below zero. +* Group and article PDFs now show articles ordered but not received in grey. +* Upgrade to Rails 3. + +When you upgrade, be sure to review `config/app_config.yml.SAMPLE`. When you're running multiple foodcoops from a single installation, check your rake invocations as the syntax is now: `rake multicoops:run TASK=db:migrate`. + +# Foodsoft 3.1.1 +(20 July 2012) diff --git a/Gemfile b/Gemfile index ffb4ff0e..71ba7eeb 100644 --- a/Gemfile +++ b/Gemfile @@ -65,15 +65,15 @@ group :development do gem 'quiet_assets' # Deploy with Capistrano - gem 'capistrano', '2.13.5' - gem 'capistrano-ext' + gem 'capistrano', '2.13.5', require: false + gem 'capistrano-ext', require: false #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 group :development, :test do - gem 'ruby-prof' + gem 'ruby-prof', require: false end group :test do @@ -84,10 +84,12 @@ group :test do # webkit and poltergeist don't seem to work yet gem 'selenium-webdriver' gem 'database_cleaner' - gem 'simplecov', require: false # need to include rspec components before i18n-spec or rake fails in test environment gem 'rspec-core' gem 'rspec-expectations' gem 'rspec-rerun' gem 'i18n-spec' + # code coverage + gem 'simplecov', require: false + gem 'coveralls', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 5f72b63f..291014eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,12 +30,12 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (1.0.2) - actionmailer (3.2.15) - actionpack (= 3.2.15) + actionmailer (3.2.16) + actionpack (= 3.2.16) mail (~> 2.5.4) - actionpack (3.2.15) - activemodel (= 3.2.15) - activesupport (= 3.2.15) + actionpack (3.2.16) + activemodel (= 3.2.16) + activesupport (= 3.2.16) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -43,21 +43,21 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.15) - activesupport (= 3.2.15) + activemodel (3.2.16) + activesupport (= 3.2.16) builder (~> 3.0.0) - activerecord (3.2.15) - activemodel (= 3.2.15) - activesupport (= 3.2.15) + activerecord (3.2.16) + activemodel (= 3.2.16) + activesupport (= 3.2.16) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.15) - activemodel (= 3.2.15) - activesupport (= 3.2.15) - activesupport (3.2.15) + activeresource (3.2.16) + activemodel (= 3.2.16) + activesupport (= 3.2.16) + activesupport (3.2.16) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - acts_as_tree (1.4.0) + acts_as_tree (1.5.0) activerecord (>= 3.0.0) afm (0.2.0) arel (3.0.3) @@ -66,7 +66,7 @@ GEM erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bootstrap-datepicker-rails (1.1.1.9) + bootstrap-datepicker-rails (1.1.1.10) railties (>= 3.0) builder (3.0.4) bullet (4.7.1) @@ -80,7 +80,7 @@ GEM net-ssh-gateway (>= 1.1.0) capistrano-ext (1.2.1) capistrano (>= 1.0.0) - capybara (2.1.0) + capybara (2.2.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -102,11 +102,17 @@ GEM execjs coffee-script-source (1.6.3) commonjs (0.2.7) + coveralls (0.7.0) + multi_json (~> 1.3) + rest-client + simplecov (>= 0.7) + term-ansicolor + thor daemons (1.1.9) database_cleaner (1.2.0) debug_inspector (0.0.2) diff-lcs (1.2.5) - docile (1.1.0) + docile (1.1.1) erubis (2.7.0) eventmachine (1.0.3) exception_notification (4.0.1) @@ -135,7 +141,7 @@ GEM hashery (2.1.1) highline (1.6.20) hike (1.2.3) - i18n (0.6.5) + i18n (0.6.9) i18n-spec (0.4.0) iso inherited_resources (1.4.1) @@ -148,7 +154,7 @@ GEM railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) - kaminari (0.14.1) + kaminari (0.15.0) actionpack (>= 3.0.0) activesupport (>= 3.0.0) less (2.4.0) @@ -157,7 +163,6 @@ GEM actionpack (>= 3.1) less (~> 2.4.0) libv8 (3.16.14.3) - lockfile (2.1.0) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) @@ -175,7 +180,7 @@ GEM activerecord (~> 3.1) activesupport (~> 3.1) polyamorous (~> 0.5.0) - mime-types (1.25) + mime-types (1.25.1) mini_portile (0.5.2) mono_logger (1.1.0) multi_json (1.8.2) @@ -187,7 +192,7 @@ GEM net-ssh (2.7.0) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) - nokogiri (1.6.0) + nokogiri (1.6.1) mini_portile (~> 0.5.0) pdf-reader (1.3.3) Ascii85 (~> 1.0.0) @@ -198,9 +203,11 @@ GEM polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) - prawn (0.12.0) - pdf-reader (>= 0.9.0) - ttfunk (~> 1.0.2) + prawn (0.13.0) + afm + pdf-reader (~> 1.2) + ruby-rc4 + ttfunk (~> 1.0.3) quiet_assets (1.0.2) railties (>= 3.1, < 5.0) rack (1.4.5) @@ -212,14 +219,14 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.15) - actionmailer (= 3.2.15) - actionpack (= 3.2.15) - activerecord (= 3.2.15) - activeresource (= 3.2.15) - activesupport (= 3.2.15) + rails (3.2.16) + actionmailer (= 3.2.16) + actionpack (= 3.2.16) + activerecord (= 3.2.16) + activeresource (= 3.2.16) + activesupport (= 3.2.16) bundler (~> 1.0) - railties (= 3.2.15) + railties (= 3.2.16) rails-assets-listjs (0.2.0.beta.4) railties (>= 3.1) rails-i18n (3.0.0) @@ -227,9 +234,9 @@ GEM rails (>= 3.0.0, < 4.0.0) rails-settings-cached (0.2.4) rails (>= 3.0.0) - railties (3.2.15) - actionpack (= 3.2.15) - activesupport (= 3.2.15) + railties (3.2.16) + actionpack (= 3.2.16) + activesupport (= 3.2.16) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -238,7 +245,7 @@ GEM rdoc (3.12.2) json (~> 1.4) redis (3.0.6) - redis-namespace (1.3.2) + redis-namespace (1.4.1) redis (~> 3.0.4) ref (1.0.5) responders (1.0.0) @@ -249,6 +256,8 @@ GEM redis-namespace (~> 1.2) sinatra (>= 0.9.2) vegas (~> 0.1.2) + rest-client (1.6.7) + mime-types (>= 1.16) rspec (2.14.1) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) @@ -266,32 +275,31 @@ GEM rspec-mocks (~> 2.14.0) rspec-rerun (0.1.3) rspec (>= 2.11.0) - ruby-prof (0.13.0) + ruby-prof (0.13.1) ruby-rc4 (0.1.5) - rubyzip (1.0.0) + rubyzip (1.1.0) sass (3.2.12) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - select2-rails (3.5.1) + select2-rails (3.5.2) thor (~> 0.14) - selenium-webdriver (2.37.0) + selenium-webdriver (2.39.0) childprocess (>= 0.2.5) multi_json (~> 1.0) - rubyzip (~> 1.0.0) + rubyzip (~> 1.0) websocket (~> 1.0.4) simple-navigation (3.11.0) activesupport (>= 2.3.2) simple-navigation-bootstrap (1.0.0) railties (>= 3.1) simple-navigation (>= 3.7.0) - simple_form (2.1.0) + simple_form (2.1.1) actionpack (~> 3.0) activemodel (~> 3.0) - simplecov (0.8.1) + simplecov (0.8.2) docile (~> 1.1.0) - lockfile (>= 2.1.0) multi_json simplecov-html (~> 0.8.0) simplecov-html (0.8.0) @@ -308,6 +316,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.8) + term-ansicolor (1.2.2) + tins (~> 0.8) therubyracer (0.12.0) libv8 (~> 3.16.14.0) ref @@ -317,6 +327,7 @@ GEM rack (>= 1.0.0) thor (0.18.1) tilt (1.4.1) + tins (0.13.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) @@ -327,14 +338,14 @@ GEM rails (>= 3.1) railties (>= 3.1) tzinfo (0.3.38) - uglifier (2.3.1) + uglifier (2.3.3) execjs (>= 0.3.0) json (>= 1.8.0) uniform_notifier (1.4.0) vegas (0.1.11) rack (>= 1.0.0) websocket (1.0.7) - whenever (0.8.4) + whenever (0.9.0) activesupport (>= 2.3.4) chronic (>= 0.6.3) wikicloth (0.8.0) @@ -359,6 +370,7 @@ DEPENDENCIES client_side_validations client_side_validations-simple_form coffee-rails (~> 3.2.1) + coveralls daemons database_cleaner exception_notification diff --git a/VERSION b/VERSION index 94ff29cc..944880fa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.1 +3.2.0 diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index 24f6604c..42bafd17 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -104,6 +104,10 @@ table { td.odd { background-color: @tableBackgroundAccent; } + + td.main_info { + font-weight: bold; + } tr.selected td { background-color: @successBackground; @@ -269,3 +273,44 @@ i.package { .input-nano { width: 30px; } + +// get rid of extra space on bottom of dialog with form +.modal form { + margin: 0; +} + +// multiple-column layout in forms (landscape tablet and wider only) +@media (min-width: 768px) { + .form-horizontal .fold-line { + .control-group { + float: left; + } + .control-group + .control-group { + .control-label { + width: auto; + margin: 0 10px; + } + .controls { + float: left; + margin-left: 0; + } + // fix margin somehow off + // XXX there must be a better way + margin-bottom: 0; + .help-block { + margin-top: 0; + margin-bottom: 20px; + } + } + .control-group:last-child { + float: none; + .controls { + float: none; + } + } + } +} +// allow to have indicator text instead of input with same markup +.control-text { + margin-top: 5px; +} diff --git a/app/controllers/deliveries_controller.rb b/app/controllers/deliveries_controller.rb index 86eedc14..3f18899f 100644 --- a/app/controllers/deliveries_controller.rb +++ b/app/controllers/deliveries_controller.rb @@ -50,57 +50,22 @@ class DeliveriesController < ApplicationController redirect_to supplier_deliveries_url(@supplier) end - # 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 - - def edit_stock_article - @stock_article = StockArticle.find(params[:stock_article_id]) - render :layout => false - end - - def update_stock_article - @stock_article = StockArticle.find(params[:stock_article][:id]) - - if @stock_article.update_attributes(params[:stock_article]) - render :layout => false - else - render :action => 'edit_stock_article', :layout => false - end - end - def add_stock_change @stock_change = StockChange.new @stock_change.stock_article = StockArticle.find(params[:stock_article_id]) render :layout => false end + + def form_on_stock_article_create # See publish/subscribe design pattern in /doc. + @stock_article = StockArticle.find(params[:id]) + + render :layout => false + end + + def form_on_stock_article_update # See publish/subscribe design pattern in /doc. + @stock_article = StockArticle.find(params[:id]) + + render :layout => false + end end diff --git a/app/controllers/stockit_controller.rb b/app/controllers/stockit_controller.rb index 475ac3a3..85c027ea 100644 --- a/app/controllers/stockit_controller.rb +++ b/app/controllers/stockit_controller.rb @@ -4,30 +4,62 @@ class StockitController < ApplicationController @stock_articles = StockArticle.undeleted.includes(:supplier, :article_category). order('suppliers.name, article_categories.name, articles.name') end + + def index_on_stock_article_create # See publish/subscribe design pattern in /doc. + @stock_article = StockArticle.find(params[:id]) + + render :layout => false + end + def index_on_stock_article_update # See publish/subscribe design pattern in /doc. + @stock_article = StockArticle.find(params[:id]) + + render :layout => false + end + + # three possibilites to fill a new_stock_article form + # (1) start from blank or use params def new - @stock_article = StockArticle.new + @stock_article = StockArticle.new(params[:stock_article]) + + render :layout => false + end + + # (2) StockArticle as template + def copy + @stock_article = StockArticle.find(params[:stock_article_id]).dup + + render :layout => false + end + + # (3) non-stock Article as template + def derive + @stock_article = Article.find(params[:old_article_id]).becomes(StockArticle).dup + + render :layout => false end def create @stock_article = StockArticle.new(params[:stock_article]) - if @stock_article.save - redirect_to stock_articles_path, :notice => I18n.t('stockit.stock_create.notice') + if @stock_article.valid? and @stock_article.save + render :layout => false else - render :action => 'new' + render :action => 'new', :layout => false end end def edit @stock_article = StockArticle.find(params[:id]) + + render :layout => false end def update @stock_article = StockArticle.find(params[:id]) if @stock_article.update_attributes(params[:stock_article]) - redirect_to stock_articles_path, :notice => I18n.t('stockit.stock_update.notice') + render :layout => false else - render :action => 'edit' + render :action => 'edit', :layout => false end end @@ -36,9 +68,15 @@ class StockitController < ApplicationController @stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC') end + def show_on_stock_article_update # See publish/subscribe design pattern in /doc. + @stock_article = StockArticle.find(params[:id]) + + render :layout => false + end + def destroy - @article = StockArticle.find(params[:id]) - @article.mark_as_deleted + @stock_article = StockArticle.find(params[:id]) + @stock_article.mark_as_deleted render :layout => false rescue => error render :partial => "destroy_fail", :layout => false, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 59994432..ef516a67 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -84,8 +84,8 @@ module ApplicationHelper i18nopts = options.select {|a| !['short'].include?(a) } s = model.human_attribute_name(attribute, i18nopts) if options[:short] - sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({defaults: ''})) - s = raw "#{sshort}" unless sshort.empty? + sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({fallback: true, default: ''})) + s = raw "#{sshort}" unless sshort.blank? end s end diff --git a/app/helpers/deliveries_helper.rb b/app/helpers/deliveries_helper.rb index b23107cc..2ef5d14b 100644 --- a/app/helpers/deliveries_helper.rb +++ b/app/helpers/deliveries_helper.rb @@ -25,13 +25,4 @@ module DeliveriesHelper 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 diff --git a/app/helpers/group_orders_helper.rb b/app/helpers/group_orders_helper.rb index b7707744..bf490903 100644 --- a/app/helpers/group_orders_helper.rb +++ b/app/helpers/group_orders_helper.rb @@ -7,13 +7,20 @@ module GroupOrdersHelper }.join("\n") end - def link_to_ordering(order, options = {}) - path = if group_order = order.group_order(current_user.ordergroup) - edit_group_order_path(group_order, :order_id => order.id) - else - new_group_order_path(:order_id => order.id) - end - link_to order.name, path, options + # Returns a link to the page where a group_order can be edited. + # If the option :show is true, the link is for showing the group_order. + def link_to_ordering(order, options = {}, &block) + group_order = order.group_order(current_user.ordergroup) + path = if options[:show] and group_order + group_order_path(group_order) + elsif group_order + edit_group_order_path(group_order, :order_id => order.id) + else + new_group_order_path(:order_id => order.id) + end + options.delete(:show) + name = block_given? ? capture(&block) : order.name + path ? link_to(name, path, options) : name end # Return css class names for order result table @@ -36,4 +43,4 @@ module GroupOrdersHelper {group_order_article: goa, quantity: quantity, tolerance: tolerance, result: result, sub_total: sub_total} end -end \ No newline at end of file +end diff --git a/app/helpers/stockit_helper.rb b/app/helpers/stockit_helper.rb index f6a0a1fc..2bc5da01 100644 --- a/app/helpers/stockit_helper.rb +++ b/app/helpers/stockit_helper.rb @@ -7,11 +7,20 @@ module StockitHelper def link_to_stock_change_reason(stock_change) if stock_change.delivery_id - link_to t('.delivery'), supplier_delivery_path(stock_change.delivery.supplier, stock_change.delivery) + link_to Delivery.model_name.human, supplier_delivery_path(stock_change.delivery.supplier, stock_change.delivery) elsif stock_change.order_id - link_to t('.order'), order_path(stock_change.order) + link_to Order.model_name.human, order_path(stock_change.order) elsif stock_change.stock_taking_id - link_to t('.stock_taking'), stock_taking_path(stock_change.stock_taking) + link_to StockTaking.model_name.human, stock_taking_path(stock_change.stock_taking) end 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'), + stock_article_copy_path(stock_article), + :remote => true + ) + ) + end end diff --git a/app/helpers/tasks_helper.rb b/app/helpers/tasks_helper.rb index f2a9bea5..e9db9e22 100644 --- a/app/helpers/tasks_helper.rb +++ b/app/helpers/tasks_helper.rb @@ -13,4 +13,8 @@ module TasksHelper title: I18n.t('helpers.tasks.required_users', :count => task.still_required_users) end end + + def task_title(task) + I18n.t('helpers.tasks.task_title', name: task.name, duration: task.duration) + end end diff --git a/app/models/ordergroup.rb b/app/models/ordergroup.rb index bf82afc4..745b6e3e 100644 --- a/app/models/ordergroup.rb +++ b/app/models/ordergroup.rb @@ -26,6 +26,11 @@ class Ordergroup < Group User.natural_order.all.reject { |u| (users.include?(u) || u.ordergroup) } end + # the most recent order this ordergroup was participating in + def last_order + orders.order('orders.starts DESC').first + end + def value_of_open_orders(exclude = nil) group_orders.in_open_orders.reject{|go| go == exclude}.collect(&:price).sum end diff --git a/app/models/stock_article.rb b/app/models/stock_article.rb index 5d45802e..0948b257 100644 --- a/app/models/stock_article.rb +++ b/app/models/stock_article.rb @@ -14,10 +14,14 @@ class StockArticle < Article # Check for unclosed orders and substract its ordered quantity def quantity_available - quantity - OrderArticle.where(article_id: id). + quantity - quantity_ordered + end + + def quantity_ordered + OrderArticle.where(article_id: id). joins(:order).where("orders.state = 'open' OR orders.state = 'finished'").sum(:units_to_order) end - + def quantity_history stock_changes.reorder('stock_changes.created_at ASC').map{|s| s.quantity}.cumulative_sum end diff --git a/app/models/user.rb b/app/models/user.rb index 3119e29d..19ea452c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -28,6 +28,7 @@ class User < ActiveRecord::Base validates_presence_of :password, :on => :create validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i validates_uniqueness_of :email, :case_sensitive => false + validates_presence_of :first_name # for simple_form validations validates_length_of :first_name, :in => 2..50 validates_confirmation_of :password validates_length_of :password, :in => 5..25, :allow_blank => true diff --git a/app/views/admin/ordergroups/_ordergroups.html.haml b/app/views/admin/ordergroups/_ordergroups.html.haml index 54618b6f..6670c05f 100644 --- a/app/views/admin/ordergroups/_ordergroups.html.haml +++ b/app/views/admin/ordergroups/_ordergroups.html.haml @@ -4,11 +4,11 @@ %table.table.table-striped %thead %tr - %th= t '.name' - %th= t '.contact' - %th= t '.address' - %th= t '.members' - %th= t 'admin.actions' + %th= heading_helper Ordergroup, :name + %th= heading_helper Ordergroup, :contact + %th= heading_helper Ordergroup, :contact_address + %th= heading_helper Ordergroup, :user_tokens + %th= t 'ui.actions' %tbody - for ordergroup in @ordergroups %tr{:class => cycle('even','odd', :name => 'groups')} diff --git a/app/views/admin/users/_users.html.haml b/app/views/admin/users/_users.html.haml index 5fd16bf5..95d39464 100644 --- a/app/views/admin/users/_users.html.haml +++ b/app/views/admin/users/_users.html.haml @@ -5,12 +5,12 @@ %thead %tr - if FoodsoftConfig[:use_nick] - %th= t '.login' - %th= t '.name' - %th= t '.email' + %th= heading_helper User, :nick + %th= heading_helper User, :name + %th= heading_helper User, :email %th= t 'admin.access_to' - %th= t '.last_login' - %th(colspan="2")= t 'admin.actions' + %th= heading_helper User, :last_login + %th(colspan="2")= t 'ui.actions' %tbody - for user in @users %tr diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index 2321ccdb..21d03e0a 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -7,13 +7,13 @@ %p= t '.member_since', time: distance_of_time_in_words(Time.now, @user.created_on) %dl - if FoodsoftConfig[:use_nick] - %dt= t '.nick' + %dt= heading_helper User, :nick %dd= @user.nick - %dt= t '.name' + %dt= heading_helper User, :name %dd= h @user.name - %dt= t '.email' + %dt= heading_helper User, :email %dd= @user.email - %dt= t '.phone' + %dt= heading_helper User, :phone %dd= @user.phone %dt= t 'admin.access_to' %dd= format_roles(@user) diff --git a/app/views/admin/workgroups/_workgroups.html.haml b/app/views/admin/workgroups/_workgroups.html.haml index c7250e83..fd61b463 100644 --- a/app/views/admin/workgroups/_workgroups.html.haml +++ b/app/views/admin/workgroups/_workgroups.html.haml @@ -7,7 +7,7 @@ %th= t '.name' %th= t '.members' %th= t 'admin.access_to' - %th= t 'admin.actions' + %th= t 'ui.actions' %tbody - for workgroup in @workgroups %tr diff --git a/app/views/articles/_form.html.haml b/app/views/articles/_form.html.haml index ece82629..b63db423 100644 --- a/app/views/articles/_form.html.haml +++ b/app/views/articles/_form.html.haml @@ -3,24 +3,55 @@ = f.hidden_field :supplier_id .modal-header = link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} - %h3= t '.title' + %h3= @article.new_record? ? t('.title_new') : t('.title_edit') .modal-body = f.input :availability = f.input :name - = f.input :origin - = f.input :manufacturer - = f.input :unit + .fold-line + = f.input :unit_quantity, label: Article.human_attribute_name(:unit), + input_html: {class: 'input-mini', title: Article.human_attribute_name(:unit_quantity)} + = f.input :unit, label: '×'.html_safe, + input_html: {class: 'input-mini', title: Article.human_attribute_name(:unit)} + = f.input :note = f.association :article_category + / TODO labels - = f.input :price - = f.input :unit_quantity + .fold-line + = f.input :price do + .input-prepend + %span.add-on= t 'number.currency.format.unit' + = f.input_field :price, class: 'input-mini' + = f.input :tax do + .input-append + = f.input_field :tax, class: 'input-mini' + %span.add-on % + .fold-line + = f.input :deposit do + .input-prepend + %span.add-on= t 'number.currency.format.unit' + = f.input_field :deposit, class: 'input-mini' + .control-group + %label.control-label{for: 'article_fc_price'} + = Article.human_attribute_name(:fc_price) + .controls.control-text#article_fc_price + = number_to_currency(@article.fc_price) rescue nil + + = f.input :origin + = f.input :manufacturer = f.input :order_number - = f.input :tax, :wrapper => :append do - = f.input_field :tax - %span.add-on % - = f.input :deposit .modal-footer = link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'} = f.submit class: 'btn btn-primary' +:javascript + var form = $('form.edit_article, form.new_article'); + $('#article_price, #article_tax, #article_deposit', form).on('change keyup', function() { + var price = parseFloat($('#article_price', form).val()); + var tax = parseFloat($('#article_tax', form).val()); + var deposit = parseFloat($('#article_deposit', form).val()); + // Article#gross_price and Article#fc_price + var gross_price = (price + deposit) * (tax / 100 + 1); + var fc_price = gross_price * (#{FoodsoftConfig[:price_markup].to_f} / 100 + 1); + $('#article_fc_price').html($.isNumeric(fc_price) ? I18n.l("currency", fc_price) : ' '); + }); diff --git a/app/views/deliveries/_form.html.haml b/app/views/deliveries/_form.html.haml index 3e1a3b6c..40337dde 100644 --- a/app/views/deliveries/_form.html.haml +++ b/app/views/deliveries/_form.html.haml @@ -42,9 +42,9 @@ } if('new' == selectedArticle.id) { $.ajax({ - url: '#{new_stock_article_supplier_deliveries_path(@supplier)}', + url: '#{new_stock_article_path}', type: 'get', - data: {stock_article: {name: selectedArticle.text}}, + data: {stock_article: {name: selectedArticle.text, supplier_id: #{@supplier.id}}}, contentType: 'application/json; charset=UTF-8' }); $('#new_stock_article').select2('data', null); @@ -52,7 +52,7 @@ } if('' != selectedArticle.id) { $.ajax({ - url: '#{derive_stock_article_supplier_deliveries_path(@supplier)}', + url: '#{derive_stock_articles_path}', type: 'get', data: {old_article_id: selectedArticle.id}, contentType: 'application/json; charset=UTF-8' @@ -61,6 +61,26 @@ return true; } }); + + // Subscribe to database changes. + // See publish/subscribe design pattern in /doc. + $(document).on('StockArticle#create', function(e) { + $.ajax({ + url: '#{form_on_stock_article_create_supplier_deliveries_path(@supplier)}', + type: 'get', + data: {id: e.stock_article_id}, + contentType: 'application/json; charset=UTF-8' + }); + }); + + $(document).on('StockArticle#update', function(e) { + $.ajax({ + url: '#{form_on_stock_article_update_supplier_deliveries_path(@supplier)}', + type: 'get', + data: {id: e.stock_article_id}, + contentType: 'application/json; charset=UTF-8' + }); + }); }); function mark_article_for_delivery(stock_article_id) { @@ -87,16 +107,16 @@ %table#stock_articles_for_adding.table.table-hover.stupidtable %thead %tr - %th.default-sort{:data => {:sort => 'string'}}= t '.article' - %th= t '.price' - %th= t '.unit' - %th= t '.category' - %th= t '.actions' + %th.default-sort{:data => {:sort => 'string'}}= Article.model_name.human + %th= heading_helper StockArticle, :price + %th= heading_helper StockArticle, :unit + %th= heading_helper StockArticle, :article_category + %th= t 'ui.actions' %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' + = link_to t('.create_stock_article'), new_stock_article_path, :remote => true, :class => 'btn' - else %input#new_stock_article{:style => 'width: 500px;'} %tbody @@ -107,11 +127,11 @@ %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' + %th.default-sort{:data => {:sort => 'string'}}= Article.model_name.human + %th= heading_helper StockArticle, :price + %th= heading_helper StockArticle, :unit + %th= heading_helper GroupOrderArticle, :quantity # quantity to order, although technically this will be a StockChange + %th= t 'ui.actions' %tbody = f.simple_fields_for :stock_changes do |stock_change_form| = render :partial => 'stock_change_fields', :locals => {:f => stock_change_form} diff --git a/app/views/deliveries/_stock_article_for_adding.html.haml b/app/views/deliveries/_stock_article_for_adding.html.haml index b43df782..8575c121 100644 --- a/app/views/deliveries/_stock_article_for_adding.html.haml +++ b/app/views/deliveries/_stock_article_for_adding.html.haml @@ -1,11 +1,13 @@ -- css_class = ( @delivery and @delivery.includes_article? article ) ? ( 'unavailable' ) : ( false ) +- disable_delivery_action = ( @delivery and @delivery.includes_article? article ) +- css_class = ( disable_delivery_action ) ? ( 'unavailable' ) : ( false ) +- deliver_button_disabled = ( disable_delivery_action ) ? ( 'disabled' ) : ( 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_edit'), edit_stock_article_path(article), remote: true, class: 'btn btn-mini' + = link_to t('.action_other_price'), stock_article_copy_path(article), remote: true, class: 'btn btn-mini' = 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 diff --git a/app/views/deliveries/_stock_article_form.html.haml b/app/views/deliveries/_stock_article_form.html.haml deleted file mode 100644 index 21c5b216..00000000 --- a/app/views/deliveries/_stock_article_form.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- url = ( stock_article.new_record? ) ? ( create_stock_article_supplier_deliveries_path(@supplier) ) : ( update_stock_article_supplier_deliveries_path(@supplier) ) -= simple_form_for stock_article, url: url, remote: true, validate: true do |f| - = f.association :supplier, :as => :hidden - = f.hidden_field :id unless stock_article.new_record? - .modal-header - = link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} - %h3= t 'activerecord.models.stock_article' - .modal-body - = f.input :name - = f.input :unit - = f.input :note - - if stock_article.new_record? - = f.input :price - = 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') diff --git a/app/views/deliveries/copy_stock_article.js.erb b/app/views/deliveries/copy_stock_article.js.erb deleted file mode 100644 index de5d260e..00000000 --- a/app/views/deliveries/copy_stock_article.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -$('#modalContainer').html( - '<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>' -); - -$('#modalContainer').modal(); diff --git a/app/views/deliveries/create_stock_article.js.erb b/app/views/deliveries/create_stock_article.js.erb deleted file mode 100644 index cb9d0159..00000000 --- a/app/views/deliveries/create_stock_article.js.erb +++ /dev/null @@ -1,16 +0,0 @@ -$('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'); - - $('#stock_articles_for_adding tbody').append(stock_article_for_adding); - updateSort('#stock_articles_for_adding'); -})(); - -$('#modalContainer').modal('hide'); diff --git a/app/views/deliveries/derive_stock_article.js.erb b/app/views/deliveries/derive_stock_article.js.erb deleted file mode 100644 index de5d260e..00000000 --- a/app/views/deliveries/derive_stock_article.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -$('#modalContainer').html( - '<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>' -); - -$('#modalContainer').modal(); diff --git a/app/views/deliveries/edit_stock_article.js.erb b/app/views/deliveries/edit_stock_article.js.erb deleted file mode 100644 index de5d260e..00000000 --- a/app/views/deliveries/edit_stock_article.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -$('#modalContainer').html( - '<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>' -); - -$('#modalContainer').modal(); diff --git a/app/views/deliveries/form_on_stock_article_create.js.erb b/app/views/deliveries/form_on_stock_article_create.js.erb new file mode 100644 index 00000000..fd1b2d0f --- /dev/null +++ b/app/views/deliveries/form_on_stock_article_create.js.erb @@ -0,0 +1,31 @@ +// Handle more advanced DOM update after AJAX database manipulation. +// See publish/subscribe design pattern in /doc. +(function(w) { + + $('#stock_articles_for_adding tr').removeClass('success'); + + if(<%= @supplier.id != @stock_article.supplier.id %>) { + // the stock_article does _NOT_ belong to the current supplier + var try_again = w.confirm('<%= j( + t('deliveries.form.confirm_foreign_supplier_reedit', :name => @stock_article.name) + ) %>'); + + if(try_again) { + $.ajax({ + url: '<%= j edit_stock_article_path(@stock_article) %>', + type: 'get', + contentType: 'application/json; charset=UTF-8' + }); + } + + return false; + } + + // the stock_article _DOES_ belong to the current supplier + var stock_article_for_adding = $( + '<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article})) %>' + ).addClass('success'); + + $('#stock_articles_for_adding tbody').append(stock_article_for_adding); + updateSort('#stock_articles_for_adding'); +})(window); diff --git a/app/views/deliveries/form_on_stock_article_update.js.erb b/app/views/deliveries/form_on_stock_article_update.js.erb new file mode 100644 index 00000000..3d78eb0d --- /dev/null +++ b/app/views/deliveries/form_on_stock_article_update.js.erb @@ -0,0 +1,47 @@ +// Handle more advanced DOM update after AJAX database manipulation. +// See publish/subscribe design pattern in /doc. +(function(w) { + // update entry in stock_article table + + $('#stock_articles_for_adding tr').removeClass('success'); + + $('#stock_article_<%= @stock_article.id %>').remove(); + + if(<%= @supplier.id != @stock_article.supplier.id %>) { + // the stock_article does _NOT_ belong to the current supplier + var try_again = w.confirm('<%= j( + t('deliveries.form.confirm_foreign_supplier_reedit', :name => @stock_article.name) + ) %>'); + + if(try_again) { + $.ajax({ + url: '<%= j edit_stock_article_path(@stock_article) %>', + type: 'get', + contentType: 'application/json; charset=UTF-8' + }); + } + } + else { + // the stock_article _DOES_ belong to the current supplier + var stock_article_for_adding = $( + '<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article})) %>' + ).addClass('success'); + + $('#stock_articles_for_adding tbody').append(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'); +})(window); diff --git a/app/views/deliveries/new_stock_article.js.erb b/app/views/deliveries/new_stock_article.js.erb deleted file mode 100644 index de5d260e..00000000 --- a/app/views/deliveries/new_stock_article.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -$('#modalContainer').html( - '<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>' -); - -$('#modalContainer').modal(); diff --git a/app/views/deliveries/show.html.haml b/app/views/deliveries/show.html.haml index d5df7fd5..43f157bc 100644 --- a/app/views/deliveries/show.html.haml +++ b/app/views/deliveries/show.html.haml @@ -17,10 +17,10 @@ %table.table.table-striped(style="width:500px") %thead %tr - %th= t '.article' - %th= t '.unit' - %th.numeric= t '.amount' - %th.numeric= t '.price' + %th= Article.model_name.human + %th= heading_helper StockArticle, :unit + %th.numeric= heading_helper GroupOrderArticle, :quantity # quantity to order, although technically this will be a StockChange + %th.numeric= heading_helper Article, :price %th.numeric= t '.sum' %tbody - total_net, total_gross = 0,0 diff --git a/app/views/deliveries/update_stock_article.js.erb b/app/views/deliveries/update_stock_article.js.erb deleted file mode 100644 index 7b2d56d6..00000000 --- a/app/views/deliveries/update_stock_article.js.erb +++ /dev/null @@ -1,32 +0,0 @@ -$('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'); - - $('#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'); diff --git a/app/views/finance/balancing/_edit_results_by_articles.html.haml b/app/views/finance/balancing/_edit_results_by_articles.html.haml index 0ab5e81e..ab77723e 100644 --- a/app/views/finance/balancing/_edit_results_by_articles.html.haml +++ b/app/views/finance/balancing/_edit_results_by_articles.html.haml @@ -1,14 +1,14 @@ %table.ordered-articles.table.table-striped %thead %tr - %th= sort_link_helper t('.article'), "name" - %th= sort_link_helper t('.number'), "order_number" + %th= sort_link_helper Article.model_name.human, "name" + %th= sort_link_helper Article.human_attribute_name(:order_number_short), "order_number" %th= t('.amount') - %th= t('.amount_per_unit') + %th= heading_helper Article, :units %th= t('.net') %th= t('.gross') - %th= t('.tax') - %th= t('.refund') + %th= heading_helper Article, :tax + %th= heading_helper Article, :deposit %th{:colspan => "2"} = link_to t('.add_article'), new_finance_order_order_article_path(@order), remote: true, class: 'btn btn-small' diff --git a/app/views/finance/balancing/_group_order_articles.html.haml b/app/views/finance/balancing/_group_order_articles.html.haml index 6689cd95..2658878b 100644 --- a/app/views/finance/balancing/_group_order_articles.html.haml +++ b/app/views/finance/balancing/_group_order_articles.html.haml @@ -3,7 +3,7 @@ %thead %tr %td - %td{:style => "width:8em"}= t('.group') + %td{:style => "width:8em"}= Ordergroup.model_name.human %td= t('.units') %td= t('.total') %td{:colspan => "3",:style => "width:14em"} diff --git a/app/views/finance/balancing/_order_article.html.haml b/app/views/finance/balancing/_order_article.html.haml index 8bc4e268..6512d0c4 100644 --- a/app/views/finance/balancing/_order_article.html.haml +++ b/app/views/finance/balancing/_order_article.html.haml @@ -5,7 +5,7 @@ = order_article.units_to_order - unless order_article.ordered_quantities_equal_to_group_orders? %span{:style => "color:red;font-weight: bold"} ! -%td= order_article.price.unit_quantity.to_s + ' * ' + order_article.article.unit.to_s +%td #{order_article.price.unit_quantity} × #{order_article.article.unit} %td = number_to_currency(order_article.price.price, :unit => "") :plain @@ -16,7 +16,7 @@ :plain / = number_to_currency(order_article.total_gross_price, :unit => "") -%td= order_article.price.tax +%td #{order_article.price.tax}% %td= order_article.price.deposit %td = link_to t('ui.edit'), edit_finance_order_order_article_path(order_article.order, order_article), remote: true, diff --git a/app/views/finance/financial_transactions/_transactions.html.haml b/app/views/finance/financial_transactions/_transactions.html.haml index 64b1c938..1dfbc2cb 100644 --- a/app/views/finance/financial_transactions/_transactions.html.haml +++ b/app/views/finance/financial_transactions/_transactions.html.haml @@ -4,10 +4,10 @@ %table.table.table-striped %thead %tr - %td= sort_link_helper t('.date'), "date" - %td= t('.who') - %td= sort_link_helper t('.note'), "note" - %td= sort_link_helper t('.amount'), "amount" + %th= sort_link_helper heading_helper(FinancialTransaction, :created_on), "date" + %th= heading_helper FinancialTransaction, :user + %th= sort_link_helper heading_helper(FinancialTransaction, :note), "note" + %th= sort_link_helper heading_helper(FinancialTransaction, :amount), "amount" %tbody - @financial_transactions.each do |t| %tr diff --git a/app/views/finance/financial_transactions/new_collection.html.haml b/app/views/finance/financial_transactions/new_collection.html.haml index aaa67129..7fdc99b0 100644 --- a/app/views/finance/financial_transactions/new_collection.html.haml +++ b/app/views/finance/financial_transactions/new_collection.html.haml @@ -21,13 +21,13 @@ = form_tag finance_create_transaction_collection_path do %p - %b= t('.note') + %b= heading_helper FinancialTransaction, :note = text_field_tag :note, params[:note], class: 'input-xlarge', required: 'required' %p %table#ordergroups{:style => "width:20em"} %tr - %th= t('.ordergroup') - %th= t('.amount') + %th= heading_helper FinancialTransaction, :ordergroup + %th= heading_helper FinancialTransaction, :amount = render :partial => 'ordergroup', :collection => [1, 2, 3] %p = link_to t('.new_ordergroup'), '#', 'data-add-transaction' => true, class: 'btn' diff --git a/app/views/finance/group_order_articles/_form.html.haml b/app/views/finance/group_order_articles/_form.html.haml index 8b6d41a0..082a3fba 100644 --- a/app/views/finance/group_order_articles/_form.html.haml +++ b/app/views/finance/group_order_articles/_form.html.haml @@ -5,7 +5,7 @@ %h3= t('.amount_change_for', article: @order_article.article.name) .modal-body = form.input :ordergroup_id, as: :select, collection: Ordergroup.all.map { |g| [g.name, g.id] } - = form.input :result, hint: I18n.t('.result_hint', unit: @order_article.article.unit) + = form.input :result, hint: I18n.t('finance.group_order_articles.form.result_hint', unit: @order_article.article.unit) # Why do we need the full prefix? .modal-footer = link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'} = form.submit t('ui.save'), class: 'btn btn-primary' diff --git a/app/views/finance/index.html.haml b/app/views/finance/index.html.haml index 731528bd..e2d64811 100644 --- a/app/views/finance/index.html.haml +++ b/app/views/finance/index.html.haml @@ -8,9 +8,9 @@ %table.table.table-striped %thead %tr - %th= t('.date') - %th.numeric= t('.amount') - %th= t('.supplier') + %th= heading_helper Invoice, :date + %th.numeric= heading_helper Invoice, :amount + %th= heading_helper Invoice, :supplier %th %tbody - for invoice in @unpaid_invoices @@ -26,10 +26,10 @@ %table.table.table-striped %thead %tr - %th= t('.date') - %th= t('.group') - %th= t('.note') - %th.numeric= t('.amount') + %th= heading_helper FinancialTransaction, :created_on + %th= heading_helper FinancialTransaction, :ordergroup + %th= heading_helper FinancialTransaction, :note + %th.numeric= heading_helper FinancialTransaction, :amount %tbody - @financial_transactions.each do |ft| %tr @@ -45,8 +45,8 @@ %table.table.table-striped %thead %tr - %th= t('.supplier') - %th= t('.end') + %th= heading_helper Order, :name + %th= t '.end' %th.numeric= t('.amount_fc') %th %tbody @@ -55,6 +55,6 @@ %td= order.name %td= format_date(order.ends) %td.numeric= number_to_currency(order.sum(:fc)) - %td= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini' + %td= link_to t('finance.balancing.orders.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini' - else = t('.everything_cleared') diff --git a/app/views/finance/invoices/_invoices.html.haml b/app/views/finance/invoices/_invoices.html.haml index 621a08fe..0d3920ef 100644 --- a/app/views/finance/invoices/_invoices.html.haml +++ b/app/views/finance/invoices/_invoices.html.haml @@ -23,7 +23,7 @@ %td= format_date invoice.date %td= format_date invoice.paid_on %td= number_to_currency invoice.amount - %td= link_to t('.delivery'), [invoice.supplier,invoice.delivery] if invoice.delivery + %td= link_to Delivery.model_name.human, [invoice.supplier,invoice.delivery] if invoice.delivery %td= link_to format_date(invoice.order.ends), new_finance_order_path(order_id: invoice.order_id) if invoice.order %td= truncate(invoice.note) %td= link_to t('ui.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini' diff --git a/app/views/finance/order_articles/_new.html.haml b/app/views/finance/order_articles/_new.html.haml index 3cf6136e..41619e6e 100644 --- a/app/views/finance/order_articles/_new.html.haml +++ b/app/views/finance/order_articles/_new.html.haml @@ -3,7 +3,7 @@ = link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} %h3= t '.title' .modal-body - = form.input :article_id, as: :select, collection: new_order_articles_collection + = form.input :article_id, as: :select, collection: new_order_articles_collection, :label => Article.model_name.human # Why do we need the label? .modal-footer = link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'} = form.submit class: 'btn btn-primary' diff --git a/app/views/finance/ordergroups/_ordergroups.html.haml b/app/views/finance/ordergroups/_ordergroups.html.haml index 4e67df73..058fecee 100644 --- a/app/views/finance/ordergroups/_ordergroups.html.haml +++ b/app/views/finance/ordergroups/_ordergroups.html.haml @@ -4,9 +4,9 @@ %table.table.table-striped %thead %tr - %th= sort_link_helper t('.name'), "name", :per_page => @per_page - %th= t '.contact' - %th.numeric= sort_link_helper t('.account_balance'), "account_balance", :per_page => @per_page + %th= sort_link_helper heading_helper(Ordergroup, :name), "name", :per_page => @per_page + %th= heading_helper Ordergroup, :contact + %th.numeric= sort_link_helper heading_helper(Ordergroup, :account_balance), "account_balance", :per_page => @per_page %th %tbody - for ordergroup in @ordergroups diff --git a/app/views/foodcoop/ordergroups/_ordergroups.html.haml b/app/views/foodcoop/ordergroups/_ordergroups.html.haml index 20fbd0c9..a2beb812 100644 --- a/app/views/foodcoop/ordergroups/_ordergroups.html.haml +++ b/app/views/foodcoop/ordergroups/_ordergroups.html.haml @@ -5,15 +5,15 @@ %table.table.table-striped %thead %tr - %th= t '.name' - %th= t '.user' - %th= t '.last_ordered' + %th= heading_helper Ordergroup, :name + %th= heading_helper Ordergroup, :user_tokens + %th= heading_helper Ordergroup, :last_order %tbody - for ordergroup in @ordergroups %tr %td= ordergroup.name %td=h ordergroup.users.collect { |u| show_user(u) }.join(", ") - %td= format_date ordergroup.orders.order('orders.starts DESC').first.try(:starts) + %td= format_date ordergroup.last_order.try(:starts) %td= link_to_new_message(message_params: {group_id: ordergroup.id}) diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index a0b11791..f1350757 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -27,22 +27,23 @@ %h2= @order.name %dl.dl-horizontal - unless @order.note.blank? - %dt= t '.note' + %dt= heading_helper Order, :note %dd= @order.note - %dt= t '.created_by' + %dt= heading_helper Order, :created_by %dd= show_user_link(@order.created_by) - %dt= t '.ending' + %dt= heading_helper Order, :ends %dd= format_time(@order.ends) - unless @order.stockit? or @order.supplier.min_order_quantity.blank? - %dt= t '.min_quantity' + %dt= heading_helper Supplier, :min_order_quantity, short: true %dd= @order.supplier.min_order_quantity %dt= t '.sum_amount' %dd= number_to_currency @order.sum - %dt= t '.last_update' - %dd - = show_user(@group_order.updated_by) if @group_order.updated_by - (#{format_time(@group_order.updated_on)}) - %dt= t '.funds' + - unless @group_order.new_record? + %dt= heading_helper GroupOrder, :updated_by + %dd + = show_user(@group_order.updated_by) + (#{format_time(@group_order.updated_on)}) + %dt= heading_helper Ordergroup, :available_funds %dd= number_to_currency(@ordering_data[:available_funds]) .well.pull-right @@ -65,20 +66,20 @@ %table.table.table-hover %thead %tr - %th= t '.name' + %th= heading_helper Article, :name - if @order.stockit? - %th{style: 'width:120px'}= t '.supplier' + %th{style: 'width:120px'}= heading_helper StockArticle, :supplier %th{style: "width:13px;"} %th{style: "width:4.5em;"}= t '.price' - %th{style: "width:4.5em;"}= t '.unit' + %th{style: "width:4.5em;"}= heading_helper Article, :unit - unless @order.stockit? - %th{style: "width:70px;"}= t '.unit_missing' - %th#col_required= t '.amount' - %th#col_tolerance= t '.tolerance' + %th{style: "width:70px;"}= heading_helper OrderArticle, :missing_units, short: true + %th#col_required= heading_helper GroupOrderArticle, :quantity + %th#col_tolerance= heading_helper GroupOrderArticle, :tolerance - else - %th(style="width:20px")= t '.available' - %th#col_required= t '.amount' - %th{style: "width:15px;"}= t '.sum' + %th(style="width:20px")= heading_helper StockArticle, :available + %th#col_required= heading_helper GroupOrderArticle, :quantity + %th{style: "width:15px;"}= heading_helper GroupOrderArticle, :total_price %tbody.list - @order.articles_grouped_by_category.each do |category, order_articles| %tr.list-heading.article-category @@ -132,11 +133,11 @@ %span{id: "t_total_#{order_article.id}"}= @ordering_data[:order_articles][order_article.id][:tolerance] + @ordering_data[:order_articles][order_article.id][:others_tolerance] %br/ .pull-left - #{t '.manufacturer'}: #{order_article.article.manufacturer} + #{heading_helper Article, :manufacturer}: #{order_article.article.manufacturer} %br/ - #{t '.units'}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit} + #{heading_helper Article, :units}: #{@order.stockit? ? order_article.article.quantity_available : @ordering_data[:order_articles][order_article.id][:unit]} * #{h order_article.article.unit} %br/ - #{t '.note'}: #{order_article.article.note} + #{heading_helper Article, :note}: #{order_article.article.note} %br/ #order-footer #info-box @@ -147,7 +148,7 @@ %td.currency %span#total_price= number_to_currency(@group_order.price) %tr - %td= t('.available_funds') + ':' + %td= heading_helper(Ordergroup, :available_funds) + ':' %td.currency= number_to_currency(@ordering_data[:available_funds]) %tr %td= t('.new_funds') + ':' diff --git a/app/views/group_orders/_orders.html.haml b/app/views/group_orders/_orders.html.haml index f3137588..96e22706 100644 --- a/app/views/group_orders/_orders.html.haml +++ b/app/views/group_orders/_orders.html.haml @@ -1,9 +1,9 @@ %table.table.table-striped %thead %tr - %th= t '.supplier' - %th= t '.ending' - %th= t '.sum' + %th= heading_helper Order, :name + %th= heading_helper Order, :ends + %th= heading_helper GroupOrder, :price %tbody - for order in orders - group_order = order.group_order(@ordergroup) # Get GroupOrder if possible diff --git a/app/views/group_orders/index.html.haml b/app/views/group_orders/index.html.haml index 20f31b2f..41842342 100644 --- a/app/views/group_orders/index.html.haml +++ b/app/views/group_orders/index.html.haml @@ -6,22 +6,22 @@ %h2= t '.funds.title' %table.table.table-striped %tr - %td= t('.funds.account_balance') + ':' + %td= heading_helper Ordergroup, :account_balance %td.numeric{:style => "width:5em"}= number_to_currency(@ordergroup.account_balance) %tr - %td= '- ' + t('.funds.open_orders') + ':' + %td= '- ' + t('.funds.open_orders') %td.numeric= number_to_currency(@ordergroup.value_of_open_orders) %tr - %td= '- ' + t('.funds.finished_orders') + ':' + %td= '- ' + t('.funds.finished_orders') %td.numeric= number_to_currency(@ordergroup.value_of_finished_orders) %tr - %th= t('.funds.available_funds') + ':' + %th= heading_helper Ordergroup, :available_funds %th.numeric= number_to_currency(@ordergroup.get_available_funds) = render :partial => "shared/open_orders", :locals => {:ordergroup => @ordergroup} // finished orders -- unless Order.finished.empty? +- unless Order.finished_not_closed.empty? %section %h2= t '.finished_orders.title' = render :partial => "orders", :locals => {:orders => Order.finished_not_closed, :pagination => false} diff --git a/app/views/group_orders/order.html.haml b/app/views/group_orders/order.html.haml deleted file mode 100644 index 0d2f8c5a..00000000 --- a/app/views/group_orders/order.html.haml +++ /dev/null @@ -1,88 +0,0 @@ -- content_for :head do - = render 'data' - -= render :partial => 'order_head' - -- form_tag(:action => 'saveOrder', :id => @order) do - .single_column{:style => "clear:both;margin-bottom:7em;"} - .box_title - %h2= t '.title' - .column_content - %table#order.list - %thead - %tr - %th= t 'group_orders.form.name' - %th{:style => "width:13px;"} - %th{:style => "width:4.5em;"}= t 'group_orders.form.price' - %th{:style => "width:4.5em;"}= t 'group_orders.form.unit' - %th{:style => "width:70px;"}= t 'group_orders.form.unit_missing' - %th#col_required= t 'group_orders.form.amount' - - if not @order.stockit? - %th#col_tolerance= t 'group_orders.form.tolerance' - %th{:style => "width:15px;"}= t 'group_orders.form.sum' - %tbody - - total = 0 - - i = 0 - - @articles_grouped_by_category.each do |category, order_articles| - %tr{:style => "background-color:#EFEFEF"} - %td{:style => "text-align:left"} - %b= h category - %td{:colspan => "9"} - - order_articles.each do |order_article| - - if FoodsoftConfig[:tolerance_is_costly] - - article_total = @price[i] * (@tolerance[i] + @quantity[i]) - - else - - article_total = @price[i] * @quantity[i] - - total += article_total - %tr{:class => "#{cycle('even', 'odd', :name => 'articles')} order-article", :valign => "top"} - %td.name= order_article.article.name - %td= h order_article.article.origin - %td= number_to_currency(@price[i]) - %td= order_article.article.unit - %td - %span{:id => "missing_units_#{i}"} - - if @order.stockit? - - order_article.article.quantity_available - - else - - missing_units = @unit[i] - (((@quantity[i] + @others_quantity[i]) % @unit[i]) + @tolerance[i] + @others_tolerance[i]) - - missing_units < 0 ? 0 : missing_units - %td.quantity - %input{:id => "q_#{i}", :name => "ordered[#{order_article.id}][quantity]", :size => "2", :type => "hidden", :value => @quantity[i]}/ - %span.used{:id => "q_used_#{i}"}= @used_quantity[i] - + - %span.unused{:id => "q_unused_#{i}"}= @quantity[i] - @used_quantity[i] - = button_to_function('+', "increaseQuantity(#{i})") - = button_to_function('-', "decreaseQuantity(#{i})") - - unless @order.stockit? - %td.tolerance - %input{:id => "t_#{i}", :name => "ordered[#{order_article.id}][tolerance]", :size => "2", :type => "hidden", :value => @tolerance[i]}/ - - if (@unit[i] > 1) - %span.used{:id => "t_used_#{i}"}= @used_tolerance[i] - + - %span.unused{:id => "t_unused_#{i}"}= @tolerance[i] - @used_tolerance[i] - = button_to_function('+', "increaseTolerance(#{i})") - = button_to_function('-', "decreaseTolerance(#{i})") - %td{:id => "td_price_#{i}", :style => "text-align:right; padding-right:10px; width:4em"} - %span{:id => "price_#{i}_display"}= number_to_currency(article_total, :unit => "") - € - .article-info - %h3= order_article.article.name - .right - = t('group_orders.form.units_full') + ':' - %span{:id => "units_#{i}"}= order_article.units_to_order - %br/ - = t('group_orders.form.total_units') + ':' - %span{:id => "q_total_#{i}"}= @quantity[i] + @others_quantity[i] - %br/ - = t('group_orders.form.total_tolerance') + ':' - %span{:id => "t_total_#{i}"}= @tolerance[i] + @others_tolerance[i] - %br/ - .left - #{t 'group_orders.form.manufacturer'}: #{order_article.article.manufacturer} - %br/ - #{t 'group_orders.form.units'}: #{@order.stockit? ? order_article.article.quantity_available : @unit[i]} * #{h order_article.article.unit} - %br/ - #{t 'group_orders.form.note'}: #{order_article.article.note} - %br/ - - i = i + 1 - = render "order_footer", :total => total diff --git a/app/views/group_orders/show.html.haml b/app/views/group_orders/show.html.haml index 27a88eff..8af79e6a 100644 --- a/app/views/group_orders/show.html.haml +++ b/app/views/group_orders/show.html.haml @@ -9,21 +9,22 @@ .well // Order summary %dl.dl-horizontal - %dt= t '.supplier' + %dt= heading_helper Order, :name %dd= @order.name - %dt= t '.note' + %dt= heading_helper Order, :note %dd= @order.note - %dt= t '.ending' + %dt= heading_helper Order, :ends %dd= format_time(@order.ends) - %dt= t '.order_sum' + %dt= heading_helper GroupOrder, :price %dd - if @group_order = number_to_currency(@group_order.price) - else = t '.not_ordered' - if @order.closed? - %p= t '.closed_by', user: show_user(@order.updated_by) - = link_to t('.comment'), "#comments" + %dt= heading_helper Order, :closed_by + %dd= show_user_link @order.updated_by + %p= link_to t('.comment'), "#comments" // Article box %section @@ -35,8 +36,8 @@ %table.table.table-hover %thead %tr - %th{style: "width:40%"}= t '.articles.name' - %th= t '.articles.units' + %th{style: "width:40%"}= heading_helper Article, :name + %th= heading_helper Article, :units %th= t '.articles.unit_price' %th %abbr{title: t('.articles.ordered_title')}= t '.articles.ordered' @@ -46,7 +47,7 @@ = t '.articles.order_open' - else = t '.articles.order_not_open' - %th= t '.articles.total_price' + %th= heading_helper GroupOrderArticle, :total_price %tbody - for category_name, order_articles in @order.articles_grouped_by_category %tr.article-category @@ -61,7 +62,7 @@ %td{style: "width:40%"} = oa.article.name - unless oa.article.note.blank? - = image_tag("lamp_grey.png", {alt: "Notiz anzeigen", size: "15x16", border: "0", onmouseover: "$('note_#{oa.id}').show();", onmouseout: "$('note_#{oa.id}').hide();"}) + = image_tag("lamp_grey.png", {alt: t('.articles.show_note'), size: "15x16", border: "0", onmouseover: "$('#note_#{oa.id}').show();", onmouseout: "$('#note_#{oa.id}').hide();"}) %td= "#{oa.price.unit_quantity} x #{oa.article.unit}" %td= number_to_currency(oa.price.fc_price) %td @@ -73,7 +74,7 @@ %tr{id: "note_#{oa.id}", class: "note even", style: "display:none"} %td{colspan: "6"}=h oa.article.note %tr{class: cycle('even', 'odd', name: 'articles')} - %th{colspan: "5"}= t '.articles.sum' + %th{colspan: "5"}= heading_helper GroupOrder, :price %th= number_to_currency(@group_order.price) %br/ = link_to_top diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 236d5c5c..41c03e76 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -50,10 +50,10 @@ %h3= t '.my_ordergroup.transactions.title' %table.table.table-striped %tr - %th= t '.my_ordergroup.transactions.when' - %th= t '.my_ordergroup.transactions.where' - %th= t '.my_ordergroup.transactions.note' - %th= t '.my_ordergroup.transactions.amount' + %th= heading_helper FinancialTransaction, :created_on + %th= heading_helper FinancialTransaction, :user + %th= heading_helper FinancialTransaction, :note + %th= heading_helper FinancialTransaction, :amount - for ft in current_user.ordergroup.financial_transactions.limit(5).order('created_on DESC') %tr %td= format_time(ft.created_on) diff --git a/app/views/home/ordergroup.html.haml b/app/views/home/ordergroup.html.haml index 213ef0c9..52eb6a18 100644 --- a/app/views/home/ordergroup.html.haml +++ b/app/views/home/ordergroup.html.haml @@ -7,10 +7,10 @@ - unless @ordergroup.description.blank? %p= @ordergroup.description %p - %b= Ordergroup.human_attribute_name(:available_funds) + ':' + %b= heading_helper(Ordergroup, :available_funds) + ':' = number_to_currency(@ordergroup.get_available_funds()) %p - %b= Ordergroup.human_attribute_name(:user_tokens) + ':' + %b= heading_helper(Ordergroup, :user_tokens) + ':' = @ordergroup.memberships.map{|m| show_user m.user}.join(', ') = link_to t('.invite'), new_invite_path(:id => @ordergroup), :remote => true, class: 'btn btn-primary' .span8 diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index b3a4e30c..ab2e7d8e 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -7,10 +7,6 @@ %title= [t('layouts.foodsoft'), yield(:title)].join(" - ") = csrf_meta_tags = stylesheet_link_tag "application", :media => "all" - %link(href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144") - %link(href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114") - %link(href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72") - %link(href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed") //%link(href="images/favicon.ico" rel="shortcut icon") = yield(:head) diff --git a/app/views/orders/_articles.html.haml b/app/views/orders/_articles.html.haml index 8508e6e8..b0c54837 100644 --- a/app/views/orders/_articles.html.haml +++ b/app/views/orders/_articles.html.haml @@ -1,8 +1,8 @@ %table.table.table-hover %thead %tr - %th= t '.name' - %th= t '.unit_quantity' + %th= heading_helper Article, :name + %th= heading_helper Article, :unit_quantity %th= t '.prices' %th= t '.units_ordered' - unless order.stockit? diff --git a/app/views/orders/_form.html.haml b/app/views/orders/_form.html.haml index 86d24106..48d776e1 100644 --- a/app/views/orders/_form.html.haml +++ b/app/views/orders/_form.html.haml @@ -11,14 +11,14 @@ %table.table.table-hover#articleList %tr %th= check_box_tag 'checkall', "1", false, { 'data-check-all' => '#articleList' } - %th= t '.name' - %th= t '.note' + %th= heading_helper Article, :name + %th= heading_helper Article, :note - if @order.stockit? %th= t '.stockit' - else - %th= t '.origin' - %th= t '.supplier' - %th= t '.unit_quantity' + %th= heading_helper Article, :origin + %th= heading_helper Article, :manufacturer + %th= heading_helper Article, :unit_quantity %th= t '.prices' - for category_name, articles in @order.articles_for_ordering %tr.article-category diff --git a/app/views/orders/_orders.html.haml b/app/views/orders/_orders.html.haml index baa5b815..36581491 100644 --- a/app/views/orders/_orders.html.haml +++ b/app/views/orders/_orders.html.haml @@ -2,10 +2,10 @@ %table.table.table-striped %thead %tr - %th= sort_link_helper t('.supplier'), "supplier" - %th= t '.start' - %th= sort_link_helper t('.ending'), "ends" - %th= t '.status' + %th= sort_link_helper heading_helper(Order, :supplier), "supplier" + %th= heading_helper Order, :starts + %th= sort_link_helper heading_helper(Order, :ends), "ends" + %th= heading_helper Order, :status %th{:colspan => "2"} %tbody - @orders.each do |order| diff --git a/app/views/orders/index.html.haml b/app/views/orders/index.html.haml index 7960b07f..34b428af 100644 --- a/app/views/orders/index.html.haml +++ b/app/views/orders/index.html.haml @@ -15,9 +15,9 @@ %table.table.table-striped %thead %tr - %th= t '.supplier' - %th= t '.ending' - %th= t '.note' + %th= heading_helper Order, :name + %th= heading_helper Order, :ends + %th= heading_helper Order, :note %th{colspan: "2"} %tbody - for order in @open_orders diff --git a/app/views/orders/show.html.haml b/app/views/orders/show.html.haml index 865a83c8..62e24ae1 100644 --- a/app/views/orders/show.html.haml +++ b/app/views/orders/show.html.haml @@ -2,21 +2,21 @@ - if @order.finished? and !@order.closed? .alert.alert-warning - = t '.warn_not_closed' + = t '.warn_not_closed' // Order summary .well %dl.dl-horizontal - %dt= t '.supplier' + %dt= heading_helper(Order, :name) + ':' %dd= @order.name - if @note.present? - %dt= t '.note' + %dt= heading_helper(Order, :note) + ':' %dd= @order.note - %dt= t '.created_by' + %dt= heading_helper(Order, :created_by) + ':' %dd= show_user_link(@order.created_by) - %dt= t '.begin' + %dt= heading_helper(Order, :starts) + ':' %dd= format_time(@order.starts) - %dt= t '.ending' + %dt= heading_helper(Order, :ends) + ':' %dd= format_time(@order.ends) %dt= t '.group_orders' %dd #{@order.group_orders.count} (#{@order.group_orders.includes(:ordergroup).all.map {|g| g.ordergroup.name}.join(', ')}) diff --git a/app/views/shared/_articles_by_groups.html.haml b/app/views/shared/_articles_by_groups.html.haml index 9470fb49..b55c7c1c 100644 --- a/app/views/shared/_articles_by_groups.html.haml +++ b/app/views/shared/_articles_by_groups.html.haml @@ -1,7 +1,7 @@ %table.table.table-hover %thead %tr - %th{:style => "width:40%"}= t '.name' + %th{:style => "width:40%"}= heading_helper Article, :name %th %acronym{:title => t('shared.articles.ordered_desc')}= t 'shared.articles.ordered' %th @@ -10,7 +10,7 @@ %acronym{:title => t('.fc_price_desc')}= t '.fc_price' %th %acronym{:title => t('.unit_quantity_desc')}= t '.unit_quantity' - %th= t '.unit' + %th= heading_helper Article, :unit %th= t '.price' - for group_order in order.group_orders.ordered diff --git a/app/views/shared/_group.html.haml b/app/views/shared/_group.html.haml index ebd34405..3de9b38c 100644 --- a/app/views/shared/_group.html.haml +++ b/app/views/shared/_group.html.haml @@ -1,14 +1,14 @@ %dl - %dt= t('.description') + ':' + %dt= heading_helper(Ordergroup, :description) + ':' %dd=h group.description - if group.is_a?(Ordergroup) and (@current_user.role_admin? or @current_user.role_finance?) - %dt= t('.contact') + ':' + %dt= heading_helper(Ordergroup, :contact) + ':' %dd=h group.contact - %dt= t('.address') + ':' + %dt= heading_helper(Ordergroup, :contact_address) + ':' %dd= link_to_gmaps group.contact_address %dt= t('.access') + ':' %dd= format_roles(group) - %dt= t('.members') + ':' + %dt= heading_helper(Ordergroup, :user_tokens) + ':' %dd - members = group.users = "(#{members.size})" diff --git a/app/views/shared/_open_orders.html.haml b/app/views/shared/_open_orders.html.haml index 5c00c5f4..eddc82ab 100644 --- a/app/views/shared/_open_orders.html.haml +++ b/app/views/shared/_open_orders.html.haml @@ -7,10 +7,10 @@ %table.table.table-striped %thead %tr - %th= t '.supplier' - %th= t '.ending' + %th= heading_helper Order, :name + %th= heading_helper Order, :ends %th= t '.who_ordered' - %th= t '.total' + %th.numeric= heading_helper GroupOrder, :price %tbody - total = 0 - Order.open.each do |order| @@ -20,7 +20,9 @@ - if group_order = order.group_order(ordergroup) - total += group_order.price %td= "#{show_user group_order.updated_by} (#{format_time(group_order.updated_on)})" - %td.numeric= number_to_currency(group_order.price) + %td.numeric + = link_to_ordering(order, show: true) do + = number_to_currency(group_order.price) - else %td{:colspan => 2} - if total > 0 diff --git a/app/views/stock_takings/_stock_change.html.haml b/app/views/stock_takings/_stock_change.html.haml index 3d27c1fa..0f016aa9 100644 --- a/app/views/stock_takings/_stock_change.html.haml +++ b/app/views/stock_takings/_stock_change.html.haml @@ -1,7 +1,8 @@ %p = simple_fields_for "stock_taking[stock_change_attributes][]", stock_change do |form| = form.hidden_field :stock_article_id - = "Menge (#{stock_change.stock_article.quantity_available})" + = t '.amount' + (#{stock_change.stock_article.quantity_available}) = form.text_field :quantity, :size => 5, :autocomplete => 'off' %span{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => stock_change.stock_article})}} %b= stock_change.stock_article.name diff --git a/app/views/stockit/_form.html.haml b/app/views/stockit/_form.html.haml index 32e58623..1e56b2c2 100644 --- a/app/views/stockit/_form.html.haml +++ b/app/views/stockit/_form.html.haml @@ -1,18 +1,21 @@ -= simple_form_for stock_article, :validate => true do |f| - = f.association :supplier - = f.input :name - = f.input :unit - = f.input :note - - - if stock_article.new_record? - = f.input :price - = 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 => t('.price_hint') - = f.association :article_category - .form-actions - = f.submit class: 'btn' - = link_to t('ui.or_cancel'), stock_articles_path += simple_form_for stock_article, remote: true, :validate => true do |f| + .modal-header + = link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'} + %h3= title + .modal-body + = f.association :supplier + = f.input :name + = f.input :unit + = f.input :note + - if stock_article.new_record? + = f.input :price + = 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).html_safe + = 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') diff --git a/app/views/stockit/_stock_article.html.haml b/app/views/stockit/_stock_article.html.haml new file mode 100644 index 00000000..72d4c510 --- /dev/null +++ b/app/views/stockit/_stock_article.html.haml @@ -0,0 +1,14 @@ +%tr{:class => stock_article_classes(stock_article), :id => "stockArticle-#{stock_article.id}"} + %td= link_to stock_article.name, stock_article + %td= stock_article.quantity + %td= stock_article.quantity_ordered + %td.main_info= stock_article.quantity_available + %td= stock_article.unit + %td= stock_article.price + %td= number_to_percentage stock_article.tax + %td= link_to stock_article.supplier.name, stock_article.supplier + %td= stock_article.article_category.name + %td + = link_to t('ui.edit'), edit_stock_article_path(stock_article), remote: true, class: 'btn btn-mini' + = link_to t('ui.delete'), stock_article, :method => :delete, :confirm => t('.confirm_delete', :name => stock_article.name), + class: 'btn btn-mini btn-danger', :remote => true diff --git a/app/views/stockit/_stock_article_details.html.haml b/app/views/stockit/_stock_article_details.html.haml new file mode 100644 index 00000000..617799e7 --- /dev/null +++ b/app/views/stockit/_stock_article_details.html.haml @@ -0,0 +1,26 @@ +#stockArticleDetails + %dl.dl-horizontal + %dt= heading_helper(StockArticle, :supplier) + %dd= link_to stock_article.supplier.name, stock_article.supplier + %dt= heading_helper(StockArticle, :name) + %dd= stock_article.name + %dt= heading_helper(StockArticle, :unit) + %dd= stock_article.unit + %dt= heading_helper(StockArticle, :price) + %dd= number_to_currency stock_article.price + %dt= heading_helper(StockArticle, :tax) + %dd= number_to_percentage stock_article.tax + %dt= heading_helper(StockArticle, :deposit) + %dd= number_to_currency stock_article.deposit + %dt= heading_helper(StockArticle, :fc_price) + %dd= number_to_currency stock_article.fc_price + %dt= heading_helper(StockArticle, :article_category) + %dd= stock_article.article_category.name + %dt= heading_helper(StockArticle, :note) + %dd= stock_article.note + %dt= heading_helper(StockArticle, :quantity) + %dd= stock_article.quantity + %dt= heading_helper(StockArticle, :quantity_available) + %dd= stock_article.quantity_available + .form-actions + = link_to t('ui.edit'), edit_stock_article_path(stock_article), remote: true, class: 'btn' diff --git a/app/views/stockit/copy.js.erb b/app/views/stockit/copy.js.erb new file mode 100644 index 00000000..e3bc3321 --- /dev/null +++ b/app/views/stockit/copy.js.erb @@ -0,0 +1,9 @@ +$('#modalContainer').html('<%= j(render( + :partial => "form", + :locals => { + :title => t('.title'), + :stock_article => @stock_article + } +)) %>'); + +$('#modalContainer').modal(); diff --git a/app/views/stockit/create.js.erb b/app/views/stockit/create.js.erb new file mode 100644 index 00000000..aa75b2dc --- /dev/null +++ b/app/views/stockit/create.js.erb @@ -0,0 +1,15 @@ +$('div.container-fluid').prepend('<%= j(render( + :partial => 'shared/alert_success', + :locals => { + :alert_message => t('.notice', :name => @stock_article.name) + } +)) %>'); + +// Publish database changes. +// See publish/subscribe design pattern in /doc. +$(document).trigger({ + type: 'StockArticle#create', + stock_article_id: <%= @stock_article.id %> +}); + +$('#modalContainer').modal('hide'); diff --git a/app/views/stockit/derive.js.erb b/app/views/stockit/derive.js.erb new file mode 100644 index 00000000..e3bc3321 --- /dev/null +++ b/app/views/stockit/derive.js.erb @@ -0,0 +1,9 @@ +$('#modalContainer').html('<%= j(render( + :partial => "form", + :locals => { + :title => t('.title'), + :stock_article => @stock_article + } +)) %>'); + +$('#modalContainer').modal(); diff --git a/app/views/stockit/destroy.js.erb b/app/views/stockit/destroy.js.erb new file mode 100644 index 00000000..7bba9dbf --- /dev/null +++ b/app/views/stockit/destroy.js.erb @@ -0,0 +1,13 @@ +$('div.container-fluid').prepend('<%= j(render( + :partial => 'shared/alert_success', + :locals => { + :alert_message => t('.notice', :name => @stock_article.name) + } +)) %>'); + +// Publish database changes. +// See publish/subscribe design pattern in /doc. +$(document).trigger({ + type: 'StockArticle#destroy', + stock_article_id: <%= @stock_article.id %> +}); diff --git a/app/views/stockit/destroy.js.haml b/app/views/stockit/destroy.js.haml deleted file mode 100644 index 8bbde9ed..00000000 --- a/app/views/stockit/destroy.js.haml +++ /dev/null @@ -1,8 +0,0 @@ --# please polish the following line if you know how, same in partial _destroy_fail -var successDiv = $('
'); - -successDiv.append(document.createTextNode('#{escape_javascript(t('.notice', name: @article.name))}')); -$('div.container-fluid').prepend(successDiv); - -$('#stockArticle-#{@article.id}').remove(); --# WARNING: Do not use a simple .fadeOut() above, because it conflicts with the show/hide function of unavailable articles. diff --git a/app/views/stockit/edit.html.haml b/app/views/stockit/edit.html.haml deleted file mode 100644 index bdf498c6..00000000 --- a/app/views/stockit/edit.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -- title t('.title') - -= render :partial => 'form', :locals => {:stock_article => @stock_article} diff --git a/app/views/stockit/edit.js.erb b/app/views/stockit/edit.js.erb new file mode 100644 index 00000000..e3bc3321 --- /dev/null +++ b/app/views/stockit/edit.js.erb @@ -0,0 +1,9 @@ +$('#modalContainer').html('<%= j(render( + :partial => "form", + :locals => { + :title => t('.title'), + :stock_article => @stock_article + } +)) %>'); + +$('#modalContainer').modal(); diff --git a/app/views/stockit/index.html.haml b/app/views/stockit/index.html.haml index c2899d9e..4ece59d5 100644 --- a/app/views/stockit/index.html.haml +++ b/app/views/stockit/index.html.haml @@ -3,6 +3,30 @@ :javascript $(function() { $('tr.unavailable').hide(); + + // Subscribe to database changes. + // See publish/subscribe design pattern in /doc. + $(document).on('StockArticle#create', function(e) { + $.ajax({ + url: '#{index_on_stock_article_create_stock_articles_path}', + type: 'get', + data: {id: e.stock_article_id}, + contentType: 'application/json; charset=UTF-8' + }); + }); + + $(document).on('StockArticle#destroy', function(e) { + $('#stockArticle-' + e.stock_article_id).remove(); + }); + + $(document).on('StockArticle#update', function(e) { + $.ajax({ + url: '#{index_on_stock_article_update_stock_articles_path}', + type: 'get', + data: {id: e.stock_article_id}, + contentType: 'application/json; charset=UTF-8' + }); + }); }) .well.well-small @@ -17,7 +41,7 @@ .btn-group = link_to_if @current_user.role_orders?, t('.order_online'), new_order_path(supplier_id: 0), class: 'btn', class: 'btn btn-primary' - = link_to t('.new_stock_article'), new_stock_article_path, class: 'btn' + = link_to t('.new_stock_article'), new_stock_article_path, remote: true, class: 'btn' = link_to t('.new_stock_taking'), new_stock_taking_path, class: 'btn' = link_to t('.show_stock_takings'), stock_takings_path, class: 'btn' @@ -32,32 +56,19 @@ %table.table.table-hover#articles %thead %tr - %th= t '.article.article' - %th= t '.article.stock' - %th= t '.article.ordered' - %th= t '.article.available' - %th= t '.article.unit' - %th= t '.article.price' - %th= t '.article.vat' - %th= t '.article.supplier' - %th= t '.article.category' + %th= Article.model_name.human + %th= heading_helper StockArticle, :quantity + %th= heading_helper StockArticle, :quantity_ordered + %th= heading_helper StockArticle, :available + %th= heading_helper StockArticle, :unit + %th= heading_helper StockArticle, :price + %th= heading_helper StockArticle, :tax + %th= heading_helper StockArticle, :supplier + %th= heading_helper StockArticle, :article_category %th - %tbody - - for article in @stock_articles - %tr{:class => stock_article_classes(article), :id => "stockArticle-#{article.id}"} - %td= link_to article.name, article - %td= article.quantity - %td= article.quantity - article.quantity_available - %th= article.quantity_available - %td= article.unit - %td= article.price - %td= number_to_percentage article.tax - %td= link_to article.supplier.name, article.supplier - %td= article.article_category.name - %td - = link_to t('ui.edit'), edit_stock_article_path(article), class: 'btn btn-mini' - = link_to t('ui.delete'), article, :method => :delete, :confirm => t('.confirm_delete'), - class: 'btn btn-mini btn-danger', :remote => true + %tbody#articles-tbody + - for stock_article in @stock_articles + = render :partial => 'stock_article', :locals => {:stock_article => stock_article} %p = t '.stock_worth' = number_to_currency StockArticle.stock_value diff --git a/app/views/stockit/index_on_stock_article_create.js.erb b/app/views/stockit/index_on_stock_article_create.js.erb new file mode 100644 index 00000000..14a3bc90 --- /dev/null +++ b/app/views/stockit/index_on_stock_article_create.js.erb @@ -0,0 +1,14 @@ +// Handle more advanced DOM update after AJAX database manipulation. +// See publish/subscribe design pattern in /doc. +(function() { + $('#articles-tbody tr').removeClass('success'); + + var stock_article_row = $('<%= j(render( + :partial => 'stock_article', + :locals => { + :stock_article => @stock_article + } + )) %>').addClass('success'); + + $('#articles-tbody').prepend(stock_article_row); +})(); diff --git a/app/views/stockit/index_on_stock_article_update.js.erb b/app/views/stockit/index_on_stock_article_update.js.erb new file mode 100644 index 00000000..f2f644ba --- /dev/null +++ b/app/views/stockit/index_on_stock_article_update.js.erb @@ -0,0 +1,14 @@ +// Handle more advanced DOM update after AJAX database manipulation. +// See publish/subscribe design pattern in /doc. +(function() { + $('#articles-tbody tr').removeClass('success'); + + var stock_article_row = $('<%= j(render( + :partial => 'stock_article', + :locals => { + :stock_article => @stock_article + } + )) %>').addClass('success'); + + $('#stockArticle-<%= @stock_article.id %>').replaceWith(stock_article_row); +})(); diff --git a/app/views/stockit/new.html.haml b/app/views/stockit/new.html.haml deleted file mode 100644 index 05609a84..00000000 --- a/app/views/stockit/new.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -- title t('.title') - -- content_for :head do - :javascript - $(function() { - $('#article_search').autocomplete({ - source: '#{articles_search_stock_articles_path}', - select: function(e, ui) { - alert(ui.item.value); - //location.href = '#{nil}' + ui.item.value; - } - }); - }) - - -/ - TODO: Fix this - %p - = t '.search_text' - = text_field_tag 'article_search' -#stock_article_form - = render :partial => 'form', :locals => {:stock_article => @stock_article} diff --git a/app/views/stockit/new.js.erb b/app/views/stockit/new.js.erb new file mode 100644 index 00000000..e3bc3321 --- /dev/null +++ b/app/views/stockit/new.js.erb @@ -0,0 +1,9 @@ +$('#modalContainer').html('<%= j(render( + :partial => "form", + :locals => { + :title => t('.title'), + :stock_article => @stock_article + } +)) %>'); + +$('#modalContainer').modal(); diff --git a/app/views/stockit/show.html.haml b/app/views/stockit/show.html.haml index 5f416bf9..077b6e3a 100644 --- a/app/views/stockit/show.html.haml +++ b/app/views/stockit/show.html.haml @@ -1,32 +1,22 @@ - title @stock_article.name +- content_for :javascript do + :javascript + $(function() { + // Subscribe to database changes. + // See publish/subscribe design pattern in /doc. + $(document).on('StockArticle#update', function(e) { + $.ajax({ + url: '#{show_on_stock_article_update_stock_articles_path}', + type: 'get', + data: {id: e.stock_article_id}, + contentType: 'application/json; charset=UTF-8' + }); + }); + }); .row-fluid .span6 - %dl.dl-horizontal - %dt= StockArticle.human_attribute_name 'supplier' - %dd= link_to @stock_article.supplier.name, @stock_article.supplier - %dt= StockArticle.human_attribute_name 'name' - %dd= @stock_article.name - %dt= StockArticle.human_attribute_name 'unit' - %dd= @stock_article.unit - %dt= StockArticle.human_attribute_name 'price' - %dd= number_to_currency @stock_article.price - %dt= StockArticle.human_attribute_name 'tax' - %dd= number_to_percentage @stock_article.tax - %dt= StockArticle.human_attribute_name 'deposit' - %dd= number_to_currency @stock_article.deposit - %dt= StockArticle.human_attribute_name 'fc_price' - %dd= number_to_currency @stock_article.fc_price - %dt= StockArticle.human_attribute_name 'article_category' - %dd= @stock_article.article_category.name - %dt= StockArticle.human_attribute_name 'note' - %dd= @stock_article.note - %dt= StockArticle.human_attribute_name 'quantity' - %dd= @stock_article.quantity - %dt= StockArticle.human_attribute_name 'quantity_available' - %dd= @stock_article.quantity_available - .form-actions - = link_to t('ui.edit'), edit_stock_article_path(@stock_article), class: 'btn' + = render :partial => 'stock_article_details', :locals => {:stock_article => @stock_article} .span6 %h2= t('.stock_changes') diff --git a/app/views/stockit/show_on_stock_article_update.js.erb b/app/views/stockit/show_on_stock_article_update.js.erb new file mode 100644 index 00000000..ce057f89 --- /dev/null +++ b/app/views/stockit/show_on_stock_article_update.js.erb @@ -0,0 +1,13 @@ +// Handle more advanced DOM update after AJAX database manipulation. +// See publish/subscribe design pattern in /doc. +(function() { + var stock_article_details = $('<%= j(render( + :partial => 'stock_article_details', + :locals => { + :stock_article => @stock_article + } + )) %>'); + + $('#stockArticleDetails').replaceWith(stock_article_details); + $('h1').first().text('<%= j(@stock_article.name) %>'); +})(); diff --git a/app/views/stockit/update.js.erb b/app/views/stockit/update.js.erb new file mode 100644 index 00000000..830d846c --- /dev/null +++ b/app/views/stockit/update.js.erb @@ -0,0 +1,15 @@ +$('div.container-fluid').prepend('<%= j(render( + :partial => 'shared/alert_success', + :locals => { + :alert_message => t('.notice', :name => @stock_article.name) + } +)) %>'); + +// Publish database changes. +// See publish/subscribe design pattern in /doc. +$(document).trigger({ + type: 'StockArticle#update', + stock_article_id: <%= @stock_article.id %> +}); + +$('#modalContainer').modal('hide'); diff --git a/app/views/tasks/_archive_tasks.html.haml b/app/views/tasks/_archive_tasks.html.haml index 9ece4d05..95f6fd4a 100644 --- a/app/views/tasks/_archive_tasks.html.haml +++ b/app/views/tasks/_archive_tasks.html.haml @@ -5,13 +5,13 @@ %table.table.table-striped %thead %tr - %th= t '.due_date' - %th= t '.task' - %th= t '.who' + %th= heading_helper Task, :due_date + %th= heading_helper Task, :name + %th= heading_helper Task, :user_list %th %tbody - @tasks.each do |task| %tr %td= task.due_date unless task.due_date.nil? - %td= link_to t('.task_format', name: task.name, duration: task.duration), task_path(task) + %td= link_to task_title(task), task_path(task) %td= task_assignments task diff --git a/app/views/tasks/_list.haml b/app/views/tasks/_list.haml index da91cec8..f3b191ee 100644 --- a/app/views/tasks/_list.haml +++ b/app/views/tasks/_list.haml @@ -1,9 +1,9 @@ %table.table.table-striped %thead %tr - %th= t '.due_date' + %th= heading_helper Task, :due_date %th - %th= t '.task' + %th= heading_helper Task, :name %th{:colspan => '2'} = t '.who' %small= t '.who_hint' @@ -15,7 +15,7 @@ %td - if task.periodic? %i.icon-repeat{title: t('tasks.repeated')} - %td= link_to t('.task_format', name: task.name, duration: task.duration), task_path(task) + %td= link_to task_title(task), task_path(task) %td = task_assignments task = highlighted_required_users task diff --git a/app/views/tasks/index.haml b/app/views/tasks/index.haml index e8d7df44..044dc05c 100644 --- a/app/views/tasks/index.haml +++ b/app/views/tasks/index.haml @@ -13,6 +13,6 @@ %section %h3 = group.name - %small= link_to t('.show_group_tasks'), workgroup_tasks_path(group) + %small= link_to t('.show_group_tasks'), workgroup_tasks_path(workgroup_id: group) = render 'list', tasks: tasks = link_to_top diff --git a/app/views/tasks/show.haml b/app/views/tasks/show.haml index 86de92bf..fd3805ba 100644 --- a/app/views/tasks/show.haml +++ b/app/views/tasks/show.haml @@ -3,22 +3,22 @@ %section %dl.dl-horizontal - %dt= Task.human_attribute_name(:name) + %dt= heading_helper Task, :name %dd= @task.name - if @task.description.present? - %dt= Task.human_attribute_name(:description) + %dt= heading_helper Task, :description %dd= simple_format(@task.description) - if @task.due_date.present? - %dt= Task.human_attribute_name(:due_date) + %dt= heading_helper Task, :due_date %dd = format_date(@task.due_date) - if @task.periodic? %i.icon-repeat{title: t('tasks.repeated')} - %dt= Task.human_attribute_name(:duration) + %dt= heading_helper Task, :duration %dd= t('.hours', count: @task.duration) - %dt= Task.human_attribute_name(:user_list) + %dt= heading_helper Task, :user_list %dd= task_assignments(@task) - %dt= Task.human_attribute_name(:workgroup) + %dt= heading_helper Task, :workgroup %dd - if @task.workgroup = link_to @task.workgroup.name, workgroup_tasks_path(workgroup_id: @task.workgroup_id) diff --git a/config/application.rb b/config/application.rb index 2d8cf3ef..c86d6b0b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,6 +2,10 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' +# need to include this before requiring some other gems +# http://stackoverflow.com/questions/20361428 +I18n.enforce_available_locales = true + if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) diff --git a/config/locales/de.yml b/config/locales/de.yml index 6c776a12..146a827f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -7,7 +7,7 @@ de: availability_short: verf. deposit: Pfand fc_price: Endpreis - fc_price_short: + fc_price_short: FC-Preis fc_share: FoodCoop-Aufschlag fc_share_short: FC-Aufschlag gross_price: Bruttopreis @@ -15,6 +15,7 @@ de: name: Name note: Notiz order_number: Bestellnummer + order_number_short: Nr. origin: Herkunft price: Nettopreis supplier: Lieferantin @@ -22,6 +23,7 @@ de: unit: Einheit unit_quantity: Gebindegröße unit_quantity_short: GebGr + units: Gebinde article_category: description: Beschreibung name: Name @@ -31,10 +33,19 @@ de: supplier: Lieferantin financial_transaction: amount: Betrag + created_on: Datum note: Notiz + ordergroup: Bestellgruppe + user: Eingetragen von + group_order: + price: Bestellsumme + updated_by: Zuletzt bestellt group_order_article: ordergroup_id: Bestellgruppe + quantity: Menge result: Menge + tolerance: Toleranz + total_price: Summe invoice: amount: Betrag date: Rechnungsdatum @@ -54,20 +65,30 @@ de: sent_to_all: An alle Mitglieder schicken subject: Betreff order: + closed_by: Abgerechnet von + created_by: Erstellt von ends: Endet am + name: Lieferant note: Notiz starts: Läuft vom + status: Status order_article: + missing_units: Fehlende Einheiten + missing_units_short: Fehlende units_to_order: Menge update_current_price: Globalen Preis aktualisieren order_comment: text: Kommentiere diese Bestellung ... ordergroup: + account_balance: Kontostand + available_funds: Verfügbares Guthaben + contact: Kontakt contact_address: Adresse contact_person: Kontaktperson contact_phone: Telefon description: Beschreibung ignore_apple_restriction: Bestellstop bei zu wenig Äpfeln ignorieren + last_order: Zuletst bestellt name: Name user_tokens: Mitglieder page: @@ -75,10 +96,12 @@ de: parent_id: Oberseite title: Titel stock_article: + available: Verfügbar price: Nettopreis - quantity: Lagerbestand + quantity: im Lager quantity_available: Verfügbarer Bestand - supplier: Lieferant + quantity_available_short: Verf. + quantity_ordered: Davon bestellt stock_taking: date: Datum note: Notiz @@ -92,6 +115,7 @@ de: fax: FAX is_subscribed: abonniert? min_order_quantity: Mindestbestellmenge + min_order_quantity_short: name: Name note: Notiz order_howto: Howto Bestellen @@ -103,13 +127,14 @@ de: done: Erledigt? due_date: Wann erledigen? duration: Dauer - name: Name + name: Aufgabe required_users: Anzahl - user_list: Verantwortliche + user_list: Verantwortlichen workgroup: Arbeitsgruppe user: email: Email first_name: Vorname + last_login: Letzter login last_name: Nachname name: Name nick: Benutzername @@ -156,7 +181,6 @@ de: workgroup: Arbeitsgruppe admin: access_to: Zugriff auf - actions: Aktionen base: index: all_ordergroups: Alle Bestellgruppen @@ -194,11 +218,6 @@ de: workgroup: Arbeitsgruppe new: title: Bestellgruppe anlegen - ordergroups: - address: Adresse - contact: Kontakt - members: Mitglieder - name: Name show: confirm: Bist Du sicher? edit: Gruppe/Mitglieder bearbeiten @@ -217,20 +236,11 @@ de: title: Neue Benutzerin anlegen show: confirm: Willst du %{user} wirklich rausschmeißen? - email: Email groupabos: Gruppenabos member_since: Mitglied seit %{time} - name: Name - nick: Nick person: Person - phone: Telefon preference: Einstellungen send_message: Nachricht senden - users: - email: Email - last_login: Letzter login - login: Login - name: Name workgroups: destroy: error: ! 'Arbeitsgruppe konnte nicht gelöscht werden: %{error}' @@ -258,8 +268,8 @@ de: name: Name application: controller: - error_authn: - error_denied: + error_authn: Anmeldung erforderlich! + error_denied: Kein Zugriff! error_members_only: Diese Aktion ist nur für Mitglieder der Gruppe erlaubt! article_categories: create: @@ -318,17 +328,9 @@ de: submit: Alle Artikel aktualisieren title: Alle Artikel von %{supplier} bearbeiten warning: Achtung, alle Artikel werden aktualisiert! - edit_all_table: - available_desc: verfügbar - available_short: verf. - order_number_desc: Bestellnummer - order_number_short: Best.Nr. - price_desc: Netto! - price_short: Preis - unit_quantity_desc: Gebindegröße - unit_quantity_short: GebGr form: - title: Neuen Artikel einfügen + title_edit: Artikel bearbeiten + title_new: Neuen Artikel einfügen import_search_results: action_import: importieren already_imported: schon importiert @@ -354,7 +356,7 @@ de: error_nosel: Du hast keine Artikel ausgewählt parse_upload: body:Bitte überprufe die engelesenen Artikel.
Achtung, momentan gibt es keine Überprüfung auf doppelte Artikel.
- title: + title: Artikel hochladen sync: outlist: alert_used: Achtung, %{article} wird gerade in einer laufenden Bestellung verwendet. Bitte erst Bestellung anpassen. @@ -383,24 +385,17 @@ de: how_many_units: Wie viele Einheiten (%{unit}) des Artikels »%{name}« liefern? create: notice: Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen! - create_stock_article: - notice: Neuer Lagerartikel »%{name}« gespeichert. destroy: notice: Lieferung wurde gelöscht. edit: title: Lieferung bearbeiten form: - actions: Optionen - article: Artikel - category: Kategorie + confirm_foreign_supplier_reedit: Der Lagerartikel »%{name}« wurde erfolgreich gespeichert. Er gehört jedoch nicht zu dem Lieferanten dieser Lieferung. Möchtest Du diesen Lagerartikel erneut bearbeiten? create_from_blank: Ohne Vorlage anlegen create_stock_article: Lagerartikel anlegen - price: Nettopreis - 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: confirm_delete: Bist Du sicher? new_delivery: Neue Lieferung für %{supplier} anlegen @@ -410,29 +405,21 @@ de: new: title: Neue Lieferung von %{supplier} show: - amount: Menge - article: Artikel - price: Nettopreis sum: Summe sum_diff: Brutto - bereinigter Rechnungsbetrag sum_gross: Bruttosumme sum_net: Nettosumme title: Lieferung anzeigen title_articles: Artikel - unit: Einheit 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 suppliers_overview: Lieferantenübersicht update: notice: Lieferung wurde aktualisiert. - update_stock_article: - notice: Lagerartikel »%{name}« aktualisiert. documents: order_by_articles: filename: Bestellung %{name}-%{date} - Artikelsortierung @@ -494,26 +481,20 @@ de: alert: ! 'Ein Fehler ist beim Abrechnen aufgetreten: %{message}' notice: Bestellung wurde erfolgreich abgerechnet, die Kontostände aktualisiert. close_direct: - alert: ! 'Bestellung kann nicht geschlossen werden: %{message}' - notice: Bestellung wurde geschlossen. + alert: ! 'Bestellung kann nicht abgerechnet werden: %{message}' + notice: Bestellung wurde abgerechnet. confirm: - clear: Abschließen - first_paragraph: ! 'Wenn die Bestellung abgeschlossen wird, werden ebenfalls alle Gruppenkonten aktualisiert.Hier kannst Du den Mitgliedern Deiner Foodcoop eine Nachricht schreiben.
Damit Deine Kontaktdaten einzusehen sind, musst Du sie unter %{profile_link} freigeben.
@@ -705,30 +664,14 @@ de: notfound: Fehlerhafte URL, das ist nicht Deine Bestellung. form: action_save: Bestellung speichern - amount: Menge - available: Verfügbar - available_funds: Verfügbares Guthaben - created_by: Erstellt von - ending: Ende - funds: Guthaben - last_update: Zuletzt bestellt - manufacturer: Hersteller - min_quantity: Mindestbestellmenge - name: Name new_funds: Neuer Kontostand - note: Notiz price: Preis reset_article_search: Suche zurücksetzen search_article: Artikel suchen... - sum: Summe - sum_amount: ! 'Gesamtbestellmenge bisher:' - supplier: Lieferant + sum_amount: Gesamtbestellmenge bisher title: Bestellen - tolerance: Toleranz total_sum_amount: Gesamtbetrag total_tolerance: Gesamt-Toleranz - unit: Einheit - unit_missing: Fehlende Einheiten units: Gebinde units_full: Volle Gebinde units_total: Gesamt-Einheiten @@ -740,8 +683,6 @@ de: title: Nicht abgerechnete Bestellungen total_sum: Gesamtsumme funds: - account_balance: Kontostand - available_funds: verfügbares Guthaben finished_orders: nicht abgerechnete Bestellungen open_orders: Laufende Bestellungen title: Guthaben @@ -750,14 +691,9 @@ de: not_enough_apples: Um zu Bestellen brauchst Du mindestends %{stop_ordering_under} Äpfel. Momentan hat Deine Bestellgruppe aber nur %{apples} Äpfel. order: title: Artikel - orders: - ending: Ende - sum: Summe - supplier: Lieferantin show: articles: edit_order: Bestellung anpassen - name: Name not_ordered_msg: Du hast noch nicht bestellt order_closed_msg: Die Bestellung is leider schon zu Ende. Beim nächsten mal früher aufstehen... order_nopen_title: Unter Berücksichtigung der derzeitigen Bestellungen aller Gruppen @@ -767,21 +703,14 @@ de: ordered: Bestellt ordered_title: Menge + Toleranz show_hide: Zeige/Verstecke nicht bestellte Artikel - sum: Summe + show_note: Notiz zeigen title: Artikelübersicht - total_price: Gesamtpreis unit_price: Einzelpreis - units: Gebinde - closed_by: Abgerechnet von %{user} comment: Kommentare lesen/schreiben comments: title: Kommentare - ending: Ende not_ordered: Du hast nicht bestellt. - note: Notiz - order_sum: Bestellsumme sum: Summe - supplier: Lieferantin title: Dein Bestellergebnis für %{order} switch_order: remaining: noch %{remaining} @@ -815,6 +744,7 @@ de: create: Nachricht verschicken tasks: required_users: Es fehlen %{count} Mitstreiterinnen! + task_title: ! '%{name} (%{duration}h)' home: apple_bar: desc: ! 'Abgebildet ist das Verhältnis von erledigten Aufgaben zu dem Bestellvolumen Deiner Bestellgruppe im Vergleich zum Durchschnitt in der Foodcoop. Konkret: Pro %{amount} Bestellsumme solltest Du eine Aufgabe machen!' @@ -832,12 +762,8 @@ de: last_update: Letzte Aktualisiering ist %{when} her title: Meine Bestellgruppe transactions: - amount: Betrag - note: Notiz title: Letzte Transaktionen view: Kontoauszug anzeigen - when: Wann - where: Wer ordergroup: title: Engagement Deiner Bestellgruppe tasks_move: @@ -1155,10 +1081,8 @@ de: orders: articles: article_count: ! 'Bestellte Artikel:' - name: Name prices: Netto-/Bruttopreis prices_sum: ! 'Summe (Netto/Brutto-Preise):' - unit_quantity: Gebinde units_full: Volle Gebinde units_ordered: Bestellte Einheiten create: @@ -1177,26 +1101,18 @@ de: notice: Die Bestellung wurde beendet. form: ignore_warnings: Warnungen ignorieren - name: Name - note: Notiz - origin: Herkunft prices: Price (netto/FC) select_all: Alle auswählen stockit: Verfügbar - supplier: Hersteller title: Artikel - unit_quantity: Gebinde index: action_end: Beenden confirm_delete: Willst Du wirklich die Bestellung löschen? confirm_end: Willst Du wirklich die Bestellung %{order} beenden? Es gibt kein zurück. ended_orders: Beendete Bestellungen - ending: Ende new_order: Neue Bestellung anlegen no_open_orders: Derzeit gibt es keine laufende Bestellungen. - note: Notiz open_orders: Laufende Bestellungen - supplier: Lieferantin title: Bestellungen verwalten model: error_closed: Bestellung wurde schon abgerechnet @@ -1208,17 +1124,11 @@ de: warning_ordered_stock: ! 'Warnung: Die rot markierten Artikel wurden in der laufenden Lagerbestellung bereits bestellt bzw. gekauft. Wenn Du sie hier abwählst, werden alle bestehenden Bestellungen bzw. Käufe dieses Artikels gelöscht und nicht abgerechnet!' new: title: Neue Bestellung anlegen - orders: - ending: Ende - start: Start - status: Status - supplier: Lieferantin show: action_end: Beenden! amounts: ! 'Netto/Bruttosumme:' articles: Artikelübersicht articles_ordered: ! 'Bestellte Artikel:' - begin: ! 'Beginn:' comments: title: Kommentare comments_link: Kommentare @@ -1226,7 +1136,6 @@ de: confirm_end: ! 'Willst Du wirklich die Bestellung %{order} beenden? Es gibt kein zurück.' - created_by: ! 'Erstellt von:' download: article_pdf: Artikel PDF download_file: Download file @@ -1235,12 +1144,9 @@ de: group_pdf: Gruppen PDF matrix_pdf: Matrix PDF title: Download - ending: ! 'Ende:' group_orders: ! 'Gruppenbestellungen:' - note: ! 'Notiz:' sort_article: Sortiert nach Artikeln sort_group: Sortiert nach Gruppen - supplier: ! 'Lieferantin:' title: ! 'Bestellung: %{name}' warn_not_closed: Achtung, Bestellung wurde noch nicht abgerechnet. state: @@ -1332,29 +1238,23 @@ de: shared: articles: ordered: Bestellt - ordered_desc: + ordered_desc: Anzahl der Artikel die durch das Mitglied bestellt wurden (Menge + Toleranz) received: Bekommen - received_desc: + received_desc: Anzahl der Artikel die ein Mitglied erhält articles_by_articles: ordergroup: Bestellgruppe price: Gesamtpreis articles_by_groups: fc_price: FC-Preis fc_price_desc: Preis incl. MwSt, Pfand und Foodcoop-Aufschlag - name: Name price: Gesamtpreis - unit: Einheit unit_quantity: GebGr unit_quantity_desc: Gebindegröße group: access: Zugriff auf activated: aktiviert - address: Adresse apple_limit: Äpfel-Bestellbeschränkung - contact: Kontakt deactivated: deaktiviert - description: Beschreibung - members: Mitglieder no_weekly_job: kein wöchentlicher Job definiert weekly_job: Wöchentlicher Job group_form_fields: @@ -1363,12 +1263,9 @@ de: title: Wöchentliche Jobs user_not_found: Keine Nutzerin gefunden open_orders: - ending: Ende no_open_orders: Derzeit gibt es keine laufenden Bestellungen not_enough_apples: Achtung, Deine Bestellgruppe hat zu wenig Äpfel um Bestellen zu können! - supplier: Lieferantin title: Laufende Bestellungen - total: Summe total_sum: Gesamtsumme who_ordered: Wer hat bestellt? workgroup_members: @@ -1385,7 +1282,7 @@ de: units_to_order: Wenn Du die Gesamtanzahl gelieferter Gebinde änderst, musst Du auch die individuelle Anzahl der einzelnen Bestellgruppen anpassen, indem Du auf den Artikelnamen klickst. Sie werden nicht automatisch neuberechnet und andernfalls werden den Bestellgruppen Artikel in Rechnung gestellt, die nicht geliefert wurden! update_current_price: Ändert auch den Preis für aktuelle Bestellungen stock_article: - copy_stock_article: + copy: name: Bitte ändern edit_stock_article: price:Here you can write a message to the members of your Foodcoop.
You have to approve in your %{profile_link} that your contact details are visible.
@@ -719,30 +678,14 @@ en: notfound: Incorrect URL, this is not your order. form: action_save: Save order - amount: Amount - available: Available - available_funds: Available credits - created_by: Created by - ending: End - funds: Credit - last_update: Last ordered - manufacturer: Manufacturer - min_quantity: Minimum quantity - name: Name new_funds: New account balance - note: Note price: Price reset_article_search: Reset search - search_article: Search for article... - sum: Sum + search_article: Search for articles... sum_amount: Current amount - supplier: Supplier title: Orders - tolerance: Tolerance total_sum_amount: Total amount total_tolerance: Total tolerance - unit: Unit - unit_missing: Missing units units: Units units_full: Filled units units_total: Total units @@ -754,9 +697,7 @@ en: title: Unsettled orders total_sum: Total sum funds: - account_balance: Account balance - available_funds: Available credit - finished_orders: unsettled orders + finished_orders: Unsettled orders open_orders: Current orders title: Credit title: Orders overview @@ -764,14 +705,9 @@ en: not_enough_apples: You need at least %{stop_ordering_under} apples to order. Currently your order group has only %{apples} apples. order: title: Articles - orders: - ending: End - sum: Sum - supplier: Suppliers show: articles: edit_order: Edit order - name: Name not_ordered_msg: You didn’t place an order yet order_closed_msg: Sorry, this order is closed. order_nopen_title: Considering current orders of all groups @@ -781,21 +717,14 @@ en: ordered: Ordered ordered_title: Amount + tolerance show_hide: Show/hide articles not ordered - sum: Sum + show_note: Show note title: Article overview - total_price: Total price unit_price: Unit price - units: Units - closed_by: Settled by %{user} comment: Comment comments: title: Comments - ending: End not_ordered: You didn’t order. - note: Note - order_sum: Order sum sum: Sum - supplier: Suppliers title: Your order result for %{order} switch_order: remaining: ! '%{remaining} remaining' @@ -829,6 +758,7 @@ en: create: send message tasks: required_users: ! '%{count} members are still needed!' + task_title: ! '%{name} (%{duration}h)' home: apple_bar: desc: ! 'This shows the proportion of completed tasks to the volume of orders for your ordergroup in comparison to the average of the Foodcoop. In practice: for every %{amount} of total orders, you should execute a task!' @@ -843,15 +773,11 @@ en: view_all: See all messages my_ordergroup: funds: ! '| Available Credit:' - last_update: Last Update was %{when} ago + last_update: Last update was %{when} ago title: My ordergroup transactions: - amount: Amount - note: Note title: Last Transactions view: Show account statement - when: When - where: Who ordergroup: title: Engagement of your ordergroup tasks_move: @@ -885,7 +811,7 @@ en: admin: Administration finances: accounts: Update accounts - settle: To account orders + settle: Account orders title: Finances foodcoop: Foodcoop members: Members @@ -1169,10 +1095,8 @@ en: orders: articles: article_count: ! 'Ordered articles:' - name: Name prices: Net/gross price prices_sum: ! 'Sum (net/gross price):' - unit_quantity: Unit quantity units_full: Full units units_ordered: Units ordered create: @@ -1191,26 +1115,18 @@ en: notice: The order has been closed. form: ignore_warnings: Ignore warnings - name: Name - note: Note - origin: Origin prices: Prices (net/FC) select_all: Select all stockit: In stock - supplier: Producer title: Article - unit_quantity: Unit quantity index: action_end: Close confirm_delete: Do you really want to delete the order? confirm_end: Do you really want to close the order %{order}? There is no going back. ended_orders: Closed orders - ending: End new_order: Create new order no_open_orders: There are currently no open orders. - note: Note open_orders: Current orders - supplier: Supplier title: Manage orders model: error_closed: Order was already settled @@ -1218,21 +1134,15 @@ en: error_starts_before_ends: must be after the start date (or remain empty) notice_close: ! 'Order: %{name}, until %{ends}' stock: Stock - warning_ordered: ! 'Warning: Articles marked red have already been ordered within this open order. If you uncheck them here, all existing orders of these articles will be deleted.' - warning_ordered_stock: ! 'Warning: Articles marked red have already been ordered/ purchased within this open stock order. If you uncheck them here, all existing orders/ purchases of these articles will be deleted and it will not be accounted for them.' + warning_ordered: ! 'Warning: articles marked red have already been ordered within this open order. If you uncheck them here, all existing orders of these articles will be deleted.' + warning_ordered_stock: ! 'Warning: Articles marked red have already been ordered/purchased within this open stock order. If you uncheck them here, all existing orders/purchases of these articles will be deleted and it will not be accounted for them.' new: title: Create new order - orders: - ending: End - start: Start - status: Status - supplier: Supplier show: action_end: Close! amounts: ! 'Net/gross sum:' articles: Article overview articles_ordered: ! 'Ordered articles:' - begin: ! 'Begin:' comments: title: Comments comments_link: Comments @@ -1240,7 +1150,6 @@ en: confirm_end: ! 'Do you really want to close the order %{order}? There is no going back.' - created_by: ! 'Created by:' download: article_pdf: Article PDF download_file: Download file @@ -1249,12 +1158,9 @@ en: group_pdf: Group PDF matrix_pdf: Matrix PDF title: Download - ending: ! 'End:' group_orders: ! 'Group orders:' - note: ! 'Note:' sort_article: Sorted in articles sort_group: Sorted in groups - supplier: ! 'Supplier:' title: ! 'Order: %{name}' warn_not_closed: Warning, order is not yet settled. state: @@ -1269,7 +1175,7 @@ en: recent_changes: Recent changes search: action: Search - placeholder: Page title .. + placeholder: Page title ... site_map: Sitemap title: All Wiki pages title_list: List of pages @@ -1355,20 +1261,14 @@ en: articles_by_groups: fc_price: FC-Price fc_price_desc: Price including taxes, deposit and Foodcoop-charge - name: Name price: Total price - unit: Unit unit_quantity: Lot quantity unit_quantity_desc: How many units per lot. group: access: Access to activated: activated - address: Address apple_limit: Apple points order limit - contact: Contact deactivated: deactivated - description: Description - members: Members no_weekly_job: No weekly job defined weekly_job: Weekly job group_form_fields: @@ -1377,12 +1277,9 @@ en: title: Weekly jobs user_not_found: No user found open_orders: - ending: Ending no_open_orders: There are no current orders not_enough_apples: Attention your order group has too few apple points to place an order! - supplier: Supplier title: Current orders - total: Sum total_sum: Total sum who_ordered: Who ordered? workgroup_members: @@ -1392,19 +1289,19 @@ en: default_message: Errors were found. Please check the form. hints: article: - unit: ! 'For example: KG or 1L or 500g' + unit: e.g. KG or 1L or 500g message: private: Message doesn’t show in Foodsoft mail inbox order_article: units_to_order: If you change the total amount of delivered units, you also have to change individual group amounts by clicking on the article name. They will not be automatically recalculated and so ordergroups may be accounted for articles that were not delivered! update_current_price: Also update the price of the current order stock_article: - copy_stock_article: + copy: name: Please modify edit_stock_article: price:Cette page sert à envoyer des messages aux autres membres de la coop.
@@ -723,30 +682,14 @@ fr: notfound: ! ' Mauvaise adresse, ce n''est pas ta commande.' form: action_save: Enregistrer ta commande - amount: Quantité - available: Disponible - available_funds: Crédit disponible - created_by: Établi par - ending: Clôture le - funds: Crédit - last_update: Dernière commande - manufacturer: Produit par - min_quantity: Quantité minimale - name: Nom new_funds: Nouveau solde - note: Note price: Prix reset_article_search: search_article: - sum: Prix total - sum_amount: ! 'Quantité déjà commandée:' - supplier: Fourni par + sum_amount: Quantité déjà commandée title: Commander - tolerance: Tolérance total_sum_amount: Montant total total_tolerance: Tolérance totale - unit: Unité - unit_missing: Unités manquantes units: Lots units_full: Lots complet units_total: Unités déjà commandées @@ -758,8 +701,6 @@ fr: title: Commandes par encore décomptées total_sum: Total funds: - account_balance: Crédit initial - available_funds: Crédit disponible finished_orders: montant prévu des commandes non décomptées open_orders: montant des commandes en cours title: Crédit @@ -770,14 +711,9 @@ fr: alors que vous n''en avez que %{apples} pour le moment.' order: title: Article - orders: - ending: Clôture le - sum: Total - supplier: FournisseusE_r show: articles: edit_order: Modifier ta commande - name: Nom not_ordered_msg: Tu n'as pas encore commandé order_closed_msg: Désolé, cette commande a déjà été fermée. Il faudra te réveiller plus tôt la prochaine fois order_nopen_title: En tenant compte des commandes en cours de toutes les cellules @@ -787,21 +723,14 @@ fr: ordered: Quantité souhaitée ordered_title: Quantité + tolérance show_hide: Montrer/cacher les articles non commandés - sum: Total + show_note: title: Aperçu des articles - total_price: Prix unit_price: Prix unitaire - units: Lots - closed_by: Décompté par %{user} comment: Lire/écrire des commentaire comments: title: Commentaire - ending: Clôture le not_ordered: Tu n'as pas commandé. - note: Note - order_sum: Total de la commande sum: Total - supplier: Fourni par title: Ta part de la commande %{order} switch_order: remaining: encore %{remaining} @@ -835,6 +764,7 @@ fr: create: Envoyer un message tasks: required_users: Il manque encore %{count} camarades! + task_title: ! '%{name} (%{duration}h)' home: apple_bar: desc: ! 'Ce système de glands sert à comparer la durée du travail collectif auquel ta cellule a contribué (rapportée à la quantité commandée) avec @@ -858,12 +788,8 @@ fr: last_update: La dernière mise à jour date du %{when} title: Ta cellule transactions: - amount: Montant - note: Note title: Dernière transactions view: Afficher un relevé de compte - when: Quand? - where: Qui? ordergroup: title: Niveau de participation de ta cellule tasks_move: @@ -1164,10 +1090,8 @@ fr: orders: articles: article_count: ! 'Articles commandés:' - name: Nom prices: Prix brut/net prices_sum: ! 'Totaux (des prix bruts/nets):' - unit_quantity: Unités par lots x Lots units_full: Lots complet units_ordered: Unités commandées create: @@ -1186,26 +1110,18 @@ fr: notice: La commande a été close. form: ignore_warnings: - name: Nom - note: Note - origin: Origine prices: Prix (net/coop) select_all: Tout sélectionner stockit: Disponible - supplier: Productrice_teur title: Article - unit_quantity: Lots index: action_end: Terminer confirm_delete: Vraiment supprimer la commande? confirm_end: Veux tu vraiment mettre fin à la commande %{order}? Attention, il n'y aura pas d'annulation possible. ended_orders: Commandes closes - ending: Clôture le new_order: Définir une nouvelle commande no_open_orders: Il n'y a aucune commande en cours en ce moment. - note: Note open_orders: Commandes en cours - supplier: FournisseusE_r title: Gestion des commandes model: error_closed: Cette commande a déjà été décomptée @@ -1217,23 +1133,16 @@ fr: warning_ordered_stock: new: title: Définir une nouvelle commande - orders: - ending: Clôture le - start: Début - status: Statut - supplier: FournisseurE show: action_end: Clore! amounts: ! 'Total net/brut:' articles: Aperçu des articles articles_ordered: ! 'Articles commandés:' - begin: ! 'Début:' comments: title: Commentaire comments_link: Commenaire confirm_delete: Veux-tu vraiment supprimer la commande? confirm_end: Veux tu vraiment terminer la commande %{order}? Pas d'annulation possible. - created_by: ! 'Créée par:' download: article_pdf: Liste des articles en PDF download_file: Télécharger @@ -1242,12 +1151,9 @@ fr: group_pdf: Liste des cellules en PDF matrix_pdf: Matrice de distribution en PDF title: Télécharger - ending: ! 'Clôture le:' group_orders: ! 'Commandes des cellules:' - note: ! 'Note:' sort_article: Trié par article sort_group: Trié par cellules - supplier: FournisseurE title: ! 'Commande: %{name}' warn_not_closed: Attention, cette commande n'a pas encore été décomptée! state: @@ -1348,20 +1254,14 @@ fr: articles_by_groups: fc_price: Prix coop fc_price_desc: Prix avec TVA, consigne et part de la coop inclus. - name: Nom price: Prix total - unit: Unité unit_quantity: U/L unit_quantity_desc: Unités par lot group: access: Accès à activated: activé - address: Adresse apple_limit: Minimum de glands - contact: Contact deactivated: désactivé - description: Description - members: Membre no_weekly_job: aucun boulot hebdomadaire n'a été défini weekly_job: Boulot hebdomadaire group_form_fields: @@ -1370,12 +1270,9 @@ fr: title: Boulots hebdomadaires user_not_found: Aucune utilisatrice n'a été trouvée. open_orders: - ending: Clôture le no_open_orders: Il n'y a aucune commande en cours en ce moment not_enough_apples: Désolé, ta cellule n'a pas assez de glands pour pouvoir commander! - supplier: FournisseusE_r title: Commandes en cours - total: Total total_sum: Total who_ordered: Qui a commandé? workgroup_members: @@ -1392,7 +1289,7 @@ fr: units_to_order: update_current_price: Modifie aussi le prix des commandes en cours stock_article: - copy_stock_article: + copy: name: Merci de modifier edit_stock_article: price:Hier kun je leden van deze foodcoop een bericht sturen.
Om je eigen contactgegevens te laten zien, moet je die vrijgeven op %{profile_link}.
@@ -702,30 +668,14 @@ nl: notfound: Foute URL, dit is niet jouw bestelling. form: action_save: Bestelling opslaan - amount: Hoeveelheid - available: Beschikbaar - available_funds: Beschikbaar tegoed - created_by: Aangemaakt door - ending: Einde - funds: Krediet - last_update: Laatst bestelt - manufacturer: Producent - min_quantity: Min. bestelhoeveelheid - name: Naam new_funds: Nieuw tegoed - note: Notitie price: Prijs - reset_article_search: - search_article: Artikel zoeken... - sum: Som - sum_amount: ! 'Huidig totaalbedrag:' - supplier: Leverancier + reset_article_search: Alles tonen + search_article: Artikelen zoeken... + sum_amount: Huidig totaalbedrag title: Bestellen - tolerance: Tolerantie total_sum_amount: Totalbedrag total_tolerance: Totale tolerantie - unit: Eenheid - unit_missing: Missende eenheden units: Eenheden units_full: Volle eenheden units_total: Totaal aantal @@ -737,8 +687,6 @@ nl: title: Niet afgerekende bestellingen total_sum: Totaal funds: - account_balance: Tegoed - available_funds: finished_orders: niet afgerekende bestellingen open_orders: Lopende bestellingen title: Credit @@ -747,14 +695,9 @@ nl: not_enough_apples: Om te bestellen heb je minimaal %{stop_ordering_under} appels nodig. Momenteel heeft je huishouden slechts %{apples} appels. order: title: Artikelen - orders: - ending: Einde - sum: Som - supplier: Leveranciers show: articles: - edit_order: Order aanpassen - name: Naam + edit_order: Bestelling aanpassen not_ordered_msg: Je hebt nog niets bestelt order_closed_msg: Sorry, deze bestelling is gesloten. order_nopen_title: Waarbij rekening gehouden is met bestellingen van anderen @@ -764,21 +707,14 @@ nl: ordered: Besteld ordered_title: Hoeveelheid + tolerantie show_hide: Niet bestelde artikelen tonen/verbergen - sum: Som + show_note: Opmerking title: Artikeloverzicht - total_price: Totaalprijs unit_price: Stuksprijs - units: Eenheden - closed_by: Afgerekend door %{user} comment: Notitie comments: - title: - ending: Einde + title: Commentaar not_ordered: Je hebt niets bestelt. - note: Notitie - order_sum: sum: Som - supplier: Leveranciers title: Jouw bestelling voor %{order} switch_order: remaining: nog %{remaining} @@ -812,12 +748,15 @@ nl: create: bericht versturen tasks: required_users: Nog %{count} leden nodig! + task_title: ! '%{name} (%{duration}u)' home: apple_bar: - desc: + desc: ! 'Deze balk laat zien hoeveel taken je gedaan hebt per bestelhoeveelheid, vergeleken met het gemiddelde van de foodcoop. + + Praktisch: voor iedere %{amount} aan totale bestellingen moet je een taak te doen!' more_info: Meer informatie - points: - warning: + points: ! 'Appelpuntenstand: %{points}' + warning: Opgelet, als je minder dan %{threshold} appelpunten hebt, kun je geen bestelling plaatsen! changes_saved: Wijzigingen opgeslagen. index: due_date_format: ! '%A %d %B' @@ -829,14 +768,10 @@ nl: last_update: Laatst gewijzigd %{when} geleden title: Mijn huishouden transactions: - amount: Bedrag - note: Notitie title: Laatste transacties view: Rekeningafschrift tonen - when: Wanneer - where: Wie ordergroup: - title: + title: Betrokkenheid van je huishouden tasks_move: action: Taken op je nemen/annuleren desc: Je bent voor de volgende taken verantwoordelijk. @@ -845,7 +780,7 @@ nl: action: open taken desc: Er zijn %{size} title: open taken - title: Beginpagina + title: Hoofdpagina your_tasks: Jouw taken no_ordergroups: Jammergenoeg ben je niet aangesloten bij een huishouden. ordergroup: @@ -865,10 +800,10 @@ nl: since: ! '(gebruiker sinds: %{when})' title: ! '%{user}' start_nav: - admin: + admin: Administratie finances: accounts: Tegoeden bijwerken - settle: Bestelling afrekenen + settle: Bestellingen afrekenen title: Financiën foodcoop: Foodcoop members: Leden @@ -898,7 +833,7 @@ nl: success: Persoon is uitgenodigd. js: ordering: - confirm_change: + confirm_change: Als je naar een andere bestelling gaat, gaan je aanpassingen in deze bestelling verloren. Wijzigingen vergeten en naar de andere bestelling gaan? layouts: email: footer: ! '-- @@ -951,16 +886,55 @@ nl: header: ! '%{user} schreef op %{date}:' subject: Feedback van %{email} foodsoft_message: - footer: + footer: ! 'Antwoorden: %{reply_url} + + Bericht online lezen: %{msg_url} + + Berichtinstellingen: %{profile_url}' invite: subject: Uitnodiging voor de foodcoop - text: + text: ! 'Hallo! + + + %{user} <%{mail}> heeft je uitgenodigd om deel te worden van de groep "%{group}". + + Om lid te worden van de foodcoop en de uitnodiging te accepteren, ga naar: %{link} + + Dit kan maar een keer en uiterlijk tot %{expires}. + + + Groeten van de foodcoop.' negative_balance: - subject: - text: + subject: Negatief tegoed + text: ! 'Beste %{group}, + + + Je tegoed is onder nul gekomen op %{when}: %{balance} + + + Er werd %{amount} afgeschreven voor "%{note}" door %{user}. + + + Zorg er alsjeblieft voor dat tegoed weer positief wordt. + + + + Hartlijke groet van %{foodcoop}.' not_enough_users_assigned: - subject: - text: + subject: ! '"%{task}" heeft nog mensen nodig!' + text: ! 'Beste %{user}, + + + De taak ''%{task}'' van jouw werkgroep op %{when} kan nog iemand gebruiken! + + + Als je je hiervoor nog niet aangemeld hebt is dit je kans: + + + %{workgroup_tasks_url} + + + Jouw taken: %{user_tasks_url}' order_result: subject: ! 'Bestelling gesloten: %{name}' text0: ! 'Beste %{ordergroup}. @@ -1076,8 +1050,8 @@ nl: title: Bestellingen tasks: Taken wiki: - all_pages: Alle Pagina's - home: Begin + all_pages: Alle pagina's + home: Hoofdpagina title: Wiki workgroups: Werkgroepen ordergroups: @@ -1091,10 +1065,8 @@ nl: orders: articles: article_count: ! 'Bestelde artikelen:' - name: Naam prices: Netto/bruto prijs prices_sum: ! 'Totaal (netto/bruto prijs):' - unit_quantity: Groothandelseenheid units_full: Volle eenheden units_ordered: Bestelde eenheden create: @@ -1113,56 +1085,41 @@ nl: notice: De bestelling is gesloten. form: ignore_warnings: Waarschuwingen negeren - name: Naam - note: Notitie - origin: Herkomst prices: Prijs (netto/FC) select_all: Alles selecteren stockit: Beschikbaar - supplier: Producent title: Artikel - unit_quantity: index: action_end: Sluiten confirm_delete: Wil je de bestelling werkelijk verwijderen? confirm_end: Wil je de bestelling %{order} werkelijk sluiten? Dit kun je niet ongedaan maken. ended_orders: Gesloten bestellingen - ending: - new_order: + new_order: Nieuwe bestelling openen no_open_orders: Er zijn momenteel geen lopende bestellingen. - note: open_orders: Lopende bestellingen - supplier: - title: + title: Bestellingen beheren model: error_closed: Bestelling was al afgerekend - error_nosel: - error_starts_before_ends: + error_nosel: Er moet minstens één artikel geselecteerd zijn + error_starts_before_ends: moet na de startdatum zijn (of niet ingevuld worden) notice_close: ! 'Bestelling: %{name}, tot %{ends}' stock: Voorraad - warning_ordered: - warning_ordered_stock: + warning_ordered: ! 'Opgelet: rood gemarkeerde artikelen zijn al besteld door leden. Als je ze hier deselecteert, worden alle bestaande ledenbestellingen van deze artikelen verwijderd.' + warning_ordered_stock: ! 'Opgelet: rood gemarkeerde artikelen zijn al besteld of gekocht door leden. Als je ze hier deselecteert, worden alle bestaande ledenbestellingen/-aankopen van deze artikelen verwijderd, en worden ze niet afgerekend.' new: - title: - orders: - ending: - start: Start - status: - supplier: Leverancier + title: Nieuwe bestelling openen show: action_end: Sluiten! - amounts: + amounts: ! 'Totaal netto/bruto:' articles: Artikeloverzicht articles_ordered: ! 'Bestelde artikelen:' - begin: ! 'Begin:' comments: title: Commentaar comments_link: Commentaar - confirm_delete: + confirm_delete: Wil je deze bestelling echt verwijderen? confirm_end: ! 'Wil je de bestelling %{order} echt sluiten? Hierna kan zij niet opnieuw geopend worden.' - created_by: ! 'Geopend door:' download: article_pdf: Artikelen PDF download_file: Bestand downloaden @@ -1171,13 +1128,10 @@ nl: group_pdf: Huishoudens PDF matrix_pdf: Matrix PDF title: Downloaden - ending: ! 'Einde:' group_orders: ! 'Ledenbestellingen:' - note: ! 'Notitie:' sort_article: Gesorteerd naar artikel sort_group: Gesorteerd naar huishouden - supplier: - title: + title: ! 'Bestelling: %{name}' warn_not_closed: Opgelet, bestelling is nog niet afgerekend. state: closed: afgerekend @@ -1187,34 +1141,34 @@ nl: notice: De bestelling is bijgewerkt. pages: all: - new_page: - recent_changes: + new_page: Nieuwe pagina maken + recent_changes: Recente wijzigingen search: - action: - placeholder: - site_map: - title: - title_list: + action: Zoeken + placeholder: Pagina titel ... + site_map: Sitemap + title: Alle wikipagina's + title_list: Paginalijst body: - title_toc: + title_toc: Inhoud create: notice: Pagina is gemaakt. cshow: - error_noexist: + error_noexist: Pagina bestaat niet! redirect_notice: Doorverwezen van %{page} ... destroy: notice: De pagina '%{page}' en alle subpagina's zijn verwijderd. edit: - title: - error_stale_object: + title: Pagina bewerken + error_stale_object: Opgelet, de pagina is net veranderd door een ander. Probeer het alsjeblieft opnieuw. form: help: - bold: - external_link_ex: - external_links: - heading: - headings: - italic: + bold: vet + external_link_ex: Externe pagina + external_links: Links naar pagina's op andere websites + heading: niveau %{level} + headings: Kop + italic: italic list_item_1: Eerste in de lijst list_item_2: Tweede in de lijst noformat: Zonder wiki-opmaak @@ -1226,35 +1180,35 @@ nl: see_tables: zie %{tables_link} tables_link: Tabellen text: tekst - title: - unordered_list: - wiki_link_ex: - wiki_links: - preview: - last_updated: + title: Korte opmaakhulp + unordered_list: Itemlijst + wiki_link_ex: Foodsoft wiki pagina + wiki_links: Wiki-links + preview: Voorbeeld + last_updated: Laatst bijgewerkt new: - title: + title: Nieuwe wiki pagina page_list_item: - date_format: + date_format: ! '%a, %d %B %Y %H:%M:%S' show: - date_format: - delete: - delete_confirm: - edit: - last_updated: - subpages: - title_versions: - versions: - title: + date_format: ! '%d-%m-%y %H:%M' + delete: Pagina verwijderen + delete_confirm: ! 'Opgelet: alle onderliggende pagina''s worden ook verwijderd. Zeker weten?' + edit: Pagina bewerken + last_updated: Laatst bijgewerkt door %{user} op %{when} + subpages: kindpagina's + title_versions: Versies + versions: Versies (%{count}) + title: Titel update: notice: Pagina is bijgewerkt. version: - author: - date_format: - revert: - title: - title_version: - view_current: + author: ! 'Auteur: %{user}' + date_format: ! '%a, %d-%m-%Y, %H:%M' + revert: Deze versie terugzetten + title: ! '%{title} - versie %{version}' + title_version: Versie + view_current: Huidige versie bekijken sessions: logged_in: Ingelogd! logged_out: Uitgelogd! @@ -1277,20 +1231,14 @@ nl: articles_by_groups: fc_price: FC-Prijs fc_price_desc: Prijs inclusief belasting, statiegeld en foodcoop marge - name: Naam price: Totaalprijs - unit: Eenheid unit_quantity: Gr.Eenh. unit_quantity_desc: Hoeveel eenheden per groothandelsverpakking group: access: Toegang tot activated: actief - address: Adres - apple_limit: - contact: Contact + apple_limit: Appelpunten bestellingslimiet deactivated: inactief - description: Beschrijving - members: Leden no_weekly_job: geen wekelijkse taak ingesteld weekly_job: wekelijkse taak group_form_fields: @@ -1299,38 +1247,35 @@ nl: title: Wekelijkse taken user_not_found: Geen gebruiker gevonden open_orders: - ending: Einde no_open_orders: Er zijn momenteel geen lopende bestellingen. - not_enough_apples: - supplier: Leverancier + not_enough_apples: Opgelet, je huishouden heeft niet genoeg appelpunten om te kunnen bestellen! title: Lopende bestellingen - total: Som total_sum: Totaalsom who_ordered: Wie heeft besteld? workgroup_members: title: Groepsleden simple_form: error_notification: - default_message: + default_message: Problemen gevonden, controleer alsjeblieft de invoer. hints: article: unit: ! 'Bijvoorbeeld: KG of 1L of 500g' message: - private: + private: Bericht wordt niet getoond in de Foodsoft inbox. order_article: - units_to_order: - update_current_price: + units_to_order: Als je het aantal geleverde eenheden wijzigt, moet je daarna de hoeveelheden voor huishoudens aanpassen. Klik daarvoor op de artikelnaam. Als je dit vergeet, kunnen huishoudens belast worden voor artikelen die ze niet hebben gekregen! + update_current_price: Ook prijs in huidige besteling aanpassen stock_article: - copy_stock_article: - name: + copy: + name: Wijzigen alsjeblieft edit_stock_article: - price: + price:Hier kun je leveranciers in de externe database zien.
Als je een externe leverancier importeert, wordt er een nieuwe leverancier aangemaakt die verbonden is met de externe database.
+ subscribe: Importeren + subscribe_again: Nogmaals importeren + supplier: Leverancier + title: Externe lijsten show: - confirm_delete: - last_deliveries: - new_delivery: - show_deliveries: + confirm_delete: Zeker weten? + last_deliveries: Laatste leveringen + new_delivery: Levering aanmaken + show_deliveries: Alle leveringen tonen update: notice: Leverancier is bijgewerkt tasks: accept: notice: Je hebt de taak geaccepteerd archive: - title: - archive_tasks: - due_date: - task: - task_format: - who: + title: Takenarchief create: notice: Taak is aangemaakt destroy: notice: Taak is verwijderd edit: - title: - warning_periodic: - error_not_found: + title: Taak bewerken + warning_periodic: Opgelet: deze taak is onderdeel van een wekelijkse taak. Wanneer deze opslaat, zal de uitzondering als een normale taak worden opgeslagen. + error_not_found: Geen werkgroep gevonden form: search: - hint: - noresult: - placeholder: + hint: Gebruiker zoeken + noresult: Geen gebruiker gevonden + placeholder: Zoeken ... submit: - periodic: + periodic: Wekelijkse taak bewaren index: - show_group_tasks: - title: - title_non_group: + show_group_tasks: Groepstaken tonen + title: Taken + title_non_group: Taken voor iedereen! list: - accept_task: - done: - done_q: - due_date: - mark_done: - reject_task: - task: - task_format: - who: - who_hint: + accept_task: Taak accepteren + done: Gedaan + done_q: Gedaan? + mark_done: Taak als gedaan markeren + reject_task: Taak laten vallen + who: Wie doet het? + who_hint: (Hoeveel zijn er nog nodig?) nav: - all_tasks: - archive: - group_tasks: - my_tasks: - new_task: - pages: + all_tasks: Alle taken + archive: Gedane taken (archief) + group_tasks: Groepstaken + my_tasks: Mijn taken + new_task: Nieuwe taak + pages: Pagina's new: - title: - repeated: + title: Nieuwe taken maken + repeated: Taak wordt wekelijks herhaald set_done: notice: De status van de taak is aangepast show: - accept_task: - confirm_delete_group: - confirm_delete_single: - delete_group: - hours: - mark_done: - reject_task: - title: + accept_task: Accepteren + confirm_delete_group: Deze en alle volgende taken echt verwijderen? + confirm_delete_single: Weet je zeker dat je deze taak wilt verwijderen? + delete_group: Deze en volgende taken verwijderen + hours: ! '%{count}u' + mark_done: Als gedaan markeren + reject_task: Taak laten vallen + title: Taak bekijken update: notice: Taak is bijgewerkt notice_converted: Taak is bijgewerkt en omgezet naar een eenmalige taak. user: - more: - tasks_link: - title: - title_accepted: - title_open: + more: Niets voor jou? %{tasks_link} is vast wat te doen + tasks_link: Hier + title: Mijn taken + title_accepted: Aangenomen taken + title_open: Open taken workgroup: - title: - title_all: + title: Taken voor %{workgroup} + title_all: Alle groepstaken ui: + actions: Acties close: Sluiten delete: Verwijder edit: Bewerk @@ -1555,16 +1486,16 @@ nl: show: Tonen views: pagination: - first: - last: - next: - previous: - truncate: + first: ! '«' + last: ! '»' + next: ! '›' + previous: ! '‹' + truncate: ! '...' workgroups: edit: title: Werkgroep bewerken - error_last_admin_group: - error_last_admin_role: + error_last_admin_group: De laatste groep met admin-rechten mag niet verwijderd worden (anders kun je er niet meer in). + error_last_admin_role: Je kunt admin-privileges voor de laatste groep met admin-rechten niet weghalen (anders kun je er niet meer in). index: title: Werkgroepen update: diff --git a/config/routes.rb b/config/routes.rb index 3a0b0608..bd2a4a2b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,9 +86,14 @@ Foodsoft::Application.routes.draw do end resources :stock_articles, :to => 'stockit' do + get :copy collection do - get :articles_search - get :fill_new_stock_article_form + get :derive + + get :index_on_stock_article_create + get :index_on_stock_article_update + + get :show_on_stock_article_update end end @@ -96,15 +101,12 @@ Foodsoft::Application.routes.draw do get :shared_suppliers, :on => :collection resources :deliveries do - post :add_stock_change, :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 + collection do + post :add_stock_change + + get :form_on_stock_article_create + get :form_on_stock_article_update + end end resources :articles do diff --git a/doc/DEPLOYMENT.md b/doc/DEPLOYMENT.md index dad42aa3..bcdc1b39 100644 --- a/doc/DEPLOYMENT.md +++ b/doc/DEPLOYMENT.md @@ -4,20 +4,23 @@ Deployment Setup -------- - cp config/deploy.rb.SAMPLE config/deploy.rb - touch config/deploy/staging.rb - touch config/deploy/production.rb + cp config/deploy.rb.SAMPLE config/deploy.rb + touch config/deploy/staging.rb + touch config/deploy/production.rb Deploy -------- On your first deploy you should run - bundle exec cap deploy:setup - bundle exec cap deploy:check + + bundle exec cap deploy:setup + bundle exec cap deploy:check Deploy to staging - bundle exec cap deploy + + bundle exec cap deploy Deploy to production - bundle exec cap production deploy + + bundle exec cap production deploy diff --git a/doc/SETUP_DEVELOPMENT.md b/doc/SETUP_DEVELOPMENT.md index 9941c262..d2d51931 100644 --- a/doc/SETUP_DEVELOPMENT.md +++ b/doc/SETUP_DEVELOPMENT.md @@ -17,6 +17,9 @@ Getting started ``` git clone https://github.com/foodcoops/foodsoft.git ``` + This brings up the bleeding-edge development version, which might contain some + unfinished parts. If you want to be safe, choose the last release: + `git checkout $(git tag -l | grep ^v | sort -rn | head -n1)` 1. Install RVM and Ruby 1.9.3 (if you have not done so before): ``` diff --git a/doc/design_patterns/publish_subscribe.md b/doc/design_patterns/publish_subscribe.md new file mode 100644 index 00000000..eef6fa1d --- /dev/null +++ b/doc/design_patterns/publish_subscribe.md @@ -0,0 +1,40 @@ +# Publish/subscribe pattern +## Handling DOM updates after AJAX database manipulation + +As an example, let us consider the manipulation (create, update...) of `StockArticles`. This can be done in different views, e.g., `stock_articles/index`, `stock_articles/show` and `deliveries/_form` through modals using AJAX requests. As an advantage of the AJAX technique, the user does not need to reload the entire page. However, (after the update of the `StockArticle` in the database) it is generally required to update the DOM in the current view such that the page properly reacts to the asynchronous actions. + +The process can be divided in two steps: **1.** AJAX database manipulation and **2.** DOM updates for the particular view. The crucial point is the coupling of the two steps since the controller for the first step offers the same functionality to all views and does not need to know anything about the current view. + +### 1. AJAX database manipulation +**(i)** Example: current view `deliveries/_form` offers a link for the AJAX action `StockArticle#new`. This opens a modal filled with `stock_articles/_form`. + +**(ii)** AJAX form post addresses the `StockArticle#create` action which handles the database manipulation. + +**(iii)** The database manipulation is finished by the rendering of, e.g., `stock_articles/create.js.erb`. The key task there is to **publish** the database changes by calling `trigger`, i.e., + + $(document).trigger({ + type: 'StockArticle#create', + stock_article_id: <%= @stock_article.id %> + }); + +### 2. DOM updates for the particular view +**(i)** Each view has the opportunity to **subscribe** to particular events of the previous step. A very simple example is the update of the `stock_articles/index` view after `StockArticle#destroy`: + + $(document).on('StockArticle#destroy', function(e) { + $('#stockArticle-' + e.stock_article_id).remove(); + }); + +However, in most of the situations you will like to use the full power of the MVC framework in order to read new data from the database and render some partial. Let us consider this slightly more advanced case in the following. + +The view `stock_articles/index` could listen (amongst others) to `StockArticle#create` like this: + + $(document).on('StockArticle#create', function(e) { + $.ajax({ + url: '#{index_on_stock_article_create_stock_articles_path}', + type: 'get', + data: {id: e.stock_article_id}, + contentType: 'application/json; charset=UTF-8' + }); + }); + +**(ii)** The action `StockArticles#index_on_stock_article_create` is a special helper action to handle DOM updates of the `stock_articles/index` view after the creation of a new `StockArticle` with the given `id`. diff --git a/lib/foodsoft_wiki/app/controllers/pages_controller.rb b/lib/foodsoft_wiki/app/controllers/pages_controller.rb index e2190159..ed4598b4 100644 --- a/lib/foodsoft_wiki/app/controllers/pages_controller.rb +++ b/lib/foodsoft_wiki/app/controllers/pages_controller.rb @@ -51,7 +51,7 @@ class PagesController < ApplicationController end def create - @page = current_user.pages.build(params[:page]) + @page = Page.new(params[:page].merge({:user => current_user})) if params[:preview] render :action => 'new' diff --git a/lib/foodsoft_wiki/app/helpers/pages_helper.rb b/lib/foodsoft_wiki/app/helpers/pages_helper.rb index 09be29f0..552791f3 100644 --- a/lib/foodsoft_wiki/app/helpers/pages_helper.rb +++ b/lib/foodsoft_wiki/app/helpers/pages_helper.rb @@ -2,7 +2,8 @@ module PagesHelper include WikiCloth def wikified_body(body, title = nil) - WikiCloth.new({:data => body+"\n", :link_handler => Wikilink.new, :params => {:referer => title}}).to_html.html_safe + render_opts = {:locale => I18n.locale} # workaround for wikicloth 0.8.0 https://github.com/nricciar/wikicloth/pull/59 + WikiCloth.new({:data => body+"\n", :link_handler => Wikilink.new, :params => {:referer => title}}).to_html(render_opts).html_safe end def link_to_wikipage(page, text = nil) diff --git a/script/heroku_deploy b/script/heroku_deploy index e1e0326b..651a946f 100755 --- a/script/heroku_deploy +++ b/script/heroku_deploy @@ -108,6 +108,9 @@ gem 'localeapp'" >>Gemfile fi # TODO add more extensive database seed +# XXX don't use redis for now +echo "Resque.inline = true" >config/initializers/resque.rb + # and push = deploy git add -A git commit -q -m "heroku changes for environment ${RAILS_ENV}" -a diff --git a/spec/support/coverage.rb b/spec/support/coverage.rb index c67e3172..20bbdcf3 100644 --- a/spec/support/coverage.rb +++ b/spec/support/coverage.rb @@ -1,14 +1,26 @@ # optional test coverage # needs to be loaded first, e.g. add a require at top of spec_helper -if ENV['COVERAGE'] +if ENV['COVERAGE'] or ENV['COVERALLS'] require 'simplecov' + + # update coveralls.io on Travis CI + if ENV['COVERALLS'] + require 'coveralls' + SimpleCov.formatter = Coveralls::SimpleCov::Formatter + end + + # slightly tweaked coverage reporting + def cov_no_plugins(source_file, path) + source_file.filename =~ /#{path}/ and not source_file.filename =~ /\/lib\/foodsoft_.*\// + end SimpleCov.start do add_filter '/spec/' add_filter '/test/' - add_group 'Models', '/app/models/' - add_group 'Controllers', '/app/controllers/' - add_group 'Helpers', '/app/helpers/' - add_group 'Documents', '/app/documents/' - add_group 'Libraries', '/lib/' + add_group 'Models' do |s| cov_no_plugins s, '/app/models/' end + add_group 'Controllers' do |s| cov_no_plugins s, '/app/controllers/' end + add_group 'Helpers' do |s| cov_no_plugins s, '/app/helpers/' end + add_group 'Documents' do |s| cov_no_plugins s, '/app/documents/' end + add_group 'Libraries' do |s| cov_no_plugins s, '/lib/' end + add_group 'Plugins' do |s| s.filename =~ /\/lib\/foodsoft_.*\// end end end