From 463c09f02ce609ad4c64ca209a62ff4c4997989c Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 26 Jul 2016 08:55:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=82=80=E8=AF=B7=E5=BC=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- app/controllers/applied_project_controller.rb | 75 +++++++------- app/helpers/watchers_helper.rb | 29 +++--- .../_applied_join_project.html.erb | 28 ++++++ .../applied_join_project.js.erb | 21 ++-- config/routes.rb | 4 +- public/images/sy/sy_icons_close02.png | Bin 0 -> 18724 bytes public/javascripts/application.js | 16 +++ public/stylesheets/css/common.css | 31 ++++++ public/stylesheets/css/popup.css | 93 +++++++++++++++++- public/stylesheets/sy_public.css | 56 +++++------ 11 files changed, 261 insertions(+), 94 deletions(-) create mode 100644 app/views/applied_project/_applied_join_project.html.erb create mode 100644 public/images/sy/sy_icons_close02.png diff --git a/Gemfile b/Gemfile index 03dbb5785..a94f1b33b 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem 'elasticsearch-rails' ### profile -gem 'oneapm_rpm' +# gem 'oneapm_rpm' group :development do gem 'grape-swagger' diff --git a/app/controllers/applied_project_controller.rb b/app/controllers/applied_project_controller.rb index b9824976b..39491c0e6 100644 --- a/app/controllers/applied_project_controller.rb +++ b/app/controllers/applied_project_controller.rb @@ -2,44 +2,45 @@ class AppliedProjectController < ApplicationController #申请加入项目 def applied_join_project - @user_id = params[:user_id] - @project = Project.find_by_id(params[:project_id]) - if params[:project_join] - if @project - user = User.find @user_id - if user.member_of?(@project) - @status = 3 - else - @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) - if @applieds.count == 0 - appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) - Mailer.run.applied_project(appliedproject) - @status = 2 - else - @status = 1 - end - end - else - @status = 0 - end - respond_to do |format| - format.js - end - return - end - @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) - if @applieds.count == 0 - appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) - Mailer.run.applied_project(appliedproject) - end - - #redirect_to project_path(params[:project_id]) - #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true} - respond_to do |format| - format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_applied'} - end + # @user_id = params[:user_id] + # @project = Project.find_by_id(params[:project_id]) + # if params[:project_join] + # if @project + # user = User.find @user_id + # if user.member_of?(@project) + # @status = 3 + # else + # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + # if @applieds.count == 0 + # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + # Mailer.run.applied_project(appliedproject) + # @status = 2 + # else + # @status = 1 + # end + # end + # else + # @status = 0 + # end + # respond_to do |format| + # format.js + # end + # return + # end + # + # @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) + # if @applieds.count == 0 + # appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) + # Mailer.run.applied_project(appliedproject) + # end + # + # #redirect_to project_path(params[:project_id]) + # #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true} + # respond_to do |format| + # format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} + # format.js { render :partial => 'set_applied'} + # end end #取消申请 diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 52f2ea119..823fe534b 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -366,20 +366,27 @@ module WatchersHelper #申请加入项目 def join_in_project_link(project, user, options=[]) - return '' unless user && user.logged? applied = project.applied_projects.find_by_user_id(user.id) text = applied ? l(:label_unapply_project) : l(:label_apply_project) - @applied_flag = project.instance_of?(Project) - if applied - appliedid = applied.id - end - id = applied_css(project) - url = appliedproject_path( - :id=>appliedid, - :user_id => user.id, - :project_id => project.id) + url = applied ? unapplied_join_project_path(:object_id => project.id) : applied_join_project_path(:object_id => project.id) method = applied ? 'delete' : 'post' - link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id + @applied_flag = project.instance_of?(Project) + if applied + link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{project.id}") + else + link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "sy_btn_grey fl") + end + link.html_safe + # if applied + # appliedid = applied.id + # end + # id = applied_css(project) + # url = appliedproject_path( + # :id=>appliedid, + # :user_id => user.id, + # :project_id => project.id) + # method = applied ? 'delete' : 'post' + # link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id end def paginateHelper obj, pre_size=20 diff --git a/app/views/applied_project/_applied_join_project.html.erb b/app/views/applied_project/_applied_join_project.html.erb new file mode 100644 index 000000000..baa49ef01 --- /dev/null +++ b/app/views/applied_project/_applied_join_project.html.erb @@ -0,0 +1,28 @@ + +
+

欢迎加入项目

+ +
+
+
+ +
diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb index ae9d3f467..f79e9ac20 100644 --- a/app/views/applied_project/applied_join_project.js.erb +++ b/app/views/applied_project/applied_join_project.js.erb @@ -1,14 +1,7 @@ -// @status: 0 该项目不存在;1 不重复加入;2 成功加入; 3 已是项目成员;其它 加入失败 -<% if @status == 0%> - alert("<%= l('project.join.tips.notexist') %>"); -<% elsif @status == 1%> - alert("<%= l('project.join.tips.repeat') %>"); -<% elsif @status == 2%> - alert("<%= l('project.join.tips.success') %>"); - hideModal($("#popbox")); - $("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>"); -<% elsif @status == 3%> - alert("<%= l('project.join.tips.has') %>"); -<%else%> - alert("<%= l('project.join.tips.fail') %>"); -<%end%> \ No newline at end of file +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'applied_join_project', locals: { :course => @course}) %>'); +showModal('ajax-modal', '500px'); + +$('#ajax-modal').siblings().remove(); + +$('#ajax-modal').parent().css("top","").css("left",""); + diff --git a/config/routes.rb b/config/routes.rb index 1124080b7..4b9027335 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -721,8 +721,8 @@ RedmineApp::Application.routes.draw do post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' - post 'appliedproject/applied', :to => 'applied_project#applied_join_project', :as => 'appliedproject' - delete 'appliedproject/applied', :to => 'applied_project#unapplied_join_project' + post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project' + delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project' resources :projects do member do diff --git a/public/images/sy/sy_icons_close02.png b/public/images/sy/sy_icons_close02.png new file mode 100644 index 0000000000000000000000000000000000000000..456f2ea67183dcba533dfed2c7591e2b37b9c787 GIT binary patch literal 18724 zcmeI43pAA7*T5g7P$btPVWhWW%mp)MVqD88B6ms|GlR+8niCj zbP?qiMM6c}3IIXP$qs?8(L)M^wjt_lXS1e(3vu*q08ArGtU}uDr1TMhv{PEf zq-@t-31>O^IY~sPTiY8Xh{=1Or7kY;G2Oq{{eaUtgV(C98JD(%^!N3Be)#!XcT)FA zO>ph(@HsMz4nIG+5y08+GQ>BjM%of@-6;wemM6APQ+rt${wiDajcL7D&_*Y4u4Z5fEWOv2Zx%$ zfU}Z7?|UnPDA1G{-Kq#Qot&R31{@Ls;ul*k6gIgEcsgyf*A_0l0inyEs~0?FKN%*z}{6r6aq>sW2@s< z)$7U?#NJa1d^^zoO#Rsn`UNwR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#TN%A ziQgr;@z$v$PM#0H>opv`>%xQO4@||Rv9bfA_@!+UhB2M%Xc?pXkM+l*!5oG}phn-n zn@(0kP2KpLPF6!rCoG+qG#&vg-eVU7X`W;?dTWRuixmg(6hkF|Q-d}^d)v{1sB~8g z8hG=<9WBBba86@3P{nTz-6jmtQw%35z8j7&+N86_Sh$S0f+rd95QX@8iuxszewO}! z^UK7H{!OnCUxGm(K=_LST>SY!v;tfZApAuEF8+KVS^+Ky5dNY77k@qwtpFDU2!Bz4 zi$5QTR)7lvguf`j#h(vEE5HQ-!e12N;?D=772tvZ;V%ks@#h243UEPy@D~NR`165i z1-KwU_=^Hu{P{q%0$dOv{6zsS{(K->0WJs-{-OXEe?Abc02c%Ze^G#oKOcxzfC~bI zzbL@PpASSUzy$%qUlict&j+Fv;DP|*FA8w+=L69Sa6y3Z7X`TZ^MPmuxFA6IivnEy z`9QP+To54qMFB4Ud>~o@E(j3*q5v0vJ`k+{7X%1@kuNTZiRY53Oz>gkK=7$!arKbV z|D~fwCfeHoK!_#)gzo@=;cwvQO91dk0>CRz0Kgvu07cf34P`3;Kxn6xg{fmub7zz3 z>YGUET~ABqxV(Uen@cx7wwE$BeT&nU-?Z=IV8RU*U)EvsnCgX`j!kH{X)b5uY}OUo z%GRcPB(44{hvu~IQK1mK2EI*Y;8l^aJ9b$&b6cQiUlHrM#1;4K!cg^{9Xq#p6ib`Q zx_p!k0*XaR*PjTrU1VXoq{7hcxtFxS-$}>8Y^LTmcDt`v(8i8*}g z$J_qn4KF|c=$oFwhf3mVOAUcEV*&?adWHXt1WWOJh%S`5G2^? literal 0 HcmV?d00001 diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b7468366a..e86ad8ddc 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1492,6 +1492,22 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } } +// 公共弹框样式 +// title +function pop_box_new(value, tWidth, tTop, tLeft){ + $("#ajax-modal").html(value); + showModal('ajax-modal', tWidth + "px"); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top", tTop+"%").css("left", tLeft+"%").css("padding-top", "10px").css("position", "fixed"); + $('#ajax-modal').parent().addClass("resourceUploadPopup"); + $('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px"); + + function hideModal(){ + $('#ajax-modal').hide(); + } +} + //显示的时候根据当前网址是http 还是https 选择视频显示方式直接显示还是弹框 function autoMedia(id){ var rootPath = getRootPath(); diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index b72a8ef56..888cb3ca3 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -542,6 +542,37 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .borderRadius {border-radius:5px;} a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.Blue-btn{ background:#3598db; color:#fff;} + +/*20160725 项目申请按钮*/ +a.sy_btn_grey{ + color: #333; + background: #e1e1e1; + text-align: center; + font-size: 12px; + padding:0 15px; + height: 30px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.sy_btn_grey{ background: #c3c3c3;} +a.sy_btn_blue{ + display:block; + width:80px; + height: 30px; + text-align:center; + color: #fff; + background: #3b94d6; + font-size: 12px; + line-height: 30px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.sy_btn_blue{ background: #2788d0;} /* commonpic */ .pic_date{ display:block; background:url(/images/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; } .pic_add{ display:block; background:url(/images/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; } diff --git a/public/stylesheets/css/popup.css b/public/stylesheets/css/popup.css index ea2034a5e..c9f8ccf09 100644 --- a/public/stylesheets/css/popup.css +++ b/public/stylesheets/css/popup.css @@ -332,4 +332,95 @@ a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: no .relatePWrap{max-height: 210px;overflow:hidden;} /*20160622代码分析弹窗*/ -.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} \ No newline at end of file +.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} + +/*公共弹框*/ +/* 按钮*/ + + + + + +/* 加入班级弹窗 */ +#sy_popup_box{ + width:460px; + background:#fff; + padding-bottom:30px; + -webkit-border-radius:5px; + -moz-border-radius:5px; + -o-border-radius:5px; + border-radius:5px; + box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); +} +.sy_popup_top{ + background:#3b94d6; + height:40px; + -webkit-border-radius: 5px 5px 0px 0px; + -moz-border-radius: 5px 5px 0px 0px; + -o-border-radius: 5px 5px 0px 0px; + border-radius: 5px 5px 0px 0px; +} +.sy_popup_top h3{ + font-size:18px; + color:#fff; + font-weight:normal; + line-height:40px; + padding-left:10px; +} +a.sy_icons_close{ + width:20px; + height:20px; + display:block; + background: url(../images/sy/sy_icons_close.png) 0 0px no-repeat; + margin:8px 10px 0 0; +} +a:hover.sy_icons_close{ + background: url(../images/sy/sy_icons_close.png) -40px 0px no-repeat; +} +.sy_popup_con{ + margin:30px auto 0; + font-size:14px; + width:330px; +} +.sy_popup_add label{ + display:block; + float:left; + width:85px; + text-align:right; + line-height:40px; +} +.sy_popup_add li{ + line-height:40px; +} +.sy_input_txt{ + border:1px solid #dedede; + height:36px; + background:#fff; + padding:0 5px; + width:220px; +} +.sy_popup_con02{ + margin:30px auto 0; + font-size:14px; + text-align:center; + width:360px; +} +.sy_popup_con02 ul li p{ + margin-bottom:15px; + text-align:center; + font-size:14px; + color:#616161; +} +.sy_popup_con02 a{ margin:0 auto;} +.sy_popup_top_tishi{ background:#ededed; } +.sy_popup_top_tishi h3{color:#616161; font-size:16px;} +a.sy_icons_close02{ + width:20px; + height:20px; + display:block; + background: url(../images/sy/sy_icons_close02.png) 0 0px no-repeat; + margin:8px 10px 0 0; +} +a:hover.sy_icons_close02{ + background: url(../images/sy/sy_icons_close02.png) -40px 0px no-repeat; +} \ No newline at end of file diff --git a/public/stylesheets/sy_public.css b/public/stylesheets/sy_public.css index 7c79bf6e6..77c782698 100644 --- a/public/stylesheets/sy_public.css +++ b/public/stylesheets/sy_public.css @@ -62,34 +62,34 @@ a.sy_btn_green{ border-radius:3px; } a:hover.sy_btn_green{ background: #51a74f;} -a.sy_btn_grey{ - color: #333; - background: #e1e1e1; - text-align: center; - font-size: 12px; - padding:0 15px; - height: 30px; - line-height: 30px; - -webkit-border-radius:3px; - -moz-border-radius:3px; - -o-border-radius:3px; - border-radius:3px; -} -a:hover.sy_btn_grey{ background: #c3c3c3;} -a.sy_btn_blue{ - color: #fff; - background: #3b94d6; - text-align: center; - font-size: 12px; - padding:0 15px; - height: 30px; - line-height: 30px; - -webkit-border-radius:3px; - -moz-border-radius:3px; - -o-border-radius:3px; - border-radius:3px; -} -a:hover.sy_btn_blue{ background: #2788d0;} +/*a.sy_btn_grey{*/ + /*color: #333;*/ + /*background: #e1e1e1;*/ + /*text-align: center;*/ + /*font-size: 12px;*/ + /*padding:0 15px;*/ + /*height: 30px;*/ + /*line-height: 30px;*/ + /*-webkit-border-radius:3px;*/ + /*-moz-border-radius:3px;*/ + /*-o-border-radius:3px;*/ + /*border-radius:3px;*/ +/*}*/ +/*a:hover.sy_btn_grey{ background: #c3c3c3;}*/ +/*a.sy_btn_blue{*/ + /*color: #fff;*/ + /*background: #3b94d6;*/ + /*text-align: center;*/ + /*font-size: 12px;*/ + /*padding:0 15px;*/ + /*height: 30px;*/ + /*line-height: 30px;*/ + /*-webkit-border-radius:3px;*/ + /*-moz-border-radius:3px;*/ + /*-o-border-radius:3px;*/ + /*border-radius:3px;*/ +/*}*/ +/*a:hover.sy_btn_blue{ background: #2788d0;}*/ /* 排序 */ .sy_category{ height: 50px;