This commit is contained in:
sw 2014-08-08 16:41:36 +08:00
commit 6ab17a2bf7
9 changed files with 45 additions and 16 deletions

View File

@ -119,8 +119,8 @@ class AccountController < ApplicationController
@user = User.new @user = User.new
@user.safe_attributes = user_params @user.safe_attributes = user_params
if params[:identity] == "2" # 2 企业 if params[:identity] == "2" # 2 企业
#@user.firstname = params[:enterprise_name] @user.firstname = params[:enterprise_name]
#@user.lastname = l(:field_enterprise) @user.lastname = l(:field_enterprise)
end end
@user.admin = false @user.admin = false
@user.register @user.register

View File

@ -892,6 +892,18 @@ class ProjectsController < ApplicationController
end end
end end
def exit_project
@project = Project.find params[:id]
if User.current.login?
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
if members != nil
members.destroy
end
respond_to do |format|
format.js
end
end
end
private private
def memberAccess def memberAccess
@ -1038,4 +1050,5 @@ class ProjectsController < ApplicationController
end end
#gcmend #gcmend
end end

View File

@ -246,4 +246,7 @@ module WatchersHelper
link_to text, url, :remote => true, :method => method ,:class=>css link_to text, url, :remote => true, :method => method ,:class=>css
end end
end def exit_project_link(project)
link_to("退出项目",exit_cur_project_path(project.id),:remote => true )
end
end

View File

@ -0,0 +1,20 @@
<div style="margin-left: 20px;">
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
<span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %>
<% end %>
</div>
<!--添加项目申请-->
<div style="margin-left: 20px;">
<% if ( !(User.current.member_of? @project) && User.current.login?) %>
<span class="icon-fav icon"></span>
<%= applied_link(@project, User.current) %>
<% end %>
</div>
<!--添加退出项目-->
<div style="margin-left: 20px;">
<% if ((User.current.member_of? @project) && User.current.login?) %>
<%= exit_project_link(@project) %>
<% end %>
</div>

View File

@ -74,20 +74,9 @@
<% end %> <% end %>
<!-- end --> <!-- end -->
</div> </div>
<div style="margin-left: 20px;"> <div id="join_exit_project_div">
<%= render 'layouts/join_exit_project' %>
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
<span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %>
<% end %>
</div>
<!--添加项目申请-->
<div style="margin-left: 20px;">
<% if ( !(User.current.member_of? @project) && User.current.login?) %>
<span class="icon-fav icon"></span>
<%= applied_link(@project, User.current) %>
<% end %>
</div> </div>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -0,0 +1 @@
$('#join_exit_project_div').html("<%= escape_javascript(render(:partial => 'layouts/join_exit_project')) %>");

View File

@ -1197,6 +1197,7 @@ en:
label_tags_issue_description: issue description label_tags_issue_description: issue description
label_tags_all_objects: all objects label_tags_all_objects: all objects
label_apply_project: Apply Project label_apply_project: Apply Project
label_exit_project: Exit Project
label_apply_project_waiting: "Application has been submitted, please wait for administrator review." label_apply_project_waiting: "Application has been submitted, please wait for administrator review."
label_unapply_project: Unsubscribe label_unapply_project: Unsubscribe

View File

@ -1409,6 +1409,7 @@ zh:
label_tags_issue_description: 问题描述 label_tags_issue_description: 问题描述
label_tags_all_objects: 所有 label_tags_all_objects: 所有
label_apply_project: 申请加入 label_apply_project: 申请加入
label_exit_project: 退出项目
label_apply_project_waiting: 已处理申请,请等待管理员审核 label_apply_project_waiting: 已处理申请,请等待管理员审核
label_unapply_project: 取消申请 label_unapply_project: 取消申请

View File

@ -510,6 +510,7 @@ RedmineApp::Application.routes.draw do
get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
get 'projects/:id/repository', :to => 'repositories#show', :path => nil get 'projects/:id/repository', :to => 'repositories#show', :path => nil
get 'projects/:id/exit', :to => 'projects#exit_project', :as => 'exit_cur_project'
# additional routes for having the file name at the end of url # additional routes for having the file name at the end of url
get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment' get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'