客户列表调整

dev_local
cxt 6 years ago
parent 260cc5b598
commit 0e8b1d5ee8

@ -1,8 +1,11 @@
class CooperatesController < ApplicationController
before_filter :require_login
before_filter :find_partner, only: [:partner_list]
before_filter :is_admin, only: [:partner_list]
def partner_list
search = params[:search]
@schools = School.where(id: [117, 179, 3181, 3216])
@schools = School.where(customer_id: @partner.customer_ids)
@all_count = @schools.size
unless search.blank?
@ -17,4 +20,17 @@ class CooperatesController < ApplicationController
format.html{render :layout => "base_edu"}
end
end
def find_partner
@partner = Partner.find_by_id(params[:id])
render_404 if @partner.nil? || @partner.status == -1
rescue ActiveRecord::RecordNotFound
render_404
end
def is_admin
unless User.current.admin? || (User.current.partner.present? && User.current.partner == @partner)
render_403
end
end
end

@ -52,6 +52,9 @@
<li><%= link_to '我的课堂', user_path(User.current) %></li>
<li><%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %></li>
<li><%= link_to '我的实训课程', user_path(User.current, :type => 'a_path') %></li>
<% if User.current.partner.present? %>
<li><%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %></li>
<% end %>
<li><%= link_to '我的项目', user_path(User.current, :type => 'a_project') %></li>
<li><a>客户管理</a></li>

@ -42,11 +42,10 @@ RedmineApp::Application.routes.draw do ## oauth相关
resources :cooperates do
member do
get 'partner_list'
end
collection do
get 'partner_list'
end
end

Loading…
Cancel
Save