Removed fancybox. Fixed profile, my ordergroup and tasks.
|
@ -6,7 +6,6 @@
|
|||
//= require bootstrap-datepicker
|
||||
//= require bootstrap-datepicker.de
|
||||
//= require jquery.observe_field
|
||||
//= require jquery.fancybox-1.3.4.pack
|
||||
//= require rails.validations
|
||||
//= require_self
|
||||
//= require ordering
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
*= require bootstrap_and_overrides
|
||||
*= require token-input-bootstrappy
|
||||
*= require jquery.fancybox-1.3.4
|
||||
*/
|
Before Width: | Height: | Size: 43 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 107 B |
Before Width: | Height: | Size: 106 B |
Before Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 324 B |
Before Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 103 B |
Before Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 506 B |
Before Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 176 B |
Before Width: | Height: | Size: 15 KiB |
|
@ -1,359 +0,0 @@
|
|||
/*
|
||||
* FancyBox - jQuery Plugin
|
||||
* Simple and fancy lightbox alternative
|
||||
*
|
||||
* Examples and documentation at: http://fancybox.net
|
||||
*
|
||||
* Copyright (c) 2008 - 2010 Janis Skarnelis
|
||||
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
|
||||
*
|
||||
* Version: 1.3.4 (11/11/2010)
|
||||
* Requires: jQuery v1.3+
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
#fancybox-loading {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-top: -20px;
|
||||
margin-left: -20px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
z-index: 1104;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-loading div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 40px;
|
||||
height: 480px;
|
||||
background-image: url('fancybox/fancybox.png');
|
||||
}
|
||||
|
||||
#fancybox-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 1100;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-tmp {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
overflow: auto;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-wrap {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: 20px;
|
||||
z-index: 1101;
|
||||
outline: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-outer {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#fancybox-content {
|
||||
width: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
outline: none;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
z-index: 1102;
|
||||
border: 0px solid #fff;
|
||||
}
|
||||
|
||||
#fancybox-hide-sel-frame {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
z-index: 1101;
|
||||
}
|
||||
|
||||
#fancybox-close {
|
||||
position: absolute;
|
||||
top: -15px;
|
||||
right: -15px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background: transparent url('fancybox/fancybox.png') -40px 0px;
|
||||
cursor: pointer;
|
||||
z-index: 1103;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-error {
|
||||
color: #444;
|
||||
font: normal 12px/20px Arial;
|
||||
padding: 14px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#fancybox-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
outline: none;
|
||||
line-height: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#fancybox-frame {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#fancybox-left, #fancybox-right {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
height: 100%;
|
||||
width: 35%;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
background: transparent url('fancybox/blank.gif');
|
||||
z-index: 1102;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#fancybox-left {
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#fancybox-right {
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
#fancybox-left-ico, #fancybox-right-ico {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: -9999px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-top: -15px;
|
||||
cursor: pointer;
|
||||
z-index: 1102;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#fancybox-left-ico {
|
||||
background-image: url('fancybox/fancybox.png');
|
||||
background-position: -40px -30px;
|
||||
}
|
||||
|
||||
#fancybox-right-ico {
|
||||
background-image: url('fancybox/fancybox.png');
|
||||
background-position: -40px -60px;
|
||||
}
|
||||
|
||||
#fancybox-left:hover, #fancybox-right:hover {
|
||||
visibility: visible; /* IE6 */
|
||||
}
|
||||
|
||||
#fancybox-left:hover span {
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
#fancybox-right:hover span {
|
||||
left: auto;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.fancybox-bg {
|
||||
position: absolute;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
#fancybox-bg-n {
|
||||
top: -20px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-image: url('fancybox/fancybox-x.png');
|
||||
}
|
||||
|
||||
#fancybox-bg-ne {
|
||||
top: -20px;
|
||||
right: -20px;
|
||||
background-image: url('fancybox/fancybox.png');
|
||||
background-position: -40px -162px;
|
||||
}
|
||||
|
||||
#fancybox-bg-e {
|
||||
top: 0;
|
||||
right: -20px;
|
||||
height: 100%;
|
||||
background-image: url('fancybox/fancybox-y.png');
|
||||
background-position: -20px 0px;
|
||||
}
|
||||
|
||||
#fancybox-bg-se {
|
||||
bottom: -20px;
|
||||
right: -20px;
|
||||
background-image: url('fancybox/fancybox.png');
|
||||
background-position: -40px -182px;
|
||||
}
|
||||
|
||||
#fancybox-bg-s {
|
||||
bottom: -20px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-image: url('fancybox/fancybox-x.png');
|
||||
background-position: 0px -20px;
|
||||
}
|
||||
|
||||
#fancybox-bg-sw {
|
||||
bottom: -20px;
|
||||
left: -20px;
|
||||
background-image: url('fancybox/fancybox.png');
|
||||
background-position: -40px -142px;
|
||||
}
|
||||
|
||||
#fancybox-bg-w {
|
||||
top: 0;
|
||||
left: -20px;
|
||||
height: 100%;
|
||||
background-image: url('fancybox/fancybox-y.png');
|
||||
}
|
||||
|
||||
#fancybox-bg-nw {
|
||||
top: -20px;
|
||||
left: -20px;
|
||||
background-image: url('fancybox/fancybox.png');
|
||||
background-position: -40px -122px;
|
||||
}
|
||||
|
||||
#fancybox-title {
|
||||
font-family: Helvetica;
|
||||
font-size: 12px;
|
||||
z-index: 1102;
|
||||
}
|
||||
|
||||
.fancybox-title-inside {
|
||||
padding-bottom: 10px;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fancybox-title-outside {
|
||||
padding-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.fancybox-title-over {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
color: #FFF;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#fancybox-title-over {
|
||||
padding: 10px;
|
||||
background-image: url('fancybox/fancy_title_over.png');
|
||||
display: block;
|
||||
}
|
||||
|
||||
.fancybox-title-float {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: -20px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
#fancybox-title-float-wrap {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#fancybox-title-float-wrap td {
|
||||
border: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#fancybox-title-float-left {
|
||||
padding: 0 0 0 15px;
|
||||
background: url('fancybox/fancybox.png') -40px -90px no-repeat;
|
||||
}
|
||||
|
||||
#fancybox-title-float-main {
|
||||
color: #FFF;
|
||||
line-height: 29px;
|
||||
font-weight: bold;
|
||||
padding: 0 0 3px 0;
|
||||
background: url('fancybox/fancybox-x.png') 0px -40px;
|
||||
}
|
||||
|
||||
#fancybox-title-float-right {
|
||||
padding: 0 0 0 15px;
|
||||
background: url('fancybox/fancybox.png') -55px -90px no-repeat;
|
||||
}
|
||||
|
||||
/* IE6 */
|
||||
|
||||
.fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); }
|
||||
|
||||
.fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); }
|
||||
.fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); }
|
||||
|
||||
.fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
|
||||
.fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); }
|
||||
.fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); }
|
||||
.fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); }
|
||||
|
||||
.fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame {
|
||||
height: expression(this.parentNode.clientHeight + "px");
|
||||
}
|
||||
|
||||
#fancybox-loading.fancybox-ie6 {
|
||||
position: absolute; margin-top: 0;
|
||||
top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px');
|
||||
}
|
||||
|
||||
#fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); }
|
||||
|
||||
/* IE6, IE7, IE8 */
|
||||
|
||||
.fancybox-ie .fancybox-bg { background: transparent !important; }
|
||||
|
||||
.fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); }
|
||||
.fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); }
|
|
@ -3,29 +3,22 @@ class HomeController < ApplicationController
|
|||
|
||||
def index
|
||||
# unaccepted tasks
|
||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
||||
@unaccepted_tasks = Task.unaccepted_tasks_for(current_user)
|
||||
# task in next week
|
||||
@next_tasks = @current_user.next_tasks
|
||||
@next_tasks = Task.next_assigned_tasks_for(current_user)
|
||||
# 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.member_of?(task.workgroup)
|
||||
end
|
||||
@unassigned_tasks = Task.unassigned_tasks_for(current_user)
|
||||
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'
|
||||
if @current_user.update_attributes(params[:user])
|
||||
redirect_to my_profile_url, notice: 'Änderungen wurden gespeichert.'
|
||||
else
|
||||
render :action => 'profile'
|
||||
render :profile
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -34,10 +27,6 @@ class HomeController < ApplicationController
|
|||
@ordergroup = @user.ordergroup
|
||||
|
||||
unless @ordergroup.nil?
|
||||
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
||||
@ordergroup_columns = ["description", "account_balance", "account_updated"]
|
||||
|
||||
#listing the financial transactions with ajax...
|
||||
|
||||
if params['sort']
|
||||
sort = case params['sort']
|
||||
|
@ -52,18 +41,9 @@ class HomeController < ApplicationController
|
|||
sort = "created_on DESC"
|
||||
end
|
||||
|
||||
# or if somebody uses the search field:
|
||||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||
@financial_transactions = @ordergroup.financial_transactions.page(params[:page]).per(@per_page).order(sort)
|
||||
@financial_transactions = @financial_transactions.where("note LIKE ?", "%#{params[:query]}%") if params[:query].present?
|
||||
|
||||
@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 :layout => false }
|
||||
end
|
||||
else
|
||||
redirect_to root_path, :alert => "Leider bist Du kein Mitglied einer Bestellgruppe"
|
||||
end
|
||||
|
|
|
@ -8,12 +8,12 @@ class TasksController < ApplicationController
|
|||
end
|
||||
|
||||
def user
|
||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
||||
@accepted_tasks = @current_user.accepted_tasks
|
||||
@unaccepted_tasks = Task.unaccepted_tasks_for(current_user)
|
||||
@accepted_tasks = Task.accepted_tasks_for(current_user)
|
||||
end
|
||||
|
||||
def new
|
||||
@task = Task.new
|
||||
@task = Task.new(current_user_id: current_user.id)
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -31,6 +31,7 @@ class TasksController < ApplicationController
|
|||
|
||||
def edit
|
||||
@task = Task.find(params[:id])
|
||||
@task.current_user_id = current_user.id
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -3,8 +3,11 @@ class Task < ActiveRecord::Base
|
|||
has_many :users, :through => :assignments
|
||||
belongs_to :workgroup
|
||||
|
||||
scope :non_group, :conditions => { :workgroup_id => nil, :done => false }
|
||||
scope :done, :conditions => {:done => true}, :order => "due_date DESC"
|
||||
scope :non_group, where(workgroup_id: nil, done: false)
|
||||
scope :done, where(done: true)
|
||||
scope :undone, where(done: false)
|
||||
|
||||
attr_accessor :current_user_id
|
||||
|
||||
# form will send user in string. responsibilities will added later
|
||||
attr_protected :users
|
||||
|
@ -16,6 +19,32 @@ class Task < ActiveRecord::Base
|
|||
|
||||
after_save :update_ordergroup_stats
|
||||
|
||||
# Find all tasks, for which the current user should be responsible
|
||||
# but which aren't accepted yet
|
||||
def self.unaccepted_tasks_for(user)
|
||||
user.tasks.undone.where(assignments: {accepted: false})
|
||||
end
|
||||
|
||||
# Find all accepted tasks, which aren't done
|
||||
def self.accepted_tasks_for(user)
|
||||
user.tasks.undone.where(assignments: {accepted: true})
|
||||
end
|
||||
|
||||
|
||||
# find all tasks in the next week (or another number of days)
|
||||
def self.next_assigned_tasks_for(user, number = 7)
|
||||
user.tasks.undone.where(assignments: {accepted: true}).
|
||||
where(["tasks.due_date >= ? AND tasks.due_date <= ?", Time.now, number.days.from_now])
|
||||
end
|
||||
|
||||
# count tasks with no responsible person
|
||||
# tasks for groups the user is not a member are ignored
|
||||
def self.unassigned_tasks_for(user)
|
||||
Task.undone.where(assigned: false).includes(:workgroup).all.select do |task|
|
||||
!task.workgroup or user.member_of?(task.workgroup)
|
||||
end
|
||||
end
|
||||
|
||||
def is_assigned?(user)
|
||||
self.assignments.detect {|ass| ass.user_id == user.id }
|
||||
end
|
||||
|
@ -35,13 +64,13 @@ class Task < ActiveRecord::Base
|
|||
new_users = list - users.collect(&:id)
|
||||
old_users = users.reject { |user| list.include?(user.id) }
|
||||
|
||||
logger.debug "New users: #{new_users}"
|
||||
logger.debug "[debug] New users: #{new_users}"
|
||||
logger.debug "Old users: #{old_users}"
|
||||
|
||||
self.class.transaction do
|
||||
# delete old assignments
|
||||
if old_users.any?
|
||||
assignments.find(:all, :conditions => ["user_id IN (?)", old_users.collect(&:id)]).each(&:destroy)
|
||||
assignments.where(user_id: old_users.map(&:id)).each(&:destroy)
|
||||
end
|
||||
# create new assignments
|
||||
new_users.each do |id|
|
||||
|
@ -49,7 +78,7 @@ class Task < ActiveRecord::Base
|
|||
if user.blank?
|
||||
errors.add(:user_list)
|
||||
else
|
||||
if user == User.current_user
|
||||
if id == current_user_id
|
||||
# current_user will accept, when he puts himself to the list of users
|
||||
self.assignments.build :user => user, :accepted => true
|
||||
else
|
||||
|
|
|
@ -138,44 +138,6 @@ class User < ActiveRecord::Base
|
|||
ordergroup ? ordergroup.name : "keine Bestellgruppe"
|
||||
end
|
||||
|
||||
# Find all tasks, for which the current user should be responsible
|
||||
# but which aren't accepted yet
|
||||
def unaccepted_tasks
|
||||
# this doesn't work. Produces "undefined method", when later use task.users... Rails Bug?
|
||||
# self.tasks.find :all, :conditions => ["accepted = ?", false], :order => "due_date DESC"
|
||||
Task.find_by_sql ["SELECT t.* FROM tasks t, assignments a, users u
|
||||
WHERE u.id = a.user_id
|
||||
AND t.id = a.task_id
|
||||
AND u.id = ?
|
||||
AND a.accepted = ?
|
||||
AND t.done = ?
|
||||
ORDER BY t.due_date ASC", self.id, false, false]
|
||||
end
|
||||
|
||||
# Find all accepted tasks, which aren't done
|
||||
def accepted_tasks
|
||||
Task.find_by_sql ["SELECT t.* FROM tasks t, assignments a, users u
|
||||
WHERE u.id = a.user_id
|
||||
AND t.id = a.task_id
|
||||
AND u.id = ?
|
||||
AND a.accepted = ?
|
||||
AND t.done = ?
|
||||
ORDER BY t.due_date ASC", self.id, true, false]
|
||||
end
|
||||
|
||||
# find all tasks in the next week (or another number of days)
|
||||
def next_tasks(number = 7)
|
||||
Task.find_by_sql ["SELECT t.* FROM tasks t, assignments a, users u
|
||||
WHERE u.id = a.user_id
|
||||
AND t.id = a.task_id
|
||||
AND u.id = ?
|
||||
AND t.due_date >= ?
|
||||
AND t.due_date <= ?
|
||||
AND t.done = ?
|
||||
AND a.accepted = ?
|
||||
ORDER BY t.due_date ASC", self.id, Time.now, number.days.from_now, false, true]
|
||||
end
|
||||
|
||||
# returns true if user is a member of a given group
|
||||
def member_of?(group)
|
||||
group.users.exists?(self.id)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
$('#article_#{@article.id}').replaceWith('#{escape_javascript(render(@article))}');
|
||||
$.fancybox.close();
|
||||
$('#modalContainer').modal('hide');
|
||||
|
|
|
@ -3,22 +3,25 @@
|
|||
- content_for(:sidebar) do
|
||||
= render :partial => 'start_nav'
|
||||
|
||||
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0
|
||||
%section.well
|
||||
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks.size == 0
|
||||
%section.row-fluid
|
||||
- unless @next_tasks.empty?
|
||||
%h3 Deine Aufgaben für nächste Woche
|
||||
%dl.dl-horizontal
|
||||
- @next_tasks.each do |task|
|
||||
%dt= l task.due_date, format: "%A, %d. %b"
|
||||
%dd= link_to task.name, task_path(task)
|
||||
|
||||
.span3.well
|
||||
%h4 Deine Aufgaben
|
||||
%dl
|
||||
- @next_tasks.each do |task|
|
||||
%dt= l task.due_date, format: "%A, %d. %b"
|
||||
%dd= link_to task.name, task_path(task)
|
||||
- unless @unaccepted_tasks.empty?
|
||||
%h3 Aufgaben übernehmen
|
||||
Du bis für Aufgaben verantwortlich.
|
||||
= link_to "Aufgaben übernehmen/ablehnen", user_tasks_path
|
||||
- unless @unassigned_tasks_number == 0
|
||||
%h3 Offene Aufgaben
|
||||
= "Es gibt #{@unassigned_tasks_number} #{link_to 'offene Aufgabe(n)', :controller => 'tasks'}".html_safe
|
||||
.span3.well
|
||||
%h4 Aufgaben übernehmen
|
||||
Du bis für Aufgaben verantwortlich.
|
||||
= link_to "Aufgaben übernehmen/ablehnen", user_tasks_path
|
||||
- unless @unassigned_tasks.size == 0
|
||||
.span3.well
|
||||
%h4 Offene Aufgaben
|
||||
Es gibt #{@unassigned_tasks.size}
|
||||
= link_to 'offene Aufgabe(n)', tasks_path
|
||||
|
||||
- if current_user.ordergroup
|
||||
= render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup}
|
||||
|
|
|
@ -1,35 +1,26 @@
|
|||
%h1 Meine Bestellgruppe
|
||||
.left_column
|
||||
.box_title
|
||||
%h2= h @ordergroup.name
|
||||
.column_content
|
||||
%p
|
||||
%b Beschreibung:
|
||||
= h @ordergroup.description
|
||||
%p
|
||||
%b Verfügbares Guthaben:
|
||||
= number_to_currency(@ordergroup.get_available_funds())
|
||||
%h2 Personen
|
||||
%ul{:style => "list-style-type:decimal;"}
|
||||
- for membership in @ordergroup.memberships
|
||||
%li= membership.user.nick
|
||||
= link_to('Person einladen', new_invite_path(:id => @ordergroup), :remote => true)
|
||||
.right_column
|
||||
.box_title
|
||||
%h2 Kontoauszug
|
||||
.column_content
|
||||
= form_tag my_ordergroup_url, :method => :get, :style => 'display:inline;', :id => 'transactions_search', |
|
||||
:remote => true do |
|
||||
= label_tag "financial_transaction_note", "Filter für Notizen:"
|
||||
= text_field_tag("query", params['query'], :size => 10 )
|
||||
#transactions
|
||||
= render :partial => "/finance/transactions/list"
|
||||
#edit_box{:style => "display:none"}
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('#query').observe_field(1, function() {
|
||||
$('#transactions_search').submit();
|
||||
});
|
||||
})
|
||||
-title "Meine Bestellgruppe"
|
||||
|
||||
.row-fluid
|
||||
.span4
|
||||
%h2= @ordergroup.name
|
||||
.well
|
||||
%p
|
||||
%b Beschreibung:
|
||||
= @ordergroup.description
|
||||
%p
|
||||
%b Verfügbares Guthaben:
|
||||
= number_to_currency(@ordergroup.get_available_funds())
|
||||
%h2 Personen
|
||||
%ul{:style => "list-style-type:decimal;"}
|
||||
- for membership in @ordergroup.memberships
|
||||
%li= membership.user.nick
|
||||
= link_to('Person einladen', new_invite_path(:id => @ordergroup), :remote => true)
|
||||
.span8
|
||||
%h2 Kontoauszug
|
||||
.well.well-small
|
||||
= form_tag my_ordergroup_path, :method => :get, :remote => true,
|
||||
'data-submit-onchange' => true, class: 'form-search' do
|
||||
= text_field_tag :query, params[:query], class: 'input-medium search-query',
|
||||
placeholder: 'Suchen ...'
|
||||
#transactions= render "finance/financial_transactions/transactions"
|
||||
|
|
@ -1 +1 @@
|
|||
$('#transactions').html('#{escape_javascript(render("finance/transactions/list"))}');
|
||||
$('#transactions').html('#{j(render("finance/financial_transactions/transactions"))}');
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
- title "Mein Profil"
|
||||
%p
|
||||
Hier kannst Du deine Einstellungen ändern, z.b. Deine Telphonnummer oder Dein Passwort.
|
||||
.left_column{:style => "width: 60%;"}
|
||||
.box_title
|
||||
%h2
|
||||
= h @user.nick
|
||||
- title "Mein Profil", false
|
||||
|
||||
.row-fluid
|
||||
.span7
|
||||
%h3
|
||||
= h @current_user.nick
|
||||
%small
|
||||
(Mitglied seit: #{distance_of_time_in_words(Time.now, @user.created_on)})
|
||||
.column_content
|
||||
- simple_form_for(@user, :url => { :action => 'update_profile'}) do |f|
|
||||
(Mitglied seit: #{distance_of_time_in_words(Time.now, @current_user.created_on)})
|
||||
= simple_form_for(@current_user, :url => { :action => 'update_profile'}) do |f|
|
||||
= render :partial => 'shared/user_form_fields', :locals => {:f => f}
|
||||
= submit_tag 'Speichern'
|
||||
.right_column{:style => "width: 35%;"}
|
||||
.box_title
|
||||
.form-actions
|
||||
= submit_tag 'Speichern', class: 'btn'
|
||||
.span5
|
||||
%h2 Du bist Mitglied in folgenden Gruppen
|
||||
.column_content
|
||||
- for membership in Membership.find_all_by_user_id(@user.id)
|
||||
%p
|
||||
= membership.group.name
|
||||
= link_to "Neue Mitglieder einladen", new_invite_path(id: membership.group_id)
|
||||
- if membership.group.type != 'Ordergroup'
|
||||
= link_to "Mitgliedschaft beenden", cancel_membership_path(membership_id: membership),
|
||||
confirm: "Bist Du sicher, dass Du Deine Mitgliedschaft beenden willst?", method: :post
|
||||
%table.table.table-striped
|
||||
- @current_user.memberships.each do |membership|
|
||||
%tr
|
||||
%td= membership.group.name
|
||||
%td= link_to "Neue Mitglieder einladen", new_invite_path(id: membership.group_id),
|
||||
remote: true, class: 'btn btn-success btn-small'
|
||||
- if membership.group.type != 'Ordergroup'
|
||||
%td= link_to "Mitgliedschaft beenden", cancel_membership_path(membership_id: membership),
|
||||
confirm: "Bist Du sicher, dass Du Deine Mitgliedschaft beenden willst?", method: :post,
|
||||
class: 'btn btn-danger btn-small'
|
||||
|
|
|
@ -1 +1 @@
|
|||
$('#modalForm').modal('hide');
|
||||
$('#modalContainer').modal('hide');
|
|
@ -1,2 +1,2 @@
|
|||
$('#modalContainer').html('#{escape_javascript(render('modal_form'))}');
|
||||
$('#modalForm').modal();
|
||||
$('#modalContainer').html('#{j(render('modal_form'))}');
|
||||
$('#modalContainer').modal();
|
|
@ -15,6 +15,7 @@
|
|||
= render "shared/workgroup_members"
|
||||
|
||||
= simple_form_for @task do |f|
|
||||
= f.hidden_field :current_user_id
|
||||
= f.input :name
|
||||
= f.input :description, as: :text, input_html: {rows: 10}
|
||||
= f.input :duration, :as => :select, :collection => 1..3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- title "Aufgabe im Detail"
|
||||
- title "Aufgabe anzeigen"
|
||||
- content_for :sidebar do
|
||||
= render 'nav'
|
||||
|
||||
|
@ -18,10 +18,9 @@
|
|||
%dd
|
||||
- if @task.workgroup
|
||||
= link_to @task.workgroup.name, workgroup_tasks_path(workgroup_id: @task.workgroup_id)
|
||||
|
||||
%p
|
||||
- unless @task.done?
|
||||
= link_to 'Als erledigt markieren', set_done_task_path(@task), method: :post, class: 'btn'
|
||||
= link_to "Bearbeiten", edit_task_path(@task), class: 'btn'
|
||||
= link_to "Löschen", task_path(@task), :method => :delete, :confirm => "Die Aufgabe wirklich löschen?",
|
||||
class: 'btn btn-danger'
|
||||
%p
|
||||
- unless @task.done?
|
||||
= link_to 'Als erledigt markieren', set_done_task_path(@task), method: :post, class: 'btn'
|
||||
= link_to "Bearbeiten", edit_task_path(@task), class: 'btn'
|
||||
= link_to "Löschen", task_path(@task), :method => :delete, :confirm => "Die Aufgabe wirklich löschen?",
|
||||
class: 'btn btn-danger'
|
||||
|
|
|
@ -54,6 +54,7 @@ SimpleNavigation::Configuration.run do |navigation|
|
|||
primary.item :feedback, 'Feedback', new_feedback_path, title: "Fehler gefunden? Vorschlag? Idee? Kritik?", id: nil
|
||||
primary.item :nick, current_user.nick, '#' do |subnav|
|
||||
subnav.item :edit_profile, 'Profil bearbeiten', my_profile_path, title: 'Profil bearbeiten', id: nil
|
||||
subnav.item :my_ordergroup, 'Meine Bestellgruppe', my_ordergroup_path, id: nil
|
||||
subnav.item :logout, 'Abmelden', logout_path, id: nil
|
||||
end
|
||||
end
|
||||
|
|