mirror of
https://github.com/NaN-tic/trytond-galatea_cms.git
synced 2023-12-14 04:32:53 +01:00
URI website
This commit is contained in:
parent
a47515a1b5
commit
8de8574072
2 changed files with 13 additions and 0 deletions
11
cms.py
11
cms.py
|
@ -90,6 +90,7 @@ class Article(ModelSQL, ModelView):
|
|||
slug = fields.Char('Slug', required=True, translate=True,
|
||||
help='Cannonical uri.')
|
||||
slug_langs = fields.Function(fields.Dict(None, 'Slug Langs'), 'get_slug_langs')
|
||||
uri = fields.Function(fields.Char('Uri'), 'get_uri')
|
||||
description = fields.Text('Description', required=True, translate=True,
|
||||
help='You could write wiki markup to create html content. Formats text following '
|
||||
'the MediaWiki (http://meta.wikimedia.org/wiki/Help:Editing) syntax.')
|
||||
|
@ -169,6 +170,16 @@ class Article(ModelSQL, ModelView):
|
|||
|
||||
return slugs
|
||||
|
||||
def get_uri(self, name):
|
||||
if self.galatea_website:
|
||||
locale = Transaction().context.get('language', 'en')
|
||||
return '%s%s/%s' % (
|
||||
self.galatea_website.uri,
|
||||
locale[:2],
|
||||
self.slug,
|
||||
)
|
||||
return ''
|
||||
|
||||
|
||||
class Block(ModelSQL, ModelView):
|
||||
"Block CMS"
|
||||
|
|
|
@ -12,6 +12,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="template"/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
<label name="uri"/>
|
||||
<field name="uri" widget="url"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Descriptions" id="descriptions">
|
||||
<field name="description"/>
|
||||
|
|
Loading…
Reference in a new issue