parent
c26778b41c
commit
a9f6e817b4
@ -0,0 +1,7 @@
|
||||
class StudentWorkProject < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :homework_common
|
||||
belongs_to :student_work
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
end
|
@ -1,30 +1,83 @@
|
||||
<div class="groupPopUp" style="border:3px solid #269ac9;"> <span class="f16 fontBlue">关联项目</span><a href="javascript:void(0);" class="popClose"></a>
|
||||
<form class="resourcesSearchBox">
|
||||
<input type="text" name="serach" placeholder="输入项目名称进行搜索" class="searchResourcePopup" />
|
||||
</form>
|
||||
<ul class="mb10">
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目一</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目二项目二项目二</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目三项目三</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目四</span></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="courseSendSubmit"><a href="javascript:void(0);" class="sendSourceText">确定</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText">取消</a></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div id="popbox02" style="">
|
||||
<span class="f16 fontBlue">关联项目</span>
|
||||
<a href="javascript:void(0);" class="popClose" onclick="clickCanel();"></a>
|
||||
<%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:course_id=>@course_id,:user_activity_id=>@user_activity_id,:is_in_course=>@is_in_course),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>
|
||||
<input type="text" name="serach_project" placeholder="输入项目名称进行搜索" class="searchResourcePopup" />
|
||||
<span id="no_search_result" style="display: none">您当前尚未参与任何项目,请先加入项目再关联。</span>
|
||||
<div id="search_project_list"></div>
|
||||
<ul class="mb10 maxHeight100">
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目一</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目二项目二项目二</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目三项目三</span></label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input name="checkMenu" type="radio" class="courseSendCheckbox"/>
|
||||
<span class="sendCourseName">项目四</span></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="courseSendSubmit"><a href="javascript:void(0);" class="sendSourceText">确定</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
function search_orgs(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'student_work', :action => 'search_public_orgs_not_in_course') %>'+'?name='+ e.target.value+'&page='+page,
|
||||
type:'get'
|
||||
});
|
||||
}
|
||||
|
||||
function throttle(method,context,e){
|
||||
clearTimeout(method.tId);
|
||||
method.tId=setTimeout(function(){
|
||||
method.call(context,e);
|
||||
},500);
|
||||
}
|
||||
|
||||
//查询组织
|
||||
$("input[name='orgs']").on('input', function (e) {
|
||||
throttle(search_orgs,window,e);
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'courses', :action => 'search_public_orgs_not_in_course') %>'+'?page=1',
|
||||
type:'get'
|
||||
});
|
||||
});
|
||||
function cancel_join_orgs() {
|
||||
$("#join_orgs_for_course input:checked").attr("checked", false);
|
||||
}
|
||||
function course_join_org(courseId) {
|
||||
$.ajax({
|
||||
url: "/org_courses?" + $("#join_orgs_for_course").serialize() + "&course_id=" + courseId,
|
||||
type: "post",
|
||||
success: function (data) {
|
||||
$.ajax({
|
||||
url: "/courses/" + courseId + "/search_public_orgs_not_in_course?hint_flag=true&name=" + $("input[name='orgs']").val().trim(),
|
||||
type: "get"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
@ -0,0 +1,5 @@
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/relate_project') %>');
|
||||
showModal('ajax-modal', '320px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("groupPopUp");
|
@ -0,0 +1,13 @@
|
||||
class CreateStudentWorkProjects < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :student_work_projects do |t|
|
||||
t.integer :homework_common_id
|
||||
t.integer :student_work_id
|
||||
t.integer :project_id
|
||||
t.integer :user_id
|
||||
t.integer :is_leader
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
class AddIndexToStudentWorkProject < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :student_work_projects, :homework_common_id
|
||||
add_index :student_work_projects, :user_id
|
||||
add_index :student_work_projects, :project_id
|
||||
add_index :student_work_projects, :student_work_id
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :student_work_project do
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StudentWorkProject, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue