Sha256: 3336a9a6c583a37b097904402bb6ce6471e56d80649f342e883b0e8f4ff88a35

Contents?: true

Size: 1.08 KB

Versions: 19

Compression:

Stored size: 1.08 KB

Contents

module Alchemy
	module Admin

		class ClipboardController < Alchemy::Admin::BaseController

			def index
				clipboard = get_clipboard(params[:remarkable_type])
				@clipboard_items = model_class.all_from_clipboard(clipboard)
				respond_to do |format|
					format.html { render :layout => false }
				end
			end

			def insert
				@clipboard = get_clipboard(params[:remarkable_type])
				@item = model_class.find(params[:remarkable_id])
				unless @clipboard.collect { |i| i[:id].to_s }.include?(params[:remarkable_id])
					@clipboard.push({:id => params[:remarkable_id], :action => params[:remove] ? 'cut' : 'copy'})
				end
				respond_to do |format|
					format.js
				end
			end

			def remove
				@clipboard = get_clipboard(params[:remarkable_type])
				@item = model_class.find(params[:remarkable_id])
				@clipboard.delete_if { |i| i[:id].to_s == params[:remarkable_id] }
				respond_to do |format|
					format.js
				end
			end

			def clear
				session[:clipboard] = {}
			end

		private

			def model_class
				"alchemy/#{params[:remarkable_type]}".classify.constantize
			end

		end
	end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
alchemy_cms-2.1.9.1 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.9 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.8.1 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.8 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.7 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.6 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.5 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.4 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.3 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.2 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.1 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.rc6 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.rc5 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.rc4 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.rc3 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.rc2 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.beta6 app/controllers/alchemy/admin/clipboard_controller.rb
alchemy_cms-2.1.beta5 app/controllers/alchemy/admin/clipboard_controller.rb