Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
98ba28ab3d
|
@ -244,13 +244,18 @@ class TagsController < ApplicationController
|
|||
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) unless @taggable_id.blank?
|
||||
@obj = get_object(@taggable_id,params[:taggableType]) unless @taggable_id.blank?
|
||||
if @taggable_id.blank? #如果没有传tag_id,那么直接更新tag_name就好了。但是要防止 重命名后的tag存在。
|
||||
#看重命名后的tag是否存在。如果存在的话,只需要更改taggings里边的id,
|
||||
if @rename_tag
|
||||
@taggings = ActsAsTaggableOn::Tagging.where(" `taggings`.`tag_id` = #{ @tag_id} AND `taggings`.`taggable_type` = 'Attachment' ")#find_by_tag_id_and_taggable_type(@tag_id,@taggable_type)
|
||||
@taggings.each { |t| t.update_attributes({:tag_id=> @rename_tag.id}) if t.tag_id != @rename_tag.id }
|
||||
ActsAsTaggableOn::Tag.find(@tag_id).update_attributes(:name=>@rename_tag_name)#并且将该tag改名
|
||||
else #如果不存在,那么就直接更新该tag名称为新的名称
|
||||
(ActsAsTaggableOn::Tag.find_by_name(@tag_name)).update_attributes(:name=>@rename_tag_name)
|
||||
if @course_id
|
||||
course = Course.find @course_id
|
||||
if course
|
||||
course.attachments.each do |attachment|
|
||||
taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,attachment.id,attachment.class)
|
||||
if taggings
|
||||
taggings.delete
|
||||
attachment.tag_list.add(@rename_tag_name.split(","))
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if(@rename_tag.nil?) #这次命名的是新的tag
|
||||
|
|
|
@ -112,17 +112,10 @@ class UsersController < ApplicationController
|
|||
case params[:type]
|
||||
when nil
|
||||
@message_alls = []
|
||||
system_message_types = MessageAll.where("message_type =?", "SystemMessage").order("created_at desc")
|
||||
messages = MessageAll.where("user_id =? and message_type !=?" ,@user, "SystemMessage").order("created_at desc")
|
||||
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user, "SystemMessage", "SystemMessage").order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
@message_alls << message_all.message
|
||||
end
|
||||
# 系统消息需要给每个人发送,之所以这样做,可以避免遍历系统所有用户
|
||||
system_message_types.each do |system_message_type|
|
||||
@message_alls << system_message_type.message
|
||||
end
|
||||
# 取出所有符合条件的按照创建时间排序
|
||||
@message_alls = @message_alls.sort {|a,b| b.created_at <=> a.created_at}
|
||||
when 'unviewed'
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("user_id =?", @user).order("created_at desc")
|
||||
|
|
|
@ -246,36 +246,63 @@
|
|||
tagId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width +'px;" value="'+name+'"/>');
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width +'px;" value="'+name+'"/>');
|
||||
domEle.parent().css("border","1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
//监听所有的单击事件
|
||||
$(document.body).click(function(e){
|
||||
isdb = false; //这是单击
|
||||
node = document.elementFromPoint(e.clientX, e.clientY);
|
||||
if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
|
||||
isdb = true; //为了防止在编辑的时候又去单击其他tag去过滤。导致tag过滤不可用
|
||||
return;
|
||||
}
|
||||
if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
|
||||
if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
$(function(){
|
||||
$("#renameTagName").live("blur",function(){
|
||||
updateTagName();
|
||||
}).live("keypress",function(e){
|
||||
if (e.keyCode == '13') {
|
||||
updateTagName();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}else{ //否则就要更新tag名称了
|
||||
// if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ 去掉询问
|
||||
$.post(
|
||||
'<%= update_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>}
|
||||
)
|
||||
// }else{
|
||||
// ele.parent().css("border","");
|
||||
// ele.parent().html(tagNameHtml);
|
||||
// }
|
||||
}
|
||||
}
|
||||
});
|
||||
//执行修改TAGName方法
|
||||
function updateTagName(){
|
||||
if(isdb){
|
||||
isdb = false;
|
||||
if($("#renameTagName").val() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}
|
||||
else{
|
||||
$.post(
|
||||
'<%= update_tag_name_path %>',
|
||||
{"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// $(document.body).click(function(e){
|
||||
// isdb = false; //这是单击
|
||||
// node = document.elementFromPoint(e.clientX, e.clientY);
|
||||
// if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
|
||||
// isdb = true; //为了防止在编辑的时候又去单击其他tag去过滤。导致tag过滤不可用
|
||||
// return;
|
||||
// }
|
||||
// if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
|
||||
// if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
|
||||
// ele.parent().css("border","");
|
||||
// ele.parent().html(tagNameHtml);
|
||||
//
|
||||
// }else{ //否则就要更新tag名称了
|
||||
//// if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ 去掉询问
|
||||
// $.post(
|
||||
// '<%= update_tag_name_path %>',
|
||||
// {"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>}
|
||||
// )
|
||||
//// }else{
|
||||
//// ele.parent().css("border","");
|
||||
//// ele.parent().html(tagNameHtml);
|
||||
//// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
<%end %>
|
||||
|
||||
</script>
|
||||
|
|
|
@ -191,8 +191,10 @@
|
|||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<p>
|
||||
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
|
||||
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败,作业详情如下:
|
||||
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败,
|
||||
失败原因:提交作品的人数低于2人
|
||||
</p>
|
||||
<p>作业详情如下:</p>
|
||||
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
|
||||
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue