diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 372c2bac..daecbe75 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1290,7 +1290,6 @@ end school.update_attributes(:partner_id => partner.id) end end - render :json => {status: 1, message: "创建成功!"} end end @@ -1339,13 +1338,17 @@ end @partner = Partner.where(:id => params[:partner]).first @members = if params[:search] - User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%'") + User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%' AND partner_id is NULL") else - User.where(:certification => 1) + User.where(:certification => 1, :partner_id => nil ) end - @members = paginateHelper @members, 8 + @total_pages = (@members.count / 10.0).ceil + @members = paginateHelper @members, 10 respond_to do |format| format.js + format.json { + render json: member_json_data(@members) + } end end @@ -1358,10 +1361,18 @@ end user.update_attributes(partner_id: @partner.id) if !@partner.nil? && !user.nil? end end + end - redirect_to partners_managements_path + # 合作伙伴删除管理员 + def delete_partner_member + if params[:partner] && params[:partner_member] + @partner = Partner.find_by_id params[:partner] + user = User.find_by_id params[:partner_member] + user.update_attributes(partner_id: nil) if !@partner.nil? && !user.nil? + end end + # check 部门 identifier是否重复 def check_depart_identifier logger.info("###############{params}") @@ -4380,4 +4391,19 @@ end book.write xls_report xls_report.string end + + def member_json_data mmebers + mmebers.map do |member| + real_name = member.show_real_name + identity = member.identity + school_name = member.school_name + user_phone = member.phone || "" + member.attributes.dup.except("login", "hashed_password", "salt", "status", "mail", "experience", "grade", + "authentication", "professional_certification").merge({real_name: real_name, + identity: identity, + school_name: school_name, + user_phone: user_phone}) + end + end + end diff --git a/app/views/managements/_partner_addManage.html.erb b/app/views/managements/_partner_addManage.html.erb index 9c8769ae..54a141a4 100644 --- a/app/views/managements/_partner_addManage.html.erb +++ b/app/views/managements/_partner_addManage.html.erb @@ -14,7 +14,7 @@

<%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %> -
+
<%= render :partial => "partner_member_search_list" %>
<% end %> @@ -27,14 +27,14 @@
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index c3ac80c7..ff0be82f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -556,6 +556,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'partners' get 'add_partner_member_box' post 'add_partner_member' + delete 'delete_partner_member' get 'get_partner' get 'all_partners' post 'add_partner' diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 9a18a93a..449a1bcd 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -2984,9 +2984,10 @@ a.singlepublishtwo{ } .partnerList{max-height: 500px;overflow-y: auto;} .manageList{float: left} -.manageList li{width: 60px;height: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;} -.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;float: left;margin-right: 10px;border-radius: 50%;} +.manageList li{width: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;} +.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;margin-right: 10px;border-radius: 50%;display: block} .addManage{display: block;background: #cdcdcd;color: #fff!important;font-size: 55px;} +.managementName{display: block;width: 60px;color: #666;} .removeImg{position: absolute;right: 1px;top: -12px;} .tableList .tableHead{background: #fafafa} .tableList{min-height: 400px;} @@ -3133,40 +3134,40 @@ line-height: 20px;display: inline-block;color: rgba(65, 140, 205, 1) !important; width: calc( 100% ) } #requireTable thead .td-head-child:last-child{border-right: none;} - - -/*用户列表*/ -.managerPanels a{margin-right:24px;} -.managerPanels a:nth-child(16n){margin-right: 0px;} -.managerPanels a span{display: block;text-align: center;max-width: 70px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color: #666;} -.managerPanels a:hover span{color: #4cacff!important;} -.userimg{position: absolute;top: -16px;right: -5px;} -.useradd{font-size: 42px !important; position: absolute; top: -16px;} -.ListTableLines .column-2{ - width: 150px; - text-align: center; - padding-left: 5px; - box-sizing: border-box; - color:#999999; -} -.ListTableLines .column-No{ - color:#999999; -} -.courselist .column-2{ - width: 150px; - text-align: center; - padding-left: 5px; - box-sizing: border-box; - color:#656565; -} -.courselist .column-No{ - color:#999999; -} -.poll_list a { - display: inline-block; - padding: 20px; - font-size: 18px; - text-align: center; - position: relative; - color: #05101a; + + +/*用户列表*/ +.managerPanels a{margin-right:24px;} +.managerPanels a:nth-child(16n){margin-right: 0px;} +.managerPanels a span{display: block;text-align: center;max-width: 70px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color: #666;} +.managerPanels a:hover span{color: #4cacff!important;} +.userimg{position: absolute;top: -16px;right: -5px;} +.useradd{font-size: 42px !important; position: absolute; top: -16px;} +.ListTableLines .column-2{ + width: 150px; + text-align: center; + padding-left: 5px; + box-sizing: border-box; + color:#999999; +} +.ListTableLines .column-No{ + color:#999999; +} +.courselist .column-2{ + width: 150px; + text-align: center; + padding-left: 5px; + box-sizing: border-box; + color:#656565; +} +.courselist .column-No{ + color:#999999; +} +.poll_list a { + display: inline-block; + padding: 20px; + font-size: 18px; + text-align: center; + position: relative; + color: #05101a; } \ No newline at end of file