wheels 0.0.41 → 0.0.42

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.41
1
+ 0.0.42
@@ -1,4 +1,36 @@
1
1
  class UsersController < InheritedResources::Base
2
+ respond_to :html, :js, :only=>[:edit, :show, :update]
3
+ respond_to :json, :only=>[:verify_password]
2
4
 
5
+ before_filter :authenticate_user!, :resource
6
+
7
+ def edit
8
+ resource.old_password
9
+ respond_with(resource)
10
+ end
11
+
12
+ def update
13
+ update!(:notice=>"Your password has been updated.") {root_url}
14
+ end
15
+
16
+ def verify
17
+ respond_with @user do |format|
18
+ format.json {render :json=> @user.valid_password?(params[:password]).to_json}
19
+ end
20
+ end
21
+
22
+ def resource
23
+ a = ValidatorCallbacks.new
24
+ @user ||= lambda{
25
+ user = User.find(current_user)
26
+ user.class_eval do
27
+ attr_accessor :old_password
28
+ validates :old_password, :presence=>true , :password=>true
29
+ validates :password, :presence=>true , :length=>{:minimum=>6}
30
+ validates :password_confirmation, :equal_to=>{:other=>:password}
31
+ end
32
+ user
33
+ }.call
34
+ end
3
35
  end
4
36
 
@@ -3,7 +3,6 @@ class Blog < ActiveRecord::Base
3
3
  belongs_to :user
4
4
  validates_presence_of :user_id, :title
5
5
  acts_as_linkable :parent=>:user, :name=>:title
6
-
7
6
  has_many :images
8
7
  cattr_reader :per_page
9
8
  @@per_page = 5
@@ -6,6 +6,8 @@ class User < ActiveRecord::Base
6
6
  has_many :galleries, :dependent => :destroy
7
7
  has_many :access_control_entries, :dependent=>:destroy
8
8
 
9
+ validates :email, :presence => true
10
+
9
11
  def self.nobody
10
12
  User.new(:role=>Role.nobody)
11
13
  end
@@ -1,37 +1,43 @@
1
1
  module ActionDispatch::Routing
2
2
  class Mapper
3
3
  def wheels_resources
4
- resources :galleries do
5
- resources :images
4
+ scope "/admin" do
5
+ resources :access_control_entries
6
6
  end
7
- resource :profile
8
- resources :blogs, :path=>"blog"
9
7
 
10
- devise_for :users
11
-
12
- resources :users do
13
- resource :profile
14
- resources :galleries
15
- resources :blogs, :path=>"blog"
16
- end
8
+ resources :blogs, :path=>"blog"
17
9
 
18
- resources :layouts
19
10
  resources :forums do
20
11
  resources :discussions do
21
12
  resources :forum_messages
22
13
  end
23
14
  end
24
15
 
16
+ resources :galleries do
17
+ resources :images
18
+ end
19
+
20
+ resources :layouts
21
+
25
22
  resources :pages do
26
23
  resources :attachments
27
24
  resources :children, :controller=>"pages", :as => "children"
28
25
  end
29
26
 
30
- scope "/admin" do
31
- resources :access_control_entries
32
- resources :users
27
+ resource :profile
28
+
29
+ devise_for :users
30
+ resources :users do
31
+ resources :blogs, :path=>"blog"
32
+ resources :galleries
33
+ resource :profile
34
+ member do
35
+ get :verify
36
+ end
33
37
  end
34
38
 
39
+ match "change_password" => "users#edit"
40
+ match "verify_password" => "users#verify", :format=>:json
35
41
  end
36
42
  end
37
43
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wheels}
8
- s.version = "0.0.41"
8
+ s.version = "0.0.42"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler Gannon"]
12
- s.date = %q{2010-08-25}
12
+ s.date = %q{2010-09-01}
13
13
  s.description = %q{Call rails generate wheels.}
14
14
  s.email = %q{tgannon@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wheels
3
3
  version: !ruby/object:Gem::Version
4
- hash: 77
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 41
10
- version: 0.0.41
8
+ - 42
9
+ version: 0.0.42
11
10
  platform: ruby
12
11
  authors:
13
12
  - Tyler Gannon
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-08-25 00:00:00 -07:00
17
+ date: 2010-09-01 00:00:00 -07:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
@@ -312,7 +310,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
310
  requirements:
313
311
  - - ">="
314
312
  - !ruby/object:Gem::Version
315
- hash: 3
316
313
  segments:
317
314
  - 0
318
315
  version: "0"
@@ -321,7 +318,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
318
  requirements:
322
319
  - - ">="
323
320
  - !ruby/object:Gem::Version
324
- hash: 3
325
321
  segments:
326
322
  - 0
327
323
  version: "0"