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

52 lines
3.0 KiB
Plaintext
Raw Normal View History

2013-12-26 19:28:18 +08:00
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
2016-07-25 13:56:26 +08:00
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon','Syllabus'].include? @journal_destroyed.jour_type)%>
2015-07-18 16:19:43 +08:00
<% if @is_user%>
2016-01-25 15:33:50 +08:00
<% if @activity %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
2016-01-25 15:33:50 +08:00
<% else %>
$("#user_activity_<%= @user_activity_id%>").hide();
<% end %>
/*var destroyedItem = $('#<%#=@journal_destroyed.id%>');
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
2016-01-25 15:33:50 +08:00
<%# if @jours_count && @jours_count == 0 %>
$("#user_jour_list").css("padding","0px");
2016-01-25 15:33:50 +08:00
<%# end %>*/
2015-07-09 15:27:49 +08:00
<% else %>
2015-07-18 16:19:43 +08:00
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");
2016-07-25 13:56:26 +08:00
<% elsif @syllabus %>
$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :user_activity_id => @syllabus.id, :activity_id => @syllabus.id}) %>");
2015-07-18 16:19:43 +08:00
<% elsif @course && @jours_count%>
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :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 %>
2015-07-18 16:19:43 +08:00
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%>
2016-09-21 10:34:38 +08:00
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @user_activity_id, :hw_status => @hw_status, :is_teacher => @is_teacher}) %>");
2016-09-19 17:14:14 +08:00
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
2016-09-19 17:14:14 +08:00
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
2015-07-18 16:19:43 +08:00
<% end %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
2015-07-09 15:27:49 +08:00
<% end %>
2013-12-26 19:28:18 +08:00
<% 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 %>
2015-07-18 16:19:43 +08:00