プロジェクト

全般

プロフィール

Vote #64650

完了

Use wavatar as a default for gravatar images

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Accounts / authentication_7
対象バージョン:
開始日:
2009/02/12
期日:
進捗率:

100%

予定工数:
category_id:
7
version_id:
6
issue_org_id:
2734
author_id:
3866
assigned_to_id:
5
comments:
8
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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

journals

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.
--------------------------------------------------------------------------------
I like the idea but this should be a user option. I prefer the identicon more myself.
--------------------------------------------------------------------------------
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.

<pre>
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'
</pre>

(the diff is also attached)
--------------------------------------------------------------------------------
Ok, If you replace the corresponding lines in _general.rhtml with:

<pre>
<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>
</pre>

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

--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
Felix:

No need to update the patch, I've committed it in r3076. Thank you for the patches.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------


related_issues

relates,Closed,4137,Use Gravatar ident icons instead of default "G" icon

Admin Redmine さんが3年以上前に更新

  • カテゴリAccounts / authentication_7 にセット
  • 対象バージョン0.9.0_6 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0