From e92fb33275b9b4909b608daa3a9ddfa0b9fc53a4 Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Sun, 20 Jan 2013 15:24:14 -0500 Subject: [PATCH] Improved quotes --- app/assets/stylesheets/forum-monster.css.scss | 23 ++++++++++++++++++- app/controllers/posts_controller.rb | 4 ++-- app/controllers/topics_controller.rb | 10 ++++++++ app/helpers/application_helper.rb | 10 +------- app/views/topics/show.html.erb | 2 +- 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/app/assets/stylesheets/forum-monster.css.scss b/app/assets/stylesheets/forum-monster.css.scss index ed47101..b2bb939 100755 --- a/app/assets/stylesheets/forum-monster.css.scss +++ b/app/assets/stylesheets/forum-monster.css.scss @@ -54,4 +54,25 @@ blockquote { font-style: italic; margin: 10px 0px 0px 25px; padding: 10px; - } \ No newline at end of file + } + + blockquote span.a, blockquote span.b { + font-family: helvetica, arial; font-size: 50px; color: #8ac; + } + + blockquote span.a { + position: relative; + top:0.2em; + } + + blockquote span.b { + position:relative; + top:0.8em; + } + + blockquote cite { + display: block; + text-align: left; + font-style: normal; + font-weight:bold; + } diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 5850937..68d810a 100755 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -6,7 +6,7 @@ class PostsController < ApplicationController if params[:quote] quote_post = Post.find(params[:quote]) if quote_post - @post.body = "[quote]#{quote_post.body}[/quote]" + @post.body = "[quote=#{quote_post.user.username}]#{quote_post.body}[/quote]" end end end @@ -42,4 +42,4 @@ class PostsController < ApplicationController end end -end \ No newline at end of file +end diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 3b00f87..3b5b7cc 100755 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -4,6 +4,16 @@ class TopicsController < ApplicationController def show @topic.hit! if @topic + + @my_blockquote = { + 'Quote' => [ + /\[quote(:.*)?=(.*?)\](.*?)\[\/quote\1?\]/mi, + '
\2\3
', + 'Quote with citation', + '[quote=mike]please quote me[/quote]', + :quote + ], + } end def create diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0336ac0..a2f4870 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,11 +1,3 @@ module ApplicationHelper - @my_blockquote = { - 'Quote' => [ - /\[quote\](.*?)\[\/quote\1?\]/mi, - '
\3
', - 'Quote with citation', - '[quote=mike]please quote me[/quote]', - :quote - ], - } + end diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 37eca35..9b389c7 100755 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -35,7 +35,7 @@ - <%= post.body.bbcode_to_html().html_safe %> + <%= post.body.bbcode_to_html(@my_blockquote).html_safe %> <%end%>