snippet part0

bzr revid: al@openerp.com-20130702185106-98ac5l76kyx4kaq8
This commit is contained in:
Antony Lesuisse 2013-07-02 20:51:06 +02:00
parent 7a6a492f00
commit 06d65b090a
5 changed files with 209 additions and 238 deletions

View File

@ -12,8 +12,12 @@ OpenERP Website CMS
'installable': True,
'data': [
'views/views.xml'
],
'js': [
'static/src/js/website.js',
],
'css': [
'static/src/css/*.css',
],
'js': ['static/src/js/website.js'],
'css': ['static/src/css/website.css'],
'qweb': ['static/src/xml/*.xml'],
}

View File

@ -1,81 +0,0 @@
$(function(){
var selected_snippet = null;
function snippet_click(event){
if(selected_snippet){
selected_snippet.removeClass('oe_selected');
if(selected_snippet[0] === $(this)[0]){
selected_snippet = null;
event.preventDefault();
make_static();
return;
}
}
$(this).addClass('oe_selected');
selected_snippet = $(this);
make_editable();
event.preventDefault();
}
$('.oe_snippet').click(snippet_click);
var hover_element = null;
function make_editable( constraint_after, constraint_inside ){
if(selected_snippet && selected_snippet.hasClass('oe_new')){
$('.oe_snippet_demo').addClass('oe_new');
}else{
$('.oe_snippet_demo').removeClass('oe_new');
}
$('.oe_page *').off('mouseover');
$('.oe_page *').off('mouseleave');
$('.oe_page *').mouseover(function(event){
console.log('hover:',this);
if(hover_element){
hover_element.removeClass('oe_selected');
hover_element.off('click');
}
$(this).addClass('oe_selected');
$(this).click(append_snippet);
hover_element = $(this);
event.stopPropagation();
});
$('.oe_page *').mouseleave(function(){
if(hover_element && $(this) === hover_element){
hover_element = null;
$(this).removeClass('oe_selected');
}
});
}
function make_static(){
$('.oe_snippet_demo').removeClass('oe_new');
$('.oe_page *').off('mouseover');
$('.oe_page *').off('mouseleave');
$('.oe_page .oe_selected').removeClass('oe_selected');
}
function append_snippet(event){
console.log('click',this,event.button);
if(event.button === 0){
if(selected_snippet){
if(selected_snippet.hasClass('oe_new')){
var new_snippet = $("<div class='oe_snippet'></div>");
new_snippet.append($(this).clone());
new_snippet.click(snippet_click);
$('.oe_snippet.oe_selected').before(new_snippet);
}else{
$(this).after($('.oe_snippet.oe_selected').contents().clone());
}
selected_snippet.removeClass('oe_selected');
selected_snippet = null;
make_static();
}
}else if(event.button === 1){
$(this).remove();
}
event.preventDefault();
}
});

View File

@ -65,4 +65,86 @@ instance.website.EditorBar = instance.web.Widget.extend({
}
});
$(function(){
var selected_snippet = null;
function snippet_click(event){
if(selected_snippet){
selected_snippet.removeClass('oe_selected');
if(selected_snippet[0] === $(this)[0]){
selected_snippet = null;
event.preventDefault();
make_static();
return;
}
}
$(this).addClass('oe_selected');
selected_snippet = $(this);
make_editable();
event.preventDefault();
}
$('.oe_snippet').click(snippet_click);
var hover_element = null;
function make_editable( constraint_after, constraint_inside ){
if(selected_snippet && selected_snippet.hasClass('oe_new')){
$('.oe_snippet_demo').addClass('oe_new');
}else{
$('.oe_snippet_demo').removeClass('oe_new');
}
$('.oe_page *').off('mouseover');
$('.oe_page *').off('mouseleave');
$('.oe_page *').mouseover(function(event){
console.log('hover:',this);
if(hover_element){
hover_element.removeClass('oe_selected');
hover_element.off('click');
}
$(this).addClass('oe_selected');
$(this).click(append_snippet);
hover_element = $(this);
event.stopPropagation();
});
$('.oe_page *').mouseleave(function(){
if(hover_element && $(this) === hover_element){
hover_element = null;
$(this).removeClass('oe_selected');
}
});
}
function make_static(){
$('.oe_snippet_demo').removeClass('oe_new');
$('.oe_page *').off('mouseover');
$('.oe_page *').off('mouseleave');
$('.oe_page .oe_selected').removeClass('oe_selected');
}
function append_snippet(event){
console.log('click',this,event.button);
if(event.button === 0){
if(selected_snippet){
if(selected_snippet.hasClass('oe_new')){
var new_snippet = $("<div class='oe_snippet'></div>");
new_snippet.append($(this).clone());
new_snippet.click(snippet_click);
$('.oe_snippet.oe_selected').before(new_snippet);
}else{
$(this).after($('.oe_snippet.oe_selected').contents().clone());
}
selected_snippet.removeClass('oe_selected');
selected_snippet = null;
make_static();
}
}else if(event.button === 1){
$(this).remove();
}
event.preventDefault();
}
});
};

View File

@ -1,126 +0,0 @@
<html>
<head>
<title>OpenERP Snippet Editor</title>
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/web/webclient/css">
<link rel="stylesheet" href="css/snippets.css">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src='js/snippets.js'></script>
</head>
<body class='oe_styling_v8 oe_snippet_demo'>
<div class='oe_snippet_editor'>
<div class='oe_snippet_list'>
<div class='oe_snippet' name='Screenshot' selafter='.oe_span6' selinside='.oe_row'>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=point_of_sale">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg">
</a>
</div>
</div>
</div>
<div class='oe_snippet' name='Introduction' selafter='.oe_container'>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">A very friendly Point of Sale</h2>
<h3 class="oe_slogan">Set up in a minute, Sell in seconds</h3>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=point_of_sale">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg">
</a>
</div>
</div>
<div class="oe_span6">
<p class='oe_mt32'>
OpenERP's Point of Sale introduces a super clean interface with no installation required
that runs online and offline on modern hardwares.
</p>
<p>
It's full integration with the company inventory and accounting, gives you real time statistics and
consolidations amongst all shops without the hassle of integrating several applications.
</p>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
</div>
</section>
</div>
<div class='oe_snippet' name='Call To Action' selafter='p,h1,h2,h3,h4,h5,ul,ol' selinside='.oe_span6'>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
<div class='oe_snippet' name='Alternate Paragraph'selafter='.oe_container'>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">A very friendly Point of Sale</h2>
<h3 class="oe_slogan">Set up in a minute, Sell in seconds</h3>
</div>
<div class="oe_span6">
<p class='oe_mt32'>
OpenERP's Point of Sale introduces a super clean interface with no installation required
that runs online and offline on modern hardwares.
</p>
<p>
It's full integration with the company inventory and accounting, gives you real time statistics and
consolidations amongst all shops without the hassle of integrating several applications.
</p>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=point_of_sale">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg">
</a>
</div>
</div>
</div>
</section>
</div>
<div class='oe_snippet oe_new' name='New Snippet'>
</div>
</div>
</div>
<div class='oe_page' contenteditable=true>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">A very friendly Point of Sale</h2>
<h3 class="oe_slogan">Set up in a minute, Sell in seconds</h3>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=point_of_sale">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg">
</a>
</div>
</div>
<div class="oe_span6">
<p class='oe_mt32'>
OpenERP's Point of Sale introduces a super clean interface with no installation required
that runs online and offline on modern hardwares.
</p>
<p>
It's full integration with the company inventory and accounting, gives you real time statistics and
consolidations amongst all shops without the hassle of integrating several applications.
</p>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
</div>
</section>
</div>
</body>
</html>

View File

@ -11,7 +11,8 @@
<title t-raw="title"><t t-esc="res_company.name"/></title>
<link rel="stylesheet" href="/web/webclient/css"/>
<link rel='stylesheet' href='https://www.openerp.com/saas_master/static/site_new/fonts/lato/stylesheet.css'/>
<link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700'/>
<link href='//fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'/>
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700' rel='stylesheet' type='text/css'/>
<t t-raw="script"/>
<t t-if="editable">
<link href="http://cdn.aloha-editor.org/latest/css/aloha.css" rel="stylesheet" type="text/css" />
@ -32,7 +33,8 @@
<script type="text/javascript" src="/website/static/src/js/website_bootstrap.js"></script>
</t>
</head>
<body class="oe_website">
<body class="oe_website oe_styling_v8">
<header class="oe_website_header">
<div class="container">
<div class="row">
@ -85,6 +87,123 @@
</div>
<p class="oe_website_copy text-center">&amp;copy; <span t-record="res_company" t-field="name">Company name</span>.</p>
</footer>
<!--
<div class='oe_snippet_editor'>
<div class='oe_snippet_list'>
<div class='oe_snippet' name='Screenshot' selafter='.oe_span6' selinside='.oe_row'>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="#">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg"/>
</a>
</div>
</div>
</div>
<div class='oe_snippet' name='Introduction' selafter='.oe_container'>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">A very friendly Point of Sale</h2>
<h3 class="oe_slogan">Set up in a minute, Sell in seconds</h3>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="#">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg"/>
</a>
</div>
</div>
<div class="oe_span6">
<p class='oe_mt32'>
OpenERP's Point of Sale introduces a super clean interface with no installation required
that runs online and offline on modern hardwares.
</p>
<p>
It's full integration with the company inventory and accounting, gives you real time statistics and
consolidations amongst all shops without the hassle of integrating several applications.
</p>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
</div>
</section>
</div>
<div class='oe_snippet' name='Call To Action' selafter='p,h1,h2,h3,h4,h5,ul,ol' selinside='.oe_span6'>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
<div class='oe_snippet' name='Alternate Paragraph' selafter='.oe_container'>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">A very friendly Point of Sale</h2>
<h3 class="oe_slogan">Set up in a minute, Sell in seconds</h3>
</div>
<div class="oe_span6">
<p class='oe_mt32'>
OpenERP's Point of Sale introduces a super clean interface with no installation required
that runs online and offline on modern hardwares.
</p>
<p>
It's full integration with the company inventory and accounting, gives you real time statistics and
consolidations amongst all shops without the hassle of integrating several applications.
</p>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="#">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg"/>
</a>
</div>
</div>
</div>
</section>
</div>
<div class='oe_snippet oe_new' name='New Snippet'>
</div>
</div>
</div>
<div class='oe_page' contenteditable="true">
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">A very friendly Point of Sale</h2>
<h3 class="oe_slogan">Set up in a minute, Sell in seconds</h3>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<a href="#">
<img src="https://www.openerp.com/apps/point_of_sale/pos_sc_02.jpg"/>
</a>
</div>
</div>
<div class="oe_span6">
<p class='oe_mt32'>
OpenERP's Point of Sale introduces a super clean interface with no installation required
that runs online and offline on modern hardwares.
</p>
<p>
It's full integration with the company inventory and accounting, gives you real time statistics and
consolidations amongst all shops without the hassle of integrating several applications.
</p>
<div class="oe_centeralign oe_websiteonly">
<a href="http://www.openerp.com/start" class="oe_button oe_big oe_tacky">Start your <span class="oe_emph">free</span> trial</a>
</div>
</div>
</div>
</section>
</div>
-->
</body>
</html>
</field>
@ -135,32 +254,5 @@
</field>
</record>
<!--
# WIIIP !!
module_template = Template("""
{%- for module in modules %}
<a href='#' title='{{ module.shortdesc }}' class='oe_app ab_app_descr'>
<div class='ab_app_descr'>
<div class='oe_app_icon'>
<img src="data:image/png;base64,{{ module.icon_image }}" onerror="this.src = '/base/static/src/img/icon.png'">
</div>
</div>
<div
class='oe_app_name oe_editable'
data-model='ir.module.module'
data-id='{{ module.id }}'
data-field='shortdesc'
>{{ module.shortdesc }}</div>
<div
class='oe_app_descr oe_editable'
data-model='ir.module.module'
data-id='{{ module.id }}'
data-field='summary'
>{{ module.summary }}</div>
</a>
{%- endfor %}
""")
-->
</data>
</openerp>