Class: Pageflow::EntriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pageflow/entries_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



57
58
59
60
# File 'app/controllers/pageflow/entries_controller.rb', line 57

def edit
  @entry = DraftEntry.find(params[:id])
  authorize!(:edit, @entry.to_model)
end

#indexObject



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/pageflow/entries_controller.rb', line 13

def index
  theming = Theming.find_by_cname!(request.host)
  @account = Account.with_landing_page.find_by_theming!(theming)

  respond_to do |format|
    format.html {
      render :template => "pageflow/entries/index/#{@account.landing_page_name}", :layout => "pageflow/basic"
    }
  end
end

#pageObject



40
41
42
43
44
45
# File 'app/controllers/pageflow/entries_controller.rb', line 40

def page
  entry = PublishedEntry.find(params[:id], entry_request_scope)
  index = params[:page_index].split('-').first.to_i

  redirect_to(short_entry_path(entry.to_model, :anchor => entry.pages[index].try(:perma_id)))
end

#partialsObject



47
48
49
50
51
52
53
54
55
# File 'app/controllers/pageflow/entries_controller.rb', line 47

def partials
  authenticate_user!
  @entry = DraftEntry.find(params[:id])
  authorize!(:show, @entry.to_model)

  respond_to do |format|
    format.html { render :action => 'partials', :layout => false }
  end
end

#showObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/pageflow/entries_controller.rb', line 24

def show
  respond_to do |format|
    format.any(:html, :css) do
      @entry = PublishedEntry.find(params[:id], entry_request_scope)
    end
    format.json do
      authenticate_user!
      @entry = DraftEntry.find(params[:id])
      authorize!(:show, @entry.to_model)
    end
    format.any do
      render(:file => 'public/pageflow/404.html', :status => :not_found)
    end
  end
end

#updateObject



62
63
64
65
66
67
68
69
# File 'app/controllers/pageflow/entries_controller.rb', line 62

def update
  @entry = DraftEntry.find(params[:id])

  authorize!(:update, @entry.to_model)
  @entry.update_meta_data!(entry_params)

  head(:no_content)
end