Class: Portfolio::Admin::SiteSocialLinksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/portfolio/admin/site_social_links_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/portfolio/admin/site_social_links_controller.rb', line 23

def create
  @link = SiteSocialLink.new(link_params)

  respond_to do |format|
    if @link.save
      format.html { redirect_to [:admin, @site, :site_social_links], notice: 'Social link was successfully created.' }
    else
      format.html { render :new }
    end
  end
end

#destroyObject



45
46
47
48
49
50
# File 'app/controllers/portfolio/admin/site_social_links_controller.rb', line 45

def destroy
  @link.destroy
  respond_to do |format|
    format.html { redirect_to [:admin, @site, :site_social_links], notice: 'Social link was successfully destroyed.' }
  end
end

#editObject



20
21
# File 'app/controllers/portfolio/admin/site_social_links_controller.rb', line 20

def edit
end

#indexObject

TODO: replace horrible method paths with [res, res, …] format (not working for some reason)



9
10
11
# File 'app/controllers/portfolio/admin/site_social_links_controller.rb', line 9

def index
  @links = @site.site_social_links
end

#newObject



16
17
18
# File 'app/controllers/portfolio/admin/site_social_links_controller.rb', line 16

def new
  @link = SiteSocialLink.new site: @site
end

#showObject



13
14
# File 'app/controllers/portfolio/admin/site_social_links_controller.rb', line 13

def show
end

#updateObject



35
36
37
38
39
40
41
42
43
# File 'app/controllers/portfolio/admin/site_social_links_controller.rb', line 35

def update
  respond_to do |format|
    if @link.update(link_params)
      format.html { redirect_to [:admin, @site, :site_social_links], notice: 'Social link was successfully updated.' }
    else
      format.html { render :edit }
    end
  end
end