Project

General

Profile

Actions

Patch #2734

closed

Use wavatar as a default for gravatar images

Added by Felix Schäfer about 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Accounts / authentication
Target version:
Start date:
2009-02-12
Due date:
% Done:

100%

Estimated time:

Description

I would recommend setting wavatar (or monsterid or identicons) as a default for the gravatar plugin, as having the "same" default gravatar for everyone not having one doesn't really help to tell people apart.

I don't know how hard it would be to make that a droplist to choose between the 3, but that might be a nice touch to it :-)

Patch:

$ svn diff vendor/plugins/gravatar/lib/gravatar.rb
Index: vendor/plugins/gravatar/lib/gravatar.rb
===================================================================
--- vendor/plugins/gravatar/lib/gravatar.rb     (revision 2363)
+++ vendor/plugins/gravatar/lib/gravatar.rb     (working copy)
@@ -13,7 +13,7 @@
   DEFAULT_OPTIONS = {
     # The URL of a default image to display if the given email address does
     # not have a gravatar.
-    :default => nil,
+    :default => 'wavatar',

     # The default size in pixels for the gravatar image (they're square).
     :size => 50,
@@ -64,4 +64,4 @@

   end

-end
\ No newline at end of file
+end


Files

gravatar_schemes.diff (3.02 KB) gravatar_schemes.diff Felix Schäfer, 2009-02-12 19:46

Related issues

Related to Redmine - Feature #4137: Use Gravatar ident icons instead of default "G" iconClosed2009-10-29

Actions
Actions #1

Updated by Felix Schäfer about 15 years ago

Forgot to include the link to the gravatar page explaining the whole thing, see http://en.gravatar.com/site/implement/url and scroll down to step 5.

Actions #2

Updated by Eric Davis about 15 years ago

  • Category set to Accounts / authentication

I like the idea but this should be a user option. I prefer the identicon more myself.

Actions #3

Updated by Felix Schäfer about 15 years ago

OK, I went a little deeper in the stuff, and added an option to the preferences to change the default gravatar stuff. Only caveat: It's my first rail hacking ever, and I didn't get how to have an entry called "default" in the dropdown that would enter a "rail nil" or an empty string in the DB.

Index: app/helpers/application_helper.rb
===================================================================
--- app/helpers/application_helper.rb    (revision 2363)
+++ app/helpers/application_helper.rb    (working copy)
@@ -609,6 +609,7 @@
   def avatar(user, options = { })
     if Setting.gravatar_enabled?
       email = nil
+      options[:default] = Setting.gravatar_default
       if user.respond_to?(:mail)
         email = user.mail
       elsif user.to_s =~ %r{<(.+?)>}
Index: app/views/settings/_general.rhtml
===================================================================
--- app/views/settings/_general.rhtml    (revision 2363)
+++ app/views/settings/_general.rhtml    (working copy)
@@ -53,6 +53,9 @@

 <p><label><%= l(:setting_gravatar_enabled) %></label>
 <%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %></p>
+
+<p><label><%= l(:setting_gravatar_default) %></label>
+<%= select_tag 'settings[gravatar_default]', options_for_select(['wavatar', 'identicon', 'monsterid'], Setting.gravatar_default) %></p>
 </div>

 <%= submit_tag l(:button_save) %>
Index: lang/en.yml
===================================================================
--- lang/en.yml    (revision 2363)
+++ lang/en.yml    (working copy)
@@ -225,6 +225,7 @@
 setting_mail_handler_api_key: API key
 setting_sequential_project_identifiers: Generate sequential project identifiers
 setting_gravatar_enabled: Use Gravatar user icons
+setting_gravatar_default: Default Gravatars
 setting_diff_max_lines_displayed: Max number of diff lines displayed

 permission_edit_project: Edit project
Index: lang/de.yml
===================================================================
--- lang/de.yml    (revision 2363)
+++ lang/de.yml    (working copy)
@@ -223,6 +223,7 @@
 setting_mail_handler_api_key: API-Schlüssel
 setting_sequential_project_identifiers: Fortlaufende Projektkennungen generieren
 setting_gravatar_enabled: Gravatar Benutzerbilder benutzen
+setting_gravatar_default: Standard Gravatarschema
 setting_diff_max_lines_displayed: Maximale Anzahl anzuzeigender Diff-Zeilen

 permission_edit_project: Projekt bearbeiten
Index: lang/fr.yml
===================================================================
--- lang/fr.yml    (revision 2363)
+++ lang/fr.yml    (working copy)
@@ -225,6 +225,7 @@
 setting_mail_handler_api_key: Clé de protection de l'API
 setting_sequential_project_identifiers: Générer des identifiants de projet séquentiels
 setting_gravatar_enabled: Afficher les Gravatar des utilisateurs
+setting_gravatar_default: Gravatar par défaut
 setting_diff_max_lines_displayed: Nombre maximum de lignes de diff affichées

 permission_edit_project: Modifier le projet
Index: config/settings.yml
===================================================================
--- config/settings.yml    (revision 2363)
+++ config/settings.yml    (working copy)
@@ -140,3 +140,5 @@
     To change your notification preferences, please click here: http://hostname/my/account
 gravatar_enabled:  
   default: 0
+gravatar_default:
+  default: 'wavatar'

(the diff is also attached)

Actions #4

Updated by Felix Schäfer about 15 years ago

Ok, If you replace the corresponding lines in _general.rhtml with:

<p><label><%= l(:setting_gravatar_default) %></label>
<%= select_tag 'settings[gravatar_default]', options_for_select([["None",  ''], ["Wavatars", 'wavatar'], ["Identicons", 'identicon'], ["Monsterids", 'monsterid']], Setting.gravatar_default) %></p>

You get all the currently available options for the gravatar schemes.

Actions #5

Updated by Eric Davis about 15 years ago

  • Status changed from New to 7
  • Assignee set to Eric Davis
Actions #6

Updated by Felix Schäfer almost 15 years ago

Should I update this patch to apply to current trunk? Is there a default place to put a list of options like this, or can it stay in the view?

Actions #7

Updated by Eric Davis over 14 years ago

  • Status changed from 7 to Closed
  • Target version set to 0.9.0
  • % Done changed from 0 to 100

Felix:

No need to update the patch, I've committed it in r3076. Thank you for the patches.

Actions #8

Updated by Felix Schäfer over 14 years ago

Hey, great to see my first ruby/rails lines ever getting integrated without modifications :-) I'll have a look at getting the fr and de language files up to speed.

Actions

Also available in: Atom PDF