diff --git a/app/controllers/finance/transactions_controller.rb b/app/controllers/finance/transactions_controller.rb index 01f5bca3..01e4e820 100644 --- a/app/controllers/finance/transactions_controller.rb +++ b/app/controllers/finance/transactions_controller.rb @@ -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 diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 0c3d0ba0..ee24faa6 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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... diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 665c6a5c..1b3c0392 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/models/article.rb b/app/models/article.rb index 2432d141..98e8f49d 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -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 # diff --git a/app/models/article_category.rb b/app/models/article_category.rb index 5b8ac32f..d61ee3be 100644 --- a/app/models/article_category.rb +++ b/app/models/article_category.rb @@ -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) # diff --git a/app/models/article_price.rb b/app/models/article_price.rb index d951b880..fee2d160 100644 --- a/app/models/article_price.rb +++ b/app/models/article_price.rb @@ -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 # diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 326888d5..b5113f49 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -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 diff --git a/app/models/delivery.rb b/app/models/delivery.rb index 5103f49d..8e75147b 100644 --- a/app/models/delivery.rb +++ b/app/models/delivery.rb @@ -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 # diff --git a/app/models/financial_transaction.rb b/app/models/financial_transaction.rb index 08616245..12acd177 100644 --- a/app/models/financial_transaction.rb +++ b/app/models/financial_transaction.rb @@ -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 # diff --git a/app/models/group.rb b/app/models/group.rb index 9dd619c6..7a25c313 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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. diff --git a/app/models/group_order.rb b/app/models/group_order.rb index 3b860de5..3a21439c 100644 --- a/app/models/group_order.rb +++ b/app/models/group_order.rb @@ -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. diff --git a/app/models/group_order_article.rb b/app/models/group_order_article.rb index 215bab9c..b5a39e63 100644 --- a/app/models/group_order_article.rb +++ b/app/models/group_order_article.rb @@ -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 # diff --git a/app/models/group_order_article_quantity.rb b/app/models/group_order_article_quantity.rb index 178bb613..53bbcca4 100644 --- a/app/models/group_order_article_quantity.rb +++ b/app/models/group_order_article_quantity.rb @@ -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 # diff --git a/app/models/invite.rb b/app/models/invite.rb index 2797cc90..588dfeb7 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -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 # diff --git a/app/models/invoice.rb b/app/models/invoice.rb index e18f18c1..261499a2 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -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 # diff --git a/app/models/membership.rb b/app/models/membership.rb index 456a8670..343ced61 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -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 diff --git a/app/models/message.rb b/app/models/message.rb index 5304afb8..5e987028 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -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 # diff --git a/app/models/order.rb b/app/models/order.rb index 501ebbb7..9e72a3ee 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -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 diff --git a/app/models/order_article.rb b/app/models/order_article.rb index 86576dd5..aaaffd56 100644 --- a/app/models/order_article.rb +++ b/app/models/order_article.rb @@ -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. diff --git a/app/models/order_comment.rb b/app/models/order_comment.rb index 73d6d557..200a6872 100644 --- a/app/models/order_comment.rb +++ b/app/models/order_comment.rb @@ -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 # diff --git a/app/models/ordergroup.rb b/app/models/ordergroup.rb index edcdef41..56ad433f 100644 --- a/app/models/ordergroup.rb +++ b/app/models/ordergroup.rb @@ -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 diff --git a/app/models/stock_change.rb b/app/models/stock_change.rb index 087d0044..54f34746 100644 --- a/app/models/stock_change.rb +++ b/app/models/stock_change.rb @@ -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 # diff --git a/app/models/supplier.rb b/app/models/supplier.rb index 2c90f3e6..f61f49cf 100644 --- a/app/models/supplier.rb +++ b/app/models/supplier.rb @@ -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 # diff --git a/app/models/task.rb b/app/models/task.rb index 2c1d07a5..8b1bceb2 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index a595d082..a7f40735 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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) diff --git a/app/models/workgroup.rb b/app/models/workgroup.rb index 53c06dc5..56d0e897 100644 --- a/app/models/workgroup.rb +++ b/app/models/workgroup.rb @@ -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 diff --git a/app/views/admin/index.html.haml b/app/views/admin/index.html.haml index a4342a37..f3b9fa47 100644 --- a/app/views/admin/index.html.haml +++ b/app/views/admin/index.html.haml @@ -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 diff --git a/app/views/admin/ordergroups/_form.html.haml b/app/views/admin/ordergroups/_form.html.haml index 319a714a..f39a1e4d 100644 --- a/app/views/admin/ordergroups/_form.html.haml +++ b/app/views/admin/ordergroups/_form.html.haml @@ -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" diff --git a/app/views/admin/ordergroups/_ordergroups.html.haml b/app/views/admin/ordergroups/_ordergroups.html.haml index e918d826..d12042d3 100644 --- a/app/views/admin/ordergroups/_ordergroups.html.haml +++ b/app/views/admin/ordergroups/_ordergroups.html.haml @@ -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) diff --git a/app/views/admin/users/_users.html.haml b/app/views/admin/users/_users.html.haml index 740b8628..de7e371e 100644 --- a/app/views/admin/users/_users.html.haml +++ b/app/views/admin/users/_users.html.haml @@ -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) | \ No newline at end of file + :confirm => 'Willst du ' + user.name + ' wirklich löschen?', :method => :delete) | diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index 6866ce6d..ceb4d5de 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -10,10 +10,9 @@

Person

Nick: <%=h @user.nick %>

-

Name: <%=h @user.first_name + ' ' + @user.last_name %>

+

Name: <%=h @user.name %>

Email: <%=h @user.email %>

Telefon: <%=h @user.phone %>

-

Adresse: <%=h @user.address %>

@@ -32,14 +31,8 @@

Benutzer_in hat Zugriff auf:

- <% 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? %>

- <%=h roles.join(', ') %> + <%=h format_roles(@user) %>

diff --git a/app/views/admin/workgroups/_workgroups.html.haml b/app/views/admin/workgroups/_workgroups.html.haml index 29ff545f..1b279d59 100644 --- a/app/views/admin/workgroups/_workgroups.html.haml +++ b/app/views/admin/workgroups/_workgroups.html.haml @@ -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) | \ No newline at end of file + :confirm => 'Willst du ' + workgroup.name + ' wirklich löschen?', :method => :delete) | diff --git a/app/views/finance/transactions/_ordergroups.html.haml b/app/views/finance/transactions/_ordergroups.html.haml index 61317a20..9e424151 100644 --- a/app/views/finance/transactions/_ordergroups.html.haml +++ b/app/views/finance/transactions/_ordergroups.html.haml @@ -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")} diff --git a/app/views/finance/transactions/index.html.haml b/app/views/finance/transactions/index.html.haml index 57ce3c48..c2d2e7e9 100644 --- a/app/views/finance/transactions/index.html.haml +++ b/app/views/finance/transactions/index.html.haml @@ -23,4 +23,4 @@ = render :partial => "ordergroups" %br/ - if @current_user.role_admin? - = link_to _("New ordergroup"), :controller => 'admin', :action => 'newOrdergroup' \ No newline at end of file + = link_to "Neue Bestellgruppe anlegen", new_admin_ordergroup_path \ No newline at end of file diff --git a/app/views/foodcoop/_users.html.haml b/app/views/foodcoop/_users.html.haml index 5c3ca61f..924706f6 100644 --- a/app/views/foodcoop/_users.html.haml +++ b/app/views/foodcoop/_users.html.haml @@ -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(', ') diff --git a/app/views/home/ordergroup.html.erb b/app/views/home/ordergroup.html.erb index 16f70def..95b483a1 100644 --- a/app/views/home/ordergroup.html.erb +++ b/app/views/home/ordergroup.html.erb @@ -5,7 +5,6 @@

Beschreibung: <%=h @ordergroup.description %> <%= link_to '(ändern)', :controller => 'foodcoop', :action => 'edit_group', :id => @ordergroup %>

-

Gruppengröße: <%=h @ordergroup.actual_size %>

Kontostand: <%= number_to_currency(@ordergroup.account_balance) %>

Personen