Commits

roma milushov committed 7543998

added feature, which allows the application to work on two domains

Comments (0)

Files changed (4)

app/assets/javascripts/backbone/routers/app_router.js.coffee

     ':url'              : 'getPlaylist'
     '.*'                : 'myProfile'
     '*path'             : 'notFound'
+
   initialize: (options)->
     console.log 'Routers.AppRouter initialize()'
     @vk = new Playlists.Models.Vk()
+    @vk.set url: app_url
     if not @vk.isAuth() then console.error 'Вы не залогинены! Атата! Как не стыдно!'
 
     # подписываем роутер на события

app/controllers/application_controller.rb

   MAX_REQUERS_PER_SECOND = 2
   APP_ID = 1111000
   APP_SECRET = '1111000key'
-  REDIRECT_URI = 'http://playlists.dev:3000/auth'
+  REDIRECT_URI = ENV['USER'].nil? ? 'http://wpl.herokuapp.com/auth' : 'http://playlists.dev:3000/auth'
+  APP_URL = ENV['USER'].nil? ? 'http://wpl.herokuapp.com/' : 'http://playlists.dev:3000/'
   SETTINGS = 'notify,friends,photos,audio' # 1+2+4+8
 
 private

app/controllers/main_controller.rb

       end
 
       @count_friends = ApplicationController::COUNT_FRIENDS.max + 1
+      @app_url = ApplicationController::APP_URL
+      binding.pry
 
       respond_to do |format|
         format.html # index.html.haml

app/views/main/index.html.haml

   var my_profile = #{@user_profile.to_json};
   var user_profile = {};
   var count_friends = #{@count_friends};
+  var app_url = "#{@app_url}";
 
 %footer
   %center