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
helper :messages
def index
@currentOrders = Order.find_current
@ -10,7 +11,7 @@ class HomeController < ApplicationController
@unaccepted_tasks = @current_user.unaccepted_tasks
# task in next week
@next_tasks = @current_user.next_tasks
@messages = Message.user.find :all, :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])

View File

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

View File

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

View File

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

View File

@ -1,12 +1,11 @@
- unless @messages.empty?
- form_tag :action => 'destroy' do
%table.list
%tbody
- for message in @messages
%tr{:class => cycle('even','odd', :name => 'messages')}
%td
%b= h(message.sender_name)
%td= format_subject(message)
%td= format_time(message.created_at)
%td= link_to('Antworten', reply_message_path(message))
%table.list
%tbody
- for message in @messages
%tr{:class => cycle('even','odd', :name => 'messages')}
%td
%b= h(message.sender_name)
%td= format_subject(message, subject_length)
%td= format_time(message.created_at)
%td= link_to('Antworten', reply_message_path(message))

View File

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