Class: SesDashboard::EmailsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ses_dashboard/emails_controller.rb

Instance Method Summary collapse

Instance Method Details

#exportObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/ses_dashboard/emails_controller.rb', line 22

def export
  scope = filtered_scope

  respond_to do |format|
    format.csv do
      send_data generate_csv(scope), filename: "emails-#{Date.today}.csv", type: "text/csv"
    end
    format.json do
      send_data serialize_emails(scope).to_json,
                filename: "emails-#{Date.today}.json",
                type: "application/json"
    end
  end
end

#indexObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/ses_dashboard/emails_controller.rb', line 7

def index
  scope = filtered_scope
  @emails, @pagination = Paginatable.paginate(scope, page: params[:page])

  respond_to do |format|
    format.html
    format.json { render json: serialize_emails(@emails) }
  end
end

#showObject



17
18
19
20
# File 'app/controllers/ses_dashboard/emails_controller.rb', line 17

def show
  @email  = @project.emails.find(params[:id])
  @events = @email.email_events.ordered
end