加入课堂的调整

dev_aliyun
cxt 6 years ago
parent 115a316e80
commit 857d72c02b

@ -360,6 +360,13 @@ class UsersController < ApplicationController
@messages = PrivateMessage.find_by_sql("SELECT ui.* FROM (SELECT * FROM private_messages WHERE STATUS != 2 AND user_id = #{@user.id} ORDER BY id DESC) ui GROUP BY ui.target_id ORDER BY ui.send_time DESC")
end
def join_private_courses
@invitation_code = params[:invitation_code]
respond_to do |format|
format.js
end
end
# 我收到的issue
def user_receive_issues
@receive_issues = "我收到的Issue"

@ -4,7 +4,7 @@
</div>
<div class="task_popup_con mt15 ml30">
<div class="mr15">
<%= form_tag({:controller => 'courses', :action => 'join_course_multi_role'}, :remote => true, :method => :post, :id => 'new-watcher-form') do %>
<form id="new-watcher-form">
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl">课堂邀请码:</label>
@ -32,7 +32,7 @@
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_join_course();">确定</a>
</li>
</ul>
<% end %>
</form>
</div>
</div>
</div>
@ -45,10 +45,30 @@
$("#none_invite_code_notice").hide();
if ($("input[name='role[]']:checked").length >= 1){
$("#none_checked_notice").hide();
$('#new-watcher-form').submit();
$.ajax({
url: "/api/courses/apply_to_join_course.json",
type: "post",
dataType: 'json',
data: {
student: $("#join_course_role_10").is(":checked") ? 1 : "",
professor: $("#join_course_role_9").is(":checked") ? 1 : "",
assistant_professor: $("#join_course_role_7").is(":checked") ? 1 : "",
invite_code: $("input[name='invite_code']").val(),
},
success: function(data){
if(data.status == -1){
$("#none_checked_notice").html(data.message).show();
} else if(data.status == 0 && data.message == "成功"){
window.location = "/courses/"+data.course_id+"/students";
} else{
hideModal();
notice_box(data.message);
}
}
});
return;
}else{
$("#none_checked_notice").show();
$("#none_checked_notice").html("请至少选择一个身份").show();
}
}
}

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'courses/join_private_course') %>";
pop_box_new(htmlvalue,460,220);

@ -1670,6 +1670,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'html_show'
get 'switch_user_module'
get 'reward_grade'
match 'join_private_courses', :via => [:get, :post]
end
member do

Loading…
Cancel
Save