working on facebook app views
[shapado:shapado.git] / app / controllers / facebook_controller.rb
1 class FacebookController < ApplicationController
2   layout "facebook"
3
4   subtabs :index => [[:newest, [:created_at, Mongo::DESCENDING]],
5                      [:hot, [[:hotness, Mongo::DESCENDING], [:views_count, Mongo::DESCENDING]]],
6                      [:votes, [:votes_average, Mongo::DESCENDING]],
7                      [:activity, [:activity_at, :desc]], [:expert, [:created_at, Mongo::DESCENDING]]],
8           :unanswered => [[:newest, [:created_at, Mongo::DESCENDING]], [:votes, [:votes_average, Mongo::DESCENDING]], [:mytags, [:created_at, Mongo::DESCENDING]]],
9           :show => [[:votes, [:votes_average, Mongo::DESCENDING]], [:oldest, [:created_at, Mongo::ASCENDING]], [:newest, [:created_at, Mongo::DESCENDING]]]
10
11   def index
12     find_questions
13   end
14
15   def enable_page
16     @owner = User.where(:authentication_token => params[:t]).first
17
18     if @owner.role_on(@current_group) != "owner"
19       render :text => "you dont have permissions to do this!" and return
20     end
21
22     @current_group.override(:"share.fb_page_id" => params[:fb_page_id])
23
24     redirect_to facebook_path(:signed_request => params[:signed_request])
25   end
26
27   protected
28 end