Class: Alchemy::Admin::ClipboardController
Constant Summary
collapse
%w[elements pages]
Instance Method Summary
collapse
#leave
Methods included from Modules
included, #module_definition_for, register_module
#current_ability
#configuration, #multi_language?, #multi_site?, #prefix_locale?
Instance Method Details
#clear ⇒ Object
39
40
41
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 39
def clear
@clipboard.clear
end
|
#index ⇒ Object
11
12
13
14
15
16
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 11
def index
@clipboard_items = model_class.all_from_clipboard(@clipboard)
respond_to do |format|
format.html
end
end
|
#insert ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 18
def insert
@item = model_class.find([:remarkable_id])
unless @clipboard.detect { |item| item["id"] == [:remarkable_id] }
@clipboard << {
"id" => [:remarkable_id],
"action" => params[:remove] ? "cut" : "copy"
}
end
respond_to do |format|
format.js
end
end
|
#remove ⇒ Object
31
32
33
34
35
36
37
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 31
def remove
@item = model_class.find([:remarkable_id])
@clipboard.delete_if { |item| item["id"] == [:remarkable_id] }
respond_to do |format|
format.js
end
end
|