<% menu :posts %> <% atom_link_header(space, Post.new, :title => h(t('post.other_in_space', :space => space.name))) %> <%= content_for :headers do -%> <%= javascript_include_tag 'jquery.fancybox', 'jquery.filestyle', 'fckeditor/fckeditor', 'jquery.fcbkcomplete' %> <%= stylesheet_link_tag "fcbkcomplete", :media => "screen, projection" %> <% end -%> <%= content_for :javascript do %> /* * Expand and collapse thread */ extend_thread = function(id){ $("#parent_" + id + " .extended_thread").show(); $("#parent_" + id + " .extend_thread").hide(); $("#parent_" + id + " .collapse_thread").show(); } collapse_thread = function(id){ $("#parent_" + id + " .extended_thread").hide(); $("#parent_" + id + " .extend_thread").show(); $("#parent_" + id + " .collapse_thread").hide(); } /* * Replace with Ajax links */ $("a.reply_to_link").click(function(){ var route = "<%= space_posts_path(@space) %>" + "/" + $(this).attr("name"); $.get(route, {authenticity_token: "<%=form_authenticity_token()%>"}, function(data){ $("#sidebar").children("div:last").replaceWith(data); /* Reply panel javascript*/ /*$("#reply-form").postsForm('<%= space_posts_url(@space) %>');*/ var destination = $('#add').offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100, function() { window.location.hash = '#add' }); setTimeout(function() { $("#new_reply").effect("highlight", {color:"#F5DF51"}, 3000); }, 1000); $("a.big_new_reply").fancybox({ 'hideOnContentClick' : false, 'callbackOnShow' : function(){ $(".big_post_text").val($(".small_post_text").val()); $("textarea#post_text").remove();//IE Compatibility big_textarea(); $("#fancy_outer").width($("#new_thread_big").width() + 50); $("#fancy_outer").height($("#new_thread_big").height() + 80); $(window).resize(); }, 'callbackOnClose' : function(){ var oEditor = FCKeditorAPI.GetInstance('post[text]') ; var data = oEditor.GetHTML(); $("div#new_post_content").append("<%= escape_javascript(small_post_text_area) %>"); //IE Compatibility $(".small_post_text").val(data); } }); } ); return false; }); $("a.edit_post_link").click(function(){ var route = "<%= space_posts_path(@space) %>" + "/" + $(this).attr("name") + "?edit=true"; $.get(route, {authenticity_token: "<%=form_authenticity_token()%>"}, function(data){ $("#sidebar").children("div:last").replaceWith(data); /*Edit thread*/ /*$("#edit-form").postsForm('<%= space_posts_url(@space) %>');*/ $(".edit_thread_options").click(function(){ $(".edit_thread_options").removeClass("selected"); $(this).addClass("selected");}); /*Edit reply*/ $(".edit_reply_options").click(function(){ $(".edit_reply_options").removeClass("selected"); $(this).addClass("selected");}); style_file_input(); /*Scroll to the edit form*/ var destination = $('#add').offset().top; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100, function() { window.location.hash = '#add' /*Extract form fancbox*/ $("a#big_edit_thread").fancybox({ 'hideOnContentClick' : false, 'callbackOnShow' : function(){ $(".big_post_text").val($(".small_post_text").val()); $(".big_post_title").val($(".small_post_title").val()); $("textarea#post_text").remove();//IE Compatibility big_textarea(); $("#fancy_outer").width($("#new_thread_big").width() + 50); $("#fancy_outer").height($("#new_thread_big").height() + 80); $(window).resize(); }, 'callbackOnClose' : function(){ var oEditor = FCKeditorAPI.GetInstance('post[text]') ; var data = oEditor.GetHTML(); $("div#edit_post_content").append("<%= escape_javascript(small_post_text_area) %>"); //IE Compatibility $(".small_post_text").val(data); $(".small_post_title").val($(".big_post_title").val()); } }); }); setTimeout(function() { $("#edit_reply").effect("highlight", {color:"#F5DF51"}, 3000); $("#edit_thread").effect("highlight", {color:"#F5DF51"}, 3000); }, 1000); }); return false; }); /*Extended post creation*/ /*New thread*/ $("a.big_new_thread_link").fancybox({ 'hideOnContentClick' : false, 'callbackOnShow' : function(){ $(".big_post_title").val($(".small_post_title").val()); $(".big_post_text").val($(".small_post_text").val()); $("textarea#post_text").remove(); //IE Compatibility big_textarea(); $("#fancy_outer").width($("#new_thread_big").width() + 50); $("#fancy_outer").height($("#new_thread_big").height() + 80); $(window).resize(); }, 'callbackOnClose' : function(){ $(".small_post_title").val($(".big_post_title").val()); /*close_lightbox();*/ var oEditor = FCKeditorAPI.GetInstance('post[text]') ; var data = oEditor.GetHTML(); $("div#new_post_content").append("<%= escape_javascript(small_post_text_area) %>"); //IE Compatibility $(".small_post_text").val(data); } }); /*Reply*/ $("#new_attachment_big_link").livequery('click',function () { $(".big_options").removeClass("selected"); $(this).addClass("selected"); $("#new_attachment_form").show(); $("#fancy_outer").height($("#new_thread_big").height() + 80); $(window).resize(); return false; }); <%= render :partial => 'fckeditor_functions' %> <% end %> <%= content_for :search do %> <%= render :partial => 'search/form' %> <%end%> <%= content_for :sidebar do %> <%= render :partial => 'spaces/sidebar' %> <%if @space.authorize?([:create, :content],:to => current_user)%> <% if params[:reply_to]%> <%= render :partial => "new_post", :locals => {:p_id=> Post.find(params[:reply_to]).id, :id => "reply-form"} %> <% elsif params[:edit] %> <%= render :partial => "edit_post", :locals => { :post => Post.find(params[:edit]) } %> <%else%> <%= render :partial => "new_post", :locals => {:id => "thread-form" }%> <%end%> <% end %> <% end %>
<% extended = (params[:extended] == "true" || (!params[:extended] && current_user.expanded_post)) %> <%= raw(t('thread.see_less') + " " + link_to(t('thread.compact_view'), space_posts_path(@space, :extended => "false"))) if extended %> <%= raw(t('thread.see_more') + " " + link_to(t('thread.extended_view'), space_posts_path(@space, :extended => "true"))) unless extended %>
<%if params[:extended]=="true" || (!params[:extended] && current_user.expanded_post)%> <%= render :partial => "extended_threads", :locals => {:threads => @posts} %> <%else%> <%= render :partial => "collapsed_threads", :locals => {:threads => @posts} %> <%end%> <%= will_paginate @posts %>