Sha256: 379fd2eb047fd22a465681ddf962cb1332c9e1038964323013407fe1146b57ac

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

module Caboose
  class RetargetingController < ApplicationController
    layout 'caboose/admin'
      
    def before_action
      @page = Page.page_with_uri(request.host_with_port, '/admin')
    end
    
    # GET /admin/sites/:site_id/retargeting
    def admin_edit
      return if !user_is_allowed('sites', 'edit')       
      if !@site.is_master
        @error = "You are not allowed to manage sites."
        render :file => 'caboose/extras/error' and return
      end      
      @site = Site.find(params[:site_id])
    end
        
    # PUT /admin/sites/:id/retargeting
    def admin_update
      render :json => { :error => "You are not allowed to manage sites." } and return if !user_is_allowed('sites', 'edit') || !@site.is_master
      
      resp = StdClass.new     
      site = Site.find(params[:site_id])
      rc = site.retargeting_config
    
      params.each do |name,value|
        case name          
          when 'conversion_id'   then rc.conversion_id   = value    
          when 'labels_function' then rc.labels_function = value                
    	  end
    	end
    	
    	resp.success = rc.save
    	render :json => resp
    end
    
  end
end
 

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
caboose-cms-0.5.195 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.5.194 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.5.193 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.5.192 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.5.191 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.5.190 app/controllers/caboose/retargeting_controller.rb