socialforge/app/views/words/destroy.js.erb

52 lines
2.9 KiB
Plaintext

<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon','Syllabus'].include? @journal_destroyed.jour_type)%>
<% if @is_user%>
<% if @activity %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_journal_post_reply', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
<% else %>
$("#user_activity_<%= @user_activity_id%>").hide();
<% end %>
/*var destroyedItem = $('#<%#=@journal_destroyed.id%>');
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<%# if @jours_count && @jours_count == 0 %>
$("#user_jour_list").css("padding","0px");
<%# end %>*/
<% else %>
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");
<% elsif @syllabus %>
$("#activity_post_reply_<%= @syllabus.id %>").html("<%= escape_javascript(render :partial => 'syllabuses/syllabus_post_reply', :locals => {:activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
sd_create_editor_from_data(<%= @syllabus.id%>,"","100%", "<%=@syllabus.class.to_s%>");
<% elsif @course && @jours_count%>
<% if @user_activity_id %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_journal_post_reply', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
<% else %>
$('#course_jour_count').html("<%= @jours_count %>");
<% end %>
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%>
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% end %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% end %>
<% else %>
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>');
$('#new_form_reference_user_id').val("");
<% end %>