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
|
||||
|
||||
def index
|
||||
@currentOrders = Order.open
|
||||
@ordergroup = @current_user.ordergroup
|
||||
# unaccepted tasks
|
||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
||||
# task in next week
|
||||
@next_tasks = @current_user.next_tasks
|
||||
@messages = Message.public.all :order => 'created_at DESC', :limit => 5
|
||||
# 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])
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
# * account_updated (datetime)
|
||||
class Ordergroup < Group
|
||||
acts_as_paranoid # Avoid deleting the ordergroup for consistency of order-results
|
||||
extend ActiveSupport::Memoizable # Ability to cache method results. Use memoize :expensive_method
|
||||
serialize :stats
|
||||
|
||||
has_many :financial_transactions, :order => "created_on DESC"
|
||||
|
@ -36,7 +35,6 @@ class Ordergroup < Group
|
|||
def get_available_funds(exclude = nil)
|
||||
account_balance - value_of_open_orders(exclude) - value_of_finished_orders(exclude)
|
||||
end
|
||||
memoize :get_available_funds
|
||||
|
||||
# Creates a new FinancialTransaction for this Ordergroup and updates the account_balance accordingly.
|
||||
# Throws an exception if it fails.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
max_width = 600
|
||||
|
||||
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?
|
||||
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
|
||||
%p{:style => "clear:both"}= link_to "Meine Aufgaben", user_tasks_path
|
||||
|
||||
- if @ordergroup
|
||||
- if current_user.ordergroup
|
||||
// Current orders
|
||||
= render :partial => 'shared/open_orders'
|
||||
|
||||
// Stats
|
||||
- if @ordergroup
|
||||
- if current_user.ordergroup
|
||||
.box_title
|
||||
%h2 Engagement Deiner Bestellgruppe
|
||||
.column_content
|
||||
= render "stats"
|
||||
= render :partial => "stats", :locals => {:ordergroup => current_user.ordergroup}
|
||||
|
||||
- unless @messages.empty?
|
||||
- unless Message.public.empty?
|
||||
.box_title
|
||||
%h2 Neuste Nachrichten
|
||||
.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/
|
||||
= link_to "Alle Nachrichten einsehen", messages_path
|
||||
|
||||
- if @ordergroup
|
||||
- if current_user.ordergroup
|
||||
// Ordergroup overview
|
||||
.box_title
|
||||
%h2 Meine Bestellgruppe
|
||||
.column_content
|
||||
%p
|
||||
%b= @ordergroup.name
|
||||
%b= current_user.ordergroup.name
|
||||
|
|
||||
Verfügbares Guthaben:
|
||||
= number_to_currency(@ordergroup.get_available_funds())
|
||||
= number_to_currency(current_user.ordergroup.get_available_funds)
|
||||
%span.description
|
||||
(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
|
||||
%table
|
||||
%tr
|
||||
|
@ -66,7 +66,7 @@
|
|||
%th Wer
|
||||
%th Notiz
|
||||
%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')}
|
||||
%td= format_time(ft.created_on)
|
||||
%td= h(ft.user.nil? ? '?' : ft.user.nick)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- unless @messages.empty?
|
||||
- unless messages.empty?
|
||||
%table.list
|
||||
%tbody
|
||||
- for message in @messages
|
||||
- for message in messages
|
||||
%tr{:class => cycle('even','odd', :name => 'messages')}
|
||||
%td= format_subject(message, subject_length)
|
||||
%td= h(message.sender_name)
|
||||
|
|
|
@ -78,9 +78,9 @@ de:
|
|||
format:
|
||||
unit: '€'
|
||||
format: '%n %u'
|
||||
separator:
|
||||
delimiter:
|
||||
precision:
|
||||
separator: ','
|
||||
delimiter: '.'
|
||||
precision: 2
|
||||
percentage:
|
||||
format:
|
||||
delimiter: ""
|
||||
|
|
Loading…
Reference in a new issue