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

36 lines
1.8 KiB
Plaintext

<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
<% if @is_user%>
var destroyedItem = $('#<%=@journal_destroyed.id%>');
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% else %>
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");
<% elsif @course && @jours_count%>
$('#course_jour_count').html("(<%= @jours_count %>)");
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%>
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% 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 %>