diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a93698de8..9c335ad6d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -17,8 +17,8 @@ class UsersController < ApplicationController layout 'base_users' - before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info] - before_filter :find_user, :only => [:show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info] + before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist] + before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info] accept_api_auth :index, :show, :create, :update, :destroy helper :sort @@ -27,7 +27,7 @@ class UsersController < ApplicationController include CustomFieldsHelper include AvatarHelper - # added by liuping 关注 + # added by liuping 关注 helper :watchers helper :activities @@ -379,7 +379,16 @@ class UsersController < ApplicationController respond_to do |format| format.html format.js - end + end + end + + ###add by huang + def user_watchlist + + end + ###add by huang + def user_fanslist + end private diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9935b577d..343b41265 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1305,4 +1305,14 @@ module ApplicationHelper html.html_safe end #end +# add by huang + def show_watcher_list(user) + html = '' + for user in User.watched_by(user.id) + html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.name}") + end + html.html_safe + end +# end + end diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 0ee2c64a0..2e00961bc 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -30,7 +30,7 @@
- +
<%= link_to image_tag(avatar_image(@project), :class => 'avatar') %><%= link_to image_tag(url_to_avatar(@project), :class => 'avatar') %>
<%= textilizable @project.name %> diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 35722ed93..81b0c8743 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -53,7 +53,7 @@
<%= l(:label_user_watcher) %> (<%= User.watched_by(@user.id).count %>)   <%= l(:label_user_fans) %> (<%= @user.watcher_users.count %>) -
+
@@ -76,7 +76,7 @@
- <%= l(:label_user_watcher) %>(<%= link_to User.watched_by(@user.id).count %>) + <%= l(:label_user_watcher) %>(<%= link_to User.watched_by(@user.id).count, :controller=>"users",:action=>"user_watchlist" %>)
@@ -93,7 +93,7 @@
- <%= l(:label_user_fans) %>(<%= link_to @user.watcher_users.count %>) + <%= l(:label_user_fans) %>(<%= link_to @user.watcher_users.count,:controller=>"users",:action=>"user_fanslist" %>)
diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb new file mode 100644 index 000000000..579ea42fd --- /dev/null +++ b/app/views/users/user_fanslist.html.erb @@ -0,0 +1,32 @@ + +

<%= l(:label_user_fans)%>

+
+ <% for user in @user.watcher_users %> +
  • +
+ + + + +
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> + + + + + + + + + +
<%= content_tag "div", link_to_user(user), :class => "nomargin avatar_name" %> +

+ <% 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 %> +

<%= l(:label_user_joinin) %><%= format_date(@user.created_on) %> +
+<% end %> +
\ No newline at end of file diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 12d5fc943..72638c5f5 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -10,7 +10,8 @@
- +
<%= link_to_user(membership.user) if membership.respond_to?(:user) %> 创建了 <%= link_to_project(membership.project) %> <%= link_to_user(membership.user) if membership.respond_to?(:user) %> + 创建了 <%= link_to_project(membership.project) %>
diff --git a/app/views/users/user_watchlist.html.erb b/app/views/users/user_watchlist.html.erb new file mode 100644 index 000000000..222ac117e --- /dev/null +++ b/app/views/users/user_watchlist.html.erb @@ -0,0 +1,32 @@ + +

<%= l(:label_user_watcher)%>

+
+ <% for user in User.watched_by(@user.id) %> +
  • + + + + + +
    <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> + + + + + + + + + +
    <%= content_tag "div", link_to_user(user), :class => "nomargin avatar_name" %> +

    + <% 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 %> +

    <%= l(:label_user_joinin) %><%= format_date(@user.created_on) %> +
+<% end %> +
\ No newline at end of file diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 438652557..df0a561b0 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -137,7 +137,7 @@

项目需求

添加描述添加描述添加描述添加描述...

-

发现开源

+

项目需求

添加描述添加描述添加描述添加描述...

diff --git a/config/routes.rb b/config/routes.rb index d43a594fa..8b74e410c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -78,6 +78,8 @@ RedmineApp::Application.routes.draw do match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" match 'watch_bids', :controller => 'users', :action => 'watch_bids', :via => [:get , :post] match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info' + match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang + match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang end end #end diff --git a/public/images/avatars/AnonymousUser/0 b/public/images/avatars/AnonymousUser/0 index 26e7db3e7..a4cc45467 100644 Binary files a/public/images/avatars/AnonymousUser/0 and b/public/images/avatars/AnonymousUser/0 differ diff --git a/public/images/avatars/Project/0 b/public/images/avatars/Project/0 index beea14904..585b4bfc0 100644 Binary files a/public/images/avatars/Project/0 and b/public/images/avatars/Project/0 differ diff --git a/public/images/avatars/Project/6315 b/public/images/avatars/Project/6315 new file mode 100644 index 000000000..cce3b9ccf Binary files /dev/null and b/public/images/avatars/Project/6315 differ diff --git a/public/images/avatars/Project/6322 b/public/images/avatars/Project/6322 new file mode 100644 index 000000000..1f0332907 Binary files /dev/null and b/public/images/avatars/Project/6322 differ diff --git a/public/images/avatars/User/0 b/public/images/avatars/User/0 index 26e7db3e7..a4cc45467 100644 Binary files a/public/images/avatars/User/0 and b/public/images/avatars/User/0 differ diff --git a/public/images/avatars/User/4874 b/public/images/avatars/User/4874 new file mode 100644 index 000000000..90e0e8474 Binary files /dev/null and b/public/images/avatars/User/4874 differ diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 8aa00453d..91b74e767 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -11,6 +11,11 @@ h4 {border-bottom: 1px dotted #bbb;} /*new by huang*/ /**/ +ul.list_watch{list-style-type:none; + height:auto; + border-bottom: 1px dashed rgb(204, 204, 204); + } + .new_creat{ padding-top: 0px; float: right;