Some fixes to home view.
This commit is contained in:
parent
06f2cc2007
commit
1cf63fc40b
6 changed files with 17 additions and 22 deletions
|
@ -2,13 +2,10 @@ class HomeController < ApplicationController
|
||||||
helper :messages
|
helper :messages
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@currentOrders = Order.open
|
|
||||||
@ordergroup = @current_user.ordergroup
|
|
||||||
# unaccepted tasks
|
# unaccepted tasks
|
||||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
@unaccepted_tasks = @current_user.unaccepted_tasks
|
||||||
# task in next week
|
# task in next week
|
||||||
@next_tasks = @current_user.next_tasks
|
@next_tasks = @current_user.next_tasks
|
||||||
@messages = Message.public.all :order => 'created_at DESC', :limit => 5
|
|
||||||
# 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])
|
tasks = Task.find(:all, :conditions => ["assigned = ? and done = ?", false, false])
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
# * account_updated (datetime)
|
# * account_updated (datetime)
|
||||||
class Ordergroup < Group
|
class Ordergroup < Group
|
||||||
acts_as_paranoid # Avoid deleting the ordergroup for consistency of order-results
|
acts_as_paranoid # Avoid deleting the ordergroup for consistency of order-results
|
||||||
extend ActiveSupport::Memoizable # Ability to cache method results. Use memoize :expensive_method
|
|
||||||
serialize :stats
|
serialize :stats
|
||||||
|
|
||||||
has_many :financial_transactions, :order => "created_on DESC"
|
has_many :financial_transactions, :order => "created_on DESC"
|
||||||
|
@ -36,7 +35,6 @@ class Ordergroup < Group
|
||||||
def get_available_funds(exclude = nil)
|
def get_available_funds(exclude = nil)
|
||||||
account_balance - value_of_open_orders(exclude) - value_of_finished_orders(exclude)
|
account_balance - value_of_open_orders(exclude) - value_of_finished_orders(exclude)
|
||||||
end
|
end
|
||||||
memoize :get_available_funds
|
|
||||||
|
|
||||||
# Creates a new FinancialTransaction for this Ordergroup and updates the account_balance accordingly.
|
# Creates a new FinancialTransaction for this Ordergroup and updates the account_balance accordingly.
|
||||||
# Throws an exception if it fails.
|
# Throws an exception if it fails.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
max_width = 600
|
max_width = 600
|
||||||
|
|
||||||
global_avg = Ordergroup.avg_jobs_per_euro
|
global_avg = Ordergroup.avg_jobs_per_euro
|
||||||
group_avg = @ordergroup.avg_jobs_per_euro.to_f
|
group_avg = ordergroup.avg_jobs_per_euro.to_f
|
||||||
|
|
||||||
unless global_avg == 0 or global_avg.nan?
|
unless global_avg == 0 or global_avg.nan?
|
||||||
length_of_global_bar = max_width / 2.0
|
length_of_global_bar = max_width / 2.0
|
||||||
|
|
|
@ -27,38 +27,38 @@
|
||||||
= "Es gibt #{@unassigned_tasks_number} #{link_to 'offene Aufgabe(n)', :controller => 'tasks'}".html_safe
|
= "Es gibt #{@unassigned_tasks_number} #{link_to 'offene Aufgabe(n)', :controller => 'tasks'}".html_safe
|
||||||
%p{:style => "clear:both"}= link_to "Meine Aufgaben", user_tasks_path
|
%p{:style => "clear:both"}= link_to "Meine Aufgaben", user_tasks_path
|
||||||
|
|
||||||
- if @ordergroup
|
- if current_user.ordergroup
|
||||||
// Current orders
|
// Current orders
|
||||||
= render :partial => 'shared/open_orders'
|
= render :partial => 'shared/open_orders'
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
- if @ordergroup
|
- if current_user.ordergroup
|
||||||
.box_title
|
.box_title
|
||||||
%h2 Engagement Deiner Bestellgruppe
|
%h2 Engagement Deiner Bestellgruppe
|
||||||
.column_content
|
.column_content
|
||||||
= render "stats"
|
= render :partial => "stats", :locals => {:ordergroup => current_user.ordergroup}
|
||||||
|
|
||||||
- unless @messages.empty?
|
- unless Message.public.empty?
|
||||||
.box_title
|
.box_title
|
||||||
%h2 Neuste Nachrichten
|
%h2 Neuste Nachrichten
|
||||||
.column_content
|
.column_content
|
||||||
= render :partial => 'messages/messages', :locals => { :subject_length => 70 }
|
= render :partial => 'messages/messages', :locals => {:messages => Message.public.order(:create_at.desc).limit(5), :subject_length => 70}
|
||||||
%br/
|
%br/
|
||||||
= link_to "Alle Nachrichten einsehen", messages_path
|
= link_to "Alle Nachrichten einsehen", messages_path
|
||||||
|
|
||||||
- if @ordergroup
|
- if current_user.ordergroup
|
||||||
// Ordergroup overview
|
// Ordergroup overview
|
||||||
.box_title
|
.box_title
|
||||||
%h2 Meine Bestellgruppe
|
%h2 Meine Bestellgruppe
|
||||||
.column_content
|
.column_content
|
||||||
%p
|
%p
|
||||||
%b= @ordergroup.name
|
%b= current_user.ordergroup.name
|
||||||
|
|
|
|
||||||
Verfügbares Guthaben:
|
Verfügbares Guthaben:
|
||||||
= number_to_currency(@ordergroup.get_available_funds())
|
= number_to_currency(current_user.ordergroup.get_available_funds)
|
||||||
%span.description
|
%span.description
|
||||||
(Letzte Aktualisierung ist
|
(Letzte Aktualisierung ist
|
||||||
= distance_of_time_in_words(Time.now, @ordergroup.account_updated) + " her)"
|
= distance_of_time_in_words(Time.now, current_user.ordergroup.account_updated) + " her)"
|
||||||
%h3 Letzte Transaktionen
|
%h3 Letzte Transaktionen
|
||||||
%table
|
%table
|
||||||
%tr
|
%tr
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
%th Wer
|
%th Wer
|
||||||
%th Notiz
|
%th Notiz
|
||||||
%th Betrag
|
%th Betrag
|
||||||
- for ft in @ordergroup.financial_transactions.all(:limit => 5)
|
- for ft in current_user.ordergroup.financial_transactions.limit(5)
|
||||||
%tr{:class => cycle('even','odd')}
|
%tr{:class => cycle('even','odd')}
|
||||||
%td= format_time(ft.created_on)
|
%td= format_time(ft.created_on)
|
||||||
%td= h(ft.user.nil? ? '?' : ft.user.nick)
|
%td= h(ft.user.nil? ? '?' : ft.user.nick)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- unless @messages.empty?
|
- unless messages.empty?
|
||||||
%table.list
|
%table.list
|
||||||
%tbody
|
%tbody
|
||||||
- for message in @messages
|
- for message in messages
|
||||||
%tr{:class => cycle('even','odd', :name => 'messages')}
|
%tr{:class => cycle('even','odd', :name => 'messages')}
|
||||||
%td= format_subject(message, subject_length)
|
%td= format_subject(message, subject_length)
|
||||||
%td= h(message.sender_name)
|
%td= h(message.sender_name)
|
||||||
|
|
|
@ -77,10 +77,10 @@ de:
|
||||||
currency:
|
currency:
|
||||||
format:
|
format:
|
||||||
unit: '€'
|
unit: '€'
|
||||||
format: '%n%u'
|
format: '%n %u'
|
||||||
separator:
|
separator: ','
|
||||||
delimiter:
|
delimiter: '.'
|
||||||
precision:
|
precision: 2
|
||||||
percentage:
|
percentage:
|
||||||
format:
|
format:
|
||||||
delimiter: ""
|
delimiter: ""
|
||||||
|
|
Loading…
Reference in a new issue