Removed fancybox. Fixed profile, my ordergroup and tasks.
|
@ -6,7 +6,6 @@
|
||||||
//= require bootstrap-datepicker
|
//= require bootstrap-datepicker
|
||||||
//= require bootstrap-datepicker.de
|
//= require bootstrap-datepicker.de
|
||||||
//= require jquery.observe_field
|
//= require jquery.observe_field
|
||||||
//= require jquery.fancybox-1.3.4.pack
|
|
||||||
//= require rails.validations
|
//= require rails.validations
|
||||||
//= require_self
|
//= require_self
|
||||||
//= require ordering
|
//= require ordering
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/*
|
/*
|
||||||
*= require bootstrap_and_overrides
|
*= require bootstrap_and_overrides
|
||||||
*= require token-input-bootstrappy
|
*= 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
|
def index
|
||||||
# unaccepted tasks
|
# unaccepted tasks
|
||||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
@unaccepted_tasks = Task.unaccepted_tasks_for(current_user)
|
||||||
# task in next week
|
# 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
|
# count tasks with no responsible person
|
||||||
# tasks for groups the current user is not a member are ignored
|
# tasks for groups the current user is not a member are ignored
|
||||||
tasks = Task.find(:all, :conditions => ["assigned = ? and done = ?", false, false])
|
@unassigned_tasks = Task.unassigned_tasks_for(current_user)
|
||||||
@unassigned_tasks_number = 0
|
|
||||||
for task in tasks
|
|
||||||
(@unassigned_tasks_number += 1) unless task.workgroup && !current_user.member_of?(task.workgroup)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def profile
|
def profile
|
||||||
@user = @current_user
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_profile
|
def update_profile
|
||||||
@user = @current_user
|
if @current_user.update_attributes(params[:user])
|
||||||
if @user.update_attributes(params[:user])
|
redirect_to my_profile_url, notice: 'Änderungen wurden gespeichert.'
|
||||||
flash[:notice] = 'Änderungen wurden gespeichert.'
|
|
||||||
redirect_to :action => 'profile'
|
|
||||||
else
|
else
|
||||||
render :action => 'profile'
|
render :profile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,10 +27,6 @@ class HomeController < ApplicationController
|
||||||
@ordergroup = @user.ordergroup
|
@ordergroup = @user.ordergroup
|
||||||
|
|
||||||
unless @ordergroup.nil?
|
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']
|
if params['sort']
|
||||||
sort = case params['sort']
|
sort = case params['sort']
|
||||||
|
@ -52,18 +41,9 @@ class HomeController < ApplicationController
|
||||||
sort = "created_on DESC"
|
sort = "created_on DESC"
|
||||||
end
|
end
|
||||||
|
|
||||||
# or if somebody uses the search field:
|
@financial_transactions = @ordergroup.financial_transactions.page(params[:page]).per(@per_page).order(sort)
|
||||||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
@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
|
else
|
||||||
redirect_to root_path, :alert => "Leider bist Du kein Mitglied einer Bestellgruppe"
|
redirect_to root_path, :alert => "Leider bist Du kein Mitglied einer Bestellgruppe"
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,12 +8,12 @@ class TasksController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def user
|
def user
|
||||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
@unaccepted_tasks = Task.unaccepted_tasks_for(current_user)
|
||||||
@accepted_tasks = @current_user.accepted_tasks
|
@accepted_tasks = Task.accepted_tasks_for(current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@task = Task.new
|
@task = Task.new(current_user_id: current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -31,6 +31,7 @@ class TasksController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@task = Task.find(params[:id])
|
@task = Task.find(params[:id])
|
||||||
|
@task.current_user_id = current_user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -3,8 +3,11 @@ class Task < ActiveRecord::Base
|
||||||
has_many :users, :through => :assignments
|
has_many :users, :through => :assignments
|
||||||
belongs_to :workgroup
|
belongs_to :workgroup
|
||||||
|
|
||||||
scope :non_group, :conditions => { :workgroup_id => nil, :done => false }
|
scope :non_group, where(workgroup_id: nil, done: false)
|
||||||
scope :done, :conditions => {:done => true}, :order => "due_date DESC"
|
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
|
# form will send user in string. responsibilities will added later
|
||||||
attr_protected :users
|
attr_protected :users
|
||||||
|
@ -16,6 +19,32 @@ class Task < ActiveRecord::Base
|
||||||
|
|
||||||
after_save :update_ordergroup_stats
|
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)
|
def is_assigned?(user)
|
||||||
self.assignments.detect {|ass| ass.user_id == user.id }
|
self.assignments.detect {|ass| ass.user_id == user.id }
|
||||||
end
|
end
|
||||||
|
@ -35,13 +64,13 @@ class Task < ActiveRecord::Base
|
||||||
new_users = list - users.collect(&:id)
|
new_users = list - users.collect(&:id)
|
||||||
old_users = users.reject { |user| list.include?(user.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}"
|
logger.debug "Old users: #{old_users}"
|
||||||
|
|
||||||
self.class.transaction do
|
self.class.transaction do
|
||||||
# delete old assignments
|
# delete old assignments
|
||||||
if old_users.any?
|
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
|
end
|
||||||
# create new assignments
|
# create new assignments
|
||||||
new_users.each do |id|
|
new_users.each do |id|
|
||||||
|
@ -49,7 +78,7 @@ class Task < ActiveRecord::Base
|
||||||
if user.blank?
|
if user.blank?
|
||||||
errors.add(:user_list)
|
errors.add(:user_list)
|
||||||
else
|
else
|
||||||
if user == User.current_user
|
if id == current_user_id
|
||||||
# current_user will accept, when he puts himself to the list of users
|
# current_user will accept, when he puts himself to the list of users
|
||||||
self.assignments.build :user => user, :accepted => true
|
self.assignments.build :user => user, :accepted => true
|
||||||
else
|
else
|
||||||
|
|
|
@ -138,44 +138,6 @@ class User < ActiveRecord::Base
|
||||||
ordergroup ? ordergroup.name : "keine Bestellgruppe"
|
ordergroup ? ordergroup.name : "keine Bestellgruppe"
|
||||||
end
|
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
|
# returns true if user is a member of a given group
|
||||||
def member_of?(group)
|
def member_of?(group)
|
||||||
group.users.exists?(self.id)
|
group.users.exists?(self.id)
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
$('#article_#{@article.id}').replaceWith('#{escape_javascript(render(@article))}');
|
$('#article_#{@article.id}').replaceWith('#{escape_javascript(render(@article))}');
|
||||||
$.fancybox.close();
|
$('#modalContainer').modal('hide');
|
||||||
|
|
|
@ -3,22 +3,25 @@
|
||||||
- content_for(:sidebar) do
|
- content_for(:sidebar) do
|
||||||
= render :partial => 'start_nav'
|
= render :partial => 'start_nav'
|
||||||
|
|
||||||
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0
|
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks.size == 0
|
||||||
%section.well
|
%section.row-fluid
|
||||||
- unless @next_tasks.empty?
|
- unless @next_tasks.empty?
|
||||||
%h3 Deine Aufgaben für nächste Woche
|
.span3.well
|
||||||
%dl.dl-horizontal
|
%h4 Deine Aufgaben
|
||||||
- @next_tasks.each do |task|
|
%dl
|
||||||
%dt= l task.due_date, format: "%A, %d. %b"
|
- @next_tasks.each do |task|
|
||||||
%dd= link_to task.name, task_path(task)
|
%dt= l task.due_date, format: "%A, %d. %b"
|
||||||
|
%dd= link_to task.name, task_path(task)
|
||||||
- unless @unaccepted_tasks.empty?
|
- unless @unaccepted_tasks.empty?
|
||||||
%h3 Aufgaben übernehmen
|
.span3.well
|
||||||
Du bis für Aufgaben verantwortlich.
|
%h4 Aufgaben übernehmen
|
||||||
= link_to "Aufgaben übernehmen/ablehnen", user_tasks_path
|
Du bis für Aufgaben verantwortlich.
|
||||||
- unless @unassigned_tasks_number == 0
|
= link_to "Aufgaben übernehmen/ablehnen", user_tasks_path
|
||||||
%h3 Offene Aufgaben
|
- unless @unassigned_tasks.size == 0
|
||||||
= "Es gibt #{@unassigned_tasks_number} #{link_to 'offene Aufgabe(n)', :controller => 'tasks'}".html_safe
|
.span3.well
|
||||||
|
%h4 Offene Aufgaben
|
||||||
|
Es gibt #{@unassigned_tasks.size}
|
||||||
|
= link_to 'offene Aufgabe(n)', tasks_path
|
||||||
|
|
||||||
- if current_user.ordergroup
|
- if current_user.ordergroup
|
||||||
= render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup}
|
= render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup}
|
||||||
|
|
|
@ -1,35 +1,26 @@
|
||||||
%h1 Meine Bestellgruppe
|
-title "Meine Bestellgruppe"
|
||||||
.left_column
|
|
||||||
.box_title
|
.row-fluid
|
||||||
%h2= h @ordergroup.name
|
.span4
|
||||||
.column_content
|
%h2= @ordergroup.name
|
||||||
%p
|
.well
|
||||||
%b Beschreibung:
|
%p
|
||||||
= h @ordergroup.description
|
%b Beschreibung:
|
||||||
%p
|
= @ordergroup.description
|
||||||
%b Verfügbares Guthaben:
|
%p
|
||||||
= number_to_currency(@ordergroup.get_available_funds())
|
%b Verfügbares Guthaben:
|
||||||
%h2 Personen
|
= number_to_currency(@ordergroup.get_available_funds())
|
||||||
%ul{:style => "list-style-type:decimal;"}
|
%h2 Personen
|
||||||
- for membership in @ordergroup.memberships
|
%ul{:style => "list-style-type:decimal;"}
|
||||||
%li= membership.user.nick
|
- for membership in @ordergroup.memberships
|
||||||
= link_to('Person einladen', new_invite_path(:id => @ordergroup), :remote => true)
|
%li= membership.user.nick
|
||||||
.right_column
|
= link_to('Person einladen', new_invite_path(:id => @ordergroup), :remote => true)
|
||||||
.box_title
|
.span8
|
||||||
%h2 Kontoauszug
|
%h2 Kontoauszug
|
||||||
.column_content
|
.well.well-small
|
||||||
= form_tag my_ordergroup_url, :method => :get, :style => 'display:inline;', :id => 'transactions_search', |
|
= form_tag my_ordergroup_path, :method => :get, :remote => true,
|
||||||
:remote => true do |
|
'data-submit-onchange' => true, class: 'form-search' do
|
||||||
= label_tag "financial_transaction_note", "Filter für Notizen:"
|
= text_field_tag :query, params[:query], class: 'input-medium search-query',
|
||||||
= text_field_tag("query", params['query'], :size => 10 )
|
placeholder: 'Suchen ...'
|
||||||
#transactions
|
#transactions= render "finance/financial_transactions/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();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
|
@ -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"
|
- title "Mein Profil", false
|
||||||
%p
|
|
||||||
Hier kannst Du deine Einstellungen ändern, z.b. Deine Telphonnummer oder Dein Passwort.
|
.row-fluid
|
||||||
.left_column{:style => "width: 60%;"}
|
.span7
|
||||||
.box_title
|
%h3
|
||||||
%h2
|
= h @current_user.nick
|
||||||
= h @user.nick
|
|
||||||
%small
|
%small
|
||||||
(Mitglied seit: #{distance_of_time_in_words(Time.now, @user.created_on)})
|
(Mitglied seit: #{distance_of_time_in_words(Time.now, @current_user.created_on)})
|
||||||
.column_content
|
= simple_form_for(@current_user, :url => { :action => 'update_profile'}) do |f|
|
||||||
- simple_form_for(@user, :url => { :action => 'update_profile'}) do |f|
|
|
||||||
= render :partial => 'shared/user_form_fields', :locals => {:f => f}
|
= render :partial => 'shared/user_form_fields', :locals => {:f => f}
|
||||||
= submit_tag 'Speichern'
|
.form-actions
|
||||||
.right_column{:style => "width: 35%;"}
|
= submit_tag 'Speichern', class: 'btn'
|
||||||
.box_title
|
.span5
|
||||||
%h2 Du bist Mitglied in folgenden Gruppen
|
%h2 Du bist Mitglied in folgenden Gruppen
|
||||||
.column_content
|
%table.table.table-striped
|
||||||
- for membership in Membership.find_all_by_user_id(@user.id)
|
- @current_user.memberships.each do |membership|
|
||||||
%p
|
%tr
|
||||||
= membership.group.name
|
%td= membership.group.name
|
||||||
= link_to "Neue Mitglieder einladen", new_invite_path(id: membership.group_id)
|
%td= link_to "Neue Mitglieder einladen", new_invite_path(id: membership.group_id),
|
||||||
- if membership.group.type != 'Ordergroup'
|
remote: true, class: 'btn btn-success btn-small'
|
||||||
= link_to "Mitgliedschaft beenden", cancel_membership_path(membership_id: membership),
|
- if membership.group.type != 'Ordergroup'
|
||||||
confirm: "Bist Du sicher, dass Du Deine Mitgliedschaft beenden willst?", method: :post
|
%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'))}');
|
$('#modalContainer').html('#{j(render('modal_form'))}');
|
||||||
$('#modalForm').modal();
|
$('#modalContainer').modal();
|
|
@ -15,6 +15,7 @@
|
||||||
= render "shared/workgroup_members"
|
= render "shared/workgroup_members"
|
||||||
|
|
||||||
= simple_form_for @task do |f|
|
= simple_form_for @task do |f|
|
||||||
|
= f.hidden_field :current_user_id
|
||||||
= f.input :name
|
= f.input :name
|
||||||
= f.input :description, as: :text, input_html: {rows: 10}
|
= f.input :description, as: :text, input_html: {rows: 10}
|
||||||
= f.input :duration, :as => :select, :collection => 1..3
|
= f.input :duration, :as => :select, :collection => 1..3
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- title "Aufgabe im Detail"
|
- title "Aufgabe anzeigen"
|
||||||
- content_for :sidebar do
|
- content_for :sidebar do
|
||||||
= render 'nav'
|
= render 'nav'
|
||||||
|
|
||||||
|
@ -18,10 +18,9 @@
|
||||||
%dd
|
%dd
|
||||||
- if @task.workgroup
|
- if @task.workgroup
|
||||||
= link_to @task.workgroup.name, workgroup_tasks_path(workgroup_id: @task.workgroup_id)
|
= link_to @task.workgroup.name, workgroup_tasks_path(workgroup_id: @task.workgroup_id)
|
||||||
|
%p
|
||||||
%p
|
- unless @task.done?
|
||||||
- unless @task.done?
|
= link_to 'Als erledigt markieren', set_done_task_path(@task), method: :post, class: 'btn'
|
||||||
= 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 "Bearbeiten", edit_task_path(@task), class: 'btn'
|
= link_to "Löschen", task_path(@task), :method => :delete, :confirm => "Die Aufgabe wirklich löschen?",
|
||||||
= link_to "Löschen", task_path(@task), :method => :delete, :confirm => "Die Aufgabe wirklich löschen?",
|
class: 'btn btn-danger'
|
||||||
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 :feedback, 'Feedback', new_feedback_path, title: "Fehler gefunden? Vorschlag? Idee? Kritik?", id: nil
|
||||||
primary.item :nick, current_user.nick, '#' do |subnav|
|
primary.item :nick, current_user.nick, '#' do |subnav|
|
||||||
subnav.item :edit_profile, 'Profil bearbeiten', my_profile_path, title: 'Profil bearbeiten', id: nil
|
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
|
subnav.item :logout, 'Abmelden', logout_path, id: nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|