% menu :admin %> <%= content_for :headers do -%> <%= javascript_include_tag 'fckeditor/fckeditor' %> <% end -%> <%= content_for :javascript do %> $(".edit_news_link").livequery("click", function(){ var route = $(this).attr("href"); $(this).attr("href","#").addClass("clicked_edit_news_link"); $.get(route, {authenticity_token: "<%=form_authenticity_token()%>"}, function(data){ $("#news_sidebar").replaceWith(data); $(".clicked_edit_news_link").attr("href",route).removeClass("clicked_edit_news_link"); /*New piece of news*/ $("a#big_edit_news").fancybox({ 'hideOnContentClick' : false, 'callbackOnShow' : function(){ $(".big_news_title").val($(".small_news_title").val()); $(".big_news_text").val($(".small_news_text").val()); big_textarea(); $("#fancy_outer").width($("#news_big").width() + 50); $("#fancy_outer").height($("#news_big").height() + 70); $(window).resize(); }, 'callbackOnClose' : function(){ $(".small_news_title").val($(".big_news_title").val()); var oEditor = FCKeditorAPI.GetInstance('news[text]') ; var data = oEditor.GetHTML(); $(".small_news_text").val(data); } }); }, "html" ); }); /*New piece of news*/ $("a#big_new_news").fancybox({ 'hideOnContentClick' : false, 'callbackOnShow' : function(){ $(".big_news_title").val($(".small_news_title").val()); $(".big_news_text").val($(".small_news_text").val()); big_textarea(); $("#fancy_outer").width($("#news_big").width() + 50); $("#fancy_outer").height($("#news_big").height() + 70); $(window).resize(); }, 'callbackOnClose' : function(){ $(".small_news_title").val($(".big_news_title").val()); var oEditor = FCKeditorAPI.GetInstance('news[text]') ; var data = oEditor.GetHTML(); $(".small_news_text").val(data); } }); big_textarea = function(data){ var div = document.getElementById("big_textarea_div"); var oFCKeditor = new FCKeditor( 'news[text]' ) ; oFCKeditor.BasePath = "/javascripts/fckeditor/" ; oFCKeditor.ToolbarSet = 'vccToolbar' ; oFCKeditor.Value = $(".big_news_text").val(); div.innerHTML = oFCKeditor.CreateHtml(); }; <% end %> <%= content_for :search do %> <%= render :partial => 'search/form' %> <%end%> <%= content_for :sidebar do %> <% if params[:edit_news]%> <%= render :partial => 'edit_news' %> <% else %> <%= render :partial => 'create_news' %> <% end%> <% end %> <%= render :partial => 'spaces/admin_tabs' %> <% for news in @news %>
<%=sanitize(news.text)%>