tbone-devise 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ group :development do
10
10
  gem "bundler"
11
11
  gem "jeweler"
12
12
  end
13
+ gem 'tbone', path: '../tbone'
14
+ gem 'devise'
@@ -1,21 +1,123 @@
1
+ PATH
2
+ remote: ../tbone
3
+ specs:
4
+ tbone (0.2.0)
5
+ coffee-filter
6
+ haml-rails
7
+ i18n-js
8
+ jquery-rails
9
+ kaminari
10
+ rabl
11
+ rails-backbone
12
+ requirejs-rails
13
+ yajl-ruby
14
+
1
15
  GEM
2
16
  remote: http://rubygems.org/
3
17
  specs:
18
+ actionpack (3.2.8)
19
+ activemodel (= 3.2.8)
20
+ activesupport (= 3.2.8)
21
+ builder (~> 3.0.0)
22
+ erubis (~> 2.7.0)
23
+ journey (~> 1.0.4)
24
+ rack (~> 1.4.0)
25
+ rack-cache (~> 1.2)
26
+ rack-test (~> 0.6.1)
27
+ sprockets (~> 2.1.3)
28
+ activemodel (3.2.8)
29
+ activesupport (= 3.2.8)
30
+ builder (~> 3.0.0)
31
+ activesupport (3.2.8)
32
+ i18n (~> 0.6)
33
+ multi_json (~> 1.0)
34
+ bcrypt-ruby (3.0.1)
35
+ builder (3.0.4)
36
+ coffee-filter (0.1.1)
37
+ coffee-script (>= 2.2.0)
38
+ haml (>= 3.0.18)
39
+ coffee-script (2.2.0)
40
+ coffee-script-source
41
+ execjs
42
+ coffee-script-source (1.4.0)
43
+ devise (2.1.2)
44
+ bcrypt-ruby (~> 3.0)
45
+ orm_adapter (~> 0.1)
46
+ railties (~> 3.1)
47
+ warden (~> 1.2.1)
48
+ ejs (1.1.1)
49
+ erubis (2.7.0)
50
+ execjs (1.4.0)
51
+ multi_json (~> 1.0)
4
52
  git (1.2.5)
53
+ haml (3.1.7)
54
+ haml-rails (0.3.5)
55
+ actionpack (>= 3.1, < 4.1)
56
+ activesupport (>= 3.1, < 4.1)
57
+ haml (~> 3.1)
58
+ railties (>= 3.1, < 4.1)
59
+ hike (1.2.1)
60
+ i18n (0.6.1)
61
+ i18n-js (2.1.2)
62
+ i18n
5
63
  jeweler (1.8.4)
6
64
  bundler (~> 1.0)
7
65
  git (>= 1.2.5)
8
66
  rake
9
67
  rdoc
68
+ journey (1.0.4)
69
+ jquery-rails (2.1.3)
70
+ railties (>= 3.1.0, < 5.0)
71
+ thor (~> 0.14)
10
72
  json (1.7.3)
73
+ kaminari (0.14.1)
74
+ actionpack (>= 3.0.0)
75
+ activesupport (>= 3.0.0)
76
+ multi_json (1.3.6)
77
+ orm_adapter (0.4.0)
78
+ rabl (0.7.6)
79
+ activesupport (>= 2.3.14)
80
+ multi_json (~> 1.0)
81
+ rack (1.4.1)
82
+ rack-cache (1.2)
83
+ rack (>= 0.4)
84
+ rack-ssl (1.3.2)
85
+ rack
86
+ rack-test (0.6.2)
87
+ rack (>= 1.0)
88
+ rails-backbone (0.8.0)
89
+ coffee-script (~> 2.2.0)
90
+ ejs (~> 1.1.1)
91
+ jquery-rails (~> 2.1.3)
92
+ railties (>= 3.1.0)
93
+ railties (3.2.8)
94
+ actionpack (= 3.2.8)
95
+ activesupport (= 3.2.8)
96
+ rack-ssl (~> 1.3.2)
97
+ rake (>= 0.8.7)
98
+ rdoc (~> 3.4)
99
+ thor (>= 0.14.6, < 2.0)
11
100
  rake (0.9.2.2)
12
101
  rdoc (3.12)
13
102
  json (~> 1.4)
103
+ requirejs-rails (0.9.0)
104
+ railties (>= 3.1.1, < 3.3)
105
+ sprockets (2.1.3)
106
+ hike (~> 1.2)
107
+ rack (~> 1.0)
108
+ tilt (~> 1.1, != 1.3.0)
109
+ thor (0.16.0)
110
+ tilt (1.3.3)
111
+ warden (1.2.1)
112
+ rack (>= 1.0)
113
+ yajl-ruby (1.1.0)
14
114
 
15
115
  PLATFORMS
16
116
  ruby
17
117
 
18
118
  DEPENDENCIES
19
119
  bundler
120
+ devise
20
121
  jeweler
21
122
  rdoc
123
+ tbone!
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.2.0
@@ -10,7 +10,7 @@ define ['backbone', 'bootstrap'], (Backbone, App) ->
10
10
  'delete': '/users/sign_out.json'
11
11
  }
12
12
  isNew: ->
13
- @user.get('abilities').signin
13
+ not @user.get('signed_in')
14
14
 
15
15
  sync: (method, model, options) ->
16
16
  if model.methodUrl && model.methodUrl[method.toLowerCase()]
@@ -92,6 +92,7 @@ define [
92
92
  destroy: ->
93
93
  @session.destroy(
94
94
  success: (session, response) =>
95
+ console.log(session)
95
96
  @user.set(@guest.attributes)
96
97
  AlertQueue.add({type: 'info', message: I18n.t('devise.sessions.signed_out')})
97
98
  window.location.hash = "/"
@@ -1,7 +1,7 @@
1
1
  %ul.nav.pull-right
2
- :if abilities.signout == true
2
+ - if @signed_in
3
3
  %li
4
4
  %a{href: "#/signout"}= I18n.t('sign_out')
5
- :if abilities.signin == true
5
+ - else
6
6
  %li
7
7
  %a{href: "#/signin"}= I18n.t('sign_in')
@@ -11,7 +11,7 @@
11
11
  .controls
12
12
  %input#password{name: "password", type: "password"}
13
13
 
14
- :if $.inArray('rememberable', this.options.modules) != -1
14
+ - if $.inArray('rememberable', @options.modules) != -1
15
15
  .control-group
16
16
  %label.control-label{for: "remember_me"}= I18n.t('remember_me')
17
17
  .controls
@@ -20,14 +20,14 @@
20
20
  .form-actions
21
21
  %input#new-post.btn.btn-primary{type: "submit"}
22
22
 
23
- :if $.inArray('registerable', this.options.modules) != -1
23
+ - if $.inArray('registerable', @options.modules) != -1
24
24
  %p
25
25
  %a{href: '#/signup'}= I18n.t('sign_up')
26
26
 
27
- :if $.inArray('recoverable', this.options.modules) != -1
27
+ - if $.inArray('recoverable', @options.modules) != -1
28
28
  %p
29
29
  %a{href: '#/forgot'}= I18n.t('forgot_password')
30
30
 
31
- :if $.inArray('confirmable', this.options.modules) != -1
31
+ - if $.inArray('confirmable', @options.modules) != -1
32
32
  %p
33
33
  %a{href: '#/confirm'}= I18n.t('confirm')
@@ -8,7 +8,7 @@ define [
8
8
  ], ($, Backbone, App, FormView) ->
9
9
 
10
10
  class App.Views.Confirmations.NewView extends FormView
11
- template: JST["templates/confirmations/new"]
11
+ template: JST["confirmations/new"]
12
12
 
13
13
  success: (session) ->
14
14
  @addSuccessAlert(I18n.t('devise.confirmations.send_instructions'))
@@ -8,7 +8,7 @@ define [
8
8
  ], ($, Backbone, App, FormView) ->
9
9
 
10
10
  class App.Views.Passwords.EditView extends FormView
11
- template: JST["templates/passwords/edit"]
11
+ template: JST["passwords/edit"]
12
12
 
13
13
  success: (session) ->
14
14
  @addSuccessAlert(I18n.t('devise.passwords.updated'))
@@ -9,7 +9,7 @@ define [
9
9
  ], ($, Backbone, App, Password, FormView) ->
10
10
 
11
11
  class App.Views.Passwords.NewView extends FormView
12
- template: JST["templates/passwords/new"]
12
+ template: JST["passwords/new"]
13
13
 
14
14
  success: (session) ->
15
15
  @addSuccessAlert(I18n.t('devise.passwords.send_instructions'))
@@ -9,7 +9,7 @@ define [
9
9
  ], ($, Backbone, App, Password, FormView) ->
10
10
 
11
11
  class App.Views.Passwords.NewView extends FormView
12
- template: JST["templates/registrations/new"]
12
+ template: JST["registrations/new"]
13
13
 
14
14
  success: (session) ->
15
15
  @options.user.id = session.id
@@ -7,7 +7,7 @@ define [
7
7
  ], ($, Backbone, App) ->
8
8
 
9
9
  class App.Views.Sessions.LoginBar extends Backbone.View
10
- template: JST["templates/sessions/login_bar"]
10
+ template: JST["sessions/login_bar"]
11
11
 
12
12
  initialize: ->
13
13
  @model.on('change', @render, this)
@@ -15,4 +15,4 @@ define [
15
15
  render: ->
16
16
  return unless @model?
17
17
  $(@el).html(@template(@model.toJSON()))
18
- return this
18
+ @
@@ -9,7 +9,7 @@ define [
9
9
  ], ($, Backbone, App, Session, FormView) ->
10
10
 
11
11
  class App.Views.Sessions.NewView extends FormView
12
- template: JST["templates/sessions/new"]
12
+ template: JST["sessions/new"]
13
13
 
14
14
  success: (session) ->
15
15
  @options.user.id = session.id
@@ -0,0 +1,9 @@
1
+ @user ||= locals[:object]
2
+ object @user => :user
3
+ attributes *@user.attributes.keys
4
+ node :id do
5
+ @user.id
6
+ end
7
+ node :signed_in do
8
+ !@user.new_record?
9
+ end
@@ -1,6 +1,4 @@
1
- Tbone::Engine.routes.draw do
2
- resources :tokens
3
- root :to => 'home#index'
1
+ Tbone::Devise::Engine.routes.draw do
4
2
  devise_for :users
5
3
  resources :users
6
4
  end
@@ -5,8 +5,28 @@ module Tbone
5
5
  initializer "tbone-devise" do |app|
6
6
  Tbone.configure do |c|
7
7
  c.add_params devise_modules: User.devise_modules
8
+ app.middleware.use Middleware
8
9
  end
9
10
  end
10
11
  end
12
+ class Middleware
13
+ def initialize(app)
14
+ @app = app
15
+ end
16
+ def call(env)
17
+ warden = env['warden']
18
+ return @app.call(env) if env['REQUEST_PATH'] =~ /^\/assets/
19
+ user = warden.authenticate
20
+ m = self
21
+ Tbone.configure do |c|
22
+ c.add_params currentUser: m.render_user(user || User.new)
23
+ c.add_params guestUser: m.render_user(User.new)
24
+ end
25
+ @app.call(env)
26
+ end
27
+ def render_user(user)
28
+ Rabl.render(user, 'users/show', view_path: 'app/views', format: :hash)
29
+ end
30
+ end
11
31
  end
12
32
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tbone-devise}
8
- s.version = "0.1.3"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Pavel Tatarsky}]
12
- s.date = %q{2012-07-08}
12
+ s.date = %q{2012-11-09}
13
13
  s.description = %q{Devise views for Tbone}
14
14
  s.email = %q{fazzzenda@mail.ru}
15
15
  s.extra_rdoc_files = [
@@ -36,12 +36,12 @@ Gem::Specification.new do |s|
36
36
  "app/assets/javascripts/routers/sessions_router.js.coffee",
37
37
  "app/assets/javascripts/tbone-devise.js.coffee",
38
38
  "app/assets/javascripts/templates/.gitkeep",
39
- "app/assets/javascripts/templates/confirmations/new.jst.hamljs",
40
- "app/assets/javascripts/templates/passwords/edit.jst.hamljs",
41
- "app/assets/javascripts/templates/passwords/new.jst.hamljs",
42
- "app/assets/javascripts/templates/registrations/new.jst.hamljs",
43
- "app/assets/javascripts/templates/sessions/login_bar.jst.hamljs",
44
- "app/assets/javascripts/templates/sessions/new.jst.hamljs",
39
+ "app/assets/javascripts/templates/confirmations/new.hamlc",
40
+ "app/assets/javascripts/templates/passwords/edit.hamlc",
41
+ "app/assets/javascripts/templates/passwords/new.hamlc",
42
+ "app/assets/javascripts/templates/registrations/new.hamlc",
43
+ "app/assets/javascripts/templates/sessions/login_bar.hamlc",
44
+ "app/assets/javascripts/templates/sessions/new.hamlc",
45
45
  "app/assets/javascripts/views/.gitkeep",
46
46
  "app/assets/javascripts/views/confirmations/new_view.js.coffee",
47
47
  "app/assets/javascripts/views/passwords/edit_view.js.coffee",
@@ -53,6 +53,7 @@ Gem::Specification.new do |s|
53
53
  "app/views/devise/mailer/confirmation_instructions.html.erb",
54
54
  "app/views/devise/mailer/reset_password_instructions.html.erb",
55
55
  "app/views/devise/mailer/unlock_instructions.html.erb",
56
+ "app/views/users/show.json.rabl",
56
57
  "config/locales/tbone-devise.en.yml",
57
58
  "config/routes.rb",
58
59
  "lib/tbone-devise.rb",
@@ -71,15 +72,21 @@ Gem::Specification.new do |s|
71
72
  s.specification_version = 3
72
73
 
73
74
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
75
+ s.add_runtime_dependency(%q<tbone>, [">= 0"])
76
+ s.add_runtime_dependency(%q<devise>, [">= 0"])
74
77
  s.add_development_dependency(%q<rdoc>, [">= 0"])
75
78
  s.add_development_dependency(%q<bundler>, [">= 0"])
76
79
  s.add_development_dependency(%q<jeweler>, [">= 0"])
77
80
  else
81
+ s.add_dependency(%q<tbone>, [">= 0"])
82
+ s.add_dependency(%q<devise>, [">= 0"])
78
83
  s.add_dependency(%q<rdoc>, [">= 0"])
79
84
  s.add_dependency(%q<bundler>, [">= 0"])
80
85
  s.add_dependency(%q<jeweler>, [">= 0"])
81
86
  end
82
87
  else
88
+ s.add_dependency(%q<tbone>, [">= 0"])
89
+ s.add_dependency(%q<devise>, [">= 0"])
83
90
  s.add_dependency(%q<rdoc>, [">= 0"])
84
91
  s.add_dependency(%q<bundler>, [">= 0"])
85
92
  s.add_dependency(%q<jeweler>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbone-devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,33 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-08 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: tbone
16
+ requirement: &70157694245540 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70157694245540
25
+ - !ruby/object:Gem::Dependency
26
+ name: devise
27
+ requirement: &70157694244880 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70157694244880
14
36
  - !ruby/object:Gem::Dependency
15
37
  name: rdoc
16
- requirement: &70361528330060 !ruby/object:Gem::Requirement
38
+ requirement: &70157694244080 !ruby/object:Gem::Requirement
17
39
  none: false
18
40
  requirements:
19
41
  - - ! '>='
@@ -21,10 +43,10 @@ dependencies:
21
43
  version: '0'
22
44
  type: :development
23
45
  prerelease: false
24
- version_requirements: *70361528330060
46
+ version_requirements: *70157694244080
25
47
  - !ruby/object:Gem::Dependency
26
48
  name: bundler
27
- requirement: &70361528329220 !ruby/object:Gem::Requirement
49
+ requirement: &70157694243460 !ruby/object:Gem::Requirement
28
50
  none: false
29
51
  requirements:
30
52
  - - ! '>='
@@ -32,10 +54,10 @@ dependencies:
32
54
  version: '0'
33
55
  type: :development
34
56
  prerelease: false
35
- version_requirements: *70361528329220
57
+ version_requirements: *70157694243460
36
58
  - !ruby/object:Gem::Dependency
37
59
  name: jeweler
38
- requirement: &70361528327780 !ruby/object:Gem::Requirement
60
+ requirement: &70157694242840 !ruby/object:Gem::Requirement
39
61
  none: false
40
62
  requirements:
41
63
  - - ! '>='
@@ -43,7 +65,7 @@ dependencies:
43
65
  version: '0'
44
66
  type: :development
45
67
  prerelease: false
46
- version_requirements: *70361528327780
68
+ version_requirements: *70157694242840
47
69
  description: Devise views for Tbone
48
70
  email: fazzzenda@mail.ru
49
71
  executables: []
@@ -71,12 +93,12 @@ files:
71
93
  - app/assets/javascripts/routers/sessions_router.js.coffee
72
94
  - app/assets/javascripts/tbone-devise.js.coffee
73
95
  - app/assets/javascripts/templates/.gitkeep
74
- - app/assets/javascripts/templates/confirmations/new.jst.hamljs
75
- - app/assets/javascripts/templates/passwords/edit.jst.hamljs
76
- - app/assets/javascripts/templates/passwords/new.jst.hamljs
77
- - app/assets/javascripts/templates/registrations/new.jst.hamljs
78
- - app/assets/javascripts/templates/sessions/login_bar.jst.hamljs
79
- - app/assets/javascripts/templates/sessions/new.jst.hamljs
96
+ - app/assets/javascripts/templates/confirmations/new.hamlc
97
+ - app/assets/javascripts/templates/passwords/edit.hamlc
98
+ - app/assets/javascripts/templates/passwords/new.hamlc
99
+ - app/assets/javascripts/templates/registrations/new.hamlc
100
+ - app/assets/javascripts/templates/sessions/login_bar.hamlc
101
+ - app/assets/javascripts/templates/sessions/new.hamlc
80
102
  - app/assets/javascripts/views/.gitkeep
81
103
  - app/assets/javascripts/views/confirmations/new_view.js.coffee
82
104
  - app/assets/javascripts/views/passwords/edit_view.js.coffee
@@ -88,6 +110,7 @@ files:
88
110
  - app/views/devise/mailer/confirmation_instructions.html.erb
89
111
  - app/views/devise/mailer/reset_password_instructions.html.erb
90
112
  - app/views/devise/mailer/unlock_instructions.html.erb
113
+ - app/views/users/show.json.rabl
91
114
  - config/locales/tbone-devise.en.yml
92
115
  - config/routes.rb
93
116
  - lib/tbone-devise.rb
@@ -110,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
133
  version: '0'
111
134
  segments:
112
135
  - 0
113
- hash: 2102245750480204451
136
+ hash: -1955465905685037180
114
137
  required_rubygems_version: !ruby/object:Gem::Requirement
115
138
  none: false
116
139
  requirements: