Merge branch 'master' into master-to-rails3
Conflicts: Gemfile README_DEVEL app/controllers/articles_controller.rb app/controllers/orders_controller.rb app/controllers/tasks_controller.rb app/models/task.rb app/views/articles/_import_search_results.haml app/views/articles/index.haml app/views/messages/new.haml app/views/ordering/_order_head.haml app/views/ordering/my_order_result.haml app/views/orders/show.haml app/views/stockit/new.html.haml db/schema.rb
This commit is contained in:
commit
0edd29dfd4
15 changed files with 44 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@ nbproject/
|
|||
config/environments/development.rb
|
||||
capfile
|
||||
*.swp
|
||||
*~
|
||||
public/**/*_cached.*
|
||||
.idea
|
||||
.get-dump.yml
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -1,5 +1,6 @@
|
|||
# A sample Gemfile
|
||||
source "https://rubygems.org"
|
||||
ruby "1.9.3"
|
||||
|
||||
gem "rails", '3.2.9'
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ With this, you also get a ready to go user with username 'admin' and password 's
|
|||
(7) Try it out!
|
||||
---------------
|
||||
Start the WEBrick server to try it out:
|
||||
|
||||
|
||||
bundle exec rails s
|
||||
|
||||
|
||||
|
|
|
@ -37,8 +37,7 @@ class TasksController < ApplicationController
|
|||
def update
|
||||
@task = Task.find(params[:id])
|
||||
@task.attributes=(params[:task])
|
||||
if @task.errors.empty?
|
||||
@task.save
|
||||
if @task.errors.empty? && @task.save
|
||||
flash[:notice] = "Aufgabe wurde aktualisiert"
|
||||
if @task.workgroup
|
||||
redirect_to workgroup_tasks_url(workgroup_id: @task.workgroup_id)
|
||||
|
|
|
@ -138,6 +138,12 @@ module ApplicationHelper
|
|||
link_to h(address), "http://maps.google.de/?q=#{h(address)}", :title => "Show it on google maps",
|
||||
:target => "_blank"
|
||||
end
|
||||
|
||||
# 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, user_message_path(user), :title => 'Nachricht schreiben' )
|
||||
end
|
||||
|
||||
def bootstrap_flash
|
||||
flash_messages = []
|
||||
|
|
|
@ -12,13 +12,17 @@ class Order < ActiveRecord::Base
|
|||
has_many :comments, :class_name => "OrderComment", :order => "created_at"
|
||||
has_many :stock_changes
|
||||
belongs_to :supplier
|
||||
belongs_to :updated_by, :class_name => "User", :foreign_key => "updated_by_user_id"
|
||||
belongs_to :updated_by, :class_name => 'User', :foreign_key => 'updated_by_user_id'
|
||||
belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by_user_id'
|
||||
|
||||
# Validations
|
||||
validates_presence_of :starts
|
||||
validate :starts_before_ends, :include_articles
|
||||
|
||||
# Callbacks
|
||||
before_create do |order|
|
||||
order.created_by = User.current_user
|
||||
end
|
||||
after_update :update_price_of_group_orders
|
||||
after_save :save_order_articles
|
||||
|
||||
|
|
|
@ -8,8 +8,5 @@ class SharedSupplier < ActiveRecord::Base
|
|||
has_one :supplier
|
||||
has_many :shared_articles, :foreign_key => :supplier_id
|
||||
|
||||
# save the lists as an array
|
||||
serialize :lists
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -59,9 +59,10 @@ class Task < ActiveRecord::Base
|
|||
|
||||
# Get users from comma seperated ids
|
||||
# and makes the users responsible for the task
|
||||
# TODO: check for maximal number of users
|
||||
def user_list=(ids)
|
||||
list = ids.split(",")
|
||||
new_users = list - users.collect(&:id)
|
||||
new_users = (list - users.collect(&:id)).uniq
|
||||
old_users = users.reject { |user| list.include?(user.id) }
|
||||
|
||||
logger.debug "[debug] New users: #{new_users}"
|
||||
|
|
|
@ -17,6 +17,7 @@ class User < ActiveRecord::Base
|
|||
has_many :tasks, :through => :assignments
|
||||
has_many :send_messages, :class_name => "Message", :foreign_key => "sender_id"
|
||||
has_many :pages, :foreign_key => 'updated_by'
|
||||
has_many :created_orders, :class_name => 'Order', :foreign_key => 'created_by_user_id', :dependent => :nullify
|
||||
|
||||
attr_accessor :password, :setting_attributes
|
||||
|
||||
|
@ -79,10 +80,6 @@ class User < ActiveRecord::Base
|
|||
def receive_email?
|
||||
settings['messages.sendAsEmail'] == "1" && email.present?
|
||||
end
|
||||
|
||||
def ordergroup_name
|
||||
ordergroup.name if ordergroup
|
||||
end
|
||||
|
||||
# Sets the user's password. It will be stored encrypted along with a random salt.
|
||||
def set_password
|
||||
|
|
|
@ -45,4 +45,4 @@
|
|||
|
||||
= form_tag update_selected_supplier_articles_path(@supplier), id: "articlesInListForm",
|
||||
'data-submit-onchange' => true do
|
||||
#table= render 'articles'
|
||||
#table= render 'articles'
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
- unless @order.note.blank?
|
||||
%dt Notiz
|
||||
%dd= @order.note
|
||||
%dt Erstellt von
|
||||
%dd= link_to_user_message_if_valid(@order.created_by)
|
||||
%dt Ende
|
||||
%dd= format_time(@order.ends)
|
||||
- unless @order.stockit? or @order.supplier.min_order_quantity.blank?
|
||||
|
|
|
@ -32,8 +32,12 @@
|
|||
%small{:style => "color:grey"}
|
||||
Eventuell musst Du Dich dem Verteiler erst bekannt machen.
|
||||
%br/
|
||||
z.b. mit einer Mail an
|
||||
= mail_to FoodsoftConfig[:mailing_list_subscribe]
|
||||
- if Foodsoft.config[:mailing_list_subscribe].blank?
|
||||
Erklärungen zum Verteiler findest Du im
|
||||
= link_to 'Wiki (Abschnitt Mailing-Liste)', wiki_page_path('MailingListe')
|
||||
- else
|
||||
z.b. mit einer Mail an
|
||||
= mail_to Foodsoft.config[:mailing_list_subscribe]
|
||||
|
||||
#recipients
|
||||
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
%dl.dl-horizontal
|
||||
%dt Lieferantin
|
||||
%dd= @order.name
|
||||
%dt Notiz
|
||||
%dd= @order.note
|
||||
- if @note.present?
|
||||
%dt Notiz
|
||||
%dd= @order.note
|
||||
%dt Erstellt von
|
||||
%dd= link_to_user_message_if_valid(@order.created_by)
|
||||
%dt Beginn
|
||||
%dd= format_time(@order.starts)
|
||||
%dt Ende
|
||||
%dd= format_time(@order.ends)
|
||||
%dt Gruppenbestellungen:
|
||||
%dd
|
||||
= @order.group_orders.count
|
||||
= "[#{@order.group_orders.includes(:ordergroup).all.collect{|g| g.ordergroup.name}.join(', ')}]"
|
||||
|
||||
%dd #{@order.group_orders.count} (#{@order.group_orders.includes(:ordergroup).all.map {|g| g.ordergroup.name}.join(', ')})
|
||||
%dt Netto/Bruttosumme aller Artikel:
|
||||
%dd= "#{number_to_currency(@order.sum(:net))} / #{number_to_currency(@order.sum(:gross))}"
|
||||
%dt Bestellte Artikel:
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class AddCreatedByUserIdToOrders < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :orders, :created_by_user_id, :integer
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :orders, :created_by_user_id
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120929155541) do
|
||||
ActiveRecord::Schema.define(:version => 20121112093327) do
|
||||
|
||||
create_table "article_categories", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
|
@ -253,6 +253,7 @@ ActiveRecord::Schema.define(:version => 20120929155541) do
|
|||
t.integer "lock_version", :default => 0, :null => false
|
||||
t.integer "updated_by_user_id"
|
||||
t.decimal "foodcoop_result", :precision => 8, :scale => 2
|
||||
t.integer "created_by_user_id"
|
||||
end
|
||||
|
||||
add_index "orders", ["state"], :name => "index_orders_on_state"
|
||||
|
|
Loading…
Reference in a new issue