Merge branch 'cxt_course' into develop

This commit is contained in:
cxt 2016-03-18 14:53:43 +08:00
commit dc4a7ee2e6
10 changed files with 53 additions and 20 deletions

View File

@ -40,12 +40,16 @@ class AdminController < ApplicationController
@projects = scope.where(project_type: Project::ProjectType_project).reorder("created_on desc").all
=end
@projects = Project.like(@name).order('created_on desc')
@projects = paginateHelper @projects,30
@page = (params['page'] || 1).to_i - 1
render :action => "projects", :layout => false if request.xhr?
end
def courses
@name = params[:name]
@courses = Course.like(@name).order('created_at desc')
@courses = paginateHelper @courses,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end

View File

@ -17,9 +17,9 @@ class HomeworkCommonController < ApplicationController
@page = params[:page] ? params[:page].to_i + 1 : 0
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @is_teacher
@homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10)
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
else
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10)
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
end
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
@is_new = params[:is_new]
@ -51,10 +51,16 @@ class HomeworkCommonController < ApplicationController
@user = User.current
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
if @is_in_course == 1 || @course_activity == 1
respond_to do |format|
format.html{render :layout => 'base_courses'}
end
else
respond_to do |format|
format.html{render :layout => 'new_base_user'}
end
end
end
def update
if params[:homework_common]

View File

@ -1,3 +1,4 @@
#encoding: utf-8
class StudentWorkController < ApplicationController
layout "base_courses"
include StudentWorkHelper
@ -282,7 +283,7 @@ class StudentWorkController < ApplicationController
@submit_result = true
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
student_work ||= StudentWork.new
student_work.name = params[:student_work][:name]
student_work.name = params[:student_work][:name] == "#{@homework.name}的作品提交(可修改)" ? "#{@homework.name}的作品提交" : params[:student_work][:name]
student_work.description = params[:student_work][:description]
student_work.homework_common_id = @homework.id
student_work.user_id = User.current.id

View File

@ -573,7 +573,7 @@ class UsersController < ApplicationController
@r_sort = @b_sort == "desc" ? "asc" : "desc"
@user = User.current
search = params[:name].to_s.strip.downcase
type_ids = params[:property] ? "(" + params[:property] + ")" : "(1, 2, 3)"
type_ids = params[:property]=="" ? "(1, 2, 3)" : "(" + params[:property] + ")"
if(params[:type].blank? || params[:type] == "1") #全部
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"

View File

@ -73,4 +73,8 @@
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_course_all)) -%>

View File

@ -73,6 +73,10 @@
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_project_plural)) -%>
<script>

View File

@ -1,4 +1,10 @@
<script type="text/javascript">
<% if @is_in_course == 1 || @course_activity == 1 %>
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
<% end %>
function reset_homework(){
$("#homework_name").val("");
$("#homework_publish_time").val("");
@ -24,7 +30,7 @@
<% end %>
}
</script>
<div class="homepageRightBanner mb10">
<div class="homepageRightBanner mb10 <%= (@is_in_course == 1 || @course_activity == 1) ? 'ml10' : '' %>">
<div class="NewsBannerName">编辑作业</div>
</div>
<div class="cl"></div>

View File

@ -79,10 +79,6 @@
}
}
var KE = {
MDU: "1234455",//当前文章标识符
};
function nh_check_field(params){
var result=true;
if(!regexStudentWorkName()) {
@ -90,14 +86,14 @@
return result;
}
if(params.content!=undefined){
if(params.content.isEmpty()){
if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*[\uFE30-\uFFA0][\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.content.html())){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*[\uFE30-\uFFA0][\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.content.html())){
params.contentmsg.html('作品描述不能为空');
}else{
params.contentmsg.html('');
@ -150,6 +146,17 @@
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
},
afterBlur:function(){
if(this.isEmpty()) {
this.edit.html("<span id='hint' style='color: #999999; font-size: 12px'>请在此输入作品描述,您可以直接在这里粘贴作业图片</span>");
}
},
afterFocus: function(){
var edit = this.edit;
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*[\uFE30-\uFFA0][\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){
edit.html('');
}
},
afterCreate:function(){
//init
var edit = this.edit;
@ -159,7 +166,7 @@
//reset height
var edit = this.edit;
var body = edit.doc.body;
edit.html(params.textarea.innerHTML);
edit.html("<span id='hint' style='color: #999999; font-size: 12px'>请在此输入作品描述,您可以直接在这里粘贴作业图片</span>");
//paramsHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(150);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
@ -242,7 +249,7 @@
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
<% end %>
<div>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请输入作品名称",:value=>"#{@homework.name}的作品提交", :onkeyup => "regexStudentWorkName();" %>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请输入作品名称",:value=>"#{@homework.name}的作品提交(可修改)", :onkeyup => "regexStudentWorkName();" %>
<div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p>
</div>

View File

@ -194,9 +194,10 @@
</div>
<div class="cl"></div>
<div class="mt10 <%= defined?(select_course) ? 'none' : ''%>">
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
</div>
<!--<div class="mt10 <%= defined?(select_course) ? 'none' : ''%>">
<%#= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
</div>-->
<%= hidden_field_tag :course_id, params[:course_id], :value =>homework.course_id %>
<p id="homework_course_id_span" class="c_red mt5"></p>
<p id="e_tip" class="c_grey"></p>
<p id="e_tips" class="c_grey"></p>

View File

@ -58,7 +58,7 @@
</ul>
<div class="cl"></div>
<div id="homework_search_input" class="mt10 fl">
<%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
<%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => nil} %>
</div>
<div class="cl"></div>
<div class="w683 fl mr10 mt10" id="homework_repository_list">