Galatea User

This commit is contained in:
resteve 2014-12-15 15:04:02 +01:00
parent 32f16cbaa3
commit 4cfeb9a16a
5 changed files with 35 additions and 9 deletions

View file

@ -78,6 +78,10 @@ msgctxt "field:galatea.tutorial,slug_langs:"
msgid "Slug Langs"
msgstr "Slug idiomes"
msgctxt "field:galatea.tutorial,user:"
msgid "User"
msgstr "Usuari"
msgctxt "field:galatea.tutorial,websites:"
msgid "Websites"
msgstr "Llocs web"
@ -213,7 +217,7 @@ msgid ""
"Almost all search engines recommend it to be shorter than 155 characters of "
"plain text"
msgstr ""
"La majoría dels cercadors recomanen un text de 155 caràcters de text pla."
"La majoria dels cercadors recomanen un text de 155 caràcters de text pla."
msgctxt "help:galatea.tutorial,metakeywords:"
msgid "Separated by comma"
@ -270,7 +274,7 @@ msgstr "Comentaris"
msgctxt "model:ir.action,name:act_tutorial_form"
msgid "Tutorials"
msgstr "Tutoriales"
msgstr "Tutorials"
msgctxt "model:ir.ui.menu,name:menu_galatea_tutorial"
msgid "Tutorial"
@ -282,7 +286,7 @@ msgstr "Comentaris"
msgctxt "model:ir.ui.menu,name:menu_tutorial_form"
msgid "Tutorials"
msgstr "Tutoriales"
msgstr "Tutorials"
msgctxt "model:res.group,name:group_galatea_tutorial"
msgid "Galatea Tutorial"
@ -322,7 +326,7 @@ msgstr "Tutorial"
msgctxt "view:galatea.tutorial:"
msgid "Tutorials"
msgstr "Tutoriales"
msgstr "Tutorials"
msgctxt "view:galatea.tutorial:"
msgid "Websites"

View file

@ -78,6 +78,10 @@ msgctxt "field:galatea.tutorial,slug_langs:"
msgid "Slug Langs"
msgstr "Slug idiomas"
msgctxt "field:galatea.tutorial,user:"
msgid "User"
msgstr "Usuario"
msgctxt "field:galatea.tutorial,websites:"
msgid "Websites"
msgstr "Sitios web"
@ -243,7 +247,7 @@ msgstr ""
msgctxt "help:galatea.website,tutorial_anonymous:"
msgid "Active user anonymous to publish comments."
msgstr "Activar usuarios anónimos en publicar comentaios."
msgstr "Activar usuarios anónimos en publicar comentarios."
msgctxt "help:galatea.website,tutorial_comment:"
msgid "Active tutorial comments."

View file

@ -31,6 +31,7 @@ class GalateaTutorial(ModelSQL, ModelView):
metatitle = fields.Char('Meta Title', translate=True)
active = fields.Boolean('Active',
help='Dissable to not show content tutorial.')
user = fields.Many2One('galatea.user', 'User', required=True)
websites = fields.Many2Many('galatea.tutorial-galatea.website',
'tutorial', 'website', 'Websites',
help='Tutorial will be available in those websites')
@ -53,6 +54,17 @@ class GalateaTutorial(ModelSQL, ModelView):
def default_comment():
return True
@classmethod
def default_user(cls):
Website = Pool().get('galatea.website')
websites = Website.search([('active', '=', True)], limit=1)
if not websites:
return None
website, = websites
if website.tutorial_anonymous_user:
return website.tutorial_anonymous_user.id
return None
@classmethod
def __setup__(cls):
super(GalateaTutorial, cls).__setup__()
@ -139,10 +151,13 @@ class GalateaTutorialComment(ModelSQL, ModelView):
@classmethod
def default_user(cls):
Website = Pool().get('galatea.website')
websites = Website.search([('active', '=', True)])
if len(websites) == 1:
if websites[0].tutorial_anonymous_user:
return websites[0].tutorial_anonymous_user.id
websites = Website.search([('active', '=', True)], limit=1)
if not websites:
return None
website, = websites
if website.tutorial_anonymous_user:
return website.tutorial_anonymous_user.id
return None
@classmethod
def get_comment_create_date(cls, records, name):

View file

@ -8,6 +8,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="slug"/>
<label name="active"/>
<field name="active"/>
<label name="user"/>
<field name="user"/>
<notebook colspan="4">
<page string="Descriptions" id="descriptions">
<field name="description" colspan="4"/>

View file

@ -4,6 +4,7 @@ this repository contains the full copyright notices and license terms. -->
<tree string="Tutorials">
<field name="name"/>
<field name="slug"/>
<field name="user"/>
<field name="websites" tree_invisible="1"/>
<field name="active" tree_invisible="1"/>
</tree>