From 2c1bd03c4651f5aa9d441c54b1841fcf34ba2584 Mon Sep 17 00:00:00 2001 From: jasder Date: Thu, 4 Apr 2019 09:27:08 +0800 Subject: [PATCH 1/3] ADD --- app/controllers/managements_controller.rb | 12 +++++++ .../managements/_partner_addManage.html.erb | 34 +++++++++---------- .../managements/add_partner_member_box.js.erb | 7 ++++ config/routes.rb | 1 + 4 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 app/views/managements/add_partner_member_box.js.erb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 9a42aae4..6fcc149a 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1206,6 +1206,18 @@ end end end + # 添加合作伙伴管理员- 弹框 + def add_partner_member_box + @partner = Partner.first + @members = + if params[:search] + User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%'") + else + User.where(:certification => 1) + end + @members = paginateHelper @members, 8 + end + # check 部门 identifier是否重复 def check_depart_identifier logger.info("###############{params}") diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb index 818a4777..4f7e145f 100644 --- a/app/views/managements/_partner_addManage.html.erb +++ b/app/views/managements/_partner_addManage.html.erb @@ -33,24 +33,22 @@ 手机号

-

- - - - - 学生 - 湖北工业大学 - 156****9087 -

-

- - - - - 学生 - 湖北工业大学 - -

+ + <%= form_for @partner, :url => add_depart_member_managements_path,:html => {:id => 'add_depart_member_form', :remote => true, :method => :post} do |f| %> + <% @members.each do |member| %> +

+ + + + + <%= member.identity %> + <%= member.school_name %> + <%= member.phone %> +

+ <% end %> + <% end %> + +

diff --git a/app/views/managements/add_partner_member_box.js.erb b/app/views/managements/add_partner_member_box.js.erb new file mode 100644 index 00000000..72197cd0 --- /dev/null +++ b/app/views/managements/add_partner_member_box.js.erb @@ -0,0 +1,7 @@ + +<% if params[:search] || params[:page] %> +$("#depart_member_search_list").html("<%= j(render :partial => "depart_member_search_list") %>") +<% else %> + var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>"; + pop_box_new(html,572,500); +<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 57410238..f98c6e4f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -554,6 +554,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 post 'import_departments' match 'departments', :via => [:get, :post] get 'partners' + get 'add_partner_member_box' delete 'delete_depart_member' get 'add_depart_member_box' post 'add_depart_member' From 367b3a619723ba658e819182b80550b37b55bd20 Mon Sep 17 00:00:00 2001 From: jasder Date: Thu, 4 Apr 2019 09:54:48 +0800 Subject: [PATCH 2/3] FIX --- app/controllers/managements_controller.rb | 7 ++++++- app/views/managements/_partner_addManage.html.erb | 2 +- app/views/managements/partners.html.erb | 8 +++----- config/routes.rb | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 84df89dd..dc1d39e3 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1174,7 +1174,7 @@ end def partners @menu_type = 6 @sub_type = 3 - @partners = Partner.includes(:school) + @partners = Partner.includes(:school).order("created_at desc") end def all_partners @@ -1219,6 +1219,7 @@ end school.save end render :json => {status: 1, message: "创建成功!"} + redirects_to partners_path end end @@ -1265,6 +1266,10 @@ end @members = paginateHelper @members, 8 end + def add_partner_member + + end + # check 部门 identifier是否重复 def check_depart_identifier logger.info("###############{params}") diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb index 4f7e145f..4f2b9fad 100644 --- a/app/views/managements/_partner_addManage.html.erb +++ b/app/views/managements/_partner_addManage.html.erb @@ -34,7 +34,7 @@

- <%= form_for @partner, :url => add_depart_member_managements_path,:html => {:id => 'add_depart_member_form', :remote => true, :method => :post} do |f| %> + <%= form_for "", :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %> <% @members.each do |member| %>

diff --git a/app/views/managements/partners.html.erb b/app/views/managements/partners.html.erb index 1d39b899..cf16ead1 100644 --- a/app/views/managements/partners.html.erb +++ b/app/views/managements/partners.html.erb @@ -21,7 +21,9 @@

管理员
    -
  • +
  • +
  • + <%= link_to '+', add_partner_member_box_managements_path(:partner => 1), :remote => true, :class => "addManage" %> +
@@ -65,10 +67,6 @@ pop_box_new(html,572,500); }) - $(".manageList").on("click",".addManage",function(){ - var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>"; - pop_box_new(html,572,500); - }) }) \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index b539fdf5..efc9756e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -555,6 +555,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 match 'departments', :via => [:get, :post] get 'partners' get 'add_partner_member_box' + post 'add_partner_member' get 'all_partners' post 'add_partner' delete 'delete_depart_member' From 0aec53dda74a8e3e3ac8c0f2cd70e38a65bfecbe Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 4 Apr 2019 10:08:45 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../managements/_partner_addManage.html.erb | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb index 4f2b9fad..94e3ba0b 100644 --- a/app/views/managements/_partner_addManage.html.erb +++ b/app/views/managements/_partner_addManage.html.erb @@ -1,29 +1,9 @@
添加管理员
-
-
  • - - -

    - 姓名: - 单位: -

    -
    - 职业: -
    - - -
    -

    请选择职业

    -

    教师

    -

    学生

    -

    专业人士

    -
    -
    - 搜索 -
    -
  • +
    + + 搜索