Merge branch 'develop' into hjq_new_course

This commit is contained in:
huang 2016-03-18 15:40:00 +08:00
commit 1b8680e385
27 changed files with 158 additions and 97 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

@ -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]

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,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

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,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}'")
@ -2473,13 +2473,13 @@ class UsersController < ApplicationController
# 资源库 分为全部 课程资源 项目资源 附件
def user_resource
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
return
end
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@score = @b_sort == "desc" ? "asc" : "desc"
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
@ -2563,6 +2563,10 @@ class UsersController < ApplicationController
end
def import_resources_search
if User.current.id.to_i != params[:id].to_i
render_403
return
end
@resource_id = params[:mul_id]
@resource_type = params[:mul_type]
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
@ -2571,11 +2575,6 @@ class UsersController < ApplicationController
@switch_search = params[:name].nil? ? " " : params[:name]
search = "%#{@switch_search.strip.downcase}%"
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
return
end
@resource_id = params[:mul_id]
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
user_course_ids = User.current.courses.map { |c| c.id}

View File

@ -370,7 +370,7 @@ module ApplicationHelper
def link_to_short_attachment(attachment, options={})
length = options[:length] ? options[:length]:23
text = h(truncate(options.delete(:text) || attachment.filename, length: length, omission: '...'))
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
route_method = options.delete(:download) ? :download_named_attachment_url_without_domain : :named_attachment_url_without_domain
html_options = options.slice!(:only_path)
url = send(route_method, attachment, attachment.filename, options)
link_to text, url, html_options
@ -841,7 +841,7 @@ module ApplicationHelper
def project_member_check_box_tags_ex name, principals
s = ''
principals.each do |principal|
s << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id)}</li>\n"
s << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_url_in_org( principal.id)}</li>\n"
end
s.html_safe
end
@ -2582,9 +2582,9 @@ module ApplicationHelper
elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
@ -2631,7 +2631,7 @@ module ApplicationHelper
def user_for_homework_common homework,is_teacher
if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量
link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
link_to "作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
@ -2639,30 +2639,30 @@ module ApplicationHelper
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
else
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
link_to "提交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
end
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
else
link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
link_to "补交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
link_to "查看作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
link_to "修改作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
link_to "修改作品(#{homework.student_works.count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
else
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
link_to "查看作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
end
end
end
else
link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
link_to "作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
end
end
@ -3021,6 +3021,24 @@ end
def register_url_without_domain
Setting.protocol + "://" + Setting.host_name + "/login?login=false"
end
def new_student_work_url_without_domain(homework_id)
Setting.protocol + "://" + Setting.host_name + "/student_work/new?homework=" + homework_id.to_s
end
def edit_student_work_url_without_domain(homework_id)
Setting.protocol + "://" + Setting.host_name + "/student_work/" + homework_id.to_s + "/edit"
end
def download_named_attachment_url_without_domain(id, filename, option={})
attachment_id = (Attachment === id ? id.id : id)
Setting.protocol + "://" + Setting.host_name + "/attachments/download/" + attachment_id.to_s + "/" + filename
end
def named_attachment_url_without_domain(id, filename, option={})
attachment_id = (Attachment === id ? id.id : id)
Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/" + filename
end
#判断是否为默认的组织栏目
def is_default_field? field
(field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default'

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

@ -2,6 +2,8 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<script>
var onUserCard = false;
var onImage = false;
$(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block");
@ -10,15 +12,24 @@
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
onImage = true;
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
$(this).children(".userCard").css("display","none");
var cur = $(this);
onImage = false;
setTimeout(function(){
if (onUserCard == false && onImage == false){
$(cur).children(".userCard").css("display", "none");
}
}, 500);
})
$(".userCard").mouseover(function(){
onUserCard = true;
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
onUserCard = false;
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){

View File

@ -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>

View File

@ -49,11 +49,13 @@
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".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 %>

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

@ -9,7 +9,7 @@
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
if(<%= @is_edit %>) {
if(true == <%= @is_edit %>) {
issueEditShow();
}
});

View File

@ -28,6 +28,8 @@
});
</script>
<script>
var onUserCard = false;
var onImage = false;
$(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block");
@ -36,15 +38,24 @@
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
onImage = true;
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
$(this).children(".userCard").css("display","none");
var cur = $(this);
onImage = false;
setTimeout(function(){
if (onUserCard == false && onImage == false) {
$(cur).children(".userCard").css("display","none");
}
},500);
})
$(".userCard").mouseover(function(){
onUserCard = true;
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
onUserCard = false;
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){

View File

@ -1,4 +1,5 @@
<script>
var onUserCard = false;
$(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block");
@ -6,18 +7,6 @@
$("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
$(this).children(".userCard").css("display","none");
})
$(".userCard").mouseover(function(){
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff");
})

View File

@ -6,18 +6,6 @@
$("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
$(this).children(".userCard").css("display","none");
})
$(".userCard").mouseover(function(){
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff");
})

View File

@ -73,7 +73,7 @@
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", "https://www.trustie.net/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
<%= link_to "模拟答题", Setting.protocol + "://" + Setting.host_name + "/users/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div>
<% end %>
<% if activity.homework_type == 2%>
@ -154,7 +154,7 @@
<% end %>
<% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id), :alt => "学生头像" %>
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id)%></p>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
@ -245,7 +245,7 @@
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li>
<%= link_to("禁用匿评", Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_forbidden_anonymous_comment?user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink",
<%= link_to("禁用匿评", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_forbidden_anonymous_comment?user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品",:remote => true)%>
</li>
<% end %>

View File

@ -22,9 +22,9 @@
<div class="homepagePostTitle break_word" >
<%#= link_to activity.polls_name.to_s/*+"(问卷名称)"*/, %>
<% if has_commit %>
<%= link_to poll_name, poll_result_poll_path(activity.id), :class => "postGrey"%>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :class => "postGrey"%>
<% else %>
<%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%>
<%= link_to poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s, :class => "postGrey"%>
<% end %>
</div>
<div class="homepagePostDate fl">

View File

@ -1,4 +1,6 @@
<script>
var onUserCard = false;
var onImage = false;
$(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block");
@ -7,15 +9,24 @@
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
onImage = true;
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
$(this).children(".userCard").css("display","none");
var cur = $(this);
onImage = false;
setTimeout(function(){
if (onUserCard == false && onImage == false) {
$(cur).children(".userCard").css("display", "none");
}
}, 500);
})
$(".userCard").mouseover(function(){
onUserCard = true;
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
onUserCard = false;
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){

View File

@ -1,9 +1,9 @@
<% members.each do |member|%>
<ul class="orgListRow">
<li class="orgListUser"><a href="<%= user_path(User.find(member.user_id))%>" class="linkBlue"><%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %></a></li>
<li class="orgListUser"><a href="<%= user_url_in_org(member.user_id) %>" class="linkBlue"><%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %></a></li>
<li class="orgListRole">
<%= get_org_member_role_name member %>
<%= form_for(member, {:as => :org_member, :remote => true, :url => org_member_path(member),
<%= form_for(member, {:as => :org_member, :remote => true, :url => Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,
:method => :put,
:html => {:id => "org-member-#{member.id}-roles-form", :style=>'display:none'}}
) do |f| %>
@ -32,7 +32,7 @@
</li>
<% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%>
<a href="javascript:void(0);" style="color: #0781B4;margin-left: 30px;float: left" onclick="$(this).parent().height(70);$('#org-member-<%= member.id%>-roles-form').show();">编辑</a>
<%= link_to '删除', org_member_path(member.id),:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
<%= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
<div class="cl"></div>
</ul>
<% end %>

View File

@ -1,11 +1,11 @@
<% if PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",activity.id,activity.class.to_s,User.current.id).empty? %>
<a href="<%= praise_tread_praise_plus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type })%>" data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
<a href='<%= Setting.protocol+"://"+Setting.host_name+"/praise_tread/praise_plus?obj_id="+activity.id.to_s+"&obj_type="+activity.class.name+"&user_activity_id="+user_activity_id.to_s+"&type="+type.to_s %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
<span class="likeText">赞</span>
<% num = get_praise_num(activity) %>
<span class="likeNum"><%= num > 0 ? "#{num}" : "" %></span>
</a>
<% else %>
<a href="<%= praise_tread_praise_minus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type })%>" data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
<a href='<%= Setting.protocol+"://"+Setting.host_name+"/praise_tread/praise_minus?obj_id="+activity.id.to_s+"&obj_type="+activity.class.name+"&user_activity_id="+user_activity_id.to_s+"&type="+type.to_s %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
<span class="likeText">已赞</span>
<% num = get_praise_num(activity) %>
<span class="likeNum"><%= num > 0 ? "#{num}" : "" %></span>

View File

@ -1,5 +1,7 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<script>
var onUserCard = false;
var onImage = false;
$(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block");
@ -8,15 +10,24 @@
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
onImage = true;
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
$(this).children(".userCard").css("display","none");
var cur = $(this);
onImage = false;
setTimeout(function(){
if (onUserCard == false && onImage == false) {
$(cur).children(".userCard").css("display", "none");
}
}, 500);
})
$(".userCard").mouseover(function(){
onUserCard = true;
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
onUserCard = false;
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){

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

@ -9,19 +9,6 @@
$("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
$(this).children(".userCard").css("display","none");
})
$(".userCard").mouseover(function(){
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff");
})

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

@ -392,7 +392,7 @@
<% end %>
<% end %>
<!-- 作业迟交,不能参与匿评提醒消息 -->
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %></a></li>
<li class="homepageNewsPubType fl">

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">