[FIX] website: display or not editor edit button; website_sale: test tour; website: contact qweb widget
bzr revid: chm@openerp.com-20140121123912-0ya4ziusj09efti3
This commit is contained in:
parent
51f6977f39
commit
4ff1af4d01
|
@ -404,11 +404,7 @@ class Contact(orm.AbstractModel):
|
||||||
field_browse = self.pool[column._obj].browse(cr, openerp.SUPERUSER_ID, id, context={"show_address": True})
|
field_browse = self.pool[column._obj].browse(cr, openerp.SUPERUSER_ID, id, context={"show_address": True})
|
||||||
value = werkzeug.utils.escape( field_browse.name_get()[0][1] )
|
value = werkzeug.utils.escape( field_browse.name_get()[0][1] )
|
||||||
|
|
||||||
IMD = self.pool["ir.model.data"]
|
val = {
|
||||||
model, id = IMD.get_object_reference(cr, uid, "website", "contact")
|
|
||||||
view = self.pool["ir.ui.view"].browse(cr, uid, id, context=context)
|
|
||||||
|
|
||||||
html = view.render({
|
|
||||||
'name': value.split("\n")[0],
|
'name': value.split("\n")[0],
|
||||||
'address': werkzeug.utils.escape("\n".join(value.split("\n")[1:])),
|
'address': werkzeug.utils.escape("\n".join(value.split("\n")[1:])),
|
||||||
'phone': field_browse.phone,
|
'phone': field_browse.phone,
|
||||||
|
@ -417,7 +413,9 @@ class Contact(orm.AbstractModel):
|
||||||
'email': field_browse.email,
|
'email': field_browse.email,
|
||||||
'fields': opf,
|
'fields': opf,
|
||||||
'options': options
|
'options': options
|
||||||
}, engine='website.qweb', context=context)
|
}
|
||||||
|
|
||||||
|
html = self.pool["ir.ui.view"].render(cr, uid, "website.contact", val, engine='website.qweb', context=context)
|
||||||
|
|
||||||
return ir_qweb.HTMLSafe(html)
|
return ir_qweb.HTMLSafe(html)
|
||||||
|
|
||||||
|
|
|
@ -463,6 +463,10 @@
|
||||||
$(window).on('resize', _.debounce(this.check_height.bind(this), 50));
|
$(window).on('resize', _.debounce(this.check_height.bind(this), 50));
|
||||||
this.check_height();
|
this.check_height();
|
||||||
|
|
||||||
|
if (website.is_editable_button) {
|
||||||
|
this.$("button[data-action=edit]").removeClass("hidden");
|
||||||
|
}
|
||||||
|
|
||||||
return $.when(
|
return $.when(
|
||||||
this._super.apply(this, arguments),
|
this._super.apply(this, arguments),
|
||||||
this.rte.appendTo(this.$('#website-top-edit .nav.pull-right'))
|
this.rte.appendTo(this.$('#website-top-edit .nav.pull-right'))
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
|
|
||||||
var website = openerp.website;
|
var website = openerp.website;
|
||||||
website.is_editable = true;
|
website.is_editable = true;
|
||||||
|
website.is_editable_button = true;
|
||||||
|
|
||||||
website.EditorBar.include({
|
website.EditorBar.include({
|
||||||
start: function() {
|
start: function() {
|
||||||
var res = this._super();
|
var res = this._super();
|
||||||
this.$("a[data-action=new_page]").parents("li").removeClass("hidden");
|
this.$("a[data-action=new_page]").parents("li").removeClass("hidden");
|
||||||
this.$("button[data-action=edit]").removeClass("hidden");
|
|
||||||
this.$(".oe_content_menu li.divider").removeClass("hidden");
|
this.$(".oe_content_menu li.divider").removeClass("hidden");
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
var dom_ready = website.dom_ready = $.Deferred();
|
var dom_ready = website.dom_ready = $.Deferred();
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
website.is_editable = website.is_editable || $('html').data('editable');
|
website.is_editable = website.is_editable || $('html').data('editable');
|
||||||
|
website.is_editable_button= website.is_editable_button || $('html').data('editable');
|
||||||
dom_ready.resolve();
|
dom_ready.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,9 @@
|
||||||
hack_to_add_snippet_id();
|
hack_to_add_snippet_id();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 'snippet-dropped' is triggered on '#oe_snippets' whith $target as attribute when a snippet is dropped
|
||||||
|
// 'snippet-activated' is triggered on '#oe_snippets' (and on snippet) when a snippet is activated
|
||||||
|
|
||||||
website.snippet.styles = {};
|
website.snippet.styles = {};
|
||||||
website.snippet.selector = [];
|
website.snippet.selector = [];
|
||||||
website.snippet.BuildingBlock = openerp.Widget.extend({
|
website.snippet.BuildingBlock = openerp.Widget.extend({
|
||||||
|
|
|
@ -366,7 +366,7 @@
|
||||||
overlapsCrash = setTimeout(function () {
|
overlapsCrash = setTimeout(function () {
|
||||||
window.localStorage.removeItem(testId);
|
window.localStorage.removeItem(testId);
|
||||||
throw "Test: '" + testId + "' can't resolve stape: '" + step.stepId + "'";
|
throw "Test: '" + testId + "' can't resolve stape: '" + step.stepId + "'";
|
||||||
}, step.delay || defaultDelay);
|
}, (step.delay || defaultDelay) + 500);
|
||||||
|
|
||||||
var $element = $(step.element);
|
var $element = $(step.element);
|
||||||
if (step.triggers) step.triggers(next);
|
if (step.triggers) step.triggers(next);
|
||||||
|
|
|
@ -13,9 +13,13 @@
|
||||||
var self = this;
|
var self = this;
|
||||||
this.initial_content = {};
|
this.initial_content = {};
|
||||||
return this._super.apply(this, arguments).then(function () {
|
return this._super.apply(this, arguments).then(function () {
|
||||||
|
self.$("button[data-action=edit]").removeClass("hidden");
|
||||||
self.$('button[data-action=edit]')
|
self.$('button[data-action=edit]')
|
||||||
.text("Translate")
|
.text("Translate");
|
||||||
.after(openerp.qweb.render('website.TranslatorAdditionalButtons'));
|
if (website.is_editable_button) {
|
||||||
|
self.$('button[data-action=edit]')
|
||||||
|
.after(openerp.qweb.render('website.TranslatorAdditionalButtons'));
|
||||||
|
}
|
||||||
self.$('.js_hide_on_translate').hide();
|
self.$('.js_hide_on_translate').hide();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -239,10 +239,10 @@
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="show_sign_in" inherit_option_id="website.layout" inherit_id="website.layout" name="Show Sign In">
|
<template id="show_sign_in" inherit_option_id="website.layout" inherit_id="website.layout" name="Show Sign In" groups="base.group_public">
|
||||||
<xpath expr="//ul[@id='top_menu']" position="inside">
|
<xpath expr="//ul[@id='top_menu']" position="inside">
|
||||||
<li class="divider" groups="base.group_public"/>
|
<li class="divider"/>
|
||||||
<li groups="base.group_public">
|
<li>
|
||||||
<a t-attf-href="/web#redirect=#{ quote_plus(url_for('', keep_query='*')) }">
|
<a t-attf-href="/web#redirect=#{ quote_plus(url_for('', keep_query='*')) }">
|
||||||
<b>Sign in</b>
|
<b>Sign in</b>
|
||||||
</a>
|
</a>
|
||||||
|
@ -725,7 +725,7 @@ Sitemap: <t t-esc="url_root"/>sitemap.xml
|
||||||
|
|
||||||
<template id="contact">
|
<template id="contact">
|
||||||
<address t-ignore="true">
|
<address t-ignore="true">
|
||||||
<div t-att-class='"" if "name" in fields else "css_non_editable_mode_hidden"'><span t-esc="name"/></div>
|
<div t-attf-class="'name' not in fields and 'css_non_editable_mode_hidden'"><span t-esc="name"/></div>
|
||||||
<div class='css_editable_mode_hidden'>
|
<div class='css_editable_mode_hidden'>
|
||||||
<div t-if="address and 'address' in fields">
|
<div t-if="address and 'address' in fields">
|
||||||
<i class='fa fa-map-marker'/>
|
<i class='fa fa-map-marker'/>
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
website.is_editable = true;
|
website.is_editable = true;
|
||||||
website.EditorBar.include({
|
website.EditorBar.include({
|
||||||
start: function() {
|
start: function() {
|
||||||
|
website.is_editable_button = website.is_editable_button || !!$("#wrap.js_blog").size();
|
||||||
var res = this._super();
|
var res = this._super();
|
||||||
if ($("#wrap.js_blog").size()) {
|
|
||||||
this.$("button[data-action=edit]").removeClass("hidden");
|
|
||||||
}
|
|
||||||
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
website.is_editable = true;
|
website.is_editable = true;
|
||||||
website.EditorBar.include({
|
website.EditorBar.include({
|
||||||
start: function() {
|
start: function() {
|
||||||
|
website.is_editable_button = website.is_editable_button || !!$("#wrap.js_event").size();
|
||||||
var res = this._super();
|
var res = this._super();
|
||||||
if ($("#wrap.js_event").size()) {
|
|
||||||
this.$("button[data-action=edit]").removeClass("hidden");
|
|
||||||
}
|
|
||||||
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
|
@ -203,7 +203,7 @@
|
||||||
</t>
|
</t>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5" groups="event.group_event_manager">
|
||||||
<t t-call="website.publish_management">
|
<t t-call="website.publish_management">
|
||||||
<t t-set="object" t-value="event"/>
|
<t t-set="object" t-value="event"/>
|
||||||
<t t-set="publish_edit" t-value="True"/>
|
<t t-set="publish_edit" t-value="True"/>
|
||||||
|
|
|
@ -6,10 +6,8 @@
|
||||||
website.is_editable = true;
|
website.is_editable = true;
|
||||||
website.EditorBar.include({
|
website.EditorBar.include({
|
||||||
start: function() {
|
start: function() {
|
||||||
|
website.is_editable_button = website.is_editable_button || !!$("#wrap.js_hr_recruitment").size();
|
||||||
var res = this._super();
|
var res = this._super();
|
||||||
if ($("#wrap.js_hr_recruitment").size()) {
|
|
||||||
this.$("button[data-action=edit]").removeClass("hidden");
|
|
||||||
}
|
|
||||||
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
|
@ -288,8 +288,9 @@
|
||||||
{
|
{
|
||||||
stepId: 'pay-checkout-product',
|
stepId: 'pay-checkout-product',
|
||||||
element: 'button:contains("Pay Now")',
|
element: 'button:contains("Pay Now")',
|
||||||
trigger: 'click',
|
trigger: {
|
||||||
|
url: /shop\/confirmation\//,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
stepId: 'end-test',
|
stepId: 'end-test',
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
website.is_editable = true;
|
website.is_editable = true;
|
||||||
website.EditorBar.include({
|
website.EditorBar.include({
|
||||||
start: function() {
|
start: function() {
|
||||||
|
website.is_editable_button = website.is_editable_button || !!$("#wrap.js_sale").size();
|
||||||
var res = this._super();
|
var res = this._super();
|
||||||
if ($("#wrap.js_sale").size()) {
|
|
||||||
this.$("button[data-action=edit]").removeClass("hidden");
|
|
||||||
}
|
|
||||||
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
this.$(".dropdown:has(.oe_content_menu)").removeClass("hidden");
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,16 +15,9 @@ testRunner.run(function websiteSaleTest (page, timeout) {
|
||||||
window.openerp.website.TestConsole.test('shoptest').run(true);
|
window.openerp.website.TestConsole.test('shoptest').run(true);
|
||||||
});
|
});
|
||||||
waitFor(function testExecuted () {
|
waitFor(function testExecuted () {
|
||||||
var after = page.evaluate(function () {
|
return page.evaluate(function () { return window.$ && $('#wrap:contains("Order Confirmed")').length; });
|
||||||
return window.$ && $('button[data-action=edit]').is(":visible") && {
|
|
||||||
image: $('#wrap [data-snippet-id=image-text]').length,
|
|
||||||
text: $('#wrap [data-snippet-id=text-block]').length,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
var result = after && (after.image === 1) && (after.text === 1);
|
|
||||||
return result;
|
|
||||||
}, function finish () {
|
}, function finish () {
|
||||||
console.log('{ "event": "success" }');
|
console.log('{ "website_sale": "success" }');
|
||||||
phantom.exit();
|
phantom.exit();
|
||||||
}, 4*timeout/5);
|
}, 4*timeout/5);
|
||||||
}, timeout/5);
|
}, timeout/5);
|
||||||
|
|
|
@ -282,7 +282,7 @@
|
||||||
<t t-call="website_sale.search" />
|
<t t-call="website_sale.search" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4" groups="base.group_sale_manager">
|
||||||
<t t-call="website.publish_management">
|
<t t-call="website.publish_management">
|
||||||
<t t-set="object" t-value="product"/>
|
<t t-set="object" t-value="product"/>
|
||||||
<t t-set="publish_edit" t-value="True"/>
|
<t t-set="publish_edit" t-value="True"/>
|
||||||
|
|
Loading…
Reference in New Issue