Created
February 28, 2011 07:15
-
-
Save qichunren/847033 to your computer and use it in GitHub Desktop.
使用bbcode编辑器
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= content_for :html_head do %> | |
<%= javascript_include_tag "jquery.bbcode.js" %> | |
<%= javascript_tag do %> | |
$(function(){ | |
$("#web_message_content").bbcode({tag_bold:true,tag_italic:true,tag_underline:true,tag_link:true,tag_image:true,button_image:true,image_url:'/images/bbcode/'}); | |
$("#bbcode_preview_btn").bind("click", function(){ | |
var bbcode = $("#web_message_content").val(); | |
$.get("/utils/parse_bbcode", {id:bbcode}, function(text){ | |
$("#preview").html(text); | |
}); | |
}); | |
if(!$("#send_now").attr("checked")){ | |
$("#send_now").click(); | |
}; | |
$("#send_now").click(function(){ | |
if($(this).attr("checked")){ | |
$("#p_will_receive_at").hide(); | |
} else { | |
$("#p_will_receive_at").show(); | |
} | |
}); | |
}); | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class UtilsController < ApplicationController | |
def parse_bbcode | |
render :text => params[:id].bbcode_to_html | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment