cirandas.net

ref: master

app/views/categories/_form.html.erb


<%= stylesheet_link_tag 'vendor/spectrum.css' %>
<%= javascript_include_tag "vendor/spectrum.js" %>
<%= javascript_include_tag "colorpicker-noosfero.js" %>

<%= error_messages_for 'category' %>

<%= labelled_form_for 'category', :html => { :multipart => true} do |f| %>

  <%= required_fields_message %>

  <% if @category.new_record? %>
    <% if @category.parent %>
      <%= hidden_field_tag('parent_id', @category.parent.id) %>
      <%= hidden_field_tag('parent_type', @category.parent.class.name) %>
    <% else %>
        <%= select_category_type :type %>
    <% end %>
  <% end %>

  <%= required f.text_field('name') %>

  <%= labelled_check_box(_('Display in the menu'), 'category[display_in_menu]', '1', @category.display_in_menu) %>

  <%= labelled_check_box(_("Visible in article categorization"), 'category[visible_for_articles]', '1', @category.visible_for_articles) %>
  <%= labelled_check_box(_("Visible in profile categorization"), 'category[visible_for_profiles]', '1', @category.visible_for_profiles) %>
  <%= labelled_check_box(_("Is allowed to be a final category (if it's not allowed, the user will have to choose a subcategory)"),
                         'category[choosable]', '1', @category.choosable,
                         :disabled => if @category.may_change_choosable? then nil else 'disabled' end,
                         :class => "#{if @category.may_change_choosable? then nil else 'disabled' end}") %>

  <%= labelled_colorpicker_field(_('Pick a color'), :category, 'display_color' ) unless environment.enabled?('disable_categories_menu')%>
  

  <%= f.fields_for :image_builder, @category.image do |i| %>
    <%= file_field_or_thumbnail(_('Image:'), @category.image, i) %>
  <% end %>

  <%= button_bar do %>
    <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %>
  <% end%>
<% end %>