Class: Workarea::Admin::SearchCustomizationsController
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
#analyze ⇒ Object
58
59
60
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 58
def analyze
@analysis = Admin::SearchAnalysisViewModel.wrap(@customization, view_model_options)
end
|
#create ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 29
def create
if @customization.persisted? || @customization.save
flash[:success] = t('workarea.admin.search_customizations.flash_messages.created', query: @customization.query)
redirect_to search_customization_path(@customization)
else
flash[:error] = t('workarea.admin.search_customizations.flash_messages.saved_error')
redirect_back fallback_location: root_path
end
end
|
#destroy ⇒ Object
62
63
64
65
66
67
68
69
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 62
def destroy
@customization.destroy
flash[:success] = t(
'workarea.admin.search_customizations.flash_messages.removed',
query: @customization.query
)
redirect_to search_customizations_path
end
|
#edit ⇒ Object
42
43
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 42
def edit
end
|
#index ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 9
def index
if request.xhr?
@customizations = Search::Customization.autocomplete(params[:q])
else
customizations =
Search::Customization
.all
.page(params[:page])
.per(Workarea.config.per_page)
.order_by(find_sort(Search::Customization))
@customizations = PagedArray.from(
SearchCustomizationViewModel.wrap(customizations),
params[:page],
Workarea.config.per_page,
customizations.total_count
)
end
end
|
#insights ⇒ Object
55
56
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 55
def insights
end
|
#show ⇒ Object
39
40
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 39
def show
end
|
#update ⇒ Object
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/workarea/admin/search_customizations_controller.rb', line 45
def update
if @customization.update_attributes(params[:customization])
flash[:success] = t('workarea.admin.search_customizations.flash_messages.saved')
redirect_to search_customization_path(@customization)
else
flash[:error] = t('workarea.admin.search_customizations.flash_messages.saved_error')
render :new
end
end
|