rostra 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/rostra/application.js +7 -2
- data/app/assets/stylesheets/rostra/flash_messages.css +1 -1
- data/app/controllers/rostra/questions_controller.rb +1 -1
- data/app/helpers/rostra/base_helper.rb +4 -3
- data/app/views/rostra/questions/index.html.erb +1 -1
- data/app/views/rostra/questions/show.html.erb +2 -2
- data/app/views/rostra/shared/_votes.html.erb +2 -2
- data/lib/generators/rostra/templates/app/helpers/rostra/application_helper.rb +4 -3
- data/lib/rostra/version.rb +1 -1
- metadata +1 -1
@@ -32,8 +32,13 @@ $(document).ready(function() {
|
|
32
32
|
|
33
33
|
|
34
34
|
var closeable_flash_messages = function() {
|
35
|
-
$('.flash a.
|
36
|
-
$(this).parent()
|
35
|
+
$('.flash a.closeable').click(function() {
|
36
|
+
var flash = $(this).parent();
|
37
|
+
flash.animate({'opacity': 0}, 250, function() {
|
38
|
+
flash.slideUp(250, function() {
|
39
|
+
flash.css('opacity', 1)
|
40
|
+
});
|
41
|
+
})
|
37
42
|
return false;
|
38
43
|
});
|
39
44
|
}();
|
@@ -39,14 +39,15 @@ module Rostra
|
|
39
39
|
# 2. Uses the users email address to look for a gravatar
|
40
40
|
# 3. Renders <tt>app/assets/images/rostra/anonymous_avatar.png</tt>
|
41
41
|
#
|
42
|
-
def
|
42
|
+
def rostra_user_avatar(user)
|
43
43
|
if user.respond_to?(:avatar)
|
44
|
-
user.avatar
|
44
|
+
url = user.avatar
|
45
45
|
else
|
46
46
|
default_url = "#{main_app.root_url}assets/rostra/anonymous_avatar.png"
|
47
47
|
gravatar_id = Digest::MD5.hexdigest(user.rostra_user_email.downcase)
|
48
|
-
"http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
|
48
|
+
url = "http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
|
49
49
|
end
|
50
|
+
image_tag(url, class: 'avatar')
|
50
51
|
end
|
51
52
|
|
52
53
|
# Method to build links for ajax-y voting arrows.
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<div class="question" id="<%= dom_id(@question) %>">
|
6
6
|
<%= render partial: 'rostra/shared/votes', locals: { resource: @question } %>
|
7
|
-
<%=
|
7
|
+
<%= rostra_user_avatar(@question.user) %>
|
8
8
|
<cite>
|
9
9
|
Asked by <%= link_to_profile(@question.user) %>
|
10
10
|
<%= link_to 'edit', edit_question_path(@question) if can? :manage, @question %>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<% @answers.each do |answer| %>
|
23
23
|
<div class="answer" id="<%= dom_id(answer) %>">
|
24
24
|
<%= render partial: 'rostra/shared/votes', locals: { resource: answer } %>
|
25
|
-
<%=
|
25
|
+
<%= rostra_user_avatar(answer.user) %>
|
26
26
|
<cite>
|
27
27
|
<%= link_to_profile(answer.user) %> says:
|
28
28
|
<%= link_to('edit', edit_question_answer_path(@question, answer)) if can? :manage, answer %>
|
@@ -7,13 +7,13 @@
|
|
7
7
|
<% unless user_signed_in? %>
|
8
8
|
<div class="hidden flash" id="flash_notice">
|
9
9
|
You must <%= link_to 'login', main_app_login_path %> or <%= link_to 'signup', main_app_signup_path %> in order to vote
|
10
|
-
<%= link_to '
|
10
|
+
<%= link_to 'X', '#', class: 'closeable' %>
|
11
11
|
</div>
|
12
12
|
<% end %>
|
13
13
|
|
14
14
|
<% if can? :manage, resource %>
|
15
15
|
<div class="hidden flash" id="flash_notice">
|
16
16
|
You cannot vote on your own <%= class_name(resource) %>
|
17
|
-
<%= link_to '
|
17
|
+
<%= link_to 'X', '#', class: 'closeable' %>
|
18
18
|
</div>
|
19
19
|
<% end %>
|
@@ -26,14 +26,15 @@ module Rostra
|
|
26
26
|
# 2. Uses the users email address to look for a gravatar
|
27
27
|
# 3. Renders <tt>app/assets/images/rostra/anonymous_avatar.png</tt>
|
28
28
|
#
|
29
|
-
# def
|
29
|
+
# def rostra_user_avatar(user)
|
30
30
|
# if user.respond_to?(:avatar)
|
31
|
-
# user.avatar
|
31
|
+
# url = user.avatar
|
32
32
|
# else
|
33
33
|
# default_url = "#{main_app.root_url}assets/rostra/anonymous_avatar.png"
|
34
34
|
# gravatar_id = Digest::MD5.hexdigest(user.rostra_user_email.downcase)
|
35
|
-
# "http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
|
35
|
+
# url = "http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}"
|
36
36
|
# end
|
37
|
+
# image_tag(url, class: 'avatar')
|
37
38
|
# end
|
38
39
|
|
39
40
|
# Used to populate both the <tt>title</tt> and <tt>h1</tt> elements for each page.
|
data/lib/rostra/version.rb
CHANGED