Skip to content

Commit 9b6486e

Browse files
committed
fix to sunspot config and additional activity grid tweaks
refactor Rails.root to request.host update for mailers too mailer reqeust.host fixes in tests more mailer test tweaks mailer test fixes 2 more mailer test refactoring ActionMailer host changes in test and app more test tweaks test helper specifying hosts for mailers in dev and test revision timing change for order render body test w/ request host param render_body_email, not render_body hostname env. config and activity feed html tweak mailer/request.host additions style tweak last domain tweak
1 parent 17398e4 commit 9b6486e

File tree

60 files changed

+212
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+212
-189
lines changed

app/assets/stylesheets/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,15 @@ table th a {
491491
table th a:hover {
492492
color: #aaa;
493493
}
494+
495+
@media (max-width:768px) {
496+
table {
497+
font-size: 90%;
498+
}
499+
}
500+
501+
@media (max-width:400px) {
502+
table {
503+
font-size: 80%;
504+
}
505+
}

app/controllers/application_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def current_user
8383
@current_user = nil
8484
elsif @current_user.try(:drupal_user).try(:status) == 5
8585
# Tell the user they are banned. Fails b/c redirect to require below.
86-
flash[:warning] = "The user '#{@current_user.username}' has been placed in moderation; please see <a href='https://#{Rails.root}/wiki/moderators'>our moderation policy</a> and contact <a href='mailto:moderators@#{Rails.root}'>moderators@#{Rails.root}</a> if you believe this is in error."
86+
flash[:warning] = "The user '#{@current_user.username}' has been placed in moderation; please see <a href='https://#{request.host}/wiki/moderators'>our moderation policy</a> and contact <a href='mailto:moderators@#{request.host}'>moderators@#{request.host}</a> if you believe this is in error."
8787
# Same effect as if the user clicked logout:
8888
current_user_session.destroy
8989
# Ensures no code will use old @current_user info. Treat the user
@@ -142,7 +142,7 @@ def alert_and_redirect_moderated
142142
# no notification; don't let people easily fish for existing draft titles; we should try to 404 it
143143
redirect_to "/"
144144
elsif @node.author.status == 5
145-
flash.now[:warning] = "The user '#{@node.author.username}' has been placed <a href='https://#{Rails.root}/wiki/moderators'>in moderation</a> and will not be able to respond to comments."
145+
flash.now[:warning] = "The user '#{@node.author.username}' has been placed <a href='https://#{request.host}/wiki/moderators'>in moderation</a> and will not be able to respond to comments."
146146
end
147147
end
148148

app/controllers/legacy_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def openid_username
3838
end
3939

4040
def file
41-
redirect_to "//#{Rails.root}/sites/default/files/"+params[:filename]+"."+params[:format], :status => 301
41+
redirect_to "//#{request.host}/sites/default/files/"+params[:filename]+"."+params[:format], :status => 301
4242
end
4343

4444
# def image

app/controllers/openid_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def decision
215215
def server
216216
if @server.nil?
217217
server_url = url_for :action => 'index', :only_path => false
218-
dir = Pathname.new(Rails.root).join('db').join('openid-store')
218+
dir = Pathname.new(request.host).join('db').join('openid-store')
219219
store = OpenID::Store::Filesystem.new(dir)
220220
@server = Server.new(store, server_url)
221221
end

app/controllers/tag_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ def barnstar
8282
else
8383
flash[:notice] = I18n.t('tag_controller.barnstar_awarded', :url1 => "/wiki/barnstars#"+params[:star].split('-').each{|w| w.capitalize!}.join('+')+"+Barnstar", :star => params[:star], :url2 => "/profile/"+node.author.name, :awardee => node.author.name).html_safe
8484
# on success add comment
85-
barnstar_info_link = '<a href="//' + Rails.root.to_s + '/wiki/barnstars">barnstar</a>'
85+
barnstar_info_link = '<a href="//' + request.host.to_s + '/wiki/barnstars">barnstar</a>'
8686
node.add_comment({
8787
:subject => 'barnstar',
8888
:uid => current_user.uid,
89-
:body => "#{current_user.username} awards a #{barnstar_info_link} to #{node.drupal_users.name} for their awesome contribution!"
89+
:body => "@#{current_user.username} awards a #{barnstar_info_link} to #{node.drupal_users.name} for their awesome contribution!"
9090
})
9191
end
9292
redirect_to node.path + "?_=" + Time.now.to_i.to_s

app/controllers/wiki_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class WikiController < ApplicationController
55
before_filter :require_user, :only => [:new, :create, :edit, :update, :delete]
66

77
def subdomain
8-
url = "//#{Rails.root}/wiki/"
8+
url = "//#{request.host}/wiki/"
99
case request.subdomain
1010
when "new-york-city",
1111
"gulf-coast",

app/helpers/application_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def insert_extras(body)
8080
output += ' <td class="author"><a href="/profile/' + node.author.username + '">@' + node.author.username + '</a></td>'
8181
output += ' <td class="time">' + (node.has_power_tag('time') ? node.power_tag('time') : '-') + '</td>'
8282
output += ' <td class="difficulty">' + (node.has_power_tag('difficulty') ? node.power_tag('difficulty') : '-') + '</td>'
83-
output += ' <td class="replications">' + node.response_count('replication').to_s + ' replications</td>'
83+
output += ' <td class="replications">' + node.response_count('replication').to_s + ' replications: <a href="' + node.path + '#replications">Try it &raquo;</a></td>'
8484
output += '</tr>'
8585
end
8686
output += '</table>'
@@ -109,7 +109,7 @@ def insert_extras(body)
109109
output += ' <td class="author"><a href="/profile/' + node.author.username + '">@' + node.author.username + '</a></td>'
110110
output += ' <td class="time">' + (node.has_power_tag('time') ? node.power_tag('time') : '-') + '</td>'
111111
output += ' <td class="difficulty">' + (node.has_power_tag('difficulty') ? node.power_tag('difficulty') : '-') + '</td>'
112-
output += ' <td class="builds">' + node.response_count('build').to_s + ' builds</td>'
112+
output += ' <td class="builds">' + node.response_count('build').to_s + ' builds: <a href="' + node.path + '#builds">Try it &raquo;</a></td>'
113113
output += '</tr>'
114114
end
115115
output += '</table>'

app/mailers/admin_mailer.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class AdminMailer < ActionMailer::Base
2-
default from: "do-not-reply@#{Rails.root}"
2+
default from: "do-not-reply@#{ActionMailer::Base.default_url_options[:host]}"
33

44
def notify_node_moderators(node)
55
subject = "[New Public Lab poster needs moderation] " + node.title
66
@node = node
77
moderators = User.where(role: ['moderator', 'admin']).collect(&:email)
88
mail(
9-
to: "moderators@#{Rails.root}",
9+
to: "moderators@#{ActionMailer::Base.default_url_options[:host]}",
1010
bcc: moderators,
1111
subject: subject
1212
).deliver
@@ -34,7 +34,7 @@ def notify_moderators_of_approval(node, moderator)
3434
@node = node
3535
moderators = User.where(role: ['moderator', 'admin']).collect(&:email)
3636
mail(
37-
to: "moderators@#{Rails.root}",
37+
to: "moderators@#{ActionMailer::Base.default_url_options[:host]}",
3838
bcc: moderators,
3939
subject: subject
4040
).deliver
@@ -47,7 +47,7 @@ def notify_moderators_of_spam(node, moderator)
4747
@node = node
4848
moderators = User.where(role: ['moderator', 'admin']).collect(&:email)
4949
mail(
50-
to: "moderators@#{Rails.root}",
50+
to: "moderators@#{ActionMailer::Base.default_url_options[:host]}",
5151
bcc: moderators,
5252
subject: subject
5353
).deliver

app/mailers/answer_mailer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class AnswerMailer < ActionMailer::Base
2-
default from: "do-not-reply@#{Rails.root}"
2+
default from: "do-not-reply@#{ActionMailer::Base.default_url_options[:host]}"
33

44
def notify_question_author(user, answer)
55
subject = "[PublicLab] New answer to Question: " + answer.node.title

app/mailers/comment_mailer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class CommentMailer < ActionMailer::Base
2-
default from: "do-not-reply@#{Rails.root}"
2+
default from: "do-not-reply@#{ActionMailer::Base.default_url_options[:host]}"
33

44
# CommentMailer.notify_of_comment(user,self).deliver
55
def notify(user,comment)

0 commit comments

Comments
 (0)