5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/cms/viewables_controller.rb', line 5
def create
current_count = UniqueKey.where(list_key_params).count
if params[:max] == 'Infinity' || current_count < params[:max].to_i
unique_key = list_key_params.merge(position: current_count + 1)
viewable = UniqueKey.create_localized_viewable!(unique_key)
if unique_key[:viewable_type] != 'Viewable::Block'
path = rails_admin.edit_path(model_name: unique_key[:viewable_type].to_s.underscore.gsub('/', '~'), id: viewable.id)
redirect_to path
else
redirect_to :back
end
else
redirect_to :back
end
end
|