[IMP] website: refact. javascript,xml for website publish button
bzr revid: chm@openerp.com-20130814083439-wvc07n0sg2vblq1y
This commit is contained in:
parent
ba0230fa53
commit
39d5bced7f
|
@ -382,4 +382,31 @@ $(function(){
|
|||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$(document).on('click', '.js_publish, .js_unpublish', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this).parent();
|
||||
$link.find('.js_publish, .js_unpublish').addClass("hidden");
|
||||
var $unp = $link.find(".js_unpublish");
|
||||
var $p = $link.find(".js_publish");
|
||||
|
||||
var paths = document.location.pathname.split('/');
|
||||
var url = '/' + paths[1];
|
||||
if (paths[1] === 'page') {
|
||||
url += '/' + paths[2];
|
||||
}
|
||||
url += '/publish';
|
||||
|
||||
$.post(url, {'id': $link.data('id')}, function (result) {
|
||||
if (+result) {
|
||||
$p.addClass("hidden");
|
||||
$unp.removeClass("hidden");
|
||||
} else {
|
||||
$p.removeClass("hidden");
|
||||
$unp.addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
|
|
@ -454,5 +454,12 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<template id="publish">
|
||||
<a href="#" t-att-data-id="object.id" class="pull-right" t-if="editable">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not object.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (object.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
$(document).ready(function () {
|
||||
$(document).on('click', '.js_publish, .js_unpublish', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this).parent();
|
||||
$link.find('.js_publish, .js_unpublish').addClass("hidden");
|
||||
var $unp = $link.find(".js_unpublish");
|
||||
var $p = $link.find(".js_publish");
|
||||
$.post('/event/publish', {'id': $link.data('id')}, function (result) {
|
||||
if (+result) {
|
||||
$p.addClass("hidden");
|
||||
$unp.removeClass("hidden");
|
||||
} else {
|
||||
$p.removeClass("hidden");
|
||||
$unp.addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -58,10 +58,7 @@
|
|||
</span>
|
||||
</t>
|
||||
<h4 class="media-heading"><a t-att-href="'/event/%%s/' %% event_id.id"><span t-field="event_id.name"> </span></a></h4>
|
||||
<a t-if="editable" href="#" t-att-data-id="event_id.id" class="pull-right">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not event_id.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (event_id.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="event_id"/></t>
|
||||
<div>
|
||||
<span t-field="event_id.type">: </span>
|
||||
<t t-if="event_id.user_id">
|
||||
|
@ -148,10 +145,7 @@
|
|||
</span>
|
||||
</t>
|
||||
<h4 class="media-heading"><a t-att-href="'/event/%%s/' %% event_id.id"><span t-field="event_id.name"> </span></a></h4>
|
||||
<a t-if="editable" href="#" t-att-data-id="event_id.id" class="pull-right">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not event_id.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (event_id.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="event_id"/></t>
|
||||
<h5 class="media-heading">
|
||||
<span t-field="event_id.address_id"/><br/>
|
||||
<i class="icon-time"></i> <span t-field="event_id.date_begin"/><br/>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
$(document).ready(function () {
|
||||
$(document).on('click', '.js_publish, .js_unpublish', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this).parent();
|
||||
$link.find('.js_publish, .js_unpublish').addClass("hidden");
|
||||
var $unp = $link.find(".js_unpublish");
|
||||
var $p = $link.find(".js_publish");
|
||||
$.post('/page/website.aboutus/publish', {'id': $link.data('id')}, function (result) {
|
||||
if (+result) {
|
||||
$p.addClass("hidden");
|
||||
$unp.removeClass("hidden");
|
||||
} else {
|
||||
$p.removeClass("hidden");
|
||||
$unp.addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -35,12 +35,7 @@
|
|||
<img class="media-object" t-att-src="'data:image/png;base64,%%s' %% employee_id.image_small"/>
|
||||
</a>
|
||||
<div class="media-body">
|
||||
<div t-if="editable" class="pull-right">
|
||||
<a href="#" t-att-data-id="employee_id.id">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not employee_id.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (employee_id.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
</div>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="employee_id"/></t>
|
||||
<h5 class="media-heading" t-field="employee_id.name"/>
|
||||
<div t-field="employee_id.department_id"/>
|
||||
<div t-field="employee_id.job_id"/>
|
||||
|
|
|
@ -1,21 +1,4 @@
|
|||
$(document).ready(function () {
|
||||
$('.js_website_mail').on('click', '.js_publish, .js_unpublish', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this).parent();
|
||||
$link.find('.js_publish, .js_unpublish').addClass("hidden");
|
||||
var $unp = $link.find(".js_unpublish");
|
||||
var $p = $link.find(".js_publish");
|
||||
$.post('/blog/publish', {'id': $link.data('id')}, function (result) {
|
||||
if (+result) {
|
||||
$p.addClass("hidden");
|
||||
$unp.removeClass("hidden");
|
||||
} else {
|
||||
$p.removeClass("hidden");
|
||||
$unp.addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$form = $('.js_nav_year a:first').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
$(this).next("ul").toggle();
|
||||
|
|
|
@ -52,10 +52,7 @@
|
|||
<div class="span8" t-if="blog_id">
|
||||
<div class="media">
|
||||
<div class="media-body well">
|
||||
<a href="#" t-att-data-id="blog_id.id" class="pull-right" t-if="editable">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not blog_id.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (blog_id.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="blog_id"/></t>
|
||||
<h3 t-field="blog_id.subject"/>
|
||||
<div t-field="blog_id.body"/>
|
||||
<small class="pull-right muted text-right">
|
||||
|
@ -66,10 +63,7 @@
|
|||
<ul class="media-list" id="comment">
|
||||
<li t-foreach="blog_id.child_ids" t-as="comment" class="media">
|
||||
<div class="media-body">
|
||||
<a href="#" t-att-data-id="blog_id.id" class="pull-right" t-if="editable">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not comment.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (comment.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="comment"/></t>
|
||||
<t t-raw="comment.body"/>
|
||||
<small class="pull-right muted text-right">
|
||||
<div t-field="comment.author_id"/>
|
||||
|
@ -88,10 +82,7 @@
|
|||
<ul class="media-list">
|
||||
<li t-foreach="blog_ids" t-as="blog" class="media well">
|
||||
<div t-att-class="'media-body %%s' %% (blog.website_published and 'css_published' or '')">
|
||||
<a href="#" t-att-data-id="blog.id" class="pull-right" t-if="editable">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not blog.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (blog.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="blog"/></t>
|
||||
<h4 class="media-heading" ><a t-att-href="'/blog/%%s/%%s#comment' %% (blog.res_id, blog.id)" t-field="blog.subject"></a></h4>
|
||||
<div class="media">
|
||||
<div t-field="blog.body"/>
|
||||
|
|
|
@ -1,22 +1,4 @@
|
|||
$(document).ready(function () {
|
||||
$('.oe_website_sale').on('click', '.js_publish, .js_unpublish', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this).parent();
|
||||
$link.find('.js_publish, .js_unpublish').addClass("hidden");
|
||||
var $unp = $link.find(".js_unpublish");
|
||||
var $p = $link.find(".js_publish");
|
||||
$.post('/shop/publish', {'id': $link.data('id')}, function (result) {
|
||||
if (+result) {
|
||||
$p.addClass("hidden");
|
||||
$unp.removeClass("hidden");
|
||||
} else {
|
||||
$p.removeClass("hidden");
|
||||
$unp.addClass("hidden");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(".oe_website_sale input[name='shipping_different']").change(function() {
|
||||
$(".oe_website_sale .js_shipping").toggle();
|
||||
});
|
||||
|
|
|
@ -138,10 +138,7 @@
|
|||
<t t-set="title">Product</t>
|
||||
<t t-set="shop_content">
|
||||
<div class="oe_product_detail span8" id="product_detail">
|
||||
<a href="#" t-att-data-id="product.id" class="pull-right" t-if="editable">
|
||||
<span t-att-class="'label label-success js_unpublish %%s' %% (not product.website_published and 'hidden' or '')">Unpublish</span>
|
||||
<span t-att-class="'label label-important js_publish %%s' %% (product.website_published and 'hidden' or '')">Publish</span>
|
||||
</a>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="product"/></t>
|
||||
<h2 t-field="product.name"></h2>
|
||||
|
||||
<div class="oe_button_cart">
|
||||
|
|
Loading…
Reference in New Issue