ensl.org/app/views/articles/_form.html.erb
Luke Barratt 6f56bf81fd Removed fixed topbar
Improved layout
Improved form styling
Fixes issues with firefox
Added menu icons
2014-04-19 02:12:02 +01:00

57 lines
1.6 KiB
Text

<% if @article.text_coding == Article::CODING_HTML %>
<%= render partial: "javascripts/mce_full" %>
<% end %>
<h1>Editing Article</h1>
<%= form_for(@article, html: { class: 'article square' }) do |f| %>
<%= render 'shared/errors', messages: @article.errors.full_messages %>
<div class="fields horizontal">
<%= f.label :title %>
<%= f.text_field :title %>
</div>
<% if cuser.admin? %>
<div class="fields horizontal">
<%= f.label :status %>
<%= f.select :status, @article.statuses.invert %>
</div>
<% end %>
<div class="fields horizontal">
<%= f.label :text_coding %>
<%= f.select :text_coding, @article.codings.invert %>
</div>
<div class="fields horizontal">
<%= f.label :category_id %>
<%= f.select :category_id, Category.ordered.collect{|c| ["#{c.domains[c.domain]} - #{c}", c.id]} %>
</div>
<div class="fields horizontal wide">
<h4>Content</h4>
<%= f.text_area :text, :rows => 30, :cols => 80 %>
</div>
<div class="controls inline">
<%= f.submit %>
</div>
<% end %>
<% unless @article.new_record? %>
<h2>Files</h2>
<%= render partial: "data_files/list", locals: { files: @article.files } %>
<% if @file && @file.can_create?(cuser) %>
<h4>New file</h4>
<%= form_for @file, html: { multipart: true } do |f| %>
<%= render 'shared/errors', messages: @file.errors.full_messages %>
<%= f.hidden_field :directory_id %>
<%= f.hidden_field :article_id %>
<p>
<%= f.file_field :name %>
<%= f.submit 'Create' %>
</p>
<% end %>
<% end %>
<% end %>