Activity stream: show detail will not be displayed if the selected activity cannot be found- this shouldn't happe, but just in case. Viewing detail no longer users an API call. Instead it retrieves the record from memory. It might be possible for this to break if the user clicks browser refresh. Inventory refactor: fixed drag-n-drop so that an object cannot be dropped onto two groups at the same time.

This commit is contained in:
chris Houseknecht 2014-01-17 13:02:46 -05:00
parent d3149bc8ef
commit aec5a2ba73
3 changed files with 39 additions and 36 deletions

View File

@ -178,40 +178,42 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
var generator = GenerateForm;
var form = ActivityDetailForm;
var activity = Find({list: parent_scope.activities, key: 'id', val: activity_id });
// Setup changes field
activity['changes'] = JSON.stringify(activity['changes'], null, '\t');
var n = activity['changes'].match(/\n/g);
var rows = (n) ? n.length : 1;
rows = (rows < 1) ? 3 : 10;
form.fields['changes'].rows = 10;
// Load the form
var scope = generator.inject(form, { mode: 'edit', modal: true, related: false });
scope['changes'] = activity['changes'];
scope['user'] = ( (activity.summary_fields.actor) ? activity.summary_fields.actor.username : 'system' ) +
' on ' + FormatDate(new Date(activity['timestamp']));
scope['operation'] = activity['description_nolink'];
scope.formModalAction = function() {
$('#form-modal').modal("hide");
}
$('#form-modal').on('show.bs.modal', function (e) {
$('#form-modal-body').css({
width:'auto', //probably not needed
height:'auto', //probably not needed
'max-height':'100%'
});
});
scope.formModalActionLabel = 'OK';
scope.formModalCancelShow = false;
scope.formModalInfo = false;
scope.formModalHeader = "Event " + activity.id;
if (!scope.$$phase) {
scope.$digest();
if (activity) {
// Setup changes field
activity['changes'] = JSON.stringify(activity['changes'], null, '\t');
var n = activity['changes'].match(/\n/g);
var rows = (n) ? n.length : 1;
rows = (rows < 1) ? 3 : 10;
form.fields['changes'].rows = 10;
// Load the form
var scope = generator.inject(form, { mode: 'edit', modal: true, related: false });
scope['changes'] = activity['changes'];
scope['user'] = ( (activity.summary_fields.actor) ? activity.summary_fields.actor.username : 'system' ) +
' on ' + FormatDate(new Date(activity['timestamp']));
scope['operation'] = activity['description_nolink'];
scope.formModalAction = function() {
$('#form-modal').modal("hide");
}
$('#form-modal').on('show.bs.modal', function (e) {
$('#form-modal-body').css({
width:'auto', //probably not needed
height:'auto', //probably not needed
'max-height':'100%'
});
});
scope.formModalActionLabel = 'OK';
scope.formModalCancelShow = false;
scope.formModalInfo = false;
scope.formModalHeader = "Event " + activity.id;
if (!scope.$$phase) {
scope.$digest();
}
}
}

View File

@ -1078,7 +1078,7 @@ input[type="checkbox"].checkbox-no-label {
.droppable-hover {
background-color: @info;
color: @info-color;
padding: 5px;
padding: 6px;
border: 1px solid @info-border;
border-radius: 4px;
}

View File

@ -534,7 +534,8 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService'])
start: function(e, ui) {
ui.helper.addClass('draggable-clone');
},
zIndex: 100
zIndex: 100,
cursorAt: { left: -1 }
});
}
@ -607,7 +608,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService'])
scope.$emit('CopyMoveHost', $(this).attr('data-tree-id'), ui.draggable.attr('data-host-id'));
}
},
tolerance: 'touch'
tolerance: 'pointer'
});
}