Class: Forge::DispatchesController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#chart_data ⇒ Object
27
28
29
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 27
def chart_data
render :json => @dispatch.chart_data
end
|
#clicks ⇒ Object
35
36
37
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 35
def clicks
@clicks = DispatchLinkClick.includes(:dispatch_link).where("dispatch_links.dispatch_id = ?", @dispatch.id).paginate(:per_page => 15, :page => params[:page])
end
|
#create ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 43
def create
@dispatch = Dispatch.new(params[:dispatch])
if @dispatch.save
flash[:notice] = 'Dispatch was successfully created.'
redirect_to(forge_dispatches_path)
else
render :action => "new"
end
end
|
#destroy ⇒ Object
62
63
64
65
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 62
def destroy
@dispatch.destroy
redirect_to(forge_dispatches_path)
end
|
#edit ⇒ Object
20
21
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 20
def edit
end
|
#index ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 5
def index
respond_to do |format|
format.html { @dispatches = Dispatch.paginate(:per_page => 10, :page => params[:page]) }
format.js {
params[:q] ||= ''
@dispatches = Dispatch.where("LOWER(subject) LIKE ? OR LOWER(content) LIKE ?", "%#{params[:q].downcase}%", "%#{params[:q].downcase}%")
render :partial => "dispatch", :collection => @dispatches
}
end
end
|
#new ⇒ Object
16
17
18
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 16
def new
@dispatch = Dispatch.new
end
|
#opens ⇒ Object
31
32
33
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 31
def opens
@opens = @dispatch.opens.paginate(:per_page => 15, :page => params[:page])
end
|
#queue ⇒ Object
67
68
69
70
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 67
def queue
@groups = SubscriberGroup.all
@total_subscribers = Subscriber.count
end
|
#send_all ⇒ Object
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 78
def send_all
if params[:group_send] && params[:group_ids].blank?
flash[:warning] = "You must select the groups to send the dispatch to."
redirect_to queue_forge_dispatch_path(@dispatch)
else
@dispatch.deliver!(params[:group_ids])
flash[:notice] = "Your dispatch is currently sending."
redirect_to forge_dispatches_path
end
end
|
#show ⇒ Object
23
24
25
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 23
def show
@dispatch = Dispatch.find(params[:id], :include => [:messages, :queued_messages, :opens, :sent_messages, :failed_messages])
end
|
#test_send ⇒ Object
72
73
74
75
76
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 72
def test_send
DispatchMailer.dispatch(@dispatch, params[:test_send_email], "Admin", current_user.id).deliver
flash[:notice] = "A copy of the dispatch was sent to #{params[:test_send_email]}."
redirect_to queue_forge_dispatch_path(@dispatch)
end
|
#unsubscribes ⇒ Object
39
40
41
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 39
def unsubscribes
@unsubscribes = @dispatch.unsubscribes.paginate(:per_page => 15, :page => params[:page])
end
|
#update ⇒ Object
53
54
55
56
57
58
59
60
|
# File 'lib/forge/app/controllers/forge/dispatches_controller.rb', line 53
def update
if @dispatch.update_attributes(params[:dispatch])
flash[:notice] = 'Dispatch was successfully updated.'
redirect_to(forge_dispatches_path)
else
render :action => "edit"
end
end
|