summaryrefslogtreecommitdiff
path: root/addons/event/static
diff options
context:
space:
mode:
authorAtul Patel (OpenERP) <atp@tinyerp.com>2012-05-21 18:54:58 +0530
committerAtul Patel (OpenERP) <atp@tinyerp.com>2012-05-21 18:54:58 +0530
commit4a02e98d42678b9becec3bacf4d65906596bfdf7 (patch)
treebc45461229b9aa7353fac620c6364f24d3923d42 /addons/event/static
parent96fde61acf012673b4f0a197b7a9b62d10ee9b5e (diff)
[FIX]: Add osv memory wizard for event preview.Refactor code as per new specification.
bzr revid: atp@tinyerp.com-20120521132458-xozrh3vcz4wbo6t5
Diffstat (limited to 'addons/event/static')
-rw-r--r--addons/event/static/src/css/event.css181
-rw-r--r--addons/event/static/src/js/google_map.js87
2 files changed, 164 insertions, 104 deletions
diff --git a/addons/event/static/src/css/event.css b/addons/event/static/src/css/event.css
index 4a2d8d558fb..cdf92810392 100644
--- a/addons/event/static/src/css/event.css
+++ b/addons/event/static/src/css/event.css
@@ -33,69 +33,25 @@ div.oe_fold_column{
padding:0px !important;
}
.oe_event_button_subscribe {
- display: inline-block;
- border: 1px solid #ababab;
- color: #404040;
- font-size: 12px;
- padding: 0px !important;
- text-align: center;
- -o-background-size: 100% 100%;
- -moz-background-size: 100% 100%;
- -webkit-background-size: auto auto !important;
- background-size: 100% 100%;
- background: #d8d8d8 none;
- background: none, -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8));
- background: none, -webkit-linear-gradient(#efefef, #d8d8d8);
- background: none, -moz-linear-gradient(#efefef, #d8d8d8);
- background: none, -o-linear-gradient(top, #efefef, #d8d8d8);
- background: none, -khtml-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8));
- background: -ms-linear-gradient(top, #efefef, #d8d8d8);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef', endColorstr='#d8d8d8',GradientType=0 );
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- -o-border-radius: 3px;
- -ms-border-radius: 3px;
- border-radius: 3px;
- -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
- -webkit-font-smoothing: antialiased;
- outline: none;
+ color: white;
+ background-color: #8a89ba;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#8a89ba), to(#807fb4));
+ background-image: -webkit-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -moz-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -ms-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -o-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: linear-gradient(to bottom, #8a89ba, #807fb4);
}
.oe_event_button_unsubscribe {
- display: inline-block;
- border: 1px solid #AAA;
- color: #404040;
- font-size: 12px;
- padding: 3px 10px;
- text-align: center;
- -o-background-size: 100% 100%;
- -moz-background-size: 100% 100%;
- -webkit-background-size: auto auto !important;
- background-size: 100% 100%;
- background: #AAA none;
- background: none, -webkit-gradient(linear, left top, left bottom, from(#AAA), to(#AAA));
- background: none, -webkit-linear-gradient(#AAA, #AAA);
- background: none, -moz-linear-gradient(#AAA, #AAA);
- background: none, -o-linear-gradient(top, #AAA, #AAA);
- background: none, -khtml-gradient(linear, left top, left bottom, from(#AAA), to(#AAA));
- background: -ms-linear-gradient(top, #AAA, #AAA);
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#AAA, endColorstr='#AAA',GradientType=0 );
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- -o-border-radius: 3px;
- -ms-border-radius: 3px;
- border-radius: 3px;
- -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
- -webkit-font-smoothing: antialiased;
- outline: none;
+ color: white;
+ background-color: #8a89ba;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#8a89ba), to(#807fb4));
+ background-image: -webkit-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -moz-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -ms-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -o-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: linear-gradient(to bottom, #8a89ba, #807fb4);;
}
.oe_event_button_subscribe:hover {
cursor: pointer;
@@ -120,3 +76,108 @@ div.oe_fold_column{
width:35px;
}
+ .oe_event_title{
+ font-size: 25px;
+}
+.oe_sub1
+{
+ float:left;
+ height:50px;
+ border-right: 1px solid black;
+ border-color: #DCDCDC;
+}
+.oe_mapbox
+{
+ width:auto;
+ height:200px;
+ margin-left:auto;
+ margin-right:auto;
+ text-align: right;
+}
+.oe_td_border
+{
+ width: 7em;
+ padding: 5px;
+ border-right: 1px solid black;
+ text-align: right;
+ border-color: #DCDCDC;
+ border-spacing:5em
+}
+.oe_td_date_border
+{
+ border-right:1px solid black;
+ border-color: #DCDCDC;
+}
+
+td.oe_sale_end_date
+{
+ padding:5px;
+}
+td.oe_qty
+{
+ width: 80px;
+ text-align:right;
+ padding:5px;
+}
+
+.oe_order_button
+{
+ height:25px;
+ position: absolute;
+ left:330px;
+ padding: 5px;
+}
+
+.oe_a
+{
+ position: absolute;
+ left: 22%;
+}
+
+td.oe_b
+{
+ position:relative;
+ left: 60%;
+}
+
+textarea.field_text
+{
+ width: 765px;
+ height: 318px;
+}
+
+td.oe_form_group_nested
+{
+ padding: 5px;
+}
+.oe_event_title{
+ font-size: 25px;
+}
+.oe_sub1
+{
+ float:left;
+ height:50px;
+ border-right: 1px solid black;
+ border-color: #DCDCDC;
+}
+.oe_mapbox
+{
+ width:auto;
+ height:200px;
+ margin-left:auto;
+ margin-right:auto;
+ text-align: right;
+}
+.oe_td_border
+{
+ width: 5em;
+ padding: 2px;
+ border-right: 1px solid black;
+ text-align: center;
+ border-color: #DCDCDC;
+}
+.oe_td_date_border
+{
+ border-right:1px solid black;
+ border-color: #DCDCDC;
+}
diff --git a/addons/event/static/src/js/google_map.js b/addons/event/static/src/js/google_map.js
index 2209001f29d..7d2681a7369 100644
--- a/addons/event/static/src/js/google_map.js
+++ b/addons/event/static/src/js/google_map.js
@@ -1,11 +1,24 @@
openerp.event = function(instance){
- instance.web.form.widgets.add('geo_address', 'instance.event.GeoAddress');
- instance.event.GoogleMapConnecter = instance.web.Class.extend({
- init : function(){
-// call ajex to render map load
-
- },
- render_map: function(address){
+ instance.web.form.widgets.add('many2one_Geo_address', 'instance.event.Many2OneAddress');
+
+ instance.web.GoogleMapConnector = instance.web.Class.extend({
+ init: function(){
+ this.googleMapsLoaded = $.Deferred();
+ this.map_load();
+ },
+ map_load: function() {
+ var self = this;
+ if(this.googleMapsLoaded.state() != "pending"){return this.googleMapsLoaded.promise();}
+ googleMapsCallback = function () {
+ self.googleMapsLoaded.resolve();
+ };
+ $.ajax({
+ url: "https://maps.googleapis.com/maps/api/js?v=3&callback=googleMapsCallback&sensor=false",
+ dataType: "script"
+ }).fail(self.googleMapsLoaded.reject);
+ return this.googleMapsLoaded.promise();
+ },
+ render_map: function(address,$element){
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status){
if (status == google.maps.GeocoderStatus.OK){
@@ -16,54 +29,40 @@ openerp.event = function(instance){
mapTypeId: google.maps.MapTypeId.ROADMAP
}
return new google.maps.Marker({
- map : new google.maps.Map(document.getElementById("oe_mapbox"),myOptions),
+ map : new google.maps.Map($element,myOptions),
position: new google.maps.LatLng(lat,lng)
});
}
});
- map_load: function() {
- var self = this;
- if(this.googleMapsLoaded.state() != "pending"){return this.googleMapsLoaded.promise();}
- googleMapsCallback = function () {
- self.googleMapsLoaded.resolve();
- };
- $.ajax({
- url: "https://maps.googleapis.com/maps/api/js?v=3&callback=googleMapsCallback&sensor=false",
- dataType: "script"
- }).fail(self.googleMapsLoaded.reject);
- return this.googleMapsLoaded.promise();
- },
-
- }),
-
- instance.event.GeoAddress = instance.web.form.Many2OneField.extend(_.extend({}, {
- init : function(){
- this._super();
- this.googleMapsLoaded = $.Deferred();
},
-
-
- set_value:function(value){
- var self = this;
- this.get_address(value).done(function(value){
- if(!self.__parentedParent.$element.find("#address_text").length)self.__parentedParent.$element.find(".oe_td_border").after(instance.web.qweb.render("address",{'record': value}));
- var address = _.str.sprintf(' %(street)s, %(city)s, %(country_id[1])s', value);
- var defer = self.map_load();
- defer.done(function(){
- return self.render_map(address);
- });
- });
+ });
+ instance.event.Many2OneAddress = instance.web.form.FieldMany2One.extend({
+ init: function(field_manager, node){
+ this._super(field_manager, node);
+ this.map = new instance.web.GoogleMapConnector();
},
get_address:function(value){
+ var self = this;
if (!value || value.length == 0){
return $.Deferred().reject();
}
- return new instance.web.DataSet (this,this.field.relation, this.build_context()).read_ids(value[0],["street","city","country_id"]);
+ (value instanceof Array)?value = parseInt(value[0]):false;
+ var data = new instance.web.DataSet(this,this.field.relation, this.build_context());
+ data.read_ids(value,["street","city","country_id"]).done(function(value){
+ var address = _.str.sprintf(' %(street)s, %(city)s, %(country_id[1])s', value);
+ self.map.googleMapsLoaded.done(function(){
+ self.map.render_map(address,document.getElementById("oe_mapbox"));
+ })
+ });
},
-
+ set_value:function(value){
+ this._super(value);
+ this.get_address(value);
},
- get_value:function(){
- }
- }));
+ render_value:function(no_recurse){
+ this.get_address(this.get("value"));
+ this._super(no_recurse);
+ }
+ });
}; \ No newline at end of file