Merge branch 'rails3' of http://github.com/bennibu/foodsoft into rails3
Conflicts: app/helpers/application_helper.rb
This commit is contained in:
commit
524819b86f
12 changed files with 73 additions and 50 deletions
3
Gemfile
3
Gemfile
|
@ -53,4 +53,7 @@ group :development do
|
|||
# Re-enable rails benchmarker/profiler
|
||||
gem 'ruby-prof'
|
||||
gem 'test-unit'
|
||||
|
||||
# Get infos when not using proper eager loading
|
||||
gem 'bullet'
|
||||
end
|
||||
|
|
|
@ -57,6 +57,8 @@ GEM
|
|||
erubis (>= 2.7.0)
|
||||
binding_of_caller (0.6.8)
|
||||
builder (3.0.4)
|
||||
bullet (4.3.0)
|
||||
uniform_notifier
|
||||
chronic (0.9.0)
|
||||
client_side_validations (3.1.4)
|
||||
coderay (1.0.8)
|
||||
|
@ -205,6 +207,7 @@ GEM
|
|||
uglifier (1.3.0)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
uniform_notifier (1.1.1)
|
||||
vegas (0.1.11)
|
||||
rack (>= 1.0.0)
|
||||
whenever (0.8.1)
|
||||
|
@ -223,6 +226,7 @@ DEPENDENCIES
|
|||
acts_as_versioned!
|
||||
better_errors
|
||||
binding_of_caller
|
||||
bullet
|
||||
client_side_validations
|
||||
coffee-rails (~> 3.2.1)
|
||||
daemons
|
||||
|
|
|
@ -157,13 +157,13 @@ function updateBalance() {
|
|||
var bgcolor = '';
|
||||
if (balance < 0) {
|
||||
bgcolor = '#FF0000';
|
||||
$('#submit_button').disabled = true;
|
||||
$('#submit_button').attr('disabled', 'disabled')
|
||||
} else {
|
||||
$('#submit_button').disabled = false;
|
||||
$('#submit_button').removeAttr('disabled')
|
||||
}
|
||||
// update bgcolor
|
||||
for (i in itemTotal) {
|
||||
$('#ltd_price_' + i).css('background-color', bgcolor);
|
||||
$('#td_price_' + i).css('background-color', bgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,8 @@ module ApplicationHelper
|
|||
# offers a link for writing message to user
|
||||
# checks for nil (useful for relations)
|
||||
def link_to_user_message_if_valid(user)
|
||||
user.nil? ? '??' : ( link_to user.nick, new_message_path(:message => {:mail_to => user.id}), :title => 'Nachricht schreiben' )
|
||||
user.nil? ? '??' : link_to(user.nick, new_message_path('message[mail_to]' => user.id),
|
||||
:title => 'Nachricht schreiben')
|
||||
end
|
||||
|
||||
def bootstrap_flash
|
||||
|
|
|
@ -38,20 +38,23 @@ class GroupOrder < ActiveRecord::Base
|
|||
|
||||
# load prices and other stuff....
|
||||
data[:order_articles] = {}
|
||||
order.order_articles.each do |order_article|
|
||||
data[:order_articles][order_article.id] = {
|
||||
:price => order_article.article.fc_price,
|
||||
:unit => order_article.article.unit_quantity,
|
||||
:quantity => (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:others_quantity => order_article.quantity - (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:used_quantity => (new_record? ? 0 : goas[order_article.id][:quantity_result]),
|
||||
:tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:others_tolerance => order_article.tolerance - (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:used_tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance_result]),
|
||||
:total_price => (new_record? ? 0 : goas[order_article.id][:total_price]),
|
||||
:missing_units => order_article.missing_units,
|
||||
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
|
||||
}
|
||||
#order.order_articles.each do |order_article|
|
||||
order.articles_grouped_by_category.each do |article_category, order_articles|
|
||||
order_articles.each do |order_article|
|
||||
data[:order_articles][order_article.id] = {
|
||||
:price => order_article.article.fc_price,
|
||||
:unit => order_article.article.unit_quantity,
|
||||
:quantity => (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:others_quantity => order_article.quantity - (new_record? ? 0 : goas[order_article.id][:quantity]),
|
||||
:used_quantity => (new_record? ? 0 : goas[order_article.id][:quantity_result]),
|
||||
:tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:others_tolerance => order_article.tolerance - (new_record? ? 0 : goas[order_article.id][:tolerance]),
|
||||
:used_tolerance => (new_record? ? 0 : goas[order_article.id][:tolerance_result]),
|
||||
:total_price => (new_record? ? 0 : goas[order_article.id][:total_price]),
|
||||
:missing_units => order_article.missing_units,
|
||||
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
data
|
||||
|
|
|
@ -82,9 +82,10 @@ class Order < ActiveRecord::Base
|
|||
# The array has the following form:
|
||||
# e.g: [["drugs",[teethpaste, toiletpaper]], ["fruits" => [apple, banana, lemon]]]
|
||||
def articles_grouped_by_category
|
||||
order_articles.includes([:article_price, :group_order_articles, :article => :article_category]).
|
||||
@articles_grouped_by_category ||= order_articles.
|
||||
includes([:article_price, :group_order_articles, :article => :article_category]).
|
||||
order('articles.name').
|
||||
group_by { |a| a.article.article_category.name }.
|
||||
group_by { |a| a.article.article_category.name }.
|
||||
sort { |a, b| a[0] <=> b[0] }
|
||||
end
|
||||
|
||||
|
|
|
@ -12,31 +12,34 @@
|
|||
})
|
||||
});
|
||||
|
||||
.row-fluid
|
||||
.span6
|
||||
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
||||
= f.hidden_field :supplier_id
|
||||
#stock_changes
|
||||
= f.fields_for :stock_changes do |stock_change_form|
|
||||
%p
|
||||
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
|
||||
Menge
|
||||
= stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
|
||||
= stock_change_form.hidden_field :_destroy
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", class: 'destroy_stock_change'
|
||||
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
||||
= f.hidden_field :supplier_id
|
||||
#stock_changes
|
||||
= f.fields_for :stock_changes do |stock_change_form|
|
||||
%p
|
||||
= link_to "Lagerartikel der Lieferung hinzufügen", {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
|
||||
%hr/
|
||||
= f.input :delivered_on, as: :date_picker
|
||||
= f.input :note, input_html: {size: '35x4'}
|
||||
.form-actions
|
||||
= f.submit class: 'btn btn-primary'
|
||||
= link_to "oder abbrechen", supplier_deliveries_path(@supplier)
|
||||
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
|
||||
Menge
|
||||
= stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
|
||||
= stock_change_form.hidden_field :_destroy
|
||||
= link_to "Artikel aus Lieferung entfernen", "#", class: 'destroy_stock_change'
|
||||
%p
|
||||
= link_to "Lagerartikel der Lieferung hinzufügen", {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
|
||||
%p
|
||||
%small
|
||||
Ist ein Artikel noch nicht in der Lagerverwaltung, muss er erst
|
||||
#{link_to("neu angelegt", new_stock_article_path)} werden.
|
||||
%hr/
|
||||
= f.input :delivered_on, as: :date_picker
|
||||
= f.input :note, input_html: {size: '35x4'}
|
||||
.form-actions
|
||||
= f.submit class: 'btn btn-primary'
|
||||
= link_to "oder abbrechen", supplier_deliveries_path(@supplier)
|
||||
|
||||
/
|
||||
TODO: Fix this!!
|
||||
.span6
|
||||
%h2 Neuen Lagerartikel anlegen
|
||||
%p
|
||||
//TODO: Fix this!!
|
||||
Suche nach Artikeln aus dem
|
||||
%i= @supplier.name
|
||||
Katalog:
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
%td Neuer Kontostand:
|
||||
%td.currency
|
||||
%strong
|
||||
%span#new_balance= @ordergroup.account_balance - @group_order.price
|
||||
%span#new_balance= @ordering_data[:available_funds] - @group_order.price
|
||||
€
|
||||
#order-button
|
||||
= submit_tag( "Bestellung speichern", id: 'submit_button', class: 'btn btn-primary' )
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
%li= link_to "Nicht verfügbare Artikel zeigen/verstecken", "#", 'data-toggle-this' => 'tr.unavailable,input.unavailable', tabindex: -1
|
||||
|
||||
.btn-group
|
||||
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn btn-primary'
|
||||
= link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", new_order_path(supplier_id: 0),
|
||||
class: 'btn'
|
||||
class: 'btn', class: 'btn btn-primary'
|
||||
= link_to "Neuen Lagerartikel anlegen", new_stock_article_path, class: 'btn'
|
||||
= link_to "Inventur anlegen", new_stock_taking_path, class: 'btn'
|
||||
= link_to "Inventurübersicht", stock_takings_path, class: 'btn'
|
||||
= link_to 'Löschvorschläge', stock_article_selections_path, class: 'btn'
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
})
|
||||
|
||||
|
||||
%p
|
||||
/
|
||||
TODO: Fix this
|
||||
%p
|
||||
Suche nach Artikeln aus allen Katalogen:
|
||||
= text_field_tag 'article_search'
|
||||
#stock_article_form
|
||||
|
|
6
config/initializers/bullet.rb
Normal file
6
config/initializers/bullet.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
if defined? Bullet
|
||||
Bullet.enable = true
|
||||
# Bullet.alert = true
|
||||
Bullet.bullet_logger = true
|
||||
Bullet.console = true
|
||||
end
|
|
@ -7,7 +7,7 @@ SimpleNavigation::Configuration.run do |navigation|
|
|||
|
||||
primary.item :dashboard_nav_item, 'Dashboard', root_path(anchor: '')
|
||||
|
||||
primary.item :foodcoop, 'Foodcoop', '#' do |subnav|
|
||||
primary.item :foodcoop, 'Foodcoop', '#', id: nil do |subnav|
|
||||
subnav.item :members, 'Mitglieder', foodcoop_users_path, id: nil
|
||||
subnav.item :workgroups, 'Arbeitsgruppen', foodcoop_workgroups_path, id: nil
|
||||
subnav.item :ordergroups, 'Bestellgruppen', foodcoop_ordergroups_path, id: nil
|
||||
|
@ -15,32 +15,32 @@ SimpleNavigation::Configuration.run do |navigation|
|
|||
subnav.item :tasks, 'Aufgaben', tasks_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :wiki, 'Wiki', '#' do |subnav|
|
||||
primary.item :wiki, 'Wiki', '#', id: nil do |subnav|
|
||||
subnav.item :wiki_home, 'Startseite', wiki_path, id: nil
|
||||
subnav.item :all_pages, 'Alle Seiten', all_pages_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :orders, 'Bestellungen', '#' do |subnav|
|
||||
primary.item :orders, 'Bestellungen', '#', id: nil do |subnav|
|
||||
subnav.item :ordering, 'Bestellen!', group_orders_path, id: nil
|
||||
subnav.item :ordering_archive, 'Meine Bestellungen', archive_group_orders_path, id: nil
|
||||
subnav.item :orders, 'Bestellverwaltung', orders_path, if: Proc.new { current_user.role_orders? }, id: nil
|
||||
end
|
||||
|
||||
primary.item :articles, 'Artikel', '#',
|
||||
primary.item :articles, 'Artikel', '#', id: nil,
|
||||
if: Proc.new { current_user.role_article_meta? or current_user.role_suppliers? } do |subnav|
|
||||
subnav.item :suppliers, 'Lieferanten/Artikel', suppliers_path, id: nil
|
||||
subnav.item :stockit, 'Lager', stock_articles_path, id: nil
|
||||
subnav.item :categories, 'Kategorien', article_categories_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :finance, 'Finanzen', '#', if: Proc.new { current_user.role_finance? } do |subnav|
|
||||
primary.item :finance, 'Finanzen', '#', id: nil, if: Proc.new { current_user.role_finance? } do |subnav|
|
||||
subnav.item :finance_home, 'Übersicht', finance_root_path
|
||||
subnav.item :accounts, 'Konten verwalten', finance_ordergroups_path, id: nil
|
||||
subnav.item :balancing, 'Bestellungen abrechnen', finance_order_index_path, id: nil
|
||||
subnav.item :invoices, 'Rechnungen', finance_invoices_path, id: nil
|
||||
end
|
||||
|
||||
primary.item :admin, 'Administration', '#', if: Proc.new { current_user.role_admin? } do |subnav|
|
||||
primary.item :admin, 'Administration', '#', id: nil, if: Proc.new { current_user.role_admin? } do |subnav|
|
||||
subnav.item :admin_home, 'Übersicht', admin_root_path
|
||||
subnav.item :users, 'Benutzerinnen', admin_users_path, id: nil
|
||||
subnav.item :ordergroups, 'Bestellgruppen', admin_ordergroups_path, id: nil
|
||||
|
|
Loading…
Reference in a new issue