Permalink
Browse files

More fixing html_safe, queries, etc

  • Loading branch information...
1 parent cc54d5b commit b9d69297b3ca17fdbf26b9d87c3de6beadf6813a @jamesu committed Aug 21, 2011
View
@@ -9,6 +9,7 @@ gem 'uglifier'
gem 'paperclip'
gem 'dynamic_form'
gem 'will_paginate', '~> 3.0'
+gem 'RedCloth'
#group :test, :development do
# gem 'rspec-rails', '~> 2.3.1'
View
@@ -8,6 +8,7 @@ GIT
GEM
remote: http://rubygems.org/
specs:
+ RedCloth (4.2.8)
actionmailer (3.1.0.rc4)
actionpack (= 3.1.0.rc4)
mail (~> 2.3.0)
@@ -118,6 +119,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ RedCloth
cancan
choices!
dynamic_form
@@ -121,7 +121,7 @@ def new
if @category
@message.category_id = @category.id
else
- @category = @active_project.project_message_categories.where(:conditions => ['name = ?', Rails.configuration.default_project_message_category]).first
+ @category = @active_project.project_message_categories.where(['name = ?', Rails.configuration.default_project_message_category]).first
end
@message.comments_enabled = true unless (params[:message] and params[:message].has_key?(:comments_enabled))
@@ -67,7 +67,7 @@ def action_list(actions)
else
nil
end
- end.compact.join(' | ')
+ end.compact.join(' | ').html_safe
end
def tag_list(object)
@@ -219,9 +219,9 @@ def cal_table(in_rows, tableclass)
"<th class=\"month\" rowspan=\"#{column[2]}\">#{column[1]}</th>"
end
end
- "<tr>#{columns}</tr>"
+ "<tr>#{columns.join}</tr>"
end
- "<table class=\"#{tableclass}\"><tbody>#{rows}</tbody></table>".html_safe
+ "<table class=\"#{tableclass}\"><tbody>#{rows.join}</tbody></table>".html_safe
end
# offset: Use date.wday, so use 0 to start the week in sunday
@@ -306,6 +306,6 @@ def textilize(text)
textilized = RedCloth.new(text, [ :hard_breaks, :filter_html ])
textilized.hard_breaks = true if textilized.respond_to?('hard_breaks=')
- textilized.to_html
+ textilized.to_html.html_safe
end
end
View
@@ -26,7 +26,7 @@ class Comment < ActiveRecord::Base
has_many :attached_file, :as => 'rel_object'
has_many :project_file, :through => :attached_file
- before_validation :on => :create, :process_params
+ before_validation :process_params, :on => :create
after_create :process_create
before_update :process_update_params
before_destroy :process_destroy
View
@@ -25,8 +25,6 @@ class Tag < ActiveRecord::Base
belongs_to :rel_object, :polymorphic => true
- acts_as_ferret :fields => [:tag, :project_id, :is_private], :store_class_name => true
-
before_create :process_params
def process_params
@@ -27,7 +27,7 @@
<% elsif not comment.created_by.nil? %>
<%= :comment_posted_with_user.l_with_args(
:time => format_usertime(comment.created_on, :comment_posted_format),
- :user => "<a href=\"#{comment.created_by.object_url}\">#{h(comment.created_by.display_name)}</a>") %>
+ :user => "<a href=\"#{comment.created_by.object_url}\">#{h(comment.created_by.display_name)}</a>").html_safe %>
<% else %>
<%= format_usertime(comment.created_on, :comment_posted_format) %>
<% end %>
@@ -7,11 +7,11 @@
<div class="hint" id="new_account_info">
<div class="header"><%= :welcome_to_new_account.l %></div>
- <div class="content"><%= :welcome_to_new_account_info.l_with_args(:user => h(@logged_user.display_name), :url => "<a href=\"#{Rails.configuration.site_url}\">#{Rails.configuration.site_url}</a>") %></div>
+ <div class="content"><%= :welcome_to_new_account_info.l_with_args(:user => h(@logged_user.display_name), :url => "<a href=\"#{Rails.configuration.site_url}\">#{Rails.configuration.site_url}</a>").html_safe %></div>
<% new_account_steps(@logged_user).each do |step| %>
- <div class='header'><%= step[:del] ? "<del>#{step[:title]}</del>" : "#{step[:title]}" %></div>
- <div class='content'><%= step[:del] ? "<del>#{step[:content]}</del>" : "#{step[:content]}" %></div>
+ <div class='header'><%= raw step[:del] ? "<del>#{step[:title]}</del>" : "#{step[:title]}" %></div>
+ <div class='content'><%= raw step[:del] ? "<del>#{step[:content]}</del>" : "#{step[:content]}" %></div>
<% end %>
<% if @logged_user.is_admin %>
<p><%= link_to :hide_welcome_info.l, hide_welcome_info_company_path(Company.owner), :class => 'cancel' %></p>
@@ -27,7 +27,7 @@
<h2><%= :late_milestones.l %></h2>
<ul>
<% @late_milestones.each do |milestone| %>
- <li><% unless milestone.assigned_to.nil? %><%= h milestone.assigned_to.object_name %>: <% end %><%= :milestone_in.l_with_args(:milestone => link_to(h(milestone.name), milestone_path(:id => milestone.id, :active_project => milestone.project)), :project => link_to(h(milestone.project.name), project_path(:id => milestone.project.id))) %> (<span class="error"><%= :milestone_days_late.l_with_args(:days => milestone.days_late) %></span>)</li>
+ <li><% unless milestone.assigned_to.nil? %><%= h milestone.assigned_to.object_name %>: <% end %><%= :milestone_in.l_with_args(:milestone => link_to(h(milestone.name), milestone_path(:id => milestone.id, :active_project => milestone.project)), :project => link_to(h(milestone.project.name), project_path(:id => milestone.project.id))).html_safe %> (<span class="error"><%= :milestone_days_late.l_with_args(:days => milestone.days_late) %></span>)</li>
<% end %>
</ul>
<% end %>
@@ -22,7 +22,7 @@
<%=
project.companies.collect do |company|
link_to( (h company.name), company_path(:id => company.id) )
- end.join(', ')
+ end.join(', ').html_safe
%>
</div>
<% end %>
@@ -9,7 +9,7 @@
<% if not message.created_by.nil? %>
<div class="messageAuthor"><%= :message_created_with_user.l_with_args(
:time => format_usertime(message.created_on, :message_created_format),
- :user => link_to( h(message.created_by.display_name), user_path(:id => message.created_by.id))) %></div>
+ :user => link_to( h(message.created_by.display_name), user_path(:id => message.created_by.id))).html_safe %></div>
<% else %>
<div class="messageAuthor"><%= format_usertime(message.created_on, :message_created_format) %></div>
<% end %>
@@ -2,8 +2,8 @@
<h2><%= :calendar_feeds.l %></h2>
<div class="blockContent">
<a href="<%= @logged_user.milestone_feed_url(@active_project, 'ics') %>" class="iCalSubscribe"><%= :ical.l %></a>
- <p><%= :calendar_feed_milestone_info.l %></p>
- <p><%= :calendar_feeds_password_warning.l %></p>
+ <p><%= :calendar_feed_milestone_info.l.html_safe %></p>
+ <p><%= :calendar_feeds_password_warning.l.html_safe %></p>
</div>
</div>
@@ -18,7 +18,7 @@
<br /><span class="desc"><%=
:milestone_completed_time_with_user.l_with_args(
:time => format_usertime(milestone.completed_on, :milestone_completed_time_format),
- :user => (link_to milestone.completed_by.display_name, user_path(:id => milestone.completed_by.id))) %></span>
+ :user => (link_to milestone.completed_by.display_name, user_path(:id => milestone.completed_by.id))).html_safe %></span>
<% end %>
</li>
<% end %>
@@ -50,7 +50,7 @@
<% if not (milestone.project_messages.length > 0 or milestone.project_task_lists.length > 0) %>
<p><%= :milestone_empty_info.l_with_args(
:message => link_to(:message.l, new_message_path(:milestone_id => milestone.id)),
- :task_list => link_to(:task_list.l, new_task_list_path(:milestone_id => milestone.id))) %></p>
+ :task_list => link_to(:task_list.l, new_task_list_path(:milestone_id => milestone.id))).html_safe %></p>
<% else %>
<% if milestone.project_messages.length > 0 %>
<p><%= :messages.l %>:</p>
@@ -60,7 +60,7 @@
<% if not message.created_by.nil? %>
<span class="desc">(<%= :milestone_messages_created_with_user.l_with_args(
:time => format_usertime(message.created_on, :milestone_messages_created_format),
- :user => link_to(h(message.created_by.display_name), user_path(:id => message.created_by.id) )) %>)</span>
+ :user => link_to(h(message.created_by.display_name), user_path(:id => message.created_by.id) )).html_safe %>)</span>
<% end %>
<% end %>
</ul>
View
@@ -4,7 +4,7 @@
match 'feed/:user/:token/:action.::format', :controller => 'feed'
# The rest of the simple controllers
- match "dashboard/:action(/:id)", :controller => 'dashboard'
+ match "dashboard/(/:action(/:id))", :controller => 'dashboard'
match "dashboard/:action/:id.format", :controller => 'dashboard'
resource :session, :only => [:new, :create, :destroy]

0 comments on commit b9d6929

Please sign in to comment.