wristband 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,8 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'rails', '>=3.1.0'
4
- gem 'haml', '>=3.1.3'
5
- gem 'formatted_form', '>=1.0.2'
6
4
 
7
5
  group :development, :test do
8
6
  gem 'sqlite3'
data/Gemfile.lock CHANGED
@@ -36,9 +36,7 @@ GEM
36
36
  erubis (2.7.0)
37
37
  faker (1.0.0)
38
38
  i18n (~> 0.4)
39
- formatted_form (1.0.2)
40
39
  git (1.2.5)
41
- haml (3.1.3)
42
40
  hike (1.2.1)
43
41
  i18n (0.6.0)
44
42
  jeweler (1.6.4)
@@ -96,8 +94,6 @@ PLATFORMS
96
94
 
97
95
  DEPENDENCIES
98
96
  faker
99
- formatted_form (>= 1.0.2)
100
- haml (>= 3.1.3)
101
97
  jeweler
102
98
  rails (>= 3.1.0)
103
99
  sqlite3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
@@ -0,0 +1,7 @@
1
+ <h1>Enter a new Password</h1>
2
+
3
+ <%= form_for @user, :url => { :action => :update, :id => params[:id] } do |form| %>
4
+ <%= form.password_field :password, :autocomplete => :off %>
5
+ <%= form.password_field :password_confirmation, :label => 'Password Confim' %>
6
+ <%= form.submit 'Update' %>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <h1>Reset your password</h1>
2
+
3
+ <%= form_tag passwords_path do %>
4
+ <label>Email</label>
5
+ <%= text_field_tag :email %>
6
+ <%= submit_tag 'Send Reset Password Email' %>
7
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <h1>Login</h1>
2
+
3
+ <%= form_for @session_user, :url => login_path do |f| %>
4
+ <label>email</label><%= f.text_field :email %>
5
+ <label>password</label><%= f.password_field :password %>
6
+ <label>remember_me</label><%= f.check_box :remember_me %>
7
+ <%= f.submit 'Log In' %>
8
+ <% end %>
9
+
10
+ <p>
11
+ Did you forget your password?
12
+ <%= link_to 'Recover it here.', new_password_path %>
13
+ </p>
@@ -0,0 +1,5 @@
1
+ <p>Hi</p>
2
+
3
+ <p>A new password was requested for this email address. Please ignore this if you think this email is sent to you in error.</p>
4
+
5
+ <p><%= link_to 'Reset your password', edit_password_url(:id => @user.perishable_token) %></p>
@@ -3,4 +3,4 @@ Hi,
3
3
  A new password was requested for this email address. Please ignore this if you think this email is sent to you in error.
4
4
 
5
5
  To reset your password please follow this link:
6
- = edit_password_url(:id => @user.perishable_token)
6
+ <%= edit_password_url(:id => @user.perishable_token) %>
@@ -0,0 +1 @@
1
+ <h1><%= "Hi #{current_user.email}" %></h1>
data/wristband.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wristband}
8
- s.version = "2.0.0"
8
+ s.version = "2.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jack Neto", "The Working Group Inc"]
12
- s.date = %q{2011-09-25}
12
+ s.date = %q{2011-09-29}
13
13
  s.description = %q{Provides a starting point for user authentication}
14
14
  s.email = %q{jack@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -26,17 +26,16 @@ Gem::Specification.new do |s|
26
26
  "app/controllers/passwords_controller.rb",
27
27
  "app/controllers/sessions_controller.rb",
28
28
  "app/controllers/users_controller.rb",
29
- "app/helpers/form_helper.rb",
30
29
  "app/mailers/user_mailer.rb",
31
30
  "app/models/session_user.rb",
32
31
  "app/models/user.rb",
33
32
  "app/views/layouts/application.html.erb",
34
- "app/views/passwords/edit.html.haml",
35
- "app/views/passwords/new.html.haml",
36
- "app/views/sessions/new.html.haml",
37
- "app/views/user_mailer/password_reset.html.haml",
38
- "app/views/user_mailer/password_reset.text.haml",
39
- "app/views/users/show.html.haml",
33
+ "app/views/passwords/edit.html.erb",
34
+ "app/views/passwords/new.html.erb",
35
+ "app/views/sessions/new.html.erb",
36
+ "app/views/user_mailer/password_reset.html.erb",
37
+ "app/views/user_mailer/password_reset.text.erb",
38
+ "app/views/users/show.html.erb",
40
39
  "config.ru",
41
40
  "config/application.rb",
42
41
  "config/boot.rb",
@@ -45,12 +44,10 @@ Gem::Specification.new do |s|
45
44
  "config/environments/development.rb",
46
45
  "config/environments/production.rb",
47
46
  "config/environments/test.rb",
48
- "config/initializers/formatted_form_builder.rb",
49
47
  "config/initializers/wristband.rb",
50
48
  "config/locales/en.yml",
51
49
  "config/routes.rb",
52
50
  "db/migrate/01_create_users_table.rb",
53
- "db/schema.rb",
54
51
  "lib/generators/wristband/.DS_Store",
55
52
  "lib/generators/wristband/wristband_generator.rb",
56
53
  "lib/wristband.rb",
@@ -81,8 +78,6 @@ Gem::Specification.new do |s|
81
78
 
82
79
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
83
80
  s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
84
- s.add_runtime_dependency(%q<haml>, [">= 3.1.3"])
85
- s.add_runtime_dependency(%q<formatted_form>, [">= 1.0.2"])
86
81
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
87
82
  s.add_development_dependency(%q<jeweler>, [">= 0"])
88
83
  s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
@@ -90,8 +85,6 @@ Gem::Specification.new do |s|
90
85
  s.add_runtime_dependency(%q<formatted_form>, [">= 1.0.2"])
91
86
  else
92
87
  s.add_dependency(%q<rails>, [">= 3.1.0"])
93
- s.add_dependency(%q<haml>, [">= 3.1.3"])
94
- s.add_dependency(%q<formatted_form>, [">= 1.0.2"])
95
88
  s.add_dependency(%q<sqlite3>, [">= 0"])
96
89
  s.add_dependency(%q<jeweler>, [">= 0"])
97
90
  s.add_dependency(%q<rails>, [">= 3.1.0"])
@@ -100,8 +93,6 @@ Gem::Specification.new do |s|
100
93
  end
101
94
  else
102
95
  s.add_dependency(%q<rails>, [">= 3.1.0"])
103
- s.add_dependency(%q<haml>, [">= 3.1.3"])
104
- s.add_dependency(%q<formatted_form>, [">= 1.0.2"])
105
96
  s.add_dependency(%q<sqlite3>, [">= 0"])
106
97
  s.add_dependency(%q<jeweler>, [">= 0"])
107
98
  s.add_dependency(%q<rails>, [">= 3.1.0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wristband
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-25 00:00:00.000000000 -04:00
13
+ date: 2011-09-29 00:00:00.000000000 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
18
- requirement: &2169255100 !ruby/object:Gem::Requirement
18
+ requirement: &2153453920 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,32 +23,10 @@ dependencies:
23
23
  version: 3.1.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2169255100
27
- - !ruby/object:Gem::Dependency
28
- name: haml
29
- requirement: &2169254620 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: 3.1.3
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: *2169254620
38
- - !ruby/object:Gem::Dependency
39
- name: formatted_form
40
- requirement: &2169254140 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 1.0.2
46
- type: :runtime
47
- prerelease: false
48
- version_requirements: *2169254140
26
+ version_requirements: *2153453920
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: sqlite3
51
- requirement: &2169253660 !ruby/object:Gem::Requirement
29
+ requirement: &2153452700 !ruby/object:Gem::Requirement
52
30
  none: false
53
31
  requirements:
54
32
  - - ! '>='
@@ -56,10 +34,10 @@ dependencies:
56
34
  version: '0'
57
35
  type: :development
58
36
  prerelease: false
59
- version_requirements: *2169253660
37
+ version_requirements: *2153452700
60
38
  - !ruby/object:Gem::Dependency
61
39
  name: jeweler
62
- requirement: &2169253180 !ruby/object:Gem::Requirement
40
+ requirement: &2153449360 !ruby/object:Gem::Requirement
63
41
  none: false
64
42
  requirements:
65
43
  - - ! '>='
@@ -67,10 +45,10 @@ dependencies:
67
45
  version: '0'
68
46
  type: :development
69
47
  prerelease: false
70
- version_requirements: *2169253180
48
+ version_requirements: *2153449360
71
49
  - !ruby/object:Gem::Dependency
72
50
  name: rails
73
- requirement: &2169252700 !ruby/object:Gem::Requirement
51
+ requirement: &2153446300 !ruby/object:Gem::Requirement
74
52
  none: false
75
53
  requirements:
76
54
  - - ! '>='
@@ -78,10 +56,10 @@ dependencies:
78
56
  version: 3.1.0
79
57
  type: :runtime
80
58
  prerelease: false
81
- version_requirements: *2169252700
59
+ version_requirements: *2153446300
82
60
  - !ruby/object:Gem::Dependency
83
61
  name: haml
84
- requirement: &2169252220 !ruby/object:Gem::Requirement
62
+ requirement: &2153432960 !ruby/object:Gem::Requirement
85
63
  none: false
86
64
  requirements:
87
65
  - - ! '>='
@@ -89,10 +67,10 @@ dependencies:
89
67
  version: 3.1.3
90
68
  type: :runtime
91
69
  prerelease: false
92
- version_requirements: *2169252220
70
+ version_requirements: *2153432960
93
71
  - !ruby/object:Gem::Dependency
94
72
  name: formatted_form
95
- requirement: &2169251740 !ruby/object:Gem::Requirement
73
+ requirement: &2153430720 !ruby/object:Gem::Requirement
96
74
  none: false
97
75
  requirements:
98
76
  - - ! '>='
@@ -100,7 +78,7 @@ dependencies:
100
78
  version: 1.0.2
101
79
  type: :runtime
102
80
  prerelease: false
103
- version_requirements: *2169251740
81
+ version_requirements: *2153430720
104
82
  description: Provides a starting point for user authentication
105
83
  email: jack@theworkinggroup.ca
106
84
  executables: []
@@ -118,17 +96,16 @@ files:
118
96
  - app/controllers/passwords_controller.rb
119
97
  - app/controllers/sessions_controller.rb
120
98
  - app/controllers/users_controller.rb
121
- - app/helpers/form_helper.rb
122
99
  - app/mailers/user_mailer.rb
123
100
  - app/models/session_user.rb
124
101
  - app/models/user.rb
125
102
  - app/views/layouts/application.html.erb
126
- - app/views/passwords/edit.html.haml
127
- - app/views/passwords/new.html.haml
128
- - app/views/sessions/new.html.haml
129
- - app/views/user_mailer/password_reset.html.haml
130
- - app/views/user_mailer/password_reset.text.haml
131
- - app/views/users/show.html.haml
103
+ - app/views/passwords/edit.html.erb
104
+ - app/views/passwords/new.html.erb
105
+ - app/views/sessions/new.html.erb
106
+ - app/views/user_mailer/password_reset.html.erb
107
+ - app/views/user_mailer/password_reset.text.erb
108
+ - app/views/users/show.html.erb
132
109
  - config.ru
133
110
  - config/application.rb
134
111
  - config/boot.rb
@@ -137,12 +114,10 @@ files:
137
114
  - config/environments/development.rb
138
115
  - config/environments/production.rb
139
116
  - config/environments/test.rb
140
- - config/initializers/formatted_form_builder.rb
141
117
  - config/initializers/wristband.rb
142
118
  - config/locales/en.yml
143
119
  - config/routes.rb
144
120
  - db/migrate/01_create_users_table.rb
145
- - db/schema.rb
146
121
  - lib/generators/wristband/.DS_Store
147
122
  - lib/generators/wristband/wristband_generator.rb
148
123
  - lib/wristband.rb
@@ -177,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
152
  version: '0'
178
153
  segments:
179
154
  - 0
180
- hash: 4047135453176872071
155
+ hash: -1620791451856764861
181
156
  required_rubygems_version: !ruby/object:Gem::Requirement
182
157
  none: false
183
158
  requirements:
@@ -1,8 +0,0 @@
1
- module FormHelper
2
- def formatted_form_for(record_or_name_or_array, *args, &proc)
3
- options = args.extract_options!
4
- options.merge!(:builder => FormattedFormBuilder)
5
- (options[:html] ||= { }).merge!(:class => "#{options[:html][:class]} formatted")
6
- form_for(record_or_name_or_array, *(args << options), &proc)
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- %h1 Enter a new Password
2
-
3
- = formatted_form_for @user, :url => { :action => :update, :id => params[:id] } do |form|
4
- = form.error_messages
5
- = form.password_field :password, :autocomplete => :off
6
- = form.password_field :password_confirmation, :label => 'Password Confim'
7
- = form.submit 'Update'
@@ -1,15 +0,0 @@
1
- %h1 Reset your password
2
-
3
- = form_tag passwords_path, :class => 'formatted' do
4
- .form_element.text_field_element
5
- .label Email
6
- .value= text_field_tag :email
7
-
8
- .form_element.submit_element
9
- = submit_tag 'Send Reset Password Email'
10
-
11
-
12
-
13
- %p
14
- Already have an account?
15
- = link_to 'Login', login_path
@@ -1,11 +0,0 @@
1
- %h1 Login
2
-
3
- = formatted_form_for @session_user, :url => login_path do |f|
4
- = f.text_field :email, :label => 'Email address'
5
- = f.password_field :password
6
- = f.check_box :remember_me, :label => 'Remember me when I come back'
7
- = f.submit 'Log In'
8
-
9
- %p
10
- Did you forget your password?
11
- = link_to 'Recover it here.', new_password_path
@@ -1,7 +0,0 @@
1
- %p
2
- Hi
3
- %p
4
- A new password was requested for this email address. Please ignore this if you think this email is sent to you in error.
5
-
6
- %h2
7
- = link_to 'Reset your password', edit_password_url(:id => @user.perishable_token)
@@ -1,6 +0,0 @@
1
- %h1= "Hi #{current_user.email}"
2
-
3
- - if logged_in?
4
- = link_to 'Logout', logout_path
5
- - else
6
- = link_to 'Login', login_path
@@ -1,141 +0,0 @@
1
- class FormattedFormBuilder < ActionView::Helpers::FormBuilder
2
-
3
- %w[ date_select text_field password_field text_area file_field datetime_select ].each do |selector|
4
- src = <<-end_src
5
- def #{selector}(method, options = {})
6
- if (options[:simple] == true)
7
- super(method, options)
8
- else
9
- options.merge!(:size=> '') if #{%w{text_field password_field}.include?(selector)}
10
- standard_field('#{selector}', method, options) { super(method, options) }
11
- end
12
- end
13
- end_src
14
- class_eval src, __FILE__, __LINE__
15
- end
16
-
17
- def standard_field(type, method, options={}, &block)
18
- description = options.delete(:desc)
19
- content = options.delete(:content)
20
- prev_content = options.delete(:prev_content)
21
- label = label_for(method, options)
22
- required = options.delete(:required)
23
- check_box_details = options.delete(:check_box_details)
24
- text_snippet = options.delete(:text_snippet)
25
- %{
26
- <div class='form_element #{type}_element'>
27
- #{"<div class='text_snippet'>"+text_snippet+"</div>" if text_snippet}
28
- <div class='label'>
29
- #{description(description) || '&nbsp;' if type == 'check_box' }
30
- #{label if type != 'check_box' }
31
- #{@template.content_tag(:span, '*', :class => 'required_ind') if required }
32
- </div>
33
- <div class='value'>
34
- #{prev_content}#{yield}#{content}
35
- #{error_messages_for(method)}
36
- #{description(description) if type != 'check_box'}
37
- #{description(check_box_details) if type == 'check_box'}
38
- </div>
39
- </div>
40
- }.html_safe
41
- end
42
-
43
- # generic container for all things form
44
- def element(label = '&nbsp;', value = '', type = 'text_field', &block)
45
- value += @template.capture(&block) if block_given?
46
- %{
47
- <div class='form_element #{type}_element'>
48
- <div class='label'>
49
- #{label}
50
- </div>
51
- <div class='value'>
52
- #{value}
53
- </div>
54
- </div>
55
- }.html_safe
56
- end
57
-
58
- def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
59
- options[:content] = label_for(method, options)
60
- options[:label] = ''
61
- standard_field('check_box', method, options) { super(method, options, checked_value, unchecked_value) }
62
- end
63
-
64
- def radio_button(method, tag_value, options = {})
65
- if options && options[:choices]
66
- radios = options.delete(:choices).collect{|choice| %{<div class="radio_button">}+super(method, choice[0], options) + %{<label for="#{object_name.to_s.gsub(']', '').gsub('[', '_')}_#{method}_#{choice[0]}">#{choice[1]}</label></div>}}.join.html_safe
67
- standard_field('radio_button', method, options) { radios }
68
- elsif options && options[:value_name]
69
- standard_field('radio_button', method, options) { super(method, tag_value) + %{<label for="#{object_name}_#{method}_#{tag_value}">#{options[:value_name]}</label><div class="clearfloat"></div>}.html_safe}
70
- else
71
- standard_field('radio_button', method, options) { super(method, tag_value, options = {}) }
72
- end
73
- end
74
-
75
- def select(method, choices, options = {}, html_options = {})
76
- standard_field('select', method, options) { super(method, choices, options, html_options) }
77
- end
78
-
79
- def hidden_field(method, options = {}, html_options = {})
80
- super(method, options)
81
- end
82
-
83
- def submit(value, options={}, &block)
84
- cancel_link = @template.capture(&block) if block_given?
85
- cancel_link ||= options[:cancel_url] ? ' or ' + options.delete(:cancel_url) : ''
86
- if options[:show_ajax_loader]
87
- options[:onclick] = "$(this).parent().next().css('display', 'block');$(this).parent().hide();"
88
- end
89
- if options[:image_button] == true
90
- submit_id = Time.now.usec
91
- out = @template.content_tag(:div,
92
- %{
93
- #{super(value, options.merge(:style=>'visibility:hidden;position: absolute', :id => submit_id)).html_safe}
94
- <a class="red_button" href="" onclick="$('##{submit_id}').closest('form').submit();return false"><span>#{value}</span></a>
95
- #{cancel_link.html_safe}
96
- }.html_safe, :class => 'form_element submit_element').html_safe
97
-
98
- else
99
- out = @template.content_tag(:div, super(value, options) + cancel_link.html_safe, :class => 'form_element submit_element').html_safe
100
- end
101
-
102
- if options[:show_ajax_loader]
103
- out << %{
104
- <div class="form_element submit_element" style="display:none">
105
- <div class="submit_ajax_loader">#{options[:show_ajax_loader]}</div>
106
- </div>
107
- }.html_safe
108
- end
109
- out.html_safe
110
- end
111
-
112
- def label_for(method, options)
113
- label = options.delete(:label) || method.to_s.titleize.capitalize
114
- "<label for=\"#{object_name}_#{method}\">#{label}</label>"
115
- end
116
-
117
- def description(description)
118
- "<div class='description'>#{description}</div>" unless description.nil?
119
- end
120
-
121
- def error_messages
122
- if object && !object.errors.empty?
123
- message = object.errors[:base].present? ? object.errors[:base]: 'There were some problems submitting this form. Please correct all the highlighted fields and try again'
124
- @template.content_tag(:div, message, :class => 'form_error')
125
- end
126
- end
127
-
128
- def error_messages_for(method)
129
- if (object and object.respond_to?(:errors) and errors = object.errors[method])
130
- "<div class='errors'>#{errors.is_a?(Array) ? errors.first : errors}</div>"
131
- else
132
- ''
133
- end
134
- end
135
-
136
- def formatted_fields_for(record_or_name_or_array, *args, &block)
137
- options = args.extract_options!
138
- options.merge!(:builder => FormattedFormBuilder)
139
- fields_for(record_or_name_or_array, *(args << options), &block)
140
- end
141
- end
data/db/schema.rb DELETED
@@ -1,30 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
10
- #
11
- # It's strongly recommended to check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(:version => 1) do
14
-
15
- create_table "users", :force => true do |t|
16
- t.string "email"
17
- t.string "password_hash", :limit => 40
18
- t.string "password_salt", :limit => 40
19
- t.string "perishable_token"
20
- t.string "remember_token"
21
- t.string "role"
22
- t.datetime "created_at"
23
- t.datetime "updated_at"
24
- end
25
-
26
- add_index "users", ["email"], :name => "index_users_on_email"
27
- add_index "users", ["perishable_token"], :name => "index_users_on_perishable_token"
28
- add_index "users", ["remember_token"], :name => "index_users_on_remember_token"
29
-
30
- end