modify the style of the projects witch show

exceptionHandle
xianbo 12 years ago
parent cbe22e4e60
commit e9856b3524

@ -64,6 +64,8 @@ class UsersController < ApplicationController
events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
@events_by_day = events.group_by(&:event_date) @events_by_day = events.group_by(&:event_date)
@state = 0
#add by huang #add by huang
unless User.current.admin? unless User.current.admin?
@ -379,49 +381,7 @@ class UsersController < ApplicationController
end end
end end
### modified by fq
def show def show
# has = {
# "show_issues" => true,
# "show_changesets" => true,
# "show_news" => true,
# "show_messages" => true,
# "show_bids" => true,
# }
#####fq
# JournalsForMessage.reference_message(@user.id)
# show projects based on current user visibility
# @memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current))
# if @user == User.current
# events = []
# activity = Redmine::Activity::Fetcher.new(User.current, :author => User.current)
# activity.scope_select {|t| !has["show_#{t}"].nil?}
# events += activity.events(nil, nil, :limit => 10)
# @watcher = User.watched_by(@user)
# for user in @watcher
# activity = Redmine::Activity::Fetcher.new(User.current, :author => user)
# activity.scope_select {|t| !has["show_#{t}"].nil?}
# events += activity.events(nil, nil, :limit => 10)
# end
# else
# activity = Redmine::Activity::Fetcher.new(User.current, :author => @user)
# activity.scope_select {|t| !has["show_#{t}"].nil?}
# events = activity.events(nil, nil, :limit => 10)
# end
# @events = []
# @events_by_day = events.group_by(&:event_date)
# @events_by_day.keys.sort.reverse.each do |day|
# @events += @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime}
# end
# @offset, @limit = api_offset_and_limit({:limit => 10})
# @activity_count = @events.size
# @activity_pages = Paginator.new @activity_count, @limit, params['page']
# @offset ||= @activity_pages.offset
# @events_by_day_ = @events.slice(@offset,@limit)
case params[:type] case params[:type]
when "1" when "1"
if @user == User.current if @user == User.current
@ -570,6 +530,7 @@ class UsersController < ApplicationController
@watch_projects << Project.find(obj.watchable_id) @watch_projects << Project.find(obj.watchable_id)
end end
end end
@state = 1
respond_to do |format| respond_to do |format|
format.html { format.html {
render :layout => 'base_users' render :layout => 'base_users'

@ -92,6 +92,20 @@ module UsersHelper
content_tag('div', content, :class => "pagination") content_tag('div', content, :class => "pagination")
end end
def watch_projects(state)
content = ''.html_safe
case state
when 0
s = content_tag('span', l(:label_project_take), :class => "current-page")
content << content_tag('li', s)
content << content_tag('li', link_to(l(:label_has_watched_project), {:controller => 'users', :action => 'watch_projects', :type => 1}))
when 1
s = content_tag('span', l(:label_has_watched_project), :class => "current-page")
content << content_tag('li', link_to(l(:label_project_take), {:controller => 'users', :action => 'user_projects'}))
content << content_tag('li', s, :class => "current-page")
end
content_tag('div', content, :class => "pagination")
end
def user_course(state) def user_course(state)
content = ''.html_safe content = ''.html_safe
if @user != User.current if @user != User.current
@ -193,5 +207,4 @@ def sort_user(state, project_type)
content = content_tag('ul', content) content = content_tag('ul', content)
content_tag('div', content, :class => "tabs_enterprise") content_tag('div', content, :class => "tabs_enterprise")
end end
#end
end end

@ -89,7 +89,7 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag' has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags', :dependent => :destroy has_many :project_tags, :class_name => 'ProjectTags'
acts_as_nested_set :order => 'name', :dependent => :destroy acts_as_nested_set :order => 'name', :dependent => :destroy
acts_as_attachable :view_permission => :view_files, acts_as_attachable :view_permission => :view_files,

@ -1,11 +1,10 @@
<!--add by huang--> <!--add by huang-->
<p>
<strong><%= l(:label_project_take)%>
<%= link_to l(:label_has_watched_project) , {:controller => 'users', :action => 'watch_projects', :id => @user.id}%></strong>
<% unless @memberships.empty? %>
<% if @user == User.current %> <% if @user == User.current %>
<span style="margin-left: 300px"><%= 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) %></sapn></p> <%= 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 %> <% end %>
<p><%= watch_projects @state%>
<% unless @memberships.empty? %>
<div class="content_frame"> <div class="content_frame">
<ul class="user_project_sort"> <ul class="user_project_sort">
<% for membership in @memberships %> <% for membership in @memberships %>

@ -1,4 +1,3 @@
<!--add by huang-->
<h3><%= l(:label_user_watcher)%></h3> <h3><%= l(:label_user_watcher)%></h3>
<div class="inf_user_image"> <div class="inf_user_image">
<% for user in User.watched_by(@user.id) %> <% for user in User.watched_by(@user.id) %>

@ -1,13 +1,7 @@
<table>
<p><strong>
<%= l(:label_has_watched_project)%>
<%= link_to l(:label_project_take) , {:controller => 'users', :action => 'user_projects', :course => 0, :project_type => @project_type}%></strong>
<% if @user == User.current %> <% if @user == User.current %>
<span style="margin-left: 300px"><%= 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) %></span> <%= 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 %> <% end %>
</td> <%= watch_projects @state%>
</p>
<table>
<% unless @watch_projects.nil?&&watch_projects.project.nil? %> <% unless @watch_projects.nil?&&watch_projects.project.nil? %>
<% for watch_project in @watch_projects %> <% 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;"> <table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">

Loading…
Cancel
Save