From be35324bbca95ae7efc397d180cb33c8fb7079e7 Mon Sep 17 00:00:00 2001 From: william Date: Mon, 12 Aug 2013 15:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=BF=E6=8E=89=E4=BA=86=E5=AF=B9=E4=BA=BA?= =?UTF-8?q?=E3=80=81=E9=97=AE=E9=A2=98=E3=80=81=E9=9C=80=E6=B1=82=E3=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9A=84=E8=B5=9E=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BA=86=E4=B8=80=E4=BA=9B=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=BF=99=E4=BA=9B=E5=8A=9F=E8=83=BD=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/helpers/application_helper.rb | 4 ++-- app/views/users/index.html.erb | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 02d23e174..0a1775c5c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -31,7 +31,7 @@ class UsersController < ApplicationController accept_api_auth :index, :show, :create, :update, :destroy,:tag_save #william - before_filter :require_login,:only => :tag_save + before_filter :need_login,:only => :tag_save helper :sort diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 789861fad..75484a227 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1317,8 +1317,8 @@ module ApplicationHelper # end #added by william - def get_fans_num(user) - user.watcher_users.count + def need_login + redirect_to signin_path end #end end diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 0bf0642dd..d82d3dc9d 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -87,8 +87,7 @@
<% for user in @users -%> -
- +
<%= 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"%> @@ -99,9 +98,8 @@
<%= l(:label_has_fans,:count=>user.watcher_users.count)%> <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %> - <%= l(:label_has_praisers,:count=>get_praise_num(user))%>
- +
<% unless user.memberships.empty? %> <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %>