Permalink
Browse files

Add markdown gem and markdown code to front end

  • Loading branch information...
1 parent 9b2450d commit 8c18bafe7f5305d18284d6ec91c89cb948a718a0 Andy Zhang committed Mar 25, 2013
View
@@ -26,6 +26,7 @@ end
gem 'jquery-rails'
gem 'haml-rails'
+gem 'redcarpet'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
View
@@ -83,6 +83,7 @@ GEM
rake (10.0.3)
rdoc (3.12.2)
json (~> 1.4)
+ redcarpet (2.2.2)
ref (1.0.4)
sass (3.2.7)
sass-rails (4.0.0.beta1)
@@ -127,6 +128,7 @@ DEPENDENCIES
jquery-rails
pg
rails (= 4.0.0.beta1)
+ redcarpet
sass-rails (~> 4.0.0.beta1)
sqlite3
therubyracer
@@ -13,6 +13,10 @@ $ ->
$('#curated').append('</br><hr>')
commentsArray.push(commentJSON.commentId)
- $('.comments').click (event) ->
- event.preventDefault()
- window.open commentsLocation, 'comments', 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes'
+ $('#comments .open').click (event) ->
+ event.preventDefault()
+ window.open commentsLocation, 'comments', 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes'
+
+ $('.code a').click (event) ->
+ event.preventDefault()
+ $(@).parent().find('.codeblock').slideToggle()
@@ -0,0 +1,5 @@
+.codeblock
+ background: grey
+ border-radius: 5px
+ -moz-border-radius: 5px
+ display: none
@@ -0,0 +1,11 @@
+:markdown
+ javascript:
+
+ var commentsLocation;
+
+ commentsLocation = 'http://secret-cove-3320.herokuapp.com';
+
+ $('.comments .open').click(function(event) {
+ event.preventDefault();
+ window.open(commentsLocation, 'comments', 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes');
+ });
@@ -0,0 +1,20 @@
+:markdown
+ javascript:
+
+ var commentsArray = [];
+
+ $(window).on('message', function(event) {
+ var commentDataKeys, commentJSON, key, _i, _len;
+
+ commentJSON = event.originalEvent.data;
+ if (commentsArray.indexOf(commentJSON.commentId) !== -1) {
+ return;
+ }
+ commentDataKeys = ['commentId', 'commentAuthor', 'commentHTML'];
+ for (_i = 0, _len = commentDataKeys.length; _i < _len; _i++) {
+ key = commentDataKeys[_i];
+ $('#curated').append('<p>' + commentJSON[key] + '</p>');
+ }
+ $('#curated').append('</br><hr>');
+ commentsArray.push(commentJSON.commentId);
+ });
@@ -1,3 +1,11 @@
-%span.comments
- =link_to 'Open Comments'
+#comments
+ %h1.open= link_to 'Open Comments'
+ .code
+ = link_to 'Example Code'
+ .codeblock= render 'comments'
+
#curated
+ %h1 Curated Content Below
+ .code
+ = link_to 'Example Code'
+ .codeblock= render 'post_message'

0 comments on commit 8c18baf

Please sign in to comment.