[IMP] Website Apps
bzr revid: fp@tinyerp.com-20130811140619-a164pkqxwpdwrohc
This commit is contained in:
parent
a40abac6cb
commit
a416267806
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
'name': 'Website',
|
||||
'category': 'CMS',
|
||||
'category': 'Website',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
OpenERP Website CMS
|
||||
|
|
|
@ -63,6 +63,45 @@ class Website(openerp.addons.web.controllers.main.Home):
|
|||
html = website.render('website.404', values)
|
||||
return html
|
||||
|
||||
@http.route('/website/customize_template_toggle', type='json', auth='admin') # FIXME: auth
|
||||
def customize_template_set(self, view_id):
|
||||
view_obj = request.registry.get("ir.ui.view")
|
||||
view = view_obj.browse(request.cr, request.uid, int(view_id), context=request.context)
|
||||
if view.inherit_id:
|
||||
print '*', view.inherit_id
|
||||
value = False
|
||||
else:
|
||||
value = view.inherit_option_id and view.inherit_option_id.id or False
|
||||
print '*', view.inherit_id, 'no', value, view
|
||||
view_obj.write(request.cr, request.uid, [view_id], {
|
||||
'inherit_id': value
|
||||
}, context=request.context)
|
||||
print 'Wrote', value, 'on', view_id
|
||||
return True
|
||||
|
||||
@http.route('/website/customize_template_get', type='json', auth='admin') # FIXME: auth
|
||||
def customize_template_get(self, xml_id):
|
||||
view = request.registry.get("ir.ui.view")
|
||||
views = view._views_get(request.cr, request.uid, xml_id, request.context)
|
||||
done = {}
|
||||
result = []
|
||||
for v in views:
|
||||
if v.inherit_option_id:
|
||||
if v.inherit_option_id.id not in done:
|
||||
result.append({
|
||||
'name': v.inherit_option_id.name,
|
||||
'header': True,
|
||||
'active': False
|
||||
})
|
||||
done[v.inherit_option_id.id] = True
|
||||
result.append({
|
||||
'name': v.name,
|
||||
'id': v.id,
|
||||
'header': False,
|
||||
'active': v.inherit_id.id == v.inherit_option_id.id
|
||||
})
|
||||
return result
|
||||
|
||||
@http.route('/website/attach', type='http', auth='admin') # FIXME: auth
|
||||
def attach(self, CKEditorFuncNum, CKEditor, langCode, upload):
|
||||
req = request.httprequest
|
||||
|
|
|
@ -27,6 +27,34 @@ instance.website.EditorBar = instance.web.Widget.extend({
|
|||
this._super.apply(this, arguments);
|
||||
this.saving_mutex = new $.Mutex();
|
||||
},
|
||||
customize_setup: function() {
|
||||
var self = this;
|
||||
this.$('#customize-menu-button').click(function(event) {
|
||||
self.rpc('/website/customize_template_get', {'xml_id': 'website.contactus'}).then(
|
||||
function(result) {
|
||||
node = $('#customize-menu').empty()
|
||||
for (var i in result) {
|
||||
item = result[i];
|
||||
if (item.header) {
|
||||
li = '<li class="nav-header">'+item.name+'</li>'
|
||||
} else {
|
||||
li = '<li><a href="#" data-view-id="'+item.id+'"><strong class="icon-check'+
|
||||
(item.active?'':'-empty')+
|
||||
'"></strong> '+item.name+'</a></li>'
|
||||
}
|
||||
node.append(li);
|
||||
}
|
||||
$('a', node).on('click', function (event) {
|
||||
self.rpc('/website/customize_template_toggle', {
|
||||
'view_id': $(event.target).attr('data-view-id')
|
||||
}).then( function(result) {
|
||||
window.location.reload();
|
||||
})
|
||||
});
|
||||
}
|
||||
)
|
||||
});
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
|
||||
|
@ -34,6 +62,7 @@ instance.website.EditorBar = instance.web.Widget.extend({
|
|||
this.$('#website-top-view').show();
|
||||
|
||||
$('.dropdown-toggle').dropdown();
|
||||
this.customize_setup();
|
||||
|
||||
this.$buttons = {
|
||||
edit: this.$('button[data-action=edit]'),
|
||||
|
@ -321,6 +350,12 @@ $(function(){
|
|||
});
|
||||
}
|
||||
|
||||
function customier_option_get(event){
|
||||
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function append_snippet(event){
|
||||
console.log('click',this,event.button);
|
||||
if(event.button === 0){
|
||||
|
|
|
@ -9,20 +9,26 @@
|
|||
<button data-action="edit" class="btn btn-primary">Edit</button>
|
||||
</form>
|
||||
<ul class="nav pull-right">
|
||||
<li class="active"><a href="#"><span class="icon-desktop"/></a></li>
|
||||
<li><a href="#"><span class="icon-mobile-phone"/></a></li>
|
||||
<li class="divider-vertical"></li>
|
||||
<li><a href="#">Promote<!-- <sup><span class="badge">1</span></sup> --></a></li>
|
||||
<li><a href="#">Translate</a></li>
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Customize <strong class="carret"></strong></a>
|
||||
<a id="customize-menu-button" class="dropdown-toggle" data-toggle="dropdown" href="#">Customize <span class="caret"></span></a>
|
||||
<div class="dropdown-menu">
|
||||
aaa
|
||||
<ul class="nav nav-list" id="customize-menu">
|
||||
<!-- filled in JS -->
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Settings <strong class="carret"></strong></a>
|
||||
<div class="dropdown-menu">
|
||||
Install Apps
|
||||
Paramters
|
||||
</div>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Settings <strong class="caret"></strong></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/admin#action=website.action_module_website">Install Apps</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#">General Configuration</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -34,4 +34,3 @@ class view(osv.osv):
|
|||
for child in node.xpath("//t[@t-call]"):
|
||||
result += self._views_get(cr, uid, child.get('t-call'), options=options, context=context)
|
||||
return result
|
||||
|
||||
|
|
|
@ -224,9 +224,9 @@
|
|||
<div class="carousel-inner">
|
||||
<div class="item active" style="background-image: url(/website/static/src/img/greenfields.jpg); background-size: cover;" >
|
||||
<div class='container'>
|
||||
<div class="mt32"> </div>
|
||||
<h1>Create Awesome Enterprise Website</h1>
|
||||
<h2>All the features you need at your finger tips</h2>
|
||||
<div class="mt64"> </div>
|
||||
<h1>Create Awesome Websites</h1>
|
||||
<h2>So many features, so easy to use</h2>
|
||||
<a href='/page/website.contactus' class='btn btn-success btn-large mt16'>Contact us</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -367,7 +367,7 @@
|
|||
</t>
|
||||
</template>
|
||||
|
||||
<template id="contactus">
|
||||
<template id="contactus" name="Contact us">
|
||||
<t t-call="website.layout">
|
||||
<t t-set="title">Contact us - <t t-raw="res_company.name"/></t>
|
||||
<div class="container">
|
||||
|
|
|
@ -16,6 +16,19 @@
|
|||
<field name="users" eval="[(4, ref('public_user'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="action_module_website" model="ir.actions.act_window">
|
||||
<field name="name">Website Apps</field>
|
||||
<field name="res_model">ir.module.module</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">kanban,form</field>
|
||||
<field name="context" eval="'{\'search_default_category_id\':'+str(ref('base.module_category_website'))+'}'"/>
|
||||
<field name="help" type="html">
|
||||
<p><b>No website module found!</b></p>
|
||||
<p>You should try others search criteria.</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="action_gotowebsite" model="ir.actions.client">
|
||||
<field name="name">Website</field>
|
||||
|
@ -32,4 +45,4 @@
|
|||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
'name': 'Website Contact Form',
|
||||
'category': 'CRM',
|
||||
'category': 'Website',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
OpenERP Contact Form
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
'name': 'Website Event',
|
||||
'category': 'mail',
|
||||
'category': 'Website',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
OpenERP Blog
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
'name': 'Website Team',
|
||||
'category': 'mail',
|
||||
'category': 'Website',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
OpenERP Blog
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
'name': 'Website Blog',
|
||||
'category': 'mail',
|
||||
'category': 'Website',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
OpenERP Blog
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
'name': 'E-Commerce',
|
||||
'category': 'Sale',
|
||||
'category': 'Website',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
OpenERP E-Commerce
|
||||
|
|
Loading…
Reference in New Issue