[FIX] [CLEAN] website_project: added controller and dummy template for task. Will have to be improved, but at least we have a controller. Some cleaning has been performed, notably about indentation.
bzr revid: tde@openerp.com-20130924145445-udqk94zvwq72mr24
This commit is contained in:
parent
0cfd15ff72
commit
f702cafdc5
|
@ -1,15 +1,16 @@
|
|||
|
||||
{
|
||||
'name': 'Public Projects',
|
||||
'name': 'Public Projects',
|
||||
'category': 'Website',
|
||||
'summary': 'Publish Your Public Projects',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
OpenERP Blog
|
||||
============
|
||||
OpenERP Projects
|
||||
================
|
||||
|
||||
""",
|
||||
'author': 'OpenERP SA',
|
||||
'depends': ['website', 'project'],
|
||||
'depends': ['website_mail', 'project'],
|
||||
'data': [
|
||||
'views/website_project.xml',
|
||||
],
|
||||
|
|
|
@ -1,13 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.addons.web import http
|
||||
from openerp.addons.web.http import request
|
||||
from openerp.addons.website import website
|
||||
from openerp.osv import osv
|
||||
|
||||
|
||||
class Website(osv.osv):
|
||||
class Website(osv.Model):
|
||||
_inherit = "website"
|
||||
|
||||
def preprocess_request(self, cr, uid, ids, *args, **kwargs):
|
||||
project_obj = request.registry['project.project']
|
||||
project_ids = project_obj.search(cr, uid, [('privacy_visibility', "=", "public")], context=request.context)
|
||||
|
@ -20,7 +40,25 @@ class Website(osv.osv):
|
|||
class website_project(http.Controller):
|
||||
|
||||
@website.route(['/project/<int:project_id>/'], type='http', auth="public")
|
||||
def blog(self, project_id=None, **post):
|
||||
def project(self, project_id=None, **post):
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
project_obj = request.registry['project.project']
|
||||
|
||||
project = project_obj.browse(request.cr, request.uid, project_id, request.context)
|
||||
return request.website.render("website_project.index", {'project_id': project})
|
||||
|
||||
render_values = {
|
||||
'project': project
|
||||
}
|
||||
return request.website.render("website_project.index", render_values)
|
||||
|
||||
@website.route(['/project/task/<int:task_id>'], type='http', auth="public")
|
||||
def task(self, task_id=None, **post):
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
task_obj = request.registry['project.task']
|
||||
|
||||
task = task_obj.browse(cr, uid, task_id, context=context)
|
||||
|
||||
render_values = {
|
||||
'task': task
|
||||
}
|
||||
return request.website.render("website_project.task", render_values)
|
||||
|
|
|
@ -1,57 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data>
|
||||
|
||||
<!-- Layout add nav and footer -->
|
||||
<template id="footer_custom" inherit_id="website.layout" name="Custom Footer">
|
||||
<xpath expr="//footer//ul[@name='products']" position="inside">
|
||||
<li t-foreach="website_project_ids" t-as="project"><a t-attf-href="/project/#{ project.id }/"><t t-esc="project.name"/></a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Layout add nav and footer -->
|
||||
<!-- Task -->
|
||||
<template id="task" name="Task">
|
||||
<t t-call="website.layout">
|
||||
<t t-set="title">Task</t>
|
||||
<div id="wrap">
|
||||
<div class="container">
|
||||
<h4 t-field="task.name"/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="footer_custom" inherit_id="website.layout" name="Custom Footer">
|
||||
<xpath expr="//footer//ul[@name='products']" position="inside">
|
||||
<li t-foreach="website_project_ids" t-as="project"><a t-attf-href="/project/#{ project.id }/"><t t-esc="project.name"/></a></li>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Page -->
|
||||
|
||||
|
||||
<template id="kanban_card" name="Project">
|
||||
<div class="thumbnail">
|
||||
<a t-attf-href="/task/#{ object_id.id }/"><span t-field="object_id.name"/></a>
|
||||
<div>
|
||||
Assigned to <span t-field="object_id.user_id"/>
|
||||
<!-- Project -->
|
||||
<template id="task_kanban_card" name="TaskKanban">
|
||||
<div class="thumbnail">
|
||||
<a t-attf-href="/project/task/#{object_id.id}/"><span t-field="object_id.name"/></a>
|
||||
<div>
|
||||
Assigned to <span t-field="object_id.user_id"/>
|
||||
</div>
|
||||
<div>
|
||||
<span t-foreach="object_id.categ_ids" t-as="categ_id" class="label">
|
||||
<t t-esc="categ_id.name"/>
|
||||
</span>
|
||||
</div>
|
||||
<small>
|
||||
<i class="icon-time"></i> <span t-field="object_id.date_start"/><br/>
|
||||
<t t-if="object_id.date_end">Ending Date: <span t-field="object_id.date_end"/></t>
|
||||
</small>
|
||||
</div>
|
||||
<div>
|
||||
<span t-foreach="object_id.categ_ids" t-as="categ_id" class="label">
|
||||
<t t-esc="categ_id.name"/>
|
||||
</span>
|
||||
</div>
|
||||
<small>
|
||||
<i class="icon-time"></i> <span t-field="object_id.date_start"/><br/>
|
||||
<t t-if="object_id.date_end">Ending Date: <span t-field="object_id.date_end"/></t>
|
||||
</small>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<template id="index" name="Project">
|
||||
<t t-call="website.layout">
|
||||
<t t-set="title">Project</t>
|
||||
<div id="wrap">
|
||||
<div class="container">
|
||||
<h4 t-field="project.name"/>
|
||||
<t t-call="website.kanban">
|
||||
<t t-set="model">project.task</t>
|
||||
<t t-set="domain" t-value="[('project_id', '=', project.id)]"/>
|
||||
<t t-set="column">stage_id</t>
|
||||
<t t-set="template">website_project.task_kanban_card</t>
|
||||
<t t-set="step">10</t>
|
||||
<t t-set="scope">3</t>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="index" name="Project">
|
||||
<t t-call="website.layout">
|
||||
<t t-set="title">Project</t>
|
||||
<div id="wrap">
|
||||
<div class="oe_structure"/>
|
||||
<div class="container">
|
||||
<h4 t-field="project_id.name"/>
|
||||
<t t-call="website.kanban">
|
||||
<t t-set="model">project.task</t>
|
||||
<t t-set="domain" t-value="[('project_id', '=', project_id.id)]"/>
|
||||
<t t-set="column">stage_id</t>
|
||||
<t t-set="template">website_project.kanban_card</t>
|
||||
<t t-set="step">10</t>
|
||||
<t t-set="scope">3</t>
|
||||
</t>
|
||||
</div>
|
||||
<div class="oe_structure"/>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue