diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js index f5f6da2..4b35aea 100644 --- a/app/assets/javascripts/editor.js +++ b/app/assets/javascripts/editor.js @@ -23,11 +23,7 @@ $(function() { prev.html("(Loading ...)"); prev.show(); editor.hide(); - if (target.parent().parent().hasClass('mini')) { - var url = '/tools/render_mini_markdown'; - } else { - var url = '/tools/render_markdown'; - } + var url = '/tools/render_markdown'; $.ajax(url, { type: 'post', data: {text: editor.val()}, diff --git a/app/controllers/tools_controller.rb b/app/controllers/tools_controller.rb index ae86f76..b2a8092 100644 --- a/app/controllers/tools_controller.rb +++ b/app/controllers/tools_controller.rb @@ -8,12 +8,4 @@ class ToolsController < ApplicationController end end - def render_mini_markdown - if current_user - render text: render_mini_md(params[:text]) - else - render text: "Error: You are not logged in!" - end - end - end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0390858..e3a2a25 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -69,34 +69,6 @@ module ApplicationHelper render_youtube(md.render(content)) end - def render_mini_md(content) - renderer = Redcarpet::Render::HTML.new({ - filter_html: true, - no_images: true, - no_styles: true, - safe_links_only: true, - with_toc_data: false, - hard_wrap: false, - link_attributes: {rel: "nofollow"} - }) - md = Redcarpet::Markdown.new(renderer, { - no_intra_emphasis: true, - tables: false, - fenced_code_blocks: false, - autolink: true, - strikethrough: true, - lax_spacing: false, - disable_indented_code_blocks: true, - space_after_headers: true, - superscript: true, - underline: true, - highlight: true, - footnotes: false - }) - md.render(content.gsub(/([\r\n]+\s*?){3,}/, "\n\n").gsub(/^\s*#/, "\\#")) - end - - private def render_youtube(content) diff --git a/app/views/application/_md_editor.html.erb b/app/views/application/_md_editor.html.erb index 0344485..3a18645 100644 --- a/app/views/application/_md_editor.html.erb +++ b/app/views/application/_md_editor.html.erb @@ -1,4 +1,4 @@ -
<%= f.submit "Update Post", class: "btn blue left" %>
<% end %><%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right" %>
diff --git a/app/views/blogposts/new.html.erb b/app/views/blogposts/new.html.erb index ed67138..b923002 100644 --- a/app/views/blogposts/new.html.erb +++ b/app/views/blogposts/new.html.erb @@ -3,7 +3,7 @@<%= f.submit "Create Post", class: "btn blue left" %>
<% end %> diff --git a/app/views/comments/_new.html.erb b/app/views/comments/_new.html.erb index cc894a4..f4b2785 100644 --- a/app/views/comments/_new.html.erb +++ b/app/views/comments/_new.html.erb @@ -1,5 +1,5 @@<%= f.submit class: "btn blue" %>
<% end %> \ No newline at end of file diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index 16706cc..5416ab6 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -3,7 +3,7 @@<%= f.submit "Update Comment", class: "btn blue left" %>
<% end %><%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", data: {confirm: "Delete comment forever?"}, class: "btn red right" %>
diff --git a/app/views/forumthreads/edit.html.erb b/app/views/forumthreads/edit.html.erb index 863f563..cab2dd8 100644 --- a/app/views/forumthreads/edit.html.erb +++ b/app/views/forumthreads/edit.html.erb @@ -34,7 +34,7 @@<%= f.submit "Update thread", class: "btn blue left" %>
<% end %> <%= button_to "Delete thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %> diff --git a/app/views/forumthreads/new.html.erb b/app/views/forumthreads/new.html.erb index fec08e7..021e907 100644 --- a/app/views/forumthreads/new.html.erb +++ b/app/views/forumthreads/new.html.erb @@ -28,7 +28,7 @@<%= f.submit "Create thread", class: "btn blue left" %>
diff --git a/app/views/info/edit.html.erb b/app/views/info/edit.html.erb index c36f6ca..0135219 100644 --- a/app/views/info/edit.html.erb +++ b/app/views/info/edit.html.erb @@ -3,7 +3,7 @@<%= f.submit "Update Info", class: "btn blue left" %>
<% end %><%= button_to "Delete Info", @info, method: "delete", data: {confirm: "Delete Info forever?"}, class: "btn red right" %>
diff --git a/app/views/info/new.html.erb b/app/views/info/new.html.erb index 00d156f..55abdb7 100644 --- a/app/views/info/new.html.erb +++ b/app/views/info/new.html.erb @@ -3,7 +3,7 @@<%= f.submit "Create Info", class: "btn blue left" %>
<% end %> diff --git a/app/views/redstoner_mailer/new_post_comment_mail.html.erb b/app/views/redstoner_mailer/new_post_comment_mail.html.erb index 9728427..b3ab99a 100644 --- a/app/views/redstoner_mailer/new_post_comment_mail.html.erb +++ b/app/views/redstoner_mailer/new_post_comment_mail.html.erb @@ -5,8 +5,7 @@<%= link_to @comment.author.name, user_url(@comment.author), style: "text-decoration: none; color: #4096EE;" %> has replied to '<%= @comment.blogpost.title %>' on the Redstoner blog!
- <%# TODO: fix relative links + iframes %> - <%= render_mini_md(@comment.content).html_safe %> + <%= render_md(@comment.content).html_safe %>
<%= link_to "Click here", blogpost_url(@comment.blogpost) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.
diff --git a/app/views/redstoner_mailer/new_post_comment_mention_mail.html.erb b/app/views/redstoner_mailer/new_post_comment_mention_mail.html.erb index a923c0e..a65e4a3 100644 --- a/app/views/redstoner_mailer/new_post_comment_mention_mail.html.erb +++ b/app/views/redstoner_mailer/new_post_comment_mention_mail.html.erb @@ -5,8 +5,7 @@<%= link_to @comment.author.name, user_url(@comment.author), style: "text-decoration: none; color: #4096EE;" %> has mentioned you in '<%= @comment.blogpost.title %>' on the Redstoner blog!
- <%# TODO: fix relative links + iframes %> - <%= render_mini_md(@comment.content).html_safe %> + <%= render_md(@comment.content).html_safe %>
<%= link_to "Click here", blogpost_url(@comment.blogpost) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.
diff --git a/app/views/redstoner_mailer/new_post_mention_mail.html.erb b/app/views/redstoner_mailer/new_post_mention_mail.html.erb index 9efae11..5119e7c 100644 --- a/app/views/redstoner_mailer/new_post_mention_mail.html.erb +++ b/app/views/redstoner_mailer/new_post_mention_mail.html.erb @@ -5,8 +5,7 @@<%= link_to @post.author.name, user_url(@post.author), style: "text-decoration: none; color: #4096EE;" %> has mentioned you in '<%= @post.title %>' on the Redstoner blog!
- <%# TODO: fix relative links + iframes %> - <%= render_mini_md(@post.content).html_safe %> + <%= render_md(@post.content).html_safe %>
<%= link_to "Click here", blogpost_url(@post), style: "text-decoration: none; color: #4096EE;" %> to view the blog post.
diff --git a/app/views/threadreplies/_new.html.erb b/app/views/threadreplies/_new.html.erb index 93f227d..b0c4b5e 100644 --- a/app/views/threadreplies/_new.html.erb +++ b/app/views/threadreplies/_new.html.erb @@ -1,4 +1,4 @@ <%= form_for [reply.thread, reply] do |f| %> - <%= render partial: "md_editor", locals: {name: "threadreply[content]", content: reply.content, mini: false} %> + <%= render partial: "md_editor", locals: {name: "threadreply[content]", content: reply.content} %><%= f.submit "Reply#{ ' (Locked)' if reply.thread.locked? }", class: "btn blue" %>
<% end %> \ No newline at end of file diff --git a/app/views/threadreplies/edit.html.erb b/app/views/threadreplies/edit.html.erb index d45c2b7..645c64d 100644 --- a/app/views/threadreplies/edit.html.erb +++ b/app/views/threadreplies/edit.html.erb @@ -3,7 +3,7 @@ <%= link_to @reply.thread.forum.group, forumgroup_path(@reply.thread.forum.group) %> → <%= link_to @reply.thread.forum, @reply.thread.forum %> → <%= link_to @reply.thread %> → Edit reply<%= f.submit "Reply", class: "btn blue left" %>
<% end %><%= button_to "Delete reply", [@reply.thread, @reply], method: "delete", data: {confirm: "Delete reply forever?"}, class: "btn red right" %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 0a47b64..b2d1bd5 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -67,7 +67,7 @@