Sha256: acdf2e173b8e1dabe0a004de1d272a194d1eb69477e6f478a82661548194a9a8

Contents?: true

Size: 996 Bytes

Versions: 2

Compression:

Stored size: 996 Bytes

Contents

module Caboose
  class BlockTypeCategoriesController < ApplicationController
    
    # @route GET /admin/block-type-categories/tree-options
    def admin_tree_options
      return unless user_is_allowed('pages', 'edit')
      render :json => BlockTypeCategory.tree
    end

    # @route GET /admin/block-type-categories/:id/options
    def admin_options
    	btc = BlockTypeCategory.find(params[:id])
      options = params[:default] == 'yes' ? [{:text => 'Default', :value => 'Default'}] : []
      options << { 'value' => 'none', 'text' => "No Header" } if params[:none] == 'yes'
    	BlockType.joins(:block_type_site_memberships).where("block_type_site_memberships.site_id = ?",@site.id).where("block_type_site_memberships.block_type_id = block_types.id").where("block_types.block_type_category_id = ?",btc.id).reorder('block_types.description').all.each do |s|
        options << { 'value' => s.id, 'text' => s.description }
      end
    	render :json => options
    end
    		
  end  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caboose-cms-0.9.193 app/controllers/caboose/block_type_categories_controller.rb
caboose-cms-0.9.192 app/controllers/caboose/block_type_categories_controller.rb