[IMP]:improved code.

bzr revid: apa@tinyerp.com-20120427062725-0lpfbxs0xkdmm7zf
This commit is contained in:
Amit Patel (OpenERP) 2012-04-27 11:57:25 +05:30
parent 7f1995e5c0
commit f8e076e9a4
5 changed files with 31 additions and 32 deletions

View File

@ -198,11 +198,9 @@
</ul>
<h4><t t-esc="record.name.value.substr(0,33)"/><t t-if="record.name.value.length > 33">...</t></h4>
<div id="list">
<a id="1">
<t t-if="record.task.raw_value">
<button name="open_tasks" id = "open_tasks" class="oe_project_buttons" type="object"><t t-if="record.open_task.value &lt;= 1"> Task</t><t t-if="record.open_task.value &gt; 1"> Tasks</t>(<t t-esc="record.open_task.value"/>)</button>
</t>
</a>
<t t-if="record.task.raw_value">
<a id="1" name="open_tasks" class="oe_project_buttons" type="object"><t t-if="record.open_task.value &lt;= 1"> Task</t><t t-if="record.open_task.value &gt; 1"> Tasks</t>(<t t-esc="record.open_task.value"/>)</a>
</t>
</div>
<br/>
<button class="click_button" type="object">
@ -229,6 +227,17 @@
</button>
</li>
</div>
<script type="text/javascript">
//open dropdwon when click on the icon.
$('.dropdown-toggle').dropdown();
//show and hide the dropdown icon when mouseover and mouseour.
$('.oe_project_kanban_vignette').mouseover(function() {
return $(this).find('.oe_project_kanban_action').show();
}).mouseout(function() {
return $(this).find('.oe_project_kanban_action').hide();
});
</script>
</t>
</templates>
</kanban>

View File

@ -4,17 +4,11 @@ openerp.project = function(openerp) {
self = this;
self._super();
if(this.view.dataset.model == 'project.project') {
//open dropdwon when click on the icon.
$('.dropdown-toggle').dropdown();
//show and hide the dropdown icon when mouseover and mouseour.
$('.oe_project_kanban_vignette').mouseover(function() {
return $(this).find('.oe_project_kanban_action').show();
}).mouseout(function() {
return $(this).find('.oe_project_kanban_action').hide();
});
//set avatar title for members.
/*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){
var dataset = new openerp.web.DataSetSearch(this, 'res.users', self.session.context, [['id','=',avatar.id]]);
dataset.read_slice(['name']).then(function(result){
@ -35,7 +29,9 @@ openerp.project = function(openerp) {
});
$('#list').replaceWith(my_list);
// set background color
/* set background color.
we can do other way to implement new widget.
*/
this.$element.find('.bgcolor').click(function(){
color = parseInt($(this).find('span').attr('class').split(' ')[0].substring(16))
color_class = $(this).find('span').attr('class').split(' ')[0]

View File

@ -366,11 +366,9 @@
<field name="total_issues" invisible="1"/>
</field>
<xpath expr="//div[@id='list']" position="inside">
<a id="2">
<t t-if="record.issues.raw_value">
<button name="open_issues" class="oe_project_buttons" type="object"><t t-if="record.total_issues.value &lt;= 1"> Issue</t><t t-if="record.total_issues.value > 1"> Issues</t>(<t t-esc="record.total_issues.value"/>)</button>
</t>
</a>
<t t-if="record.issues.raw_value">
<a id="2" name="open_issues" class="oe_project_buttons" type="object"><t t-if="record.total_issues.value &lt;= 1">Issue</t><t t-if="record.total_issues.value > 1">Issues</t>(<t t-esc="record.total_issues.value"/>)</a>
</t>
</xpath>
</field>
</record>

View File

@ -121,11 +121,9 @@
<field name="open_phases"/>
</field>
<xpath expr="//div[@id='list']" position="inside">
<a id="4">
<t t-if="record.phases.raw_value">
<button name="open_phase" class="oe_project_buttons" type="object"><t t-if="record.open_phases.value &lt;= 1"> Phase</t><t t-if="record.open_phases.value > 1"> Phases</t>(<t t-esc="record.open_phases.value"/>)</button>
</t>
</a>
<t t-if="record.phases.raw_value">
<a id="4" name="open_phase" class="oe_project_buttons" type="object"><t t-if="record.open_phases.value &lt;= 1">Phase</t><t t-if="record.open_phases.value > 1">Phases</t>(<t t-esc="record.open_phases.value"/>)</a>
</t>
</xpath>
</field>
</record>

View File

@ -37,11 +37,9 @@
<field name="currency_id"/>
</field>
<xpath expr="//div[@id='list']" position="inside">
<a id="3">
<t t-if="record.timesheets.raw_value">
<button name="open_timesheets" class="oe_project_buttons" type="object"><t t-if="record.total_timesheet.value &lt;= 1"> Timesheet</t><t t-if="record.total_timesheet.value &gt; 1"> Timesheets</t>(<t t-esc="record.total_timesheet.value"/>)</button>
</t>
</a>
<t t-if="record.timesheets.raw_value">
<a id="3" name="open_timesheets" class="oe_project_buttons" type="object"><t t-if="record.total_timesheet.value &lt;= 1">Timesheet</t><t t-if="record.total_timesheet.value &gt; 1">Timesheets</t>(<t t-esc="record.total_timesheet.value"/>)</a>
</t>
</xpath>
<xpath expr="//tr[@id='deadline']" position="before">