Skip to content

Commit

Permalink
Fix deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
scottwillson committed May 5, 2011
1 parent 6596963 commit 33e35a0
Show file tree
Hide file tree
Showing 86 changed files with 181 additions and 179 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin/people_controller.rb
Expand Up @@ -122,7 +122,7 @@ def create
:value => number_value
)
unless race_number.errors.empty?
@person.errors.add_to_base(race_number.errors.full_messages)
@person.errors.add(:base, race_number.errors.full_messages)
end
end
end
Expand Down Expand Up @@ -183,7 +183,7 @@ def update
:updated_by => current_person.name
)
unless race_number.errors.empty?
@person.errors.add_to_base(race_number.errors.full_messages)
@person.errors.add(:base, race_number.errors.full_messages)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/application_controller.rb
Expand Up @@ -145,7 +145,7 @@ def require_administrator
end

unless current_person.administrator?
session[:return_to] = request.request_uri
session[:return_to] = request.fullpath
flash[:notice] = "You must be an administrator to access this page"
store_location_and_redirect_to_login
return false
Expand Down Expand Up @@ -174,7 +174,7 @@ def require_administrator_or_official
end

unless administrator? || official?
session[:return_to] = request.request_uri
session[:return_to] = request.fullpath
flash[:notice] = "You must be an official or administrator to access this page"
store_location_and_redirect_to_login
return false
Expand Down Expand Up @@ -235,7 +235,7 @@ def store_location_and_redirect_to_login
session[:return_to] = request.referrer
render :update do |page| page.redirect_to(new_person_session_url(secure_redirect_options)) end
else
session[:return_to] = request.request_uri
session[:return_to] = request.fullpath
redirect_to new_person_session_url(secure_redirect_options)
end
end
Expand Down
6 changes: 2 additions & 4 deletions app/controllers/posts_controller.rb
Expand Up @@ -86,8 +86,7 @@ def post_private_reply
@post = Post.new(params[:post])
@mailing_list = MailingList.find(@post.mailing_list_id)
if @post.valid?
private_reply_email = MailingListMailer.create_private_reply(@post, @reply_to.sender)
MailingListMailer.deliver(private_reply_email)
private_reply_email = MailingListMailer.private_reply(@post, @reply_to.sender).deliver
flash[:notice] = "Sent private reply '#{@post.subject}' to #{private_reply_email.to}"
redirect_to(:action => "confirm_private_reply", :mailing_list_name => @mailing_list.name)
else
Expand All @@ -100,8 +99,7 @@ def post_to_list
@mailing_list = MailingList.find(@post.mailing_list_id)
@post.mailing_list = @mailing_list
if @post.valid?
post_email = MailingListMailer.create_post(@post)
MailingListMailer.deliver(post_email)
post_email = MailingListMailer.post(@post).deliver
flash[:notice] = "Submitted new post: #{@post.subject}"
redirect_to(:action => "confirm", :mailing_list_name => @mailing_list.name)
else
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/admin/events_helper.rb
Expand Up @@ -30,7 +30,7 @@ def link_to_flyer(event)
if event.flyer.blank?
event.full_name
else
link_to event.full_name, event.flyer
link_to(event.full_name, event.flyer).html_safe
end
end

Expand All @@ -46,7 +46,7 @@ def link_to_parents(event)
html << " (#{e.friendly_class_name}): "
end
end
html
html.html_safe
end

# Choose POST or PUT. Not sure why we need this.
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/admin/races_helper.rb
Expand Up @@ -11,7 +11,7 @@ def link_to_events(race)
html << link_to(truncate(race.event.name, :length => 40), edit_admin_event_path(race.event), :class => "obvious")
html << ": "

html
html.html_safe
end

# BAR category or Rider Rankings category
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/events_helper.rb
Expand Up @@ -38,7 +38,7 @@ def link_to_flyer(event)
if event.flyer.blank?
event.full_name
else
link_to event.full_name, event.flyer
link_to(event.full_name, event.flyer).html_safe
end
end
end
3 changes: 1 addition & 2 deletions app/helpers/posts_helper.rb
Expand Up @@ -130,5 +130,4 @@ def post_navigation(post)
}
}
end

end
end
8 changes: 4 additions & 4 deletions app/helpers/results_helper.rb
Expand Up @@ -10,9 +10,9 @@ def link_to_results(text, result)
end

if result.competition_result?
"<a href=\"/events/#{result.event_id}/people/#{result.person_id}/results##{result.race_id}\"#{html_options}>#{text}</a>"
"<a href=\"/events/#{result.event_id}/people/#{result.person_id}/results##{result.race_id}\"#{html_options}>#{text}</a>".html_safe
else
"<a href=\"/people/#{result.person_id}/#{result.year}\"#{html_options}>#{text}</a>"
"<a href=\"/people/#{result.person_id}/#{result.year}\"#{html_options}>#{text}</a>".html_safe
end
end

Expand All @@ -21,9 +21,9 @@ def link_to_team_results(text, result)
return text unless result.team_id

if result.team_competition_result?
"<a href=\"/events/#{result.event_id}/teams/#{result.team_id}/results/#{result.race_id}\">#{text}</a>"
"<a href=\"/events/#{result.event_id}/teams/#{result.team_id}/results/#{result.race_id}\">#{text}</a>".html_safe
else
"<a href=\"/teams/#{result.team_id}/#{result.year}\">#{text}</a>"
"<a href=\"/teams/#{result.team_id}/#{result.year}\">#{text}</a>".html_safe
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/tabs_helper.rb
Expand Up @@ -3,7 +3,7 @@ module TabsHelper
def tabs(select_current_page = true)
tabs = Tabs.new(controller)
yield tabs
tabs.to_html select_current_page
tabs.to_html(select_current_page).html_safe
end

class Tabs
Expand Down
2 changes: 1 addition & 1 deletion app/models/editor_request.rb
Expand Up @@ -34,7 +34,7 @@ def destroy_duplicates
end

def send_email
EditorRequestMailer.deliver_request(self)
EditorRequestMailer.request(self).deliver
end

# Make +editor+ an editor of +person+
Expand Down
14 changes: 9 additions & 5 deletions app/models/notifier.rb
Expand Up @@ -3,10 +3,14 @@ class Notifier < ActionMailer::Base
def password_reset_instructions(people)
Notifier.default_url_options[:host] = RacingAssociation.current.rails_host

subject "Password Reset Instructions"
from "#{RacingAssociation.current.short_name} <#{RacingAssociation.current.email}>"
recipients people.first.email_with_name
sent_on Time.zone.now
body :edit_password_reset_urls => people.map { |person| edit_password_reset_url(person.perishable_token) }, :people => people
@edit_password_reset_urls = people.map { |person| edit_password_reset_url(person.perishable_token) }
@people = people

mail(
:subject => "Password Reset Instructions",
:from => "#{RacingAssociation.current.short_name} <#{RacingAssociation.current.email}>",
:recipients => people.first.email_with_name,
:sent_on => Time.zone.now
)
end
end
2 changes: 1 addition & 1 deletion app/models/person.rb
Expand Up @@ -237,7 +237,7 @@ def Person.select_by_recent_activity(people)

def Person.deliver_password_reset_instructions!(people)
people.each(&:reset_perishable_token!)
Notifier.deliver_password_reset_instructions(people)
Notifier.password_reset_instructions(people).deliver
end

def people_with_same_name
Expand Down
Expand Up @@ -16,7 +16,7 @@
<%= label(:event, :sanctioned_by, "#{check_box(:event, :sanctioned_by)} #{RacingAssociation.current.short_name}?", :class => "check_box") %>
</div>

<% table :class => "clear people", :id => :people do %>
<%= table :class => "clear people", :id => :people do %>
<tr>
<th class="span-1">Place</th>
<th class="span-1">Number</th>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/categories/index.html.erb
Expand Up @@ -3,10 +3,10 @@
<% #We're small enough we can recompute competitions on demand. alp -%>
<% if RacingAssociation.current.competitions.include?(:mbra_bar) -%>
<div class="left">
<p><% form_tag "/admin/categories/recompute_bar" do -%>
<p><%= form_tag "/admin/categories/recompute_bar" do -%>
<%= submit_tag "Recompute MBRA BAR", :id => "recompute_bar" %>
<% end -%></p>
<p><% form_tag "/admin/categories/recompute_team_bar" do -%>
<p><%= form_tag "/admin/categories/recompute_team_bar" do -%>
<%= submit_tag "Recompute MBRA BAT", :id => "recompute_bar" %>
<% end -%></p>
</div>
Expand Down
8 changes: 4 additions & 4 deletions app/views/admin/events/_events.html.erb
Expand Up @@ -6,15 +6,15 @@
{ :class => "image" }) if @event.has_results_including_children? }
</div>
} %>
<% table :caption => nav_caption, :class => "box-3 last", :columns => 3, :insert_header => true do %>
<%= table :caption => nav_caption, :class => "box-3 last", :columns => 3, :insert_header => true do %>
<%- @event.children_and_child_competitions.each do |single_day_event| -%>
<tr id="event_<%= single_day_event.id %>_row">
<td class='nowrap'><%= link_to single_day_event.date.strftime('%A, %B %d'), edit_admin_event_path(single_day_event) %></td>
<td class='link'><%= link_to single_day_event.name, edit_admin_event_path(single_day_event) %></td>
<td class="right"><%= link_to_remote(image_tag('/images/icons/delete.png'),
<td class="right"><%= link_to(image_tag('/images/icons/delete.png'),
:remote => true,
:url => admin_event_path(single_day_event),
:html => { :class => "image", :id => "destroy_event_#{single_day_event.id}", :title => "Delete event" },
:complete => evaluate_remote_response,
:method => :delete) if administrator?
%></td>
</tr>
Expand All @@ -26,7 +26,7 @@
<% end -%>
</td>
<td class='link'></td>
<td class="right"><%= link_to_remote(image_tag("/images/icons/add.png"),
<td class="right"><%= link_to(image_tag("/images/icons/add.png"), :remote => true,
:url => new_admin_event_path(:event => { :parent_id => @event.id, :type => @event.is_a?(MultiDayEvent) ? "SingleDayEvent" : "Event" }),
:html => { :class => "image", :id => "new_event" },
:method => "post") if administrator? && !@event.new_record?
Expand Down
14 changes: 8 additions & 6 deletions app/views/admin/events/_races.html.erb
Expand Up @@ -6,7 +6,7 @@
{ :class => "image" }) if @event.has_results_including_children? }
</div>
} %>
<% table :caption => nav_caption, :class => "event_nav clear span-3", :insert_header => true, :columns => 4 do %>
<%= table :caption => nav_caption, :class => "event_nav clear span-3", :insert_header => true, :columns => 4 do %>
<%= render @event.races %>
<% unless @event.new_record? || @event.races.any? %>
<tr>
Expand All @@ -17,28 +17,30 @@
<tr id="create_race_row">
<td>
<%= image_tag "icons/spinner.gif", :id => "propagate_races_progress", :style => "display: none" %>
<%= link_to_remote("Copy to child events",
<%= link_to("Copy to child events",
:url => propagate_admin_event_races_path(@event),
:remote => true,
:before => "$('propagate_races').hide({queue: 'front'}); $('propagate_races_progress').show({queue: 'front'})",
:html => { :class => "obvious", :id => "propagate_races", :title => "Add same races to all children events" }
) if @event.races.any? && @event.children.any?
%>
</td>
<td class="right delete_all_races">
<%= link_to_remote("Delete all races",
<%= link_to("Delete all races",
:url => destroy_races_admin_event_path(@event),
:remote => true,
:html => { :class => "obvious", :id => "destroy_races", :title => "Delete all" },
:method => :delete,
:before => "$('destroy_races').hide({queue: 'front'}); $('destroy_races_progress').show({queue: 'front'})",
:complete => evaluate_remote_response,
:confirm => (Rails.env.acceptance?) ? nil : "Really delete all races from #{@event.name}?") if @event.races.any? && administrator?
# Lame workaround for Safari
%>
<%= image_tag "icons/spinner.gif", :id => "destroy_races_progress", :style => "display: none" %>
</td>
<td class="right">
<%= link_to_remote image_tag("/images/icons/add.png"),
<%= link_to image_tag("/images/icons/add.png"),
:url => admin_event_races_path(@event),
:remote => true,
:html => { :class => "image", :id => "create_race", :title => "Add race" }
%>
</td>
Expand All @@ -48,7 +50,7 @@
<div class="page_buttons">
<% if administrator? -%>
<%= label_tag :results_file, "Import Results", :class => "left", :id => "upload_form_label" %>
<% form_tag upload_admin_event_path(@event), :multipart => true, :id => "upload_form", :style => "clear" do %>
<%= form_tag upload_admin_event_path(@event), :multipart => true, :id => "upload_form", :style => "clear" do %>
<div>
<%= file_field_tag "results_file",
:style => "width: 250px;",
Expand Down
6 changes: 3 additions & 3 deletions app/views/admin/events/edit.html.erb
Expand Up @@ -11,8 +11,8 @@
<%= render :partial => "races", :object => @event %>
</div>
<div class="span-3 last">
<%= form_for(:event,
@event,
<%= form_for(@event,
:as => :event,
:url => @event.new_record? ? admin_events_path : admin_event_path(@event),
:html => { :method => form_method_for(@event) }) do |f| -%>
<div class="span-3 last no_top_margin">
Expand Down Expand Up @@ -168,7 +168,7 @@
end -%>
<% if !@event.new_record? && administrator? -%>
<% javascript_tag do %>
<%= javascript_tag do %>
$('event_promoter_id').change(function () {
if ($('event_promoter_id').val() == '') {
$('edit_promoter_link').hide();
Expand Down
12 changes: 6 additions & 6 deletions app/views/admin/events/index.html.erb
Expand Up @@ -9,7 +9,7 @@ end -%>

<div class="page_buttons container">
<div class="left">
<% form_tag upload_schedule_admin_events_path, :multipart => true, :id => "upload_form" do %>
<%= form_tag upload_schedule_admin_events_path, :multipart => true, :id => "upload_form" do %>
<label class="left">Import Schedule</label><%= file_field_tag "schedule_file", :onchange => "$('upload_form').submit();" %>
<% end -%>
</div>
Expand All @@ -19,8 +19,8 @@ end -%>
</div>

<div class="container">
<%- for month in @schedule.months -%>
<% table :class => "calendar", :caption => "<a name='#{month.name}'>#{month.name} #{@year}</a>" do %>
<%- @schedule.months.each do |month| -%>
<%= table :class => "calendar", :caption => "<a name='#{month.name}'>#{month.name} #{@year}</a>" do %>
<tr>
<th>Sunday</th>
<th>Monday</th>
Expand All @@ -30,15 +30,15 @@ end -%>
<th>Friday</th>
<th>Saturday</th>
</tr>
<%- for week in month.weeks -%>
<%- month.weeks.each do |week| -%>
<tr class="month">
<%- for day in week.days -%>
<%- week.days.each do |day| -%>
<%- if day.other_month? -%>
<td class="day_from_other_month"><div class="number"><%= day.day_of_month -%></div>
<%- else -%>
<td class="day">
<div class="number"><%= day.day_of_month -%></div>
<%- for event in day.events -%>
<%- day.events.each do |event| -%>
<div class="event"><%= link_to event.full_name, edit_admin_event_path(event) %></div>
<%- end -%>
<%- end -%>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/first_aid_providers/index.html.erb
@@ -1,14 +1,14 @@
<% @page_title = 'First Aid' %>
<% form_tag({}, { :method => :get }) do %>
<%= form_tag({}, { :method => :get }) do %>
<div class="container">
<label for="past_events" class="check_box left"><%= check_box_tag "past_events", "true", @past_events, :onclick => "form.submit();" %>Show past events</label>
<%= hidden_field_tag "sort_by", @sort_by %>
<%= hidden_field_tag "sort_direction", params[:sort_direction] %>
</div>
<% end -%>
<% table :caption => "#{Date.today.year} First Aid", :class => "first_aid_providers", :id => :events, :collection => @events do %>
<%= table :caption => "#{Date.today.year} First Aid", :class => "first_aid_providers", :id => :events, :collection => @events do %>
<tr>
<%= th(:first_aid_provider, :title => "Provider", :class => "name", :sort_params => { :past_events => @past_events }) %>
<%= th(:chief_referee, :title => "Chief Referee", :class => "name", :sort_params => { :past_events => @past_events }) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/pages/_page.html.erb
@@ -1,4 +1,4 @@
<% content_tag :tr, :class => cycle("even", "odd"), :id => "page_#{page.id}_row" do %>
<%= content_tag :tr, :class => cycle("even", "odd"), :id => "page_#{page.id}_row" do %>
<td class="title" style="padding-left: <%= 16 + page.depth * 16 %>px"><%= in_place_editor_field :page, :title, page, true %>
</td>
<td class="updated not_editable">
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/pages/edit.html.erb
Expand Up @@ -9,7 +9,7 @@
<%= f.labelled_text_field :slug, "Slug", :label => { :class => "top" } %>
<%= f.label :parent_id, "Parent", :class => "top" %>
<%= f.select :parent_id, @page.valid_parents.sort_by(&:path).collect { |p| [ "#{p.title} (#{p.path})", p.id ] }, { :include_blank => true } %>
<% table :caption => "Versions", :class => "versions box-2 top_margin", :id => :versions, :insert_header => true, :columns => 2 do %>
<%= table :caption => "Versions", :class => "versions box-2 top_margin", :id => :versions, :insert_header => true, :columns => 2 do %>
<%= render :partial => "version", :collection => @page.versions.sort_by(&:lock_version).reverse, :locals => { :selected => @page.versions.latest } %>
<% end -%>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/pages/index.html.erb
@@ -1,4 +1,4 @@
<% table :class => "pages", :id => :pages do %>
<%= table :class => "pages", :id => :pages do %>
<tr>
<th class="title">Title</th>
<th class="updated">Updated</th>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/pages/versions/edit.html.erb
Expand Up @@ -6,7 +6,7 @@
<%= labelled_text :version, :slug, "Slug", @version.slug, {:class => "left"} %>
<%= labelled_text :version, :parent_id, "Parent", ("#{@parent.title} (#{@parent.path})" if @parent), {:class => "left"} %>
<% table :caption => "Versions", :class => "versions box-2 top_margin", :id => :versions, :insert_header => true, :columns => 2 do %>
<%= table :caption => "Versions", :class => "versions box-2 top_margin", :id => :versions, :insert_header => true, :columns => 2 do %>
<%= render :partial => "admin/pages/version",
:collection => @version.page.versions.sort_by(&:lock_version).reverse,
:locals => { :selected => @version } %>
Expand Down

0 comments on commit 33e35a0

Please sign in to comment.