Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
8b09be83e0
|
@ -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
|
||||
|
|
|
@ -7,6 +7,7 @@ class CoursesController < ApplicationController
|
|||
helper :members
|
||||
helper :words
|
||||
helper :attachments
|
||||
helper :files
|
||||
helper :activity_notifys
|
||||
|
||||
before_filter :auth_login1, :only => [:show, :course_activity, :feedback]
|
||||
|
|
|
@ -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,8 +51,14 @@ class HomeworkCommonController < ApplicationController
|
|||
@user = User.current
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'new_base_user'}
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -573,8 +573,8 @@ 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)"
|
||||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
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(",") + ")"
|
||||
all_homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'")
|
||||
|
|
|
@ -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)) -%>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<div class="fl">
|
||||
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %><div class="cl"></div> </p>
|
||||
<p class="f12">
|
||||
<% if e_course.attachments.count > 0 %>
|
||||
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
|
||||
<% if visable_attachemnts(e_course.attachments).count > 0 %>
|
||||
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to visable_attachemnts(e_course.attachments).count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<% if e_course.homework_commons.count > 0 %>
|
||||
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
|
||||
<% if e_course.homework_commons.where("publish_time <= '#{Date.today}'").count > 0 %>
|
||||
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.where("publish_time <= '#{Date.today}'").count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
|
|
|
@ -49,11 +49,13 @@
|
|||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if file.container.try(:organization).try(:is_public?) %>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue