Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial markdown support for issue and maintenance text #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ def service_status_tag_for_status(status, options = {})
end
end

def markdown(text)
md = Redcarpet::Markdown.new(Redcarpet::Render::Safe)
return md.render(text).html_safe
end

end
6 changes: 3 additions & 3 deletions content/themes/default/views/pages/issue.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<% @updates.each do |update| %>
<div class='issueUpdates__update'>
<a name='update-<%=update.identifier%>'></a>
<p class='issueUpdates__text'>
<div class='issueUpdates__text'>
<b class='issueUpdate__state issueUpdate__state--<%= update.state %>'><%= update.state.humanize %></b> &mdash;
<%= update.text %>
</p>
<%= markdown(update.text) %>
</div>
<p class='issueUpdates__meta'>
Posted <%= time_tag update.created_at%>
<% if update.user %>by <%= update.user.name %><% end %>
Expand Down
8 changes: 4 additions & 4 deletions content/themes/default/views/pages/maintenance.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<h1 class='issueDetail__title'><%= @maintenance.title %></h1>
<p class='issueDetail__date'>Scheduled for <%= @maintenance.start_at.strftime("%A #{@maintenance.start_at.day.ordinalize} %B %Y at %H:%M (#{site.time_zone})") %></p>
<p class='issueDetail__descriptionTitle'>Schedule/description of work</p>
<p class='issueDetail__description'><%= @maintenance.description %></p>
<div class='issueDetail__description'><%= markdown(@maintenance.description) %></div>

<dl class='issueDetail__details'>
<dt>Scheduled start time</dt>
Expand All @@ -35,9 +35,9 @@
<% @updates.each do |update| %>
<div class='issueUpdates__update'>
<a name='update-<%=update.identifier%>'></a>
<p class='issueUpdates__text'>
<%= update.text %>
</p>
<div class='issueUpdates__text'>
<%= markdown(update.text) %>
</div>
<p class='issueUpdates__meta'>
Posted <%= time_tag update.created_at%>
<% if update.user %>by <%= update.user.name %><% end %>
Expand Down