Replaced IndexController by Home- and FoodcoopController. Some reorganizing in groups/memberships-logic (moved memberships out of admin-namespace).
This commit is contained in:
parent
fadc951208
commit
6ce6c2c75a
70 changed files with 553 additions and 934 deletions
|
@ -113,6 +113,20 @@ class ApplicationController < ActionController::Base
|
|||
authenticate('orders')
|
||||
end
|
||||
|
||||
# checks if the current_user is member of given group.
|
||||
# if fails the user will redirected to startpage
|
||||
def authenticate_membership_or_admin
|
||||
@group = Group.find(params[:id])
|
||||
unless @group.member?(@current_user) or @current_user.role_admin?
|
||||
flash[:error] = ERROR_NO_GROUP_MEMBER
|
||||
if request.xml_http_request?
|
||||
render(:update) {|page| page.redirect_to root_path }
|
||||
else
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Stores this controller instance as a thread local varibale to be accessible from outside ActionController/ActionView.
|
||||
def store_controller
|
||||
Thread.current[:application_controller] = self
|
||||
|
|
|
@ -23,15 +23,12 @@ class Finance::TransactionsController < ApplicationController
|
|||
conditions = "name LIKE '%#{params[:query]}%'" unless params[:query].nil?
|
||||
|
||||
@total = Ordergroup.count(:conditions => conditions)
|
||||
@groups = Ordergroup.paginate :conditions => conditions, :page => params[:page], :per_page => @per_page, :order => sort
|
||||
@groups = Ordergroup.paginate :conditions => conditions, :page => params[:page],
|
||||
:per_page => @per_page, :order => sort
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js do
|
||||
render :update do |page|
|
||||
page.replace_html 'table', :partial => "ordergroups"
|
||||
end
|
||||
end
|
||||
format.js { render :partial => "ordergroups" }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,17 +51,15 @@ class Finance::TransactionsController < ApplicationController
|
|||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||
|
||||
@total = @group.financial_transactions.count(:conditions => conditions)
|
||||
@financial_transactions = @group.financial_transactions.paginate(:page => params[:page],
|
||||
:per_page => 10,
|
||||
:conditions => conditions,
|
||||
:order => sort)
|
||||
@financial_transactions = @group.financial_transactions.paginate(
|
||||
:page => params[:page],
|
||||
:per_page => 10,
|
||||
:conditions => conditions,
|
||||
:order => sort)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js do
|
||||
render :update do |page|
|
||||
page.replace_html 'table', :partial => "list"
|
||||
end
|
||||
end
|
||||
format.js { render :partial => "list" }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
67
app/controllers/foodcoop_controller.rb
Normal file
67
app/controllers/foodcoop_controller.rb
Normal file
|
@ -0,0 +1,67 @@
|
|||
class FoodcoopController < ApplicationController
|
||||
|
||||
before_filter :authenticate_membership_or_admin,
|
||||
:only => [:edit_group, :update_group, :memberships, :invite, :send_invitation]
|
||||
|
||||
# gives a view to list all members of the foodcoop
|
||||
def members
|
||||
|
||||
# sort by ordergroups
|
||||
if params[:sort_by_ordergroups]
|
||||
@users = []
|
||||
Ordergroup.find(:all, :order => "name").each do |group|
|
||||
group.users.each do |user|
|
||||
@users << user
|
||||
end
|
||||
end
|
||||
@total = @users.size
|
||||
else
|
||||
# sort by nick, thats default
|
||||
if (params[:per_page] && params[:per_page].to_i > 0 && params[:per_page].to_i <= 100)
|
||||
@per_page = params[:per_page].to_i
|
||||
else
|
||||
@per_page = 20
|
||||
end
|
||||
|
||||
# if somebody uses the search field:
|
||||
conditions = "first_name LIKE '%#{params[:query]}%' OR last_name LIKE '%#{params[:query]}%'" unless params[:query].blank?
|
||||
|
||||
@total = User.count(:conditions => conditions)
|
||||
@users = User.paginate(:page => params[:page], :per_page => @per_page, :conditions => conditions, :order => "nick", :include => "groups")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js { render :partial => "users" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# gives an overview for the workgroups and its members
|
||||
def workgroups
|
||||
@groups = Workgroup.find :all, :order => "name"
|
||||
end
|
||||
|
||||
def group
|
||||
end
|
||||
|
||||
def edit_group
|
||||
end
|
||||
|
||||
def memberships
|
||||
end
|
||||
|
||||
# Invites a new user to join foodsoft in this group.
|
||||
def invite
|
||||
@invite = Invite.new
|
||||
end
|
||||
# Sends an email
|
||||
def send_invitation
|
||||
@invite = Invite.new(:user => @current_user, :group => @group, :email => params[:invite][:email])
|
||||
if @invite.save
|
||||
flash[:notice] = format('Es wurde eine Einladung an %s geschickt.', @invite.email)
|
||||
redirect_to(:action => 'index')
|
||||
else
|
||||
render :action => 'invite'
|
||||
end
|
||||
end
|
||||
end
|
86
app/controllers/home_controller.rb
Normal file
86
app/controllers/home_controller.rb
Normal file
|
@ -0,0 +1,86 @@
|
|||
class HomeController < ApplicationController
|
||||
|
||||
def index
|
||||
@currentOrders = Order.find_current
|
||||
@orderGroup = @current_user.find_ordergroup
|
||||
if @orderGroup
|
||||
@financial_transactions = @orderGroup.financial_transactions.find(:all, :order => 'created_on desc', :limit => 3)
|
||||
end
|
||||
# unread messages
|
||||
@messages = Message.find_all_by_recipient_id_and_read(@current_user.id, false, :order => 'messages.created_on desc', :include => :sender)
|
||||
# unaccepted tasks
|
||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
||||
# task in next week
|
||||
@next_tasks = @current_user.next_tasks
|
||||
|
||||
# count tasks with no responsible person
|
||||
# tasks for groups the current user is not a member are ignored
|
||||
tasks = Task.find(:all, :conditions => ["assigned = ? and done = ?", false, false])
|
||||
@unassigned_tasks_number = 0
|
||||
for task in tasks
|
||||
(@unassigned_tasks_number += 1) unless task.workgroup && !current_user.is_member_of(task.workgroup)
|
||||
end
|
||||
end
|
||||
|
||||
def profile
|
||||
@user = @current_user
|
||||
end
|
||||
|
||||
def update_profile
|
||||
@user = @current_user
|
||||
if @user.update_attributes(params[:user])
|
||||
flash[:notice] = 'Änderungen wurden gespeichert.'
|
||||
redirect_to :action => 'profile'
|
||||
else
|
||||
render :action => 'profile'
|
||||
end
|
||||
end
|
||||
|
||||
def ordergroup
|
||||
@user = @current_user
|
||||
@ordergroup = @user.find_ordergroup
|
||||
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
||||
@ordergroup_columns = ["description", "actual_size", "account_balance", "account_updated"]
|
||||
|
||||
#listing the financial transactions with ajax...
|
||||
|
||||
if params['sort']
|
||||
sort = case params['sort']
|
||||
when "date" then "created_on"
|
||||
when "note" then "note"
|
||||
when "amount" then "amount"
|
||||
when "date_reverse" then "created_on DESC"
|
||||
when "note_reverse" then "note DESC"
|
||||
when "amount_reverse" then "amount DESC"
|
||||
end
|
||||
else
|
||||
sort = "created_on DESC"
|
||||
end
|
||||
|
||||
# or if somebody uses the search field:
|
||||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||
|
||||
@total = @ordergroup.financial_transactions.count(:conditions => conditions)
|
||||
@financial_transactions = @ordergroup.financial_transactions.paginate(:page => params[:page],
|
||||
:per_page => 10,
|
||||
:conditions => conditions,
|
||||
:order => sort)
|
||||
respond_to do |format|
|
||||
format.html # myOrdergroup.haml
|
||||
format.js { render :partial => "finance/transactions/list" }
|
||||
end
|
||||
end
|
||||
|
||||
# cancel personal memberships direct from the myProfile-page
|
||||
def cancel_membership
|
||||
membership = Membership.find(params[:membership_id])
|
||||
if membership.user == current_user
|
||||
membership.destroy
|
||||
flash[:notice] = "Du bist jetzt kein Mitglied der Gruppe #{@group.name} mehr."
|
||||
else
|
||||
flash[:error] = "Ein Problem ist aufgetreten."
|
||||
end
|
||||
redirect_to my_profile_path
|
||||
end
|
||||
|
||||
end
|
|
@ -1,261 +0,0 @@
|
|||
class IndexController < ApplicationController
|
||||
# Messages
|
||||
MSG_USER_UPDATED = 'Benutzeränderungen wurden gespeichert'
|
||||
ERROR_NO_GROUP_MEMBER = 'Du bist kein Gruppenmitglied.'
|
||||
MSG_GROUP_UPDATED = 'Gruppe wurde erfolgreich bearbeitet'
|
||||
ERR_LAST_MEMBER = "Eine Benutzerin muss der Bestellgruppe erhalten bleiben"
|
||||
MSG_MEMBERSHIP_ENDS = 'Du bist nun nicht mehr Mitglied der Gruppe '
|
||||
ERR_CANNOT_INVITE = 'Du kannst niemanden in diese Gruppe einladen.'
|
||||
MSG_INVITE_SUCCESS = 'Es wurde eine Einladung an %s geschickt.'
|
||||
|
||||
def index
|
||||
@currentOrders = Order.find_current
|
||||
@orderGroup = @current_user.find_ordergroup
|
||||
if @orderGroup
|
||||
@financial_transactions = @orderGroup.financial_transactions.find(:all, :order => 'created_on desc', :limit => 3)
|
||||
end
|
||||
# unread messages
|
||||
@messages = Message.find_all_by_recipient_id_and_read(@current_user.id, false, :order => 'messages.created_on desc', :include => :sender)
|
||||
# unaccepted tasks
|
||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
||||
# task in next week
|
||||
@next_tasks = @current_user.next_tasks
|
||||
|
||||
# count tasks with no responsible person
|
||||
# tasks for groups the current user is not a member are ignored
|
||||
tasks = Task.find(:all, :conditions => ["assigned = ? and done = ?", false, false])
|
||||
@unassigned_tasks_number = 0
|
||||
for task in tasks
|
||||
(@unassigned_tasks_number += 1) unless task.group && !current_user.is_member_of(task.group)
|
||||
end
|
||||
end
|
||||
|
||||
def myProfile
|
||||
@user = @current_user
|
||||
@user_columns = ["first_name", "last_name", "email", "phone", "address"]
|
||||
end
|
||||
|
||||
def editProfile
|
||||
@user = @current_user
|
||||
end
|
||||
|
||||
def updateProfile
|
||||
@user = @current_user
|
||||
@user.set_password({:required => false}, params[:user][:password], params[:user][:password_confirmation])
|
||||
@user.attributes = params[:user]
|
||||
for setting in User::setting_keys.keys
|
||||
@user.settings[setting] = (params[:user][:settings] && params[:user][:settings][setting] == '1' ? '1' : nil)
|
||||
end
|
||||
if @user.errors.empty? && @user.save
|
||||
flash[:notice] = MSG_USER_UPDATED
|
||||
redirect_to :action => 'myProfile'
|
||||
else
|
||||
render :action => 'editProfile'
|
||||
end
|
||||
end
|
||||
|
||||
def myOrdergroup
|
||||
@user = @current_user
|
||||
@ordergroup = @user.find_ordergroup
|
||||
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
||||
@ordergroup_columns = ["description", "actual_size", "account_balance", "account_updated"]
|
||||
|
||||
#listing the financial transactions with ajax...
|
||||
|
||||
if params['sort']
|
||||
sort = case params['sort']
|
||||
when "date" then "created_on"
|
||||
when "note" then "note"
|
||||
when "amount" then "amount"
|
||||
when "date_reverse" then "created_on DESC"
|
||||
when "note_reverse" then "note DESC"
|
||||
when "amount_reverse" then "amount DESC"
|
||||
end
|
||||
else
|
||||
sort = "created_on DESC"
|
||||
end
|
||||
|
||||
# or if somebody uses the search field:
|
||||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||
|
||||
@total = @ordergroup.financial_transactions.count(:conditions => conditions)
|
||||
@financial_transactions = @ordergroup.financial_transactions.paginate(:page => params[:page],
|
||||
:per_page => 10,
|
||||
:conditions => conditions,
|
||||
:order => sort)
|
||||
respond_to do |format|
|
||||
format.html # myOrdergroup.haml
|
||||
format.js do
|
||||
render :update do |page|
|
||||
page.replace_html 'table', :partial => "financial_transactions/list"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def showGroup
|
||||
@user = @current_user
|
||||
@group = Group.find(params[:id])
|
||||
end
|
||||
|
||||
def showUser
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
||||
def editGroup
|
||||
@group = Group.find(params[:id])
|
||||
authenticate_membership(@group)
|
||||
# unless @group.member?(@current_user)
|
||||
# flash[:error] = ERROR_NO_GROUP_MEMBER
|
||||
# redirect_to :action => 'index'
|
||||
# end
|
||||
end
|
||||
|
||||
# update the Group
|
||||
# only access to description for Ordergroups
|
||||
def updateGroup
|
||||
@group = Group.find(params[:id])
|
||||
authenticate_membership(@group)
|
||||
if @group.is_a?(Ordergroup)
|
||||
@group.update_attribute(:description, params[:group][:description])
|
||||
else
|
||||
@group.update_attributes(params[:group])
|
||||
end
|
||||
if @group.errors.empty?
|
||||
flash[:notice] = MSG_GROUP_UPDATED
|
||||
redirect_to :action => 'showGroup', :id => @group
|
||||
else
|
||||
render :action => 'editGroup'
|
||||
end
|
||||
end
|
||||
|
||||
def members
|
||||
@group = Group.find(params[:id])
|
||||
authenticate_membership(@group)
|
||||
end
|
||||
|
||||
# adds a new member to the group
|
||||
def addMember
|
||||
@group = Group.find(params[:id])
|
||||
authenticate_membership(@group)
|
||||
user = User.find(params[:user])
|
||||
Membership.create(:group => @group, :user => user)
|
||||
redirect_to :action => 'memberships_reload', :id => @group
|
||||
end
|
||||
|
||||
# the membership will find an end....
|
||||
def dropMember
|
||||
begin
|
||||
group = Group.find(params[:group])
|
||||
authenticate_membership(group)
|
||||
membership = Membership.find(params[:membership])
|
||||
if group.is_a?(Ordergroup) && group.memberships.size == 1
|
||||
# Deny dropping member if the group is an Ordergroup and there is only one member left.
|
||||
flash[:error] = ERR_LAST_MEMBER
|
||||
else
|
||||
membership.destroy
|
||||
end
|
||||
redirect_to :action => 'memberships_reload', :id => group
|
||||
rescue => error
|
||||
flash[:error] = error.to_s
|
||||
redirect_to :action => 'memberships_reload', :id => group
|
||||
end
|
||||
end
|
||||
|
||||
# the two boxes 'members' and 'non members' will be reload through ajax
|
||||
def memberships_reload
|
||||
@group = Group.find(params[:id])
|
||||
unless @group.member?(@current_user)
|
||||
flash[:error] = ERROR_NO_GROUP_MEMBER
|
||||
render(:update) {|page| page.redirect_to :action => "myProfile"}
|
||||
else
|
||||
render :update do |page|
|
||||
page.replace_html 'members', :partial => 'groups/members', :object => @group
|
||||
page.replace_html 'non_members', :partial => 'groups/non_members', :object => @group
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# checks if the current_user is member of given group.
|
||||
# if fails the user will redirected to startpage
|
||||
# method used while group/memberships beeing edit
|
||||
def authenticate_membership(group)
|
||||
unless group.member?(@current_user)
|
||||
flash[:error] = ERROR_NO_GROUP_MEMBER
|
||||
if request.xml_http_request?
|
||||
render(:update) {|page| page.redirect_to :action => "index"}
|
||||
else
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# gives a view to list all members of the foodcoop
|
||||
def foodcoop_members
|
||||
|
||||
# sort by ordergroups
|
||||
if params[:sort_by_ordergroups]
|
||||
@users = []
|
||||
Ordergroup.find(:all, :order => "name").each do |group|
|
||||
group.users.each do |user|
|
||||
@users << user
|
||||
end
|
||||
end
|
||||
@total = @users.size
|
||||
else
|
||||
# sort by nick, thats default
|
||||
if (params[:per_page] && params[:per_page].to_i > 0 && params[:per_page].to_i <= 100)
|
||||
@per_page = params[:per_page].to_i
|
||||
else
|
||||
@per_page = 20
|
||||
end
|
||||
|
||||
# if somebody uses the search field:
|
||||
conditions = "first_name LIKE '%#{params[:query]}%' OR last_name LIKE '%#{params[:query]}%'" unless params[:query].blank?
|
||||
|
||||
@total = User.count(:conditions => conditions)
|
||||
@users = User.paginate(:page => params[:page], :per_page => @per_page, :conditions => conditions, :order => "nick", :include => "groups")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js do
|
||||
render :update do |page|
|
||||
page.replace_html 'user_table', :partial => "list_members"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# gives an overview for the workgroups and its members
|
||||
def workgroups
|
||||
@groups = Group.find :all, :conditions => "type != 'Ordergroup'", :order => "name"
|
||||
end
|
||||
|
||||
# Invites a new user to join foodsoft in this group.
|
||||
def invite
|
||||
@group = Group.find(params[:id])
|
||||
if (!@group || (!@current_user.is_member_of(@group) && !@current_user.role_admin?))
|
||||
flash[:error] = ERR_CANNOT_INVITE
|
||||
redirect_to(:action => "index")
|
||||
elsif (request.post?)
|
||||
@invite = Invite.new(:user => @current_user, :group => @group, :email => params[:invite][:email])
|
||||
if @invite.save
|
||||
flash[:notice] = format(MSG_INVITE_SUCCESS, @invite.email)
|
||||
redirect_to(:action => 'index')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# cancel personal memberships direct from the myProfile-page
|
||||
def cancel_membership
|
||||
membership = Membership.find(params[:id])
|
||||
if membership.user == current_user
|
||||
membership.destroy
|
||||
flash[:notice] = _("The membership was cancelled.")
|
||||
else
|
||||
flash[:error] = _("You are not allowed to cancel this membership")
|
||||
end
|
||||
redirect_to my_profile_path
|
||||
end
|
||||
end
|
|
@ -1,4 +1,5 @@
|
|||
class Admin::MembershipsController < ApplicationController
|
||||
class MembershipsController < ApplicationController
|
||||
before_filter :authenticate_membership_or_admin
|
||||
|
||||
def add_member
|
||||
@group = Group.find(params[:group_id])
|
||||
|
@ -27,8 +28,8 @@ class Admin::MembershipsController < ApplicationController
|
|||
def reload
|
||||
@group = Group.find(params[:group_id])
|
||||
render :update do |page|
|
||||
page.replace_html 'members', :partial => 'members', :object => @group
|
||||
page.replace_html 'non_members', :partial => 'non_members', :object => @group
|
||||
page.replace_html 'members', :partial => 'shared/memberships/current_members', :object => @group
|
||||
page.replace_html 'non_members', :partial => 'shared/memberships/non_members', :object => @group
|
||||
end
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@ class TasksController < ApplicationController
|
|||
#auto_complete_for :user, :nick
|
||||
|
||||
def index
|
||||
@non_group_tasks = Task.find :all, :conditions => "group_id IS NULL AND done = 0", :order => "due_date ASC"
|
||||
@non_group_tasks = Task.non_group
|
||||
@groups = Group.find :all, :conditions => "type != 'Ordergroup'"
|
||||
end
|
||||
|
||||
|
@ -28,8 +28,8 @@ class TasksController < ApplicationController
|
|||
if @task.errors.empty?
|
||||
@task.save
|
||||
flash[:notice] = "Aufgabe wurde erstellt"
|
||||
if @task.group
|
||||
redirect_to :action => "workgroup", :id => @task.group
|
||||
if @task.workgroup
|
||||
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||
else
|
||||
redirect_to :action => "index"
|
||||
end
|
||||
|
@ -52,8 +52,8 @@ class TasksController < ApplicationController
|
|||
if @task.errors.empty?
|
||||
@task.save
|
||||
flash[:notice] = "Aufgabe wurde aktualisiert"
|
||||
if @task.group
|
||||
redirect_to :action => "workgroup", :id => @task.group
|
||||
if @task.workgroup
|
||||
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||
else
|
||||
redirect_to :action => "index"
|
||||
end
|
||||
|
|
2
app/helpers/foodcoop_helper.rb
Normal file
2
app/helpers/foodcoop_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module FoodcoopHelper
|
||||
end
|
2
app/helpers/home_helper.rb
Normal file
2
app/helpers/home_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module HomeHelper
|
||||
end
|
|
@ -18,17 +18,14 @@ class Invite < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
belongs_to :group
|
||||
|
||||
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => 'ist keine gültige Email-Adresse'
|
||||
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
||||
validates_presence_of :user
|
||||
validates_presence_of :group
|
||||
validates_presence_of :token
|
||||
validates_presence_of :expires_at
|
||||
|
||||
attr_accessible :email, :user, :group
|
||||
|
||||
# messages
|
||||
ERR_EMAIL_IN_USE = 'ist bereits in Verwendung'
|
||||
|
||||
|
||||
protected
|
||||
|
||||
# Before validation, set token and expires_at.
|
||||
|
@ -46,7 +43,9 @@ class Invite < ActiveRecord::Base
|
|||
|
||||
# Custom validation: check that email does not already belong to a registered user.
|
||||
def validate_on_create
|
||||
errors.add(:email, ERR_EMAIL_IN_USE) unless User.find_by_email(self.email).nil?
|
||||
unless User.find_by_email(self.email).nil?
|
||||
errors.add(:email, 'ist bereits in Verwendung. Person ist schon Mitglied der Foodcoop.')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090114101610
|
||||
#
|
||||
# Table name: tasks
|
||||
#
|
||||
|
@ -8,7 +8,7 @@
|
|||
# description :string(255)
|
||||
# due_date :date
|
||||
# done :boolean(1)
|
||||
# group_id :integer(4)
|
||||
# workgroup_id :integer(4)
|
||||
# assigned :boolean(1)
|
||||
# created_on :datetime not null
|
||||
# updated_on :datetime not null
|
||||
|
@ -18,7 +18,9 @@
|
|||
class Task < ActiveRecord::Base
|
||||
has_many :assignments, :dependent => :destroy
|
||||
has_many :users, :through => :assignments
|
||||
belongs_to :group
|
||||
belongs_to :workgroup
|
||||
|
||||
named_scope :non_group, :conditions => { :workgroup_id => nil, :done => false }, :order => "due_date ASC"
|
||||
|
||||
# form will send user in string. responsibilities will added later
|
||||
attr_protected :users
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<% for user in @users %>
|
||||
<tr class="<%= cycle('even','odd', :name => 'users') %>">
|
||||
<td><%= link_to user.nick, :action => 'showUser', :id => user.id %></td>
|
||||
<td><%= link_to user.nick, [:admin, user] %></td>
|
||||
<td><%= user.first_name %> <%= user.last_name %></td>
|
||||
<td><%= format_date(user.created_on) %></td>
|
||||
</tr>
|
||||
|
@ -36,8 +36,8 @@
|
|||
</tr>
|
||||
<% for group in @groups %>
|
||||
<tr class="<%= cycle('even','odd', :name => 'groups') %>">
|
||||
<td><%= link_to group.name, :action => 'showGroup', :id => group %></td>
|
||||
<td><%= group.is_a?(Ordergroup) ? 'Bestellgruppe' : 'Gruppe' %></td>
|
||||
<td><%= link_to group.name, [:admin, group] %></td>
|
||||
<td><%= group.class.human_name %></td>
|
||||
<td><%= group.users.size %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<h1>Mitglieder von <%=h @group.name %></h1>
|
||||
<p>
|
||||
<i>Hier kannst Du die Mitglieder der Gruppe verwalten.</i>
|
||||
</p>
|
||||
<div class="left_column" style="width:48%">
|
||||
<div class="box_title">
|
||||
<h2>Sind schon Mitglieder</h2>
|
||||
</div>
|
||||
<div class="column_content" id="members">
|
||||
<%=render :partial => 'admin/memberships/members' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right_column" style="width:48%">
|
||||
<div class="box_title">
|
||||
<h2>Sind noch keine Mitglieder</h2>
|
||||
</div>
|
||||
<div class="column_content" id="non_members">
|
||||
<%= render :partial => 'admin/memberships/non_members' %>
|
||||
<%= link_to('Person einladen', :controller =>'index', :action => 'invite', :id => @group) if (@current_user.is_member_of(@group) || @current_user.role_admin?) %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,44 +1,12 @@
|
|||
- form_for [:admin, @ordergroup] do |@form|
|
||||
= @form.error_messages
|
||||
|
||||
= render :partial => 'shared/group_form'
|
||||
|
||||
%div{:style => "float:left;width:55%;"}
|
||||
%p
|
||||
= @form.label :name
|
||||
%br/
|
||||
= @form.text_field :name, :size => 20
|
||||
%p
|
||||
= @form.label :description
|
||||
%br/
|
||||
= @form.text_field :description, :size => 40
|
||||
%p
|
||||
= @form.label :actual_size, "Aktuelle Gruppengröße"
|
||||
%br/
|
||||
= @form.text_field :actual_size, :size => 3
|
||||
|
||||
%div{:style => "float:right;width:40%"}
|
||||
%h3 Gruppe hat Zugriff auf
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_admin, "Administration"
|
||||
%td= @form.check_box :role_admin
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_finance, "Finanzen"
|
||||
%td= @form.check_box :role_finance
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_suppliers, "Lieferantenverwaltung"
|
||||
%td= @form.check_box :role_suppliers
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_article_meta, "Artikelverwaltung"
|
||||
%td= @form.check_box :role_article_meta
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_orders, "Bestellungsverwaltung"
|
||||
%td= @form.check_box :role_orders
|
||||
|
||||
%br{ :style => "clear:both" }
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
= render :partial => 'admin/memberships/edit_members'
|
||||
= render :partial => 'shared/memberships/members'
|
||||
%p{ :style => "clear:both" }
|
||||
= link_to 'Gruppenübersicht', admin_ordergroups_path
|
|
@ -1,42 +1,15 @@
|
|||
- title "Arbeitsgruppe #{@ordergroup.name}"
|
||||
- title "Bestellgruppe #{@ordergroup.name}"
|
||||
.left_column{:style => "width:45em"}
|
||||
.box_title
|
||||
%h2 Übersicht
|
||||
.column_content
|
||||
= render :partial => 'shared/group', :locals => { :group => @ordergroup }
|
||||
%p
|
||||
%b Beschreibung:
|
||||
=h @ordergroup.description
|
||||
%p
|
||||
%b Gruppe hat Zugriff auf:
|
||||
- roles = Array.new
|
||||
- roles << 'Administration' if @ordergroup.role_admin?
|
||||
- roles << 'Finanzen' if @ordergroup.role_finance?
|
||||
- roles << 'Lieferanten' if @ordergroup.role_suppliers?
|
||||
- roles << 'Artikel' if @ordergroup.role_article_meta?
|
||||
- roles << 'Bestellungsverwaltung' if @ordergroup.role_orders?
|
||||
=h roles.join(', ')
|
||||
%p
|
||||
- if @ordergroup.weekly_task
|
||||
%b wöchentlicher Job:
|
||||
=h @ordergroup.task_name
|
||||
am
|
||||
= weekday(@ordergroup.weekday)
|
||||
- else
|
||||
kein wöchentlicher Job definiert
|
||||
|
||||
= link_to 'Gruppe bearbeiten', edit_admin_ordergroup_path(@ordergroup)
|
||||
|
|
||||
= link_to 'Löschen', [:admin, @ordergroup], :confirm => 'Bist Du sicher?', :method => :delete
|
||||
|
|
||||
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @ordergroup
|
||||
.box_title
|
||||
%h2 Mitglieder
|
||||
.column_content
|
||||
- if @ordergroup.memberships.empty?
|
||||
%i Diese Gruppe hat derzeit keine Mitglieder
|
||||
- else
|
||||
%ul{:style => "list-style-type:decimal;"}
|
||||
- for membership in @ordergroup.memberships
|
||||
%li= link_to membership.user.nick, [:admin, membership.user]
|
||||
%p= link_to 'Mitglieder bearbeiten', memberships_admin_ordergroup_path(@ordergroup)
|
||||
= link_to 'Gruppe bearbeiten', edit_admin_ordergroup_path(@ordergroup)
|
||||
|
|
||||
= link_to 'Löschen', [:admin, @ordergroup], :confirm => 'Bist Du sicher?', :method => :delete
|
||||
|
|
||||
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @ordergroup
|
||||
|
|
||||
= link_to 'Mitglieder bearbeiten', memberships_admin_ordergroup_path(@ordergroup)
|
||||
%p{:style => "clear:both"}= link_to "Gruppenübersicht", admin_ordergroups_path
|
|
@ -4,7 +4,44 @@
|
|||
<h2>Übersicht</h2>
|
||||
</div>
|
||||
<div class="column_content">
|
||||
<%= render :partial => 'users/show'%>
|
||||
<p>
|
||||
Mitglied seit <%= distance_of_time_in_words(Time.now, @user.created_on) -%>
|
||||
</p>
|
||||
<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>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>
|
||||
<b>Einstellungen</b>
|
||||
</p>
|
||||
<table style="width:26em">
|
||||
<tbody>
|
||||
<% for setting in User::setting_keys.keys -%>
|
||||
<tr>
|
||||
<td><%= User::setting_keys[setting] %></td>
|
||||
<td><%= @user.settings[setting] == '1' ? 'ja' : 'nein' %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
</tbody>
|
||||
</table>
|
||||
<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(', ') %>
|
||||
</p>
|
||||
</div>
|
||||
<p style="clear:both">
|
||||
<%= link_to 'Bearbeiten', edit_admin_user_path(@user) %>
|
||||
| <%= link_to 'Löschen', [:admin, @user], :confirm => "Willst du #{@user.first_name} wirklich rausschmeißen?", :method => :delete %>
|
||||
|
@ -13,7 +50,7 @@
|
|||
</div>
|
||||
<div class="box_title"><h2>Gruppenabos</h2></div>
|
||||
<div class="column_content">
|
||||
<%= render :partial => 'users/memberships'%>
|
||||
<%= render :partial => 'shared/user_memberships'%>
|
||||
<p><%= link_to 'Gruppenübersicht', :action => 'listGroups' %></p>
|
||||
</div>
|
||||
</div>
|
|
@ -1,84 +1,30 @@
|
|||
- form_for [:admin, @workgroup] do |@form|
|
||||
= @form.error_messages
|
||||
- render :layout => 'shared/group_form' do
|
||||
%div{:style => "float:right;width:40%"}
|
||||
%h3 Gruppe hat Zugriff auf
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_admin, "Administration"
|
||||
%td= @form.check_box :role_admin
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_finance, "Finanzen"
|
||||
%td= @form.check_box :role_finance
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_suppliers, "Lieferantenverwaltung"
|
||||
%td= @form.check_box :role_suppliers
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_article_meta, "Artikelverwaltung"
|
||||
%td= @form.check_box :role_article_meta
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_orders, "Bestellungsverwaltung"
|
||||
%td= @form.check_box :role_orders
|
||||
|
||||
%div{:style => "float:left;width:55%;"}
|
||||
%p
|
||||
= @form.label :name
|
||||
%br/
|
||||
= @form.text_field :name, :size => 20
|
||||
%p
|
||||
= @form.label :description
|
||||
%br/
|
||||
= @form.text_field :description, :size => 40
|
||||
|
||||
%div{:style => "float:right;width:40%"}
|
||||
%h3 Gruppe hat Zugriff auf
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_admin, "Administration"
|
||||
%td= @form.check_box :role_admin
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_finance, "Finanzen"
|
||||
%td= @form.check_box :role_finance
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_suppliers, "Lieferantenverwaltung"
|
||||
%td= @form.check_box :role_suppliers
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_article_meta, "Artikelverwaltung"
|
||||
%td= @form.check_box :role_article_meta
|
||||
%tr
|
||||
%td
|
||||
= @form.label :role_orders, "Bestellungsverwaltung"
|
||||
%td= @form.check_box :role_orders
|
||||
|
||||
%div{:style => "clear:both"}
|
||||
%h3
|
||||
Wöchentliche Jobs definieren?
|
||||
= @form.check_box :weekly_task, {:onclick => "toggleWeeklyTask();"}
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
= @form.label :weekday, "Wochentag:"
|
||||
%td
|
||||
= @form.select :weekday, Workgroup.weekdays
|
||||
%tr
|
||||
%td
|
||||
= @form.label :task_name, "Dienstname:"
|
||||
%td= @form.text_field :task_name, :size => 20
|
||||
%tr
|
||||
%td
|
||||
= @form.label :task_required_users, "Benötigte Verantwortliche:"
|
||||
%td= @form.text_field :task_required_users, :size => 3
|
||||
%tr
|
||||
%td
|
||||
= @form.label :task_description, "Beschreibung:"
|
||||
%td= @form.text_area :task_description
|
||||
|
||||
%br{ :style => "clear:both" }
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
= link_to "Abbrechen", admin_workgroups_path
|
||||
|
||||
%script{ 'type' => "text/javascript"}
|
||||
:plain
|
||||
//<![CDATA[
|
||||
// preset data
|
||||
function toggleWeeklyTask(){
|
||||
if ($("workgroup_weekly_task").checked == true) {
|
||||
$('workgroup_weekday').disabled = false;
|
||||
$('workgroup_task_name').disabled = false;
|
||||
$('workgroup_task_required_users').disabled = false;
|
||||
$('workgroup_task_description').disabled = false;
|
||||
} else {
|
||||
$('workgroup_weekday').disabled = true;
|
||||
$('workgroup_task_name').disabled = true;
|
||||
$('workgroup_task_required_users').disabled = true;
|
||||
$('workgroup_task_description').disabled = true;
|
||||
}
|
||||
}
|
||||
toggleWeeklyTask();
|
||||
//]]>
|
||||
%br{ :style => "clear:both" }
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
= link_to "Abbrechen", admin_workgroups_path
|
|
@ -1,3 +1,3 @@
|
|||
= render :partial => 'admin/memberships/edit_members'
|
||||
= render :partial => 'shared/memberships/members'
|
||||
%p{ :style => "clear:both" }
|
||||
= link_to 'Gruppenübersicht', admin_workgroups_path
|
|
@ -3,40 +3,14 @@
|
|||
.box_title
|
||||
%h2 Übersicht
|
||||
.column_content
|
||||
%p
|
||||
%b Beschreibung:
|
||||
=h @workgroup.description
|
||||
%p
|
||||
%b Gruppe hat Zugriff auf:
|
||||
- roles = Array.new
|
||||
- roles << 'Administration' if @workgroup.role_admin?
|
||||
- roles << 'Finanzen' if @workgroup.role_finance?
|
||||
- roles << 'Lieferanten' if @workgroup.role_suppliers?
|
||||
- roles << 'Artikel' if @workgroup.role_article_meta?
|
||||
- roles << 'Bestellungsverwaltung' if @workgroup.role_orders?
|
||||
=h roles.join(', ')
|
||||
%p
|
||||
- if @workgroup.weekly_task
|
||||
%b wöchentlicher Job:
|
||||
=h @workgroup.task_name
|
||||
am
|
||||
= weekday(@workgroup.weekday)
|
||||
- else
|
||||
kein wöchentlicher Job definiert
|
||||
= render :partial => 'shared/group', :locals => { :group => @workgroup }
|
||||
|
||||
= link_to 'Gruppe bearbeiten', edit_admin_workgroup_path(@workgroup)
|
||||
|
|
||||
= link_to 'Löschen', [:admin, @workgroup], :confirm => 'Bist Du sicher?', :method => :delete
|
||||
|
|
||||
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @workgroup
|
||||
.box_title
|
||||
%h2 Mitglieder
|
||||
.column_content
|
||||
- if @workgroup.memberships.empty?
|
||||
%i Diese Gruppe hat derzeit keine Mitglieder
|
||||
- else
|
||||
%ul{:style => "list-style-type:decimal;"}
|
||||
- for membership in @workgroup.memberships
|
||||
%li= link_to membership.user.nick, [:admin, membership.user]
|
||||
%p= link_to 'Mitglieder bearbeiten', memberships_admin_workgroup_path(@workgroup)
|
||||
%p
|
||||
= link_to 'Gruppe bearbeiten', edit_admin_workgroup_path(@workgroup)
|
||||
|
|
||||
= link_to 'Löschen', [:admin, @workgroup], :confirm => 'Bist Du sicher?', :method => :delete
|
||||
|
|
||||
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @workgroup
|
||||
|
|
||||
= link_to 'Mitglieder bearbeiten', memberships_admin_workgroup_path(@workgroup)
|
||||
%p{:style => "clear:both"}= link_to "Gruppenübersicht", admin_workgroups_path
|
|
@ -7,7 +7,8 @@
|
|||
<p>Anzahl gefundener Transaktionen: <b><%= @total %></b></p>
|
||||
|
||||
<p>
|
||||
<%= pagination_links_remote @financial_transactions, :params => {:sort => params[:sort], :query => params['query']}%>
|
||||
<%= pagination_links_remote @financial_transactions, :update => 'transactions',
|
||||
:params => {:sort => params[:sort], :query => params['query']}%>
|
||||
</p>
|
||||
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
%table{:style => "width:100%"}
|
||||
%tr
|
||||
%td
|
||||
= pagination_links_remote @groups, :params => {:sort => params[:sort]}
|
||||
= pagination_links_remote @groups, :update => :ordergroups, :params => {:sort => params[:sort]}
|
||||
%td{:style => "text-align:right"}
|
||||
- if @total > 20
|
||||
= items_per_page
|
||||
= items_per_page :update => :ordergroups
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
:before => "Element.show('loader')", |
|
||||
:success => "Element.hide('loader')", |
|
||||
:url => {:action => 'index'}, |
|
||||
:with => 'query' |
|
||||
#table
|
||||
:with => 'query', |
|
||||
:update => 'ordergroups' |
|
||||
#ordergroups
|
||||
= render :partial => "ordergroups"
|
||||
%br/
|
||||
- if @current_user.role_admin?
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')",
|
||||
:url => {:action => 'list'},
|
||||
:with => 'query' %>
|
||||
<div id="table">
|
||||
<%= render :partial => "list" %>
|
||||
:with => 'query',
|
||||
:update => 'transactions' %>
|
||||
<div id="transactions">
|
||||
<%= render :partial => "list" %>
|
||||
</div>
|
||||
<p><%= link_to 'Neue Transaktion', :action => 'new', :id => @group %></p>
|
||||
</div>
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
%table{:style => "width:100%"}
|
||||
%tr
|
||||
%td
|
||||
= pagination_links_remote @users
|
||||
= pagination_links_remote @users, :update => :users
|
||||
%td{:style => "text-align:right"}
|
||||
- if @total > 20
|
||||
= items_per_page
|
||||
= items_per_page :update => :users
|
||||
%table.list
|
||||
%thead
|
||||
%tr
|
12
app/views/foodcoop/_workgroup.html.haml
Normal file
12
app/views/foodcoop/_workgroup.html.haml
Normal file
|
@ -0,0 +1,12 @@
|
|||
.single_column{:style => "width:50em"}
|
||||
.box_title
|
||||
%h2= @group.name
|
||||
.column_content
|
||||
= render :partial => 'shared/group', :locals => { :group => @group }
|
||||
%p
|
||||
= link_to _("Show all tasks"), :controller => "tasks", :action => "workgroup", :id => @group
|
||||
|
|
||||
- if @group.member?(@current_user)
|
||||
= link_to _("Edit group"), :action => "edit_group", :id => @group
|
||||
|
|
||||
= link_to _('Send members a message'), :controller => 'messages', :action => 'group', :id => @group
|
15
app/views/foodcoop/edit_group.html.haml
Normal file
15
app/views/foodcoop/edit_group.html.haml
Normal file
|
@ -0,0 +1,15 @@
|
|||
- title "Gruppe bearbeiten"
|
||||
|
||||
%p
|
||||
%i
|
||||
Mitglieder kannst du
|
||||
= link_to "hier", :action => "memberships", :id => @group
|
||||
hinzufügen.
|
||||
.edit_form{:style => "width:35em"}
|
||||
- form_for(@group, :url => {:action => 'update_group', :id => @group}) do |@form|
|
||||
= render :partial => "shared/group_form"
|
||||
|
||||
%p{:style => "clear:both"}
|
||||
= submit_tag 'Speichern'
|
||||
|
|
||||
= link_to "Abbrechen", :action => "workgroups"
|
14
app/views/foodcoop/invite.haml
Normal file
14
app/views/foodcoop/invite.haml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- title "Neues Foodcoop-Mitglied einladen"
|
||||
|
||||
%p
|
||||
Hier kannst du eine Person in die Gruppe
|
||||
%b=h @group.name
|
||||
einladen, die noch nicht Mitglied der Foodcoop ist.
|
||||
.edit_form{:style => 'width:35em'}
|
||||
- form_for(@invite, :url => {:action => 'send_invitation', :id => @group}) do |form|
|
||||
= form.error_messages
|
||||
%p
|
||||
Email-Adresse:
|
||||
= form.text_field('email', :size => 40, :maxlength => 128)
|
||||
%p
|
||||
= submit_tag('Einladung abschicken')
|
|
@ -4,7 +4,7 @@
|
|||
Hier kannst Du den Mitgliedern Deiner Foodcoop eine Nachricht schreiben.
|
||||
%br/
|
||||
Damit Deine Kontaktdaten einzusehen sind, musst Du sie unter
|
||||
= link_to "Einstellungen", :action => "editProfile"
|
||||
= link_to "Einstellungen", my_profile_path
|
||||
freigeben.
|
||||
|
||||
.left_column{:style => "width:100%"}
|
||||
|
@ -21,13 +21,11 @@
|
|||
:before => "Element.show('loader')", |
|
||||
:success => "Element.hide('loader')", |
|
||||
:url => {:action => 'foodcoop_members'}, |
|
||||
:update => :users, |
|
||||
:with => 'query' |
|
||||
|
||||
=_ "Sort by Ordergroups :"
|
||||
- form_tag({:action => "foodcoop_members"}, :method => "get", :style=>"display:inline;") do
|
||||
-unless params[:sort_by_ordergroups]
|
||||
%input{:type => "checkbox", :name => :sort_by_ordergroups, :value => "1", :onclick => "submit();"}
|
||||
-else
|
||||
%input{:type => "checkbox", :name => :sort_by_ordergroups, :value => "0", :checked => "checked", :onclick => "submit();"}
|
||||
#user_table
|
||||
= render :partial => "list_members"
|
||||
- form_tag({:action => "members"}, :method => "get", :style=>"display:inline;") do
|
||||
= check_box_tag :sort_by_ordergroups, 1, params[:sort_by_ordergroups], :onclick => "submit();"
|
||||
#users
|
||||
= render :partial => "users"
|
1
app/views/foodcoop/memberships.rhtml
Normal file
1
app/views/foodcoop/memberships.rhtml
Normal file
|
@ -0,0 +1 @@
|
|||
<%= render :partial => 'shared/memberships/members' %>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
- unless @groups.empty?
|
||||
-for @group in @groups
|
||||
= render :partial => "showGroup"
|
||||
= render :partial => "workgroup"
|
||||
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<h1>Mitglieder von <%=h @group.name %></h1>
|
||||
<p>
|
||||
<i>Hier kannst Du die Mitglieder der Gruppe verwalten.</i>
|
||||
</p>
|
||||
<div class="left_column" style="width:48%">
|
||||
<div class="box_title">
|
||||
<h2>Sind schon Mitglieder</h2>
|
||||
</div>
|
||||
<div class="column_content" id="members">
|
||||
<%=render :partial => 'groups/members' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right_column" style="width:48%">
|
||||
<div class="box_title">
|
||||
<h2>Sind noch keine Mitglieder</h2>
|
||||
</div>
|
||||
<div class="column_content" id="non_members">
|
||||
<%= render :partial => 'groups/non_members' %>
|
||||
<%= link_to('Person einladen', :controller =>'index', :action => 'invite', :id => @group) if (@current_user.is_member_of(@group) || @current_user.role_admin?) %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,87 +0,0 @@
|
|||
= error_messages_for 'group'
|
||||
|
||||
<!--[form:group]-->
|
||||
%div{:style => "float:left;width:55%;"}
|
||||
- if controller.controller_name == "admin" || !@group.is_a?(Ordergroup)
|
||||
%p
|
||||
%label{:for => "group_name"} Names
|
||||
%br/
|
||||
= text_field 'group', 'name', :size => 20
|
||||
%p
|
||||
%label{:for => "group_description"} Beschreibung
|
||||
%br/
|
||||
= text_field 'group', 'description', :size => 40
|
||||
- if @group.is_a?(Ordergroup) && controller.controller_name == "admin"
|
||||
%p
|
||||
%label{:for => "group_actual_size"} Aktuelle Gruppengröße
|
||||
%br/
|
||||
= text_field "group", "actual_size", :size => 3
|
||||
- if controller.controller_name == "admin"
|
||||
%div{:style => "float:right;width:40%"}
|
||||
%h3 Gruppe hat Zugriff auf
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_role_admin"} Administration
|
||||
%td= check_box 'group', 'role_admin'
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_role_finance"} Finanzen
|
||||
%td= check_box 'group', 'role_finance'
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_role_suppliers"} Lieferantenverwaltung
|
||||
%td= check_box 'group', 'role_suppliers'
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_role_article_meta"} Artikelverwaltung
|
||||
%td= check_box 'group', 'role_article_meta'
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_role_orders"} Bestellungsverwaltung
|
||||
%td= check_box 'group', 'role_orders'
|
||||
-unless @group.is_a?(Ordergroup)
|
||||
%div{:style => "clear:both"}
|
||||
%h3
|
||||
Wöchentliche Jobs definieren?
|
||||
= check_box "group", "weekly_task", {:onclick => "toggleWeeklyTask();"}
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_weekday"} Wochentag:
|
||||
%td
|
||||
%select#group_weekday{:name => "group[weekday]"}
|
||||
= options_for_select([["Montag", "1"], ["Dienstag", "2"], ["Mittwoch","3"],["Donnerstag","4"],["Freitag","5"],["Samstag","6"],["Sonntag","0"]], [@group.weekday.to_s])
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_task_name"} Dienstname:
|
||||
%td= text_field "group", "task_name",:size => 20
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_task_name"} Benötigte Verantwortliche:
|
||||
%td= text_field "group", "task_required_users",:size => 3
|
||||
%tr
|
||||
%td
|
||||
%label{:for => "group_task_name"} Beschreibung:
|
||||
%td= text_area "group", "task_description"
|
||||
|
||||
%script{ 'type' => "text/javascript"}
|
||||
:plain
|
||||
//<![CDATA[
|
||||
// preset data
|
||||
function toggleWeeklyTask(){
|
||||
if ($("group_weekly_task").checked == true) {
|
||||
$('group_weekday').disabled = false;
|
||||
$('group_task_name').disabled = false;
|
||||
$('group_task_required_users').disabled = false;
|
||||
$('group_task_description').disabled = false;
|
||||
} else {
|
||||
$('group_weekday').disabled = true;
|
||||
$('group_task_name').disabled = true;
|
||||
$('group_task_required_users').disabled = true;
|
||||
$('group_task_description').disabled = true;
|
||||
}
|
||||
}
|
||||
toggleWeeklyTask();
|
||||
//]]>
|
||||
<!--[eoform:group]-->
|
|
@ -1,16 +0,0 @@
|
|||
<% if flash[:error] %><h3 class="error" id="flashError" ><%= flash[:error] %></h3><%= javascript_tag("new Effect.Highlight('flashError', {delay:0.8, duration:1});") -%><% end %>
|
||||
<% memberships = @group.memberships
|
||||
if memberships.size != 0 %>
|
||||
<ul style="">
|
||||
<% for membership in memberships %>
|
||||
<li style="margin-left:-15px">
|
||||
<b><%= link_to membership.user.nick, :action => "showUser", :id => membership.user %></b> (<%=h membership.user.first_name + ' ' + membership.user.last_name %>)
|
||||
| <%= link_to_remote 'entfernen', :url => {:action => 'dropMember', :group => @group, :membership => membership},
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<p><i><%= @group.name %> hat keine Mitglieder.</i></p>
|
||||
<% end %>
|
|
@ -1,8 +0,0 @@
|
|||
<ul>
|
||||
<% for user in @group.non_members %>
|
||||
<li><b><%= link_to user.nick, :action => "showUser", :id => user %></b> (<%=h user.first_name + ' ' + user.last_name %>)
|
||||
| <%= link_to_remote 'hinzufügen', :url => {:action => 'addMember', :id => @group, :user => user},
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %> </li>
|
||||
<% end %>
|
||||
</ul>
|
|
@ -1,8 +0,0 @@
|
|||
<h1>Gruppe bearbeiten</h1>
|
||||
<div class="edit_form" style="width:50em">
|
||||
<% form_tag(:action => 'updateGroup', :id => @group) do %>
|
||||
<%= render :partial => 'groups/form' %>
|
||||
<br style="clear:both" />
|
||||
<%= submit_tag 'Speichern' %> | <%= link_to "Abbrechen", :action => "listGroups" %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -2,8 +2,8 @@
|
|||
<div class="left_column">
|
||||
<div class="box_title"><h2><%=h @ordergroup.name %></h2></div>
|
||||
<div class="column_content">
|
||||
<p><b>Beschreibung:</b> <%=h @ordergroup.description %>
|
||||
<%= link_to '(ändern)', :action => 'editGroup', :id => @ordergroup %>
|
||||
<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>
|
||||
|
@ -15,7 +15,7 @@
|
|||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= link_to('Hinzufügen/entfernen', :action => 'members', :id => @ordergroup) %> |
|
||||
<%= link_to('Hinzufügen/entfernen', :action => 'members', :id => @ordergroup) %> |
|
||||
<%= link_to('Person einladen', :action => 'invite', :id => @ordergroup) %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -32,10 +32,11 @@
|
|||
<%= observe_field 'query', :frequency => 2,
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')",
|
||||
:url => {:action => 'myOrdergroup'},
|
||||
:with => 'query' %>
|
||||
<div id="table">
|
||||
<%= render :partial => "/financial_transactions/list" %>
|
||||
:url => {:action => 'ordergroup'},
|
||||
:with => 'query',
|
||||
:update => 'transactions' %>
|
||||
<div id="transactions">
|
||||
<%= render :partial => "/finance/transactions/list" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
38
app/views/home/profile.html.erb
Normal file
38
app/views/home/profile.html.erb
Normal file
|
@ -0,0 +1,38 @@
|
|||
<% title "Mein Profil" -%>
|
||||
|
||||
<p>
|
||||
Hier kannst Du deine Einstellungen ändern, z.b. Deine Telphonnummer oder Dein Passwort.
|
||||
</p>
|
||||
|
||||
<div class="left_column" style="width: 60%;">
|
||||
<div class="box_title">
|
||||
<h2>
|
||||
Nickname: <%= h @user.nick %>
|
||||
<small>(Mitglied seit: <%= distance_of_time_in_words(Time.now, @user.created_on) -%>)</small>#
|
||||
</h2>
|
||||
</div>
|
||||
<div class="column_content">
|
||||
<% form_for(@user, :url => { :action => 'update_profile'}) do |@form| %>
|
||||
<%= render :partial => 'shared/user_form' %>
|
||||
<p style="clear:both">
|
||||
<%= submit_tag 'Speichern' %> | <%= link_to 'Abbrechen', :action => 'profile' %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right_column" style="width: 35%;">
|
||||
<div class="box_title">
|
||||
<h2>Du bist Mitglied in folgenden Gruppen</h2>
|
||||
</div>
|
||||
<div class="column_content">
|
||||
<% for membership in Membership.find_all_by_user_id(@user.id) %>
|
||||
<p>
|
||||
<%= membership.group.name %>
|
||||
<% if membership.group.type != 'Ordergroup' %>
|
||||
(<%= link_to _("Cancel membership"), { :action => 'cancel_membership', :membership_id => membership },
|
||||
:confirm => _("Are you sure to cancel this membership?"), :method => :post %>)
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,40 +0,0 @@
|
|||
.single_column{:style => "width:50em"}
|
||||
.box_title
|
||||
%h2= @group.name
|
||||
.column_content
|
||||
%table
|
||||
%tr
|
||||
%td= _("Description") + ":"
|
||||
%td= @group.description
|
||||
%tr
|
||||
%td= _("Group has access to") + ":"
|
||||
%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?
|
||||
=h roles.join(', ')
|
||||
%tr
|
||||
%td= _("Members") + ":"
|
||||
%td
|
||||
- members = @group.users
|
||||
= "(#{members.size})"
|
||||
= members.collect(&:nick).join(", ")
|
||||
%tr
|
||||
%td= _("Weekly task") + ":"
|
||||
%td
|
||||
- if @group.weekly_task
|
||||
=h @group.task_name
|
||||
=_ "at"
|
||||
= weekday(@group.weekday)
|
||||
- else
|
||||
=_ 'No weekly tasks defined yet'
|
||||
%p
|
||||
= link_to _("Show all tasks"), :controller => "tasks", :action => "workgroup", :id => @group
|
||||
|
|
||||
- if @group.member?(@current_user)
|
||||
= link_to _("Edit group"), :action => "editGroup", :id => @group
|
||||
|
|
||||
= link_to _('Send members a message'), :controller => 'messages', :action => 'group', :id => @group
|
|
@ -1,14 +0,0 @@
|
|||
%h1 Gruppe bearbeiten
|
||||
|
||||
%p
|
||||
%i
|
||||
Mitglieder kannst du
|
||||
= link_to "hier", :action => "members", :id => @group
|
||||
hinzufügen.
|
||||
.edit_form{:style => "width:35em"}
|
||||
- form_tag(:action => 'updateGroup', :id => @group) do
|
||||
= render :partial => "/groups/form"
|
||||
%p{:style => "clear:both"}
|
||||
= submit_tag 'Speichern'
|
||||
|
|
||||
= link_to "Abbrechen", :action => "showGroup", :id => @group
|
|
@ -1,11 +0,0 @@
|
|||
<h1>Meine Daten bearbeiten</h1>
|
||||
<div class="left_column" style="width: 100%;">
|
||||
<div class="box_title"><h2><%= h @user.nick %></h2></div>
|
||||
<div class="column_content">
|
||||
<% form_tag(:action => 'updateProfile') do %>
|
||||
<%= render :partial => 'users/form' %>
|
||||
<p style="clear:both">
|
||||
<%= submit_tag 'Speichern' %> | <%= link_to 'Abbrechen', :action => 'myProfile' %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,13 +0,0 @@
|
|||
%h1 Einladen
|
||||
%p
|
||||
Hier kannst du eine Person in die Gruppe
|
||||
=h @group.name
|
||||
einladen, die noch nicht Mitglied der Foodcoop ist.
|
||||
= error_messages_for('invite')
|
||||
.edit_form{:style => 'width:35em'}
|
||||
- form_for(:invite, @invite) do |i|
|
||||
%p
|
||||
Email-Adresse:
|
||||
= i.text_field('email', :size => 40, :maxlength => 128)
|
||||
%p
|
||||
= submit_tag('Einladung abschicken')
|
|
@ -1,8 +0,0 @@
|
|||
<%= render :partial => 'groups/edit_members' %>
|
||||
<p style="clear:both">
|
||||
<% if @group.is_a?(Ordergroup) -%>
|
||||
<%= link_to "Zurück", :action => "myOrdergroup" %>
|
||||
<% else -%>
|
||||
<%= link_to 'Zurück', :action => 'showGroup', :id => @group %>
|
||||
<% end -%>
|
||||
</p>
|
|
@ -1,30 +0,0 @@
|
|||
<h1><%= _('edit my profile')%></h1>
|
||||
<%= _('Here you can change your preferences. For example you can change your phone number or your password.
|
||||
<br>
|
||||
You can also see in which workgroups you are.
|
||||
<p></p>
|
||||
')%>
|
||||
<div class="left_column" style="width: 60%;">
|
||||
<div class="box_title"><h2>Nickname: <%= h @user.nick %><small> (Mitglied seit: <%= distance_of_time_in_words(Time.now, @user.created_on) -%>)</small></h2></div>
|
||||
<div class="column_content">
|
||||
<% form_tag(:action => 'updateProfile') do %>
|
||||
<%= render :partial => 'users/form' %>
|
||||
<p style="clear:both">
|
||||
<%= submit_tag 'Speichern' %> | <%= link_to 'Abbrechen', :action => 'myProfile' %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right_column" style="width: 35%;">
|
||||
<div class="box_title"><h2>Du bist Mitglied in folgenden Gruppen</h2></div>
|
||||
<div class="column_content">
|
||||
<% for membership in Membership.find_all_by_user_id(@user.id) %>
|
||||
<p>
|
||||
<%= link_to(membership.group.name, :action => 'showGroup', :id => membership.group) %>
|
||||
<% if membership.group.type != 'Ordergroup' %>
|
||||
(<%= link_to _("Cancel membership"), { :action => 'cancel_membership', :id => membership }, :confirm => _("Are you sure to cancel this membership?"), :method => :post %>)
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,8 +0,0 @@
|
|||
%h1
|
||||
=h @group.is_a?(Ordergroup) ? "Bestellgruppe:" : "Gruppe:"
|
||||
=h @group.name
|
||||
= render :partial => "showGroup"
|
||||
|
||||
- unless @group.is_a?(Ordergroup)
|
||||
%p{:style => "clear:both"}
|
||||
= link_to "alle Arbeitsgruppen", :action => "workgroups"
|
|
@ -1,12 +0,0 @@
|
|||
%h1=h @user.nick
|
||||
.left_column{:style => "width:50em"}
|
||||
.box_title
|
||||
%h2 Übersicht
|
||||
.column_content
|
||||
= render :partial => "users/show"
|
||||
%p{:style => "clear:both"}
|
||||
%p= link_to "Nachricht senden", :controller => "messages", :action => 'user', :id => @user
|
||||
.box_title
|
||||
%h2 Gruppenabos
|
||||
.column_content
|
||||
= render :partial => "users/memberships"
|
|
@ -1,14 +1,19 @@
|
|||
<%
|
||||
u = @current_user
|
||||
tabs = [
|
||||
{ :name => "Start", :url => root_path, :active => ["index", "messages", "tasks"],
|
||||
{ :name => "Start", :url => root_path, :active => ["index", "messages", "home"],
|
||||
:subnav => [
|
||||
{ :name => "Members", :url => "/index/foodcoop_members"},
|
||||
{ :name => "Workgroups", :url => "/index/workgroups"},
|
||||
{ :name => "Tasks", :url => "/tasks"},
|
||||
{ :name => "Messages", :url => "/messages/inbox"},
|
||||
{ :name => "My Ordergroup", :url => my_ordergroup_path},
|
||||
{ :name => "My Ordergroup", :url => my_profile_path}
|
||||
{ :name => "My tasks", :url => "/home/tasks" },
|
||||
{ :name => "My ordergroup", :url => "/home/ordergroup"},
|
||||
{ :name => "My profile", :url => "/home/profile"}
|
||||
]
|
||||
},
|
||||
{ :name => "Foodcoop", :url => "/foodcoop/members", :active => ["foodcoop", "tasks"],
|
||||
:subnav => [
|
||||
{ :name => "Members", :url => "/foodcoop/members"},
|
||||
{ :name => "Workgroups", :url => "/foodcoop/workgroups"},
|
||||
{ :name => "Tasks", :url => "/tasks"}
|
||||
]
|
||||
},
|
||||
{ :name => "Orders", :url => "/ordering", :active => ["orders", "ordering"],
|
||||
|
@ -48,12 +53,12 @@
|
|||
-%>
|
||||
<ul>
|
||||
<% for tab in tabs -%>
|
||||
<% unless tab[:access?] and tab[:access?] == false %>
|
||||
<% unless tab[:access?] and tab[:access?] == false -%>
|
||||
<li class="<%= 'current' if tab_is_active?(tab) %>">
|
||||
<%= link_to tab[:name], tab[:url] %>
|
||||
<ul>
|
||||
<% for subtab in tab[:subnav] -%>
|
||||
<% unless subtab[:access?] and subtab[:access?] == false %>
|
||||
<% unless subtab[:access?] and subtab[:access?] == false -%>
|
||||
<li><%= link_to subtab[:name], subtab[:url] %></li>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
|
28
app/views/shared/_group.html.haml
Normal file
28
app/views/shared/_group.html.haml
Normal file
|
@ -0,0 +1,28 @@
|
|||
%table
|
||||
%tr
|
||||
%td Beschreibung:
|
||||
%td=h group.description
|
||||
%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(', ')
|
||||
%tr
|
||||
%td Mitglieder:
|
||||
%td
|
||||
- members = group.users
|
||||
= "(#{members.size})"
|
||||
= members.collect(&:nick).join(", ")
|
||||
- if group.is_a?(Workgroup)
|
||||
%tr
|
||||
%td wöchentlicher Job:
|
||||
%td
|
||||
- if group.weekly_task
|
||||
=h "#{group.task_name} am #{weekday(group.weekday)}"
|
||||
- else
|
||||
kein wöchentlicher Job definiert
|
57
app/views/shared/_group_form.html.haml
Normal file
57
app/views/shared/_group_form.html.haml
Normal file
|
@ -0,0 +1,57 @@
|
|||
= @form.error_messages
|
||||
|
||||
%div{:style => "float:left;width:55%;"}
|
||||
%p
|
||||
= @form.label :name
|
||||
%br/
|
||||
= @form.text_field :name, :size => 20
|
||||
%p
|
||||
= @form.label :description
|
||||
%br/
|
||||
= @form.text_field :description, :size => 40
|
||||
|
||||
= yield
|
||||
|
||||
- if @group.is_a?(Workgroup)
|
||||
%div{:style => "clear:both"}
|
||||
%h3
|
||||
Wöchentliche Jobs definieren?
|
||||
= @form.check_box :weekly_task, {:onclick => "toggleWeeklyTask();"}
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
= @form.label :weekday, "Wochentag:"
|
||||
%td
|
||||
= @form.select :weekday, Workgroup.weekdays
|
||||
%tr
|
||||
%td
|
||||
= @form.label :task_name, "Dienstname:"
|
||||
%td= @form.text_field :task_name, :size => 20
|
||||
%tr
|
||||
%td
|
||||
= @form.label :task_required_users, "Benötigte Verantwortliche:"
|
||||
%td= @form.text_field :task_required_users, :size => 3
|
||||
%tr
|
||||
%td
|
||||
= @form.label :task_description, "Beschreibung:"
|
||||
%td= @form.text_area :task_description
|
||||
|
||||
%script{ 'type' => "text/javascript"}
|
||||
:plain
|
||||
//<![CDATA[
|
||||
// preset data
|
||||
function toggleWeeklyTask(){
|
||||
if ($("workgroup_weekly_task").checked == true) {
|
||||
$('workgroup_weekday').disabled = false;
|
||||
$('workgroup_task_name').disabled = false;
|
||||
$('workgroup_task_required_users').disabled = false;
|
||||
$('workgroup_task_description').disabled = false;
|
||||
} else {
|
||||
$('workgroup_weekday').disabled = true;
|
||||
$('workgroup_task_name').disabled = true;
|
||||
$('workgroup_task_required_users').disabled = true;
|
||||
$('workgroup_task_description').disabled = true;
|
||||
}
|
||||
}
|
||||
toggleWeeklyTask();
|
||||
//]]>
|
|
@ -1,7 +1,7 @@
|
|||
%ul
|
||||
%li
|
||||
= image_tag 'b_user.png' , :size => '7x10', :border => 0, :alt => _("User")
|
||||
= link_to h(@current_user.nick), { :controller => 'index', :action => 'myProfile' }, { :title => _("User Settings") }
|
||||
= link_to h(@current_user.nick), my_profile_path, { :title => _("User Settings") }
|
||||
- if APP_CONFIG[:base_url]
|
||||
%li= link_to APP_CONFIG[:name], APP_CONFIG[:base_url], { :title => _("Go to your FoodCoop-Hompage") }
|
||||
%li= link_to _("Help"), 'http://dev.foodcoops.net/wiki/FoodsoftDoku'
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<li style="margin-left:-15px">
|
||||
<b><%= membership.user.nick %></b> (<%=h membership.user.first_name + ' ' + membership.user.last_name %>)
|
||||
| <%= link_to_remote 'entfernen',
|
||||
:url => { :controller => 'admin/memberships', :action => 'drop_member', :group_id => @group, :membership_id => membership },
|
||||
:url => { :controller => '/memberships', :action => 'drop_member', :group_id => @group, :membership_id => membership },
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
</li>
|
24
app/views/shared/memberships/_members.rhtml
Normal file
24
app/views/shared/memberships/_members.rhtml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<h1>Mitglieder von <%=h @group.name %></h1>
|
||||
<p>
|
||||
<i>
|
||||
Hier kannst Du die Mitglieder der Gruppe verwalten oder ein neues Foodcoop-Mitglied in die Gruppe
|
||||
<%= link_to('einladen', :controller => '/foodcoop', :action => 'invite', :id => @group) %>.
|
||||
</i>
|
||||
</p>
|
||||
<div class="left_column" style="width:48%">
|
||||
<div class="box_title">
|
||||
<h2>Sind schon Mitglieder</h2>
|
||||
</div>
|
||||
<div class="column_content" id="members">
|
||||
<%=render :partial => 'shared/memberships/current_members' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right_column" style="width:48%">
|
||||
<div class="box_title">
|
||||
<h2>Sind noch keine Mitglieder</h2>
|
||||
</div>
|
||||
<div class="column_content" id="non_members">
|
||||
<%= render :partial => 'shared/memberships/non_members' %>
|
||||
<%= link_to('Person einladen', :controller => '/foodcoop', :action => 'invite', :id => @group) %>
|
||||
</div>
|
||||
</div>
|
|
@ -3,7 +3,7 @@
|
|||
<li>
|
||||
<b><%= user.nick %></b> (<%=h user.first_name + ' ' + user.last_name %>)
|
||||
| <%= link_to_remote 'hinzufügen',
|
||||
:url => { :controller => 'admin/memberships', :action => 'add_member', :group_id => @group, :user_id => user },
|
||||
:url => { :controller => '/memberships', :action => 'add_member', :group_id => @group, :user_id => user },
|
||||
:before => "Element.show('loader')",
|
||||
:success => "Element.hide('loader')" %>
|
||||
</li>
|
|
@ -9,4 +9,4 @@
|
|||
#workgroup_members{:style => "padding-left:41em"}
|
||||
%h3=_ 'Members of the workgroups'
|
||||
#list
|
||||
= render :partial => "/groups/workgroup_members"
|
||||
= render :partial => "shared/workgroup_members"
|
|
@ -8,4 +8,4 @@
|
|||
#workgroup_members{:style => "padding-left:41em"}
|
||||
%h3=_ 'Members of the workgroups'
|
||||
#list
|
||||
= render :partial => "/groups/workgroup_members"
|
||||
= render :partial => "shared/workgroup_members"
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
%tr
|
||||
%td=_ 'Group'
|
||||
%td
|
||||
- if @task.group
|
||||
= link_to @task.group.name, :action => "workgroup", :id => @task.group
|
||||
- if @task.workgroup
|
||||
= link_to @task.workgroup.name, :action => "workgroup", :id => @task.workgroup
|
||||
|
||||
%tr
|
||||
%td{:colspan => "2"}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
<%= error_messages_for 'user' %>
|
||||
|
||||
<table style="float:left;width:52%;">
|
||||
<tr>
|
||||
<td><label for="user_nick">Nick</label></td>
|
||||
<td><%= text_field 'user', 'nick' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="user_first_name">Vorname</label></td>
|
||||
<td><%= text_field 'user', 'first_name' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="user_last_name">Nachname</label></td>
|
||||
<td><%= text_field 'user', 'last_name' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="user_email">Email</label></td>
|
||||
<td><%= text_field 'user', 'email' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="user_phone">Telefon</label></td>
|
||||
<td><%= text_field 'user', 'phone' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="user_address">Adresse</label></td>
|
||||
<td><%= text_field 'user', 'address' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="user_password_entry">Neues Passwort</label></td>
|
||||
<td><%= password_field_tag "user", "password_entry" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="user_password_entry_confirmation">Passwort wiederholen</label></td>
|
||||
<td><%= password_field_tag "user", "password_entry_confirmation" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="float:right;width:45%;">
|
||||
<tr>
|
||||
<td colspan="2"><b>Einstellungen:</b></td>
|
||||
</tr>
|
||||
<% for setting in User::setting_keys.keys -%>
|
||||
<tr>
|
||||
<td><label for="user[settings][<%= setting %>]"><%=h User::setting_keys[setting]%></label></td>
|
||||
<td><%= check_box_tag "user[settings][#{setting}]", '1', @user.settings[setting] == '1' || @user.settings_default(setting) %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
</table>
|
|
@ -1,6 +0,0 @@
|
|||
%table{:style => "width:26em"}
|
||||
%tbody
|
||||
- for setting in User::setting_keys.keys
|
||||
%tr
|
||||
%td=h User::setting_keys[setting]
|
||||
%td= @user.settings[setting] == '1' ? 'ja' : 'nein'
|
|
@ -1,26 +0,0 @@
|
|||
<p>Mitglied seit <%= distance_of_time_in_words(Time.now, @user.created_on) -%></p>
|
||||
|
||||
<% if @current_user.role_admin? %>
|
||||
<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>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><b>Einstellungen</b></p>
|
||||
<%= render :partial => 'users/settings' %>
|
||||
<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(', ') %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,10 +1,11 @@
|
|||
ActionController::Routing::Routes.draw do |map|
|
||||
map.my_profile '/home/profile', :controller => 'home', :action => 'profile'
|
||||
map.my_tasks '/home/tasks', :controller => 'tasks', :action => 'myTasks'
|
||||
|
||||
map.namespace :admin do |admin|
|
||||
admin.resources :users
|
||||
admin.resources :workgroups, :member => { :memberships => :get }
|
||||
admin.resources :ordergroups, :member => { :memberships => :get }
|
||||
admin.connect 'memberships/:action/:id', :controller => 'memberships'
|
||||
end
|
||||
|
||||
map.namespace :finance do |finance|
|
||||
|
@ -17,10 +18,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
:has_many => [:deliveries],
|
||||
:collection => { :shared_suppliers => :get }
|
||||
|
||||
map.my_profile 'my_profile', :controller => 'index', :action => 'myProfile'
|
||||
map.my_ordergroup 'my_ordergroup', :controller => 'index', :action => 'myOrdergroup'
|
||||
|
||||
map.root :controller => 'index'
|
||||
map.root :controller => 'home', :action => 'index'
|
||||
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ class RenameOrdergroups < ActiveRecord::Migration
|
|||
def self.up
|
||||
rename_column :financial_transactions, :order_group_id, :ordergroup_id
|
||||
rename_column :group_orders, :order_group_id, :ordergroup_id
|
||||
rename_column :tasks, :group_id, :workgroup_id
|
||||
remove_index :group_orders, :name => "index_group_orders_on_order_group_id_and_order_id"
|
||||
add_index :group_orders, [:ordergroup_id, :order_id], :unique => true
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20090114101610) do
|
||||
ActiveRecord::Schema.define(:version => 20090113111624) do
|
||||
|
||||
create_table "article_categories", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
|
@ -269,7 +269,7 @@ ActiveRecord::Schema.define(:version => 20090114101610) do
|
|||
t.string "description"
|
||||
t.date "due_date"
|
||||
t.boolean "done", :default => false
|
||||
t.integer "group_id"
|
||||
t.integer "workgroup_id"
|
||||
t.boolean "assigned", :default => false
|
||||
t.datetime "created_on", :null => false
|
||||
t.datetime "updated_on", :null => false
|
||||
|
|
4
test/fixtures/tasks.yml
vendored
4
test/fixtures/tasks.yml
vendored
|
@ -1,5 +1,5 @@
|
|||
# == Schema Information
|
||||
# Schema version: 20090102171850
|
||||
# Schema version: 20090114101610
|
||||
#
|
||||
# Table name: tasks
|
||||
#
|
||||
|
@ -8,7 +8,7 @@
|
|||
# description :string(255)
|
||||
# due_date :date
|
||||
# done :boolean(1)
|
||||
# group_id :integer(4)
|
||||
# workgroup_id :integer(4)
|
||||
# assigned :boolean(1)
|
||||
# created_on :datetime not null
|
||||
# updated_on :datetime not null
|
||||
|
|
8
test/functional/foodcoop_controller_test.rb
Normal file
8
test/functional/foodcoop_controller_test.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require 'test_helper'
|
||||
|
||||
class FoodcoopControllerTest < ActionController::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
8
test/functional/home_controller_test.rb
Normal file
8
test/functional/home_controller_test.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require 'test_helper'
|
||||
|
||||
class HomeControllerTest < ActionController::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'index_controller'
|
||||
|
||||
# Re-raise errors caught by the controller.
|
||||
class IndexController; def rescue_action(e) raise e end; end
|
||||
|
||||
class IndexControllerTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = IndexController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
# Replace this with your real tests.
|
||||
def test_truth
|
||||
assert true
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue