Class: PhcdevworksCoreModules::Affiliate::LinksController

Inherits:
PhcdevworksCoreModules::ApplicationController show all
Defined in:
app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /affiliate/links



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb', line 31

def create
    @affiliate_link = Affiliate::Link.new(affiliate_link_params)
    @affiliate_link.user_id = current_user.id
    @affiliate_link.org_id = current_user.org_id
    respond_to do |format|
        if @affiliate_link.save
            format.html { redirect_to affiliate_links_path, :flash => { :success => 'Affilate Link has been Added.' }}
            format.json { render :show, status: :created, location: @affiliate_link }
        else
            format.html { render :new }
            format.json { render json: @affiliate_link.errors, status: :unprocessable_entity }
        end
    end
end

#destroyObject

DELETE /affiliate/links/1



60
61
62
63
64
65
66
# File 'app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb', line 60

def destroy
    @affiliate_link.destroy
    respond_to do |format|
        format.html { redirect_to affiliate_links_path, :flash => { :error => 'Affiliate Link and Post Connections have all been Removed.' }}
        format.json { head :no_content }
    end
end

#editObject

GET /affiliate/links/1/edit



27
28
# File 'app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb', line 27

def edit
end

#indexObject

GET /affiliate/links



13
14
15
# File 'app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb', line 13

def index
    @affiliate_links = Affiliate::Link.order('affiliate_link_name ASC')
end

#newObject

GET /affiliate/links/new



22
23
24
# File 'app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb', line 22

def new
    @affiliate_link = Affiliate::Link.new
end

#showObject

GET /affiliate/links/1



18
19
# File 'app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb', line 18

def show
end

#updateObject

PATCH/PUT /affiliate/links/1



47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/phcdevworks_core_modules/affiliate/links_controller.rb', line 47

def update
    respond_to do |format|
        if @affiliate_link.update(affiliate_link_params)
            format.html { redirect_to affiliate_links_path, :flash => { :notice => 'Affiliate Link has been Updated.' }}
            format.json { render :show, status: :ok, location: @affiliate_link }
        else
            format.html { render :edit }
            format.json { render json: @affiliate_link.errors, status: :unprocessable_entity }
        end
    end
end