Sha256: 2058b74091b9ee7adcc59b2d0e93fea2588d207fa4575316399341f9e7093e66

Contents?: true

Size: 800 Bytes

Versions: 82

Compression:

Stored size: 800 Bytes

Contents

class Admin::LinkablesController < Admin::BaseController
  layout false
    
  def index
    term = params[:term]
    type = params[:type]
    
    resp = {}
    if term && term.size > 3 && (linkable = Linkable.get(type))
      
      column = :"#{title_column(linkable)}"
      
      linkable.where(

        linkable.arel_table[column].matches("%#{term}%")

      ).select([:id, column]).each do |l|
        resp[l.id] = l.send(column)

      end
    end
    render :json => resp
    
  end
  
  def fields
    @linkable = Linkable.get(params[:type])
    @target = params[:target]
    @field_name = params[:field_name]
    if params[:current_type].present? && params[:current_id].present?
      @currently_linked = Linkable.get(params[:current_type]).find(params[:current_id])
    end
  end
  
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
fullstack-cms-0.3.27 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.26 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.25 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.24 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.23 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.22 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.21 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.20 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.19 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.18 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.17 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.16 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.15 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.14 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.13 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.12 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.11 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.10 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.9 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.8 app/controllers/admin/linkables_controller.rb