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.

edit.html.erb 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <%= wiki_page_breadcrumb(@page) %>
  2. <h2><%= @page.pretty_title %></h2>
  3. <%= form_for @content, :as => :content,
  4. :url => {:action => 'update', :id => @page.title},
  5. :html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| %>
  6. <%= f.hidden_field :version %>
  7. <% if @section %>
  8. <%= hidden_field_tag 'section', @section %>
  9. <%= hidden_field_tag 'section_hash', @section_hash %>
  10. <% end %>
  11. <%= error_messages_for 'content' %>
  12. <div class="box tabular">
  13. <%= text_area_tag 'content[text]', @text, :cols => 100, :rows => 25, :accesskey => accesskey(:edit),
  14. :class => 'wiki-edit',
  15. :data => {
  16. :auto_complete => true
  17. }
  18. %>
  19. <% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %>
  20. <%= fields_for @page do |fp| %>
  21. <p>
  22. <label><%= l(:field_parent_title) %></label>
  23. <%= fp.select :parent_id,
  24. content_tag('option', '', :value => '') +
  25. wiki_page_options_for_select(
  26. @wiki.pages.includes(:parent).to_a -
  27. @page.self_and_descendants, @page.parent) %>
  28. </p>
  29. <% end %>
  30. <% end %>
  31. <p><label><%= l(:field_comments) %></label><%= f.text_field :comments, :size => 120, :maxlength => 1024 %></p>
  32. <fieldset>
  33. <legend><%=l(:label_attachment_plural)%></legend>
  34. <% if @page.attachments.any? && @page.safe_attribute?('deleted_attachment_ids') %>
  35. <div class="contextual"><%= link_to l(:label_edit_attachments), '#', :onclick => "$('#existing-attachments').toggle(); return false;" %></div>
  36. <div id="existing-attachments" style="<%= @page.deleted_attachment_ids.blank? ? 'display:none;' : '' %>">
  37. <% @page.attachments.each do |attachment| %>
  38. <span class="existing-attachment">
  39. <%= text_field_tag '', attachment.filename, :class => "icon icon-attachment filename", :disabled => true %>
  40. <label class='inline'>
  41. <%= check_box_tag 'wiki_page[deleted_attachment_ids][]',
  42. attachment.id,
  43. @page.deleted_attachment_ids.include?(attachment.id),
  44. :id => nil, :class => "deleted_attachment" %> <%= l(:button_delete) %>
  45. </label>
  46. </span>
  47. <% end %>
  48. <hr />
  49. </div>
  50. <% end %>
  51. <div id="new-attachments" style="display:inline-block;">
  52. <%= render :partial => 'attachments/form' %>
  53. </div>
  54. </fieldset>
  55. </div>
  56. <p>
  57. <%= submit_tag l(:button_save) %>
  58. <%= link_to l(:button_cancel), wiki_page_edit_cancel_path(@page) %>
  59. </p>
  60. <%= wikitoolbar_for 'content_text', preview_project_wiki_page_path(:project_id => @project, :id => @page.title) %>
  61. <% end %>
  62. <% content_for :header_tags do %>
  63. <%= robot_exclusion_tag %>
  64. <% end %>
  65. <% html_title @page.pretty_title %>