Sha256: d059411aa774a46370610748e1f8c483d1bbe49a509d454797d84cdcd509d0d6

Contents?: true

Size: 1.54 KB

Versions: 32

Compression:

Stored size: 1.54 KB

Contents

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

  <% @block.category_type ||= (Category.last(:include => :category_type) && Category.last.category_type) %>  
  <%= f.cms_drop_down :category_type_id, 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_cms_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

32 entries across 32 versions & 10 rubygems

Version Path
SFEley-browsercms-3.0.2 app/views/cms/categories/_form.html.erb
buzzware-browsercms-3.0.2 app/views/cms/categories/_form.html.erb
coredumplings-browsercms-3.0.0 app/views/cms/categories/_form.html.erb
nate-browsercms-3.0.210 app/views/cms/categories/_form.html.erb
nate-browsercms-3.0.211 app/views/cms/categories/_form.html.erb
we5-browsercms-3.0.1.1 app/views/cms/categories/_form.html.erb
webficient-browsercms-3.0.1 app/views/cms/categories/_form.html.erb
webficient-browsercms-3.0.2 app/views/cms/categories/_form.html.erb
webficient-browsercms-3.0.3 app/views/cms/categories/_form.html.erb
webficient-browsercms-3.0.4 app/views/cms/categories/_form.html.erb
browsercms-3.1.5 app/views/cms/categories/_form.html.erb
browsercms-3.1.4 app/views/cms/categories/_form.html.erb
browsercms-3.1.3 app/views/cms/categories/_form.html.erb
bf4-browsercms-3.1.0 app/views/cms/categories/_form.html.erb
drujensen-browsercms-3.2.0 app/views/cms/categories/_form.html.erb
browsercms-3.1.2 app/views/cms/categories/_form.html.erb
browsercms-3.1.1 app/views/cms/categories/_form.html.erb
browsercms-3.1.0 app/views/cms/categories/_form.html.erb
we5-browsercms-3.1.0 app/views/cms/categories/_form.html.erb
browsercms-3.0.6 app/views/cms/categories/_form.html.erb