This commit is contained in:
ouyangxuhua 2015-09-25 15:27:00 +08:00
commit 6591ea8e9a
14 changed files with 97 additions and 114 deletions

View File

@ -296,7 +296,7 @@ class ForumsController < ApplicationController
#检查forum的名字
def check_forum_name
forum_name_exist = Forum.where("name = '#{params[:forum_name]}'").count >= 1 ? true : false
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
render :text => forum_name_exist
end

View File

@ -75,7 +75,7 @@ class StudentWorkController < ApplicationController
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group]
@homework_commons = @course.homework_commons.order("created_at desc")
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@is_evaluation = @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
@show_all = false
course_group = CourseGroup.find_by_id(@group) if @group
@ -86,7 +86,7 @@ class StudentWorkController < ApplicationController
else
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
end
if @is_teacher #老师 || 超级管理员 显示所有列表
if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
@show_all = true
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
@ -106,7 +106,7 @@ class StudentWorkController < ApplicationController
@stundet_works = []
end
else
if @is_teacher #老师 || 超级管理员 显示所有列表
if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
@show_all = true
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的

View File

@ -75,7 +75,7 @@ module ApiHelper
# 学生获取课程作业的状态
def get_homework_status homework
homework_status = ""
if !homework.nil?
if homework
if homework.homework_type == 1 && homework.homework_detail_manual
case homework.homework_detail_manual.comment_status
when 1

View File

@ -2299,7 +2299,7 @@ module ApplicationHelper
def homework_anonymous_comment homework
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
elsif homework.student_works.count >= 2 #作业份数大于2
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), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
@ -2309,7 +2309,7 @@ module ApplicationHelper
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
else
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评"
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
end
link
end

View File

@ -582,7 +582,7 @@ module UsersHelper
option << "请选择发布作业的课程"
option << -1
type << option
user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
option = []
option << course.name+""+course.time.to_s+course.term+""
option << course.id

View File

@ -71,7 +71,7 @@ class Mailer < ActionMailer::Base
recipients ||= []
course.student.each do |student|
user = User.find(student.student_id)
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
@token = Token.get_token_from_user(user, 'autologin')
@anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
@anonymous_comment_close_name = homework_common.name
@ -255,7 +255,7 @@ class Mailer < ActionMailer::Base
# 作业截止时间邮件提醒
def homework_endtime__added(homework_common, user_id)
user = User.find(user_id)
@subject = "#{l(:mail_homework)}#{homework_common.name}#{l(:mail_homework_endtime)} "
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} "
@token = Token.get_token_from_user(user, 'autologin')
@homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
@homework_endtime_name = homework_common.name

View File

@ -47,7 +47,7 @@
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %>
<a href="javascript:void(0);" onclick="$('#_file').click();" class="AnnexBtn fl mr15">上传附件</a>
<a href="javascript:void(0);" onclick="_file.click();" class="AnnexBtn fl mr15">上传附件</a>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',

View File

@ -10,7 +10,7 @@
<!--<a href="javascript:void(0);" class="f16 linkBlue">新手讨论吧</a>-->
<%= link_to forum.name, forum_path(forum),:class=>"f16 linkBlue" %>
</div>
<div class="postDes"><%= textAreailizable forum.description%></div>
<div class="postDes" style="word-break: break-all;word-wrap : break-word ;"><%= textAreailizable forum.description%></div>
<div class="postCreater">创建者:<a href="<%= user_path( forum.creator)%>" class="linkGrey2" target="_blank"><%= forum.creator.name %></a></div>
<div class="postDate">创建时间:<%= format_date(forum.created_at) %></div>
</div>

View File

@ -1,6 +1,6 @@
<% forum.tag_list.each do |tag|%>
<span class="postlabel mr10">
<a href="javascript:void(0);" ondblclick="rename_tag($(this),<%= tag %>,<%= forum.id%>,5);" class="fontGrey2 mr5"><%= tag %></a>
<a href="javascript:void(0);" ondblclick="rename_tag($(this),<%= tag %>,<%= forum.id%>,5);" style="cursor: default" class="fontGrey2 mr5"><%= tag %></a>
<%if forum.creator.id == User.current.id%>
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
<% end %>

View File

@ -14,7 +14,7 @@
n += 1;
}
}
if(n >= 160)
if(n >= 160 && event.keyCode != 8)
event.returnValue = false;
}
})
@ -43,13 +43,10 @@
function check_forum_name(){
check_pass = true;
name = $("textarea[name='forum[name]']").val().trim();
if(name == '<%= @forum.name%>'){
return;
}
if( name != ""){
$.get(
'<%= check_forum_name_forums_path %>',
{"forum_name":name},
{"forum_name":name,"forum_id":<%= @forum.id%>},
function(data){
if( data == 'true'){

View File

@ -122,6 +122,12 @@
}
}
});
function del_confirm(){
if(confirm('您确定要删除么?')){
$("#del_link").click();
}
}
</script>
</head>
<body class="<%= h body_css_classes %>">
@ -172,7 +178,8 @@
<span class="postEdit">
</span>
<a href="<%= edit_forum_path(@forum) %>" class="linkGrey3">编辑贴吧</a>
<a href="<%= forum_path(@forum)%>" data-method="delete" onclick="return confirm('您确定要删除么?');" class="fr linkGrey3">删除贴吧</a>
<a href="javascript:void(0);" data-method="delete" onclick="del_confirm();" class="fr linkGrey3">删除贴吧</a>
<a href="<%= forum_path(@forum)%>" data-method="delete" id="del_link" type="hidden"></a>
<span class="postDelete"></span>
<% end %>
</div>

View File

@ -14,12 +14,15 @@
<span class="homepagePostTitle hidden m_w530 fl">
<%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%>
</span>
<% if homework_common.homework_detail_manual.comment_status == 1%>
<% if homework_common.homework_detail_manual%>
<% if homework_common.homework_detail_manual.comment_status == 1%>
<span class="grey_btn_cir ml10">未开启匿评</span>
<% elsif homework_common.homework_detail_manual.comment_status == 2%>
<% elsif homework_common.homework_detail_manual.comment_status == 2%>
<span class="green_btn_cir ml10">匿评中</span>
<% elsif homework_common.homework_detail_manual.comment_status == 3%>
<% elsif homework_common.homework_detail_manual.comment_status == 3%>
<span class="grey_btn_cir ml10">匿评已结束</span>
<% end%>
<% end%>
<div class="homepagePostSubmitContainer">

View File

@ -1,94 +1,70 @@
<script type="text/javascript">
function searchUser(){
var name = $("#name").val();
if(name == "")
{
alert("搜索条件不能为空");
return;
}
$("#search_user_form").submit();
}
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
<div id="main" class="nosidebar">
<div id="content_">
<script type="text/javascript">
function searchUser(){
var name = $("#name").val();
if(name == "")
{
alert("搜索条件不能为空");
return;
}
$("#search_user_form").submit();
}
function searchByChange()
{
$("#search_by_input").val($("#search_by").val());
}
</script>
function searchByChange()
{
$("#search_by_input").val($("#search_by").val());
}
</script>
<div class="top-content">
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf " rowspan="2">
<%= l(:label_software_user ) %>
</td>
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2">
</td>
<td rowspan="2" >
<!--<div class="project-search" style="float: right">-->
<!--&lt;!&ndash;label for="user_browse_label"><%#= l(:label_user_search_type) %></label&ndash;&gt;-->
<!--<%#= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();",:style=>'display:none;' ) %>-->
<!--<%#= text_field_tag 'name', params[:name], :size => 30, :placeholder=>'昵称/姓名/邮箱' %>-->
<!--<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">-->
<!--<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>-->
<!--<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>-->
<!--</div> -->
</td>
</tr>
<tr>
<td >
<%=link_to l(:field_homepage), home_path %> >
<a><%= l(:label_software_user)%></a>
</td>
</tr>
</table>
</div>
<% end %>
<div class="autoscroll">
<% if @users.size > 0 %>
<%= render :partial => 'user_show' %>
<!--
<%# @users.each do |user| -%>
<%# unless user.id == 1%>
<div class="well">
<%#= content_tag "p", "#{format_date(user.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %>
<%#= image_tag "/images/time_member.png", :class => "img_member_time"%>
<div>
<%#= image_tag(url_to_avatar(user), :class => 'avatar') %>
<%#= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
</div>
<div style="margin-top: 20px;margin-left:66px">
<%#= l(:label_has_fans,:count=>user.watcher_users.count)%>
<%#= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
</div>
<div class="user-bottom">
<%# unless user.memberships.empty? %>
<%#= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %>
<%# for member in user.memberships %>
<%#= link_to_project(member.project) %><%#= (user.memberships.last == member) ? '' : '' %>
<%# end %>
<%# end %>
<%#= user.changesets.count == 0 ? '' : ",#{l(:label_total_commit, :total_commit => user.changesets.count)}" %>
</div>
<div class="top-content">
<%= form_tag( users_search_path, :method => :get, :id => 'search_user_form') do %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf " rowspan="2">
<%= l(:label_software_user ) %>
</td>
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2">
</td>
<td rowspan="2" >
</td>
</tr>
<tr>
<td >
<%=link_to l(:field_homepage), home_path %> >
<a><%= l(:label_software_user)%></a>
</td>
</tr>
</table>
</div>
<%# end -%>
<%# end -%>
-->
<% else %>
<%= render :partial => "layouts/no_content"%>
<% end %>
</div>
<div class="pagination">
<ul>
<%= pagination_links_full @user_pages, @user_count %>
</ul>
</div>
<% html_title(l(:label_user_plural)) -%>
<% end %>
<div class="autoscroll">
<% if @users.size > 0 %>
<%= render :partial => 'user_show' %>
<% else %>
<%= render :partial => "layouts/no_content"%>
<% end %>
<div class="cl"></div>
<div class="pagination">
<ul style="float: left;margin-bottom: 10px;margin-left: 10px;">
<%= pagination_links_full @user_pages, @user_count %>
</ul>
</div>
<div class="cl"></div>
</div>
<% html_title(l(:label_user_plural)) -%>
<div class="cl"></div>
</div>
</div>
</div>
</div>
</div>

View File

@ -115,7 +115,7 @@ $(function(){
minWidth: 753
});
$('a.ProBtn').on('click', function(){
$('a.ProBtn').live('click', function(){
$("#BluePopupBox").dialog("open");
$(".ui-dialog-titlebar").hide();
$("a.CloseBtn").on('click', function(){
@ -173,7 +173,7 @@ $(function(){
return valid;
}
$("#BluePopupBox a.BlueCirBtn").on('click', function(){
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
if(saveProgramAnswers()){
if($( "#BluePopupBox" ).dialog( "isOpen" )){
$("#BluePopupBox").dialog( "close" );