Class: Admin::PositionablesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/positionables_controller.rb

Instance Method Summary collapse

Instance Method Details

#fetch_objectObject



43
44
45
# File 'app/controllers/admin/positionables_controller.rb', line 43

def fetch_object
  
end

#indexObject



25
26
27
28
29
30
31
32
33
# File 'app/controllers/admin/positionables_controller.rb', line 25

def index
  @positionable_class = Positionable.get(params[:type])
  
  raise "NotFound" unless @positionable_class && @positionable_class.columns_hash["position"]
  
  @positionables = ::Admin::Positionable.new(@positionable_class.unscoped.order("position"))
  @skip_filter = true
  @title = t('fullstack.admin.sort', :default => "Sort") + " - " + t("fullstack.admin.resources.#{@positionable_class.name.underscore.pluralize}", :default => @positionable_class.name.humanize)
end

#sortObject



35
36
37
38
39
40
41
# File 'app/controllers/admin/positionables_controller.rb', line 35

def sort
  if subject.can_sort?(@positionable_class)
    @positionable_class = Positionable.get(params[:type])
    @positionable_class.update_positions(params[:positionables])
    redirect_to [:admin, params[:type]], :flash => { :notice => I18n.t("fullstack.admin.flash.success.generic") }
  end
end