Implement priority on client side in hidden input

This commit is contained in:
Robin McCorkell 2015-03-12 16:27:31 +00:00 committed by Vincent Petry
parent ce94a998dd
commit 680ec056dc
2 changed files with 15 additions and 0 deletions

View file

@ -332,6 +332,13 @@ GlobalStorageConfig.prototype = _.extend({}, StorageConfig.prototype,
*/
applicableGroups: null,
/**
* Storage priority
*
* @type int
*/
priority: null,
/**
* Returns the data from this object
*
@ -342,6 +349,7 @@ GlobalStorageConfig.prototype = _.extend({}, StorageConfig.prototype,
return _.extend(data, {
applicableUsers: this.applicableUsers,
applicableGroups: this.applicableGroups,
priority: this.priority,
});
}
});
@ -546,6 +554,8 @@ MountConfigListView.prototype = {
highlightInput(newElement);
$td.append(newElement);
});
var priorityEl = $('<input type="hidden" class="priority" value="' + parameters['priority'] + '" />');
$tr.append(priorityEl);
if (parameters['custom'] && $el.find('tbody tr.'+backendClass.replace(/\\/g, '\\\\')).length === 1) {
OC.addScript('files_external', parameters['custom']);
}
@ -627,6 +637,8 @@ MountConfigListView.prototype = {
storage.applicableUsers = users;
storage.applicableGroups = groups;
storage.priority = $tr.find('input.priority').val();
}
return storage;

View file

@ -90,6 +90,9 @@
print_unescaped(json_encode($mount['applicable']['users'])); ?>'>
<input type="hidden" class="applicableUsers" style="width:20em;" value=""/>
</td>
<?php if (isset($mount['priority'])): ?>
<input type="hidden" class="priority" value="<?php p($mount['priority']) ?>" />
<?php endif; ?>
<?php endif; ?>
<td <?php if (isset($mount['mountpoint'])): ?>class="remove"
<?php else: ?>style="visibility:hidden;"