[IMP] Project Kanban: jslint and code indentation

bzr revid: fme@openerp.com-20120521130914-c2iijoifs763am83
This commit is contained in:
Fabien Meghazi 2012-05-21 15:09:14 +02:00
parent 2a0d217856
commit 5feabe936f
2 changed files with 179 additions and 154 deletions

View File

@ -1,42 +1,50 @@
.project_fields {
margin-top: 1px;
margin-bottom: 1px;
font-size: 11px;
padding-left: 0px;
}
margin-top: 1px;
margin-bottom: 1px;
font-size: 11px;
padding-left: 0px;
}
.project_fields td {
border: none;
padding: 2px 0 2px 8px; }
padding: 2px 0 2px 8px;
}
.project_fields th {
padding: 0;
border-right: 1px solid #dddddd;
vertical-align: top;
margin-right: 8px; }
margin-right: 8px;
}
.project_vignettes{
padding: 4px !important }
.project_vignettes li {
padding: 4px !important;
}
.project_vignettes li {
float: left;
}
.project_vignettes .project_avatar {
}
.project_vignettes .project_avatar {
width: 30px;
height: 30px;
padding-left: 0px; }
.project_vignettes .project_fields {
width: 100%; }
.project_vignettes .project_fields th {
width: 120px;
font-weight: normal; }
.project_vignettes .project_fields td {
color: #888888; }
.project_vignettes h4 a {
color: #4c4c4c; }
.project_vignettes > li h4 {
padding-left: 0px;
}
.project_vignettes .project_fields {
width: 100%;
}
.project_vignettes .project_fields th {
width: 120px;
font-weight: normal;
}
.project_vignettes .project_fields td {
color: #888888;
}
.project_vignettes h4 a {
color: #4c4c4c;
}
.project_vignettes > li h4 {
margin-bottom: 2px;
padding-left: 2px; }
padding-left: 2px;
}
.oe_project_buttons {
padding: 2px 2px !important;
background: none !important;
background: none !important;
background-color: transparent !important;
border: hidden !important;
color: #8A89BA !important;
@ -51,8 +59,8 @@
border-radius: 4px;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.click_button {
background: none !important;
background-color: transparent !important;
@ -68,54 +76,60 @@
-webkit-box-align: baseline;
}
.click_button:hover {
cursor: default !important;
}
.dropdown-menu {
display: none;
position: absolute; }
display: none;
position: absolute;
}
.dropdown {
position: relative; }
position: relative;
}
.dropdown-toggle:after {
width: 0;
height: 0;
display: inline-block;
content: "&darr";
text-indent: -99999px;
vertical-align: top;
margin-top: 8px;
margin-left: 4px;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid white;
filter: alpha(opacity=50);
-khtml-opacity: 0.5;
-moz-opacity: 0.5;
opacity: 0.5; }
.oe_project_kanban_vignette .dropdown-menu .color-chooser {
padding: 0 3px; }
.oe_project_kanban_vignette .dropdown-menu .color-chooser li {
float: left; }
.oe_project_kanban_vignette .dropdown-menu .color-chooser li a {
padding: 2px; }
width: 0;
height: 0;
display: inline-block;
content: "&darr";
text-indent: -99999px;
vertical-align: top;
margin-top: 8px;
margin-left: 4px;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid white;
filter: alpha(opacity=50);
-khtml-opacity: 0.5;
-moz-opacity: 0.5;
opacity: 0.5;
}
.oe_project_kanban_vignette .dropdown-menu .color-chooser {
padding: 0 3px;
}
.oe_project_kanban_vignette .dropdown-menu .color-chooser li {
float: left;
}
.oe_project_kanban_vignette .dropdown-menu .color-chooser li a {
padding: 2px;
}
a.oe_project_kanban_action {
position: absolute;
right: 0;
display: none;
}
a.oe_project_kanban_action:hover {
text-decoration: none; }
a.oe_project_kanban_action .oe_i {
color: #4c4c4c; }
.square {
display: inline-block;
width: 18px;
height: 18px;
border:1px solid grey;
}
position: absolute;
right: 0;
display: none;
}
a.oe_project_kanban_action:hover {
text-decoration: none;
}
a.oe_project_kanban_action .oe_i {
color: #4c4c4c;
}
.square {
display: inline-block;
width: 18px;
height: 18px;
border:1px solid grey;
}
.oe_kanban_color_0 {
background: white;
}
@ -136,85 +150,97 @@ a.oe_project_kanban_action {
}
.open {
display: block;
}
.open .dropdown-menu {
display: block; }
display: block;
}
.open .dropdown-menu {
display: block;
}
a.oe_project_kanban_action {
position: absolute;
right: 0;
}
a.oe_project_kanban_action:hover {
position: absolute;
right: 0;
}
a.oe_project_kanban_action:hover {
text-decoration: none;
}
a.oe_project_kanban_action .eo_i {
color: #4c4c4c; }
}
a.oe_project_kanban_action .eo_i {
color: #4c4c4c;
}
.oe_project_kanban_vignette {
position: relative;
min-height: 50px;
/*background: white;*/
border: 1px solid #d8d8d8;
border-bottom-color: #b9b9b9;
padding: 6px;
margin: 6px 0;
display: inline-block;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
position: relative;
min-height: 50px;
/*background: white;*/
border: 1px solid #d8d8d8;
border-bottom-color: #b9b9b9;
padding: 6px;
margin: 6px 0;
display: inline-block;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.oe_project_kanban_vignette:last-child {
margin-bottom: 0; }
.oe_project_kanban_vignette:hover {
.oe_project_kanban_vignette:last-child {
margin-bottom: 0;
}
.oe_project_kanban_vignette:hover {
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); }
.oe_project_kanban_vignette h4 {
margin: 0 0 2px; }
-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}
.oe_project_kanban_vignette h4 {
margin: 0 0 2px;
}
.oe_project_kanban_vignette .dropdown-menu {
top: 30px;
right: -140px;
padding: 4px;
border: 1px solid #afafb6;
width: 160px;
overflow-x: hidden;
z-index: 900;
background: white;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.oe_project_kanban_vignette .dropdown-menu p {
margin-left: 12px; }
.oe_project_kanban_vignette .dropdown-menu li {
top: 30px;
right: -140px;
padding: 4px;
border: 1px solid #afafb6;
width: 160px;
overflow-x: hidden;
z-index: 900;
background: white;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.oe_project_kanban_vignette .dropdown-menu p {
margin-left: 12px;
}
.oe_project_kanban_vignette .dropdown-menu li {
float: none;
display: block;
background-color: none; }
.oe_project_kanban_vignette .dropdown-menu li a {
display: block;
padding: 3px 6px;
clear: both;
font-weight: normal;
line-height: 14px;
color: #4c4c4c;
text-decoration: none; }
.oe_project_kanban_vignette .dropdown-menu li a:hover {
background: #f0f0fa;
background: -moz-linear-gradient(#f0f0fa, #eeeef6);
background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6));
background: -webkit-linear-gradient(#f0f0fa, #eeeef6);
-moz-box-shadow: none;
-webkit-box-shadow: none;
-box-shadow: none; }
background-color: none;
}
.oe_project_kanban_vignette .dropdown-menu li a {
display: block;
padding: 3px 6px;
clear: both;
font-weight: normal;
line-height: 14px;
color: #4c4c4c;
text-decoration: none;
}
.oe_project_kanban_vignette .dropdown-menu li a:hover {
background: #f0f0fa;
background: -moz-linear-gradient(#f0f0fa, #eeeef6);
background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6));
background: -webkit-linear-gradient(#f0f0fa, #eeeef6);
-moz-box-shadow: none;
-webkit-box-shadow: none;
-box-shadow: none;
}
.oe_project_kanban_vignette .dropdown-menu .color-chooser {
padding: 0 3px; }
.oe_project_kanban_vignette .dropdown-menu .color-chooser li {
float: left; }
.oe_project_kanban_vignette .dropdown-menu .color-chooser li a {
padding: 2px; }
padding: 0 3px;
}
.oe_project_kanban_vignette .dropdown-menu .color-chooser li {
float: left;
}
.oe_project_kanban_vignette .dropdown-menu .color-chooser li a {
padding: 2px;
}

View File

@ -3,31 +3,30 @@ openerp.project = function(openerp) {
bind_events: function() {
var self = this;
self._super();
if(this.view.dataset.model == 'project.project') {
if (this.view.dataset.model == 'project.project') {
/*set avatar title for members.
In many2many fields, returns only list of ids.
we can implement return value of m2m fields like [(1,"Adminstration"),...].
*/
_.each($(this.$element).find('.project_avatar'),function(avatar){
_.each($(this.$element).find('.project_avatar'), function(avatar) {
var dataset = new openerp.web.DataSetSearch(this, 'res.users', self.session.context, [['id','=',avatar.id]]);
dataset.read_slice(['name']).then(function(result){
avatar.setAttribute("title",result[0].name)
dataset.read_slice(['name']).then(function(result) {
avatar.setAttribute("title",result[0].name);
});
});
});
// set sequence like Tasks,Issues,Timesheets and Phases
var my_list = $("#list a")
var my_list = $("#list a");
my_list.sort(function (a, b) {
var aValue = parseInt(a.id);
var bValue = parseInt(b.id);
var aValue = parseInt(a.id, 10);
var bValue = parseInt(b.id, 10);
return aValue == bValue ? 0 : aValue < bValue ? -1 : 1;
});
});
$('#list').replaceWith(my_list);
// when vignette is clicked, it opens the first action in sequence
if (my_list.length != 0) {
var click_button = $(this.$element).find('.click_button')
if (my_list.length !== 0) {
var click_button = $(this.$element).find('.click_button');
click_button.attr('data-name', my_list[0].getAttribute('data-name'));
click_button.attr('data-type', "action");
}
@ -36,13 +35,13 @@ openerp.project = function(openerp) {
we can do other way to implement new widget.
because we need to rpc call for that.
*/
this.$element.find('.bgcolor').click(function(){
var color = parseInt($(this).find('span').attr('class').split(' ')[0].substring(16))
var color_class = $(this).find('span').attr('class').split(' ')[0]
this.$element.find('.bgcolor').click(function() {
var color = parseInt($(this).find('span').attr('class').split(' ')[0].substring(16), 10);
var color_class = $(this).find('span').attr('class').split(' ')[0];
$(this).closest('#oe_project_kanban_vignette').removeClass().addClass(color_class + ' oe_project_kanban_vignette');
self.view.dataset.write(parseInt(this.id), {color:color});
self.view.dataset.write(parseInt(this.id, 10), {color:color});
});
}
}
});
}
};