Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a tooltip to the public/private icon.

- When the repository is private set the tooltip to explictly state that
  Everyone can not access the repository.
- When the repository is public set the tooltip to be the permissions
  that Everyone has.
- Add a tooltip to the private icon in the repository listing
- Move the gravatar function to the user model rather then in the helper and add a helper function to the user class.
  • Loading branch information...
commit 58b1359fc3c50b86e25a863da78f1f7669ea5b9c 1 parent 630f812
Benjamin C Meyer authored
6 web/app/helpers/application_helper.rb
View
@@ -9,10 +9,4 @@ def page_heading(text)
content_tag(:h1, content_for(:title){ text })
end
- require 'digest/md5'
-
- def gravatar_url_for(email, options)
- "http://www.gravatar.com/avatar.php?gravatar_id=" + Digest::MD5.hexdigest(email) + options
- end
-
end
13 web/app/models/user.rb
View
@@ -1,4 +1,9 @@
require 'digest/sha1'
+require 'digest/md5'
+
+def gravatar_url_for(email, options)
+ "http://www.gravatar.com/avatar.php?gravatar_id=" + Digest::MD5.hexdigest(email) + options
+end
class User < ActiveRecord::Base
has_many :repositories, :dependent => :destroy
@@ -48,6 +53,14 @@ def avatar_email
return self.email
end
+ def gravatar_url(options)
+ if self.username == I18n.t('user.all')
+ # If the repository is private user.all wont be in its list.
+ return 'public.png'
+ end
+ gravatar_url_for(self.avatar_email, options)
+ end
+
def forked(repository)
return false if !repository
return true if self == repository.user
2  web/app/views/repositories/_index.html.erb
View
@@ -11,7 +11,7 @@ end
<table id="tree">
<% for repository in @repositories %>
<tr class="<%= cycle('contents-line-odd', 'contents-line-even') %>">
- <td><%= (image_tag 'private.png') if !repository.public %></td>
+ <td><%= (image_tag 'private.png', :title => 'Everyone can NOT access this repository.') if !repository.public %></td>
<td><%=link_to h(repository.user.username), :user => repository.user.username, :controller => 'users', :action => 'show' %></td>
<td>/</td>
<td><%=link_to h(repository.name), :controller => 'repositories', :action => 'show', :user => repository.user.username, :repo => repository.name %></td>
6 web/app/views/repositories/_repositorytopbar.html.erb
View
@@ -1,9 +1,9 @@
<div id="repository">
- <%= image_tag (@repository.public ? 'public.png' : 'private.png'), :class => 'repo_public_private' %>
+ <%= image_tag ('private.png'), :class => 'repo_public_private', :title => 'Everyone can NOT access this repository.' if !@repository.public %>
<% @repository.permissions.each { |p| %>
- <%= image_tag(gravatar_url_for(p.user.email, "&size=16"), :size => "16x16", :class => 'repo_public_private', :title => p.user.username + ' ' + p.mode) if p.user.email && p.user.username%>
+ <%= image_tag(p.user.gravatar_url("&size=16"), :size => "16x16", :class => 'repo_public_private', :title => p.user.username + ' ' + p.mode)%>
<% } %>
- <%= image_tag(gravatar_url_for(@repository.user.email, "&size=16"), :size => "16x16", :class => 'repo_public_private', :title => @repository.user.username + ' rw') if @repository.user && @repository.user.email %>
+ <%= image_tag(@repository.user.gravatar_url("&size=16"), :size => "16x16", :class => 'repo_public_private', :title => @repository.user.username + ' rw') if @repository.user && @repository.user.email %>
<%= link_to_user(@owner) %> / <b> <%= link_to_repository(@repository) %></b>
<% @repository.tags.each { |t| %>
2  web/app/views/users/show.html.erb
View
@@ -1,6 +1,6 @@
<%= page_heading @user.username %>
<div id="user">
-<%= image_tag(gravatar_url_for(@user.avatar_email, "&size=48"), :size => "48x48") %>
+<%= image_tag(@user.gravatar_url("&size=48"), :size => "48x48") %>
<h1><%=h @user.username %></h1>
<div id="user_info">
<% if @user.name %>Name: <%=h @user.name %><br /><% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.