Sha256: 59e2857bc5fcd5413d229ccc3acf848e8f680d7b7fc1c735526ab44c42e546cf

Contents?: true

Size: 1.47 KB

Versions: 38

Compression:

Stored size: 1.47 KB

Contents

module Caboose
  class SocialController < ApplicationController
    layout 'caboose/admin'
    
    # GET /admin/social
    def admin_edit
      return if !user_is_allowed('social', 'edit')            
      @social_config = @site.social_config
      @social_config = SocialConfig.create(:site_id => @site.id) if @social_config.nil?
    end
    
    # PUT /admin/social
    def admin_update
      return if !user_is_allowed('sites', 'edit')

      resp = StdClass.new     
      sc = @site.social_config
      sc = SocialConfig.create(:site_id => @site.id) if sc.nil?
          
      save = true
      params.each do |name,value|
        case name
          when 'site_id'              then sc.site_id              = value
          when 'facebook_page_id'     then sc.facebook_page_id     = value
          when 'twitter_username'     then sc.twitter_username     = value
          when 'instagram_username'   then sc.instagram_username   = value
          when 'youtube_url'          then sc.youtube_url          = value
          when 'pinterest_url'        then sc.pinterest_url        = value
          when 'vimeo_url'            then sc.vimeo_url            = value
          when 'rss_url'              then sc.rss_url              = value
          when 'google_plus_url'      then sc.google_plus_url      = value
          when 'linkedin_url'         then sc.linkedin_url         = value
    	  end
    	end
    	
    	resp.success = save && sc.save
    	render :json => resp
    end
    
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
caboose-cms-0.5.128 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.127 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.126 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.125 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.124 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.123 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.122 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.121 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.120 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.119 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.118 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.117 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.116 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.115 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.114 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.113 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.112 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.111 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.110 app/controllers/caboose/social_controller.rb
caboose-cms-0.5.109 app/controllers/caboose/social_controller.rb