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.7 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.6 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.5 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.4 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.3 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.2 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.3.1 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.36 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.35 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.34 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.33 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.31 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.30 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.29 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.28 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.27 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.26 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.25 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.24 app/controllers/admin/linkables_controller.rb
fullstack-cms-0.2.23 app/controllers/admin/linkables_controller.rb