Correct bug
This commit is contained in:
parent
4bac080418
commit
c5f4a11b12
3 changed files with 12 additions and 9 deletions
|
@ -9,15 +9,18 @@ mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', '
|
||||||
$scope.image = image;
|
$scope.image = image;
|
||||||
$scope.data = {};
|
$scope.data = {};
|
||||||
$scope.data.id = image.id;
|
$scope.data.id = image.id;
|
||||||
|
if (image.protected) {
|
||||||
|
$scope.data.protected = "true";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$scope.data.protected = "false";
|
||||||
|
}
|
||||||
$scope.data.name = image.name;
|
$scope.data.name = image.name;
|
||||||
$scope.data.visibility = image.visibility;
|
$scope.data.visibility = image.visibility;
|
||||||
$scope.data.protected = image.protected;
|
|
||||||
|
|
||||||
$scope.axioms = axioms;
|
$scope.axioms = axioms;
|
||||||
$('#editImageModal').modal('show');
|
$('#editImageModal').modal('show');
|
||||||
});
|
});
|
||||||
$scope.data = {};
|
|
||||||
|
|
||||||
$scope.applyEdition = function (id) {
|
$scope.applyEdition = function (id) {
|
||||||
Image.updateImage($scope.data, function () {
|
Image.updateImage($scope.data, function () {
|
||||||
|
|
|
@ -5,7 +5,7 @@ mainApp.factory('Image', ['$http', 'Identity', function ($http, Identity) {
|
||||||
var data = {};
|
var data = {};
|
||||||
data.images = null; // Images
|
data.images = null; // Images
|
||||||
data.axioms = {};
|
data.axioms = {};
|
||||||
data.axioms.protected = [true, false];
|
data.axioms.protected = ["false", "true"];
|
||||||
data.axioms.visibility = ["public", "private"];
|
data.axioms.visibility = ["public", "private"];
|
||||||
/**
|
/**
|
||||||
* Parse uploadImage anwser
|
* Parse uploadImage anwser
|
||||||
|
|
|
@ -16,20 +16,20 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-sm-2">Name</label>
|
<label class="control-label col-sm-2">Name</label>
|
||||||
<div class="col-sm-20">
|
<div class="col-sm-20">
|
||||||
<input type="text" ng-model="data.name" value="{{ image.name}}"/>
|
<input type="text" ng-model="data.name" value="{{ data.name}}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
<label class="control-label col-sm-2">Visibility</label>
|
<label class="control-label col-sm-2">Visibility</label>
|
||||||
<select class="col-sm-20" id="visibilitySelected" ng-model="data.visibility">
|
<select class="col-sm-20" ng-model="data.visibility">
|
||||||
<option ng-repeat="visibility in axioms.visibility" ng-selected="image.visibility == visibility">{{ visibility}}</option>
|
<option ng-repeat="visibility in axioms.visibility" ng-selected="data.visibility == visibility">{{ visibility}}</option>
|
||||||
</select>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
<label class="control-label col-sm-2">Protected</label>
|
<label class="control-label col-sm-2">Protected</label>
|
||||||
<select class="col-sm-20" id="protectedSelected" ng-model="data.protected">
|
<select class="col-sm-20" ng-model="data.protected">
|
||||||
<option ng-repeat="protected in axioms.protected" ng-selected="image.protected == protected">{{ protected}}</option>
|
<option ng-repeat="protect in axioms.protected" ng-selected="data.protected == protect">{{ protect }}</option>
|
||||||
</select>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
<input type="hidden" name="token" value="{{ getToken()}}" />
|
<input type="hidden" name="token" value="{{ getToken()}}" />
|
||||||
<input type="hidden" name="action" value="uploadImage" />
|
<input type="hidden" name="action" value="uploadImage" />
|
||||||
|
|
||||||
<input type="hidden" name="id" value="{{ image.id}}" />
|
<input type="hidden" name="id" value="{{ data.id}}" />
|
||||||
<input type="hidden" name="file_name" value="cirros-0.3.4-x86_64-disk.img" />
|
<input type="hidden" name="file_name" value="cirros-0.3.4-x86_64-disk.img" />
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
<label class="control-label col-sm-2">Upload</label>
|
<label class="control-label col-sm-2">Upload</label>
|
||||||
|
|
Loading…
Add table
Reference in a new issue