修改个人主页
This commit is contained in:
parent
261c3fc337
commit
602e3dc3fa
|
@ -1,4 +1,4 @@
|
||||||
class CourseController < ApplicationController
|
class CoursesController < ApplicationController
|
||||||
|
|
||||||
before_filter :require_login, :only => [:join, :unjoin]
|
before_filter :require_login, :only => [:join, :unjoin]
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@ class ProjectsController < ApplicationController
|
||||||
redirect_to new_project_path(:course => '1')
|
redirect_to new_project_path(:course => '1')
|
||||||
#Ended by young
|
#Ended by young
|
||||||
else
|
else
|
||||||
redirect_to settings_project_path(@project, :course => @course_tag)
|
redirect_to settings_project_path(@project)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||||
|
@ -430,7 +430,8 @@ class ProjectsController < ApplicationController
|
||||||
"show_issues" => true,
|
"show_issues" => true,
|
||||||
"show_files" => true,
|
"show_files" => true,
|
||||||
"show_documents" => true,
|
"show_documents" => true,
|
||||||
"show_messages" => true
|
"show_messages" => true,
|
||||||
|
"show_bids" => true
|
||||||
}
|
}
|
||||||
@date_to ||= Date.today + 1
|
@date_to ||= Date.today + 1
|
||||||
@date_from = @date_to - @days
|
@date_from = @date_to - @days
|
||||||
|
@ -483,7 +484,7 @@ class ProjectsController < ApplicationController
|
||||||
#Added by young
|
#Added by young
|
||||||
# @course_tag = params[:course]
|
# @course_tag = params[:course]
|
||||||
# if @course_tag == '1'
|
# if @course_tag == '1'
|
||||||
if @project.project_type
|
if @project.project_type == 1
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
end
|
end
|
||||||
#Ended by young
|
#Ended by young
|
||||||
|
|
|
@ -22,11 +22,12 @@ class UsersController < ApplicationController
|
||||||
menu_item :user_project, :only => :user_projects
|
menu_item :user_project, :only => :user_projects
|
||||||
menu_item :requirement_focus, :only => :watch_bids
|
menu_item :requirement_focus, :only => :watch_bids
|
||||||
menu_item :user_newfeedback, :only => :user_newfeedback
|
menu_item :user_newfeedback, :only => :user_newfeedback
|
||||||
|
menu_item :user_course, :only => :user_courses
|
||||||
#Ended by young
|
#Ended by young
|
||||||
|
|
||||||
|
|
||||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:edit,:update]
|
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:edit,:update, :user_courses]
|
||||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership,
|
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||||
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
|
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
||||||
|
|
||||||
|
@ -117,6 +118,56 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
# added by fq
|
||||||
|
def user_courses
|
||||||
|
case params[:type]
|
||||||
|
when "1"
|
||||||
|
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||||
|
|
||||||
|
@memberships = []
|
||||||
|
@membership.each do |membership|
|
||||||
|
if membership.project.project_type == 1
|
||||||
|
@memberships << membership
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@bid = []
|
||||||
|
@memberships.each do |membership|
|
||||||
|
@bid += membership.project.homeworks
|
||||||
|
end
|
||||||
|
@state = 1
|
||||||
|
else
|
||||||
|
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||||
|
|
||||||
|
@memberships = []
|
||||||
|
@membership.each do |membership|
|
||||||
|
if membership.project.project_type == 1
|
||||||
|
@memberships << membership
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@state = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
|
||||||
|
# @events_by_day = events.group_by(&:event_date)
|
||||||
|
|
||||||
|
# @state = 0
|
||||||
|
|
||||||
|
#add by huang
|
||||||
|
unless User.current.admin?
|
||||||
|
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
|
||||||
|
render_404
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#end
|
||||||
|
|
||||||
|
# respond_to do |format|
|
||||||
|
# format.html
|
||||||
|
# format.api
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
# end
|
||||||
|
|
||||||
# modified by fq
|
# modified by fq
|
||||||
def user_newfeedback
|
def user_newfeedback
|
||||||
|
|
|
@ -90,6 +90,22 @@ module UsersHelper
|
||||||
end
|
end
|
||||||
content_tag('div', content, :class => "pagination")
|
content_tag('div', content, :class => "pagination")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_course(state)
|
||||||
|
content = ''.html_safe
|
||||||
|
case state
|
||||||
|
when 0
|
||||||
|
s = content_tag('span', '我的课程', :class => "current-page")
|
||||||
|
content << content_tag('li', s)
|
||||||
|
content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1}))
|
||||||
|
when 1
|
||||||
|
s = content_tag('span', '我的作业', :class => "current-page")
|
||||||
|
content << content_tag('li', link_to('我的课程', {:controller => 'users', :action => 'user_courses'}))
|
||||||
|
content << content_tag('li', s, :class => "current-page")
|
||||||
|
end
|
||||||
|
content_tag('div', content, :class => "pagination")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# added by huang
|
# added by huang
|
||||||
def sort_user(state)
|
def sort_user(state)
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Bid < ActiveRecord::Base
|
||||||
:author => :author,
|
:author => :author,
|
||||||
:url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}}
|
:url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}}
|
||||||
|
|
||||||
acts_as_activity_provider :find_options => {:include => [:author]},
|
acts_as_activity_provider :find_options => {:include => [:project, :author]},
|
||||||
:author_key => :author_id
|
:author_key => :author_id
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Project < ActiveRecord::Base
|
||||||
# added by fq
|
# added by fq
|
||||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||||
has_many :homework_for_courses, :dependent => :destroy
|
has_many :homework_for_courses, :dependent => :destroy
|
||||||
has_many :homeworks, :through => :homework_for_courses, :source => :bid
|
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||||
has_many :students_for_courses, :dependent => :destroy
|
has_many :students_for_courses, :dependent => :destroy
|
||||||
has_many :student, :through => :students_for_courses, :source => :user
|
has_many :student, :through => :students_for_courses, :source => :user
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
$('#join').html('<%= escape_javascript join_in_course(course, user) %>');
|
|
@ -1,6 +1,6 @@
|
||||||
<h3 class="title">请输入课程密码</h3>
|
<h3 class="title">请输入课程密码</h3>
|
||||||
|
|
||||||
<%= form_tag({:controller => 'watchers',
|
<%= form_tag({:controller => 'courses',
|
||||||
:action => 'join',
|
:action => 'join',
|
||||||
:object_id => course.id},
|
:object_id => course.id},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<h3><%=l(:label_settings)%></h3>
|
<h3><%=l(:label_settings)%></h3>
|
||||||
<% if @project.project_type %>
|
<% if @project.project_type == 1 %>
|
||||||
<%= render_tabs course_settings_tabs %>
|
<%= render_tabs course_settings_tabs %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render_tabs project_settings_tabs %>
|
<%= render_tabs project_settings_tabs %>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<div class="content_frame">
|
||||||
|
<% unless @memberships.empty? %>
|
||||||
|
<ul class="user_project_sort">
|
||||||
|
<% for membership in @memberships %>
|
||||||
|
<li>
|
||||||
|
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar'), project_path(membership.project) %></td>
|
||||||
|
<td>
|
||||||
|
<table width="580" border="0">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top"><strong> <%= link_to_user(membership.user) if membership.respond_to?(:user) %></strong>
|
||||||
|
<span class="font_lighter"> <%= l(:label_create_project) %></span> <%= link_to_project(membership.project) %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" width="580" >
|
||||||
|
<p class="font_description">
|
||||||
|
<%= membership.project.description%>
|
||||||
|
</p></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="left"><span class="font_lighter"> <%= format_time(membership.created_on) %></span></td><!-- modified by ming -->
|
||||||
|
<td align="right" ><%= h membership.roles.sort.collect(&:to_s).join(', ') %> </td>
|
||||||
|
</tr>
|
||||||
|
</table></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% else %>
|
||||||
|
<% if @user != User.current %>
|
||||||
|
<p class="font_description"><%= l(:label_project_un) %></p>
|
||||||
|
<% else %>
|
||||||
|
<p class="font_description"><%= l(:label_project_unadd) %><%= link_to"#{l(:label_new)}",:controller=>'projects',:action=>'new'%></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<%= call_hook :view_account_left_bottom, :user => @user %>
|
||||||
|
</div>
|
|
@ -0,0 +1,56 @@
|
||||||
|
<!-- fq -->
|
||||||
|
<% if @bid.size > 0%>
|
||||||
|
|
||||||
|
<% for bid in @bid%>
|
||||||
|
|
||||||
|
<table width="90%" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px; margin-top: 30px;font-size:14px;">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'),user_path(bid.author), :class => "avatar" %></td>
|
||||||
|
<td>
|
||||||
|
<table width="100%" border="0">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top"><strong><%= link_to(bid.author, user_path(bid.author), :class => 'bid_user') %>: <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="500">
|
||||||
|
<table border="0">
|
||||||
|
<tr><td>
|
||||||
|
<% if bid.reward_type.nil? or bid.reward_type == 1%>
|
||||||
|
<strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: 微软雅黑"><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= bid.budget%></span></strong>
|
||||||
|
<% elsif bid.reward_type == 2%>
|
||||||
|
<strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= bid.budget%></span></strong>
|
||||||
|
<% else %>
|
||||||
|
<strong><%= l(:label_bids_reward_method) %><span style="color: #00aa83;font-family: 14px; font-family: 微软雅黑"><%= l(:label_bids_credit) %> <%= bid.budget%> <%= l(:label_bids_credit_number) %></span></strong>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> -->
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr><td>
|
||||||
|
<span class="font_lighter"><%= l(:label_biding_project) %>(<strong><%=link_to bid.biding_projects.count, project_for_bid_path(bid) %></strong>)</span>
|
||||||
|
<span class="font_lighter"><%= l(:label_responses) %>(<strong><%=link_to bid.commit, respond_path(bid) %></strong>)</span>
|
||||||
|
<span class="font_lighter"><%= l(:label_followers) %>(<strong><%=link_to bid.watcher_users.count, respond_path(bid) %></strong>)</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table></td>
|
||||||
|
<td width="220" align="right" class="a"><span class="font_lighter"> <%= format_time bid.created_on %></span></td><!-- modified by ming -->
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="bid-description" style="border-left: 1px solid rgb(225, 225, 225); border-bottom: 1px solid rgb(225, 225, 225); padding-left: 20px; padding-bottom: 10px; margin-bottom: 20px;">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td> <%= bid.description%> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div></td>
|
||||||
|
</tr>
|
||||||
|
</table></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
<p class="font_description">暂无任何作业</p>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<!-- added by fq -->
|
||||||
|
|
||||||
|
<%= user_course @state%>
|
||||||
|
|
||||||
|
<% if @state == 0%>
|
||||||
|
<%= render :partial => 'my_course' %>
|
||||||
|
<% else %>
|
||||||
|
<%= render :partial => 'my_homework' %>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -89,6 +89,7 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info'
|
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_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
|
match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang
|
||||||
|
match 'user_courses', :to => 'users#user_courses', :via => :get
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
|
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
|
||||||
|
|
|
@ -279,6 +279,7 @@ end
|
||||||
Redmine::MenuManager.map :user_menu do |menu|
|
Redmine::MenuManager.map :user_menu do |menu|
|
||||||
menu.push :activity, {:controller => 'users', :action => 'show' }
|
menu.push :activity, {:controller => 'users', :action => 'show' }
|
||||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects'}
|
menu.push :user_project, {:controller => 'users', :action => 'user_projects'}
|
||||||
|
menu.push :user_course, {:controller => 'users', :action => 'user_courses'}
|
||||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'}
|
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'}
|
||||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback'}
|
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback'}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue