添加了对管理员申请的接受与拒绝
This commit is contained in:
parent
28b10ed3fd
commit
91d5959016
|
@ -1,7 +1,7 @@
|
||||||
class OpenSourceProjectsController < ApplicationController
|
class OpenSourceProjectsController < ApplicationController
|
||||||
|
|
||||||
before_filter :find_osp, :only => [:master_apply]
|
before_filter :find_osp, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
|
||||||
before_filter :require_master, :only => [:master_apply]
|
before_filter :require_master, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
|
||||||
|
|
||||||
helper :sort
|
helper :sort
|
||||||
include SortHelper
|
include SortHelper
|
||||||
|
@ -146,20 +146,37 @@ class OpenSourceProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
per_page_option = 10
|
# per_page_option = 10
|
||||||
|
#
|
||||||
@open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
|
# @open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
|
||||||
@open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
|
# @open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
|
||||||
|
#
|
||||||
@os_project_count = @open_source_projects.count
|
# @os_project_count = @open_source_projects.count
|
||||||
@os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
|
# @os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
|
||||||
|
#
|
||||||
@open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
|
# @open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
|
||||||
|
|
||||||
redirect_to open_source_projects_path(:name => params[:name])
|
redirect_to open_source_projects_path(:name => params[:name])
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def refuse_master_apply
|
||||||
|
@apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id)
|
||||||
|
@apply.first.destory
|
||||||
|
|
||||||
|
redirect_to master_apply_open_source_project_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def accept_master_apply
|
||||||
|
@apply = ApplyProjectMaster.where("user_id = ? and apply_id = ? and apply_type = 'OpenSourceProject'", params[:user_id], @open_source_project.id)
|
||||||
|
if @apply.count == 1
|
||||||
|
@apply.first.update_attributes(:status => 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to master_apply_open_source_project_path
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def require_master
|
def require_master
|
||||||
|
|
|
@ -26,7 +26,8 @@ module OpenSourceProjectsHelper
|
||||||
s_temp = content_tag('span', s_temp, :class => 'tag_show')
|
s_temp = content_tag('span', s_temp, :class => 'tag_show')
|
||||||
s << content_tag('div', s_temp, :id => 'tag')
|
s << content_tag('div', s_temp, :id => 'tag')
|
||||||
end
|
end
|
||||||
|
s = content_tag('div', s, :id => 'tags_show')
|
||||||
s = content_tag('div', s, :id => 'tags')
|
s = content_tag('div', s, :id => 'tags')
|
||||||
# s = content_tag('div', s, :class => 'tags')
|
s = content_tag('div', s, :class => 'user_tags')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,8 +39,7 @@
|
||||||
|
|
||||||
<!-- modified by bai -->
|
<!-- modified by bai -->
|
||||||
<div style="position:relative;float:left;margin-top:-2px;margin-left: 160px">
|
<div style="position:relative;float:left;margin-top:-2px;margin-left: 160px">
|
||||||
<%= l(:label_user_grade) %>: <span style="color:#ec6300">
|
<%= l(:label_user_grade) %>: <span style="color:#ec6300"> <%= link_to( format("%.2f" , finall_user_score).to_f, {:controller => 'users',
|
||||||
<%= link_to( format("%.2f" , finall_user_score).to_f, {:controller => 'users',
|
|
||||||
:action => 'show_score',
|
:action => 'show_score',
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:id => user.id},
|
:id => user.id},
|
||||||
|
@ -76,6 +75,8 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>
|
<%= user.changesets.count == 0 ? '' : "#{l(:label_x_total_commit, :count => user.changesets.count)}" %>
|
||||||
|
<%= link_to "同意申请", {:controller => 'open_source_projects', :action => 'accept_master_apply', :id => @open_source_project.id, :user_id => user.id}%>
|
||||||
|
<%= link_to "拒绝申请", {:controller => 'open_source_projects', :action => 'refuse_master_apply', :id => @open_source_project.id, :user_id => user.id}%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -33,6 +33,8 @@ RedmineApp::Application.routes.draw do
|
||||||
resources :relative_memos
|
resources :relative_memos
|
||||||
member do
|
member do
|
||||||
match 'master_apply', via: [:get, :post]
|
match 'master_apply', via: [:get, :post]
|
||||||
|
match 'accept_master_apply', via: [:get, :post]
|
||||||
|
match 'refuse_master_apply', via: [:get, :post]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue