Sha256: fdd3ca55dc21376c3a2204fee9325fdf626a816cb5ee78f79f9fcaad7cd233b3

Contents?: true

Size: 1.58 KB

Versions: 17

Compression:

Stored size: 1.58 KB

Contents

<% if Cms::CategoryType.count > 0 %>
  <%= content_for :html_head do %>
    <script type="text/javascript">
      jQuery(function($){
        var categoriesByType = <%= Cms::CategoryType.category_map.to_json %>
        $("#cms_category_category_type_id").change(function(){
          $("#cms_category_parent_id option").remove()
          $.each(categoriesByType[$(this).val()], function(){        
            $("#cms_category_parent_id").append($.createElement("option", this[0], {value: this[1]}))
          })
        })
      })
    </script>
  <% end %>

  <% @block.category_type ||= (Cms::Category.last(:include => :category_type) && Cms::Category.last.category_type) %>  
  <%= f.cms_drop_down :category_type_id, Cms::CategoryType.all(:order => "name").map{|c| [c.name, c.id]}, :prompt => "Select a Type of Category", :label => "Type" %>

  <% categories = @block.category_type ? @block.category_type.category_list.map{|c| [c.path, c.id]} : [] %>
  <% unless categories.empty? %>
    <%= f.cms_drop_down :parent_id, categories, :include_blank => true %>
  <% end %>
  
  <%= f.cms_text_field :name %>

<% else %>
  <% page_title "Please Create A Category Type" %>
  <%= content_for :html_head do %>
    <script type="text/javascript">
      jQuery(function($){
        $('.buttons').remove()
      })
    </script>
  <% end %>
  <p>Before you can create a category, you must <%= link_to "create a category type", new_category_type_path %>.  Each category must have a category type.  For example, if you plan to categorize your news releases, you might create a "News Release" category type.</p>
<% end %>

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
browsercms-3.5.7 app/views/cms/categories/_form.html.erb
browsercms-3.5.6 app/views/cms/categories/_form.html.erb
browsercms-3.5.5 app/views/cms/categories/_form.html.erb
browsercms-3.5.4 app/views/cms/categories/_form.html.erb
browsercms-3.5.3 app/views/cms/categories/_form.html.erb
browsercms-3.5.2 app/views/cms/categories/_form.html.erb
browsercms-3.5.1 app/views/cms/categories/_form.html.erb
browsercms-3.5.0 app/views/cms/categories/_form.html.erb
browsercms-3.5.0.rc3 app/views/cms/categories/_form.html.erb
browsercms-3.5.0.rc2 app/views/cms/categories/_form.html.erb
browsercms-3.5.0.rc1 app/views/cms/categories/_form.html.erb
browsercms-3.4.2 app/views/cms/categories/_form.html.erb
browsercms-3.4.2.rc1 app/views/cms/categories/_form.html.erb
browsercms-3.4.1 app/views/cms/categories/_form.html.erb
browsercms-3.4.0 app/views/cms/categories/_form.html.erb
browsercms-3.4.0.rc2 app/views/cms/categories/_form.html.erb
browsercms-3.4.0.rc1 app/views/cms/categories/_form.html.erb