[IMP] website snippet: add Configurable follow snippet

bzr revid: chm@openerp.com-20140305175411-in3oodk778dxvu0k
This commit is contained in:
chm@openerp.com 2014-03-05 18:54:11 +01:00
parent 10084e14db
commit 7cf77276fb
7 changed files with 62 additions and 4 deletions

View File

@ -342,7 +342,7 @@
position: absolute;
width: 100%;
text-align: center;
top: -11px;
top: -20px;
z-index: 1002;
}
.oe_overlay .oe_overlay_options .btn, .oe_overlay .oe_overlay_options a {

View File

@ -258,7 +258,7 @@
position: absolute
width: 100%
text-align: center
top: -11px
top: -20px
z-index: 1002
.btn, a
pointer-events: auto

View File

@ -229,11 +229,13 @@
dialog.on('click', '.btn-primary', function () {
def.resolve(field.val(), field, dialog);
dialog.remove();
$('.modal-backdrop').remove();
});
});
dialog.on('hidden.bs.modal', function () {
def.reject();
dialog.remove();
$('.modal-backdrop').remove();
});
if (field.is('input[type="text"], select')) {
field.keypress(function (e) {

View File

@ -566,8 +566,9 @@
website.snippet.options = {};
website.snippet.Option = openerp.Class.extend({
// initialisation (don't overwrite)
init: function (BuildingBlock, $target, snippet_id) {
init: function (BuildingBlock, editor, $target, snippet_id) {
this.BuildingBlock = BuildingBlock;
this.editor = editor;
this.$target = $target;
var styles = this.$target.data("snippet-option-ids") || {};
styles[snippet_id] = this;
@ -687,6 +688,11 @@
.first()
.addClass("active");
this.$el.find('li:has(li[data-class].active)').addClass("active");
},
/* clean_for_save
* function called just before save vue
*/
clean_for_save: function () {
}
});
@ -1382,7 +1388,7 @@
var style = val['snippet-option-id'];
var Editor = website.snippet.options[style] || website.snippet.Option;
var editor = self.styles[style] = new Editor(self.BuildingBlock, self.$target, style);
var editor = self.styles[style] = new Editor(self.BuildingBlock, self, self.$target, style);
$ul.append(editor.$el.addClass("snippet-style-" + style));
});
this.selector_siblings = this.selector_siblings.join(",");
@ -1473,6 +1479,9 @@
* function called just before save vue
*/
clean_for_save: function () {
for (var i in this.styles){
this.styles[i].clean_for_save();
}
this.$target.removeAttr('contentEditable')
.find('*').removeAttr('contentEditable');
this.$target.removeAttr('attributeEditable')

View File

@ -1,3 +1,4 @@
import mail_message
import mail_thread
import email_template
import website

View File

@ -491,5 +491,50 @@
</div>
</template>
<template id="subscribe" inherit_id="website.snippets" name="Snippet Subscribe">
<xpath expr="//div[@id='snippet_content']" position="inside">
<div>
<div class="oe_snippet_thumbnail">
<img class="oe_snippet_thumbnail_img" src="/website/static/src/img/blocks/block_button.png"/>
<span class="oe_snippet_thumbnail_title">Subscribe Button</span>
</div>
<div class="oe_snippet_body input-group js_follow"
data-id="0"
data-object="mail.group"
data-follow="off">
<input
type="email"
name="email"
class="js_follow_email form-control"
t-att-value="email or ''"
placeholder="your email..."/>
<span class="input-group-btn">
<button href="#" class="btn btn-default js_unfollow_btn">Unsubscribe</button>
<button href="#" class="btn btn-primary js_follow_btn">Subscribe</button>
</span>
<div class="alert alert-success hidden">Thanks for your subscription!</div>
</div>
</div>
</xpath>
<xpath expr="//div[@id='snippet_options']" position="inside">
<div data-snippet-option-id='subscribe'
data-selector=".js_follow"
data-selector-siblings="p, h1, h2, h3, blockquote, .well, .panel"
data-selector-children=".content">
<li>
<a href="#" class="button js_mailing_list">Select a mailing list</a>
</li>
</div>
</xpath>
</template>
</data>
</openerp>

View File

@ -22,6 +22,7 @@
<template id="head" inherit_id="website.layout" name="Mail customization">
<xpath expr="//head" position="inside">
<script type="text/javascript" src="/website_mail/static/src/js/website_mail.editor.js" groups="base.group_website_publisher"></script>
<script type="text/javascript" src="/website_mail/static/src/js/website_mail.js"></script>
<link rel='stylesheet' href='/website_mail/static/src/css/website_mail.css'/>
</xpath>