fix hardcoded static path in angularjs

use $windowProvider.$get().STATIC_URL to get correct the static path
use $window.WEBROOT to get correct webroot

Change-Id: I06a764f231c9f7042ef7be0867df705ceb9d0278
This commit is contained in:
Shengjing Zhu 2016-07-20 18:44:55 +08:00 committed by Shengjing Zhu
parent 113209883e
commit bbd5bed33c
2 changed files with 7 additions and 5 deletions

View File

@ -8,10 +8,11 @@
CloudkittyStepController.$inject = [
'$scope',
'horizon.framework.widgets.wizard.events',
'$http'
'$http',
'$window'
];
function CloudkittyStepController($scope, wizardEvents, $http) {
function CloudkittyStepController($scope, wizardEvents, $http, $window) {
var onSwitch = $scope.$on(wizardEvents.ON_SWITCH, function(evt, args) {
@ -35,7 +36,7 @@
var form_data = [{"service": "compute", "desc": desc_form, "volume": $scope.model.newInstanceSpec.instance_count}];
$http.post('/dashboard/project/rating/quote', form_data).then(function(res, status) {
$http.post($window.WEBROOT + 'project/rating/quote', form_data).then(function(res, status) {
$scope.price = res.data;
});
});

View File

@ -12,10 +12,11 @@
$provide.decorator("horizon.dashboard.project.workflow.launch-instance.workflow", ['$delegate', function ($delegate) {
var workflow = $delegate;
var static_path = $windowProvider.$get().STATIC_URL;
workflow.append({
formName: 'CloudkittyForm',
templateUrl: '/dashboard/static/cloudkitty/templates/cloudkitty-step.html',
helpUrl: '/dashboard/static/cloudkitty/templates/cloudkitty-help.html',
templateUrl: static_path + 'cloudkitty/templates/cloudkitty-step.html',
helpUrl: static_path + 'cloudkitty/templates/cloudkitty-help.html',
title: 'Price'
});
return workflow;