muck-users 3.1.10 → 3.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.10
1
+ 3.1.11
@@ -1,8 +1,19 @@
1
1
  module MuckUsersHelper
2
2
 
3
3
  # Render a basic user registration form
4
- def signup_form(user, redirect_to = nil)
5
- render :partial => 'users/signup_form', :locals => { :user => user, :redirect_to => redirect_to}
4
+ def signup_form(user, redirect_to = nil, options = {}, &block)
5
+ options[:html] = {} if options[:html].nil?
6
+ options[:title] = nil if options[:title].blank?
7
+ raw_block_to_partial('users/signup_form', options.merge(:user => user, :redirect_to => redirect_to), &block)
8
+ end
9
+
10
+ def signin_form(options = {}, &block)
11
+ options[:html] = {} if options[:html].nil?
12
+ options[:title] = nil if options[:title].blank?
13
+ options[:exclude_register_link] = false if options[:exclude_register_link].blank?
14
+ options[:exclude_forgot_password_link] = false if options[:exclude_forgot_password_link].blank?
15
+ options[:exclude_forgot_username_link] = false if options[:exclude_forgot_username_link].blank?
16
+ raw_block_to_partial('user_sessions/form', options, &block)
6
17
  end
7
18
 
8
19
  # Sign up javascript is not required but will add script to the sign up form which will make ajax calls
@@ -0,0 +1,19 @@
1
+ <div id="sign_in" class="common-form">
2
+ <%= muck_form_for :user_session, :url => user_session_path, :html => { :id => 'sign_in_form', :name => 'sign_in_form' } do |f| -%>
3
+ <h1><%= title || I18n.t('muck.users.login_title') %></h1>
4
+ <%= output_errors(t('muck.users.login_fail'), {:class => 'help-box'}) %>
5
+ <%= f.text_field :login, { :label => I18n.t('muck.users.username'), :class => 'login', :hide_required => true, :hide_control_error => true } -%>
6
+ <%= f.password_field :password, { :label => I18n.t('muck.users.password'), :class => 'password', :hide_required => true, :hide_control_error => true } -%>
7
+ <%= capture(f, &block) if block -%>
8
+ <%= f.check_box :remember_me, { :label => I18n.t('muck.users.remember_me'), :class => 'checkbox', :hide_required => true, :hide_control_error => true } %>
9
+ <div class="button form-row">
10
+ <%= submit_tag I18n.t('muck.users.sign_in'), :class => 'wait-button' %>
11
+ <div class="waiting" style="display:none;"><%=translate('muck.users.signin_wait') %></div>
12
+ </div>
13
+ <div class="form-row">
14
+ <% unless exclude_register_link -%><span class="instruction"><%= link_to I18n.t('muck.users.register_for_account'), signup_url %></span> | <% end -%>
15
+ <% unless exclude_forgot_password_link -%><span class="instruction"><%= link_to I18n.t('muck.users.forgot_your_password'), forgot_password_path %></span> | <% end -%>
16
+ <% unless exclude_forgot_username_link -%><span class="instruction"><%= link_to I18n.t('muck.users.forgot_your_username'), forgot_username_path %></span> <% end -%>
17
+ </div>
18
+ <% end %>
19
+ </div>
@@ -1,18 +1 @@
1
- <div id="sign_in" class="common-form">
2
- <%= muck_form_for :user_session, :url => user_session_path, :html => { :id => 'sign_in_form', :name => 'sign_in_form' } do |f| -%>
3
- <h1><%= I18n.t('muck.users.login_title') %></h1>
4
- <%= output_errors(t('muck.users.login_fail'), {:class => 'help-box'}) %>
5
- <%= f.text_field :login, { :label => I18n.t('muck.users.username'), :class => 'login', :hide_required => true, :hide_control_error => true } -%>
6
- <%= f.password_field :password, { :label => I18n.t('muck.users.password'), :class => 'password', :hide_required => true, :hide_control_error => true } -%>
7
- <%= f.check_box :remember_me, { :label => I18n.t('muck.users.remember_me'), :class => 'checkbox', :hide_required => true, :hide_control_error => true } %>
8
- <div class="button form-row">
9
- <%= submit_tag I18n.t('muck.users.sign_in'), :class => 'wait-button' %>
10
- <div class="waiting" style="display:none;"><%=translate('muck.users.signin_wait') %></div>
11
- </div>
12
- <div class="form-row">
13
- <span class="instruction"><%= link_to I18n.t('muck.users.register_for_account'), signup_url %></span> |
14
- <span class="instruction"><%= link_to I18n.t('muck.users.forgot_your_password'), forgot_password_path %></span> |
15
- <span class="instruction"><%= link_to I18n.t('muck.users.forgot_your_username'), forgot_username_path %></span>
16
- </div>
17
- <% end %>
18
- </div>
1
+ <%= signin_form -%>
@@ -1,42 +1,49 @@
1
- <%= muck_form_for :user, :url => users_path, :html => {:id => "register-user-form", :name => 'register-user-form'} do |f| -%>
2
-
3
- <%= output_errors(t('muck.users.problem_creating_account'), {:class => 'help-box'}, user) %>
4
-
5
- <% if MuckUsers.configuration.require_access_code -%>
6
- <%= f.text_field :access_code_code, { :label => translate('muck.users.access_code'),
7
- :extra_html => translate('muck.users.access_code_help',
8
- :access_request_anchor => %Q{<a class="fancy-access-request iframe" href="#{new_access_code_request_path}">},
9
- :access_request_anchor_end => "</a>").html_safe } -%>
10
- <% end -%>
11
-
12
- <%= f.text_field :login, { :label => t('muck.users.choose_member_name'),
13
- :extra_html => '<span id="username-availibility"></span>',
14
- :tip => t('muck.users.username_help'),
15
- :required_label => t('muck.users.username') } -%>
16
- <%= f.text_field :email, { :label => t('muck.users.email_address'),
17
- :tip => t('muck.users.email_help'),
18
- :extra_html => '<span id="email-availibility"></span>' } -%>
19
- <%= f.password_field :password, { :label => t('muck.users.password'),
20
- :tip => t('muck.users.password_help')} -%>
21
- <%= f.password_field :password_confirmation, { :label => t('muck.users.confirm_password'),
22
- :tip => t('muck.users.password_confirmation_help') } -%>
23
-
24
- <% if MuckUsers.configuration.validate_terms_of_service -%>
25
- <div class="checklist">
26
- <%= f.check_box :terms_of_service, { :label => t('muck.users.terms_and_service', :tos_link_anchor => '<a href="/terms_of_service">', :link_end => '</a>').html_safe,
27
- :tip => t('muck.users.terms_and_service_tip') } -%>
1
+ <div id="registration" class="common-form">
2
+ <h1><%= title || t('muck.users.register_account', :application_name => MuckEngine.configuration.application_name) %></h1>
3
+ <p><%= t('muck.users.already_registered') %> <a href="<%=login_url%>"><%= t('muck.users.sign_in_now') %></a></p>
4
+ <%= muck_form_for :user, :url => users_path, :html => {:id => "register-user-form", :name => 'register-user-form'} do |f| -%>
5
+
6
+ <%= output_errors(t('muck.users.problem_creating_account'), {:class => 'help-box'}, user) %>
7
+
8
+ <% if MuckUsers.configuration.require_access_code -%>
9
+ <%= f.text_field :access_code_code, { :label => translate('muck.users.access_code'),
10
+ :extra_html => translate('muck.users.access_code_help',
11
+ :access_request_anchor => %Q{<a class="fancy-access-request iframe" href="#{new_access_code_request_path}">},
12
+ :access_request_anchor_end => "</a>").html_safe } -%>
13
+ <% end -%>
14
+
15
+ <%= f.text_field :login, { :label => t('muck.users.choose_member_name'),
16
+ :extra_html => '<span id="username-availibility"></span>',
17
+ :tip => t('muck.users.username_help'),
18
+ :required_label => t('muck.users.username') } -%>
19
+ <%= f.text_field :email, { :label => t('muck.users.email_address'),
20
+ :tip => t('muck.users.email_help'),
21
+ :extra_html => '<span id="email-availibility"></span>' } -%>
22
+ <%= f.password_field :password, { :label => t('muck.users.password'),
23
+ :tip => t('muck.users.password_help')} -%>
24
+ <%= f.password_field :password_confirmation, { :label => t('muck.users.confirm_password'),
25
+ :tip => t('muck.users.password_confirmation_help') } -%>
26
+
27
+ <%= capture(f, &block) if block -%>
28
+
29
+ <% if MuckUsers.configuration.validate_terms_of_service -%>
30
+ <div class="checklist">
31
+ <%= f.check_box :terms_of_service, { :label => t('muck.users.terms_and_service', :tos_link_anchor => '<a href="/terms_of_service">', :link_end => '</a>').html_safe,
32
+ :tip => t('muck.users.terms_and_service_tip') } -%>
33
+ </div>
34
+ <% end -%>
35
+
36
+ <% if MuckUsers.configuration.use_recaptcha -%>
37
+ <div class="recaptcha">
38
+ <%= recaptcha_tags %>
39
+ </div>
40
+ <% end -%>
41
+
42
+ <div class="button form-row">
43
+ <%= f.submit t('muck.users.sign_up_now'), :class => 'wait-button' %>
44
+ <div class="waiting" style="display:none;"><%=translate('muck.users.signup_wait') %></div>
28
45
  </div>
46
+
29
47
  <% end -%>
30
-
31
- <% if MuckUsers.configuration.use_recaptcha -%>
32
- <div class="recaptcha">
33
- <%= recaptcha_tags %>
34
- </div>
35
- <% end -%>
36
-
37
- <div class="button form-row">
38
- <%= f.submit t('muck.users.sign_up_now'), :class => 'wait-button' %>
39
- <div class="waiting" style="display:none;"><%=translate('muck.users.signup_wait') %></div>
40
- </div>
41
-
42
- <% end -%>
48
+ </div>
49
+ <%= signup_form_javascript -%>
@@ -1,6 +1 @@
1
- <div id="registration" class="common-form">
2
- <h1><%= t('muck.users.register_account', :application_name => MuckEngine.configuration.application_name) %></h1>
3
- <p><%= t('muck.users.already_registered') %> <a href="<%=login_url%>"><%= t('muck.users.sign_in_now') %></a></p>
4
- <%= signup_form(@user) -%>
5
- </div>
6
- <%= signup_form_javascript -%>
1
+ <%= signup_form(@user) -%>
@@ -35,9 +35,11 @@ module MuckUsers
35
35
  def login_required
36
36
  unless logged_in?
37
37
  store_location
38
- flash[:notice] = I18n.t('muck.users.login_requred')
39
38
  respond_to do |format|
40
- format.html { redirect_to login_path }
39
+ format.html do
40
+ flash[:notice] = I18n.t('muck.users.login_requred')
41
+ redirect_to login_path
42
+ end
41
43
  format.json { render :json => { :success => false, :logged_in => false, :message => I18n.t('muck.users.login_requred') } }
42
44
  end
43
45
  end
@@ -74,6 +74,14 @@ module MuckUsers
74
74
  def validates_terms_of_service
75
75
  validate(:accepts_terms_of_service?, :on => :create)
76
76
  end
77
+
78
+ def parse_name(name)
79
+ return '' if name.blank?
80
+ names = name.split(' ')
81
+ return '' if names.length <= 0
82
+ return [names[0], names[0]] if names.length == 1
83
+ [names[0], names.slice(1, names.length).join(' ')]
84
+ end
77
85
 
78
86
  end
79
87
 
data/muck-users.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-users}
8
- s.version = "3.1.10"
8
+ s.version = "3.1.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball", "Joel Duffin"]
@@ -395,6 +395,7 @@ Gem::Specification.new do |s|
395
395
  "app/views/user_mailer/welcome_notification.zh-CN.html.erb",
396
396
  "app/views/user_mailer/welcome_notification.zh-TW.html.erb",
397
397
  "app/views/user_mailer/welcome_notification.zh.html.erb",
398
+ "app/views/user_sessions/_form.erb",
398
399
  "app/views/user_sessions/new.html.erb",
399
400
  "app/views/username_request/new.html.erb",
400
401
  "app/views/users/_available.html.erb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-users
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 10
10
- version: 3.1.10
9
+ - 11
10
+ version: 3.1.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Ball
@@ -465,6 +465,7 @@ files:
465
465
  - app/views/user_mailer/welcome_notification.zh-CN.html.erb
466
466
  - app/views/user_mailer/welcome_notification.zh-TW.html.erb
467
467
  - app/views/user_mailer/welcome_notification.zh.html.erb
468
+ - app/views/user_sessions/_form.erb
468
469
  - app/views/user_sessions/new.html.erb
469
470
  - app/views/username_request/new.html.erb
470
471
  - app/views/users/_available.html.erb