Some fixes of bugs during last commit.

This commit is contained in:
Benjamin Meichsner 2009-01-15 20:10:50 +01:00
parent e8d55e50c0
commit 7ff0467b16
6 changed files with 21 additions and 16 deletions

View File

@ -1,4 +1,5 @@
class HomeController < ApplicationController class HomeController < ApplicationController
helper :messages
def index def index
@currentOrders = Order.find_current @currentOrders = Order.find_current
@ -10,7 +11,7 @@ class HomeController < ApplicationController
@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.user.find :all, :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])

View File

@ -11,7 +11,7 @@ module MessagesHelper
groups groups
end end
def format_subject(message) def format_subject(message, length)
truncate "<b>#{link_to(h(message.subject), message)}</b> <span style='color:grey'>#{h(message.body)}</span>", :length => 200 truncate "<b>#{link_to(h(message.subject), message)}</b> <span style='color:grey'>#{h(message.body)}</span>", :length => length
end end
end end

View File

@ -125,9 +125,8 @@ class Ordergroup < Group
{:group => self, :transaction => transaction}, {:group => self, :transaction => transaction},
{:recipients_ids => users.collect(&:id), :subject => "Gruppenkonto im Minus"} {:recipients_ids => users.collect(&:id), :subject => "Gruppenkonto im Minus"}
).save! ).save!
end
end end
end end
end end
# before create or update, check if the name is already used in GroupOrderResults # before create or update, check if the name is already used in GroupOrderResults

View File

@ -31,6 +31,12 @@
// Current orders // Current orders
= render :partial => 'ordering/currentOrders' = render :partial => 'ordering/currentOrders'
- unless @messages.empty?
.box_title
%h2 Neuste Nachrichten
.column_content
= render :partial => 'messages/messages', :locals => { :subject_length => 110 }
// Ordergroup overview // Ordergroup overview
.box_title .box_title
%h2=_ "My ordergroup" %h2=_ "My ordergroup"

View File

@ -1,12 +1,11 @@
- unless @messages.empty? - unless @messages.empty?
- form_tag :action => 'destroy' do %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
%td %b= h(message.sender_name)
%b= h(message.sender_name) %td= format_subject(message, subject_length)
%td= format_subject(message) %td= format_time(message.created_at)
%td= format_time(message.created_at) %td= link_to('Antworten', reply_message_path(message))
%td= link_to('Antworten', reply_message_path(message))

View File

@ -3,4 +3,4 @@
%p= link_to('Neue Nachricht', :action => 'new') %p= link_to('Neue Nachricht', :action => 'new')
#messages #messages
= render :partial => 'messages' = render :partial => 'messages', :locals => { :subject_length => 200 }