Merge branch 'rails3' of http://github.com/bennibu/foodsoft into rails3

Conflicts:
	app/helpers/application_helper.rb
This commit is contained in:
Julius 2013-01-27 22:01:53 +01:00
commit 524819b86f
12 changed files with 73 additions and 50 deletions

View file

@ -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

View file

@ -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

View file

@ -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);
}
}

View file

@ -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

View file

@ -38,7 +38,9 @@ class GroupOrder < ActiveRecord::Base
# load prices and other stuff....
data[:order_articles] = {}
order.order_articles.each do |order_article|
#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,
@ -53,6 +55,7 @@ class GroupOrder < ActiveRecord::Base
:quantity_available => (order.stockit? ? order_article.article.quantity_available : 0)
}
end
end
data
end

View file

@ -82,7 +82,8 @@ 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 }.
sort { |a, b| a[0] <=> b[0] }

View file

@ -12,9 +12,7 @@
})
});
.row-fluid
.span6
= simple_form_for [@supplier, @delivery], validate: true do |f|
= 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|
@ -26,6 +24,10 @@
= 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'}
@ -33,10 +35,11 @@
= 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:

View file

@ -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' )

View file

@ -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'

View file

@ -13,7 +13,9 @@
})
%p
/
TODO: Fix this
%p
Suche nach Artikeln aus allen Katalogen:
= text_field_tag 'article_search'
#stock_article_form

View file

@ -0,0 +1,6 @@
if defined? Bullet
Bullet.enable = true
# Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
end

View file

@ -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