Class: Writefully::SitesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/writefully/sites_controller.rb

Constant Summary collapse

VALID_TABS =
%w(processing errors)

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_wf_authorship!, #set_flash, #wf_authorship_signed_in?

Instance Method Details

#createObject



29
30
31
32
33
34
35
# File 'app/controllers/writefully/sites_controller.rb', line 29

def create
  @site = current_wf_authorship.owned_sites.build(site_params)
  if @site.save
    set_flash :success, object: @site
    redirect_to sites_path
  end
end

#editObject



25
26
27
# File 'app/controllers/writefully/sites_controller.rb', line 25

def edit
  @site = get_site
end

#indexObject



9
10
11
12
# File 'app/controllers/writefully/sites_controller.rb', line 9

def index
  @sites = current_wf_authorship.owned_sites
  redirect_to new_site_path if @sites.empty?
end

#newObject



21
22
23
# File 'app/controllers/writefully/sites_controller.rb', line 21

def new
  @site = current_wf_authorship.owned_sites.build
end

#showObject



14
15
16
17
18
19
# File 'app/controllers/writefully/sites_controller.rb', line 14

def show
  @site = get_site
  if params[:tab].nil? or not tab_valid?
    redirect_to site_posts_path(@site) 
  end
end