From 90a81ee1f17d204bf5afc9da8d4c7bc3c102cf21 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 22 Jan 2015 17:03:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=AB=99=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E9=A6=96=E9=A1=B5=E5=8A=A0=E5=85=A5=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 10 ++- app/views/projects/_join_project.html.erb | 83 +++++++++++++++++++++++ app/views/projects/join_project.js.erb | 9 +++ app/views/welcome/index.html.erb | 3 + config/locales/zh.yml | 1 + config/routes.rb | 4 ++ 6 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 app/views/projects/_join_project.html.erb create mode 100644 app/views/projects/join_project.js.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 24a3ff19f..a2e793a10 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -35,7 +35,7 @@ class ProjectsController < ApplicationController # edit before_filter :authorize1, :only => [:show] # - before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches] + before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] @@ -917,6 +917,14 @@ class ProjectsController < ApplicationController end end end + + #加入私有项目 + def join_project + respond_to do |format| + format.js + end + end + private def memberAccess diff --git a/app/views/projects/_join_project.html.erb b/app/views/projects/_join_project.html.erb new file mode 100644 index 000000000..c7ce29dae --- /dev/null +++ b/app/views/projects/_join_project.html.erb @@ -0,0 +1,83 @@ + + + + + 快速进入项目通道 + + + + + +
+
+
+

快速进入项目通道

+

只要持有项目的ID,就可快速申请加入所在项目。项目页面搜索不到的私有项目只能从此通道进入哦!

+
+
+ <%= form_tag({:controller => 'applied_project', + :action => 'applied_join_project'}, + :remote => true, + :method => :post, + :id => 'new-watcher-form') do %> + + <% end%> +
+
+
+ + + diff --git a/app/views/projects/join_project.js.erb b/app/views/projects/join_project.js.erb new file mode 100644 index 000000000..f3bdfb50a --- /dev/null +++ b/app/views/projects/join_project.js.erb @@ -0,0 +1,9 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); +showModal('ajax-modal', '510px'); +$('#ajax-modal').css('height','260px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("alert_box"); diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 0dc62c6a3..3e341bd27 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -66,6 +66,9 @@ :course => 0, :project_type =>( @project_type||=0)}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> +      + <%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %> +      <% end %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index bd6c6dc22..fbdee1d1f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2282,4 +2282,5 @@ zh: label_answer: 答案: label_poll_answer_valid_result: 以上为有效问答题答案! label_answer_total: 总计: + label_join_project: 加入项目 diff --git a/config/routes.rb b/config/routes.rb index 524373378..65498e4ec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -377,6 +377,10 @@ RedmineApp::Application.routes.draw do match 'copy', :via => [:get, :post] end + collection do + match 'join_project', :via => [:get, :post] + end + #by young match '/member', :to => 'projects#member', :as => 'member', :via => :get match '/file', :to => 'projects#file', :as => 'file', :via => :get