noodall-devise 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/app/models/user.rb CHANGED
@@ -9,11 +9,28 @@ class User
9
9
  plugin Noodall::Tagging
10
10
 
11
11
  key :name, String
12
+ key :permalink, String, :required => true, :index => true
13
+ key :bio, String
12
14
  timestamps!
13
15
 
14
16
  alias_attribute :groups, :tags
15
17
  alias_attribute :group_list, :tag_list
16
18
 
19
+
20
+ #-- Dragonfly -----------
21
+ extend Dragonfly::ActiveModelExtensions
22
+ register_dragonfly_app(:image_accessor, Dragonfly::App[:noodall_assets])
23
+
24
+ image_accessor :avatar
25
+
26
+ key :avatar_uid, String #For dragonfly file uid
27
+ key :avatar_name, String
28
+ key :avatar_ext, String
29
+ key :avatar_size, Integer
30
+ key :avatar_mime_type, String
31
+ #------------------------
32
+
33
+
17
34
  def full_name
18
35
  name || email
19
36
  end
@@ -28,6 +45,16 @@ class User
28
45
  super(conditions)
29
46
  end
30
47
 
48
+ def web_image_extension
49
+ # If the extension id anything other than a png or gif then it should be a jpg
50
+ case avatar_ext
51
+ when 'png', 'gif'
52
+ avatar_ext
53
+ else
54
+ 'jpg'
55
+ end.to_sym
56
+ end
57
+
31
58
  protected
32
59
  before_validation :clean_email
33
60
  def clean_email
@@ -38,4 +65,8 @@ protected
38
65
  (self.tag_cloud + ['admin']).uniq
39
66
  end
40
67
 
68
+ before_validation :set_permalink
69
+ def set_permalink
70
+ self.permalink = self.name.to_s.parameterize
71
+ end
41
72
  end
@@ -1,6 +1,6 @@
1
1
  <h1><%= @user.new_record? ? 'New' : 'Editing' %> User</h1>
2
2
 
3
- <%= form_for([:admin, @user]) do |f| %>
3
+ <%= form_for([:admin, @user], :html => { :multipart => true}) do |f| %>
4
4
  <%= f.error_messages %>
5
5
 
6
6
  <p>
@@ -14,6 +14,18 @@
14
14
  <%= f.label :email %><br/>
15
15
  <span class="input-wrap"><%= f.text_field :email %></span>
16
16
  </p>
17
+
18
+ <p>
19
+ <span class="tooltip" title="Select an image to use as this user's icon">&nbsp;</span>
20
+ <%= f.label :avatar %><br/>
21
+ <span class="input-wrap"><%= f.file_field :avatar %></span>
22
+ </p>
23
+
24
+ <p>
25
+ <span class="tooltip" title="Enter some text about this user">&nbsp;</span>
26
+ <%= f.label :bio %><br/>
27
+ <span class="input-wrap"><%= f.text_area :bio %></span>
28
+ </p>
17
29
 
18
30
  <p>
19
31
  <span class="tooltip" title="Enter the a password for the user">&nbsp;</span>
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module Devise
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodall-devise
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
4
+ hash: 17
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors: []
13
13
 
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-28 00:00:00 +00:00
18
+ date: 2011-02-02 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -30,10 +30,10 @@ dependencies:
30
30
  - 1
31
31
  - 3
32
32
  version: 1.1.3
33
+ type: :runtime
33
34
  name: devise
34
35
  prerelease: false
35
36
  version_requirements: *id001
36
- type: :runtime
37
37
  - !ruby/object:Gem::Dependency
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
@@ -46,10 +46,10 @@ dependencies:
46
46
  - 1
47
47
  - 6
48
48
  version: 1.1.6
49
+ type: :runtime
49
50
  name: mm-devise
50
51
  prerelease: false
51
52
  version_requirements: *id002
52
- type: :runtime
53
53
  - !ruby/object:Gem::Dependency
54
54
  requirement: &id003 !ruby/object:Gem::Requirement
55
55
  none: false
@@ -62,10 +62,10 @@ dependencies:
62
62
  - 0
63
63
  - 0
64
64
  version: 1.0.0
65
+ type: :development
65
66
  name: bundler
66
67
  prerelease: false
67
68
  version_requirements: *id003
68
- type: :development
69
69
  description: User sign in and managent with devise. Provides administration of users in the admin area
70
70
  email: []
71
71
 
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  requirements: []
165
165
 
166
166
  rubyforge_project:
167
- rubygems_version: 1.4.1
167
+ rubygems_version: 1.3.7
168
168
  signing_key:
169
169
  specification_version: 3
170
170
  summary: "Noodall Devise: User sign in and managent with devise"