[MERGE] Sync with website-al

bzr revid: tde@openerp.com-20131112095402-82v28vq537o6le8c
This commit is contained in:
Thibault Delavallée 2013-11-12 10:54:02 +01:00
commit 92e72bb317
34 changed files with 656 additions and 1517 deletions

View File

@ -97,22 +97,18 @@ class hr_job(osv.osv):
_inherit = ['mail.thread']
_columns = {
'name': fields.char('Job Name', size=128, required=True, select=True),
# TO CLEAN: when doing a cleaning, we should change like this:
# no_of_recruitment: a function field
# expected_employees: float
# This would allow a clean update when creating new employees.
'expected_employees': fields.function(_no_of_employee, string='Total Forecasted Employees',
help='Expected number of employees for this job position after new recruitment.',
store = {
'hr.job': (lambda self,cr,uid,ids,c=None: ids, ['no_of_recruitment'], 10),
'hr.employee': (_get_job_position, ['job_id'], 10),
},
}, type='integer',
multi='no_of_employee'),
'no_of_employee': fields.function(_no_of_employee, string="Current Number of Employees",
help='Number of employees currently occupying this job position.',
store = {
'hr.employee': (_get_job_position, ['job_id'], 10),
},
}, type='integer',
multi='no_of_employee'),
'no_of_recruitment': fields.float('Expected in Recruitment', help='Number of new employees you expect to recruit.'),
'employee_ids': fields.one2many('hr.employee', 'job_id', 'Employees', groups='base.group_user'),

View File

@ -31,7 +31,7 @@
<record id="job_ceo" model="hr.job">
<field name="name">Chief Executive Officer</field>
<field name="department_id" ref="dep_management"/>
<field name="description"><![CDATA[<div class="oe_structure">Demonstration of different openerp services for each client and convincing the client about functionality of the application.
<field name="description">Demonstration of different openerp services for each client and convincing the client about functionality of the application.
The candidate should have excellent communication skills.
Relationship building and influencing skills
Expertise in New Client Acquisition (NCAs) and Relationship Management.
@ -39,15 +39,15 @@ Gathering market and customer information.
Coordinating with the sales and support team for adopting different strategies
Reviewing progress and identifying opportunities and new areas for development.
Building strong relationships with clients / customers for business growth profitability.
Keep regular interaction with key clients for better extraction and expansion. </div>]]></field>
<field name="requirements"><![CDATA[<div class="oe_structure">MBA in Marketing is must.
Keep regular interaction with key clients for better extraction and expansion.</field>
<field name="requirements">MBA in Marketing is must.
Good Communication skills.
Only Fresher's can apply.
Candidate should be ready to work in young and dynamic environment..
Candidate should be able to work in “start- up” fast paced environment,hands on attitude.
Honest,approachable and fun team player.
Result driven.
Excellent analytical skills, ability to think logically and "out of the box" </div>]]></field>
Excellent analytical skills, ability to think logically and "out of the box"</field>
</record>
<record id="job_cto" model="hr.job">

View File

@ -466,6 +466,13 @@ class hr_job(osv.osv):
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
help="Email alias for this job position. New emails will automatically "
"create new applicants for this job position."),
'address_id': fields.many2one('res.partner', 'Job Location', help="Address where employees are working"),
}
def _address_get(self, cr, uid, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.company_id.partner_id.id
_defaults = {
'address_id': _address_get
}
def _auto_init(self, cr, context=None):

View File

@ -306,7 +306,14 @@
<field name="model">hr.job</field>
<field name="inherit_id" ref="hr.view_hr_job_form"/>
<field name="arch" type="xml">
<field name="expected_employees" version="7.0" position="after">
<group name="job_data" position="inside">
<label for="address_id"/>
<div>
<field name="address_id"/>
<span class="oe_grey">(empty = remote work)</span>
</div>
</group>
<field name="expected_employees" position="after">
<label for="survey_id" groups="base.group_user"/>
<div groups="base.group_user">
<field name="survey_id" class="oe_inline" domain="[('type','=','Human Resources')]"/>

View File

@ -6,7 +6,6 @@ import json
import logging
import os
import datetime
import re
from sys import maxint
@ -17,14 +16,6 @@ import werkzeug.utils
import werkzeug.wrappers
from PIL import Image
try:
from slugify import slugify
except ImportError:
def slugify(s, max_length=None):
spaceless = re.sub(r'\s+', '-', s)
specialless = re.sub(r'[^-_a-z0-9]', '', spaceless)
return specialless[:max_length]
import openerp
from openerp.osv import fields
from openerp.addons.website.models import website
@ -66,7 +57,7 @@ class Website(openerp.addons.web.controllers.main.Home):
def pagenew(self, path, noredirect=NOPE):
module = 'website'
# completely arbitrary max_length
idname = slugify(path, max_length=50)
idname = http.slugify(path, max_length=50)
request.cr.execute('SAVEPOINT pagenew')
imd = request.registry['ir.model.data']
@ -281,7 +272,7 @@ class Website(openerp.addons.web.controllers.main.Home):
return request.make_response(body, headers=[('Content-Type', 'text/plain')])
@website.route('/sitemap', type='http', auth='public', multilang=True)
def sitemap(self, **kwargs):
def sitemap(self):
return request.website.render('website.sitemap', {'pages': request.website.list_pages()})
@website.route('/sitemap.xml', type='http', auth="public")

View File

@ -9,11 +9,11 @@
</record>
<record id="main_menu" model="website.menu">
<field name="name">Main Menu</field>
<field name="name">Top Menu</field>
</record>
<record id="menu_homepage" model="website.menu">
<field name="name">Homepage</field>
<field name="name">Home</field>
<field name="url">/</field>
<field name="parent_id" ref="website.main_menu"/>
<field name="sequence" type="int">10</field>

View File

@ -1,29 +1,34 @@
# -*- coding: utf-8 -*-
import fnmatch
import functools
import inspect
import logging
import math
import simplejson
import itertools
import traceback
import urllib
import urlparse
import simplejson
import werkzeug
import werkzeug.exceptions
import werkzeug.wrappers
import openerp
from openerp.exceptions import AccessError, AccessDenied
from openerp.osv import osv, fields
from openerp.osv import orm, osv, fields
from openerp.tools.safe_eval import safe_eval
from openerp.addons.web import http
from openerp.addons.web.http import request
logger = logging.getLogger(__name__)
def route(routes, *route_args, **route_kwargs):
def decorator(f):
new_routes = routes if isinstance(routes, list) else [routes]
f.cms = True
f.multilang = route_kwargs.get('multilang', False)
if f.multilang:
route_kwargs.pop('multilang')
@ -257,6 +262,64 @@ class website(osv.osv):
]
}
def rule_is_enumerable(self, rule):
""" Checks that it is possible to generate sensible GET queries for
a given rule (if the endpoint matches its own requirements)
:type rule: werkzeug.routing.Rule
:rtype: bool
"""
endpoint = rule.endpoint
methods = rule.methods or ['GET']
return (
'GET' in methods
and endpoint.exposed == 'http'
and endpoint.auth in ('none', 'public')
and getattr(endpoint, 'cms', False)
# ensure all converters on the rule are able to generate values for
# themselves
and all(hasattr(converter, 'generate')
for converter in rule._converters.itervalues())
) and self.endpoint_is_enumerable(rule)
def endpoint_is_enumerable(self, rule):
""" Verifies that it's possible to generate a valid url for the rule's
endpoint
:type rule: werkzeug.routing.Rule
:rtype: bool
"""
# apparently the decorator package makes getargspec work correctly
# on functions it decorates. That's not the case for
# @functools.wraps, so hack around to get the original function
# (and hope a single decorator was applied or we're hosed)
# FIXME: this is going to blow up if we want/need to use multiple @route (with various configurations) on a method
undecorated_func = rule.endpoint.func_closure[0].cell_contents
# If this is ever ported to py3, use signatures, it doesn't suck as much
spec = inspect.getargspec(undecorated_func)
# if *args or **kwargs, just bail the fuck out, only dragons can
# live there
if spec.varargs or spec.keywords:
return False
# remove all arguments with a default value from the list
defaults_count = len(spec.defaults or []) # spec.defaults can be None
# a[:-0] ~ a[:0] ~ [] -> replace defaults_count == 0 by None to get
# a[:None] ~ a
args = spec.args[:(-defaults_count or None)]
# params with defaults were removed, leftover allowed are:
# * self (technically should be first-parameter-of-instance-method but whatever)
# * any parameter mapping to a converter
return all(
(arg == 'self' or arg in rule._converters)
for arg in args)
def list_pages(self, cr, uid, ids, context=None):
""" Available pages in the website/CMS. This is mostly used for links
generation and can be overridden by modules setting up new HTML
@ -269,16 +332,23 @@ class website(osv.osv):
of the same.
:rtype: list({name: str, url: str})
"""
View = self.pool['ir.ui.view']
views = View.search_read(cr, uid, [['page', '=', True]],
fields=['name'], order='name', context=context)
xids = View.get_external_id(cr, uid, [view['id'] for view in views], context=context)
return [
{'name': view['name'], 'url': '/page/' + xids[view['id']]}
for view in views
if xids[view['id']]
]
router = request.httprequest.app.get_db_router(request.db)
for rule in router.iter_rules():
endpoint = rule.endpoint
if not self.rule_is_enumerable(rule):
continue
generated = map(dict, itertools.product(*(
itertools.izip(itertools.repeat(name), converter.generate())
for name, converter in rule._converters.iteritems()
)))
for values in generated:
# rule.build returns (domain_part, rel_url)
url = rule.build(values, append_unknown=False)[1]
yield {'name': url, 'url': url }
def kanban(self, cr, uid, ids, model, domain, column, template, step=None, scope=None, orderby=None, context=None):
step = step and int(step) or 10

View File

@ -1,20 +0,0 @@
Copyright (c) 2013 Mark Dalgleish
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,308 +0,0 @@
[![Build Status](https://secure.travis-ci.org/markdalgleish/stellar.js.png)](http://travis-ci.org/markdalgleish/stellar.js)
# Stellar.js
### Parallax scrolling made easy
Full guide and demonstrations available at the [official Stellar.js project page](http://markdalgleish.com/projects/stellar.js/).
## Download
Get the [development](https://raw.github.com/markdalgleish/stellar.js/master/jquery.stellar.js) or [production](https://raw.github.com/markdalgleish/stellar.js/master/jquery.stellar.min.js) version, or use a [package manager](https://github.com/markdalgleish/stellar.js#package-managers).
## Getting Started
Stellar.js is a jQuery plugin that provides parallax scrolling effects to any scrolling element. The first step is to run `.stellar()` against the element:
``` js
// For example:
$(window).stellar();
// or:
$('#main').stellar();
```
If you're running Stellar.js on 'window', you can use the shorthand:
``` js
$.stellar();
```
This will look for any parallax backgrounds or elements within the specified element and reposition them when the element scrolls.
## Mobile Support
Support in Mobile WebKit browsers requires a touch scrolling library, and a slightly tweaked configuration. For a full walkthrough on how to implement this correctly, read my blog post ["Mobile Parallax with Stellar.js"](http://markdalgleish.com/2012/10/mobile-parallax-with-stellar-js).
Please note that parallax backgrounds are not recommended in Mobile WebKit due to performance constraints. Instead, use parallax elements with static backgrounds.
## Parallax Elements
If you want elements to scroll at a different speed, add the following attribute to any element with a CSS position of absolute, relative or fixed:
``` html
<div data-stellar-ratio="2">
```
The ratio is relative to the natural scroll speed, so a ratio of 0.5 would cause the element to scroll at half-speed, a ratio of 1 would have no effect, and a ratio of 2 would cause the element to scroll at twice the speed. If a ratio lower than 1 is causing the element to appear jittery, try setting its CSS position to fixed.
In order for Stellar.js to perform its calculations correctly, all parallax elements must have their dimensions specified in pixels for the axis/axes being used for parallax effects. For example, all parallax elements for a vertical site must have a pixel height specified. If your design prohibits the use of pixels, try using the ['responsive' option](#configuring-everything).
## Parallax Backgrounds
If you want an element's background image to reposition on scroll, simply add the following attribute:
``` html
<div data-stellar-background-ratio="0.5">
```
As with parallax elements, the ratio is relative to the natural scroll speed. For ratios lower than 1, to avoid jittery scroll performance, set the element's CSS 'background-attachment' to fixed.
## Configuring Offsets
Stellar.js' most powerful feature is the way it aligns elements.
All elements will return to their original positioning when their offset parent meets the edge of the screen—plus or minus your own optional offset. This allows you to create intricate parallax patterns very easily.
Confused? [See how offsets are used on the Stellar.js home page.](http://markdalgleish.com/projects/stellar.js/#show-offsets)
To modify the offsets for all elements at once, pass in the options:
``` js
$.stellar({
horizontalOffset: 40,
verticalOffset: 150
});
```
You can also modify the offsets on a per-element basis using the following data attributes:
``` html
<div data-stellar-ratio="2"
data-stellar-horizontal-offset="40"
data-stellar-vertical-offset="150">
```
## Configuring Offset Parents
By default, offsets are relative to the element's offset parent. This mirrors the way an absolutely positioned element behaves when nested inside an element with a relative position.
As with regular CSS, the closest parent element with a position of relative or absolute is the offset parent.
To override this and force the offset parent to be another element higher up the DOM, use the following data attribute:
``` html
<div data-stellar-offset-parent="true">
```
The offset parent can also have its own offsets:
``` html
<div data-stellar-offset-parent="true"
data-stellar-horizontal-offset="40"
data-stellar-vertical-offset="150">
```
Similar to CSS, the rules take precedence from element, to offset parent, to JavaScript options.
Confused? [See how offset parents are used on the Stellar.js home page.](http://markdalgleish.com/projects/stellar.js/#show-offset-parents)
Still confused? [See what it looks like with its default offset parents.](http://markdalgleish.com/projects/stellar.js/#show-offset-parents-default) Notice how the alignment happens on a per-letter basis? That's because each letter's containing div is its default offset parent.
By specifying the h2 element as the offset parent, we can ensure that the alignment of all the stars in a heading is based on the h2 and not the div further down the DOM tree.
## Configuring Scroll Positioning
You can define what it means for an element to 'scroll'. Whether it's the element's scroll position that's changing, its margins or its CSS3 'transform' position, you can define it using the 'scrollProperty' option:
``` js
$('#gallery').stellar({
scrollProperty: 'transform'
});
```
This option is what allows you to run [Stellar.js on iOS](http://markdalgleish.com/projects/stellar.js/demos/ios.html).
You can even define how the elements are repositioned, whether it's through standard top and left properties or using CSS3 transforms:
``` js
$('#gallery').stellar({
positionProperty: 'transform'
});
```
Don't have the level of control you need? Write a plugin!
Otherwise, you're ready to get started!
## Configuring Everything
Below you will find a complete list of options and matching default values:
``` js
$.stellar({
// Set scrolling to be in either one or both directions
horizontalScrolling: true,
verticalScrolling: true,
// Set the global alignment offsets
horizontalOffset: 0,
verticalOffset: 0,
// Refreshes parallax content on window load and resize
responsive: false,
// Select which property is used to calculate scroll.
// Choose 'scroll', 'position', 'margin' or 'transform',
// or write your own 'scrollProperty' plugin.
scrollProperty: 'scroll',
// Select which property is used to position elements.
// Choose between 'position' or 'transform',
// or write your own 'positionProperty' plugin.
positionProperty: 'position',
// Enable or disable the two types of parallax
parallaxBackgrounds: true,
parallaxElements: true,
// Hide parallax elements that move outside the viewport
hideDistantElements: true,
// Customise how elements are shown and hidden
hideElement: function($elem) { $elem.hide(); },
showElement: function($elem) { $elem.show(); }
});
```
## Writing a Scroll Property Plugin
Out of the box, Stellar.js supports the following scroll properties:
'scroll', 'position', 'margin' and 'transform'.
If your method for creating a scrolling interface isn't covered by one of these, you can write your own. For example, if 'margin' didn't exist yet you could write it like so:
``` js
$.stellar.scrollProperty.margin = {
getLeft: function($element) {
return parseInt($element.css('margin-left'), 10) * -1;
},
getTop: function($element) {
return parseInt($element.css('margin-top'), 10) * -1;
}
}
```
Now, you can specify this scroll property in Stellar.js' configuration.
``` js
$.stellar({
scrollProperty: 'margin'
});
```
## Writing a Position Property Plugin
Stellar.js has two methods for positioning elements built in: 'position' for modifying its top and left properties, and 'transform' for using CSS3 transforms.
If you need more control over how elements are positioned, you can write your own setter functions. For example, if 'position' didn't exist yet, it could be written as a plugin like this:
``` js
$.stellar.positionProperty.position = {
setTop: function($element, newTop, originalTop) {
$element.css('top', newTop);
},
setLeft: function($element, newLeft, originalLeft) {
$element.css('left', newLeft);
}
}
```
Now, you can specify this position property in Stellar.js' configuration.
``` js
$.stellar({
positionProperty: 'position'
});
```
If, for technical reasons, you need to set both properties at once, you can define a single 'setPosition' function:
``` js
$.stellar.positionProperty.foobar = {
setPosition: function($element, newLeft, originalLeft, newTop, originalTop) {
$element.css('transform', 'translate3d(' +
(newLeft - originalLeft) + 'px, ' +
(newTop - originalTop) + 'px, ' +
'0)');
}
}
$.stellar({
positionProperty: 'foobar'
});
```
## Package Managers
Stellar.js can be installed with [Bower](http://twitter.github.com/bower/):
``` bash
$ bower install jquery.stellar
```
## Sites Using Stellar.js
* [National Geographic - Alien Deep Interactive](http://channel.nationalgeographic.com/channel/alien-deep/interactives/alien-deep-interactive)
* [François Hollande](http://www.parti-socialiste.fr/latimelineduchangement)
* [Brabus Private Aviation](http://www.brabus-aviation.com/)
* [Mary and Frankie's Wedding](http://www.maryandfrankiewedding.com/)
* [IT Support London](http://www.itsupportlondon.com)
* [Ashford University](http://bright.ashford.edu)
* [Clif Adventures](http://www.clifbar.com/adventures)
* [Mindster](http://www.mindster.org)
* [WS Interactive](http://www.ws-interactive.fr/methode)
* [Moire Mag - Untitled](http://www.moiremag.net/untitled)
* [Carnival of Courage](http://www.carnivalofcourage.com.au)
* [Ian Poulter](http://www.ianpoulter.com)
* [360 Strategy Group](http://360strategygroup.com)
* [Code, Love and Boards](http://codeloveandboards.com/)
I'm sure there are heaps more. [Let me know if you'd like me to feature your site here.](http://twitter.com/markdalgleish)
## How to Build
Stellar.js uses [Node.js](nodejs.org), [Grunt](http://gruntjs.com) and [PhantomJS](http://phantomjs.org/).
Once you've got Node and PhantomJS set up, install the dependencies:
`$ npm install`
To lint, test and minify the project, simply run the following command:
`$ grunt`
Each of the build steps are also available individually.
`$ grunt test` to test the code using QUnit and PhantomJS:
`$ grunt lint` to validate the code using JSHint.
`$ grunt watch` to continuously lint and test the code while developing.
## Contributing to Stellar.js
Ensure that you successfully test and build the project with `$ grunt` before committing.
Make sure that all plugin changes are made in `src/jquery.stellar.js` (`/jquery.stellar.js` and `/jquery.stellar.min.js` are generated by Grunt).
If you want to contribute in a way that changes the API, please file an issue before submitting a pull request so we can discuss how to appropriately integrate your ideas.
## Questions?
Contact me on GitHub or Twitter: [@markdalgleish](http://twitter.com/markdalgleish)
## License
Copyright 2013, Mark Dalgleish
This content is released under the MIT license
http://markdalgleish.mit-license.org

View File

@ -1,8 +0,0 @@
{
"name": "jquery.stellar",
"version": "0.6.2",
"main": ["./jquery.stellar.js"],
"dependencies": {
"jquery": ">=1.4.3"
}
}

View File

@ -1,71 +0,0 @@
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*!\n' +
' * <%= pkg.title || pkg.name %> v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * \n' +
' * Copyright <%= grunt.template.today("yyyy") %>, <%= pkg.author.name %>\n' +
' * This content is released under the <%= _.pluck(pkg.licenses, "type").join(", ") %> license<%= pkg.licenses.length === 1 ? "" : "s" %>\n' +
' * <%= _.pluck(pkg.licenses, "url").join(", ") %>\n' +
' */',
microbanner: '/*! <%= pkg.title || pkg.name %> v<%= pkg.version %> | Copyright <%= grunt.template.today("yyyy") %>, <%= pkg.author.name %> | <%= pkg.homepage %> | <%= _.pluck(pkg.licenses, "url").join(", ") %> */'
},
lint: {
files: ['grunt.js', 'test/**/*.js', 'src/**/*.js']
},
server: {
port: 8573
},
qunit: {
urls: ['1.4.3', '1.10.1', '2.0.2'].map(function(version) {
return 'http://localhost:<%= server.port %>/test/jquery.stellar.html?jquery=' + version;
})
},
concat: {
dist: {
src: ['<banner:meta.banner>', '<file_strip_banner:src/<%= pkg.name %>.js>'],
dest: '<%= pkg.name %>.js'
}
},
min: {
dist: {
src: ['<banner:meta.microbanner>', '<config:concat.dist.dest>'],
dest: '<%= pkg.name %>.min.js'
}
},
watch: {
files: '<config:lint.files>',
tasks: 'server lint qunit'
},
jshint: {
options: {
evil: true,
curly: false,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
browser: true
},
globals: {
jQuery: true
}
},
uglify: {}
});
// Default task.
grunt.registerTask('default', 'server lint qunit concat min');
grunt.registerTask('test', 'server lint qunit');
};

View File

@ -1,660 +0,0 @@
/*!
* Stellar.js v0.6.2
* http://markdalgleish.com/projects/stellar.js
*
* Copyright 2013, Mark Dalgleish
* This content is released under the MIT license
* http://markdalgleish.mit-license.org
*/
;(function($, window, document, undefined) {
var pluginName = 'stellar',
defaults = {
scrollProperty: 'scroll',
positionProperty: 'position',
horizontalScrolling: true,
verticalScrolling: true,
horizontalOffset: 0,
verticalOffset: 0,
responsive: false,
parallaxBackgrounds: true,
parallaxElements: true,
hideDistantElements: true,
hideElement: function($elem) { $elem.hide(); },
showElement: function($elem) { $elem.show(); }
},
scrollProperty = {
scroll: {
getLeft: function($elem) { return $elem.scrollLeft(); },
setLeft: function($elem, val) { $elem.scrollLeft(val); },
getTop: function($elem) { return $elem.scrollTop(); },
setTop: function($elem, val) { $elem.scrollTop(val); }
},
position: {
getLeft: function($elem) { return parseInt($elem.css('left'), 10) * -1; },
getTop: function($elem) { return parseInt($elem.css('top'), 10) * -1; }
},
margin: {
getLeft: function($elem) { return parseInt($elem.css('margin-left'), 10) * -1; },
getTop: function($elem) { return parseInt($elem.css('margin-top'), 10) * -1; }
},
transform: {
getLeft: function($elem) {
var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[4], 10) * -1 : 0);
},
getTop: function($elem) {
var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[5], 10) * -1 : 0);
}
}
},
positionProperty = {
position: {
setLeft: function($elem, left) { $elem.css('left', left); },
setTop: function($elem, top) { $elem.css('top', top); }
},
transform: {
setPosition: function($elem, left, startingLeft, top, startingTop) {
$elem[0].style[prefixedTransform] = 'translate3d(' + (left - startingLeft) + 'px, ' + (top - startingTop) + 'px, 0)';
}
}
},
// Returns a function which adds a vendor prefix to any CSS property name
vendorPrefix = (function() {
var prefixes = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,
style = $('script')[0].style,
prefix = '',
prop;
for (prop in style) {
if (prefixes.test(prop)) {
prefix = prop.match(prefixes)[0];
break;
}
}
if ('WebkitOpacity' in style) { prefix = 'Webkit'; }
if ('KhtmlOpacity' in style) { prefix = 'Khtml'; }
return function(property) {
return prefix + (prefix.length > 0 ? property.charAt(0).toUpperCase() + property.slice(1) : property);
};
}()),
prefixedTransform = vendorPrefix('transform'),
supportsBackgroundPositionXY = $('<div />', { style: 'background:#fff' }).css('background-position-x') !== undefined,
setBackgroundPosition = (supportsBackgroundPositionXY ?
function($elem, x, y) {
$elem.css({
'background-position-x': x,
'background-position-y': y
});
} :
function($elem, x, y) {
$elem.css('background-position', x + ' ' + y);
}
),
getBackgroundPosition = (supportsBackgroundPositionXY ?
function($elem) {
return [
$elem.css('background-position-x'),
$elem.css('background-position-y')
];
} :
function($elem) {
return $elem.css('background-position').split(' ');
}
),
requestAnimFrame = (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
setTimeout(callback, 1000 / 60);
}
);
function Plugin(element, options) {
this.element = element;
this.options = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function() {
this.options.name = pluginName + '_' + Math.floor(Math.random() * 1e9);
this._defineElements();
this._defineGetters();
this._defineSetters();
this._handleWindowLoadAndResize();
this._detectViewport();
this.refresh({ firstLoad: true });
if (this.options.scrollProperty === 'scroll') {
this._handleScrollEvent();
} else {
this._startAnimationLoop();
}
},
_defineElements: function() {
if (this.element === document.body) this.element = window;
this.$scrollElement = $(this.element);
this.$element = (this.element === window ? $('body') : this.$scrollElement);
this.$viewportElement = (this.options.viewportElement !== undefined ? $(this.options.viewportElement) : (this.$scrollElement[0] === window || this.options.scrollProperty === 'scroll' ? this.$scrollElement : this.$scrollElement.parent()) );
},
_defineGetters: function() {
var self = this,
scrollPropertyAdapter = scrollProperty[self.options.scrollProperty];
this._getScrollLeft = function() {
return scrollPropertyAdapter.getLeft(self.$scrollElement);
};
this._getScrollTop = function() {
return scrollPropertyAdapter.getTop(self.$scrollElement);
};
},
_defineSetters: function() {
var self = this,
scrollPropertyAdapter = scrollProperty[self.options.scrollProperty],
positionPropertyAdapter = positionProperty[self.options.positionProperty],
setScrollLeft = scrollPropertyAdapter.setLeft,
setScrollTop = scrollPropertyAdapter.setTop;
this._setScrollLeft = (typeof setScrollLeft === 'function' ? function(val) {
setScrollLeft(self.$scrollElement, val);
} : $.noop);
this._setScrollTop = (typeof setScrollTop === 'function' ? function(val) {
setScrollTop(self.$scrollElement, val);
} : $.noop);
this._setPosition = positionPropertyAdapter.setPosition ||
function($elem, left, startingLeft, top, startingTop) {
if (self.options.horizontalScrolling) {
positionPropertyAdapter.setLeft($elem, left, startingLeft);
}
if (self.options.verticalScrolling) {
positionPropertyAdapter.setTop($elem, top, startingTop);
}
};
},
_handleWindowLoadAndResize: function() {
var self = this,
$window = $(window);
if (self.options.responsive) {
$window.bind('load.' + this.name, function() {
self.refresh();
});
}
$window.bind('resize.' + this.name, function() {
self._detectViewport();
if (self.options.responsive) {
self.refresh();
}
});
},
refresh: function(options) {
var self = this,
oldLeft = self._getScrollLeft(),
oldTop = self._getScrollTop();
if (!options || !options.firstLoad) {
this._reset();
}
this._setScrollLeft(0);
this._setScrollTop(0);
this._setOffsets();
this._findParticles();
this._findBackgrounds();
// Fix for WebKit background rendering bug
if (options && options.firstLoad && /WebKit/.test(navigator.userAgent)) {
$(window).load(function() {
var oldLeft = self._getScrollLeft(),
oldTop = self._getScrollTop();
self._setScrollLeft(oldLeft + 1);
self._setScrollTop(oldTop + 1);
self._setScrollLeft(oldLeft);
self._setScrollTop(oldTop);
});
}
this._setScrollLeft(oldLeft);
this._setScrollTop(oldTop);
},
_detectViewport: function() {
var viewportOffsets = this.$viewportElement.offset(),
hasOffsets = viewportOffsets !== null && viewportOffsets !== undefined;
this.viewportWidth = this.$viewportElement.width();
this.viewportHeight = this.$viewportElement.height();
this.viewportOffsetTop = (hasOffsets ? viewportOffsets.top : 0);
this.viewportOffsetLeft = (hasOffsets ? viewportOffsets.left : 0);
},
_findParticles: function() {
var self = this,
scrollLeft = this._getScrollLeft(),
scrollTop = this._getScrollTop();
if (this.particles !== undefined) {
for (var i = this.particles.length - 1; i >= 0; i--) {
this.particles[i].$element.data('stellar-elementIsActive', undefined);
}
}
this.particles = [];
if (!this.options.parallaxElements) return;
this.$element.find('[data-stellar-ratio]').each(function(i) {
var $this = $(this),
horizontalOffset,
verticalOffset,
positionLeft,
positionTop,
marginLeft,
marginTop,
$offsetParent,
offsetLeft,
offsetTop,
parentOffsetLeft = 0,
parentOffsetTop = 0,
tempParentOffsetLeft = 0,
tempParentOffsetTop = 0;
// Ensure this element isn't already part of another scrolling element
if (!$this.data('stellar-elementIsActive')) {
$this.data('stellar-elementIsActive', this);
} else if ($this.data('stellar-elementIsActive') !== this) {
return;
}
self.options.showElement($this);
// Save/restore the original top and left CSS values in case we refresh the particles or destroy the instance
if (!$this.data('stellar-startingLeft')) {
$this.data('stellar-startingLeft', $this.css('left'));
$this.data('stellar-startingTop', $this.css('top'));
} else {
$this.css('left', $this.data('stellar-startingLeft'));
$this.css('top', $this.data('stellar-startingTop'));
}
positionLeft = $this.position().left;
positionTop = $this.position().top;
// Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
offsetLeft = $this.offset().left - marginLeft;
offsetTop = $this.offset().top - marginTop;
// Calculate the offset parent
$this.parents().each(function() {
var $this = $(this);
if ($this.data('stellar-offset-parent') === true) {
parentOffsetLeft = tempParentOffsetLeft;
parentOffsetTop = tempParentOffsetTop;
$offsetParent = $this;
return false;
} else {
tempParentOffsetLeft += $this.position().left;
tempParentOffsetTop += $this.position().top;
}
});
// Detect the offsets
horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
// Add our object to the particles collection
self.particles.push({
$element: $this,
$offsetParent: $offsetParent,
isFixed: $this.css('position') === 'fixed',
horizontalOffset: horizontalOffset,
verticalOffset: verticalOffset,
startingPositionLeft: positionLeft,
startingPositionTop: positionTop,
startingOffsetLeft: offsetLeft,
startingOffsetTop: offsetTop,
parentOffsetLeft: parentOffsetLeft,
parentOffsetTop: parentOffsetTop,
stellarRatio: ($this.data('stellar-ratio') !== undefined ? $this.data('stellar-ratio') : 1),
width: $this.outerWidth(true),
height: $this.outerHeight(true),
isHidden: false
});
});
},
_findBackgrounds: function() {
var self = this,
scrollLeft = this._getScrollLeft(),
scrollTop = this._getScrollTop(),
$backgroundElements;
this.backgrounds = [];
if (!this.options.parallaxBackgrounds) return;
$backgroundElements = this.$element.find('[data-stellar-background-ratio]');
if (this.$element.data('stellar-background-ratio')) {
$backgroundElements = $backgroundElements.add(this.$element);
}
$backgroundElements.each(function() {
var $this = $(this),
backgroundPosition = getBackgroundPosition($this),
horizontalOffset,
verticalOffset,
positionLeft,
positionTop,
marginLeft,
marginTop,
offsetLeft,
offsetTop,
$offsetParent,
parentOffsetLeft = 0,
parentOffsetTop = 0,
tempParentOffsetLeft = 0,
tempParentOffsetTop = 0;
// Ensure this element isn't already part of another scrolling element
if (!$this.data('stellar-backgroundIsActive')) {
$this.data('stellar-backgroundIsActive', this);
} else if ($this.data('stellar-backgroundIsActive') !== this) {
return;
}
// Save/restore the original top and left CSS values in case we destroy the instance
if (!$this.data('stellar-backgroundStartingLeft')) {
$this.data('stellar-backgroundStartingLeft', backgroundPosition[0]);
$this.data('stellar-backgroundStartingTop', backgroundPosition[1]);
} else {
setBackgroundPosition($this, $this.data('stellar-backgroundStartingLeft'), $this.data('stellar-backgroundStartingTop'));
}
// Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
offsetLeft = $this.offset().left - marginLeft - scrollLeft;
offsetTop = $this.offset().top - marginTop - scrollTop;
// Calculate the offset parent
$this.parents().each(function() {
var $this = $(this);
if ($this.data('stellar-offset-parent') === true) {
parentOffsetLeft = tempParentOffsetLeft;
parentOffsetTop = tempParentOffsetTop;
$offsetParent = $this;
return false;
} else {
tempParentOffsetLeft += $this.position().left;
tempParentOffsetTop += $this.position().top;
}
});
// Detect the offsets
horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
self.backgrounds.push({
$element: $this,
$offsetParent: $offsetParent,
isFixed: $this.css('background-attachment') === 'fixed',
horizontalOffset: horizontalOffset,
verticalOffset: verticalOffset,
startingValueLeft: backgroundPosition[0],
startingValueTop: backgroundPosition[1],
startingBackgroundPositionLeft: (isNaN(parseInt(backgroundPosition[0], 10)) ? 0 : parseInt(backgroundPosition[0], 10)),
startingBackgroundPositionTop: (isNaN(parseInt(backgroundPosition[1], 10)) ? 0 : parseInt(backgroundPosition[1], 10)),
startingPositionLeft: $this.position().left,
startingPositionTop: $this.position().top,
startingOffsetLeft: offsetLeft,
startingOffsetTop: offsetTop,
parentOffsetLeft: parentOffsetLeft,
parentOffsetTop: parentOffsetTop,
stellarRatio: ($this.data('stellar-background-ratio') === undefined ? 1 : $this.data('stellar-background-ratio'))
});
});
},
_reset: function() {
var particle,
startingPositionLeft,
startingPositionTop,
background,
i;
for (i = this.particles.length - 1; i >= 0; i--) {
particle = this.particles[i];
startingPositionLeft = particle.$element.data('stellar-startingLeft');
startingPositionTop = particle.$element.data('stellar-startingTop');
this._setPosition(particle.$element, startingPositionLeft, startingPositionLeft, startingPositionTop, startingPositionTop);
this.options.showElement(particle.$element);
particle.$element.data('stellar-startingLeft', null).data('stellar-elementIsActive', null).data('stellar-backgroundIsActive', null);
}
for (i = this.backgrounds.length - 1; i >= 0; i--) {
background = this.backgrounds[i];
background.$element.data('stellar-backgroundStartingLeft', null).data('stellar-backgroundStartingTop', null);
setBackgroundPosition(background.$element, background.startingValueLeft, background.startingValueTop);
}
},
destroy: function() {
this._reset();
this.$scrollElement.unbind('resize.' + this.name).unbind('scroll.' + this.name);
this._animationLoop = $.noop;
$(window).unbind('load.' + this.name).unbind('resize.' + this.name);
},
_setOffsets: function() {
var self = this,
$window = $(window);
$window.unbind('resize.horizontal-' + this.name).unbind('resize.vertical-' + this.name);
if (typeof this.options.horizontalOffset === 'function') {
this.horizontalOffset = this.options.horizontalOffset();
$window.bind('resize.horizontal-' + this.name, function() {
self.horizontalOffset = self.options.horizontalOffset();
});
} else {
this.horizontalOffset = this.options.horizontalOffset;
}
if (typeof this.options.verticalOffset === 'function') {
this.verticalOffset = this.options.verticalOffset();
$window.bind('resize.vertical-' + this.name, function() {
self.verticalOffset = self.options.verticalOffset();
});
} else {
this.verticalOffset = this.options.verticalOffset;
}
},
_repositionElements: function() {
var scrollLeft = this._getScrollLeft(),
scrollTop = this._getScrollTop(),
horizontalOffset,
verticalOffset,
particle,
fixedRatioOffset,
background,
bgLeft,
bgTop,
isVisibleVertical = true,
isVisibleHorizontal = true,
newPositionLeft,
newPositionTop,
newOffsetLeft,
newOffsetTop,
i;
// First check that the scroll position or container size has changed
if (this.currentScrollLeft === scrollLeft && this.currentScrollTop === scrollTop && this.currentWidth === this.viewportWidth && this.currentHeight === this.viewportHeight) {
return;
} else {
this.currentScrollLeft = scrollLeft;
this.currentScrollTop = scrollTop;
this.currentWidth = this.viewportWidth;
this.currentHeight = this.viewportHeight;
}
// Reposition elements
for (i = this.particles.length - 1; i >= 0; i--) {
particle = this.particles[i];
fixedRatioOffset = (particle.isFixed ? 1 : 0);
// Calculate position, then calculate what the particle's new offset will be (for visibility check)
if (this.options.horizontalScrolling) {
newPositionLeft = (scrollLeft + particle.horizontalOffset + this.viewportOffsetLeft + particle.startingPositionLeft - particle.startingOffsetLeft + particle.parentOffsetLeft) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionLeft;
newOffsetLeft = newPositionLeft - particle.startingPositionLeft + particle.startingOffsetLeft;
} else {
newPositionLeft = particle.startingPositionLeft;
newOffsetLeft = particle.startingOffsetLeft;
}
if (this.options.verticalScrolling) {
newPositionTop = (scrollTop + particle.verticalOffset + this.viewportOffsetTop + particle.startingPositionTop - particle.startingOffsetTop + particle.parentOffsetTop) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionTop;
newOffsetTop = newPositionTop - particle.startingPositionTop + particle.startingOffsetTop;
} else {
newPositionTop = particle.startingPositionTop;
newOffsetTop = particle.startingOffsetTop;
}
// Check visibility
if (this.options.hideDistantElements) {
isVisibleHorizontal = !this.options.horizontalScrolling || newOffsetLeft + particle.width > (particle.isFixed ? 0 : scrollLeft) && newOffsetLeft < (particle.isFixed ? 0 : scrollLeft) + this.viewportWidth + this.viewportOffsetLeft;
isVisibleVertical = !this.options.verticalScrolling || newOffsetTop + particle.height > (particle.isFixed ? 0 : scrollTop) && newOffsetTop < (particle.isFixed ? 0 : scrollTop) + this.viewportHeight + this.viewportOffsetTop;
}
if (isVisibleHorizontal && isVisibleVertical) {
if (particle.isHidden) {
this.options.showElement(particle.$element);
particle.isHidden = false;
}
this._setPosition(particle.$element, newPositionLeft, particle.startingPositionLeft, newPositionTop, particle.startingPositionTop);
} else {
if (!particle.isHidden) {
this.options.hideElement(particle.$element);
particle.isHidden = true;
}
}
}
// Reposition backgrounds
for (i = this.backgrounds.length - 1; i >= 0; i--) {
background = this.backgrounds[i];
fixedRatioOffset = (background.isFixed ? 0 : 1);
bgLeft = (this.options.horizontalScrolling ? (scrollLeft + background.horizontalOffset - this.viewportOffsetLeft - background.startingOffsetLeft + background.parentOffsetLeft - background.startingBackgroundPositionLeft) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueLeft);
bgTop = (this.options.verticalScrolling ? (scrollTop + background.verticalOffset - this.viewportOffsetTop - background.startingOffsetTop + background.parentOffsetTop - background.startingBackgroundPositionTop) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueTop);
setBackgroundPosition(background.$element, bgLeft, bgTop);
}
},
_handleScrollEvent: function() {
var self = this,
ticking = false;
var update = function() {
self._repositionElements();
ticking = false;
};
var requestTick = function() {
if (!ticking) {
requestAnimFrame(update);
ticking = true;
}
};
this.$scrollElement.bind('scroll.' + this.name, requestTick);
requestTick();
},
_startAnimationLoop: function() {
var self = this;
this._animationLoop = function() {
requestAnimFrame(self._animationLoop);
self._repositionElements();
};
this._animationLoop();
}
};
$.fn[pluginName] = function (options) {
var args = arguments;
if (options === undefined || typeof options === 'object') {
return this.each(function () {
if (!$.data(this, 'plugin_' + pluginName)) {
$.data(this, 'plugin_' + pluginName, new Plugin(this, options));
}
});
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
return this.each(function () {
var instance = $.data(this, 'plugin_' + pluginName);
if (instance instanceof Plugin && typeof instance[options] === 'function') {
instance[options].apply(instance, Array.prototype.slice.call(args, 1));
}
if (options === 'destroy') {
$.data(this, 'plugin_' + pluginName, null);
}
});
}
};
$[pluginName] = function(options) {
var $window = $(window);
return $window.stellar.apply($window, Array.prototype.slice.call(arguments, 0));
};
// Expose the scroll and position property function hashes so they can be extended
$[pluginName].scrollProperty = scrollProperty;
$[pluginName].positionProperty = positionProperty;
// Expose the plugin class so it can be modified
window.Stellar = Plugin;
}(jQuery, this, document));

File diff suppressed because one or more lines are too long

View File

@ -1,46 +0,0 @@
{
"name": "jquery.stellar",
"title": "Stellar.js",
"version": "0.6.2",
"description": "Parallax scrolling made easy.",
"homepage": "http://markdalgleish.com/projects/stellar.js",
"author": {
"name": "Mark Dalgleish",
"url": "http://markdalgleish.com"
},
"keywords": [
"parallax",
"scroll",
"effect",
"animation"
],
"licenses": [
{
"type": "MIT",
"url": "http://markdalgleish.mit-license.org"
}
],
"dependencies": {
"jquery": ">=1.4.3"
},
"bugs": "https://github.com/markdalgleish/stellar.js/issues",
"repository": {
"type": "git",
"url": "git://github.com/markdalgleish/stellar.js.git"
},
"maintainers": [
{
"name": "Mark Dalgleish",
"url": "http://markdalgleish.com"
}
],
"files": [
"jquery.stellar.js"
],
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt": "~0.3.17"
}
}

View File

@ -1,29 +0,0 @@
{
"name": "stellar",
"title": "Stellar.js",
"version": "0.6.2",
"description": "Parallax scrolling made easy.",
"homepage": "http://markdalgleish.com/projects/stellar.js",
"author": {
"name": "Mark Dalgleish",
"url": "http://markdalgleish.com"
},
"keywords": [
"parallax",
"scroll",
"effect",
"animation"
],
"licenses": [
{
"type": "MIT",
"url": "http://markdalgleish.mit-license.org"
}
],
"dependencies": {
"jquery": ">=1.4.3"
},
"bugs": "https://github.com/markdalgleish/stellar.js/issues",
"docs": "http://markdalgleish.com/projects/stellar.js/docs",
"download": "https://github.com/markdalgleish/stellar.js#download"
}

View File

@ -361,8 +361,7 @@ footer {
}
.parallax {
background-attachment: fixed;
background-size: 100%;
position: relative;
}
.parallax.oe_small {
height: 200px;
@ -444,3 +443,24 @@ a[data-publish][data-publish='on']:hover .css_published {
.logo-img {
width: 220px;
}
.oe_demo {
position: relative;
}
.oe_demo img {
width: 100%;
}
.oe_demo div {
position: absolute;
left: 0;
background-color: rgba(0, 0, 0, 0.4);
opacity: 0.85;
bottom: 0px;
width: 100%;
padding: 7px;
color: white;
font-weight: bold;
}
.oe_demo div a {
color: white;
}

View File

@ -276,8 +276,7 @@ footer
background-color: grey
.parallax
background-attachment: fixed
background-size: 100%
position: relative
&.oe_small
height: 200px
&.oe_medium
@ -337,3 +336,21 @@ a[data-publish]
.logo-img
width: 220px
.oe_demo
position: relative
img
width: 100%
div
position: absolute
left: 0
background-color: rgba(0,0,0,0.4)
opacity: 0.85
bottom: 0px
width: 100%
padding: 7px
color: white
font-weight: bold
a
color: white

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 190 KiB

View File

@ -402,8 +402,10 @@
}
});
// Adding Static Menus
menu.append('<li class="divider"></li><li class="js_change_theme"><a href="/page/website.themes">Change Theme</a></li>');
menu.append('<li class="divider"></li><li><a data-action="ace" href="#">HTML Editor</a></li>');
menu.append('<li class="divider"></li>');
menu.append('<li><a data-action="ace" href="#">HTML Editor</a></li>');
menu.append('<li class="js_change_theme"><a href="/page/website.themes">Change Theme</a></li>');
menu.append('<li><a href="/web#action=website.action_module_website">Install Apps</a></li>');
self.trigger('rte:customize_menu_ready');
}
);

View File

@ -1,6 +1,21 @@
(function () {
'use strict';
var start_snippet_animation = function () {
hack_to_add_snippet_id();
$("[data-snippet-id]").each(function() {
var $snipped_id = $(this);
if ( !$snipped_id.parents("#oe_snippets").length &&
typeof $snipped_id.data("snippet-view") === 'undefined' &&
website.snippet.animationRegistry[$snipped_id.data("snippet-id")]) {
var snippet = new website.snippet.animationRegistry[$snipped_id.data("snippet-id")]($snipped_id);
$snipped_id.data("snippet-view", snippet);
}
});
};
$(document).ready(start_snippet_animation);
var website = openerp.website;
website.add_template_file('/website/static/src/xml/website.snippets.xml');
@ -22,8 +37,10 @@
window.snippets = this.snippets = new website.snippet.BuildingBlock(this);
this.snippets.appendTo(this.$el);
this.rte.on('rte:ready', this, function () {
this.on('rte:ready', this, function () {
self.snippets.$button.removeClass("hidden");
start_snippet_animation();
self.trigger('rte:snippets_ready');
});
return this._super.apply(this, arguments);
@ -39,20 +56,8 @@
},
});
$(document).ready(function () {
hack_to_add_snippet_id();
$("[data-snippet-id]").each(function() {
var $snipped_id = $(this);
if (typeof $snipped_id.data("snippet-view") === 'undefined' &&
website.snippet.animationRegistry[$snipped_id.data("snippet-id")]) {
$snipped_id.data("snippet-view", new website.snippet.animationRegistry[$snipped_id.data("snippet-id")]($snipped_id));
}
});
});
/* ----- SNIPPET SELECTOR ---- */
website.snippet = {};
var observer = new website.Observer(function (mutations) {
if (!_(mutations).find(function (m) {
@ -504,7 +509,7 @@
console.debug( "A good node must have a [data-oe-model] attribute or must have at least one parent with [data-oe-model] attribute.");
console.debug( "Wrong node(s): ", selector);
}
function is_visible($el){
return $el.css('display') != 'none'
&& $el.css('opacity') != '0'
@ -519,7 +524,7 @@
var parents = $(this).parents().filter(function(){ return !is_visible($(this)); });
return parents.length === 0;
});
$targets.each(function () {
var $target = $(this);
if (!$target.data('overlay')) {
@ -558,13 +563,13 @@
start: function () {
},
/* onFocusEdit
* if they are an editor for this data-snippet-id
* if they are an editor for this data-snippet-id
* Called before onFocus of snippet editor
*/
onFocusEdit : function () {},
/* onBlurEdit
* if they are an editor for this data-snippet-id
* if they are an editor for this data-snippet-id
* Called after onBlur of snippet editor
*/
onBlurEdit : function () {},
@ -665,7 +670,7 @@
});
$("body").addClass('move-important');
self._drag_and_drop_after_insert_dropzone();
self._drag_and_drop_active_drop_zone($('.oe_drop_zone'));
},
@ -775,7 +780,7 @@
* This method is called when the user click inside the snippet in the dom
*/
onFocus : function () {
this.$overlay.addClass('oe_active').effect('bounce', {distance: 18, times: 5}, 250);
this.$overlay.addClass('oe_active');
},
/* onFocus
@ -855,7 +860,7 @@
if (!resize_values.s) $box.find(".oe_handle.s").remove();
if (!resize_values.e) $box.find(".oe_handle.e").remove();
if (!resize_values.w) $box.find(".oe_handle.w").remove();
this.$overlay.append($box.find(".oe_handles").html());
this.$overlay.find(".oe_handle").on('mousedown', function (event){
@ -1111,7 +1116,7 @@
var index = $active.index();
this.$target.find('.carousel-control, .carousel-indicators').removeClass("hidden");
this.$indicators.append('<li data-target="#' + this.id + '" data-slide-to="' + cycle + '"></li>');
var $clone = this.$el.find(".item.active").clone();
var bg = this.$editor.find('ul[name="carousel-background"] li:not([data-value="'+ $active.css("background-image").replace(/.*:\/\/[^\/]+|\)$/g, '') +'"]):first').data("value");
$clone.css("background-image", "url('"+ bg +"')");
@ -1207,24 +1212,23 @@
website.snippet.editorRegistry.parallax = website.snippet.editorRegistry.resize.extend({
start : function () {
this._super();
this.change_background($('.parallax', this.$target), 'ul[name="parallax-background"]');
this.change_background(this.$target, 'ul[name="parallax-background"]');
this.scroll();
this.change_size();
},
scroll: function(){
scroll: function () {
var self = this;
var $ul = this.$editor.find('ul[name="parallax-scroll"]');
var $li = $ul.find("li");
var $parallax = this.$target.find('.parallax');
var speed = $parallax.data('stellar-background-ratio') || 0.5 ;
var speed = this.$target.data('scroll-background-ratio') || 0.6 ;
$ul.find('[data-value="' + speed + '"]').addClass('active');
$li.on('click', function (event) {
$li.removeClass("active");
$(this).addClass("active");
var speed = $(this).data('value');
$parallax.attr('data-stellar-background-ratio', speed);
self.$target.attr('data-scroll-background-ratio', speed);
self.$target.data("snippet-view").set_values();
});
},
clean_for_save: function () {
this._super();
@ -1232,12 +1236,11 @@
},
change_size: function () {
var self = this;
var $el = $('.oe_big,.oe_medium,.oe_small', this.$target);
var size = 'oe_big';
if ($el.hasClass('oe_small'))
if (this.$target.hasClass('oe_small'))
size = 'oe_small';
else if ($el.hasClass('oe_medium'))
else if (this.$target.hasClass('oe_medium'))
size = 'oe_medium';
var $ul = this.$editor.find('ul[name="parallax-size"]');
var $li = $ul.find("li");
@ -1247,21 +1250,50 @@
$li.on('click', function (event) {
$li.removeClass("active");
$(this).addClass("active");
self.$target.data("snippet-view").set_values();
})
.on('mouseover', function (event) {
$el.removeClass('oe_big oe_small oe_medium');
$el.addClass($(event.currentTarget).data("value"));
self.$target.removeClass('oe_big oe_small oe_medium');
self.$target.addClass($(event.currentTarget).data("value"));
})
.on('mouseout', function (event) {
$el.removeClass('oe_big oe_small oe_medium');
$el.addClass($ul.find('li.active').data("value"));
self.$target.removeClass('oe_big oe_small oe_medium');
self.$target.addClass($ul.find('li.active').data("value"));
});
}
});
website.snippet.animationRegistry.parallax = website.snippet.Animation.extend({
start: function () {
$.stellar({ horizontalScrolling: false, verticalOffset: 0 });
var self = this;
this.set_values();
var on_scroll = function () {
var speed = parseFloat(self.$target.attr("data-scroll-background-ratio") || 0);
if (speed == 1) return;
var offset = parseFloat(self.$target.attr("data-scroll-background-offset") || 0);
var top = offset + window.scrollY * speed;
self.$target.css("background-position", "0px " + top + "px");
};
$(window).off("scroll").on("scroll", on_scroll);
},
set_values: function () {
var self = this;
var speed = parseFloat(self.$target.attr("data-scroll-background-ratio") || 0);
if (speed == 1) {
this.$target.css("background-attachment", "fixed").css("background-position", "0px 0px");
return;
} else {
this.$target.css("background-attachment", "scroll");
}
this.$target.attr("data-scroll-background-offset", 0);
var img = new Image();
img.onload = function () {
self.$target.attr("data-scroll-background-offset", self.$target.outerHeight() - this.height);
$(window).scroll();
};
img.src = this.$target.css("background-image").replace(/url\(['"]*|['"]*\)/g, "");
}
});
/*

View File

@ -24,10 +24,14 @@
stepId: 'edit-page',
element: 'button[data-action=edit]',
placement: 'bottom',
reflex: true,
title: "Edit this page",
content: "Every page of your website can be modified through the <i>Edit</i> button.",
template: render('website.tour_popover'),
onShow: function () {
editor.on('rte:snippets_ready', editor, function() {
self.movetoStep('add-block');
});
},
},
{
stepId: 'add-block',
@ -37,11 +41,6 @@
content: "To add content in a page, you can insert building blocks.",
template: render('website.tour_popover'),
onShow: function () {
function refreshAddBlockStep () {
self.tour.showStep(self.indexOfStep('add-block'));
editor.off('rte:ready', editor, refreshAddBlockStep);
}
editor.on('rte:ready', editor, refreshAddBlockStep);
$('button[data-action=snippet]').click(function () {
self.movetoStep('drag-banner');
});

View File

@ -21,14 +21,19 @@
<ul class="nav navbar-nav navbar-right">
<li><a data-action="show-mobile-preview" href="#"><span title="Mobile preview" class="icon-mobile-phone"/></a></li>
<li class="divider-vertical"></li>
<li><a data-action="promote-current-page" href="#"><span title="Promote page on the web">Promote</span></a></li>
<li class="dropdown js_hide_on_translate">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Structure <span class="caret"></span></a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Content <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a data-action="edit-structure" href="#"><span title="Edit Top Menu">Top Menu</span></a></li>
<!-- <a data-action="edit-footer" href="#"><span title="Edit Footer">Footer</span></a></li> -->
<li><a data-action="edit-structure" href="#"><span title="Edit Top Menu">Edit Menu</span></a></li>
<li class="divider"> </li>
<li><a href="">New Page</a></li> <!-- Todo: Implement with inheritancy in each module-->
<li><a href="">New Blog Post</a></li>
<li><a href="">New Event</a></li>
<li><a href="">New Job Offer</a></li>
<li><a href="">New Product</a></li>
</ul>
</li>
<li><a data-action="promote-current-page" href="#"><span title="Promote page on the web">Promote</span></a></li>
<li class="dropdown js_hide_on_translate">
<a id="customize-menu-button" class="dropdown-toggle" data-toggle="dropdown" href="#">Customize <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" id="customize-menu">
@ -41,9 +46,6 @@
<!-- filled in JS -->
</ul>
</li>
<li>
<a href="/web#action=website.action_module_website">Apps</a>
</li>
</ul>
</div>
</div>

View File

@ -109,7 +109,7 @@
</p>
</div>
<div class="col-md-6 mt16 mb16">
<img class="img-responsive shadow" src="/website/static/src/img/text_image.png"/>
<img class="img img-responsive shadow" src="/website/static/src/img/text_image.png"/>
</div>
</div>
</div>
@ -126,7 +126,7 @@
<div class="container">
<div class="row">
<div class="col-md-6 mt16 mb16">
<img class="img-responsive shadow" src="/website/static/src/img/image_text.jpg"/>
<img class="img img-responsive shadow" src="/website/static/src/img/image_text.jpg"/>
</div>
<div class="col-md-6 mt32">
<h3>A Section Subtitle</h3>
@ -243,7 +243,7 @@
<h2>A Punchy Headline</h2>
</div>
<div class="col-md-12">
<img class="img-responsive" src="/website/static/src/img/big_picture.png" style="margin: 0 auto;"/>
<img class="img img-responsive" src="/website/static/src/img/big_picture.png" style="margin: 0 auto;"/>
</div>
<div class="col-md-6 col-md-offset-3 mb16 mt16">
<p class="text-center">
@ -277,7 +277,7 @@
<h3 class="text-muted">And a good subtitle</h3>
</div>
<div class="col-md-4">
<img class="img-rounded img-responsive" src="/website/static/src/img/china_thumb.jpg"/>
<img class="img img-rounded img-responsive" src="/website/static/src/img/china_thumb.jpg"/>
<h4 class="mt16">Streamline Recruitments</h4>
<p>
Post job offers and keep track of each application
@ -290,7 +290,7 @@
</p>
</div>
<div class="col-md-4">
<img class="img-rounded img-responsive" src="/website/static/src/img/desert_thumb.jpg"/>
<img class="img img-rounded img-responsive" src="/website/static/src/img/desert_thumb.jpg"/>
<h4 class="mt16">Enterprise Social Network</h4>
<p>
Break down information silos. Share knowledge and best
@ -302,7 +302,7 @@
</p>
</div>
<div class="col-md-4">
<img class="img-rounded img-responsive" src="/website/static/src/img/deers_thumb.jpg"/>
<img class="img img-rounded img-responsive" src="/website/static/src/img/deers_thumb.jpg"/>
<h4 class="mt16">Leaves Management</h4>
<p>
Keep track of the vacation days accrued by each
@ -382,19 +382,19 @@
<h4 class="text-muted">More than 500 successful projects</h4>
</div>
<div class="col-md-4">
<img class="img-thumbnail img-responsive" src="/website/static/src/img/deers.jpg"/>
<img class="img-thumbnail img-responsive" src="/website/static/src/img/desert.jpg"/>
<img class="img-thumbnail img-responsive" src="/website/static/src/img/china.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/deers.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/desert.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/china.jpg"/>
</div>
<div class="col-md-4">
<img class="img-thumbnail img-responsive" src="/website/static/src/img/desert.jpg"/>
<img class="img-thumbnail img-responsive" src="/website/static/src/img/china.jpg"/>
<img class="img-thumbnail img-responsive" src="/website/static/src/img/deers.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/desert.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/china.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/deers.jpg"/>
</div>
<div class="col-md-4">
<img class="img-thumbnail img-responsive" src="/website/static/src/img/landscape.jpg"/>
<img class="img-thumbnail img-responsive" src="/website/static/src/img/china.jpg"/>
<img class="img-thumbnail img-responsive" src="/website/static/src/img/desert.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/landscape.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/china.jpg"/>
<img class="img img-thumbnail img-responsive" src="/website/static/src/img/desert.jpg"/>
</div>
</div>
</div>
@ -415,28 +415,28 @@
<h4 class="text-muted">More than 500 successful projects</h4>
</div>
<div class="col-md-6">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/desert.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/desert.jpg"/>
</div>
<div class="col-md-3">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/china_thumb.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/china_thumb.jpg"/>
</div>
<div class="col-md-3">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/deers_thumb.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/deers_thumb.jpg"/>
</div>
<div class="col-md-3">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/desert_thumb.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/desert_thumb.jpg"/>
</div>
<div class="col-md-3">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/china_thumb.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/china_thumb.jpg"/>
</div>
<div class="col-md-3">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/deers_thumb.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/deers_thumb.jpg"/>
</div>
<div class="col-md-6">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/landscape.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/landscape.jpg"/>
</div>
<div class="col-md-3">
<img class="img-thumbnail img-responsive mb16" src="/website/static/src/img/china_thumb.jpg"/>
<img class="img img-thumbnail img-responsive mb16" src="/website/static/src/img/china_thumb.jpg"/>
</div>
</div>
</div>
@ -650,19 +650,19 @@
</blockquote>
</div>
<div class="col-md-2 col-md-offset-1">
<img src="/website/static/src/img/openerp_logo.png" class="img-responsive img-thumbnail"/>
<img src="/website/static/src/img/openerp_logo.png" class="img img-responsive img-thumbnail"/>
</div>
<div class="col-md-2">
<img src="/website/static/src/img/openerp_logo.png" class="img-responsive img-thumbnail"/>
<img src="/website/static/src/img/openerp_logo.png" class="img img-responsive img-thumbnail"/>
</div>
<div class="col-md-2">
<img src="/website/static/src/img/openerp_logo.png" class="img-responsive img-thumbnail"/>
<img src="/website/static/src/img/openerp_logo.png" class="img img-responsive img-thumbnail"/>
</div>
<div class="col-md-2">
<img src="/website/static/src/img/openerp_logo.png" class="img-responsive img-thumbnail"/>
<img src="/website/static/src/img/openerp_logo.png" class="img img-responsive img-thumbnail"/>
</div>
<div class="col-md-2">
<img src="/website/static/src/img/openerp_logo.png" class="img-responsive img-thumbnail"/>
<img src="/website/static/src/img/openerp_logo.png" class="img img-responsive img-thumbnail"/>
</div>
</div>
</div>
@ -691,10 +691,9 @@
<ul class="dropdown-menu" name="parallax-background">
<li data-value="/website/static/src/img/banner/greenfields.jpg"><a>Greenfields</a></li>
<li data-value="/website/static/src/img/banner/landscape.jpg"><a>Landscape</a></li>
<li data-value="/website/static/src/img/parallax/parallax_photo1.jpg"><a>Photo Woman</a></li>
<li data-value="/website/static/src/img/banner/mountains.jpg"><a>Mountains</a></li>
<li data-value="/website/static/src/img/parallax/parallax_bg.jpg"><a>Office</a></li>
<li class="oe_custom_bg"><a><b>Chose your picture</b></a></li>
<li class="oe_custom_bg"><a><b>Choose your picture</b></a></li>
</ul>
</li>
<li class="oe_snippet_options dropdown-submenu">
@ -708,10 +707,9 @@
<li data-value="2"><a>Very Fast</a></li>
</ul>
</li>
<div class="oe_snippet_body" style="position:relative">
<div class="parallax oe_structure oe_small" style="background-image: url('/website/static/src/img/parallax/parallax_photo1.jpg')" data-stellar-background-ratio="0.3">
</div>
<div class="oe_snippet_body parallax oe_small oe_structure"
style="background-image: url('/website/static/src/img/parallax/parallax_bg.jpg')"
data-scroll-background-ratio="0.6">
</div>
</div>

View File

@ -76,7 +76,6 @@
<script type="text/javascript" src="/web/static/lib/qweb/qweb2.js"></script>
<script type="text/javascript" src="/web/static/src/js/openerpframework.js"></script>
<script type="text/javascript" src="/website/static/lib/stellar/jquery.stellar.js"></script>
<script type="text/javascript" src="/website/static/src/js/website.js"></script>
<t t-if="editable">
@ -118,19 +117,13 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><em>Your</em> <b>Company</b></a>
<a class="navbar-brand" href="/">Your<b>Company</b></a>
</div>
<div class="collapse navbar-collapse navbar-top-collapse">
<ul class="nav navbar-nav navbar-right" id="top_menu">
<t t-foreach="website.get_menu().child_id" t-as="submenu">
<t t-call="website.submenu"/>
</t>
<li class="active" t-if="user_id.id == website.public_user.id">
<a t-attf-href="/web#redirect=#{ url_for('') }">
Sign in
</a>
</li>
<li class="active dropdown" t-ignore="true" t-if="user_id.id != website.public_user.id">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span t-esc="user_id.name"/>
@ -225,6 +218,16 @@
</html>
</template>
<template id="show_sign_in" inherit_option_id="website.layout" inherit_id="website.layout" name="Show Sign In">
<xpath expr="//ul[@id='top_menu']" position="inside">
<li class="active" t-if="user_id.id == website.public_user.id">
<a t-attf-href="/web#redirect=#{ url_for('') }">
Sign in
</a>
</li>
</xpath>
</template>
<template id="footer_custom" inherit_option_id="website.layout" name="Custom Footer">
<xpath expr="//div[@id='footer_container']" position="before">
<div class="oe_structure">
@ -502,25 +505,23 @@ Sitemap: <t t-esc="url_root"/>sitemap.xml
<template id="aboutus" name="About us" page="True">
<t t-call="website.layout">
<div id="wrap">
<div data-snippet-id="parallax">
<div style="background-image: url('/website/static/src/img/parallax/parallax_bg.jpg')" data-stellar-background-ratio="0.3" class="parallax oe_structure mt32 mb32 oe_small">
<div class="container">
<div class="row">
<div class="col-md-12 mt32 mb32" data-snippet-id="colmd">
<div class="text-center">
<img src="/web/static/src/img/logo.png" class="img shadow logo-img"/>
</div>
<h3 class="text-center text-muted" t-field="res_company.rml_header1"></h3>
</div>
</div>
<div id="wrap" class="oe_structure">
<section data-snippet-id="title">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center">About us</h1>
<h3 class="text-muted text-center">Great products for great people</h3>
</div>
</div>
</div>
<div class="oe_structure"/>
<div class="container mb32">
<div class="row col-wrap" id="aboutus">
<div class="col-sm-8 mt16">
</section>
<section data-snippet-id="text-image">
<div class="container">
<div class="row">
<div class="col-md-6 mt32">
<p>
We are a team of passionated people whose goal is to improve everyone's
life through disruptive products. We build great products to solve your
@ -531,12 +532,37 @@ Sitemap: <t t-esc="url_root"/>sitemap.xml
their performance.
</p>
</div>
<div class="col-sm-3 col-sm-offset-1">
<img src="/website/static/src/img/library/business_conference.jpg" class="img img-responsive shadow" alt="Out Team"/>
<div class="col-md-4 col-md-offset-2 mt16 mb16">
<img src="/website/static/src/img/library/business_conference.jpg" class="img img-responsive shadow" alt="Our Team"/>
</div>
</div>
</div>
<div class="oe_structure"/>
</section>
<div class="parallax oe_structure mt16 oe_medium mb64" data-scroll-background-offset="0" data-scroll-background-ratio="1" data-snippet-id="parallax" style="background-image: url(http://localhost:8069/website/static/src/img/parallax/parallax_bg.jpg); background-attachment: scroll; background-position: 0px 0px; ">
<section class="mb32 mt16" data-snippet-id="references">
<div class="container">
<div class="row">
<div class="col-md-12 mt16 mb8">
<h1 class="text-center">What do customers say about us...</h1>
</div>
<div class="col-md-4 col-md-offset-1 mt16 mb0">
<blockquote data-snippet-id="quote">
<p><span style="background-color:#FFFFFF;">Write here a quote from one of your customer. Quotes are are great way to give confidence in your products or services.</span></p>
<small><span style="background-color:#FFFFFF;">Author of this quote</span></small>
</blockquote>
</div>
<div class="col-md-4 col-md-offset-2 mt16 mb32">
<blockquote data-snippet-id="quote">
<p><span style="background-color:#FFFFFF;">OpenERP provides essential platform for our project management. Things are better organized and more visible with it.</span></p>
<small><span style="background-color:#FFFFFF;">John Doe, CEO</span></small>
</blockquote>
</div>
</div>
</div>
</section>
</div>
</div>
</t>
</template>

View File

@ -45,9 +45,6 @@
</div>
<group>
<group string="Social Icons">
<p class="oe_grey" colspan="2">
Keep these fields empty to not show the related social icon.
</p>
<field name="social_twitter" placeholder="https://twitter.com/openerp"/>
<field name="social_facebook" placeholder="https://facebook.com/openerp"/>
<field name="social_googleplus" placeholder="https://plus.google.com/+openerp"/>

View File

@ -35,24 +35,23 @@ class WebsiteBlog(http.Controller):
@website.route([
'/blog/',
'/blog/<int:blog_post_id>/',
'/blog/<int:blog_post_id>/page/<int:page>/',
'/blog/cat/<int:category_id>/',
'/blog/cat/<int:category_id>/page/<int:page>/',
'/blog/tag/',
'/blog/tag/<int:tag_id>/',
'/blog/page/<int:page>/',
'/blog/<model("blog.post"):blog_post>/',
'/blog/<model("blog.post"):blog_post>/page/<int:page>/',
'/blog/cat/<model("blog.category"):category>/',
'/blog/cat/<model("blog.category"):category>/page/<int:page>/',
'/blog/tag/<model("blog.tag"):tag>/',
'/blog/tag/<model("blog.tag"):tag>/page/<int:page>/',
], type='http', auth="public", multilang=True)
def blog(self, category_id=None, blog_post_id=None, tag_id=None, page=1, **post):
def blog(self, category=None, blog_post=None, tag=None, page=1, enable_editor=None):
""" Prepare all values to display the blog.
:param integer category_id: id of the category currently browsed.
:param integer tag_id: id of the tag that is currently used to filter
blog posts
:param integer blog_post_id: ID of the blog post currently browsed. If not
set, the user is browsing the category and
a post pager is calculated. If set the user
is reading the blog post and a comments pager
is calculated.
:param category: category currently browsed.
:param tag: tag that is currently used to filter blog posts
:param blog_post: blog post currently browsed. If not set, the user is
browsing the category and a post pager is calculated.
If set the user is reading the blog post and a
comments pager is calculated.
:param integer page: current page of the pager. Can be the category or
post pager.
:param dict post: kwargs, may contain
@ -73,44 +72,39 @@ class WebsiteBlog(http.Controller):
"""
cr, uid, context = request.cr, request.uid, request.context
blog_post_obj = request.registry['blog.post']
tag_obj = request.registry['blog.tag']
category_obj = request.registry['blog.category']
tag = None
category = None
blog_post = None
blog_posts = None
pager = None
nav = {}
category_ids = category_obj.search(cr, uid, [], context=context)
categories = category_obj.browse(cr, uid, category_ids, context=context)
if tag_id:
tag = tag_obj.browse(cr, uid, tag_id, context=context)
if category_id:
category = category_obj.browse(cr, uid, category_id, context=context)
elif blog_post_id:
blog_post = blog_post_obj.browse(cr, uid, blog_post_id, context=context)
blog_message_ids = blog_post.website_message_ids
if blog_post:
category = blog_post.category_id
category_id = category.id
if not blog_post_id:
if category and tag:
blog_posts = [cat_post for cat_post in category.blog_post_ids
if tag_id in [post_tag.id for post_tag in cat_post.tag_ids]]
elif category:
pager = request.website.pager(
url="/blog/%s/" % blog_post.id,
total=len(blog_post.website_message_ids),
page=page,
step=self._post_comment_per_page,
scope=7
)
pager_begin = (page - 1) * self._post_comment_per_page
pager_end = page * self._post_comment_per_page
blog_post.website_message_ids = blog_post.website_message_ids[pager_begin:pager_end]
else:
if category:
pager_url = "/blog/cat/%s/" % category.id
blog_posts = category.blog_post_ids
elif tag:
pager_url = '/blog/tag/%s/' % tag.id
blog_posts = tag.blog_post_ids
else:
pager_url = '/blog/'
blog_post_ids = blog_post_obj.search(cr, uid, [], context=context)
blog_posts = blog_post_obj.browse(cr, uid, blog_post_ids, context=context)
if blog_posts:
pager = request.website.pager(
url="/blog/cat/%s/" % category_id,
url=pager_url,
total=len(blog_posts),
page=page,
step=self._category_post_per_page,
@ -120,19 +114,9 @@ class WebsiteBlog(http.Controller):
pager_end = page * self._category_post_per_page
blog_posts = blog_posts[pager_begin:pager_end]
if blog_post:
pager = request.website.pager(
url="/blog/%s/" % blog_post_id,
total=len(blog_message_ids),
page=page,
step=self._post_comment_per_page,
scope=7
)
pager_begin = (page - 1) * self._post_comment_per_page
pager_end = page * self._post_comment_per_page
blog_post.website_message_ids = blog_post.website_message_ids[pager_begin:pager_end]
nav = {}
for group in blog_post_obj.read_group(cr, uid, [], ['name', 'create_date'], groupby="create_date", orderby="create_date asc", context=context):
# FIXME: vietnamese month names contain spaces. Set sail for fail.
year = group['create_date'].split(" ")[1]
if not year in nav:
nav[year] = {'name': year, 'create_date_count': 0, 'months': []}
@ -147,7 +131,7 @@ class WebsiteBlog(http.Controller):
'blog_posts': blog_posts,
'pager': pager,
'nav_list': nav,
'enable_editor': post.get('enable_editor')
'enable_editor': enable_editor,
}
if blog_post:

View File

@ -36,8 +36,6 @@ import urllib
class website_event(http.Controller):
_order = 'website_published desc, date_begin desc'
@website.route(['/event/', '/event/page/<int:page>/'], type='http', auth="public", multilang=True)
def events(self, page=1, **searches):
cr, uid, context = request.cr, request.uid, request.context
@ -51,41 +49,47 @@ class website_event(http.Controller):
domain_search = {}
def sdn(date):
return date.strftime('%Y-%m-%d 23:59:59')
def sd(date):
return date.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
today = datetime.today()
dates = [
['all', _('All Dates'), [(1, "=", 1)], 0],
['all', _('Next Events'), [("date_end", ">", sd(today))], 0],
['today', _('Today'), [
("date_begin", ">", sd(today)),
("date_begin", "<", sd(today + relativedelta(days=1)))],
0],
['tomorrow', _('Tomorrow'), [
("date_begin", ">", sd(today + relativedelta(days=1))),
("date_begin", "<", sd(today + relativedelta(days=2)))],
("date_end", ">", sd(today)),
("date_begin", "<", sdn(today))],
0],
['week', _('This Week'), [
("date_begin", ">=", sd(today + relativedelta(days=-today.weekday()))),
("date_begin", "<", sd(today + relativedelta(days=6-today.weekday())))],
("date_end", ">=", sd(today + relativedelta(days=-today.weekday()))),
("date_begin", "<", sdn(today + relativedelta(days=6-today.weekday())))],
0],
['nextweek', _('Next Week'), [
("date_begin", ">=", sd(today + relativedelta(days=7-today.weekday()))),
("date_begin", "<", sd(today + relativedelta(days=13-today.weekday())))],
("date_end", ">=", sd(today + relativedelta(days=7-today.weekday()))),
("date_begin", "<", sdn(today + relativedelta(days=13-today.weekday())))],
0],
['month', _('This month'), [
("date_begin", ">=", sd(today.replace(day=1) + relativedelta(months=1))),
("date_begin", "<", sd(today.replace(day=1) + relativedelta(months=1)))],
("date_end", ">=", sd(today.replace(day=1))),
("date_begin", "<", (today.replace(day=1) + relativedelta(months=1)).strftime('%Y-%m-%d 00:00:00'))],
0],
['nextmonth', _('Next month'), [
("date_end", ">=", sd(today.replace(day=1) + relativedelta(months=1))),
("date_begin", "<", (today.replace(day=1) + relativedelta(months=2)).strftime('%Y-%m-%d 00:00:00'))],
0],
['old', _('Old Events'), [
("date_end", "<", today.strftime('%Y-%m-%d 00:00:00'))],
0],
]
# search domains
current_date = dates[0][1]
current_date = None
current_type = None
current_country = None
for date in dates:
if searches["date"] == date[0]:
domain_search["date"] = date[2]
current_date = date[1]
if date[0] != 'all':
current_date = date[1]
if searches["type"] != 'all':
current_type = type_obj.browse(cr, uid, int(searches['type']), context=context)
domain_search["type"] = [("type", "=", int(searches["type"]))]
@ -94,7 +98,7 @@ class website_event(http.Controller):
domain_search["country"] = [("country_id", "=", int(searches["country"]))]
def dom_without(without):
domain = SUPERUSER_ID != request.uid and [('website_published', '=', True)] or [(1, "=", 1)]
domain = [('state', "in", ['draft','confirm','done'])]
for key, search in domain_search.items():
if key != without:
domain += search
@ -102,9 +106,10 @@ class website_event(http.Controller):
# count by domains without self search
for date in dates:
date[3] = event_obj.search(
request.cr, request.uid, dom_without('date') + date[2],
count=True, context=request.context)
if date[0] <> 'old':
date[3] = event_obj.search(
request.cr, request.uid, dom_without('date') + date[2],
count=True, context=request.context)
domain = dom_without('type')
types = event_obj.read_group(
@ -133,9 +138,13 @@ class website_event(http.Controller):
request.cr, request.uid, dom_without("none"), count=True,
context=request.context)
pager = request.website.pager(url="/event/", total=event_count, page=page, step=step, scope=5)
order = 'website_published desc, date_begin'
if searches.get('date','all') == 'old':
order = 'website_published desc, date_begin desc'
obj_ids = event_obj.search(
request.cr, request.uid, dom_without("none"), limit=step,
offset=pager['offset'], order=self._order, context=request.context)
offset=pager['offset'], order=order, context=request.context)
events_ids = event_obj.browse(request.cr, request.uid, obj_ids,
context=request.context)

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -13,23 +13,22 @@
<template id="index" name="Events">
<t t-call="website.layout">
<div id="wrap">
<div class="oe_structure"/>
<div class="container">
<div class="oe_structure"/>
<h1 class="text-center">
Our Events
Next Events
</h1>
<h3 class="text-center text-muted">
<t t-esc="current_date"/><t t-if="current_type">,
<t t-esc="current_type.name"/></t><t t-if="current_country">,
<t t-esc="current_date or ''"/><span t-if="current_type"><t t-if="current_date">,</t>
<t t-esc="current_type.name"/></span><span t-if="current_country"><t t-if="current_type or current_date">,</t>
<t t-esc="current_country.name"/>
</t>
</span>
</h3>
<div class="row mt16 mb32">
<div class="row mt32 mb32">
<div class="col-md-3 col-sm-4 css_noprint" id="left_column">
<ul class="nav nav-pills nav-stacked">
<li class="nav-header">Date</li>
<t t-foreach="dates" t-as="date">
<li t-att-class="searches.get('date') == date[0] and 'active' or ''" t-if="date[3]">
<li t-att-class="searches.get('date') == date[0] and 'active' or ''" t-if="date[3] or (date[0] in ('old','all'))">
<a t-href="/event/#{ search_path }&amp;date=#{ date[0] }"><t t-esc="date[1]"/>
<span t-if="date[3]" class="badge pull-right"><t t-esc="date[3]"/></span>
</a>
@ -37,25 +36,27 @@
</t>
</ul>
</div>
<div class="col-sm-8 col-md-9">
<div class="col-sm-7 col-md-6" id="middle_column">
<t t-call="website.pager" >
<t t-set="classname">pull-left</t>
</t>
<div class="oe_structure">
</div>
<t t-if="not event_ids">
<p t-if="current_date or current_country or current_type">
No event found in this category, check <a href="/event">all events</a>.
</p>
<p t-if="(current_date is None) and (current_country is None) and (current_type is None)">
No events are planned for now on.
</p>
</t>
<ul class="media-list">
<li t-foreach="event_ids" t-as="event" class="media" data-publish="">
<t t-call="website.publish_management">
<t t-set="object" t-value="event"/>
<t t-set="publish_controller">/event/publish</t>
</t>
<div class="media-body">
<span t-if="not event.event_ticket_ids" class="label label-danger pull-right">Registration Closed</span>
<t t-if="event.event_ticket_ids">
<span t-if="event.register_avail == 9999" class="label label-default pull-right label-info">Tickets Available</span>
<span t-if="not event.register_avail" class="label label-danger pull-right">Sold Out</span>
<span t-if="event.register_avail and event.register_avail != 9999" t-attf-class="label label-default pull-right label-#{ event.register_avail &lt;= 10 and 'warning' or 'info' }">
Tickets Available
<span t-if="event.register_avail and event.register_avail &lt;= ((event.register_max or 0) / 4)" class="label pull-right label-info">
Only <t t-esc="event.register_avail"/> Remaining
</span>
</t>
<h4 class="media-heading"><a t-href="/event/#{ event.id }/"><span t-field="event.name"> </span></a></h4>
@ -76,6 +77,10 @@
</div>
</li>
</ul>
</div>
<div class="col-sm-2 col-md-3 oe_structure" id="right_column">
</div>
<div class="col-md-8 col-lg-offset-4 text-center">
<t t-call="website.pager" />
@ -87,10 +92,45 @@
</t>
</template>
<template id="event_category" inherit_id="website_event.index" inherit_option_id="website_event.index" name="Category">
<template id="event_right_photos" inherit_id="website_event.index" inherit_option_id="website_event.index" name="Photos">
<xpath expr="//div[@id='right_column']" position="inside">
<div class="row">
<div class="col-md-12 mb16">
<div class="oe_demo">
<img src="/website_event/static/src/img/openerp_enterprise_of_the_year.png" class="img-rounded"/>
<div class="text-center"><a href="/event">Photos of Past Events</a></div>
</div>
</div>
<div class="col-md-12 mb16">
<div class="oe_demo">
<img src="/website_event/static/src/img/training.jpg" class="img-rounded"/>
<div class="text-center"><a href="/event">Our Trainings</a></div>
</div>
</div>
</div>
</xpath>
</template>
<template id="event_right_quotes" inherit_id="website_event.index" inherit_option_id="website_event.index" name="Quotes">
<xpath expr="//div[@id='right_column']" position="inside">
<div class="row">
<div class="col-md-12 mb16">
<blockquote class="oe_snippet_body">
<p>
Write here a quote from one of your attendees.
It gives confidence in your
events.
</p>
<small>Author</small>
</blockquote>
</div>
</div>
</xpath>
</template>
<template id="event_category" inherit_id="website_event.index" inherit_option_id="website_event.index" name="Filter by Category">
<xpath expr="//div[@id='left_column']" position="inside">
<ul class="nav nav-pills nav-stacked mt32">
<li class="nav-header">Category</li>
<t t-foreach="types">
<li t-if="type" t-att-class="searches.get('type') == str(type and type[0]) and 'active' or ''">
<a t-href="/event/#{ search_path }&amp;type=#{ type[0] }"><t t-esc="type[1]"/>
@ -101,10 +141,9 @@
</ul>
</xpath>
</template>
<template id="event_location" inherit_id="website_event.index" inherit_option_id="website_event.index" name="Location">
<template id="event_location" inherit_id="website_event.index" inherit_option_id="website_event.index" name="Filter by Country">
<xpath expr="//div[@id='left_column']" position="inside">
<ul class="nav nav-pills nav-stacked mt32">
<li class="nav-header">Location</li>
<t t-foreach="countries">
<li t-if="country_id" t-att-class="searches.get('country') == str(country_id and country_id[0]) and 'active' or ''">
<a t-href="/event/#{ search_path }&amp;country=#{ country_id[0] }"><t t-esc="country_id[1]"/>

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp.addons.web import http
from openerp.tools.translate import _
from openerp.addons.web.http import request
from openerp.addons.website.models import website
from openerp.addons.website.controllers.main import Website as controllers
@ -9,49 +10,41 @@ import base64
class website_hr_recruitment(http.Controller):
@website.route(['/jobs', '/jobs/page/<int:page>/', '/department/<id>/', '/department/<id>/page/<int:page>/'], type='http', auth="public", multilang=True)
def jobs(self, id=0, page=1, **post):
id = id and int(id) or 0
@website.route(['/jobs', '/jobs/department/<model("hr.department"):department>/office/<model("res.partner"):office>', '/jobs/department/<model("hr.department"):department>', '/jobs/office/<model("res.partner"):office>'], type='http', auth="public", multilang=True)
def jobs(self, department=None, office=None, page=0):
hr_job_obj = request.registry['hr.job']
hr_department_obj = request.registry['hr.department']
domain = []
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain, order="website_published,no_of_recruitment", context=request.context)
jobs = hr_job_obj.browse(request.cr, request.uid, jobpost_ids, request.context)
domain = [("state", 'in', ['recruit', 'open'])]
if id != 0:
domain += [('department_id','=', id)]
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain)
request.cr.execute("SELECT DISTINCT(hr_job.company_id) FROM hr_job WHERE hr_job.company_id IS NOT NULL")
ids = []
for i in request.cr.fetchall():
ids.append(i[0])
companies = request.registry['res.company'].browse(request.cr, request.uid, ids)
departments = set()
for job in jobs:
if job.department_id:
departments.add(job.department_id)
vals = {}
for rec in hr_job_obj.browse(request.cr, request.uid, jobpost_ids):
vals[rec.id] = {'count': int(rec.no_of_recruitment), 'date_recruitment': rec.write_date.split(' ')[0]}
offices = set()
for job in jobs:
if job.address_id:
offices.add(job.address_id)
department_ids = []
request.cr.execute("SELECT * FROM hr_department")
for i in request.cr.fetchall():
department_ids.append(i[0])
active = id
if department or office:
if office:
domain += [('address_id','=', office.id)]
if department:
domain += [('department_id','=', department.id)]
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain, order="website_published,no_of_recruitment", context=request.context)
jobs = hr_job_obj.browse(request.cr, request.uid, jobpost_ids, request.context)
step = 10
pager = request.website.pager(url="/jobs/", total=len(jobpost_ids), page=page, step=step, scope=5)
jobpost_ids = hr_job_obj.search(request.cr, request.uid, domain, limit=step, offset=pager['offset'])
values = {
'active': active,
'companies': companies,
'res_job': hr_job_obj.browse(request.cr, request.uid, jobpost_ids),
'departments': hr_department_obj.browse(request.cr, request.uid, department_ids),
'vals': vals,
'pager': pager
}
return request.website.render("website_hr_recruitment.index", values)
return request.website.render("website_hr_recruitment.index", {
'jobs': jobs,
'departments': departments,
'offices': offices,
'active': department and department.id or None,
'office': office and office.id or None
})
@website.route(['/job/detail/<model("hr.job"):job>'], type='http', auth="public", multilang=True)
def detail(self, job=None, **kwargs):
def detail(self, job):
values = {
'job': job,
'vals_date': job.write_date.split(' ')[0],
@ -60,7 +53,25 @@ class website_hr_recruitment(http.Controller):
@website.route(['/job/success'], type='http', auth="admin", multilang=True)
def success(self, **post):
id = request.registry['hr.applicant'].create(request.cr, request.uid, post)
data = {
'name': _('Online Form'),
'phone': post.get('phone', False),
'email_from': post.get('email_from', False),
'partner_name': post.get('partner_name', False),
'description': post.get('description', False),
'department_id': post.get('department_id', False),
'job_id': post.get('job_id', False),
'user_id': False
}
imd = request.registry['ir.model.data']
try:
model, source_id = imd.get_object_reference(request.cr, request.uid, 'hr_recruitment', 'source_website_company')
data['source_id'] = source_id
except ValueError, e:
pass
jobid = request.registry['hr.applicant'].create(request.cr, request.uid, data, context=request.context)
if post['ufile']:
attachment_values = {
'name': post['ufile'].filename,
@ -68,16 +79,13 @@ class website_hr_recruitment(http.Controller):
'datas_fname': post['ufile'].filename,
'res_model': 'hr.applicant',
'res_name': post['name'],
'res_id': id
'res_id': jobid
}
request.registry['ir.attachment'].create(request.cr, request.uid, attachment_values)
values = {
'jobid': post['job_id']
}
return request.website.render("website_hr_recruitment.thankyou", values)
request.registry['ir.attachment'].create(request.cr, request.uid, attachment_values, context=request.context)
return request.website.render("website_hr_recruitment.thankyou", {})
@website.route(['/apply/<model("hr.job"):job>'], type='http', auth="public", multilang=True)
def applyjobpost(self, job=None, **kwargs):
@website.route(['/job/apply', '/job/apply/<model("hr.job"):job>'], type='http', auth="public", multilang=True)
def applyjobpost(self, job=None):
return request.website.render("website_hr_recruitment.applyjobpost", { 'job': job })
@website.route('/job/publish', type='json', auth="admin", multilang=True)
@ -97,4 +105,3 @@ class website_hr_recruitment(http.Controller):
hr_job.write(request.cr, request.uid, [rec.id], vals, context=request.context)
return res
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -6,7 +6,6 @@ from openerp.osv import osv, fields
class hr_job(osv.osv):
""" Override to add website-related columns: published, description. """
_inherit = "hr.job"
_columns = {
'website_published': fields.boolean('Available in the website'),
'website_description': fields.html('Description for the website'),

View File

@ -16,29 +16,60 @@
<template id="index" name="Jobs">
<t t-call="website.layout">
<div id="wrap">
<div class="oe_structure"/>
<div class="container oe_website_jobs">
<div class="row">
<div class="col-sm-4">
<t t-call="website.pager">
<t t-set="classname">pull-left</t>
</t>
<div class="oe_structure">
<section data-snippet-id="text-block" class="mb32">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mb16" data-snippet-id="colmd">
<h2>Our Job Offers</h2>
<h3 class="text-muted">Join us and help disrupt the enterprise market!</h3>
</div>
<div class="col-md-12" data-snippet-id="colmd">
<p>
With a small team of smart people, we released the most
disruptive enterprise management software in the world.
OpenERP is fully open source, super easy, full featured
(3000+ apps) and its online offer is 3 times cheaper than
traditional competitors like SAP and Ms Dynamics.
</p>
<p>
Join us, we offer you an extraordinary chance to learn, to
develop and to be part of an exciting experience and
team.
</p>
</div>
</div>
</div>
<div class='row style_default mt16'>
<div class="col-md-12" id="jobs_grid">
</section>
</div>
<div class="container oe_website_jobs">
<div class="row">
<div class="col-md-1" id="jobs_grid_left">
</div>
<div class="col-md-9" id="jobs_grid">
<ul class="media-list">
<li t-foreach="res_job" t-as="job" class="media">
<li t-foreach="jobs" t-as="job" class="media">
<div class="media-body" t-att-data-publish="job.website_published and 'on' or 'off'">
<t t-if="job.no_of_recruitment">
<span class="label label-default pull-right label-info"><t t-esc="vals[job.id]['count']"/> Vacancies.</span>
</t>
<h4 class="media-heading"><a t-href="/job/detail/#{ job.id }/"><span t-field="job.name"> </span></a></h4>
<div t-if="companies[0].country_id">
<i class="icon-map-marker"/> <span t-field="companies[0].city"> </span> <span t-if="companies[0].state_id" t-field="companies[0].state_id.name"> </span>, <span t-field="companies[0].country_id.name"> </span>
<h3 class="media-heading">
<a t-href="/job/detail/#{ job.id }/">
<span t-field="job.name"/>
</a>
<small t-if="job.no_of_recruitment &gt; 1">
<t t-esc="job.no_of_recruitment"/> open positions
</small>
</h3>
<div t-if="job.address_id">
<i class="icon-map-marker"/>
<span t-field="job.address_id.city"/>
<span t-if="job.address_id.state_id" t-field="job.address_id.state_id"/>
, <span t-field="job.address_id.country_id.name"/>
</div>
<div class="text-muted">
<i class="icon-time"/> <span><t t-esc="vals[job.id]['date_recruitment']"/></span>
<i class="icon-time"/> <span t-field="job.write_date"/>
</div>
</div>
</li>
@ -46,7 +77,18 @@
</div>
</div>
</div>
<div class="oe_structure"/>
<div class="oe_structure">
<section data-snippet-id="cta" class="darken">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/job/apply" class="btn btn-primary btn-lg">Apply</a>
</div>
</div>
</div>
</section>
</div>
</div>
</t>
</template>
@ -55,25 +97,29 @@
<t t-call="website.layout">
<t t-set="additional_title">Job Detail</t>
<div id="wrap">
<div class="container oe_website_hr_recruitment">
<section class="container mt8">
<div class="row">
<div class="col-md-3">
<t t-call="website_mail.follow">
<t t-set="email" t-value="user_id.email"/>
<t t-set="object" t-value="job"/>
</t>
</div>
<t t-call="website.publish_management">
<t t-set="object" t-value="job"/>
<t t-set="publish_edit" t-value="True"/>
<t t-set="publish_controller">/job/publish</t>
</t>
<div class="col-sm-5">
<ol class="breadcrumb mb0">
<li><a t-href="/jobs">Our Jobs</a></li>
<li class="active"><span t-field="job.name"></span></li>
</ol>
</div><div class="col-sm-7">
<t t-call="website.publish_management">
<t t-set="object" t-value="job"/>
<t t-set="publish_edit" t-value="True"/>
<t t-set="publish_controller">/job/publish</t>
</t>
</div>
</div>
</div>
</section>
<div class="oe_structure" style="clear:both;">
<h1 class="text-center" t-field="job.name"/>
<h5 class="text-center">
<i class="icon-map-marker"/> <span t-field="job.company_id.city"> </span> <span t-if="job.company_id.state_id" t-field="job.company_id.state_id.name"> </span>, <span t-field="job.company_id.country_id.name"> </span></h5>
<i class="icon-map-marker"/> <span t-field="job.address_id.city"/> <span t-if="job.address_id.state_id" t-field="job.address_id.state_id.name"/>, <span t-field="job.address_id.country_id.name"/>
</h5>
<h5 class="text-center text-muted">
<i class="icon-time"/> <span><t t-esc="vals_date"/></span>
</h5>
@ -86,7 +132,7 @@
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/apply/#{ job.id }/" class="btn btn-primary btn-lg">Apply</a>
<a t-href="/job/apply/#{ job.id }/" class="btn btn-primary btn-lg">Apply</a>
</div>
</div>
</div>
@ -103,28 +149,39 @@
<t t-set="additional_title">Apply Job</t>
<div id="wrap">
<div class="container">
<h1 class="text-center">Apply for <span t-field="job.name"/></h1>
<h1 class="text-center">
Job Application Form
</h1>
<h2 t-if="job" class="text-center text-muted">
<span t-field="job.name"/>
</h2>
<div class="row">
<section id="forms">
<!-- TODO Multilingual form action support ? -->
<form class="form-horizontal mt32" action="/job/success" method="post" enctype="multipart/form-data">
<input type="hidden" t-att-value="job.department_id.id" name="department_id"/>
<input type="hidden" t-att-value="job.id" name="job_id"/>
<input type="hidden" t-att-value="job.name" name="name"/>
<input type="hidden" t-att-value="job and job.department_id.id or False" name="department_id"/>
<input type="hidden" t-att-value="job and job.id or False" name="job_id"/>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="partner_name">Name</label>
<label class="col-md-3 col-sm-4 control-label" for="partner_name">Your Name</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control" name="partner_name" required="True" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="email_from">Email</label>
<label class="col-md-3 col-sm-4 control-label" for="email_from">Your Email</label>
<div class="col-md-7 col-sm-8">
<input type="email" class="form-control" name="email_from" required="True" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="description">Cover Note</label>
<label class="col-md-3 col-sm-4 control-label" for="phone">Your Phone</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control" name="phone" required="True" />
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label" for="description">Short Introduction</label>
<div class="col-md-7 col-sm-8">
<textarea class="form-control" name="description" style="min-height: 120px"/>
</div>
@ -147,41 +204,68 @@
</div>
</t>
</template>
<template id="thankyou">
<t t-call="website.layout">
<div id="wrap">
<div class="container">
<h1>Thank you!</h1>
<p>
We have received your application for the position,
we will contact you soon for the next part of the
recruitment process.
</p>
<div class="oe_structure">
<div class="container">
<h1>Thank you!</h1>
<p>
Your job application has been successfully registered,
we will get back to you soon.
</p>
</div>
<section data-snippet-id="cta" class="darken">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mt16 mb16">
<a t-href="/" class="btn btn-primary btn-lg">Continue To Our Website</a>
</div>
</div>
</div>
</section>
</div>
</div>
</t>
</template>
<template id="job_departments" inherit_option_id="website_hr_recruitment.index" name="Job Departments">
<xpath expr="//div[@id='jobs_grid']" position="before">
<div class="col-md-3">
<ul class="nav nav-pills nav-stacked mt16">
<template id="job_departments" inherit_option_id="website_hr_recruitment.index" name="Filter on Departments">
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
<ul class="nav nav-pills nav-stacked mb32">
<li t-att-class=" '' if active else 'active' "><a t-href="/jobs">All Departments</a></li>
<t t-foreach="departments" t-as="department">
<li t-att-class="department.id == active and 'active' or ''">
<a t-href="/department/#{ department.id }/" ><span t-field="department.name"/></a>
<a t-href="/jobs/department/#{ department.id }/" ><span t-field="department.name"/></a>
</li>
</t>
</ul>
</div>
</xpath>
<xpath expr="//div[@id='jobs_grid']" position="attributes">
<attribute name="class">col-md-9</attribute>
</xpath>
<xpath expr="//div[@class='row']/div" position="before">
<div class="col-md-4">
<h1>Departments</h1>
</div>
</xpath>
</template>
</data>
</xpath>
<xpath expr="//div[@id='jobs_grid_left']" position="attributes">
<attribute name="class">col-md-3</attribute>
</xpath>
</template>
<template id="job_offices" inherit_option_id="website_hr_recruitment.index" name="Filter on Offices">
<xpath expr="//div[@id='jobs_grid_left']" position="inside">
<ul class="nav nav-pills nav-stacked mb32">
<li t-att-class=" '' if office else 'active' "><a t-href="/jobs">All Offices</a></li>
<t t-foreach="offices" t-as="thisoffice">
<li t-att-class="thisoffice.id == office and 'active' or ''">
<a t-href="/jobs/office/#{ thisoffice.id }/" >
<span t-field="thisoffice.city"/><t t-if="thisoffice.country_id">,
<span t-field="thisoffice.country_id.name"/>
</t>
</a>
</li>
</t>
</ul>
</xpath>
<xpath expr="//div[@id='jobs_grid_left']" position="attributes">
<attribute name="class">col-md-3</attribute>
</xpath>
</template>
</data>
</openerp>

View File

@ -341,25 +341,22 @@ class Ecommerce(http.Controller):
}
return request.website.render("website_sale.products", values)
@website.route(['/shop/product/<int:product_id>/'], type='http', auth="public", multilang=True)
def product(self, product_id=0, **post):
@website.route(['/shop/product/<model("product.template"):product>/'], type='http', auth="public", multilang=True)
def product(self, product, search='', category='', filter='', promo=None, lang_code=None):
if 'promo' in post:
self.change_pricelist(post.get('promo'))
if promo:
self.change_pricelist(promo)
product_obj = request.registry.get('product.template')
category_obj = request.registry.get('product.public.category')
category_ids = category_obj.search(request.cr, request.uid, [(1, '=', 1)], context=request.context)
category_ids = category_obj.search(request.cr, request.uid, [], context=request.context)
category_list = category_obj.name_get(request.cr, request.uid, category_ids, context=request.context)
category_list = sorted(category_list, key=lambda category: category[1])
category = None
if post.get('category') and int(post.get('category')):
category = category_obj.browse(request.cr, request.uid, int(post.get('category')), context=request.context)
if category:
category = category_obj.browse(request.cr, request.uid, int(category), context=request.context)
request.context['pricelist'] = self.get_pricelist()
product = product_obj.browse(request.cr, request.uid, product_id, context=request.context)
values = {
'Ecommerce': self,
@ -368,9 +365,9 @@ class Ecommerce(http.Controller):
'main_object': product,
'product': product,
'search': {
'search': post.get('search') or '',
'category': post.get('category') or '',
'filter': post.get('filter') or '',
'search': search,
'category': category and str(category.id),
'filter': filter,
}
}
return request.website.render("website_sale.product", values)
@ -483,7 +480,7 @@ class Ecommerce(http.Controller):
product_ids = []
if order:
for line in order.order_line:
suggested_ids += [p.id for p in line.product_id and line.product_id.suggested_product_ids or [] for line in order.order_line]
suggested_ids += [p.id for p in line.product_id and line.product_id.suggested_product_ids or []]
product_ids.append(line.product_id.id)
suggested_ids = list(set(suggested_ids) - set(product_ids))
if suggested_ids: