diff --git a/app/views/activities/_thread.haml b/app/views/activities/_thread.haml index 136e681b10..94e8e2604c 100644 --- a/app/views/activities/_thread.haml +++ b/app/views/activities/_thread.haml @@ -3,60 +3,59 @@ - thread_id = "#{thread_class}_#{thread.id}" - comments = thread.comments - last_comment = comments.first -- if thread.respond_to?("project") == false - - thread = Activity.new(:project_id => Project.last.id).thread -.thread{ :'data-id' => thread.id, :'data-class' => thread_class, :id => "thread_#{thread_id}", :'data-project-id' => thread.project.id , :'data-creator-user-id' => thread.try(:user_id), :'data-watcher-ids' => (thread.try(:watcher_ids)||[]).join(','), :class => thread.is_private ? 'private' : nil, :'data-assigned-id' => thread.try(:assigned_id) } - -# Title of the element - .comment.comment_header - %span.time= posted_date(comments.first ? comments.first.created_at : thread.created_at) - .info - - icon = { "Conversation" => "comment", "Task" => "tick" }[thread.class.to_s] - %img{ :src => "/famfamfam/#{icon}.png", :style => 'padding: 4px' } - - if thread.comments_count > 1 - .comment_count - %span= thread.comments_count - .block - - case thread - - when Conversation - - if thread.to_s.present? - .thread_title - .lock_icon - = t(".conversation_with_title_html", - :conversation => link_to(thread, [thread.project, thread]), - :project => project_link_with_overlay(thread.project)) - - else - .thread_title - .lock_icon - = t(".conversation_without_title_html", - :conversation_url => project_conversation_path(thread.project, thread), - :project => project_link_with_overlay(thread.project)) - - when Task - .thread_title - .lock_icon - = t(".task_on_task_list_html", - :task => link_to(thread, [thread.project, thread]), - :task_list => link_to(thread.task_list, [thread.task_list.project, thread.task_list])) - = project_link_with_overlay thread.project - .task_summary{:class => task_classes(thread)} - = task_status_badge(thread.status_name) - = span_for_thread_due_date(thread) - %span.assigned_to= (thread.assigned && thread.open?) ? t('tasks.assigned.assigned_to', :user => thread.assigned.user.name) : '' - - if last_comment - %p.excerpt - %strong= last_comment.user.name - = strip_tags last_comment.body_html - .clear - - .comments - = render 'activities/thread_comments', :comments => comments, :thread => thread - - - if thread.is_a? Task - = form_for [thread.project, thread], :html => {:multipart => true, :id => nil, :class => 'new_comment edit_task', :'data-project-id' => thread.project_id, :'data-remote' => true, :'data-mine' => (thread.open? and thread.assigned_to?(current_user))} do |form| - = form.fields_for :comments, thread.comments.build do |comment_fields| - = render 'comments/fields', :f => comment_fields, :task_form => form, :placeholder => t("comments.new.#{thread_class}") - - else - - action = url_for([thread.project, thread, thread.comments.build]) - = form_for [thread.project, thread], :url => action, :html => {:multipart => true, :id => nil, :class => 'new_comment edit_conversation', :'data-project-id' => thread.project_id, :'data-remote' => true} do |form| - = fields_for :comment, thread.comments.build do |comment_fields| - = render 'comments/fields', :f => comment_fields, :conversation_form => form, :placeholder => t("comments.new.#{thread_class}"), :project => thread.project +#.thread{ :'data-id' => thread.id, :'data-class' => thread_class, :id => "thread_#{thread_id}", :'data-project-id' => thread.project.id , :'data-creator-user-id' => thread.try(:user_id), :'data-watcher-ids' => (thread.try(:watcher_ids)||[]).join(','), :class => thread.is_private ? 'private' : nil, :'data-assigned-id' => thread.try(:assigned_id) } +# -# Title of the element +# .comment.comment_header +# %span.time= posted_date(comments.first ? comments.first.created_at : thread.created_at) +# .info +# - icon = { "Conversation" => "comment", "Task" => "tick" }[thread.class.to_s] +# %img{ :src => "/famfamfam/#{icon}.png", :style => 'padding: 4px' } +# - if thread.comments_count > 1 +# .comment_count +# %span= thread.comments_count +# .block +# - case thread +# - when Conversation +# - if thread.to_s.present? +# .thread_title +# .lock_icon +# = t(".conversation_with_title_html", +# :conversation => link_to(thread, [thread.project, thread]), +# :project => project_link_with_overlay(thread.project)) +# - else +# .thread_title +# .lock_icon +# = t(".conversation_without_title_html", +# :conversation_url => project_conversation_path(thread.project, thread), +# :project => project_link_with_overlay(thread.project)) +# - when Task +# .thread_title +# .lock_icon +# = t(".task_on_task_list_html", +# :task => link_to(thread, [thread.project, thread]), +# :task_list => link_to(thread.task_list, [thread.task_list.project, thread.task_list])) +# = project_link_with_overlay thread.project +# .task_summary{:class => task_classes(thread)} +# = task_status_badge(thread.status_name) +# = span_for_thread_due_date(thread) +# %span.assigned_to= (thread.assigned && thread.open?) ? t('tasks.assigned.assigned_to', :user => thread.assigned.user.name) : '' +# - if last_comment +# %p.excerpt +# %strong= last_comment.user.name +# = strip_tags last_comment.body_html +# .clear +# +# .comments +# = render 'activities/thread_comments', :comments => comments, :thread => thread +# +# - if thread.is_a? Task +# = form_for [thread.project, thread], :html => {:multipart => true, :id => nil, :class => 'new_comment edit_task', :'data-project-id' => thread.project_id, :'data-remote' => true, :'data-mine' => (thread.open? and thread.assigned_to?(current_user))} do |form| +# = form.fields_for :comments, thread.comments.build do |comment_fields| +# = render 'comments/fields', :f => comment_fields, :task_form => form, :placeholder => t("comments.new.#{thread_class}") +# - else +# - action = url_for([thread.project, thread, thread.comments.build]) +# = form_for [thread.project, thread], :url => action, :html => {:multipart => true, :id => nil, :class => 'new_comment edit_conversation', :'data-project-id' => thread.project_id, :'data-remote' => true} do |form| +# = fields_for :comment, thread.comments.build do |comment_fields| +# = render 'comments/fields', :f => comment_fields, :conversation_form => form, :placeholder => t("comments.new.#{thread_class}"), :project => thread.project +# \ No newline at end of file