Ember initialize hooks
This commit is contained in:
@@ -12,19 +12,16 @@
|
||||
rootElement: '#ember-app-container'
|
||||
obtain_token: (message)->
|
||||
message ||= ''
|
||||
# frame = $('<iframe></iframe>').addClass('obtain-token-frame').attr 'src', $obtain_token_url
|
||||
# frame.css width: $('body').outerWidth(), height: $('body').outerHeight()
|
||||
# $('body').append frame
|
||||
# window.location = "#{$obtain_token_url}"
|
||||
auth_win = window.open $obtain_token_url, "_blank", "location=no"
|
||||
auth_win.addEventListener "loadstart", (event)->
|
||||
if event.url.match 'close_window'
|
||||
user_id = event.url.match(/user_id=([\w+-]+)/)[1]
|
||||
auth_token = event.url.match(/auth_token=([\w-]+)/)[1]
|
||||
auth_token = event.url.match(/authentication_token=([\w-]+)/)[1]
|
||||
Qstorage.setItem 'user_id', user_id
|
||||
Qstorage.setItem 'auth_token', token
|
||||
Qstorage.setItem 'auth_token', auth_token
|
||||
auth_win.close()
|
||||
|
||||
true
|
||||
App.deferReadiness()
|
||||
Ember.$.ajaxPrefilter (options) ->
|
||||
if options.type.toUpperCase() == 'GET'
|
||||
if auth_token = Qstorage.getItem('auth_token')
|
||||
|
||||
@@ -31,5 +31,8 @@ html lang="en"
|
||||
var $platform = 'web'
|
||||
var $log = function(params){console.log('App log:'); console.log(params);console.log('=======================================')};
|
||||
= javascript_include_tag "user/flat/application"
|
||||
- unless Rails.env.user_app?
|
||||
javascript:
|
||||
App.advanceReadiness()
|
||||
body
|
||||
#ember-app-container
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
require 'active_support/all'
|
||||
require 'uglifier'
|
||||
require 'fileutils'
|
||||
|
||||
def replace_files(files, &block)
|
||||
Array.wrap(files).each do |file|
|
||||
@@ -29,7 +30,16 @@ def gsub_all_scripts(find, replace)
|
||||
end
|
||||
end
|
||||
|
||||
def remove(*files)
|
||||
files = files.first if files.first.is_a? Array
|
||||
files.each do |file|
|
||||
FileUtils.rm_rf(File.join('public/assets', file))
|
||||
end
|
||||
end
|
||||
|
||||
remove 'user/app/application.js' # embedded in flat/application
|
||||
|
||||
gsub_file 'user/foundation/application.css', /url\(("?)\/assets/, 'url(\1../..'
|
||||
gsub_all_scripts 'src="/assets', 'src="./assets'
|
||||
|
||||
compress_js 'user/flat/application.js', 'user/app/application.js'
|
||||
compress_js 'user/flat/application.js'
|
||||
|
||||
Reference in New Issue
Block a user