Merge branch 'temp8-3298-move-rollback' of https://github.com/umbraco/Umbraco-CMS into temp8-3298-move-rollback

This commit is contained in:
Warren Buckley
2018-10-17 15:10:06 +01:00
3 changed files with 41 additions and 3 deletions

View File

@@ -840,9 +840,42 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
),
"Failed to get rollback versions for content item with id " + contentId
);
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getRollbackVersion
* @methodOf umbraco.resources.contentResource
*
* @description
* Returns a previous version of a content item
*
* ##usage
* <pre>
* contentResource.getRollbackVersion(versionId)
* .then(function(version) {
* alert('its here!');
* });
* </pre>
*
* @param {Int} versionId The version Id
* @returns {Promise} resourcePromise object containing the url.
*
*/
getRollbackVersion: function (versionId) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl("contentApiBaseUrl", "GetRollbackVersion", {
versionId: versionId
})
),
"Failed to get version for content item with id " + versionId
);
}
};
}

View File

@@ -6,7 +6,6 @@
var vm = this;
vm.rollback = rollback;
vm.loadVersion = loadVersion;
vm.changeLanguage = changeLanguage;
vm.changeVersion = changeVersion;
vm.submit = submit;
@@ -64,6 +63,12 @@
function changeVersion(version) {
console.log("version", version);
contentResource.getRollbackVersion(version.versionId)
.then(function(data){
console.log(data);
//createDiff(vm.currentVersion, data);
});
}
function getVersions() {
@@ -85,7 +90,7 @@
/**
* This will load in a new version
*/
function loadVersion(id) {
function createDiff(currentVersion, previousVersion) {
// fake load version

View File

@@ -40,7 +40,7 @@
class="input-block-level"
ng-model="vm.selectedVersion"
ng-options="version.versionDate for version in vm.previousVersions track by version.versionId"
ng-change="vm.changeVersion(vm.selectedVersion.id)">
ng-change="vm.changeVersion(vm.selectedVersion)">
<option value=""><localize key="general_choose">Choose</localize>...</option>
</select>
</div>