<%= form_for [:admin, @category ||= Roroacms::Term.new], :html => { :multipart => true } do |f| %> <% if !@category.cover_image.blank? %>
<%= render partial: 'roroacms/admin/partials/cover_image', locals: { image: @category.cover_image } %>
<% else %>
<%= render partial: 'roroacms/admin/partials/cover_image', locals: { image: @category.cover_image } %>
<% end %> <%= f.hidden_field :id %> <%= f.file_field :cover_image, :class => "", :id => "cover_image" %> <%= hidden_field_tag :has_post_image, @category.cover_image.to_s %> <%= hidden_field_tag :type_taxonomy, @type %>
<%= f.label :name, :class => 'control-label' %> <%= f.text_field :name, size: 40, :class => "form-control" %> <%= errors_for @category, :name %>
<%= f.label :parent_id %> <% if @type == 'category' %> <%= f.select(:parent_id, nested_dropdown(Roroacms::Term.term_cats('category', @category.id, true), 'name'), { include_blank: t("views.admin.generic.none"), selected: @category.parent_id }, { class: "form-control" } )%> <% else %> <%= f.select(:parent_id, nested_dropdown(Roroacms::Term.term_cats('tag', @category.id, true), 'name'), { include_blank: t("views.admin.generic.none"), selected: @category.parent_id }, { class: "form-control" }) %> <% end %>
<%= f.label :slug, :class => 'control-label' %> <%= f.text_field :slug, size: 40, :class => "form-control" %> <%= errors_for @category, :slug %>
<%= f.label :description %> <%= f.text_area :description, :rows => "5", :class => "form-control" %>
<% end %>