radiant-reader-extension 1.3.4 → 1.3.6

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/README.md CHANGED
@@ -17,6 +17,7 @@ Right now we are **not compatible with multi_site or the sites extension**: that
17
17
  * public interface internationalized;
18
18
  * Uses the new configuration interface;
19
19
  * Messaging much simplified and now intended to be purely administrative.
20
+ * ajaxable status panel returned by `reader_session_url`
20
21
 
21
22
  ## Status
22
23
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.4
1
+ 1.3.6
@@ -4,6 +4,24 @@ class ReaderSessionsController < ReaderActionController
4
4
  before_filter :require_reader, :only => :destroy
5
5
  radiant_layout { |controller| Radiant::Config['reader.layout'] }
6
6
 
7
+ def show
8
+ @reader = current_reader
9
+ respond_to do |format|
10
+ format.html {
11
+ if !@reader
12
+ redirect_to reader_login_url
13
+ elsif @reader.inactive?
14
+ redirect_to reader_activation_url
15
+ else
16
+ redirect_to reader_profile_url
17
+ end
18
+ }
19
+ format.js {
20
+ render :partial => 'readers/controls', :layout => false
21
+ }
22
+ end
23
+ end
24
+
7
25
  def new
8
26
  if current_reader
9
27
  if current_reader.activated?
@@ -32,7 +50,7 @@ class ReaderSessionsController < ReaderActionController
32
50
  redirect_back_or_to default_loggedin_url
33
51
  }
34
52
  format.js {
35
- redirect_back_with_format(:js)
53
+ redirect_back_with_format(:js)
36
54
  }
37
55
  end
38
56
 
@@ -42,7 +60,9 @@ class ReaderSessionsController < ReaderActionController
42
60
  flash[:error] = t('login_unknown')
43
61
  render :action => :new
44
62
  }
45
- format.js { render :action => :new, :layout => false }
63
+ format.js {
64
+ render :action => :new, :layout => false
65
+ }
46
66
  end
47
67
  end
48
68
  end
@@ -6,7 +6,7 @@ class ReadersController < ReaderActionController
6
6
  before_filter :check_registration_allowed, :only => [:new, :create]
7
7
  before_filter :initialize_partials
8
8
  before_filter :i_am_me, :only => [:show, :edit]
9
- before_filter :require_reader, :except => [:index, :new, :create, :activate]
9
+ before_filter :require_reader, :except => [:new, :create, :activate]
10
10
  before_filter :restrict_to_self, :only => [:edit, :update, :resend_activation]
11
11
  before_filter :no_removing, :only => [:remove, :destroy]
12
12
  before_filter :require_password, :only => [:update]
@@ -17,19 +17,6 @@ class ReadersController < ReaderActionController
17
17
 
18
18
  def show
19
19
  @reader = Reader.find(params[:id])
20
- respond_to do |format|
21
- format.html {
22
- if @reader.inactive? && @reader == current_reader
23
- redirect_to reader_activation_url
24
- else
25
- render
26
- end
27
- }
28
- format.js {
29
- @inline = true
30
- render :partial => 'readers/controls'
31
- }
32
- end
33
20
  end
34
21
 
35
22
  def new
@@ -13,7 +13,7 @@
13
13
  = purpose + ','
14
14
  = t('please')
15
15
  - else
16
- = t('please')
16
+ = t('please').titlecase
17
17
  = t('log_in')
18
18
  - if Radiant::Config['reader.allow_registration?']
19
19
  = t('or')
@@ -1,25 +1,13 @@
1
- %div#reader_links
2
- - if current_reader
3
- - if current_reader.activated?
4
- %p
5
- %strong
6
- Hello
7
- = current_reader.name
8
- %br
9
- = link_to 'your page', reader_url(current_reader)
10
- |
11
- = link_to 'preferences', edit_reader_url(current_reader)
12
- |
13
- - if current_reader.is_user?
14
- = link_to 'admin', admin_pages_url
15
- |
16
- = link_to 'log out', reader_logout_url
17
- -else
18
- %p
19
- please check your email for an activation message
20
- - else
21
- %p
22
- To take part, please
23
- = link_to 'log in', reader_login_url
24
- or
25
- = link_to 'register', new_reader_url
1
+ - if !current_reader
2
+ = link_to t('navigation.log_in'), reader_login_url
3
+ = link_to t('navigation.register'), new_reader_url
4
+ - elsif !current_reader.activated?
5
+ = link_to t('navigation.activate'), reader_activation_url
6
+ - else
7
+ = link_to t('navigation.profile'), reader_profile_url
8
+ = link_to t('navigation.account'), reader_account_url
9
+ - if current_reader.is_user?
10
+ = link_to t('navigation.admin'), admin_pages_url
11
+ = link_to t('navigation.log_out'), reader_logout_url
12
+
13
+
@@ -1,11 +1,8 @@
1
- - add_reader_js '/javascripts/reader.js'
2
- - add_reader_css '/stylesheets/reader.css'
1
+ - content_for :reader_css do
2
+ %link{:rel => 'stylesheet', :type => 'text/css', :href => '/stylesheets/reader.css', :media => 'all'}
3
3
 
4
- - content_for :section_navigation do
5
- = link_to t('navigation.readers'), readers_url, :class => 'section'
6
- = link_to t('navigation.your_account'), reader_account_url
7
- - if Radiant::Config['reader.help_url']
8
- = link_to t('navigation.reader_help'), Radiant::Config['reader.help_url']
4
+ - content_for :reader_js do
5
+ %script{:src => '/javascripts/reader.js', :type => 'text/javascript'}
9
6
 
10
7
  - content_for :reader_css do
11
8
  - reader_css_paths.each do |path|
@@ -18,3 +15,9 @@
18
15
  - content_for :person do
19
16
  - if @reader && !@reader.new_record?
20
17
  = standard_gravatar_for(@reader)
18
+
19
+ - content_for :section_navigation do
20
+ = link_to t('navigation.readers'), readers_url, :class => 'section'
21
+ = link_to t('navigation.loading'), reader_session_url, :class => "remotecontent"
22
+ - if Radiant::Config['reader.help_url']
23
+ = link_to t('navigation.reader_help'), Radiant::Config['reader.help_url']
@@ -5,6 +5,7 @@ en:
5
5
  activate_account: "Activate your account"
6
6
  activation_complete: "Thank you very much for persevering with the registration process. Your account is now active."
7
7
  activation_message_sent: "Account activation instructions have been emailed to you."
8
+ activation_required: "Please check your email for an activation message"
8
9
  activation_required_header: "Please check your email"
9
10
  activation_required_explanation: "You should have received a confirmation message containing a link that will activate your account."
10
11
  activation_sent: "Activation message sent"
@@ -20,6 +21,7 @@ en:
20
21
  cannot_edit_others: "You are not allowed to edit other people's accounts."
21
22
  change_gravatar: "change gravatar image"
22
23
  change_password: "Change your password"
24
+ check_email: "Please check your email for an activation message"
23
25
  config:
24
26
  reader:
25
27
  allow_registration?: "Allow registration"
@@ -80,12 +82,16 @@ en:
80
82
  logout_message: "You are logged out. Bye!"
81
83
  must_be_empty: "must be empty"
82
84
  navigation:
85
+ account: "Your account"
83
86
  activate: "Activate account"
87
+ admin: "Admin"
84
88
  readers: "People"
85
89
  preferences: "Preferences"
86
- profile: "Your profile"
90
+ profile: "Profile"
87
91
  log_in: "Log in"
88
92
  log_out: "Log out"
93
+ loading: "Loading..."
94
+ register: "Register"
89
95
  your_account: "Your account"
90
96
  new_account: "Create an account"
91
97
  new_password: "New password"
@@ -136,6 +142,7 @@ en:
136
142
  sorry: "sorry"
137
143
  sorry_access_denied: "Sorry: access denied"
138
144
  spam_trap: "it's a spam trap and shouldn't be visible"
145
+ status_check: "Please wait: loading controls"
139
146
  terms_and_conditions: "terms and conditions"
140
147
  thanks_activated: "Thank you! Your account has been activated."
141
148
  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."
@@ -53,8 +53,10 @@ module ControllerExtensions # for inclusion into ApplicationController
53
53
  end
54
54
 
55
55
  def redirect_back_with_format(format = 'html')
56
+ Rails.logger.warn "<<< redirect_back_with_format. session[:return_to] is #{session[:return_to].inspect}"
56
57
  address = session[:return_to]
57
- raise StandardError, "Can't add format to an already formatted url: #{address}" unless File.extname(address).blank?
58
+ previous_format = File.extname(address)
59
+ raise StandardError, "Can't add format to an already formatted url: #{address}" unless previous_format.blank? || previous_format == format
58
60
  redirect_to address + ".#{format}" # nasty! but necessary for inline login.
59
61
  end
60
62
 
@@ -1,9 +1,21 @@
1
1
  (function($) {
2
2
 
3
+ $.fn.rails_flash = function() {
4
+ this.each(function() {
5
+ var self = $(this);
6
+ var closer = $('<a href="#" class="closer">x</a>').appendTo(self);
7
+ closer.click( function (event) {
8
+ event.preventDefault();
9
+ self.fadeOut('fast');
10
+ });
11
+ });
12
+ return this;
13
+ };
14
+
3
15
  $.fn.toggler = function() {
4
16
  this.each(function() {
5
17
  var self = $(this);
6
- var toggling = $(self.attr.rel);
18
+ var toggling = $(self.attr('rel'));
7
19
  self.click( function (event) {
8
20
  event.preventDefault();
9
21
  toggling.toggle();
@@ -12,8 +24,172 @@
12
24
  return this;
13
25
  };
14
26
 
27
+ $.ajaxSetup({
28
+ 'beforeSend': function(xhr) {
29
+ xhr.setRequestHeader("Accept", "text/javascript");
30
+ }
31
+ });
32
+
33
+ // general-purpose event blocker
34
+ function squash(e) {
35
+ if(e) {
36
+ e.preventDefault();
37
+ e.stopPropagation();
38
+ if (e.target) e.target.blur();
39
+ }
40
+ }
41
+
42
+ $.fn.fetch_remote_content = function() {
43
+ this.each(function() {
44
+ var self = $(this);
45
+ var url = self.attr('href');
46
+ if (url) {
47
+ self.addClass('waiting');
48
+ $.get(url, function (result) { self.replaceWith($(result)); });
49
+ }
50
+ });
51
+ return this;
52
+ };
53
+
54
+ /*
55
+ * jQuery Color Animations
56
+ * Copyright 2007 John Resig
57
+ * Released under the MIT and GPL licenses.
58
+ * syntax corrected but otherwise untouched.
59
+ */
60
+
61
+ // We override the animation for all of these color styles
62
+ $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i, attr) {
63
+ $.fx.step[attr] = function(fx) {
64
+ if (!fx.colorInit) {
65
+ fx.start = getColor(fx.elem, attr);
66
+ fx.end = getRGB(fx.end);
67
+ fx.colorInit = true;
68
+ }
69
+
70
+ fx.elem.style[attr] = "rgb(" + [
71
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0),
72
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0),
73
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0)
74
+ ].join(",") + ")";
75
+ }
76
+ });
77
+
78
+ // Color Conversion functions from highlightFade
79
+ // By Blair Mitchelmore
80
+ // http://jquery.offput.ca/highlightFade/
81
+
82
+ // Parse strings looking for color tuples [255,255,255]
83
+ function getRGB(color) {
84
+ var result;
85
+
86
+ // Check if we're already dealing with an array of colors
87
+ if ( color && color.constructor == Array && color.length == 3 )
88
+ return color;
89
+
90
+ // Look for rgb(num,num,num)
91
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
92
+ return [parseInt(result[1], 10), parseInt(result[2], 10), parseInt(result[3], 10)];
93
+
94
+ // Look for rgb(num%,num%,num%)
95
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
96
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
97
+
98
+ // Look for #a0b1c2
99
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
100
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
101
+
102
+ // Look for #fff
103
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
104
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
105
+
106
+ // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
107
+ if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
108
+ return colors['transparent'];
109
+
110
+ // Otherwise, we're most likely dealing with a named color
111
+ return colors[jQuery.trim(color).toLowerCase()];
112
+ }
113
+
114
+ function getColor(elem, attr) {
115
+ var color;
116
+
117
+ do {
118
+ color = $.curCSS(elem, attr);
119
+
120
+ // Keep going until we find an element that has color, or we hit the body
121
+ if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
122
+ break;
123
+
124
+ attr = "backgroundColor";
125
+ } while ( elem = elem.parentNode );
126
+
127
+ return getRGB(color);
128
+ };
129
+
130
+ // Some named colors to work with
131
+ // From Interface by Stefan Petre
132
+ // http://interface.eyecon.ro/
133
+
134
+ var colors = {
135
+ aqua:[0,255,255],
136
+ azure:[240,255,255],
137
+ beige:[245,245,220],
138
+ black:[0,0,0],
139
+ blue:[0,0,255],
140
+ brown:[165,42,42],
141
+ cyan:[0,255,255],
142
+ darkblue:[0,0,139],
143
+ darkcyan:[0,139,139],
144
+ darkgrey:[169,169,169],
145
+ darkgreen:[0,100,0],
146
+ darkkhaki:[189,183,107],
147
+ darkmagenta:[139,0,139],
148
+ darkolivegreen:[85,107,47],
149
+ darkorange:[255,140,0],
150
+ darkorchid:[153,50,204],
151
+ darkred:[139,0,0],
152
+ darksalmon:[233,150,122],
153
+ darkviolet:[148,0,211],
154
+ fuchsia:[255,0,255],
155
+ gold:[255,215,0],
156
+ green:[0,128,0],
157
+ indigo:[75,0,130],
158
+ khaki:[240,230,140],
159
+ lightblue:[173,216,230],
160
+ lightcyan:[224,255,255],
161
+ lightgreen:[144,238,144],
162
+ lightgrey:[211,211,211],
163
+ lightpink:[255,182,193],
164
+ lightyellow:[255,255,224],
165
+ lime:[0,255,0],
166
+ magenta:[255,0,255],
167
+ maroon:[128,0,0],
168
+ navy:[0,0,128],
169
+ olive:[128,128,0],
170
+ orange:[255,165,0],
171
+ pink:[255,192,203],
172
+ purple:[128,0,128],
173
+ violet:[128,0,128],
174
+ red:[255,0,0],
175
+ silver:[192,192,192],
176
+ white:[255,255,255],
177
+ yellow:[255,255,0],
178
+ transparent: [255,255,255]
179
+ };
180
+
181
+ $.fn.blush = function(color, duration) {
182
+ color = color || "#FFFF9C";
183
+ duration = duration || 1500;
184
+ var backto = this.css("background-color");
185
+ if (backto == "" || backto == 'transparent') backto = '#ffffff';
186
+ this.css("background-color", color).animate({"background-color": backto}, duration);
187
+ };
188
+
15
189
  })(jQuery);
16
190
 
17
191
  $(function() {
18
192
  $("a.toggle").toggler();
193
+ $("a.remotecontent").fetch_remote_content();
194
+ $("div.notice, div.error").rails_flash();
19
195
  });
@@ -13,8 +13,6 @@
13
13
  font-weight: normal
14
14
  a
15
15
  color: #06c
16
- font-size: 80%
17
- font-weight: normal
18
16
 
19
17
  /* show and send page
20
18
 
@@ -83,4 +81,3 @@ ul.help
83
81
  code
84
82
  color: #c00
85
83
  font-size: 115%
86
-
@@ -1,11 +1,11 @@
1
1
  @import compass/css3
2
2
 
3
- $dark: #4d4e53 / cool grey 11
4
- $mid: #8c8d8e / cool grey 8
5
- $pale: #afafaf / cool grey 6
6
- $paler: #bdbdbd / cool grey 4
7
- $verypale: #d6d6d4 / cool grey 2
8
- $accent = #d1005d / rubine red
3
+ $dark: #4d4e53
4
+ $mid: #8c8d8e
5
+ $pale: #afafaf
6
+ $paler: #bdbdbd
7
+ $verypale: #d6d6d4
8
+ $accent = #d1005d
9
9
 
10
10
  =functional
11
11
  font-family: helvetica, arial, sans-serif
@@ -17,7 +17,7 @@ $accent = #d1005d / rubine red
17
17
  +functional
18
18
  font-size: 80%
19
19
 
20
- .error, .notice
20
+ div.error, div.notice
21
21
  position: absolute
22
22
  width: 300px
23
23
  top: 50px
@@ -33,10 +33,10 @@ $accent = #d1005d / rubine red
33
33
  right: 5px
34
34
  color: white
35
35
  font-weight: bold
36
- .notice
36
+ div.notice
37
37
  background-color: #b2e5b2
38
38
  color: #060
39
- .error
39
+ div.error
40
40
  background-color: #f3c2c2
41
41
  color: #770000
42
42
 
@@ -66,7 +66,7 @@ img.gravatar
66
66
  border: 1px solid white
67
67
 
68
68
  form.friendly
69
- margin: 0 0 60px 0
69
+ margin: 0 0 2em 0
70
70
  p
71
71
  margin: 1em 0 0 0
72
72
  input.login
@@ -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.3.4"
8
+ s.version = "1.3.6"
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-02-07}
12
+ s.date = %q{2011-02-09}
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 = [
data/reader_extension.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require_dependency 'application_controller'
2
2
 
3
3
  class ReaderExtension < Radiant::Extension
4
- version "1.3.4"
4
+ version "1.3.6"
5
5
  description "Provides reader/member/user registration and management functions"
6
6
  url "http://spanner.org/radiant/reader"
7
7
 
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: 19
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 4
10
- version: 1.3.4
9
+ - 6
10
+ version: 1.3.6
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-02-07 00:00:00 +00:00
18
+ date: 2011-02-09 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency