Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
0d260aee69
|
@ -134,8 +134,12 @@ class FilesController < ApplicationController
|
|||
if sort == ""
|
||||
sort = "created_on DESC"
|
||||
end
|
||||
if keywords != "%%"
|
||||
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").
|
||||
reorder(sort)
|
||||
else
|
||||
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort)
|
||||
end
|
||||
#resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
|
||||
end
|
||||
|
||||
|
@ -547,7 +551,7 @@ class FilesController < ApplicationController
|
|||
q = "%#{@q.strip}%"
|
||||
@result = find_course_attache q,@course,sort
|
||||
@result = visable_attachemnts @result
|
||||
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
||||
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
|
||||
@searched_attach = paginateHelper @result,10
|
||||
@tag_list = get_course_tag_list @course
|
||||
|
||||
|
|
|
@ -244,10 +244,11 @@ 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即可
|
||||
#看重命名后的tag是否存在。如果存在的话,只需要更改taggings里边的id,
|
||||
if @rename_tag
|
||||
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_type(@tag_id,@taggable_type)
|
||||
@taggings.update_attributes({:tag_id=>@rename_tag.id})
|
||||
@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)
|
||||
end
|
||||
|
|
|
@ -128,13 +128,13 @@ class UsersController < ApplicationController
|
|||
# when 'system_messages'
|
||||
# @message_alls = SystemMessage.order("created_at desc").all
|
||||
when 'apply'
|
||||
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?" , "AppliedProject", @user).order("created_at desc")
|
||||
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject') and user_id =?", @user).order("created_at desc")
|
||||
when 'homework'
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage') and user_id =?", @user).order("created_at desc")
|
||||
when 'course_message'
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||
# when 'forge_message'
|
||||
# @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||
when 'forge_message'
|
||||
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||
# @message_alls_count = @message_alls.count
|
||||
when 'course_news'
|
||||
# 课程通知包含发布的通知和回复的通知
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
<span class="files_tag_icon" >
|
||||
<a title="双击可编辑"
|
||||
onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(course)%>','','<%= @q%>','<%= course.id%>');"
|
||||
>全部</a></span>
|
||||
<% unless tag_list.nil?%>
|
||||
<% tag_list.each do |k,v|%>
|
||||
<% if tag_name && tag_name == k%>
|
||||
|
@ -5,7 +9,7 @@
|
|||
<span> <a class="files_tag_select" ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>×<%= v%></a></span>
|
||||
<% else%>
|
||||
<span class="files_tag_icon" >
|
||||
<a title="单击为过滤,双击可编辑"
|
||||
<a title="双击可编辑"
|
||||
onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(course)%>','<%= k%>','<%= @q%>','<%= course.id%>');"
|
||||
ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%>×<%= v%></a></span>
|
||||
<% end%>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<ul class="newsType">
|
||||
<li><%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "加入项目", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %></li>
|
||||
<%# 课程相关消息 %>
|
||||
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<%# 项目相关消息 %>
|
||||
<li><%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "resourcesGrey" %></li>
|
||||
<!--<li><%#= link_to "问题更新", user_message_path(User.current, :type => 'issue_update'), :class => "resourcesGrey" %></li>-->
|
||||
<!--<li><%#= link_to "项目讨论区", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %></li>-->
|
||||
<li><%= link_to "项目讨论区", user_message_path(User.current, :type => 'forge_message'), :class => "resourcesGrey" %></li>
|
||||
<!--<li><%#= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "resourcesGrey" %></li>-->
|
||||
<!--<li><%#= link_to "新闻回复", user_message_path(User.current, :type => 'forge_news_reply'), :class => "resourcesGrey" %></li>-->
|
||||
<%# 项目相关消息 %>
|
||||
|
|
Loading…
Reference in New Issue