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.rhtml 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <div class="contextual">
  2. <%= link_to_if_authorized l(:button_edit),
  3. {:controller => 'news', :action => 'edit', :id => @news},
  4. :class => 'icon icon-edit',
  5. :accesskey => accesskey(:edit),
  6. :onclick => 'Element.show("edit-news"); return false;' %>
  7. <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
  8. </div>
  9. <h2><%=h @news.title %></h2>
  10. <div id="edit-news" style="display:none;">
  11. <% labelled_tabular_form_for :news, @news, :url => { :action => "edit", :id => @news },
  12. :html => { :id => 'news-form' } do |f| %>
  13. <%= render :partial => 'form', :locals => { :f => f } %>
  14. <%= submit_tag l(:button_save) %>
  15. <%= link_to_remote l(:label_preview),
  16. { :url => { :controller => 'news', :action => 'preview' },
  17. :method => 'post',
  18. :update => 'preview',
  19. :with => "Form.serialize('news-form')"
  20. }, :accesskey => accesskey(:preview) %> |
  21. <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news")' %>
  22. <% end %>
  23. <div id="preview" class="wiki"></div>
  24. </div>
  25. <p><em><% unless @news.summary.blank? %><%=h @news.summary %><br /><% end %>
  26. <span class="author"><%= authoring @news.created_on, @news.author %></span></em></p>
  27. <div class="wiki">
  28. <%= textilizable(@news.description) %>
  29. </div>
  30. <br />
  31. <div id="comments" style="margin-bottom:16px;">
  32. <h3 class="icon22 icon22-comment"><%= l(:label_comment_plural) %></h3>
  33. <% @comments.each do |comment| %>
  34. <% next if comment.new_record? %>
  35. <div class="contextual">
  36. <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment},
  37. :confirm => l(:text_are_you_sure), :method => :post, :title => l(:button_delete) %>
  38. </div>
  39. <h4><%= authoring comment.created_on, comment.author %></h4>
  40. <%= textilizable(comment.comments) %>
  41. <% end if @comments.any? %>
  42. </div>
  43. <% if authorize_for 'news', 'add_comment' %>
  44. <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p>
  45. <% form_tag({:action => 'add_comment', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
  46. <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
  47. <%= wikitoolbar_for 'comment_comments' %>
  48. <p><%= submit_tag l(:button_add) %></p>
  49. <% end %>
  50. <% end %>
  51. <% html_title @news.title -%>