Finish up UI

- CSS
- Popup sizing & formatting
- diff resize when popup resizes
This commit is contained in:
nathangray 2019-02-28 15:15:26 -07:00
parent d4f614e3af
commit b7934f699c
4 changed files with 23 additions and 6 deletions

View File

@ -82,7 +82,7 @@ var et2_diff = (function(){ "use strict"; return et2_valueWidget.extend([et2_IDe
jQuery('<span class="ui-icon ui-icon-circle-plus">&nbsp;</span>') jQuery('<span class="ui-icon ui-icon-circle-plus">&nbsp;</span>')
.appendTo(self.div) .appendTo(self.div)
.css("cursor", "pointer") .css("cursor", "pointer")
.click({diff: view, div: self.div}, function(e) { .click({diff: view, div: self.div, label: self.options.label}, function(e) {
var diff = e.data.diff; var diff = e.data.diff;
var div = e.data.div; var div = e.data.div;
self.un_minify(diff); self.un_minify(diff);
@ -90,11 +90,18 @@ var et2_diff = (function(){ "use strict"; return et2_valueWidget.extend([et2_IDe
.append(diff); .append(diff);
dialog_div.dialog({ dialog_div.dialog({
title: self.options.label, title: e.data.label,
width: 'auto', width: 'auto',
autoResize: true, autoResize: true,
modal: true, modal: true,
buttons: [{text: self.egw().lang('ok'), click: function() {jQuery(this).dialog("close");}}], buttons: [{text: self.egw().lang('ok'), click: function() {jQuery(this).dialog("close");}}],
open: function() {
if(jQuery(this).parent().height() > jQuery(window).height())
{
jQuery(this).height(jQuery(window).height() *0.7);
}
jQuery(this).dialog({position: "center"});
},
close: function(event, ui) { close: function(event, ui) {
// Need to destroy the dialog, etemplate widget needs divs back where they were // Need to destroy the dialog, etemplate widget needs divs back where they were
dialog_div.dialog("destroy"); dialog_div.dialog("destroy");

View File

@ -473,7 +473,9 @@ var et2_historylog = (function(){ "use strict"; return et2_valueWidget.extend([e
widget = undefined; widget = undefined;
value = _data['share_email']; value = _data['share_email'];
} }
if(typeof widget == 'undefined' && typeof self.fields[_data.status] != 'undefined') // Get widget from list, unless it needs a diff widget
if(typeof widget == 'undefined' && typeof self.fields[_data.status] != 'undefined' && i < self.NEW_VALUE ||
i >= self.NEW_VALUE &&!self._needsDiffWidget(_data['status'], _data[self.columns[self.OLD_VALUE].id]))
{ {
widget = self.fields[_data.status].widget; widget = self.fields[_data.status].widget;
if(!widget._children.length) if(!widget._children.length)
@ -586,6 +588,12 @@ var et2_historylog = (function(){ "use strict"; return et2_valueWidget.extend([e
this.div.trigger('resize.' +this.options.value.app + this.options.value.id); this.div.trigger('resize.' +this.options.value.app + this.options.value.id);
} }
} }
// Resize diff widgets to match new space
if(this.dataview)
{
var columns = this.dataview.getColumnMgr().columnWidths;
jQuery('.diff', this.div).parent().width(columns[this.NEW_VALUE] + columns[this.OLD_VALUE]);
}
} }
});}).call(this); });}).call(this);
et2_register_widget(et2_historylog, ['historylog']); et2_register_widget(et2_historylog, ['historylog']);

View File

@ -18,7 +18,6 @@ use EGroupware\Api;
// explicitly reference classes still in phpgwapi or otherwise outside api // explicitly reference classes still in phpgwapi or otherwise outside api
use notifications; use notifications;
use Text_Diff_Renderer_unified;
/** /**
* Abstract base class for trackering: * Abstract base class for trackering:
@ -463,8 +462,8 @@ abstract class Tracking
strpos($data[$name], PHP_EOL) !== FALSE || strpos($old[$name], PHP_EOL) !== FALSE)) strpos($data[$name], PHP_EOL) !== FALSE || strpos($old[$name], PHP_EOL) !== FALSE))
{ {
// Multiline string, just store diff // Multiline string, just store diff
$diff = new \Text_Diff('auto', array(explode("\n",$old[$name]), explode("\n",$data[$name]))); $diff = new \Horde_Text_Diff('auto', array(explode("\n",$old[$name]), explode("\n",$data[$name])));
$renderer = new \Text_Diff_Renderer_unified(); $renderer = new \Horde_Text_Diff_Renderer_Unified();
$this->historylog->add( $this->historylog->add(
$status, $status,
$data[$this->id_field], $data[$this->id_field],

View File

@ -585,6 +585,9 @@ div.diff {
.diff .d2h-file-diff { .diff .d2h-file-diff {
overflow-x: hidden; overflow-x: hidden;
} }
.ui-widget-content .d2h-code-line-ctn {
white-space:normal;
}
.ui-widget-content .d2h-file-diff { .ui-widget-content .d2h-file-diff {
overflow-x: visible; overflow-x: visible;
overflow-y: visible; overflow-y: visible;