Moved User.address-info into Ordergroup.contact_... attributes. Updated model-fixtures for testing.
This commit is contained in:
parent
aa47a24fda
commit
0a2a79237a
60 changed files with 466 additions and 443 deletions
|
|
@ -10,10 +10,8 @@ class Finance::TransactionsController < ApplicationController
|
|||
if params["sort"]
|
||||
sort = case params["sort"]
|
||||
when "name" then "name"
|
||||
when "size" then "actual_size"
|
||||
when "account_balance" then "account_balance"
|
||||
when "name_reverse" then "name DESC"
|
||||
when "size_reverse" then "actual_size DESC"
|
||||
when "account_balance_reverse" then "account_balance DESC"
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class HomeController < ApplicationController
|
|||
@user = @current_user
|
||||
@ordergroup = @user.ordergroup
|
||||
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
||||
@ordergroup_columns = ["description", "actual_size", "account_balance", "account_updated"]
|
||||
@ordergroup_columns = ["description", "account_balance", "account_updated"]
|
||||
|
||||
#listing the financial transactions with ajax...
|
||||
|
||||
|
|
|
|||
|
|
@ -117,4 +117,20 @@ module ApplicationHelper
|
|||
remote_options = {:before => "Element.show('loader')", :success => "Element.hide('loader')"}
|
||||
link_to_remote(text, remote_options.merge(options))
|
||||
end
|
||||
|
||||
def format_roles(record)
|
||||
roles = []
|
||||
roles << 'Admin' if record.role_admin?
|
||||
roles << 'Finanzen' if record.role_finance?
|
||||
roles << 'Lieferanten' if record.role_suppliers?
|
||||
roles << 'Artikel' if record.role_article_meta?
|
||||
roles << 'Bestellung' if record.role_orders?
|
||||
roles.join(', ')
|
||||
end
|
||||
|
||||
def link_to_gmaps(address)
|
||||
link_to h(address), "http://maps.google.de/?q=#{h(address)}", :title => "Show it on google maps",
|
||||
:target => "_blank"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,24 +3,24 @@
|
|||
#
|
||||
# Table name: articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# supplier_id :integer(4) default(0), not null
|
||||
# article_category_id :integer(4) default(0), not null
|
||||
# supplier_id :integer default(0), not null
|
||||
# article_category_id :integer default(0), not null
|
||||
# unit :string(255) default(""), not null
|
||||
# note :string(255)
|
||||
# availability :boolean(1) default(TRUE), not null
|
||||
# availability :boolean default(TRUE), not null
|
||||
# manufacturer :string(255)
|
||||
# origin :string(255)
|
||||
# shared_updated_on :datetime
|
||||
# price :decimal(8, 2)
|
||||
# price :decimal(, )
|
||||
# tax :float
|
||||
# deposit :decimal(8, 2) default(0.0)
|
||||
# unit_quantity :integer(4) default(1), not null
|
||||
# deposit :decimal(, ) default(0.0)
|
||||
# unit_quantity :integer default(1), not null
|
||||
# order_number :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# quantity :decimal(6, 2) default(0.0)
|
||||
# quantity :decimal(, ) default(0.0)
|
||||
# deleted_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: article_categories
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090120184410
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: article_prices
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# article_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# article_id :integer
|
||||
# price :decimal(8, 2) default(0.0), not null
|
||||
# tax :decimal(8, 2) default(0.0), not null
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# unit_quantity :integer(4)
|
||||
# unit_quantity :integer
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: assignments
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# user_id :integer(4) default(0), not null
|
||||
# task_id :integer(4) default(0), not null
|
||||
# accepted :boolean(1)
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer default(0), not null
|
||||
# task_id :integer default(0), not null
|
||||
# accepted :boolean
|
||||
#
|
||||
|
||||
class Assignment < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: deliveries
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivered_on :date
|
||||
# created_at :datetime
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090114101610
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: financial_transactions
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# ordergroup_id :integer(4) default(0), not null
|
||||
# id :integer not null, primary key
|
||||
# ordergroup_id :integer default(0), not null
|
||||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# note :text default(""), not null
|
||||
# user_id :integer(4) default(0), not null
|
||||
# note :text not null
|
||||
# user_id :integer default(0), not null
|
||||
# created_on :datetime not null
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -3,25 +3,27 @@
|
|||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# actual_size :integer(4)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_balance :decimal(, ) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean(1) not null
|
||||
# role_suppliers :boolean(1) not null
|
||||
# role_article_meta :boolean(1) not null
|
||||
# role_finance :boolean(1) not null
|
||||
# role_orders :boolean(1) not null
|
||||
# weekly_task :boolean(1)
|
||||
# weekday :integer(4)
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
#
|
||||
|
||||
# Groups organize the User.
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090120184410
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: group_orders
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# ordergroup_id :integer(4) default(0), not null
|
||||
# order_id :integer(4) default(0), not null
|
||||
# id :integer not null, primary key
|
||||
# ordergroup_id :integer default(0), not null
|
||||
# order_id :integer default(0), not null
|
||||
# price :decimal(8, 2) default(0.0), not null
|
||||
# lock_version :integer(4) default(0), not null
|
||||
# lock_version :integer default(0), not null
|
||||
# updated_on :datetime not null
|
||||
# updated_by_user_id :integer(4)
|
||||
# updated_by_user_id :integer
|
||||
#
|
||||
|
||||
# A GroupOrder represents an Order placed by an Ordergroup.
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: group_order_articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# group_order_id :integer(4) default(0), not null
|
||||
# order_article_id :integer(4) default(0), not null
|
||||
# quantity :integer(4) default(0), not null
|
||||
# tolerance :integer(4) default(0), not null
|
||||
# id :integer not null, primary key
|
||||
# group_order_id :integer default(0), not null
|
||||
# order_article_id :integer default(0), not null
|
||||
# quantity :integer default(0), not null
|
||||
# tolerance :integer default(0), not null
|
||||
# updated_on :datetime not null
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: group_order_article_quantities
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# group_order_article_id :integer(4) default(0), not null
|
||||
# quantity :integer(4) default(0)
|
||||
# tolerance :integer(4) default(0)
|
||||
# id :integer not null, primary key
|
||||
# group_order_article_id :integer default(0), not null
|
||||
# quantity :integer default(0)
|
||||
# tolerance :integer default(0)
|
||||
# created_on :datetime not null
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: invites
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# token :string(255) default(""), not null
|
||||
# expires_at :datetime not null
|
||||
# group_id :integer(4) default(0), not null
|
||||
# user_id :integer(4) default(0), not null
|
||||
# group_id :integer default(0), not null
|
||||
# user_id :integer default(0), not null
|
||||
# email :string(255) default(""), not null
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090120184410
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: invoices
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# delivery_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# delivery_id :integer
|
||||
# number :string(255)
|
||||
# date :date
|
||||
# paid_on :date
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
# amount :decimal(8, 2) default(0.0), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# order_id :integer(4)
|
||||
# order_id :integer
|
||||
# deposit :decimal(8, 2) default(0.0), not null
|
||||
# deposit_credit :decimal(8, 2) default(0.0), not null
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: memberships
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# group_id :integer(4) default(0), not null
|
||||
# user_id :integer(4) default(0), not null
|
||||
# id :integer not null, primary key
|
||||
# group_id :integer default(0), not null
|
||||
# user_id :integer default(0), not null
|
||||
#
|
||||
|
||||
class Membership < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090115232435
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: messages
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# sender_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# sender_id :integer
|
||||
# recipients_ids :text
|
||||
# subject :string(255) not null
|
||||
# body :text
|
||||
# email_state :integer(4) default(0), not null
|
||||
# private :boolean(1)
|
||||
# email_state :integer default(0), not null
|
||||
# private :boolean
|
||||
# created_at :datetime
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090120184410
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: orders
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# supplier_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# supplier_id :integer
|
||||
# note :text
|
||||
# starts :datetime
|
||||
# ends :datetime
|
||||
# state :string(255) default("open")
|
||||
# lock_version :integer(4) default(0), not null
|
||||
# updated_by_user_id :integer(4)
|
||||
# lock_version :integer default(0), not null
|
||||
# updated_by_user_id :integer
|
||||
#
|
||||
|
||||
class Order < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090120184410
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: order_articles
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_id :integer(4) default(0), not null
|
||||
# article_id :integer(4) default(0), not null
|
||||
# quantity :integer(4) default(0), not null
|
||||
# tolerance :integer(4) default(0), not null
|
||||
# units_to_order :integer(4) default(0), not null
|
||||
# lock_version :integer(4) default(0), not null
|
||||
# article_price_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# order_id :integer default(0), not null
|
||||
# article_id :integer default(0), not null
|
||||
# quantity :integer default(0), not null
|
||||
# tolerance :integer default(0), not null
|
||||
# units_to_order :integer default(0), not null
|
||||
# lock_version :integer default(0), not null
|
||||
# article_price_id :integer
|
||||
#
|
||||
|
||||
# An OrderArticle represents a single Article that is part of an Order.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090120184410
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: order_comments
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# order_id :integer(4)
|
||||
# user_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# order_id :integer
|
||||
# user_id :integer
|
||||
# text :text
|
||||
# created_at :datetime
|
||||
#
|
||||
|
|
|
|||
|
|
@ -3,25 +3,27 @@
|
|||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# actual_size :integer(4)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_balance :decimal(, ) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean(1) not null
|
||||
# role_suppliers :boolean(1) not null
|
||||
# role_article_meta :boolean(1) not null
|
||||
# role_finance :boolean(1) not null
|
||||
# role_orders :boolean(1) not null
|
||||
# weekly_task :boolean(1)
|
||||
# weekday :integer(4)
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
#
|
||||
|
||||
# Ordergroups can order, they are "children" of the class Group
|
||||
|
|
@ -29,7 +31,6 @@
|
|||
# Ordergroup have the following attributes, in addition to Group
|
||||
# * account_balance (decimal)
|
||||
# * account_updated (datetime)
|
||||
# * actual_size (int) : how many persons are ordering through the Ordergroup
|
||||
class Ordergroup < Group
|
||||
acts_as_paranoid # Avoid deleting the ordergroup for consistency of order-results
|
||||
extend ActiveSupport::Memoizable # Ability to cache method results. Use memoize :expensive_method
|
||||
|
|
@ -38,9 +39,11 @@ class Ordergroup < Group
|
|||
has_many :group_orders
|
||||
has_many :orders, :through => :group_orders
|
||||
|
||||
validates_inclusion_of :actual_size, :in => 1..99
|
||||
validates_numericality_of :account_balance, :message => 'ist keine gültige Zahl'
|
||||
|
||||
def contact
|
||||
"#{contact_phone} (#{contact_person})"
|
||||
end
|
||||
def non_members
|
||||
User.all(:order => 'nick').reject { |u| (users.include?(u) || u.ordergroup) }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090115232435
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: stock_changes
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# delivery_id :integer(4)
|
||||
# order_id :integer(4)
|
||||
# article_id :integer(4)
|
||||
# id :integer not null, primary key
|
||||
# delivery_id :integer
|
||||
# order_id :integer
|
||||
# article_id :integer
|
||||
# quantity :decimal(6, 2) default(0.0)
|
||||
# created_at :datetime
|
||||
#
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# Table name: suppliers
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# address :string(255) default(""), not null
|
||||
# phone :string(255) default(""), not null
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
# delivery_days :string(255)
|
||||
# order_howto :string(255)
|
||||
# note :string(255)
|
||||
# shared_supplier_id :integer(4)
|
||||
# shared_supplier_id :integer
|
||||
# min_order_quantity :string(255)
|
||||
# deleted_at :datetime
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090114101610
|
||||
# Schema version: 20090119155930
|
||||
#
|
||||
# Table name: tasks
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# due_date :date
|
||||
# done :boolean(1)
|
||||
# workgroup_id :integer(4)
|
||||
# assigned :boolean(1)
|
||||
# done :boolean
|
||||
# workgroup_id :integer
|
||||
# assigned :boolean
|
||||
# created_on :datetime not null
|
||||
# updated_on :datetime not null
|
||||
# required_users :integer(4) default(1)
|
||||
# required_users :integer default(1)
|
||||
#
|
||||
|
||||
class Task < ActiveRecord::Base
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090120184410
|
||||
#
|
||||
# Table name: users
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# nick :string(255) default(""), not null
|
||||
# password_hash :string(255) default(""), not null
|
||||
# password_salt :string(255) default(""), not null
|
||||
|
|
@ -11,7 +11,6 @@
|
|||
# last_name :string(255) default(""), not null
|
||||
# email :string(255) default(""), not null
|
||||
# phone :string(255)
|
||||
# address :string(255)
|
||||
# created_on :datetime not null
|
||||
# reset_password_token :string(255)
|
||||
# reset_password_expires :datetime
|
||||
|
|
@ -80,6 +79,13 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def name
|
||||
[first_name, last_name].join(" ")
|
||||
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
|
||||
|
|
@ -94,22 +100,6 @@ class User < ActiveRecord::Base
|
|||
Digest::SHA1.hexdigest(password + self.password_salt) == self.password_hash
|
||||
end
|
||||
|
||||
# # Sets the passwort, and if fails it returns error-messages (see above)
|
||||
# def set_password(options = {:required => false}, password = nil, confirmation = nil)
|
||||
# required = options[:required]
|
||||
# if required && (password.nil? || password.empty?)
|
||||
# self.errors.add_to_base 'Password is required'
|
||||
# elsif !password.nil? && !password.empty?
|
||||
# if password != confirmation
|
||||
# self.errors.add_to_base "Passwords doesn't match"
|
||||
# elsif password.length < 5 || password.length > 25
|
||||
# self.errors.add_to_base 'Password-length has to be between 5 and 25 characters'
|
||||
# else
|
||||
# self.password = password
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# Returns a random password.
|
||||
def new_random_password(size = 3)
|
||||
c = %w(b c d f g h j k l m n p qu r s t v w x z ch cr fr nd ng nk nt ph pr rd sh sl sp st th tr)
|
||||
|
|
|
|||
|
|
@ -3,25 +3,27 @@
|
|||
#
|
||||
# Table name: groups
|
||||
#
|
||||
# id :integer(4) not null, primary key
|
||||
# id :integer not null, primary key
|
||||
# type :string(255) default(""), not null
|
||||
# name :string(255) default(""), not null
|
||||
# description :string(255)
|
||||
# actual_size :integer(4)
|
||||
# account_balance :decimal(8, 2) default(0.0), not null
|
||||
# account_balance :decimal(, ) default(0.0), not null
|
||||
# account_updated :datetime
|
||||
# created_on :datetime not null
|
||||
# role_admin :boolean(1) not null
|
||||
# role_suppliers :boolean(1) not null
|
||||
# role_article_meta :boolean(1) not null
|
||||
# role_finance :boolean(1) not null
|
||||
# role_orders :boolean(1) not null
|
||||
# weekly_task :boolean(1)
|
||||
# weekday :integer(4)
|
||||
# role_admin :boolean not null
|
||||
# role_suppliers :boolean not null
|
||||
# role_article_meta :boolean not null
|
||||
# role_finance :boolean not null
|
||||
# role_orders :boolean not null
|
||||
# weekly_task :boolean
|
||||
# weekday :integer
|
||||
# task_name :string(255)
|
||||
# task_description :string(255)
|
||||
# task_required_users :integer(4) default(1)
|
||||
# task_required_users :integer default(1)
|
||||
# deleted_at :datetime
|
||||
# contact_person :string(255)
|
||||
# contact_phone :string(255)
|
||||
# contact_address :string(255)
|
||||
#
|
||||
|
||||
class Workgroup < Group
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
- for user in @users
|
||||
%tr{:class => cycle('even','odd', :name => 'users')}
|
||||
%td= link_to user.nick, [:admin, user]
|
||||
%td= [user.first_name, user.last_name].join(", ")
|
||||
%td=h user.name
|
||||
%td= format_date(user.created_on)
|
||||
%br/
|
||||
= link_to 'Alle Benutzerinnen', admin_users_path
|
||||
|
|
|
|||
|
|
@ -1,11 +1,18 @@
|
|||
- form_for [:admin, @ordergroup] do |@form|
|
||||
= render :partial => 'shared/group_form'
|
||||
|
||||
%div{:style => "float:left;width:55%;"}
|
||||
%p
|
||||
= @form.label :actual_size, "Aktuelle Gruppengröße"
|
||||
%br/
|
||||
= @form.text_field :actual_size, :size => 3
|
||||
- render :layout => 'shared/group_form' do
|
||||
%div{:style => "float:right;width:40%"}
|
||||
%p
|
||||
= @form.label :contact_person
|
||||
%br/
|
||||
= @form.text_field :contact_person, :size => 20
|
||||
%p
|
||||
= @form.label :contact_phone
|
||||
%br/
|
||||
= @form.text_field :contact_phone, :size => 20
|
||||
%p
|
||||
= @form.label :contact_address
|
||||
%br/
|
||||
= @form.text_field :contact_address
|
||||
|
||||
%br{ :style => "clear:both" }
|
||||
= submit_tag "Speichern"
|
||||
|
|
|
|||
|
|
@ -10,12 +10,16 @@
|
|||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Kontakt
|
||||
%th Adresse
|
||||
%th Mitglieder
|
||||
%th
|
||||
%tbody
|
||||
- for ordergroup in @ordergroups
|
||||
%tr{:class => cycle('even','odd', :name => 'groups')}
|
||||
%td= link_to ordergroup.name, [:admin, ordergroup]
|
||||
%td= ordergroup.contact
|
||||
%td= link_to_gmaps ordergroup.contact_address
|
||||
%td= ordergroup.users.size
|
||||
%td
|
||||
= link_to image_tag('b_users.png', :size => '16x16', :border => "0", :alt => 'Mitlglieder bearbeiten'), memberships_admin_ordergroup_path(ordergroup)
|
||||
|
|
|
|||
|
|
@ -9,30 +9,23 @@
|
|||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
%th= _('Username')
|
||||
%th= _('First name')
|
||||
%th= _('Last name')
|
||||
%th= _('Email')
|
||||
%th= _('Roles')
|
||||
%th= _('Last Login')
|
||||
%th Login
|
||||
%th Name
|
||||
%th Email
|
||||
%th Zugriff auf
|
||||
%th Letzter login
|
||||
%th{:style => "width:3em"}
|
||||
%tbody
|
||||
- for user in @users
|
||||
- roles = Array.new
|
||||
- roles << 'Admin' if user.role_admin?
|
||||
- roles << 'Finanzen' if user.role_finance?
|
||||
- roles << 'Lieferanten' if user.role_suppliers?
|
||||
- roles << 'Artikel' if user.role_article_meta?
|
||||
- roles << 'Bestellung' if user.role_orders?
|
||||
|
||||
%tr{:class => cycle('even','odd', :name => 'users')}
|
||||
%td= link_to user.nick, [:admin, user]
|
||||
%td=h user.first_name
|
||||
%td=h user.last_name
|
||||
%td=h user.name
|
||||
%td=h user.email
|
||||
%td=h roles.join(', ')
|
||||
%td=h format_roles(user)
|
||||
%td=h format_time(user.last_login)
|
||||
%td
|
||||
= link_to(image_tag('b_edit.png', :size => "16x16", :border => "0", :alt => 'Benutzer_in bearbeiten', :title => 'Benutzer_in bearbeiten'), edit_admin_user_path(user))
|
||||
= link_to(image_tag('b_drop.png', :size => "16x16", :border => "0", :alt => 'Benutzer_in löschen', :title => 'Benutzer_in löschen'), |
|
||||
[:admin, user], |
|
||||
:confirm => 'Willst du ' + user.first_name + ' wirklich löschen?', :method => :delete) |
|
||||
:confirm => 'Willst du ' + user.name + ' wirklich löschen?', :method => :delete) |
|
||||
|
|
|
|||
|
|
@ -10,10 +10,9 @@
|
|||
<div style="float:left;margin:5px; margin-right:10px;" class="box">
|
||||
<p><b>Person</b></p>
|
||||
<p><b>Nick:</b> <%=h @user.nick %></p>
|
||||
<p><b>Name:</b> <%=h @user.first_name + ' ' + @user.last_name %></p>
|
||||
<p><b>Name:</b> <%=h @user.name %></p>
|
||||
<p><b>Email:</b> <%=h @user.email %></p>
|
||||
<p><b>Telefon:</b> <%=h @user.phone %></p>
|
||||
<p><b>Adresse:</b> <%=h @user.address %></p>
|
||||
</div>
|
||||
<div style="float:left; margin:5px;" class="box">
|
||||
<p>
|
||||
|
|
@ -32,14 +31,8 @@
|
|||
<p>
|
||||
<b>Benutzer_in hat Zugriff auf:</b>
|
||||
</p>
|
||||
<% roles = Array.new
|
||||
roles << 'Admin' if @user.role_admin?
|
||||
roles << 'Finanzen' if @user.role_finance?
|
||||
roles << 'Lieferanten' if @user.role_suppliers?
|
||||
roles << 'Artikel' if @user.role_article_meta?
|
||||
roles << 'Bestellung' if @user.role_orders? %>
|
||||
<p>
|
||||
<%=h roles.join(', ') %>
|
||||
<%=h format_roles(@user) %>
|
||||
</p>
|
||||
</div>
|
||||
<p style="clear:both">
|
||||
|
|
|
|||
|
|
@ -11,14 +11,16 @@
|
|||
%tr
|
||||
%th Name
|
||||
%th Mitglieder
|
||||
%th Zugriff auf
|
||||
%th
|
||||
%tbody
|
||||
- for workgroup in @workgroups
|
||||
%tr{:class => cycle('even','odd', :name => 'groups')}
|
||||
%td= link_to workgroup.name, [:admin, workgroup]
|
||||
%td= workgroup.users.size
|
||||
%td= format_roles(workgroup)
|
||||
%td
|
||||
= link_to image_tag('b_users.png', :size => '16x16', :border => "0", :alt => 'Mitlglieder bearbeiten'), memberships_admin_workgroup_path(workgroup)
|
||||
= link_to(image_tag('b_edit.png', :size => "16x16", :border => "0", :alt => 'Gruppe bearbeiten'), edit_admin_workgroup_path(workgroup))
|
||||
= link_to(image_tag('b_drop.png', :size => "16x16", :border => "0", :alt => 'Gruppe löschen'), [:admin, workgroup], |
|
||||
:confirm => 'Willst du ' + workgroup.name + ' wirklich löschen?', :method => :delete) |
|
||||
:confirm => 'Willst du ' + workgroup.name + ' wirklich löschen?', :method => :delete) |
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@
|
|||
%thead
|
||||
%tr
|
||||
%th= sort_link_helper _("Name"), "name", @per_page
|
||||
%th= sort_link_helper _("Size of group"), "size", @per_page
|
||||
%th Kontakt
|
||||
%th= sort_link_helper _("Account balance"), "account_balance", @per_page
|
||||
%th
|
||||
%tbody
|
||||
- for group in @groups
|
||||
%tr{:class => cycle('even','odd', :name => 'groups')}
|
||||
%td= group.name
|
||||
%td= group.actual_size
|
||||
%td= group.contact
|
||||
%td{:class => "currency", :style => "width:5em"}= number_to_currency(group.account_balance)
|
||||
%td{:class => "actions"}
|
||||
= link_to image_tag("euro_new.png", :size => "16x16", :alt => _("New transaction"), :border => "0"), {:action => 'new', :id => group}, {:title => _("New transaction")}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@
|
|||
= render :partial => "ordergroups"
|
||||
%br/
|
||||
- if @current_user.role_admin?
|
||||
= link_to _("New ordergroup"), :controller => 'admin', :action => 'newOrdergroup'
|
||||
= link_to "Neue Bestellgruppe anlegen", new_admin_ordergroup_path
|
||||
|
|
@ -11,8 +11,7 @@
|
|||
%thead
|
||||
%tr
|
||||
%th Nick
|
||||
%th Vorname
|
||||
%th Nachname
|
||||
%th Name
|
||||
%th Email
|
||||
%th Telefon
|
||||
%th Bestellgruppe
|
||||
|
|
@ -20,14 +19,10 @@
|
|||
%tbody
|
||||
- for user in @users
|
||||
%tr{:class => cycle('even','odd', :name => 'users')}
|
||||
- groups = user.groups
|
||||
- ordergroup = groups.detect { |group| group.is_a?(Ordergroup) }
|
||||
- workgroups = groups.select { |group| !group.is_a?(Ordergroup) }.collect(&:name)
|
||||
%td= link_to user.nick, {:controller => "messages", :action => "user", :id => user}, :title => _('Send user an email')
|
||||
%td=h user.first_name if @current_user.role_admin? || user.settings["profile.nameIsPublic"] == '1'
|
||||
%td=h user.last_name if @current_user.role_admin? || user.settings["profile.nameIsPublic"] == '1'
|
||||
%td=h user.name if @current_user.role_admin? || user.settings["profile.nameIsPublic"] == '1'
|
||||
%td=h user.email if @current_user.role_admin? || user.settings["profile.emailIsPublic"] == '1'
|
||||
%td=h user.phone if @current_user.role_admin? || user.settings["profile.phoneIsPublic"] == '1'
|
||||
%td=h ordergroup.name if ordergroup
|
||||
%td=h workgroups.join(', ')
|
||||
%td=h user.ordergroup_name
|
||||
%td=h groups.select { |group| !group.is_a?(Ordergroup) }.collect(&:name).join(', ')
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
<p><b>Beschreibung:</b> <%=h @ordergroup.description %>
|
||||
<%= link_to '(ändern)', :controller => 'foodcoop', :action => 'edit_group', :id => @ordergroup %>
|
||||
</p>
|
||||
<p><b>Gruppengröße:</b> <%=h @ordergroup.actual_size %></p>
|
||||
<p><b>Kontostand:</b> <%= number_to_currency(@ordergroup.account_balance) %></p>
|
||||
<h2>Personen</h2>
|
||||
<ul style="list-style-type:decimal;">
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@
|
|||
Telefon
|
||||
%br/
|
||||
= form.text_field :phone
|
||||
%p
|
||||
Adresse
|
||||
%br/
|
||||
= form.text_field :address
|
||||
%p
|
||||
Passwort
|
||||
%br/
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
%tr
|
||||
%td Beschreibung:
|
||||
%td=h group.description
|
||||
- if @current_user.role_admin? or @current_user.role_finance?
|
||||
%tr
|
||||
%td Kontakt:
|
||||
%td=h group.contact
|
||||
%tr
|
||||
%td Adresse:
|
||||
%td= link_to_gmaps group.contact_address
|
||||
%tr
|
||||
%td Gruppe hat Zugriff auf:
|
||||
%td
|
||||
- roles = Array.new
|
||||
- roles << 'Administration' if group.role_admin?
|
||||
- roles << 'Finanzen' if group.role_finance?
|
||||
- roles << 'Lieferanten' if group.role_suppliers?
|
||||
- roles << 'Artikel' if group.role_article_meta?
|
||||
- roles << 'Bestellungsverwaltung' if group.role_orders?
|
||||
= roles.join(', ')
|
||||
%td= format_roles(group)
|
||||
%tr
|
||||
%td Mitglieder:
|
||||
%td
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@
|
|||
<td><%= @form.label :phone %></td>
|
||||
<td><%= @form.text_field :phone %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= @form.label :address %></td>
|
||||
<td><%= @form.text_field :address %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td/>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue