diff options
Diffstat (limited to 'addons/website_event')
| -rw-r--r-- | addons/website_event/controllers/main.py | 4 | ||||
| -rw-r--r-- | addons/website_event/static/src/js/website.tour.event.js | 75 | ||||
| -rw-r--r-- | addons/website_event/static/src/js/website_event.editor.js | 4 | ||||
| -rw-r--r-- | addons/website_event/tests/__init__.py | 8 | ||||
| -rw-r--r-- | addons/website_event/tests/test_controllers.py | 29 | ||||
| -rw-r--r-- | addons/website_event/tests/test_ui.py | 9 | ||||
| -rw-r--r-- | addons/website_event/tests/ui_suite/event_test.js | 17 | ||||
| -rw-r--r-- | addons/website_event/views/website_event.xml | 39 |
8 files changed, 66 insertions, 119 deletions
diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index e7e0b4ec9ff..2a6e1d134e3 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -203,7 +203,9 @@ class website_event(http.Controller): def add_event(self, event_name="New Event", **kwargs): return self._add_event(event_name, request.context, **kwargs) - def _add_event(self, event_name="New Event", context={}, **kwargs): + def _add_event(self, event_name=None, context={}, **kwargs): + if not event_name: + event_name = _("New Event") Event = request.registry.get('event.event') date_begin = datetime.today() + timedelta(days=(14)) vals = { diff --git a/addons/website_event/static/src/js/website.tour.event.js b/addons/website_event/static/src/js/website.tour.event.js index 05de73ceffb..73510b455dd 100644 --- a/addons/website_event/static/src/js/website.tour.event.js +++ b/addons/website_event/static/src/js/website.tour.event.js @@ -2,6 +2,7 @@ 'use strict'; var website = openerp.website; + var _t = openerp._t; website.EditorBar.include({ start: function () { @@ -18,93 +19,93 @@ var self = this; self.steps = [ { - title: "Create an Event", - content: "Let's go through the first steps to publish a new event.", - template: self.popover({ next: "Start Tutorial", end: "Skip It" }), + title: _t("Create an Event"), + content: _t("Let's go through the first steps to publish a new event."), + popover: { next: _("Start Tutorial"), end: _("Skip It") }, }, { element: '#content-menu-button', placement: 'left', - title: "Add Content", - content: "The <em>Content</em> menu allows you to create new pages, events, menus, etc.", - template: self.popover({ fixed: true }), + title: _t("Add Content"), + content: _t("The <em>Content</em> menu allows you to create new pages, events, menus, etc."), + popover: { fixed: true }, }, { element: 'a[data-action=new_event]', placement: 'left', - title: "New Event", - content: "Click here to create a new event.", - template: self.popover({ fixed: true }), + title: _t("New Event"), + content: _t("Click here to create a new event."), + popover: { fixed: true }, }, { - element: '.modal:contains("New Event") input[type=text]', + element: '.modal #editor_new_event input[type=text]', sampleText: 'Advanced Technical Training', placement: 'right', - title: "Create an Event Name", - content: "Create a name for your new event and click <em>'Continue'</em>. e.g: Technical Training", + title: _t("Create an Event Name"), + content: _t("Create a name for your new event and click <em>'Continue'</em>. e.g: Technical Training"), }, { waitNot: '.modal input[type=text]:not([value!=""])', element: '.modal button.btn-primary', placement: 'right', - title: "Create Event", - content: "Click <em>Continue</em> to create the event.", + title: _t("Create Event"), + content: _t("Click <em>Continue</em> to create the event."), }, { - waitFor: '#website-top-navbar button[data-action="save"]:visible', - title: "New Event Created", - content: "This is your new event page. We will edit the event presentation page.", - template: self.popover({ next: "Continue" }), + waitFor: 'body:has(button[data-action=save]:visible):has(.js_event)', + title: _t("New Event Created"), + content: _t("This is your new event page. We will edit the event presentation page."), + popover: { next: _t("Continue") }, }, { element: 'button[data-action=snippet]', placement: 'bottom', - title: "Layout your event", - content: "Insert blocks to layout the body of your event.", - template: self.popover({ fixed: true }), + title: _t("Layout your event"), + content: _t("Insert blocks to layout the body of your event."), + popover: { fixed: true }, }, { snippet: 'image-text', placement: 'bottom', - title: "Drag & Drop a block", - content: "Drag the 'Image-Text' block and drop it in your page.", - template: self.popover({ fixed: true }), + title: _t("Drag & Drop a block"), + content: _t("Drag the 'Image-Text' block and drop it in your page."), + popover: { fixed: true }, }, { element: 'button[data-action=snippet]', placement: 'bottom', - title: "Layout your event", - content: "Insert another block to your event.", - template: self.popover({ fixed: true }), + title: _t("Layout your event"), + content: _t("Insert another block to your event."), + popover: { fixed: true }, }, { snippet: 'text-block', placement: 'bottom', - title: "Drag & Drop a block", - content: "Drag the 'Text Block' in your event page.", - template: self.popover({ fixed: true }), + title: _t("Drag & Drop a block"), + content: _t("Drag the 'Text Block' in your event page."), + popover: { fixed: true }, }, { element: 'button[data-action=save]', placement: 'right', - title: "Save your modifications", - content: "Once you click on save, your event is updated.", - template: self.popover({ fixed: true }), + title: _t("Save your modifications"), + content: _t("Once you click on save, your event is updated."), + popover: { fixed: true }, }, { waitFor: 'button[data-action=edit]:visible', element: 'button.btn-danger.js_publish_btn', placement: 'top', - title: "Publish your event", - content: "Click to publish your event.", + title: _t("Publish your event"), + content: _t("Click to publish your event."), }, { waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible', element: '.js_publish_management button[data-toggle="dropdown"]', placement: 'left', - title: "Customize your event", - content: "Click here to customize your event further.", + title: _t("Customize your event"), + content: _t("Click here to customize your event further."), }, { element: '.js_publish_management ul>li>a:last:visible', diff --git a/addons/website_event/static/src/js/website_event.editor.js b/addons/website_event/static/src/js/website_event.editor.js index 056d6ed37e4..ac81be7ec36 100644 --- a/addons/website_event/static/src/js/website_event.editor.js +++ b/addons/website_event/static/src/js/website_event.editor.js @@ -2,6 +2,7 @@ "use strict"; var website = openerp.website; + var _t = openerp._t; website.add_template_file('/website_event/static/src/xml/website_event.xml'); website.is_editable = true; @@ -16,7 +17,8 @@ 'click a[data-action=new_event]': function (ev) { ev.preventDefault(); website.prompt({ - window_title: "New Event", + id: "editor_new_event", + window_title: _t("New Event"), input: "Event Name", }).then(function (event_name) { website.form('/event/add_event', 'POST', { diff --git a/addons/website_event/tests/__init__.py b/addons/website_event/tests/__init__.py index 5e7b52ddf04..3dcbf31d714 100644 --- a/addons/website_event/tests/__init__.py +++ b/addons/website_event/tests/__init__.py @@ -19,12 +19,6 @@ # ############################################################################## -import test_controllers - -import test_ui - -checks = [ - test_controllers, -] +#import test_ui # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/website_event/tests/test_controllers.py b/addons/website_event/tests/test_controllers.py deleted file mode 100644 index 33b37aede9d..00000000000 --- a/addons/website_event/tests/test_controllers.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- 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.addons.mail.tests.common import TestMail -from openerp.tools import mute_logger, email_split - - -class TestControllers(TestMail): - - def test_00(self): - cr, uid = self.cr, self.uid diff --git a/addons/website_event/tests/test_ui.py b/addons/website_event/tests/test_ui.py index 176bc77ecc5..fb6825b9a56 100644 --- a/addons/website_event/tests/test_ui.py +++ b/addons/website_event/tests/test_ui.py @@ -1,5 +1,6 @@ -import openerp.addons.website.tests.test_ui as test_ui +import openerp + +class TestUi(openerp.tests.HttpCase): + def test_admin(self): + self.phantom_js("/", "openerp.website.Tour.run_test('event')", "openerp.website.Tour") -def load_tests(loader, base, _): - base.addTest(test_ui.WebsiteUiSuite(test_ui.full_path(__file__,'event_test.js'), {'redirect': '/page/website.homepage'}, 60.0)) - return base diff --git a/addons/website_event/tests/ui_suite/event_test.js b/addons/website_event/tests/ui_suite/event_test.js deleted file mode 100644 index 06d6dc12b5f..00000000000 --- a/addons/website_event/tests/ui_suite/event_test.js +++ /dev/null @@ -1,17 +0,0 @@ -var testRunner = require('../../../website/tests/ui_suite/ui_test_runner.js'); - -var waitFor = testRunner.waitFor; - -testRunner.run(function eventTest (page, timeout) { - page.evaluate(function () { localStorage.clear(); }); - waitFor(function clientReady () { - return page.evaluate(function () { - return window.$ && window.openerp && window.openerp.website - && window.openerp.website.Tour; - }); - }, function executeTest () { - page.evaluate(function () { - window.openerp.website.Tour.get('event').run(true); - }); - }, timeout); -}); diff --git a/addons/website_event/views/website_event.xml b/addons/website_event/views/website_event.xml index 00469b7ce31..d002521b021 100644 --- a/addons/website_event/views/website_event.xml +++ b/addons/website_event/views/website_event.xml @@ -40,24 +40,17 @@ </div> <div class="row mt32 mb32"> <div class="col-md-9" id="middle_column"> - <t t-if="not event_ids"> - <div class="text-center text-muted"> - <h3 class="css_editable_display">No event found</h3> - <h3 class="css_editable_hidden">There isn't available events right now, <t t-if="current_date or current_country or current_type">click <a t-attf-href="/event">here</a> to check all events or</t> click <a t-attf-href="/page/website.contactus">here</a> to contact us</h3> - <t groups="base.group_website_publisher"> - <t groups="event.group_event_manager"> - <p>Click on "Content" to define a new event or "Help" for more informations.</p> - <img src="/website/static/src/img/content_here.png"/> - <p>In the backend's event form contains information to customize your events: location, oranizer, tikets, registrations, etc.</p> - </t> - </t> - </div> - </t> + <div class="text-center text-muted" t-if="not event_ids"> + <h1>No event found</h1> + <t groups="base.group_website_publisher"> + <p groups="event.group_event_manager">Use the top menu <i>'Content'</i> to create your first event.</p> + </t> + </div> <ul class="media-list"> <li t-foreach="event_ids" t-as="event" class="media"> - <div class="media-body"> + <div itemscope="itemscope" itemtype="http://schema.org/Event" class="media-body"> <h4 class="media-heading"> - <a t-att-class="event.state == 'done' and 'text-success'" t-attf-href="/event/#{ slug(event) }/#{(not event.menu_id) and 'register/' or ''}"><span t-field="event.name"> </span></a> + <a itemprop="url" t-att-class="event.state == 'done' and 'text-success'" t-attf-href="/event/#{ slug(event) }/#{(not event.menu_id) and 'register/' or ''}"><span itemprop="name" t-field="event.name"> </span></a> <small t-if="not event.website_published" class="label label-danger">not published</small> </h4> <div> @@ -66,9 +59,9 @@ </t> </div> <div> - <i class="fa fa-clock-o"></i> <span t-field="event.date_begin"> </span> <i>to</i> <span t-field="event.date_end"> </span> + <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.date_begin"> </span> <i>to</i> <span itemprop="endDate" t-field="event.date_end"> </span> </div> - <div t-field="event.address_id" t-field-options='{ + <div itemprop="location" t-field="event.address_id" t-field-options='{ "widget": "contact", "fields": ["city"] }'/> @@ -230,11 +223,11 @@ <template id="event_details"> <t t-call="website_event.layout"> - <div class="container"> - <h1 class="text-center" t-field="event.name"></h1> + <div itemscope="itemscope" itemtype="http://schema.org/Event" class="container"> + <h1 itemprop="name" class="text-center" t-field="event.name"></h1> <h4 class="text-center text-muted"> - <i class="fa fa-clock-o"></i> <span t-field="event.date_begin"/> to - <span t-field="event.date_end"/> + <i class="fa fa-clock-o"></i> <span itemprop="startDate" t-field="event.date_begin"/> to + <span itemprop="endDate" t-field="event.date_end"/> </h4> <h4 class="text-center text-muted" t-field="event.address_id" t-field-options='{ @@ -265,7 +258,7 @@ <template id="event_description_full"> <t t-call="website_event.event_details"> <div class="col-md-8"> - <div t-field="event.description"></div> + <div itemprop="description" t-field="event.description"></div> <div class="clearfix"/> <ul class="media-list" id="comment"> <li t-foreach="event.website_message_ids" t-as="comment" class="media"> @@ -295,7 +288,7 @@ <a t-att-href="event.google_map_link()" target="_BLANK"> <img t-att-src="event.google_map_img()" width="100%%"/> </a> - <div class="mt16 mb8" t-field="event.address_id" t-field-options='{ + <div itemprop="location" class="mt16 mb8" t-field="event.address_id" t-field-options='{ "widget": "contact", "fields": ["address", "phone", "mobile", "fax", "email"] }'/> |
