radiant-reader-extension 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/password_resets_controller.rb +8 -9
- data/app/controllers/reader_action_controller.rb +30 -0
- data/app/controllers/reader_activations_controller.rb +4 -4
- data/app/controllers/reader_sessions_controller.rb +1 -1
- data/app/controllers/readers_controller.rb +23 -11
- data/app/helpers/reader_helper.rb +48 -3
- data/app/models/reader.rb +9 -7
- data/app/models/reader_notifier.rb +0 -1
- data/app/views/password_resets/edit.html.haml +25 -22
- data/app/views/reader_sessions/new.html.haml +33 -29
- data/app/views/readers/_form.html.haml +79 -49
- data/app/views/readers/_standard_parts.html.haml +33 -0
- data/app/views/readers/edit.html.haml +11 -29
- data/app/views/readers/index.html.haml +29 -4
- data/app/views/readers/login.html.haml +1 -1
- data/app/views/readers/new.html.haml +13 -15
- data/app/views/readers/show.html.haml +16 -27
- data/config/locales/en.yml +29 -6
- data/config/routes.rb +3 -0
- data/lib/reader_tags.rb +1 -1
- data/public/javascripts/reader.js +19 -0
- data/radiant-reader-extension.gemspec +4 -2
- data/reader_extension.rb +1 -1
- metadata +7 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
@@ -1,9 +1,10 @@
|
|
1
|
-
class PasswordResetsController <
|
1
|
+
class PasswordResetsController < ReaderActionController
|
2
2
|
helper :reader
|
3
3
|
|
4
4
|
# rest gone mad! but it works, and keeps the processes well-defined.
|
5
5
|
|
6
|
-
no_login_required
|
6
|
+
no_login_required
|
7
|
+
skip_before_filter :require_reader
|
7
8
|
before_filter :get_reader, :only => [:edit, :update]
|
8
9
|
radiant_layout { |controller| Radiant::Config['reader.layout'] }
|
9
10
|
|
@@ -16,22 +17,20 @@ class PasswordResetsController < ApplicationController
|
|
16
17
|
if @reader
|
17
18
|
if @reader.activated?
|
18
19
|
@reader.send_password_reset_message
|
19
|
-
flash[:notice] = "reset_message_sent"
|
20
20
|
render
|
21
21
|
else
|
22
22
|
@reader.send_activation_message
|
23
|
-
flash[:notice] = "activation_message_sent"
|
24
23
|
redirect_to new_reader_activation_url
|
25
24
|
end
|
26
25
|
else
|
27
|
-
@error = flash[:error] = "email_unknown"
|
26
|
+
@error = flash[:error] = t("email_unknown")
|
28
27
|
render :action => :new
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
31
|
def edit
|
33
32
|
unless @reader
|
34
|
-
flash[:error] = 'reset_not_found'
|
33
|
+
flash[:error] = t('reset_not_found')
|
35
34
|
end
|
36
35
|
render
|
37
36
|
end
|
@@ -42,14 +41,14 @@ class PasswordResetsController < ApplicationController
|
|
42
41
|
@reader.password_confirmation = params[:reader][:password_confirmation]
|
43
42
|
if @reader.save
|
44
43
|
self.current_reader = @reader
|
45
|
-
flash[:notice] = 'password_updated_notice'
|
44
|
+
flash[:notice] = t('password_updated_notice')
|
46
45
|
redirect_to url_for(@reader)
|
47
46
|
else
|
48
|
-
flash[:error] = 'password_mismatch'
|
47
|
+
flash[:error] = t('password_mismatch')
|
49
48
|
render :action => :edit
|
50
49
|
end
|
51
50
|
else
|
52
|
-
flash[:error] = 'reset_not_found'
|
51
|
+
flash[:error] = t('reset_not_found')
|
53
52
|
render :action => :edit # without @reader, this will take us back to the enter-your-code form
|
54
53
|
end
|
55
54
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
class ReaderActionController < ApplicationController
|
2
|
+
include Radiant::Pagination::Controller
|
3
|
+
|
2
4
|
helper :reader
|
3
5
|
helper_method :current_site, :current_site=, :logged_in?, :logged_in_user?, :logged_in_admin?
|
6
|
+
|
7
|
+
attr_accessor :css, :js
|
8
|
+
helper_method :reader_css_paths, :reader_js_paths, :add_reader_js, :add_reader_css
|
4
9
|
|
5
10
|
no_login_required
|
6
11
|
before_filter :set_site_title
|
@@ -10,6 +15,31 @@ class ReaderActionController < ApplicationController
|
|
10
15
|
|
11
16
|
radiant_layout { |controller| Radiant::Config['reader.layout'] }
|
12
17
|
|
18
|
+
# allow reader-based extensions to contribute to the public interface
|
19
|
+
# these methods can be called from any view
|
20
|
+
|
21
|
+
def add_reader_css(path)
|
22
|
+
@css ||= []
|
23
|
+
@css << path
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_reader_js(path)
|
27
|
+
@js ||= []
|
28
|
+
@js << path
|
29
|
+
end
|
30
|
+
|
31
|
+
# these methods are called from :reader_css and :reader_js page parts defined in view/readers/_standard_parts
|
32
|
+
|
33
|
+
def reader_css_paths
|
34
|
+
@css ||= []
|
35
|
+
@css.uniq
|
36
|
+
end
|
37
|
+
|
38
|
+
def reader_js_paths
|
39
|
+
@js ||= []
|
40
|
+
@js.uniq
|
41
|
+
end
|
42
|
+
|
13
43
|
# authorisation helpers
|
14
44
|
|
15
45
|
def logged_in?
|
@@ -20,7 +20,7 @@ class ReaderActivationsController < ReaderActionController
|
|
20
20
|
if current_reader
|
21
21
|
@reader = current_reader
|
22
22
|
@reader.send_activation_message
|
23
|
-
flash[:notice] = "activation_message_sent"
|
23
|
+
flash[:notice] = t("activation_message_sent")
|
24
24
|
end
|
25
25
|
render :action => 'show'
|
26
26
|
end
|
@@ -29,11 +29,11 @@ class ReaderActivationsController < ReaderActionController
|
|
29
29
|
if @reader
|
30
30
|
@reader.activate!
|
31
31
|
self.current_reader = @reader
|
32
|
-
flash[:notice] = "thanks_activated"
|
32
|
+
flash[:notice] = t("thanks_activated")
|
33
33
|
redirect_back_or_to default_activated_url
|
34
34
|
else
|
35
|
-
@error = "please_check_message"
|
36
|
-
flash[:error] = "activation_failed
|
35
|
+
@error = t("please_check_message")
|
36
|
+
flash[:error] = t("activation_failed")
|
37
37
|
render :action => 'show'
|
38
38
|
end
|
39
39
|
end
|
@@ -1,19 +1,18 @@
|
|
1
1
|
class ReadersController < ReaderActionController
|
2
2
|
helper :reader
|
3
3
|
|
4
|
-
|
5
|
-
cattr_accessor :extended_form_partials
|
4
|
+
cattr_accessor :edit_partials, :show_partials, :index_partials
|
6
5
|
|
7
6
|
before_filter :check_registration_allowed, :only => [:new, :create]
|
8
|
-
before_filter :
|
9
|
-
before_filter :i_am_me, :only => [:show]
|
7
|
+
before_filter :initialize_partials
|
8
|
+
before_filter :i_am_me, :only => [:show, :edit]
|
10
9
|
before_filter :require_reader, :except => [:index, :new, :create, :activate]
|
11
10
|
before_filter :restrict_to_self, :only => [:edit, :update, :resend_activation]
|
12
11
|
before_filter :no_removing, :only => [:remove, :destroy]
|
13
12
|
before_filter :require_password, :only => [:update]
|
14
13
|
|
15
14
|
def index
|
16
|
-
@readers = Reader.paginate(:
|
15
|
+
@readers = Reader.all.paginate(pagination_parameters.merge(:per_page => 60))
|
17
16
|
end
|
18
17
|
|
19
18
|
def show
|
@@ -40,7 +39,7 @@ class ReadersController < ReaderActionController
|
|
40
39
|
end
|
41
40
|
@reader = Reader.new
|
42
41
|
session[:return_to] = request.referer
|
43
|
-
session[:email_field] = @
|
42
|
+
session[:email_field] = @reader.generate_email_field_name
|
44
43
|
end
|
45
44
|
|
46
45
|
def edit
|
@@ -87,7 +86,7 @@ class ReadersController < ReaderActionController
|
|
87
86
|
protected
|
88
87
|
|
89
88
|
def i_am_me
|
90
|
-
params[:id] = current_reader.id if params[:id] == 'me'
|
89
|
+
params[:id] = current_reader.id if current_reader && params[:id] == 'me'
|
91
90
|
end
|
92
91
|
|
93
92
|
def restrict_to_self
|
@@ -120,13 +119,26 @@ protected
|
|
120
119
|
end
|
121
120
|
end
|
122
121
|
|
123
|
-
def self.
|
124
|
-
|
122
|
+
def self.add_edit_partial(path)
|
123
|
+
@@edit_partials ||= []
|
124
|
+
edit_partials.push(path)
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.add_show_partial(path)
|
128
|
+
@@show_partials ||= []
|
129
|
+
show_partials.push(path)
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.add_index_partial(path)
|
133
|
+
@@index_partials ||= []
|
134
|
+
index_partials.push(path)
|
125
135
|
end
|
126
136
|
|
127
137
|
private
|
128
|
-
def
|
129
|
-
@
|
138
|
+
def initialize_partials
|
139
|
+
@show_partials = show_partials
|
140
|
+
@edit_partials = edit_partials
|
141
|
+
@index_partials = index_partials
|
130
142
|
end
|
131
143
|
|
132
144
|
end
|
@@ -1,10 +1,27 @@
|
|
1
1
|
require 'sanitize'
|
2
2
|
|
3
3
|
module ReaderHelper
|
4
|
-
def
|
4
|
+
def standard_gravatar_for(reader=nil, url=nil)
|
5
|
+
size = Radiant::Config['forum.gravatar_size'] || 40
|
6
|
+
url ||= reader_url(reader)
|
7
|
+
gravatar = gravatar_for(reader, {:size => size, :default => "#{request.protocol}#{request.host_with_port}/images/furniture/no_gravatar.png"}, {:class => 'gravatar offset', :width => size, :height => size})
|
8
|
+
link_to gravatar, url
|
9
|
+
end
|
10
|
+
|
11
|
+
def gravatar_for(reader=nil, gravatar_options={}, img_options ={})
|
5
12
|
size = gravatar_options[:size]
|
6
|
-
img_options[:size]
|
7
|
-
|
13
|
+
img_options[:size] ||= "#{size}x#{size}" if size
|
14
|
+
img_options[:alt] ||= reader.name if reader
|
15
|
+
if reader.nil? || reader.email.blank?
|
16
|
+
image_tag gravatar_options[:default], img_options
|
17
|
+
else
|
18
|
+
image_tag gravatar_url(reader.email, gravatar_options), img_options
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def home_page_link(options={})
|
23
|
+
home_page = Page.find_by_parent_id(nil)
|
24
|
+
link_to home_page.title, home_page.url, options
|
8
25
|
end
|
9
26
|
|
10
27
|
def clean_textilize(text)
|
@@ -28,4 +45,32 @@ module ReaderHelper
|
|
28
45
|
def truncate_and_textilize(text, length=64)
|
29
46
|
clean_textilize( truncate_words(text, length) )
|
30
47
|
end
|
48
|
+
|
49
|
+
def pagination_and_summary_for(list, name='')
|
50
|
+
%{<div class="pagination">
|
51
|
+
#{will_paginate list, :container => false}
|
52
|
+
<span class="pagination_summary">
|
53
|
+
#{pagination_summary(list, name)}
|
54
|
+
</span>
|
55
|
+
</div>
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
def pagination_summary(list, name='')
|
60
|
+
total = list.total_entries
|
61
|
+
if list.empty?
|
62
|
+
%{#{t('no')} #{name.pluralize}}
|
63
|
+
else
|
64
|
+
name ||= t(list.first.class.to_s.underscore.gsub('_', ' '))
|
65
|
+
if total == 1
|
66
|
+
%{#{t('showing')} #{t('one')} #{name}}
|
67
|
+
elsif list.current_page == 1 && total < list.per_page
|
68
|
+
%{#{t('all')} #{total} #{name.pluralize}}
|
69
|
+
else
|
70
|
+
start = list.offset + 1
|
71
|
+
finish = ((list.offset + list.per_page) < list.total_entries) ? list.offset + list.per_page : list.total_entries
|
72
|
+
%{#{start} #{t('to')} #{finish} #{t('of')} #{total} #{name.pluralize}}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
31
76
|
end
|
data/app/models/reader.rb
CHANGED
@@ -24,7 +24,8 @@ class Reader < ActiveRecord::Base
|
|
24
24
|
has_many :messages, :through => :message_readers
|
25
25
|
|
26
26
|
attr_accessor :current_password # used for authentication on update
|
27
|
-
|
27
|
+
attr_accessor :email_field # used in blocking spam registrations
|
28
|
+
|
28
29
|
before_save :set_login
|
29
30
|
before_update :update_user
|
30
31
|
|
@@ -39,6 +40,7 @@ class Reader < ActiveRecord::Base
|
|
39
40
|
named_scope :any
|
40
41
|
named_scope :active, :conditions => "activated_at IS NOT NULL"
|
41
42
|
named_scope :inactive, :conditions => "activated_at IS NULL"
|
43
|
+
named_scope :imported, :conditions => "old_id IS NOT NULL"
|
42
44
|
named_scope :except, lambda { |readers|
|
43
45
|
readers = [readers].flatten
|
44
46
|
{ :conditions => ["NOT readers.id IN (#{readers.map{"?"}.join(',')})", readers.map(&:id)] }
|
@@ -79,21 +81,21 @@ class Reader < ActiveRecord::Base
|
|
79
81
|
message.deliver_to(self)
|
80
82
|
end
|
81
83
|
|
82
|
-
def generate_email_field_name
|
83
|
-
generate_password(32)
|
84
|
-
end
|
85
|
-
|
86
84
|
def generate_password(length=12)
|
87
85
|
chars = ("a".."z").to_a + ("A".."Z").to_a + ("1".."9").to_a
|
88
86
|
Array.new(length, '').collect{chars[rand(chars.size)]}.join
|
89
87
|
end
|
90
88
|
|
89
|
+
def generate_email_field_name
|
90
|
+
self.email_field = generate_password(32)
|
91
|
+
end
|
92
|
+
|
91
93
|
def is_user?
|
92
|
-
self.user
|
94
|
+
!!self.user
|
93
95
|
end
|
94
96
|
|
95
97
|
def is_admin?
|
96
|
-
|
98
|
+
is_user? && self.user.admin?
|
97
99
|
end
|
98
100
|
|
99
101
|
def self.find_or_create_for_user(user)
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
2
|
-
- if @reader
|
3
|
-
|
4
|
-
%p
|
5
|
-
%strong
|
6
|
-
= t('hello')
|
7
|
-
= @reader.name + '.'
|
8
|
-
= t('new_password_instructions')
|
1
|
+
- render :partial => 'readers/standard_parts'
|
9
2
|
|
3
|
+
- content_for :form do
|
4
|
+
- if @reader
|
10
5
|
- form_for @reader, :url => password_reset_path, :method => :put, :html => {:class => 'friendly', :autocomplete => "off"} do |f|
|
11
6
|
|
12
7
|
- if @reader.errors.any?
|
@@ -20,28 +15,20 @@
|
|
20
15
|
|
21
16
|
%p
|
22
17
|
= f.label :password, t('new_password'), :class => 'required'
|
23
|
-
%span.formnote= t('password_notes')
|
24
18
|
%br
|
25
19
|
= f.password_field :password, :class => 'titular'
|
26
20
|
|
27
21
|
%p
|
28
|
-
= f.label :password_confirmation, t('
|
22
|
+
= f.label :password_confirmation, t('confirm_password'), :class => 'required'
|
29
23
|
%br
|
30
24
|
= f.password_field :password_confirmation, :class => 'titular'
|
31
25
|
%p
|
32
|
-
= f.submit
|
26
|
+
= f.submit t('set_new_password')
|
33
27
|
|
34
28
|
%p
|
35
|
-
= t('password_not_yet_changed')
|
36
|
-
|
37
|
-
- content_for :title do
|
38
|
-
= t('change_password')
|
29
|
+
= t('password_not_yet_changed', :url => reader_login_url)
|
39
30
|
|
40
31
|
- else
|
41
|
-
|
42
|
-
%p.errornote
|
43
|
-
= t('sorry_reset_not_found')
|
44
|
-
|
45
32
|
- form_tag edit_password_reset_path, :method => 'GET', :class => 'friendly', :autocomplete => "off" do
|
46
33
|
= hidden_field_tag :id, params[:id]
|
47
34
|
%p
|
@@ -57,11 +44,27 @@
|
|
57
44
|
%li
|
58
45
|
= link_to t("restart_password_change"), new_password_reset_url
|
59
46
|
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
- content_for :title do
|
48
|
+
- if @reader
|
49
|
+
= t('change_password')
|
50
|
+
- else
|
51
|
+
= t('enter_code')
|
52
|
+
|
53
|
+
- content_for :introduction do
|
54
|
+
- if @reader
|
55
|
+
%p
|
56
|
+
%strong
|
57
|
+
= t('hello').titlecase
|
58
|
+
= @reader.name + '!'
|
59
|
+
= t('new_password_instructions')
|
60
|
+
- else
|
61
|
+
%p.errornote
|
62
|
+
= t('sorry_reset_not_found')
|
63
|
+
|
64
|
+
|
63
65
|
- content_for :breadcrumbs do
|
64
66
|
= link_to t('home').titlecase, '/'
|
65
67
|
>
|
66
68
|
= t('reset_password')
|
67
69
|
|
70
|
+
= yield :form
|
@@ -1,36 +1,36 @@
|
|
1
|
-
|
2
|
-
= render :partial => 'readers/flasher'
|
1
|
+
= render :partial => 'readers/standard_parts'
|
3
2
|
|
4
|
-
-
|
5
|
-
|
6
|
-
= t('reader_logged_in_as')
|
7
|
-
%strong
|
8
|
-
= current_reader.name
|
9
|
-
- unless current_reader.activated?
|
10
|
-
= t('but_not_active')
|
11
|
-
|
12
|
-
- if current_reader.activated?
|
13
|
-
%p
|
14
|
-
=t('if_not_you')
|
15
|
-
= link_to t("log_out"), reader_logout_url
|
16
|
-
- else
|
3
|
+
- content_for :login do
|
4
|
+
- if current_reader
|
17
5
|
%p
|
18
|
-
=t('
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
6
|
+
= t('reader_logged_in_as')
|
7
|
+
%strong
|
8
|
+
= current_reader.name
|
9
|
+
- unless current_reader.activated?
|
10
|
+
= t('but_not_active')
|
11
|
+
|
12
|
+
- if current_reader.activated?
|
13
|
+
%p
|
14
|
+
=t('if_not_you')
|
15
|
+
= link_to t("log_out"), reader_logout_url
|
16
|
+
- else
|
17
|
+
%p
|
18
|
+
=t('if_cant_find')
|
19
|
+
= link_to(t("send_it_again"), new_reader_activation_url) + '.'
|
20
|
+
%p
|
21
|
+
=t('if_not_you')
|
22
|
+
=t('or')
|
23
|
+
=t('wrong_email')
|
24
|
+
=t('please')
|
25
|
+
= link_to "log out", reader_logout_url
|
26
|
+
=t('and_try_again')
|
27
27
|
|
28
|
-
- else
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
- else
|
29
|
+
- if @message
|
30
|
+
%p
|
31
|
+
= @message
|
32
32
|
|
33
|
-
|
33
|
+
= render :partial => 'login_form', :locals => {:no_title => true}
|
34
34
|
|
35
35
|
- content_for :breadcrumbs do
|
36
36
|
= link_to t('home').titlecase, '/'
|
@@ -39,3 +39,7 @@
|
|
39
39
|
|
40
40
|
- content_for :title do
|
41
41
|
= t('please_log_in').titlecase
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
= yield :login
|
@@ -1,66 +1,96 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
- reader ||= @reader
|
2
|
+
- check_password ||= false
|
3
|
+
|
4
|
+
- form_for :reader, reader, :html => { :method => "put", :class => 'friendly'} do |f|
|
5
|
+
- unless @reader.errors.empty?
|
6
|
+
%p.errornote
|
7
|
+
%strong
|
8
|
+
= t('sorry').titlecase
|
9
|
+
= t('form_problem') + '.'
|
10
|
+
- else
|
11
|
+
%p
|
12
|
+
= t('bold_required')
|
6
13
|
|
7
|
-
- if Radiant::Config['reader.use_honorifics?']
|
8
14
|
%p
|
9
|
-
= f.label :
|
10
|
-
%span.formnote= t('
|
15
|
+
= f.label :name, t('your_name'), :class => 'required'
|
16
|
+
%span.formnote= t('name_notes')
|
11
17
|
%br
|
12
|
-
= f.text_field :
|
18
|
+
= f.text_field :name, :class => 'standard'
|
13
19
|
|
14
|
-
- if
|
20
|
+
- if Radiant::Config['reader.use_honorifics?']
|
21
|
+
%p
|
22
|
+
= f.label :honorific, t(:honorific), :class => 'optional'
|
23
|
+
%span.formnote= t('honorific_notes')
|
24
|
+
%br
|
25
|
+
= f.text_field :honorific, :class => 'standard'
|
15
26
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
27
|
+
- if reader.new_record? && reader.email_field
|
28
|
+
%p
|
29
|
+
= f.label reader.email_field, t('label.reader.email'), :class => 'required'
|
30
|
+
%span.formnote= t('email_notes')
|
31
|
+
%br
|
32
|
+
= text_field_tag reader.email_field, params[reader.email_field] || reader.email, :id => "reader_#{reader.email_field}", :class => 'standard'
|
33
|
+
.innocuous
|
34
|
+
%p
|
35
|
+
=f.label :email, t("dont_fill"), :class => 'required'
|
36
|
+
%br
|
37
|
+
= f.text_field :email, :class => 'standard'
|
38
|
+
%span.formnote= t('spam_trap')
|
21
39
|
|
22
|
-
|
40
|
+
- else
|
23
41
|
%p
|
24
|
-
=f.label :email, t(
|
25
|
-
%span.formnote= t('spam_trap')
|
42
|
+
= f.label :email, t('your_email'), :class => 'required'
|
26
43
|
%br
|
27
44
|
= f.text_field :email, :class => 'standard'
|
45
|
+
%span.formnote= t('email_notes')
|
28
46
|
|
29
|
-
- else
|
30
47
|
%p
|
31
|
-
= f.label :
|
32
|
-
%span.formnote= t('email_notes')
|
48
|
+
= f.label :login, t('login_name'), :class => 'optional'
|
33
49
|
%br
|
34
|
-
= f.text_field :
|
50
|
+
= f.text_field :login, :class => 'standard'
|
51
|
+
%span.formnote= t('login_notes')
|
35
52
|
|
36
|
-
- if
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
53
|
+
- if reader.new_record?
|
54
|
+
%p
|
55
|
+
= f.label :password, t('password'), :class => 'required'
|
56
|
+
%br
|
57
|
+
= f.password_field :password, :class => 'standard', :autocomplete => 'off'
|
58
|
+
%span.formnote= t('password_notes')
|
42
59
|
|
43
|
-
%p
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
= f.text_field :login, :class => 'standard'
|
60
|
+
%p
|
61
|
+
= f.label :password_confirmation, t('confirm_password'), :class => 'required'
|
62
|
+
%br
|
63
|
+
= f.password_field :password_confirmation, :class => 'standard', :autocomplete => 'off'
|
48
64
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
65
|
+
- else
|
66
|
+
.display_password
|
67
|
+
%p
|
68
|
+
= f.label :password, t('password').titlecase, :class => 'optional'
|
69
|
+
%span.password
|
70
|
+
•••••
|
71
|
+
= link_to t('change_password'), '#', :class => 'toggle', :rel => ".display_password, .new_password"
|
72
|
+
.new_password.hidden
|
73
|
+
%p
|
74
|
+
= f.label :password, t('new_password'), :class => 'required'
|
75
|
+
%br
|
76
|
+
= f.password_field :password, :class => 'standard', :autocomplete => 'off'
|
77
|
+
%span.formnote= t('new_password_notes')
|
78
|
+
%p
|
79
|
+
= f.label :password_confirmation, t('confirm_new_password'), :class => 'required'
|
80
|
+
%br
|
81
|
+
= f.password_field :password_confirmation, :class => 'standard', :autocomplete => 'off'
|
82
|
+
|
83
|
+
- if Radiant::Config['reader.use_description?']
|
84
|
+
%p
|
85
|
+
= f.label :description, t('your_description'), :class => 'optional'
|
86
|
+
%br
|
87
|
+
= f.text_area :description, :class => 'standard', :rows => 8
|
88
|
+
%span.formnote= t('description_notes')
|
56
89
|
|
57
|
-
|
58
|
-
|
59
|
-
- cssclass = @reader.new_record? ? 'required' : 'optional'
|
60
|
-
= f.label :password_confirmation, label, :class => cssclass
|
61
|
-
%span.formnote= t('existing_password_notes')
|
62
|
-
%br
|
63
|
-
= f.password_field :password_confirmation, :class => 'standard', :autocomplete => 'off'
|
90
|
+
- @edit_partials.each do |partial|
|
91
|
+
= render :partial => partial, :locals => {:reader => @reader}
|
64
92
|
|
65
|
-
|
66
|
-
|
93
|
+
%p
|
94
|
+
= submit_tag reader.new_record? ? t('create_account') : t("update_account")
|
95
|
+
or
|
96
|
+
= link_to 'cancel', request.referer
|
@@ -0,0 +1,33 @@
|
|
1
|
+
- add_reader_js '/javascripts/reader.js'
|
2
|
+
- add_reader_css '/stylesheets/reader.css'
|
3
|
+
|
4
|
+
- content_for :section_navigation do
|
5
|
+
= link_to t('navigation.readers'), readers_url, :class => 'section'
|
6
|
+
- if current_reader
|
7
|
+
= link_to t('navigation.profile'), reader_profile_url
|
8
|
+
= link_to t('navigation.preferences'), reader_account_url
|
9
|
+
- unless current_reader.activated?
|
10
|
+
= link_to t('navigation.activate'), new_reader_activation_url
|
11
|
+
= link_to t('navigation.logout'), reader_logout_url
|
12
|
+
- else
|
13
|
+
= link_to t('log_in'), reader_login_url
|
14
|
+
- if Radiant::Config['reader.help_url']
|
15
|
+
= link_to t('navigation.reader_help'), Radiant::Config['reader.help_url']
|
16
|
+
|
17
|
+
- content_for :controls do
|
18
|
+
= render :partial => 'readers/controls'
|
19
|
+
|
20
|
+
- content_for :signals do
|
21
|
+
= render :partial => 'readers/flasher'
|
22
|
+
|
23
|
+
- content_for :reader_css do
|
24
|
+
- reader_css_paths.each do |path|
|
25
|
+
%link{:rel => 'stylesheet', :href => path, :type => 'text/css'}
|
26
|
+
|
27
|
+
- content_for :reader_js do
|
28
|
+
- reader_js_paths.each do |path|
|
29
|
+
%script{:src => path, :type => 'text/javascript'}
|
30
|
+
|
31
|
+
- content_for :person do
|
32
|
+
- if @reader
|
33
|
+
= standard_gravatar_for(@reader)
|
@@ -1,37 +1,15 @@
|
|
1
|
-
= render :partial => '
|
1
|
+
= render :partial => 'readers/standard_parts'
|
2
2
|
|
3
|
-
|
3
|
+
- content_for :introduction do
|
4
4
|
%p
|
5
|
-
= t("hello")
|
5
|
+
= t("hello").titlecase
|
6
6
|
= link_to(@reader.name, reader_url(@reader)) + '.'
|
7
7
|
= t('preferences_intro')
|
8
|
-
= t('enter_own_password')
|
9
|
-
|
10
|
-
- unless @reader.errors.empty?
|
11
|
-
%p.errornote
|
12
|
-
%strong
|
13
|
-
= t('sorry').titlecase
|
14
|
-
= t('form_problem') + '.'
|
15
|
-
|
16
|
-
- form_for :reader, :url => reader_url(@reader), :html => { :method => "put", :class => 'friendly'} do |f|
|
17
|
-
|
18
|
-
%p
|
19
|
-
= f.label :current_password, "Current password", :class => 'required'
|
20
|
-
%span.formnote
|
21
|
-
= link_to t('forgotten_password'), new_password_reset_url
|
22
|
-
= f.password_field :current_password, :class => 'standard', :autocomplete => 'off'
|
23
|
-
|
24
|
-
%p
|
25
|
-
= t('bold_required')
|
26
|
-
|
27
|
-
= render :partial => 'form', :locals => {:f => f}
|
28
|
-
%p
|
29
|
-
= submit_tag "Update your account"
|
30
|
-
or
|
31
|
-
= link_to 'cancel', request.referer
|
32
8
|
|
9
|
+
- content_for :form do
|
10
|
+
= render :partial => 'form', :locals => {:reader => @reader}
|
33
11
|
%p
|
34
|
-
=
|
12
|
+
= standard_gravatar_for(@reader, 'http://gravatar.com/site/login')
|
35
13
|
= link_to t('change_gravatar'), "http://gravatar.com/site/login/"
|
36
14
|
|
37
15
|
- content_for :breadcrumbs do
|
@@ -42,4 +20,8 @@
|
|
42
20
|
= t('account_settings')
|
43
21
|
|
44
22
|
- content_for :title do
|
45
|
-
= t('
|
23
|
+
= t('account_settings')
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
= yield :form
|
@@ -1,9 +1,29 @@
|
|
1
|
-
= render :partial => '
|
1
|
+
= render :partial => 'readers/standard_parts'
|
2
2
|
|
3
|
-
|
3
|
+
- content_for :introduction do
|
4
|
+
=t('readers_introduction')
|
5
|
+
|
6
|
+
- content_for :list do
|
4
7
|
#readers
|
5
|
-
- @readers.
|
6
|
-
|
8
|
+
- if @readers.size > 1
|
9
|
+
- columns = [@readers[0..@readers.size/2], @readers[@readers.size/2+1..@readers.size]]
|
10
|
+
- else
|
11
|
+
- columns = [@readers]
|
12
|
+
- columns.each do |readers|
|
13
|
+
%div.column
|
14
|
+
- readers.each do |reader|
|
15
|
+
.reader
|
16
|
+
%h2
|
17
|
+
= link_to standard_gravatar_for(reader), reader_url(reader), {:title => reader.name}
|
18
|
+
= link_to reader.name, reader_url(reader)
|
19
|
+
%p.context
|
20
|
+
= t("joined_on")
|
21
|
+
= l(reader.created_at, :format => :date) + '.'
|
22
|
+
- @index_partials.each do |partial|
|
23
|
+
= render :partial => partial, :locals => {:reader => reader}
|
24
|
+
|
25
|
+
- content_for :pagination do
|
26
|
+
= pagination_and_summary_for(@readers, t('person'))
|
7
27
|
|
8
28
|
- content_for :breadcrumbs do
|
9
29
|
= link_to t('home').titlecase, '/'
|
@@ -12,3 +32,8 @@
|
|
12
32
|
|
13
33
|
- content_for :title do
|
14
34
|
= t('people').titlecase
|
35
|
+
|
36
|
+
|
37
|
+
= yield :pagination if @readers.previous_page
|
38
|
+
= yield :list
|
39
|
+
= yield :pagination if @readers.next_page
|
@@ -1,27 +1,20 @@
|
|
1
|
-
= render :partial => '
|
1
|
+
= render :partial => 'readers/standard_parts'
|
2
2
|
|
3
|
-
|
3
|
+
- content_for :person do
|
4
|
+
= standard_gravatar_for(@reader)
|
5
|
+
|
6
|
+
- content_for :introduction do
|
4
7
|
%p
|
5
8
|
= t('please_register')
|
6
9
|
= t('already_registered')
|
7
10
|
= link_to t('log_in') + '.', reader_login_url
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
%strong
|
12
|
-
= t('sorry').titlecase
|
13
|
-
= t('form_problem') + '.'
|
14
|
-
|
15
|
-
- form_for :reader, :url => readers_url, :html => {:class => 'friendly'} do |f|
|
16
|
-
= render :partial => 'form', :locals => {:f => f}
|
17
|
-
%p
|
18
|
-
= submit_tag t("register")
|
19
|
-
or
|
20
|
-
= link_to t('cancel'), request.referer
|
12
|
+
- content_for :form do
|
13
|
+
= render :partial => 'form', :locals => {:f => f}
|
21
14
|
|
15
|
+
- content_for :notes do
|
22
16
|
%h3
|
23
17
|
= t('notes').titlecase
|
24
|
-
|
25
18
|
%ul.friendly
|
26
19
|
%li
|
27
20
|
= t('confirming_email')
|
@@ -40,3 +33,8 @@
|
|
40
33
|
|
41
34
|
- content_for :title do
|
42
35
|
= t('new_account').titlecase
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
= yield :form
|
40
|
+
= yield :notes
|
@@ -1,38 +1,27 @@
|
|
1
|
-
= render :partial => '
|
2
|
-
|
3
|
-
%div.reader_show
|
4
|
-
- if @reader == current_reader
|
5
|
-
%p.system_message
|
6
|
-
%strong
|
7
|
-
=t('hello').titlecase
|
8
|
-
= @reader.name + '.'
|
9
|
-
= t('this_is_your_page')
|
10
|
-
%ul.actions
|
11
|
-
%li
|
12
|
-
= link_to t('edit_profile'), edit_reader_url(@reader)
|
13
|
-
%li
|
14
|
-
= link_to t('change_gravatar'), "http://gravatar.com/site/login/"
|
15
|
-
|
16
|
-
= gravatar_for(@reader, {:size => 128}, {:class => 'big_gravatar'})
|
1
|
+
= render :partial => 'readers/standard_parts'
|
17
2
|
|
3
|
+
- content_for :description do
|
18
4
|
- if @reader.description.blank?
|
19
5
|
%p
|
20
|
-
|
6
|
+
= t('no_description')
|
21
7
|
- else
|
22
8
|
= clean_textilize @reader.description
|
23
9
|
|
24
|
-
|
25
|
-
|
10
|
+
- @show_partials.each do |partial|
|
11
|
+
= render :partial => partial, :locals => {:reader => @reader}
|
12
|
+
|
26
13
|
- content_for :breadhead do
|
27
|
-
= link_to t('
|
14
|
+
= link_to t('readers').titlecase + t('separator'), readers_url
|
15
|
+
= yield :parent
|
28
16
|
|
29
|
-
- content_for :
|
30
|
-
= link_to t('home').titlecase, '/'
|
31
|
-
>
|
32
|
-
= link_to t('people').titlecase, '/readers'
|
33
|
-
>
|
17
|
+
- content_for :title do
|
34
18
|
= @reader.name
|
35
19
|
|
36
|
-
- content_for :
|
37
|
-
=
|
20
|
+
- content_for :breadcrumbs do
|
21
|
+
= yield :breadhead
|
22
|
+
= t('separator')
|
23
|
+
= yield :title
|
24
|
+
|
25
|
+
|
38
26
|
|
27
|
+
= yield :description
|
data/config/locales/en.yml
CHANGED
@@ -17,8 +17,8 @@ en:
|
|
17
17
|
cancel: "cancel"
|
18
18
|
cannot_delete_readers: "To delete readers, please log in as an administrator"
|
19
19
|
cannot_edit_others: "You are not allowed to edit other people's accounts."
|
20
|
-
change_gravatar: "change
|
21
|
-
change_password: "Change
|
20
|
+
change_gravatar: "change gravatar image"
|
21
|
+
change_password: "Change your password"
|
22
22
|
config:
|
23
23
|
reader:
|
24
24
|
allow_registration?: "Allow registration"
|
@@ -56,6 +56,16 @@ en:
|
|
56
56
|
if_cant_find: "If you can't find the message, we can"
|
57
57
|
if_mistake_see_admin: "If this is a mistake, please talk to the site administrator about your account."
|
58
58
|
is_free_and_quick: " is free and only takes a moment"
|
59
|
+
joined_on: "Joined on"
|
60
|
+
label:
|
61
|
+
reader:
|
62
|
+
name: "Your name"
|
63
|
+
honorific: "Title"
|
64
|
+
login: "Login username"
|
65
|
+
email: "Email address"
|
66
|
+
password: "Password"
|
67
|
+
repeat_password: "Confirm password"
|
68
|
+
current_password: "Current password"
|
59
69
|
log_in: 'log in'
|
60
70
|
log_out: "log out"
|
61
71
|
login_name: "Login name"
|
@@ -64,6 +74,13 @@ en:
|
|
64
74
|
logout_message: "You are logged out. Bye!"
|
65
75
|
must_be_empty: "must be empty"
|
66
76
|
name_notes: "as you would like it to appear on the site"
|
77
|
+
navigation:
|
78
|
+
activate: "Activate account"
|
79
|
+
readers: "People"
|
80
|
+
preferences: "Preferences"
|
81
|
+
profile: "Your profile"
|
82
|
+
login: "Log in"
|
83
|
+
logout: "Log out"
|
67
84
|
new_account: "Register"
|
68
85
|
new_password: "New password"
|
69
86
|
new_password_instructions: "Please enter and confirm the new password you would like to use. It must be at least four characters long, nothing obvious or typical and ideally a mixture of numbers and letters."
|
@@ -74,7 +91,7 @@ en:
|
|
74
91
|
password: "password"
|
75
92
|
password_incorrect: "Sorry. Wrong password."
|
76
93
|
password_mismatch: "Passwords don't match! Please try again."
|
77
|
-
password_not_yet_changed: "Your password hasn't changed yet, so if you've just remembered it
|
94
|
+
password_not_yet_changed: "Your password hasn't changed yet, so if you've just remembered it please <a href='%{url}'>log in as usual</a>."
|
78
95
|
password_notes: "at least four characters, please"
|
79
96
|
password_reset_instructions: "Please enter your email address below. If we recognise it, we'll send you a message with a confirmation link (or if your account is not yet active, we'll send the activation message again)."
|
80
97
|
password_reset_reassurance: "Your password will not change until you fill in that form, so only you can complete this process."
|
@@ -95,14 +112,14 @@ en:
|
|
95
112
|
reader: 'Reader'
|
96
113
|
reader_logged_in_as: "You are logged in as %{name}."
|
97
114
|
reader_saved: "Reader saved"
|
98
|
-
readers: '
|
115
|
+
readers: 'People'
|
99
116
|
register: "register"
|
100
117
|
registration: "registration"
|
101
118
|
registration_disallowed: "Sorry. This site does not allow visitors to register"
|
102
119
|
remember_me: "remember me"
|
103
120
|
resend_activation: "resent activation messages"
|
104
121
|
reset_message_instructions: "Thank you. A message has been sent containing the instructions for setting a new password. Remember it hasn't changed yet and won't until you follow the instructions in the message. If you remember your old password, you can just carry on using it and ignore the reset message."
|
105
|
-
reset_message_sent: "Password-reset instructions have been emailed to you
|
122
|
+
reset_message_sent: "Password-reset instructions have been emailed to you"
|
106
123
|
reset_not_found: "Password-reset code not found"
|
107
124
|
sorry_reset_not_found: "Sorry: the system can't find you. That link must have been garbled somewhere along the line. Please paste the 20-character confirmation code into the box below and we'll try again."
|
108
125
|
reset_password: "Reset your password"
|
@@ -110,6 +127,7 @@ en:
|
|
110
127
|
return_to_page: "return to the page you were looking at before you started registering"
|
111
128
|
send_it_again: "send it again"
|
112
129
|
send_reset_button: "send me instructions"
|
130
|
+
set_new_password: "set new password"
|
113
131
|
sorry: "sorry"
|
114
132
|
sorry_access_denied: "Sorry: access denied"
|
115
133
|
spam_trap: "it's a spam trap and shouldn't be visible"
|
@@ -117,6 +135,9 @@ en:
|
|
117
135
|
thanks_activated: "Thank you! Your account has been activated."
|
118
136
|
thanks_and_activation_instructions: "Thank you for registering. Now please check your email. We have sent a message containing a link that will automatically activate your account and log you in."
|
119
137
|
this_is_your_page: "This is the page that other (logged-in) site visitors will see when they click on your name."
|
138
|
+
time:
|
139
|
+
formats:
|
140
|
+
date: "%B %e, %Y"
|
120
141
|
username: "username"
|
121
142
|
welcome_back: "Welcome back"
|
122
143
|
welcome_message: "Welcome message"
|
@@ -149,4 +170,6 @@ en:
|
|
149
170
|
never_sent: 'never sent'
|
150
171
|
for: 'for'
|
151
172
|
home: 'home'
|
152
|
-
reader_required: "Sorry: this part of the site requires an account."
|
173
|
+
reader_required: "Sorry: this part of the site requires an account."
|
174
|
+
update_account: "Save changes"
|
175
|
+
create_account: "Register"
|
data/config/routes.rb
CHANGED
@@ -15,8 +15,11 @@ ActionController::Routing::Routes.draw do |map|
|
|
15
15
|
map.resource :password_reset
|
16
16
|
|
17
17
|
map.activate_me '/activate/:id/:activation_code', :controller => 'reader_activations', :action => 'update'
|
18
|
+
map.repassword_me 'repassword/:id/:confirmation_code', :controller => 'password_resets', :action => 'edit'
|
18
19
|
map.reader_register '/register', :controller => 'readers', :action => 'new'
|
19
20
|
map.reader_login '/login', :controller => 'reader_sessions', :action => 'new'
|
21
|
+
map.reader_account '/account', :controller => 'readers', :action => 'edit'
|
22
|
+
map.reader_profile '/profile', :controller => 'readers', :action => 'show'
|
20
23
|
map.reader_logout '/logout', :controller => 'reader_sessions', :action => 'destroy'
|
21
24
|
map.reader_permission_denied '/permission_denied', :controller => 'readers', :action => 'permission_denied'
|
22
25
|
end
|
data/lib/reader_tags.rb
CHANGED
@@ -96,7 +96,7 @@ module ReaderTags
|
|
96
96
|
<pre><code><r:recipient:repassword_url /></code></pre>
|
97
97
|
}
|
98
98
|
tag "recipient:repassword_url" do |tag|
|
99
|
-
|
99
|
+
repassword_me_url(tag.locals.recipient, :confirmation_code => tag.locals.recipient.perishable_token, :host => @mailer_vars[:@host])
|
100
100
|
end
|
101
101
|
|
102
102
|
desc %{
|
@@ -0,0 +1,19 @@
|
|
1
|
+
(function($) {
|
2
|
+
|
3
|
+
$.fn.toggler = function() {
|
4
|
+
this.each(function() {
|
5
|
+
var self = $(this);
|
6
|
+
var toggling = $(self.attr.rel);
|
7
|
+
self.click( function (event) {
|
8
|
+
event.preventDefault();
|
9
|
+
toggling.toggle();
|
10
|
+
});
|
11
|
+
});
|
12
|
+
return this;
|
13
|
+
};
|
14
|
+
|
15
|
+
})(jQuery);
|
16
|
+
|
17
|
+
$(function() {
|
18
|
+
$("a.toggle").toggler();
|
19
|
+
});
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{radiant-reader-extension}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["spanner"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-27}
|
13
13
|
s.description = %q{Centralises reader/member/user registration and management tasks for the benefit of other extensions}
|
14
14
|
s.email = %q{will@spanner.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -70,6 +70,7 @@ Gem::Specification.new do |s|
|
|
70
70
|
"app/views/readers/_extra_controls.html.haml",
|
71
71
|
"app/views/readers/_flasher.html.haml",
|
72
72
|
"app/views/readers/_form.html.haml",
|
73
|
+
"app/views/readers/_standard_parts.html.haml",
|
73
74
|
"app/views/readers/edit.html.haml",
|
74
75
|
"app/views/readers/index.html.haml",
|
75
76
|
"app/views/readers/login.html.haml",
|
@@ -107,6 +108,7 @@ Gem::Specification.new do |s|
|
|
107
108
|
"public/images/admin/chk_off.png",
|
108
109
|
"public/images/admin/chk_on.png",
|
109
110
|
"public/images/admin/delta.png",
|
111
|
+
"public/javascripts/reader.js",
|
110
112
|
"public/stylesheets/sass/_reader_constants.sass",
|
111
113
|
"public/stylesheets/sass/admin/reader.sass",
|
112
114
|
"public/stylesheets/sass/reader.sass",
|
data/reader_extension.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-reader-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- spanner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-27 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- app/views/readers/_extra_controls.html.haml
|
154
154
|
- app/views/readers/_flasher.html.haml
|
155
155
|
- app/views/readers/_form.html.haml
|
156
|
+
- app/views/readers/_standard_parts.html.haml
|
156
157
|
- app/views/readers/edit.html.haml
|
157
158
|
- app/views/readers/index.html.haml
|
158
159
|
- app/views/readers/login.html.haml
|
@@ -190,6 +191,7 @@ files:
|
|
190
191
|
- public/images/admin/chk_off.png
|
191
192
|
- public/images/admin/chk_on.png
|
192
193
|
- public/images/admin/delta.png
|
194
|
+
- public/javascripts/reader.js
|
193
195
|
- public/stylesheets/sass/_reader_constants.sass
|
194
196
|
- public/stylesheets/sass/admin/reader.sass
|
195
197
|
- public/stylesheets/sass/reader.sass
|