Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gem 'simple_form', git: "https://github.com/bitzesty/bootstrap_form.git"
gem "semantic_menu", git: "git://github.com/michaek/semantic_menu.git"

gem 'will_paginate' # Pagination
gem 'rdiscount' # Markdown
gem 'redcarpet', '~> 3.0' # Markdown

group :development do
# Use unicorn as the web server
Expand Down
7 changes: 3 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,9 @@ GEM
thor (~> 0.14.6)
raindrops (0.8.0)
rake (10.1.0)
rdiscount (1.6.8)
rdoc (3.12.2)
json (~> 1.4)
redcarpet (2.1.0)
redcarpet (3.0.0)
responders (0.6.5)
rest-client (1.6.7)
mime-types (>= 1.16)
Expand Down Expand Up @@ -215,7 +214,7 @@ GEM
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
slop (2.4.3)
slop (2.4.4)
sprockets (2.0.4)
hike (~> 1.2)
rack (~> 1.0)
Expand Down Expand Up @@ -268,7 +267,7 @@ DEPENDENCIES
pg
pry
rails (= 3.1.11)
rdiscount
redcarpet (~> 3.0)
rspec-rails
sass-rails (~> 3.1.0)
semantic_menu!
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ module ApplicationHelper
def program_path program
"/users/#{program.author_username}/programs/#{program.slug}"
end

def markdown(text)
Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(hard_wrap: true), autolink: true).render(text).html_safe
end
end
2 changes: 1 addition & 1 deletion app/models/deleted_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def email
def to_param
'deleted_user'
end
end
end
3 changes: 1 addition & 2 deletions app/views/answers/_list.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
.meta
#{link_to list.user.username, user_path(list.user)} says
.description
:markdown
#{list.description}
=markdown(list.description)

.links
- if can? :update, list
Expand Down
3 changes: 1 addition & 2 deletions app/views/blog/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
= post.created_at.strftime("Posted %B %d, %Y at %l:%M %p")

.content
:markdown
#{post.content}
=markdown(post.content)

3 changes: 1 addition & 2 deletions app/views/blog/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
= @post.created_at.strftime("Posted %B %d, %Y at %l:%M %p")

.content
:markdown
#{@post.content}
=markdown(@post.content)
3 changes: 1 addition & 2 deletions app/views/lessons/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
#lesson-content
= lesson_categories @lesson

:markdown
#{@lesson.output}
=markdown(@lesson.output)
2 changes: 1 addition & 1 deletion app/views/questions/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- content_for :title do
New Question

= render 'form'
= render 'form'
3 changes: 1 addition & 2 deletions app/views/questions/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@


.description
:markdown
#{resource.description}
=markdown(resource.description)

%h2= pluralize(resource.answers.count, "response")
%ul.answers
Expand Down
2 changes: 1 addition & 1 deletion app/views/static/faq.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@

## Thanks!

Special thanks goes out to Eric Affleck for writing this FAQ.
Special thanks goes out to Eric Affleck for writing this FAQ.