take off course fomre form the projrct ehich is watched

This commit is contained in:
xianbo 2013-11-12 09:04:39 +08:00
parent 5fb29c150b
commit 02ff8b8955
3 changed files with 3 additions and 10 deletions

View File

@ -493,6 +493,7 @@ class UsersController < ApplicationController
end
end
#### end
def new
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
@ -544,14 +545,7 @@ class UsersController < ApplicationController
end
def watch_projects
@watch_type = Watcher.where("watchable_type = ? and user_id = ?", 'Project', @user.id)
#@project = Project.visible.where("project_type < ?", 1)
@watch_projects = []
unless @watch_type.nil?
@watch_type.each do |obj|
@watch_projects << Project.find(obj.watchable_id)
end
end
@watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and user_id = ?", '1','Project', @user.id)
@state = 1
respond_to do |format|
format.html {

View File

@ -21,7 +21,6 @@
include AvatarHelper
module UsersHelper
def users_status_options_for_select(selected)
user_count_by_status = User.count(:group => 'status').to_hash
options_for_select([[l(:label_all), ''],

View File

@ -3,7 +3,7 @@
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
<% end %>
<%= watch_projects @state%>
<% unless @watch_projects.nil?&&watch_projects.project.nil? %>
<% if @watch_projects.nil?&&watch_projects.project.nil? %>
<% for watch_project in @watch_projects %>
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>