This commit is contained in:
nwb 2014-07-02 09:11:56 +08:00
commit fb0597ab4a
5 changed files with 20 additions and 14 deletions

View File

@ -256,14 +256,14 @@ class TagsController < ApplicationController
# 获取有某类对象的tag总数 # 获取有某类对象的tag总数
def get_tags_size def get_tags_size
@issues_tags_num = Issue.tag_counts.size @issues_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Issue").count
@projects_tags_num = Project.tag_counts.size @projects_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Project").count
@users_tags_num = User.tag_counts.size @users_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"User").count
@bids_tags_num = Bid.tag_counts.size @bids_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Bid").count
forum_tags_num = Forum.tag_counts.size forum_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Forum").count
attachment_tags_num = Attachment.tag_counts.size attachment_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Attachment").count
@open_source_projects_num = OpenSourceProject.tag_counts.size @open_source_projects_num = ActsAsTaggableOn::Tagging.where(taggable_type:"OpenSourceProject").count
@contests_tags_num = Contest.tag_counts.size @contests_tags_num = ActsAsTaggableOn::Tagging.where(taggable_type:"Contest").count
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num, @open_source_projects_num
end end

View File

@ -577,15 +577,16 @@ class User < Principal
# Find a user account by matching the exact login and then a case-insensitive # Find a user account by matching the exact login and then a case-insensitive
# version. Exact matches will be given priority. # version. Exact matches will be given priority.
#通过用户名查找相应的用户,若没有匹配到,则不区分大小写进行查询 #通过用户名查找相应的用户,若没有匹配到,则不区分大小写进行查询
#修改:不再匹配不区分大小写情况 -zjc
def self.find_by_login(login) def self.find_by_login(login)
if login.present? if login.present?
login = login.to_s login = login.to_s
# First look for an exact match # First look for an exact match
user = where(:login => login).all.detect {|u| u.login == login} user = where(:login => login).all.detect {|u| u.login == login}
unless user #unless user
# Fail over to case-insensitive if none was found # # Fail over to case-insensitive if none was found
user = where("LOWER(login) = ?", login.downcase).first # user = where("LOWER(login) = ?", login.downcase).first
end #end
user user
end end
end end

View File

@ -29,7 +29,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="debug"> <div class="debug hidden">
<%= debug(params) if Rails.env.development? %> <%= debug(params) if Rails.env.development? %>
<script src="http://s4.cnzz.com/z_stat.php?id=1000482288&web_id=1000482288" language="JavaScript"></script> <script src="http://s4.cnzz.com/z_stat.php?id=1000482288&web_id=1000482288" language="JavaScript"></script>

View File

@ -101,7 +101,7 @@
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td> <td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
</tr> </tr>
<tr> <tr>
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_tread_over) %> </td> <td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %> </td>
</tr> </tr>
</table> </table>
<% else %> <% else %>

View File

@ -0,0 +1,5 @@
class AddTagTypeIndexToTagging < ActiveRecord::Migration
def change
add_index :taggings, :taggable_type
end
end