You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

show.html.erb 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <div class="contextual">
  2. <%= watcher_tag(@news, User.current) %>
  3. <%= link_to(l(:button_edit),
  4. edit_news_path(@news),
  5. :class => 'icon icon-edit',
  6. :accesskey => accesskey(:edit),
  7. :onclick => 'Element.show("edit-news"); return false;') if User.current.allowed_to?(:manage_news, @project) %>
  8. <%= link_to(l(:button_delete),
  9. news_path(@news),
  10. :confirm => l(:text_are_you_sure),
  11. :method => :delete,
  12. :class => 'icon icon-del') if User.current.allowed_to?(:manage_news, @project) %>
  13. </div>
  14. <h2><%= avatar(@news.author, :size => "24") %><%=h @news.title %></h2>
  15. <% if authorize_for('news', 'edit') %>
  16. <div id="edit-news" style="display:none;">
  17. <%= labelled_form_for :news, @news, :url => news_path(@news),
  18. :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
  19. <%= render :partial => 'form', :locals => { :f => f } %>
  20. <%= submit_tag l(:button_save) %>
  21. <%= link_to_remote l(:label_preview),
  22. { :url => preview_news_path(:project_id => @project),
  23. :method => 'get',
  24. :update => 'preview',
  25. :with => "Form.serialize('news-form')"
  26. }, :accesskey => accesskey(:preview) %> |
  27. <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news"); return false;' %>
  28. <% end %>
  29. <div id="preview" class="wiki"></div>
  30. </div>
  31. <% end %>
  32. <p><% unless @news.summary.blank? %><em><%=h @news.summary %></em><br /><% end %>
  33. <span class="author"><%= authoring @news.created_on, @news.author %></span></p>
  34. <div class="wiki">
  35. <%= textilizable(@news, :description) %>
  36. </div>
  37. <%= link_to_attachments @news %>
  38. <br />
  39. <div id="comments" style="margin-bottom:16px;">
  40. <h3 class="comments"><%= l(:label_comment_plural) %></h3>
  41. <% @comments.each do |comment| %>
  42. <% next if comment.new_record? %>
  43. <div class="contextual">
  44. <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
  45. :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %>
  46. </div>
  47. <h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
  48. <%= textilizable(comment.comments) %>
  49. <% end if @comments.any? %>
  50. </div>
  51. <% if @news.commentable? %>
  52. <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p>
  53. <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
  54. <div class="box">
  55. <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
  56. <%= wikitoolbar_for 'comment_comments' %>
  57. </div>
  58. <p><%= submit_tag l(:button_add) %></p>
  59. <% end %>
  60. <% end %>
  61. <% html_title @news.title -%>
  62. <% content_for :header_tags do %>
  63. <%= stylesheet_link_tag 'scm' %>
  64. <% end %>