Class: Alchemy::Admin::ClipboardController
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
35
36
37
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 35
def clear
@clipboard.clear
end
|
#index ⇒ Object
7
8
9
10
11
12
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 7
def index
@clipboard_items = model_class.all_from_clipboard(@clipboard)
respond_to do |format|
format.html
end
end
|
#insert ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 14
def insert
@item = model_class.find(params[:remarkable_id])
unless @clipboard.detect { |item| item['id'] == params[:remarkable_id] }
@clipboard << {
'id' => params[:remarkable_id],
'action' => params[:remove] ? 'cut' : 'copy'
}
end
respond_to do |format|
format.js
end
end
|
#remove ⇒ Object
27
28
29
30
31
32
33
|
# File 'app/controllers/alchemy/admin/clipboard_controller.rb', line 27
def remove
@item = model_class.find(params[:remarkable_id])
@clipboard.delete_if { |item| item['id'] == params[:remarkable_id] }
respond_to do |format|
format.js
end
end
|