Class: Comable::Admin::NavigationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/comable/admin/navigations_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability, #respond_to_export_with

Instance Method Details

#createObject



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

def create
  @navigation = Comable::Navigation.new(navigation_params)
  if @navigation.save
    redirect_to comable.admin_navigation_path(@navigation), notice: Comable.t('successful')
  else
    render :new
  end
end

#destroyObject



43
44
45
46
# File 'app/controllers/comable/admin/navigations_controller.rb', line 43

def destroy
  @navigation.destroy
  redirect_to comable.admin_navigations_path, notice: Comable.t('successful')
end

#editObject



22
23
# File 'app/controllers/comable/admin/navigations_controller.rb', line 22

def edit
end

#indexObject



8
9
10
11
# File 'app/controllers/comable/admin/navigations_controller.rb', line 8

def index
  @q = Comable::Navigation.ransack(params[:q])
  @navigations = @q.result.accessible_by(current_ability).by_newest
end

#newObject



18
19
20
# File 'app/controllers/comable/admin/navigations_controller.rb', line 18

def new
  @navigation.navigation_items.build
end

#search_linkable_idsObject



48
49
50
51
# File 'app/controllers/comable/admin/navigations_controller.rb', line 48

def search_linkable_ids
  @linkable_id_options = Comable::NavigationItem.linkable_id_options(params[:linkable_type])
  render layout: false
end

#showObject



13
14
15
16
# File 'app/controllers/comable/admin/navigations_controller.rb', line 13

def show
  edit
  render :edit
end

#updateObject



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

def update
  @navigation.attributes = navigation_params
  if @navigation.save
    redirect_to comable.admin_navigation_path(@navigation), notice: Comable.t('successful')
  else
    render :edit
  end
end