Sha256: c4a5ff144f258e96133cbe91b2554daa8dcf17feabd9a1e6ff3be394dc5fac9f

Contents?: true

Size: 1.38 KB

Versions: 312

Compression:

Stored size: 1.38 KB

Contents

require 'cgi'
require 'open-uri'
require 'httparty'

module Caboose
  class RetargetingController < ApplicationController
    layout 'caboose/admin'
      
    def before_action
      @page = Page.page_with_uri(request.host_with_port, '/admin')
    end
    
    # @route 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
        
    # @route 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 'google_conversion_id'   then rc.google_conversion_id   = value    
          when 'google_labels_function' then rc.google_labels_function = value
          when 'fb_pixel_id'            then rc.fb_pixel_id            = value
          when 'fb_vars_function'       then rc.fb_vars_function       = value
    	  end
    	end
    	
    	resp.success = rc.save
    	render :json => resp
    end
    
  end
end
 

Version data entries

312 entries across 312 versions & 1 rubygems

Version Path
caboose-cms-0.9.229 app/controllers/caboose/retargeting_controller.rb
caboose-cms-1.0.2 app/controllers/caboose/retargeting_controller.rb
caboose-cms-1.0.1 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.228 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.227 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.226 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.225 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.224 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.223 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.222 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.221 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.220 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.219 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.218 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.217 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.216 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.215 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.214 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.213 app/controllers/caboose/retargeting_controller.rb
caboose-cms-0.9.212 app/controllers/caboose/retargeting_controller.rb