Sha256: cc7c31c45e6afe6d369c39b6f53312a4a13ea7c2c86d4441ee964f13a39bc57e
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
require File.expand_path('../../helpers/browse_everything_helper',__FILE__) class BrowseEverythingController < ActionController::Base layout 'browse_everything' helper BrowseEverythingHelper after_filter {session["#{provider_name}_token"] = provider.token unless provider.nil? } def index render :layout => !request.xhr? end def show render :layout => !request.xhr? end def auth code = params[:code] session["#{provider_name}_token"] = provider.connect(params,session["#{provider_name}_data"]) end def resolve selected_files = params[:selected_files] || [] @links = selected_files.collect { |file| p,f = file.split(/:/) (url,extra) = browser.providers[p].link_for(f) result = { url: url } result.merge!(extra) unless extra.nil? result } respond_to do |format| format.html { render :layout => false } format.json { render :json => @links } end end private def auth_link @auth_link ||= if provider.present? link, data = provider.auth_link session["#{provider_name}_data"] = data link else nil end end def browser if @browser.nil? @browser = BrowseEverything::Browser.new(url_options) @browser.providers.values.each do |p| p.token = session["#{p.key}_token"] end end @browser end def browse_path @path ||= params[:path] || '' end def provider @provider ||= browser.providers[provider_name] end def provider_name @provider_name ||= params[:provider] || params[:state].to_s.split(/\|/).last end helper_method :auth_link helper_method :browser helper_method :browse_path helper_method :provider helper_method :provider_name end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
browse-everything-0.10.2 | app/controllers/browse_everything_controller.rb |
browse-everything-0.10.1 | app/controllers/browse_everything_controller.rb |