From 02fbae0cfc0b6750c93eaa337a4c2005c9d06a72 Mon Sep 17 00:00:00 2001 From: Miles Gould Date: Fri, 9 Nov 2012 12:06:18 +0000 Subject: [PATCH] Use Markdown to display updates --- Gemfile | 3 ++- Gemfile.lock | 2 ++ app/views/members/show.html.haml | 2 +- app/views/updates/_single.html.haml | 7 +++++-- app/views/updates/index.html.haml | 2 +- app/views/updates/show.html.haml | 9 +-------- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 3c0a1afc4..bbdd0f0ad 100644 --- a/Gemfile +++ b/Gemfile @@ -48,7 +48,8 @@ gem 'capistrano-ext' # To use debugger # gem 'debugger' -# GROWSTUFF ADDITIONS BELOW HERE +# Markdown formatting for updates etc +gem 'bluecloth' # user signup/login/etc gem 'devise' diff --git a/Gemfile.lock b/Gemfile.lock index 5f89daaf5..24da9dfc5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,6 +30,7 @@ GEM multi_json (~> 1.0) arel (3.0.2) bcrypt-ruby (3.0.1) + bluecloth (2.2.0) builder (3.0.4) cape (1.5.0) capistrano (2.13.5) @@ -188,6 +189,7 @@ PLATFORMS ruby DEPENDENCIES + bluecloth bundler (>= 1.1.5) cape capistrano diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index be7ee996e..7dd956a3c 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -6,4 +6,4 @@ %h3 Updates %table - @user.updates.each do |update| - = render :partial => "updates/single", :locals => { :update => update } + = render :partial => "updates/single", :locals => { :update => update, :subject => true } diff --git a/app/views/updates/_single.html.haml b/app/views/updates/_single.html.haml index 6e740e9e4..d2f9fa653 100644 --- a/app/views/updates/_single.html.haml +++ b/app/views/updates/_single.html.haml @@ -1,5 +1,6 @@ %div.update - %h3= link_to update.subject, update + - if subject + %h3= link_to strip_tags(update.subject), update %div.update-meta Posted by @@ -7,7 +8,9 @@ at = update.created_at - %div.update-body= update.body + %div.update-body + :markdown + #{ strip_tags update.body } - if current_user == update.user %div.update-actions diff --git a/app/views/updates/index.html.haml b/app/views/updates/index.html.haml index 978c635d3..610beee98 100644 --- a/app/views/updates/index.html.haml +++ b/app/views/updates/index.html.haml @@ -1,6 +1,6 @@ = content_for :title, "Recent Growstuff member updates" - @updates.each do |update| - = render :partial => "single", :locals => { :update => update } + = render :partial => "single", :locals => { :update => update, :subject => true } = link_to 'New Update', new_update_path diff --git a/app/views/updates/show.html.haml b/app/views/updates/show.html.haml index 54dcb6b70..b73309fe1 100644 --- a/app/views/updates/show.html.haml +++ b/app/views/updates/show.html.haml @@ -1,13 +1,6 @@ = content_for :title, @update.subject -%p - %i - = "By " - = link_to @update.user.username, member_path(@update.user) - = " at #{@update.created_at}" - -%p - = @update.body += render :partial => "single", :locals => { :update => @update, :subject => false } = link_to 'Edit', edit_update_path(@update) \|