Sha256: 49d185c737389888dd6c27933ec1186684bf5ef4c30715f7829aa191f585d9c9

Contents?: true

Size: 1.92 KB

Versions: 12

Compression:

Stored size: 1.92 KB

Contents

class WhowishWordFacebookController < ActionController::Base
  
  before_filter :compact_policy,:check_whowish_word_admin
  
  def check_whowish_word_admin
    $whowish_word_admin = session[:whowish_word_admin]
  end
  
  def compact_policy
    response.headers['P3P'] = 'policyref="/w3c/p3p.xml", CP="'+COMPACT_POLICY+'"'
  end
  
  layout "whowish_word_blank"


  def index

  end

  def add

    facebook = WhowishWordFacebook.new(:publish_id=>params[:publish_id].strip,
                                       :message=>params[:message].strip,
                                       :name=>params[:name].strip,
                                       :caption=>params[:caption].strip,
                                       :description=>params[:description].strip,
                                       :locale=>"en"
                                      )
    facebook.save

    render :json=>{:ok=>true,:html=>(render_to_string :partial=>"row",:locals=>{:entity=>facebook,:is_new=>false})}
  end

  def edit

    facebook = WhowishWordFacebook.first(:conditions=>{:id=>params[:id]})

    if !facebook
      render :json=>{:ok=>false,:error_message=>"The facebook record does not exist."}
      return
    end

    facebook.update_attributes(:publish_id=>params[:publish_id].strip,
                                       :message=>params[:message].strip,
                                       :name=>params[:name].strip,
                                       :caption=>params[:caption].strip,
                                       :description=>params[:description].strip,
                                       :locale=>"en"
                            )

    render :json=>{:ok=>true}
  end

  def delete
    if !WhowishWordFacebook.delete(params[:id])
      render :json=>{:ok=>false,:error_message=>"error while delete location"}
      return
    end

    render :json=>{:ok=>true}
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
whowish_word-0.2.1 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.2.0 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.9 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.8 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.7 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.6 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.5 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.4 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.3 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.2 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.1 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
whowish_word-0.1.0 lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb