Class: Workarea::Admin::SegmentsController
Instance Method Summary
collapse
#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
#most_visited
Instance Method Details
#destroy ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/controllers/workarea/admin/segments_controller.rb', line 33
def destroy
head :unprocessable_entity && return if @segment.life_cycle?
@segment.destroy
flash[:success] = t('workarea.admin.segments.flash_messages.removed')
redirect_to segments_path
end
|
#edit ⇒ Object
17
18
|
# File 'app/controllers/workarea/admin/segments_controller.rb', line 17
def edit
end
|
#index ⇒ Object
8
9
10
11
12
|
# File 'app/controllers/workarea/admin/segments_controller.rb', line 8
def index
query = Search::AdminSegments.new(params)
@search = SearchViewModel.new(query, view_model_options)
@segments = SegmentViewModel.wrap(Segment.all, view_model_options)
end
|
#insights ⇒ Object
30
31
|
# File 'app/controllers/workarea/admin/segments_controller.rb', line 30
def insights
end
|
#show ⇒ Object
14
15
|
# File 'app/controllers/workarea/admin/segments_controller.rb', line 14
def show
end
|
#update ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/workarea/admin/segments_controller.rb', line 20
def update
if @segment.update_attributes(params[:segment])
flash[:success] = t('workarea.admin.segments.flash_messages.saved')
redirect_to segment_path(@segment)
else
flash[:error] = @segment.errors.full_messages.to_sentence
render :edit, status: :unprocessable_entity
end
end
|