mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
Get all non-cucumber tests passing
This commit is contained in:
parent
bb8b5a4c72
commit
12d8915eda
7 changed files with 30 additions and 22 deletions
|
|
@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
helper :application
|
||||
include LoginSystem
|
||||
helper_method :current_user, :prefs, :format_date, :markdown
|
||||
helper_method :current_user, :prefs, :format_date
|
||||
|
||||
layout proc{ |controller| controller.mobile? ? "mobile" : "standard" }
|
||||
exempt_from_layout /\.js\.erb$/
|
||||
|
|
|
|||
|
|
@ -1242,7 +1242,7 @@ class TodosController < ApplicationController
|
|||
def todo_feed_content
|
||||
# TODO: move view stuff into view, also the includes at the top
|
||||
lambda do |i|
|
||||
item_notes = sanitize(markdown( i.notes )) if i.notes?
|
||||
item_notes = i.rendered_notes if i.notes?
|
||||
due = "<div>#{t('todos.feeds.due', :date => format_date(i.due))}</div>\n" if i.due?
|
||||
done = "<div>#{t('todos.feeds.completed', :date => format_date(i.completed_at))}</div>\n" if i.completed?
|
||||
context_link = "<a href=\"#{ context_url(i.context) }\">#{ i.context.name }</a>"
|
||||
|
|
|
|||
|
|
@ -189,19 +189,6 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def format_note(note)
|
||||
note = auto_link_message(note)
|
||||
note = markdown(note)
|
||||
note = auto_link(note, :link => :urls)
|
||||
|
||||
# add onenote and message protocols
|
||||
Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'onenote'
|
||||
Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'message'
|
||||
|
||||
note = Sanitize.clean(note, Sanitize::Config::RELAXED)
|
||||
return note
|
||||
end
|
||||
|
||||
def sidebar_html_for_titled_list (list, title)
|
||||
return content_tag(:h3, title+" (#{list.length})") +
|
||||
content_tag(:ul, sidebar_html_for_list(list))
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ module ProjectsHelper
|
|||
|
||||
def summary(project)
|
||||
project_description = ''
|
||||
project_description += sanitize(markdown( project.description )) unless project.description.blank?
|
||||
project_description += Tracks::Utils.render_text( project.description ) unless project.description.blank?
|
||||
project_description += content_tag(:p,
|
||||
"#{count_undone_todos_phrase(p)}. " + t('projects.project_state', :state => project.state)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -398,10 +398,10 @@ class Todo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def render_note
|
||||
unless notes.nil?
|
||||
rendered_notes = Tracks::Utils.render_text(notes)
|
||||
unless self.notes.nil?
|
||||
self.rendered_notes = Tracks::Utils.render_text(notes)
|
||||
else
|
||||
rendered_notes = nil
|
||||
self.rendered_notes = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Tracks
|
|||
# do not change string; URL is alreay linked
|
||||
href
|
||||
else
|
||||
content = content_tag(:a, h(href), :href => h(href))
|
||||
content = helpers.content_tag(:a, h(href), :href => h(href))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -22,7 +22,7 @@ module Tracks
|
|||
def self.render_text(text)
|
||||
rendered = Tracks::Utils.auto_link_message(text)
|
||||
rendered = markdown(rendered)
|
||||
rendered = ActionController::Base.helpers.auto_link(rendered, :link => :urls)
|
||||
rendered = helpers.auto_link(rendered, :link => :urls)
|
||||
|
||||
# add onenote and message protocols
|
||||
Sanitize::Config::RELAXED[:protocols]['a']['href'] << 'onenote'
|
||||
|
|
@ -39,7 +39,13 @@ module Tracks
|
|||
def self.markdown(text)
|
||||
RedCloth.new(text).to_html
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def self.helpers
|
||||
ActionController::Base.helpers
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -386,4 +386,19 @@ class TodoTest < ActiveSupport::TestCase
|
|||
assert !recent_created_todos.include?(todo_old)
|
||||
end
|
||||
|
||||
def test_notes_are_rendered_on_save
|
||||
user = @completed.user
|
||||
todo = user.todos.create(:description => "test", :context => @completed.context)
|
||||
|
||||
assert_nil todo.notes
|
||||
assert_nil todo.rendered_notes
|
||||
|
||||
todo.notes = "*test*"
|
||||
todo.save!
|
||||
todo.reload
|
||||
|
||||
assert_equal "*test*", todo.notes
|
||||
assert_equal "<p><strong>test</strong></p>", todo.rendered_notes
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue