[IMP] website: publisher with css for activated and disabled
bzr revid: chm@openerp.com-20130903104115-9yukaqh0teh45ipf
This commit is contained in:
parent
2cccfcb556
commit
1fbf4c6349
|
@ -121,8 +121,8 @@ class event_event(osv.osv):
|
|||
'description_website': fields.html('Description for the website'),
|
||||
'event_ticket_ids': fields.one2many('event.event.ticket', "event_id", "Event Ticket"),
|
||||
'organizer_id': fields.many2one('res.partner', "Orgonizer"),
|
||||
'phone': fields.related('orgonizer_id', 'phone', type='char', string='Phone'),
|
||||
'email': fields.related('orgonizer_id', 'email', type='char', string='Email'),
|
||||
'phone': fields.related('organizer_id', 'phone', type='char', string='Phone'),
|
||||
'email': fields.related('organizer_id', 'email', type='char', string='Email'),
|
||||
'register_max': fields.function(_get_register_max,
|
||||
string='Maximum Registrations',
|
||||
help="The maximum registration level is equal to the sum of the maximum registration of event ticket." +
|
||||
|
|
|
@ -162,22 +162,44 @@ ul.nav-stacked > li > a {
|
|||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* ---- PUBLISH BUTTON ---- */
|
||||
a.css_unpublish .css_unpublish {
|
||||
/* ---- PUBLISH ---- */
|
||||
a[data-publish] {
|
||||
text-decoration: none !important;
|
||||
z-index: 2;
|
||||
}
|
||||
a[data-publish] .label {
|
||||
padding: 5px 8px;
|
||||
}
|
||||
a[data-publish] .css_unpublish, a[data-publish] .css_publish, a[data-publish] .css_unpublished, a[data-publish] .css_published {
|
||||
display: none;
|
||||
}
|
||||
a.css_unpublish:hover .css_unpublish {
|
||||
a[data-publish][data-publish='off'] .css_unpublished, a[data-publish][data-publish='off']:hover .css_publish {
|
||||
display: inline;
|
||||
}
|
||||
a.css_unpublish:hover .css_publish {
|
||||
a[data-publish][data-publish='off']:hover .css_unpublished {
|
||||
display: none;
|
||||
}
|
||||
a.css_publish .css_publish {
|
||||
display: none;
|
||||
}
|
||||
a.css_publish:hover .css_publish {
|
||||
a[data-publish][data-publish='on'] .css_published, a[data-publish][data-publish='on']:hover .css_unpublish {
|
||||
display: inline;
|
||||
}
|
||||
a.css_publish:hover .css_unpublish {
|
||||
a[data-publish][data-publish='on']:hover .css_published {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[data-publish='off']:not(a) > :not([data-publish]) {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
[data-publish]:not(a) {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
}
|
||||
[data-publish]:not(a) > [data-publish] {
|
||||
position: absolute;
|
||||
right: -6px;
|
||||
top: -10px;
|
||||
display: none;
|
||||
}
|
||||
[data-publish]:not(a):hover > [data-publish] {
|
||||
display: block;
|
||||
}
|
||||
|
|
|
@ -126,21 +126,35 @@ ul.nav-stacked > li > a
|
|||
.dropdown-header
|
||||
text-transform: uppercase
|
||||
|
||||
/* ---- PUBLISH BUTTON ---- */
|
||||
a
|
||||
&.css_unpublish
|
||||
.css_unpublish
|
||||
/* ---- PUBLISH ---- */
|
||||
a[data-publish]
|
||||
text-decoration: none !important
|
||||
z-index: 2
|
||||
.label
|
||||
padding: 5px 8px
|
||||
.css_unpublish, .css_publish, .css_unpublished, .css_published
|
||||
display: none
|
||||
&[data-publish='off']
|
||||
.css_unpublished, &:hover .css_publish
|
||||
display: inline
|
||||
&:hover .css_unpublished
|
||||
display: none
|
||||
&:hover
|
||||
.css_unpublish
|
||||
display: inline
|
||||
.css_publish
|
||||
display: none
|
||||
&.css_publish
|
||||
.css_publish
|
||||
&[data-publish='on']
|
||||
.css_published, &:hover .css_unpublish
|
||||
display: inline
|
||||
&:hover .css_published
|
||||
display: none
|
||||
&:hover
|
||||
.css_publish
|
||||
display: inline
|
||||
.css_unpublish
|
||||
display: none
|
||||
|
||||
[data-publish='off']:not(a)
|
||||
>:not([data-publish])
|
||||
opacity: 0.5
|
||||
[data-publish]:not(a)
|
||||
position: relative
|
||||
overflow: visible
|
||||
>[data-publish]
|
||||
position: absolute
|
||||
right: -6px
|
||||
top: -10px
|
||||
display: none
|
||||
&:hover > [data-publish]
|
||||
display: block
|
|
@ -138,16 +138,17 @@
|
|||
|
||||
dom_ready.then(function () {
|
||||
/* ----- PUBLISHING STUFF ---- */
|
||||
$('[data-publish]:has([data-publish])').each(function () {
|
||||
var $pub = $("[data-publish]", this);
|
||||
$(this).attr("data-publish", $pub.attr("data-publish"));
|
||||
});
|
||||
|
||||
$(document).on('click', '.js_publish', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this);
|
||||
$link.toggleClass("css_publish").toggleClass("css_unpublish");
|
||||
$.post('/website/publish', {'id': $link.data('id'), 'object': $link.data('object')}, function (result) {
|
||||
if (+result) {
|
||||
$link.addClass("css_publish").removeClass("css_unpublish");
|
||||
} else {
|
||||
$link.removeClass("css_publish").addClass("css_unpublish");
|
||||
}
|
||||
var $data = $(":first", this).parents("[data-publish]");
|
||||
$data.attr("data-publish", $data.first().attr("data-publish") == 'off' ? 'on' : 'off');
|
||||
$.post('/website/publish', {'id': $(this).data('id'), 'object': $(this).data('object')}, function (result) {
|
||||
$data.attr("data-publish", +result ? 'on' : 'off');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -380,9 +380,11 @@
|
|||
</template>
|
||||
|
||||
<template id="publish">
|
||||
<a href="#" t-att-data-id="object.id" t-att-data-object="object._name" t-attf-class="pull-right js_publish #{ object.website_published and 'css_publish' or 'css_unpublish' }" t-if="editable" t-ignore="true" style="text-decoration: none !important;">
|
||||
<span t-attf-class="label label-success css_unpublish">Publish</span>
|
||||
<span t-attf-class="label label-danger css_publish">Unpublish</span>
|
||||
<a href="#" t-att-data-id="object.id" t-att-data-object="object._name" t-att-data-publish="object.website_published and 'on' or 'off'" class="pull-right js_publish" t-if="editable" t-ignore="true">
|
||||
<span t-attf-class="label label-success css_publish">Publish</span>
|
||||
<span t-attf-class="label label-danger css_unpublish">Unpublish</span>
|
||||
<span t-attf-class="label label-success css_published">Published</span>
|
||||
<span t-attf-class="label label-danger css_unpublished">Unpublished</span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@
|
|||
</div>
|
||||
<div class="col-md-8">
|
||||
<ul class="media-list">
|
||||
<li t-foreach="event_ids" t-as="event" class="media thumbnail">
|
||||
<li t-foreach="event_ids" t-as="event" class="media" data-publish="">
|
||||
<t t-call="website.publish"><t t-set="object" t-value="event"/></t>
|
||||
<div class="media-body">
|
||||
<span t-if="not event.event_ticket_ids" class="label label-default pull-right">No tickets needed.</span>
|
||||
<t t-if="event.event_ticket_ids">
|
||||
|
@ -65,7 +66,6 @@
|
|||
</span>
|
||||
</t>
|
||||
<h4 class="media-heading"><a t-attf-href="/event/#{ event.id }/"><span t-field="event.name"> </span></a></h4>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="event"/></t>
|
||||
<div>
|
||||
<span t-field="event.type">: </span>
|
||||
<t t-if="event.organizer_id">
|
||||
|
@ -123,7 +123,20 @@
|
|||
</t>
|
||||
<t t-set="title">Events</t>
|
||||
<div class="container">
|
||||
<t t-call="website.publish"><t t-set="object" t-value="event_id"/></t>
|
||||
<h1 class="text-center" t-field="event_id.name"></h1>
|
||||
<span t-if="not event_id.event_ticket_ids" class="label label-default pull-left">No tickets needed.</span>
|
||||
<t t-if="event_id.event_ticket_ids">
|
||||
<span t-if="event_id.register_avail == 9999" class="label label-default pull-left">Tickets availables.</span>
|
||||
<span t-if="not event_id.register_avail" class="label label-default pull-left">No ticket available.</span>
|
||||
<span t-if="event_id.register_avail and event_id.register_avail != 9999" t-attf-class="label label-default pull-left label-#{ event_id.register_avail <= 10 and 'warning' or 'info' }">
|
||||
<t t-if="event_id.register_avail <= 10">Only</t>
|
||||
<t t-esc="event_id.register_avail"/>
|
||||
<t t-if="event_id.register_avail > 1">tickets </t>
|
||||
<t t-if="event_id.register_avail == 1">ticket </t>
|
||||
available.
|
||||
</span>
|
||||
</t>
|
||||
<h4 class="text-center">
|
||||
<i class="icon-time"></i> <span t-field="event_id.date_begin"/> to
|
||||
<span t-field="event_id.date_end"/>
|
||||
|
@ -147,22 +160,9 @@
|
|||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="media-body">
|
||||
<span t-if="not event_id.event_ticket_ids" class="label label-default pull-right">No tickets needed.</span>
|
||||
<t t-if="event_id.event_ticket_ids">
|
||||
<span t-if="event_id.register_avail == 9999" class="label label-default pull-right">Tickets availables.</span>
|
||||
<span t-if="not event_id.register_avail" class="label label-default pull-right">No ticket available.</span>
|
||||
<span t-if="event_id.register_avail and event_id.register_avail != 9999"
|
||||
t-attf-class="label label-default pull-right label-#{ event_id.register_avail <= 10 and 'warning' or 'info' }">
|
||||
<t t-if="event_id.register_avail <= 10">Only</t>
|
||||
<t t-esc="event_id.register_avail"/>
|
||||
<t t-if="event_id.register_avail > 1">tickets </t>
|
||||
<t t-if="event_id.register_avail == 1">ticket </t>
|
||||
available.
|
||||
</span>
|
||||
</t>
|
||||
<t t-call="website.publish"><t t-set="object" t-value="event_id"/></t>
|
||||
<h4 t-if="event_id.event_ticket_ids">Ticket Information</h4>
|
||||
<form t-attf-action="/event/#{ event_id.id }/add_cart" method="post" t-if="event_id.event_ticket_ids">
|
||||
<hr/>
|
||||
<form t-attf-action="/event/#{ event_id.id }/add_cart" method="post">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -190,7 +190,8 @@ t-attf-class="label label-default pull-right label-#{ event_id.register_avail &l
|
|||
</table>
|
||||
<button type="submit" class="btn btn-primary" t-if="event_id.register_avail">Order Now</button>
|
||||
</form>
|
||||
<h4>Event Details</h4>
|
||||
</t>
|
||||
<hr/>
|
||||
<div t-field="event_id.description_website"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -78,8 +78,8 @@
|
|||
|
||||
<div class="col-md-8" t-if="not blog_id and blog_ids">
|
||||
<ul class="media-list">
|
||||
<li t-foreach="blog_ids" t-as="blog" class="media well">
|
||||
<div t-attf-class="media-body #{ 'css_published' if blog.website_published else '' }">
|
||||
<li t-foreach="blog_ids" t-as="blog" class="media well thumbnail" data-publish="">
|
||||
<div class="media-body">
|
||||
<t t-call="website.publish"><t t-set="object" t-value="blog"/></t>
|
||||
<h4 class="media-heading" ><a t-attf-href="/blog/#{ blog.res_id }/#{ blog.id }#comment" t-field="blog.subject"></a></h4>
|
||||
<div class="media">
|
||||
|
|
|
@ -1,16 +1,3 @@
|
|||
.thumbnail.disabled :not(.css_unpublish):not(.css_publish) {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.thumbnail > .css_unpublish, .thumbnail > .css_publish {
|
||||
position: absolute;
|
||||
right: -6px;
|
||||
top: -10px;
|
||||
display: none;
|
||||
}
|
||||
.thumbnail:hover > .css_unpublish, .thumbnail:hover > .css_publish {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.css_product {
|
||||
width: 170px;
|
||||
margin-left: 16px;
|
||||
|
|
|
@ -110,13 +110,13 @@
|
|||
<div class="clearfix"/>
|
||||
<div class='row grid grid-align-top'>
|
||||
<t t-foreach="products" t-as="product">
|
||||
<div t-attf-class="css_product col-md-2 mb16 thumbnail text-center #{not product.website_published and 'disabled' or ''}">
|
||||
<div class="css_product col-md-2 mb16 thumbnail text-center" data-publish="">
|
||||
<t t-call="website.publish"><t t-set="object" t-value="product"/></t>
|
||||
<div class="ellipsis css_content">
|
||||
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&category_id=%s' % category_id) or ''}">
|
||||
<a t-attf-href="/shop/product/#{ product.id }/?#{ search and ('search=%s' % search) or ''}#{ category_id and ('&category_id=%s' % category_id) or ''}" style="text-decoration: none;">
|
||||
<h5 t-field="product.name"> </h5>
|
||||
<img class="img-rounded" t-att-src="product.img('image_small')"/>
|
||||
</a>
|
||||
</a><br/>
|
||||
<small t-field="product.description_sale"></small>
|
||||
<span class="end">&#133;</span><span class="fill"></span>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue