添加了对管理员申请的接受与拒绝
This commit is contained in:
parent
28b10ed3fd
commit
91d5959016
|
@ -1,7 +1,7 @@
|
|||
class OpenSourceProjectsController < ApplicationController
|
||||
|
||||
before_filter :find_osp, :only => [:master_apply]
|
||||
before_filter :require_master, :only => [:master_apply]
|
||||
before_filter :find_osp, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
|
||||
before_filter :require_master, :only => [:master_apply, :accept_master_apply, :refuse_master_apply]
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
|
@ -146,20 +146,37 @@ class OpenSourceProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def search
|
||||
per_page_option = 10
|
||||
|
||||
@open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
|
||||
@open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
|
||||
|
||||
@os_project_count = @open_source_projects.count
|
||||
@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)
|
||||
# per_page_option = 10
|
||||
#
|
||||
# @open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
|
||||
# @open_source_projects = @open_source_projects.like(params[:name]) if params[:name].present?
|
||||
#
|
||||
# @os_project_count = @open_source_projects.count
|
||||
# @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)
|
||||
|
||||
redirect_to open_source_projects_path(:name => params[:name])
|
||||
|
||||
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
|
||||
|
||||
def require_master
|
||||
|
|
|
@ -26,7 +26,8 @@ module OpenSourceProjectsHelper
|
|||
s_temp = content_tag('span', s_temp, :class => 'tag_show')
|
||||
s << content_tag('div', s_temp, :id => 'tag')
|
||||
end
|
||||
s = content_tag('div', s, :id => 'tags_show')
|
||||
s = content_tag('div', s, :id => 'tags')
|
||||
# s = content_tag('div', s, :class => 'tags')
|
||||
s = content_tag('div', s, :class => 'user_tags')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
<% messages_count = user.messages.count %>
|
||||
<% messages_score = messages_count * 0.05%>
|
||||
<% finall_messages_score = messages_score %>
|
||||
|
||||
|
||||
<% journals_count = user.journals.count %>
|
||||
<% journals_score = journals_count * 0.1 %>
|
||||
<% user_changesets_count = user.changesets.count %>
|
||||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
|
||||
<% journals_for_messages_count = user.journals_for_messages.count %>
|
||||
<% activities_count = user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
<% finall_activity_score = journals_for_messages_score + activities_score %>
|
||||
|
||||
|
||||
<% news_count = user.news.count %>
|
||||
<% news_score = news_count * 0.1 %>
|
||||
<% wiki_contents_count = user.wiki_contents.count %>
|
||||
|
@ -36,17 +36,16 @@
|
|||
<div>
|
||||
<%= image_tag(url_to_avatar(user), :class => 'avatar') %>
|
||||
<%= content_tag "span", link_to_user(user), :class => "nomargin avatar_name" %>
|
||||
|
||||
|
||||
<!-- modified by bai -->
|
||||
<div style="position:relative;float:left;margin-top:-2px;margin-left: 160px">
|
||||
<%= l(:label_user_grade) %>: <span style="color:#ec6300">
|
||||
<%= link_to( format("%.2f" , finall_user_score).to_f, {:controller => 'users',
|
||||
:action => 'show_score',
|
||||
:remote => true,
|
||||
:id => user.id},
|
||||
:style=>"color: #EC6300;") %></span>
|
||||
<%= l(:label_user_grade) %>: <span style="color:#ec6300"> <%= link_to( format("%.2f" , finall_user_score).to_f, {:controller => 'users',
|
||||
:action => 'show_score',
|
||||
:remote => true,
|
||||
:id => user.id},
|
||||
:style=>"color: #EC6300;") %></span>
|
||||
</div>
|
||||
<!-- end -->
|
||||
<!-- end -->
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 20px;margin-left:66px">
|
||||
|
@ -76,6 +75,8 @@
|
|||
</p>
|
||||
|
||||
<%= 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>
|
||||
<% end -%>
|
||||
|
|
|
@ -33,6 +33,8 @@ RedmineApp::Application.routes.draw do
|
|||
resources :relative_memos
|
||||
member do
|
||||
match 'master_apply', via: [:get, :post]
|
||||
match 'accept_master_apply', via: [:get, :post]
|
||||
match 'refuse_master_apply', via: [:get, :post]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue