Sha256: e32dc266ecab64b83857f4dbd30a4df2a55ac66de7c7fc4892c9539c57ea1bf9

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 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
          when 'fb_pixel_id'        then rc.fb_pixel_id        = value
    	  end
    	end
    	
    	resp.success = rc.save
    	render :json => resp
    end
    
  end
end
 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caboose-cms-0.5.197 app/controllers/caboose/retargeting_controller.rb