[IMP] website_crm_partner_assign: move partner grade filter in the left column
bzr revid: odo@openerp.com-20140131104232-62nc8wua8xflrd64
This commit is contained in:
parent
8342a7c51d
commit
c52cd95348
|
@ -1,12 +1,13 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import werkzeug
|
||||
|
||||
import openerp
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.addons.web import http
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.web.http import request
|
||||
from openerp.addons.website_partner.controllers import main as website_partner
|
||||
import werkzeug.urls
|
||||
|
||||
class WebsiteCrmPartnerAssign(http.Controller):
|
||||
_references_per_page = 20
|
||||
|
@ -14,16 +15,25 @@ class WebsiteCrmPartnerAssign(http.Controller):
|
|||
@http.route([
|
||||
'/partners/',
|
||||
'/partners/page/<int:page>/',
|
||||
|
||||
'/partners/grade/<int:grade_id>',
|
||||
'/partners/grade/<int:grade_id>/page/<int:page>/',
|
||||
|
||||
'/partners/country/<int:country_id>',
|
||||
'/partners/country/<country_name>-<int:country_id>',
|
||||
'/partners/country/<int:country_id>/page/<int:page>/',
|
||||
'/partners/country/<country_name>-<int:country_id>/page/<int:page>/',
|
||||
|
||||
'/partners/grade/<int:grade_id>/country/<int:country_id>/',
|
||||
'/partners/grade/<int:grade_id>/country/<country_name>-<int:country_id>',
|
||||
'/partners/grade/<int:grade_id>/country/<int:country_id>/page/<int:page>/',
|
||||
'/partners/grade/<int:grade_id>/country/<country_name>-<int:country_id>/page/<int:page>/',
|
||||
|
||||
], type='http', auth="public", website=True, multilang=True)
|
||||
def partners(self, country_id=0, page=0, **post):
|
||||
def partners(self, country_id=0, grade_id=0, page=0, **post):
|
||||
country_obj = request.registry['res.country']
|
||||
partner_obj = request.registry['res.partner']
|
||||
post_name = post.get('search', '')
|
||||
grade_id = post.get('grade', '')
|
||||
country = None
|
||||
|
||||
# format displayed membership lines domain
|
||||
|
@ -83,7 +93,7 @@ class WebsiteCrmPartnerAssign(http.Controller):
|
|||
context=request.context, count=True)
|
||||
grades.insert(0, {
|
||||
'grade_id_count': grades_partners,
|
||||
'grade_id': ("all", _("All Levels"))
|
||||
'grade_id': (0, _("All Categories"))
|
||||
})
|
||||
|
||||
values = {
|
||||
|
|
|
@ -35,13 +35,27 @@
|
|||
Contact a reseller
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 mb32" id="partner_left">
|
||||
<h3>Resellers by Country</h3>
|
||||
|
||||
<ul class="nav nav-pills nav-stacked mt16">
|
||||
<li class="nav-header"><h3>Categories</h3></li>
|
||||
<t t-foreach="grades" t-as="grade">
|
||||
<li t-if="grade['grade_id']" t-att-class="grade['grade_id'][0] == grade_id and 'active' or ''">
|
||||
<a t-attf-href="#{ grade['grade_id'][0] and '/partners/grade/%s' % grade['grade_id'][0] or '/partners' }#{ current_country_id and ('/country/%s' % current_country_id) or '' }#{ search_path }">
|
||||
<span class="badge pull-right" t-esc="grade['grade_id_count'] or ''"/>
|
||||
<t t-esc="grade['grade_id'][1]"/>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
|
||||
<ul id="reseller_countries" class="nav nav-pills nav-stacked mt16">
|
||||
<li class="nav-header"><h3>Locations</h3></li>
|
||||
<t t-foreach="countries" t-as="country_dict">
|
||||
<t t-if="country_dict['country_id']">
|
||||
<li t-att-class="country_dict['country_id'][0] == current_country_id and 'active' or ''">
|
||||
<a t-attf-href="#{ country_dict['country_id'][0] and '/partners/country/%s' % slug(country_dict['country_id']) or '/partners/' }#{ search_path }">
|
||||
<a t-attf-href="#{ country_dict['country_id'][0] and ('/partners/country/%s' % slug(country_dict['country_id'])) or '/partners/' }#{ search_path }">
|
||||
<span class="badge pull-right" t-esc="country_dict['country_id_count'] or ''"/>
|
||||
<t t-esc="country_dict['country_id'][1]"/>
|
||||
</a>
|
||||
|
@ -49,7 +63,9 @@
|
|||
</t>
|
||||
</t>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-8" id="ref_content">
|
||||
<div class='navbar'>
|
||||
<div>
|
||||
|
@ -60,17 +76,7 @@
|
|||
<div class="form-group">
|
||||
<input type="text" name="search" class="search-query col-md-2 mt4 form-control" placeholder="Search" t-att-value="searches.get('search', '')"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select class="search-query col-md-2 mt4 form-control" name="grade" t-if="len(grades) > 1" onchange="submit()">
|
||||
<t t-foreach="grades">
|
||||
<t t-if="grade_id">
|
||||
<option t-att-selected="searches.get('grade') == str(grade_id and grade_id[0]) and 'selected'" t-att-value="grade_id[0]">
|
||||
<t t-esc="grade_id[1]"/> (<t t-esc="grade_id_count"/>)
|
||||
</option>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -103,7 +109,7 @@
|
|||
</template>
|
||||
|
||||
<template id="ref_country" inherit_id="website_crm_partner_assign.index" inherit_option_id="website_crm_partner_assign.index" name="Left World Map">
|
||||
<xpath expr="//div[@id='partner_left']//ul" position="after">
|
||||
<xpath expr="//ul[@id='reseller_countries']" position="after">
|
||||
<h3>World Map</h3>
|
||||
<ul class="nav">
|
||||
<iframe t-attf-src="/google_map/?width=320&height=240&partner_ids=#{ google_map_partner_ids }&partner_url=/partners/"
|
||||
|
|
Loading…
Reference in New Issue