Sha256: 8ecc7e76e24fca006c31f688feb2527015b282e3a782b2aa029f882c25202111
Contents?: true
Size: 909 Bytes
Versions: 9
Compression:
Stored size: 909 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'}] : [] 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
9 entries across 9 versions & 1 rubygems