Some fixes of bugs during last commit.
This commit is contained in:
parent
e8d55e50c0
commit
7ff0467b16
6 changed files with 21 additions and 16 deletions
|
@ -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])
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -128,7 +128,6 @@ class Ordergroup < Group
|
||||||
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
|
||||||
def validate_on_create
|
def validate_on_create
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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)
|
%td= format_subject(message, subject_length)
|
||||||
%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))
|
||||||
|
|
|
@ -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 }
|
Loading…
Reference in a new issue