* Etemplate/historylog: Make history log resizable, base on popup window resize

This commit is contained in:
Hadi Nategh 2015-05-13 15:39:40 +00:00
parent d469a15ab1
commit a7459e57b4
6 changed files with 37 additions and 10 deletions

View File

@ -341,7 +341,7 @@
</box>
</template>
<template id="addressbook.edit.history" template="" lang="" group="0" version="1.9.001">
<historylog id="history" width="100%" overflow="hidden"/>
<historylog id="history" width="100%"/>
</template>
<template id="addressbook.edit" template="" lang="" group="0" version="1.9.004" class="addressbook_edit">
<template id="addressbook.editname"/>
@ -395,7 +395,7 @@
<description/>
</row>
<row>
<tabbox id="tabs" span="all" width="100%" tab_height="200">
<tabbox id="tabs" span="all" width="100%" tab_height="250">
<tabs>
<tab id="general" label="Organisation"/>
<tab id="home" label="Private" statustext="Home address, Birthday, ..."/>

View File

@ -241,7 +241,7 @@
</grid>
</template>
<template id="calendar.edit.history" template="" lang="" group="0" version="1.7.002">
<historylog id="history" options="history_status" width="100%" overflow="hidden"/>
<historylog id="history" options="history_status" width="100%" />
</template>
<template id="calendar.delete_series" template="" lang="" group="0" version="1.7.003">
<vbox>

View File

@ -1268,9 +1268,6 @@ div.calendar {
background-color: rgba(255, 221, 115, 0.1);
margin-bottom: 1em;
}
#calendar-edit #calendar-edit_calendar-edit-history {
max-width: 800px;
}
#calendar-edit #calendar-edit_calendar-edit-history tbody {
display: table-row-group;
width: 100%;

View File

@ -680,7 +680,6 @@ div.calendar { position: relative; }
/*// Historie*/
#calendar-edit_calendar-edit-history{
max-width: 800px;
tbody{
display: table-row-group;
width: 100%;

View File

@ -31,7 +31,7 @@
*
* @augments et2_valueWidget
*/
var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
var et2_historylog = et2_valueWidget.extend([et2_IDataProvider,et2_IResizeable],
{
createNamespace: true,
attributes: {
@ -96,6 +96,15 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
// Bind the action to when the tab is selected
var handler = function(e) {
e.data.div.unbind("click.history");
// Bind on click tap, because we need to update history size
// after a rezise happend and history log was not the active tab
e.data.div.bind("click.history",{"history": e.data.history, div: tabs.tabData[i].flagDiv}, function(e){
e.data.history.dynheight.update(function(_w, _h)
{
e.data.history.dataview.resize(_w, _h);
});
});
e.data.history.finishInit();
e.data.history.dynheight.update(function(_w, _h) {
e.data.history.dataview.resize(_w, _h);
@ -546,5 +555,27 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
}
return columnName == 'note' || columnName == 'description' || (value && (value.length > 50 || value.match(/\n/g)));
},
resize: function (_height)
{
if (typeof this.options != 'undefined' && _height
&& typeof this.options.resize_ratio != 'undefined')
{
// apply the ratio
_height = (this.options.resize_ratio != '')? _height * this.options.resize_ratio: _height;
if (_height != 0)
{
// 250px is the default value for history widget
// if it's not loaded yet and window is resized
// then add the default height with excess_height
if (this.div.height() == 0) _height += 250;
this.div.height(this.div.height() + _height);
// trigger the history registered resize
// in order to update the height with new value
this.div.trigger('resize.' +this.options.value.app + this.options.value.id);
}
}
}
});
et2_register_widget(et2_historylog, ['historylog']);

View File

@ -83,7 +83,7 @@
</grid>
</template>
<template id="infolog.edit.history" template="" lang="" group="0" version="1.3.002">
<historylog id="history" width="100%" overflow="hidden"/>
<historylog id="history" width="100%"/>
</template>
<template id="infolog.edit.details" template="" lang="" group="0" version="1.9.001">
<grid width="100%">
@ -214,7 +214,7 @@
<description/>
</row>
<row>
<tabbox id="tabs" class="et2_nowrap" span="all" width="100%" tab_height="246px">
<tabbox id="tabs" class="et2_nowrap" span="all" width="100%" tab_height="250px">
<tabs>
<tab id="description" label="Description" statustext="longer textual description"/>
<tab id="details" label="Details" statustext="Location, priority , ..."/>