Skip to content
Browse files

useful email tags

  • Loading branch information...
1 parent 84949fa commit a0f8c68a95ccc163bdbddda2c3295908747710c5 @will-r will-r committed
Showing with 38 additions and 6 deletions.
  1. +4 −0 app/models/reader.rb
  2. +1 −1 app/views/admin/groups/_group.html.haml
  3. +30 −2 lib/message_tags.rb
  4. +1 −1 lib/radiant-reader-extension.rb
  5. +2 −2 lib/reader_tags.rb
View
4 app/models/reader.rb
@@ -153,6 +153,10 @@ def is_grouped?
def preferred_name
nickname? ? nickname : name
end
+
+ def preferred_informal_name
+ nickname? ? nickname : forename
+ end
def postal_address?
!post_line1.blank? && !post_city.blank?
View
2 app/views/admin/groups/_group.html.haml
@@ -2,7 +2,7 @@
- render_region :tbody do |tbody|
- tbody.name_cell do
%td.name{:style => "padding-left: #{9 + (24 * level)}px;"}
- = link_to image('group', :alt => '') + ' ' + group.name, admin_group_url(group)
+ = link_to image('group', :alt => '', :class => 'gravatar') + ' ' + group.name, admin_group_url(group)
%br
%span.notes
= group.description
View
32 lib/message_tags.rb
@@ -45,9 +45,9 @@ class TagError < StandardError; end
tag.expand
end
- [:name, :forename, :surname, :email, :description, :login].each do |field|
+ [:name, :forename, :nickname, :preferred_name, :preferred_informal_name, :surname, :email, :description, :login].each do |field|
desc %{
- Only for use in email messages. Displays the #{field} field of the reader currently being emailed.
+ Only for use in email messages. Displays the #{field} of the reader currently being emailed.
<pre><code><r:recipient:#{field} /></code></pre>
}
tag "recipient:#{field}" do |tag|
@@ -98,6 +98,34 @@ class TagError < StandardError; end
end
desc %{
+ Expands if the addressed reader has activated his or her account. Only for use in email messages.
+ }
+ tag "recipient:if_activated" do |tag|
+ tag.expand if tag.locals.recipient.activated?
+ end
+
+ desc %{
+ Expands if the addressed reader has not activated his or her account. Only for use in email messages.
+ }
+ tag "recipient:unless_activated" do |tag|
+ tag.expand unless tag.locals.recipient.activated?
+ end
+
+ desc %{
+ Expands if a clear password is available for the addressed reader.
+ }
+ tag "recipient:if_clear_password" do |tag|
+ tag.expand unless tag.locals.recipient.clear_password.blank?
+ end
+
+ desc %{
+ Expands if no clear password is available for the addressed reader.
+ }
+ tag "recipient:unless_clear_password" do |tag|
+ tag.expand if tag.locals.recipient.clear_password.blank?
+ end
+
+ desc %{
Only for use in email messages. Displays the address that will activate the current reader account.
<pre><code><r:recipient:activation_url /></code></pre>
}
View
2 lib/radiant-reader-extension.rb
@@ -1,5 +1,5 @@
module RadiantReaderExtension
- VERSION = '3.0.25'
+ VERSION = '3.0.26'
SUMMARY = %q{Reader/viewer/visitor registration, login and access-control for Radiant CMS}
DESCRIPTION = %q{Provides reader/member/user registration and management functions including password-reminder, group-based page access control and administrative email.}
URL = "http://radiant.spanner.org/reader"
View
4 lib/reader_tags.rb
@@ -76,7 +76,7 @@ class TagError < StandardError; end
tag.expand if get_reader(tag)
end
- [:name, :forename, :surname, :nickname, :preferred_name, :email, :description, :login].each do |field|
+ [:name, :forename, :surname, :nickname, :preferred_name, :preferred_informal_name, :email, :description, :login].each do |field|
desc %{
Displays the #{field} field of the current reader.
<pre><code><r:reader:#{field} /></code></pre>
@@ -111,7 +111,7 @@ class TagError < StandardError; end
%{<div class="remote_controls"></div>}
else
if tag.locals.reader = Reader.current
- welcome = %{<span class="greeting">#{I18n.t('reader_extension.navigation.greeting', :name => tag.locals.reader.preferred_name)}</span>. }
+ welcome = %{<span class="greeting">#{I18n.t('reader_extension.navigation.greeting', :name => tag.locals.reader.preferred_informal_name)}</span>. }
if tag.locals.reader.activated?
welcome << %{
#{I18n.t('reader_extension.not_you')} <a href="#{reader_logout_path}">#{I18n.t('reader_extension.navigation.log_out')}</a>.

0 comments on commit a0f8c68

Please sign in to comment.
Something went wrong with that request. Please try again.