Moved content provide view into the new workflow
diff --git a/xos/core/xoslib/dashboards/contentProvider.html b/xos/core/xoslib/dashboards/contentProvider.html
deleted file mode 100644
index 58d559a..0000000
--- a/xos/core/xoslib/dashboards/contentProvider.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!-- 
-To setup hpc:
-- cd /opt/xos/tosca
-- python ./run.py padmin@vicci.org samples/cdn.yaml
-
-To generate hpcapi:
-- cd /opt/xos
-- python apigen/modelgen apigen/hpc-api.template.py -n User -n Service -a hpc > xos/hpcapi.py
- -->
-
-<div ng-app="xos.contentProviderApp">
-  <ng-view></ng-view>
-</div>
-
-<link rel="stylesheet" href="{{ STATIC_URL }}/css/xosLib.css">
-<script src="{{ STATIC_URL }}js/vendor/xosNgVendor.js"></script>
-<script src="{{ STATIC_URL }}js/xosContentProvider.js"></script>
diff --git a/xos/core/xoslib/dashboards/xosContentProvider.html b/xos/core/xoslib/dashboards/xosContentProvider.html
new file mode 100644
index 0000000..9439fef
--- /dev/null
+++ b/xos/core/xoslib/dashboards/xosContentProvider.html
@@ -0,0 +1,7 @@
+<div ng-app="xos.contentProvider">
+  <ng-view></ng-view>
+</div>
+
+<link rel="stylesheet" href="{{ STATIC_URL }}/css/xosLib.css">
+<script src="{{ STATIC_URL }}js/vendor/xosContentProviderVendor.js"></script>
+<script src="{{ STATIC_URL }}js/xosContentProvider.js"></script>
\ No newline at end of file
diff --git a/xos/core/xoslib/xos-builder/.bowerrc b/xos/core/xoslib/ngXosViews/contentProvider/.bowerrc
similarity index 100%
rename from xos/core/xoslib/xos-builder/.bowerrc
rename to xos/core/xoslib/ngXosViews/contentProvider/.bowerrc
diff --git a/xos/core/xoslib/xos-builder/.gitignore b/xos/core/xoslib/ngXosViews/contentProvider/.gitignore
similarity index 88%
rename from xos/core/xoslib/xos-builder/.gitignore
rename to xos/core/xoslib/ngXosViews/contentProvider/.gitignore
index bccda71..567aee4 100644
--- a/xos/core/xoslib/xos-builder/.gitignore
+++ b/xos/core/xoslib/ngXosViews/contentProvider/.gitignore
@@ -2,4 +2,5 @@
 src/vendor
 .tmp
 node_modules
-npm-debug.log
\ No newline at end of file
+npm-debug.log
+dist/
\ No newline at end of file
diff --git a/xos/core/xoslib/xos-builder/bower.json b/xos/core/xoslib/ngXosViews/contentProvider/bower.json
similarity index 74%
rename from xos/core/xoslib/xos-builder/bower.json
rename to xos/core/xoslib/ngXosViews/contentProvider/bower.json
index 9bbcec4..516533c 100644
--- a/xos/core/xoslib/xos-builder/bower.json
+++ b/xos/core/xoslib/ngXosViews/contentProvider/bower.json
@@ -1,11 +1,10 @@
 {
-  "name": "xos.contentProviderApp",
+  "name": "xos-contentProvider",
   "version": "0.0.0",
-  "homepage": "https://github.com/teone/xos",
   "authors": [
     "Matteo Scandolo <matteo.scandolo@link-me.it>"
   ],
-  "description": "The content provider view",
+  "description": "The contentProvider view",
   "license": "MIT",
   "ignore": [
     "**/.*",
@@ -16,13 +15,13 @@
     "tests"
   ],
   "dependencies": {
+  },
+  "devDependencies": {
     "angular": "~1.4.7",
     "angular-route": "~1.4.7",
     "angular-cookies": "~1.4.7",
     "angular-resource": "~1.4.7",
-    "ng-lodash": "~0.3.0"
-  },
-  "devDependencies": {
+    "ng-lodash": "~0.3.0",
     "bootstrap-css": "2.3.2"
   }
 }
diff --git a/xos/core/xoslib/xos-builder/gulp/build.js b/xos/core/xoslib/ngXosViews/contentProvider/gulp/build.js
similarity index 69%
rename from xos/core/xoslib/xos-builder/gulp/build.js
rename to xos/core/xoslib/ngXosViews/contentProvider/gulp/build.js
index 40136c8..238001d 100644
--- a/xos/core/xoslib/xos-builder/gulp/build.js
+++ b/xos/core/xoslib/ngXosViews/contentProvider/gulp/build.js
@@ -9,7 +9,7 @@
 // The template are parsed and added to js with angular $templateCache
 
 var gulp = require('gulp');
-var ngmin = require('gulp-ngmin');
+var ngAnnotate = require('gulp-ng-annotate');
 var uglify = require('gulp-uglify');
 var templateCache = require('gulp-angular-templatecache');
 var runSequence = require('run-sequence');
@@ -19,8 +19,7 @@
 var wiredep = require('wiredep');
 var babel = require('gulp-babel');
 var angularFilesort = require('gulp-angular-filesort');
-
-var TEMPLATE_HEADER = '/*This code is autogenerated from the templates files */ angular.module("<%= module %>"<%= standalone %>).run(["$templateCache", function($templateCache) {';
+var _ = require('lodash');
 
 module.exports = function(options){
   
@@ -32,10 +31,9 @@
   // compile and minify scripts
   gulp.task('scripts', function() {
     return gulp.src([
-        options.scripts + '**/*.js'
+        options.tmp + '**/*.js'
       ])
-      .pipe(babel())
-      .pipe(ngmin())
+      .pipe(ngAnnotate())
       .pipe(angularFilesort())
       .pipe(concat('xosContentProvider.js'))
       .pipe(uglify())
@@ -46,30 +44,44 @@
   gulp.task('templates', function(){
     return gulp.src("./src/templates/*.html")
       .pipe(templateCache({
-        module: 'xos.contentProviderApp',
-        root: '../../static/templates/contentProvider/',
-        templateHeader: TEMPLATE_HEADER
+        module: 'xos.contentProvider',
+        root: 'templates/'
       }))
-      .pipe(gulp.dest(options.scripts));
+      .pipe(gulp.dest(options.tmp));
   });
 
   // copy js output to Django Folder
   gulp.task('copyJs', function(){
     return gulp.src('dist/xosContentProvider.js')
-      .pipe(gulp.dest('../static/js/'))
+      .pipe(gulp.dest(options.static + 'js/'))
   });
 
   // copy vendor js output to Django Folder
   gulp.task('copyVendor', function(){
-    return gulp.src('dist/xosNgVendor.js')
-      .pipe(gulp.dest('../static/js/vendor/'));
+    return gulp.src(options.dist + 'xosContentProviderVendor.js')
+      .pipe(gulp.dest(options.static + 'js/vendor/'));
+  });
+
+  // copy html index to Django Folder
+  gulp.task('copyHtml', function(){
+    return gulp.src(options.src + 'xosContentProvider.html')
+      .pipe(gulp.dest(options.dashboards))
   });
 
   // minify vendor js files
   gulp.task('wiredep', function(){
     var bowerDeps = wiredep().js;
+    if(!bowerDeps){
+      return;
+    }
+
+    // remove angular (it's already loaded)
+    _.remove(bowerDeps, function(dep){
+      return dep.indexOf('angular/angular.js') !== -1;
+    });
+
     return gulp.src(bowerDeps)
-      .pipe(concat('xosNgVendor.js'))
+      .pipe(concat('xosContentProviderVendor.js'))
       .pipe(uglify())
       .pipe(gulp.dest(options.dist));
   });
@@ -84,10 +96,13 @@
     runSequence(
       'clean',
       'templates',
+      'babel',
       'scripts',
       'copyJs',
+      'copyHtml',
       'wiredep',
-      'copyVendor'
+      'copyVendor',
+      'cleanTmp'
     );
   });
 }
\ No newline at end of file
diff --git a/xos/core/xoslib/xos-builder/gulp/server.js b/xos/core/xoslib/ngXosViews/contentProvider/gulp/server.js
similarity index 61%
rename from xos/core/xoslib/xos-builder/gulp/server.js
rename to xos/core/xoslib/ngXosViews/contentProvider/gulp/server.js
index 719c156..907dd19 100644
--- a/xos/core/xoslib/xos-builder/gulp/server.js
+++ b/xos/core/xoslib/ngXosViews/contentProvider/gulp/server.js
@@ -8,6 +8,7 @@
 var babel = require('gulp-babel');
 var wiredep = require('wiredep').stream;
 var httpProxy = require('http-proxy');
+var del = require('del');
 
 var proxy = httpProxy.createProxyServer({
   target: 'http://0.0.0.0:9999'
@@ -27,9 +28,20 @@
   // open in browser with sync and proxy to 0.0.0.0
   gulp.task('browser', function() {
     browserSync.init({
-      reloadDelay: 500,
+      // reloadDelay: 500,
+      // logLevel: 'debug',
+      // logConnections: true,
+      snippetOptions: {
+        rule: {
+          match: /<!-- browserSync -->/i
+        }
+      },
       server: {
         baseDir: options.src,
+        routes: {
+          '/api': options.api,
+          '/xosHelpers': options.helpers
+        },
         middleware: function(req, res, next){
           if(req.url.indexOf('no_hyperlinks') !== -1){
             proxy.web(req, res);
@@ -41,7 +53,13 @@
       }
     });
 
-     gulp.watch(options.scripts + '**/*.js', ['js-watch']);
+    gulp.watch(options.src + 'js/**/*.js', ['js-watch']);
+    gulp.watch(options.src + 'vendor/**/*.js', ['bower'], function(){
+      browserSync.reload();
+    });
+    gulp.watch(options.src + '**/*.html', function(){
+      browserSync.reload();
+    });
   });
 
   // transpile js with sourceMaps
@@ -52,14 +70,18 @@
   });
 
   // inject scripts
-  gulp.task('inject', ['babel'],function(){
+  gulp.task('inject', ['cleanTmp', 'babel'],function(){
     return gulp.src(options.src + 'index.html')
       .pipe(
         inject(
-          gulp.src(options.tmp + '**/*.js')
+          gulp.src([
+            options.tmp + '**/*.js',
+            options.api + '*.js',
+            options.helpers + '**/*.js'
+          ])
           .pipe(angularFilesort()),
           {
-            ignorePath: options.src
+            ignorePath: [options.src, '/../../ngXosLib']
           }
         )
       )
@@ -68,20 +90,24 @@
 
   // inject bower dependencies with wiredep
   gulp.task('bower', function () {
-    gulp.src(options.src + 'index.html')
+    return gulp.src(options.src + 'index.html')
     .pipe(wiredep({devDependencies: true}))
     .pipe(gulp.dest(options.src));
   });
 
-  //watch js for changes
-  gulp.task('js-watch', ['babel'], browserSync.reload);
+  gulp.task('js-watch', ['inject'], function(){
+    browserSync.reload();
+  });
+
+  gulp.task('cleanTmp', function(){
+    return del([options.tmp + '**/*']);
+  });
 
   gulp.task('serve', function() {
     runSequence(
       'bower',
       'inject',
-      ['browser'
-      ]
+      ['browser']
     );
   });
 }
\ No newline at end of file
diff --git a/xos/core/xoslib/ngXosViews/contentProvider/gulpfile.js b/xos/core/xoslib/ngXosViews/contentProvider/gulpfile.js
new file mode 100644
index 0000000..948a99d
--- /dev/null
+++ b/xos/core/xoslib/ngXosViews/contentProvider/gulpfile.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var gulp = require('gulp');
+var wrench = require('wrench');
+
+var options = {
+  src: 'src/',
+  scripts: 'src/js/',
+  tmp: 'src/.tmp',
+  dist: 'dist/',
+  api: '../../ngXosLib/api/',
+  helpers: '../../ngXosLib/xosHelpers/',
+  static: '../../static/', // this is the django static folder
+  dashboards: '../../dashboards/' // this is the django html folder
+};
+
+wrench.readdirSyncRecursive('./gulp')
+.map(function(file) {
+  require('./gulp/' + file)(options);
+});
+
+gulp.task('default', function () {
+  gulp.start('build');
+});
diff --git a/xos/core/xoslib/xos-builder/package.json b/xos/core/xoslib/ngXosViews/contentProvider/package.json
similarity index 63%
rename from xos/core/xoslib/xos-builder/package.json
rename to xos/core/xoslib/ngXosViews/contentProvider/package.json
index 66de987..331182b 100644
--- a/xos/core/xoslib/xos-builder/package.json
+++ b/xos/core/xoslib/ngXosViews/contentProvider/package.json
@@ -1,11 +1,12 @@
 {
-  "name": "xos-builder",
+  "name": "xos-contentProvider",
   "version": "1.0.0",
-  "description": "Angular Application Builder tailored to XOS needings",
-  "main": "xos-builder.js",
+  "description": "Angular Application for XOS, created with generator-xos",
   "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1",
-    "start": "gulp serve"
+    "prestart": "npm install && bower install",
+    "start": "gulp serve",
+    "prebuild": "npm install && bower install",
+    "build": "gulp"
   },
   "keywords": [
     "XOS",
@@ -13,7 +14,7 @@
     "XOSlib"
   ],
   "author": "Matteo Scandolo",
-  "license": "ISC",
+  "license": "MIT",
   "dependencies": {},
   "devDependencies": {
     "browser-sync": "^2.9.11",
@@ -25,12 +26,13 @@
     "gulp-concat": "^2.6.0",
     "gulp-inject": "^3.0.0",
     "gulp-minify-html": "^1.0.4",
-    "gulp-ngmin": "^0.3.0",
     "gulp-uglify": "^1.4.2",
     "http-proxy": "^1.12.0",
     "proxy-middleware": "^0.15.0",
     "run-sequence": "^1.1.4",
     "wiredep": "^3.0.0-beta",
-    "wrench": "^1.5.8"
+    "wrench": "^1.5.8",
+    "gulp-ng-annotate": "^1.1.0",
+    "lodash": "^3.10.1"
   }
 }
diff --git a/xos/core/xoslib/xos-builder/src/index.html b/xos/core/xoslib/ngXosViews/contentProvider/src/index.html
similarity index 62%
rename from xos/core/xoslib/xos-builder/src/index.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/index.html
index d9e5316..2d5f6d2 100644
--- a/xos/core/xoslib/xos-builder/src/index.html
+++ b/xos/core/xoslib/ngXosViews/contentProvider/src/index.html
@@ -1,3 +1,4 @@
+<!-- browserSync -->
 <!-- bower:css -->
 <link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.css" />
 <!-- endbower -->
@@ -11,7 +12,7 @@
 </style>
 
 <div class="container">
-  <div ng-app="xos.contentProviderApp">
+  <div ng-app="xos.contentProvider">
     <ng-view></ng-view>
   </div>
 </div>
@@ -25,6 +26,11 @@
 <script src="vendor/bootstrap-css/js/bootstrap.js"></script>
 <!-- endbower -->
 <!-- inject:js -->
-<script src="/.tmp/xosContentProvider.js"></script>
-<script src="/.tmp/templates.js"></script>
+<script src="/xosHelpers/xosHelpers.module.js"></script>
+<script src="/xosHelpers/services/noHyperlinks.interceptor.js"></script>
+<script src="/xosHelpers/services/csrfToken.interceptor.js"></script>
+<script src="/api/ng-xoslib.js"></script>
+<script src="/api/ng-xos.js"></script>
+<script src="/api/ng-hpcapi.js"></script>
+<script src="/.tmp/main.js"></script>
 <!-- endinject -->
diff --git a/xos/core/xoslib/xos-builder/src/js/xosContentProvider.js b/xos/core/xoslib/ngXosViews/contentProvider/src/js/main.js
similarity index 86%
rename from xos/core/xoslib/xos-builder/src/js/xosContentProvider.js
rename to xos/core/xoslib/ngXosViews/contentProvider/src/js/main.js
index d675934..10fc506 100644
--- a/xos/core/xoslib/xos-builder/src/js/xosContentProvider.js
+++ b/xos/core/xoslib/ngXosViews/contentProvider/src/js/main.js
@@ -4,20 +4,18 @@
 // TODO
 // - Add Cache
 // - Refactor routing with ui.router and child views (share the navigation and header)
-// - Add Eslint
 
-angular.module('xos.contentProviderApp', [
+'use strict';
+
+angular.module('xos.contentProvider', [
   'ngResource',
   'ngRoute',
   'ngCookies',
-  'ngLodash'
+  'ngLodash',
+  'xos.helpers',
+  'xos.xos'
 ])
-.config(($interpolateProvider, $routeProvider, $resourceProvider) => {
-  $interpolateProvider.startSymbol('{$');
-  $interpolateProvider.endSymbol('$}');
-
-  // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
-  $resourceProvider.defaults.stripTrailingSlashes = false;
+.config(($routeProvider) => {
 
   $routeProvider
   .when('/', {
@@ -38,26 +36,9 @@
   .otherwise('/');
 })
 .config(function($httpProvider){
-
   // add X-CSRFToken header for update, create, delete (!GET)
   $httpProvider.interceptors.push('SetCSRFToken');
-})
-.factory('SetCSRFToken', function($cookies){
-  return {
-    request: function(request){
-
-      // if request is not HTML
-      if(request.url.indexOf('.html') === -1){
-        request.url += '?no_hyperlinks=1';
-      }
-
-      if(request.method !== 'GET'){
-        // request.headers['X-CSRFToken'] = $cookies.get('csrftoken');
-        request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
-      }
-      return request;
-    }
-  };
+  $httpProvider.interceptors.push('NoHyperlinks');
 })
 .service('ContentProvider', function($resource){
   return $resource('/hpcapi/contentproviders/:id/', {id: '@id'}, {
@@ -84,7 +65,7 @@
     },
     bindToController: true,
     controllerAs: 'vm',
-    templateUrl: '../../static/templates/contentProvider/cp_actions.html',
+    templateUrl: 'templates/cp_actions.html',
     controller: function(){
       this.deleteCp = function(id){
         ContentProvider.delete({id: id}).$promise
@@ -100,7 +81,7 @@
     restrict: 'E',
     controllerAs: 'vm',
     scope: {},
-    templateUrl: '../../static/templates/contentProvider/cp_list.html',
+    templateUrl: 'templates/cp_list.html',
     controller: function(){
       var _this = this;
 
@@ -126,7 +107,7 @@
     restrict: 'E',
     controllerAs: 'vm',
     scope: {},
-    templateUrl: '../../static/templates/contentProvider/cp_detail.html',
+    templateUrl: 'templates/cp_detail.html',
     controller: function(){
       this.pageName = 'detail';
       var _this = this;
@@ -187,7 +168,7 @@
     restrict: 'E',
     controllerAs: 'vm',
     scope: {},
-    templateUrl: '../../static/templates/contentProvider/cp_cdn_prefix.html',
+    templateUrl: 'templates/cp_cdn_prefix.html',
     controller: function(){
       var _this = this;
 
@@ -254,7 +235,7 @@
     restrict: 'E',
     controllerAs: 'vm',
     scope: {},
-    templateUrl: '../../static/templates/contentProvider/cp_origin_server.html',
+    templateUrl: 'templates/cp_origin_server.html',
     controller: function(){
       this.pageName = 'server';
       this.protocols = {'http': 'HTTP', 'rtmp': 'RTMP', 'rtp': 'RTP','shout': 'SHOUTcast'};
@@ -320,7 +301,7 @@
     restrict: 'E',
     controllerAs: 'vm',
     scope: {},
-    templateUrl: '../../static/templates/contentProvider/cp_user.html',
+    templateUrl: 'templates/cp_user.html',
     controller: function(){
       var _this = this;
 
diff --git a/xos/core/xoslib/xos-builder/src/templates/cp_actions.html b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_actions.html
similarity index 100%
rename from xos/core/xoslib/xos-builder/src/templates/cp_actions.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_actions.html
diff --git a/xos/core/xoslib/xos-builder/src/templates/cp_cdn_prefix.html b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_cdn_prefix.html
similarity index 94%
rename from xos/core/xoslib/xos-builder/src/templates/cp_cdn_prefix.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_cdn_prefix.html
index cc39aab..8532e6a 100644
--- a/xos/core/xoslib/xos-builder/src/templates/cp_cdn_prefix.html
+++ b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_cdn_prefix.html
@@ -9,7 +9,7 @@
 <hr>
 <div class="row-fluid">
   <div class="span2">
-    <div ng-include="'../../static/templates/contentProvider/cp_side_nav.html'"></div>
+    <div ng-include="'templates/cp_side_nav.html'"></div>
   </div>
   <div class="span10">
     <div ng-repeat="item in vm.cp_prf" class="well">
diff --git a/xos/core/xoslib/xos-builder/src/templates/cp_detail.html b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_detail.html
similarity index 95%
rename from xos/core/xoslib/xos-builder/src/templates/cp_detail.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_detail.html
index 0c11329..89d8daf 100644
--- a/xos/core/xoslib/xos-builder/src/templates/cp_detail.html
+++ b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_detail.html
@@ -9,7 +9,7 @@
 <hr>
 <div class="row-fluid">
   <div ng-show="vm.cp.id" class="span2">
-    <div ng-include="'../../static/templates/contentProvider/cp_side_nav.html'"></div>
+    <div ng-include="'templates/cp_side_nav.html'"></div>
   </div>
   <div ng-class="{span10: vm.cp.id, span12: !vm.cp.id}">
   <!-- TODO hide form on not found -->
diff --git a/xos/core/xoslib/xos-builder/src/templates/cp_list.html b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_list.html
similarity index 100%
rename from xos/core/xoslib/xos-builder/src/templates/cp_list.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_list.html
diff --git a/xos/core/xoslib/xos-builder/src/templates/cp_origin_server.html b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_origin_server.html
similarity index 94%
rename from xos/core/xoslib/xos-builder/src/templates/cp_origin_server.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_origin_server.html
index ff77864..49cd175 100644
--- a/xos/core/xoslib/xos-builder/src/templates/cp_origin_server.html
+++ b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_origin_server.html
@@ -9,7 +9,7 @@
 <hr>
 <div class="row-fluid">
   <div class="span2">
-    <div ng-include="'../../static/templates/contentProvider/cp_side_nav.html'"></div>
+    <div ng-include="'templates/cp_side_nav.html'"></div>
   </div>
   <div class="span10">
     <div ng-repeat="item in vm.cp_os" class="well">
diff --git a/xos/core/xoslib/xos-builder/src/templates/cp_side_nav.html b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_side_nav.html
similarity index 100%
rename from xos/core/xoslib/xos-builder/src/templates/cp_side_nav.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_side_nav.html
diff --git a/xos/core/xoslib/xos-builder/src/templates/cp_user.html b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_user.html
similarity index 94%
rename from xos/core/xoslib/xos-builder/src/templates/cp_user.html
rename to xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_user.html
index b35c2e9..2b82e1c 100644
--- a/xos/core/xoslib/xos-builder/src/templates/cp_user.html
+++ b/xos/core/xoslib/ngXosViews/contentProvider/src/templates/cp_user.html
@@ -9,7 +9,7 @@
 <hr>
 <div class="row-fluid">
   <div class="span2">
-    <div ng-include="'../../static/templates/contentProvider/cp_side_nav.html'"></div>
+    <div ng-include="'templates/cp_side_nav.html'"></div>
   </div>
   <div class="span10">
     <div ng-repeat="item in vm.cp.users" class="well">
diff --git a/xos/core/xoslib/ngXosViews/contentProvider/src/xosContentProvider.html b/xos/core/xoslib/ngXosViews/contentProvider/src/xosContentProvider.html
new file mode 100644
index 0000000..9439fef
--- /dev/null
+++ b/xos/core/xoslib/ngXosViews/contentProvider/src/xosContentProvider.html
@@ -0,0 +1,7 @@
+<div ng-app="xos.contentProvider">
+  <ng-view></ng-view>
+</div>
+
+<link rel="stylesheet" href="{{ STATIC_URL }}/css/xosLib.css">
+<script src="{{ STATIC_URL }}js/vendor/xosContentProviderVendor.js"></script>
+<script src="{{ STATIC_URL }}js/xosContentProvider.js"></script>
\ No newline at end of file
diff --git a/xos/core/xoslib/static/js/xosContentProvider.js b/xos/core/xoslib/static/js/xosContentProvider.js
index 2d611ee..293fa25 100644
--- a/xos/core/xoslib/static/js/xosContentProvider.js
+++ b/xos/core/xoslib/static/js/xosContentProvider.js
@@ -1 +1 @@
-"use strict";angular.module("xos.contentProviderApp",["ngResource","ngRoute","ngCookies","ngLodash"]).config(["$interpolateProvider","$routeProvider","$resourceProvider",function(n,e,t){n.startSymbol("{$"),n.endSymbol("$}"),t.defaults.stripTrailingSlashes=!1,e.when("/",{template:"<content-provider-list></content-provider-list>"}).when("/contentProvider/:id?",{template:"<content-provider-detail></content-provider-detail>"}).when("/contentProvider/:id/cdn_prefix",{template:"<content-provider-cdn></content-provider-cdn>"}).when("/contentProvider/:id/origin_server",{template:"<content-provider-server></content-provider-server>"}).when("/contentProvider/:id/users",{template:"<content-provider-users></content-provider-users>"}).otherwise("/")}]).config(["$httpProvider",function(n){n.interceptors.push("SetCSRFToken")}]).factory("SetCSRFToken",["$cookies",function(n){return{request:function(e){return-1===e.url.indexOf(".html")&&(e.url+="?no_hyperlinks=1"),"GET"!==e.method&&(e.headers["X-CSRFToken"]=n.get("xoscsrftoken")),e}}}]).service("ContentProvider",["$resource",function(n){return n("/hpcapi/contentproviders/:id/",{id:"@id"},{update:{method:"PUT"}})}]).service("ServiceProvider",["$resource",function(n){return n("/hpcapi/serviceproviders/:id/",{id:"@id"})}]).service("CdnPrefix",["$resource",function(n){return n("/hpcapi/cdnprefixs/:id/",{id:"@id"})}]).service("OriginServer",["$resource",function(n){return n("/hpcapi/originservers/:id/",{id:"@id"})}]).service("User",["$resource",function(n){return n("/xos/users/:id/",{id:"@id"})}]).directive("cpActions",["ContentProvider","$location",function(n,e){return{restrict:"E",scope:{id:"=id"},bindToController:!0,controllerAs:"vm",templateUrl:"../../static/templates/contentProvider/cp_actions.html",controller:function(){this.deleteCp=function(t){n["delete"]({id:t}).$promise.then(function(){e.url("/")})}}}}]).directive("contentProviderList",["ContentProvider","lodash",function(n,e){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"../../static/templates/contentProvider/cp_list.html",controller:function(){var t=this;n.query().$promise.then(function(n){t.contentProviderList=n})["catch"](function(n){throw new Error(n)}),this.deleteCp=function(i){n["delete"]({id:i}).$promise.then(function(){e.remove(t.contentProviderList,{id:i})})}}}}]).directive("contentProviderDetail",["ContentProvider","ServiceProvider","$routeParams","$location",function(n,e,t,i){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"../../static/templates/contentProvider/cp_detail.html",controller:function(){this.pageName="detail";var s=this;t.id?n.get({id:t.id}).$promise.then(function(n){s.cp=n})["catch"](function(n){s.result={status:0,msg:n.data.detail}}):s.cp=new n,e.query().$promise.then(function(n){s.sp=n}),this.saveContentProvider=function(n){var e,t=!1;n.id?e=n.$update():(t=!0,n.name=n.humanReadableName,e=n.$save()),e.then(function(n){s.result={status:1,msg:"Content Provider Saved"},t&&i.url("contentProvider/"+n.id+"/")})["catch"](function(n){s.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderCdn",["$routeParams","CdnPrefix","ContentProvider","lodash",function(n,e,t,i){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"../../static/templates/contentProvider/cp_cdn_prefix.html",controller:function(){var s=this;this.pageName="cdn",n.id&&t.get({id:n.id}).$promise.then(function(n){s.cp=n})["catch"](function(n){s.result={status:0,msg:n.data.detail}}),e.query().$promise.then(function(e){s.prf=e,s.cp_prf=i.where(e,{contentProvider:parseInt(n.id)})})["catch"](function(n){s.result={status:0,msg:n.data.detail}}),this.addPrefix=function(t){t.contentProvider=n.id;var i=new e(t);i.$save().then(function(n){s.cp_prf.push(n)})["catch"](function(n){s.result={status:0,msg:n.data.detail}})},this.removePrefix=function(n){n.$delete().then(function(){i.remove(s.cp_prf,n)})["catch"](function(n){s.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderServer",["$routeParams","OriginServer","ContentProvider","lodash",function(n,e,t,i){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"../../static/templates/contentProvider/cp_origin_server.html",controller:function(){this.pageName="server",this.protocols={http:"HTTP",rtmp:"RTMP",rtp:"RTP",shout:"SHOUTcast"};var s=this;n.id&&t.get({id:n.id}).$promise.then(function(n){s.cp=n})["catch"](function(n){s.result={status:0,msg:n.data.detail}}),e.query({contentProvider:n.id}).$promise.then(function(n){s.cp_os=n})["catch"](function(n){s.result={status:0,msg:n.data.detail}}),this.addOrigin=function(t){t.contentProvider=n.id;var i=new e(t);i.$save().then(function(n){s.cp_os.push(n)})["catch"](function(n){s.result={status:0,msg:n.data.detail}})},this.removeOrigin=function(n){n.$delete().then(function(){i.remove(s.cp_os,n)})["catch"](function(n){s.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderUsers",["$routeParams","ContentProvider","User","lodash",function(n,e,t,i){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"../../static/templates/contentProvider/cp_user.html",controller:function(){var s=this;this.pageName="user",this.cp_users=[],n.id&&t.query().$promise.then(function(t){return s.users=t,e.get({id:n.id}).$promise}).then(function(n){return n.users=s.populateUser(n.users,s.users),n}).then(function(n){s.cp=n})["catch"](function(n){s.result={status:0,msg:n.data.detail}}),this.populateUser=function(n,e){for(var t=0;t<n.length;t++)n[t]=i.find(e,{id:n[t]});return n},this.addUserToCp=function(n){s.cp.users.push(n)},this.removeUserFromCp=function(n){i.remove(s.cp.users,n)},this.saveContentProvider=function(n){n.users=i.pluck(n.users,"id"),n.$update().then(function(n){s.cp.users=s.populateUser(n.users,s.users),s.result={status:1,msg:"Content Provider Saved"}})["catch"](function(n){s.result={status:0,msg:n.data.detail}})}}}}]),angular.module("xos.contentProviderApp").run(["$templateCache",function(n){n.put("../../static/templates/contentProvider/cp_actions.html",'<a href="#/" class="btn btn-default">\n  <i class="icon icon-arrow-left"></i>Back\n</a>\n<a href="#/contentProvider/" class="btn btn-success">\n  <i class="icon icon-plus"></i>Create\n</a>\n<a ng-click="vm.deleteCp(vm.id)" class="btn btn-danger">\n  <i class="icon icon-remove"></i>Remove\n</a>'),n.put("../../static/templates/contentProvider/cp_cdn_prefix.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'../../static/templates/contentProvider/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_prf" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO show the name instead that id -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removePrefix(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addPrefix(vm.new_prf)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Prefix</label>\n          <input type="text" ng-model="vm.new_prf.prefix" required style="max-width: 90%">\n        </div>\n        <div class="span6">\n          <label>Default Origin Server</label>\n          <select ng-model="vm.new_prf.defaultOriginServer" style="max-width: 100%">\n            <option ng-repeat="prf in vm.prf" ng-value="prf.id">{$ prf.humanReadableName $}</option>\n          </select>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("../../static/templates/contentProvider/cp_detail.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div ng-show="vm.cp.id" class="span2">\n    <div ng-include="\'../../static/templates/contentProvider/cp_side_nav.html\'"></div>\n  </div>\n  <div ng-class="{span10: vm.cp.id, span12: !vm.cp.id}">\n  <!-- TODO hide form on not found -->\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <fieldset>\n        <div class="row-fluid">\n          <div class="span6">\n            <label>Name:</label>\n            <input type="text" ng-model="vm.cp.humanReadableName" required/>\n          </div>\n          <div class="span6">\n            <label class="checkbox">\n              <input type="checkbox" ng-model="vm.cp.enabled" /> Enabled\n            </label>\n          </div>\n        </div>\n        <div class="row-fluid">\n          <div class="span12">\n            <label>Description</label>\n            <textarea style="width: 100%" ng-model="vm.cp.description"></textarea>\n          </div>\n        </div>\n        <div class="row-fluid">\n          <div class="span12">\n            <label>Service provider</label>\n            <select required ng-model="vm.cp.serviceProvider" ng-options="sp.id as sp.humanReadableName for sp in vm.sp"></select>\n          </div>\n        </div>\n        <div class="row-fluid">\n          <div class="span12">\n            <button class="btn btn-success">\n              <span ng-show="vm.cp.id">Save</span>\n              <span ng-show="!vm.cp.id">Create</span>\n            </button>\n          </div>\n        </div>\n      </fieldset>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("../../static/templates/contentProvider/cp_list.html",'<table class="table table-striped" ng-show="vm.contentProviderList.length > 0">\n  <thead>\n    <tr>\n      <th>\n        Name\n      </th>\n      <th>Description</th>\n      <th>Status</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tr ng-repeat="item in vm.contentProviderList">\n    <td>\n      <a href="#/contentProvider/{$ item.id $}">{$ item.humanReadableName $}</a>\n    </td>\n    <td>\n      {$ item.description $}\n    </td>\n    <td>\n      {$ item.enabled $}\n    </td>\n    <td class="text-right">\n      <a ng-click="vm.deleteCp(item.id)" class="btn btn-danger"><i class="icon icon-remove"></i></a></td>\n  </tr>\n</table>\n<div class="alert alert-error" ng-show="vm.contentProviderList.length == 0">\n  No Content Provider defined\n</div>\n\n<div class="row">\n  <div class="span12 text-right">\n    <a class="btn btn-success"href="#/contentProvider/">Create</a>\n  </div>\n</div>'),n.put("../../static/templates/contentProvider/cp_origin_server.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'../../static/templates/contentProvider/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_os" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO shoe the name instead that url -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeOrigin(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addOrigin(vm.new_os)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Protocol</label>\n          <select ng-model="vm.new_os.protocol" ng-options="k as v for (k,v) in vm.protocols" style="max-width: 100%;"></select>\n        </div>\n        <div class="span6">\n          <label>Url</label>\n          <input type="text" ng-model="vm.new_os.url" required>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("../../static/templates/contentProvider/cp_side_nav.html",'<ul class="nav nav-list">\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'detail\'}" href="#/contentProvider/{$ vm.cp.id $}">Details</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'cdn\'}" href="#/contentProvider/{$ vm.cp.id $}/cdn_prefix">Cdn Prexix</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'server\'}" href="#/contentProvider/{$ vm.cp.id $}/origin_server">Origin Server</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'user\'}" href="#/contentProvider/{$ vm.cp.id $}/users">Users</a>\n  </li>\n</ul>'),n.put("../../static/templates/contentProvider/cp_user.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'../../static/templates/contentProvider/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp.users" class="well">\n      <div class="row-fluid">\n        <div class="span3">\n          {{item.firstname}}\n        </div>\n        <div class="span3">\n          {{item.lastname}}\n        </div>\n        <div class="span4">\n          {{item.email}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeUserFromCp(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <div class="row-fluid">\n        <div class="span8">\n          <label>Select user:</label>\n          <select ng-model="vm.user" ng-options="u as u.username for u in vm.users" ng-change="vm.addUserToCp(vm.user)"></select>\n        </div>  \n        <div class="span4 text-right">\n          <button class="btn btn-success margin-wells">\n            Save\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>')}]);
\ No newline at end of file
+"use strict";angular.module("xos.contentProvider",["ngResource","ngRoute","ngCookies","ngLodash","xos.helpers","xos.xos"]).config(["$routeProvider",function(n){n.when("/",{template:"<content-provider-list></content-provider-list>"}).when("/contentProvider/:id?",{template:"<content-provider-detail></content-provider-detail>"}).when("/contentProvider/:id/cdn_prefix",{template:"<content-provider-cdn></content-provider-cdn>"}).when("/contentProvider/:id/origin_server",{template:"<content-provider-server></content-provider-server>"}).when("/contentProvider/:id/users",{template:"<content-provider-users></content-provider-users>"}).otherwise("/")}]).config(["$httpProvider",function(n){n.interceptors.push("SetCSRFToken"),n.interceptors.push("NoHyperlinks")}]).service("ContentProvider",["$resource",function(n){return n("/hpcapi/contentproviders/:id/",{id:"@id"},{update:{method:"PUT"}})}]).service("ServiceProvider",["$resource",function(n){return n("/hpcapi/serviceproviders/:id/",{id:"@id"})}]).service("CdnPrefix",["$resource",function(n){return n("/hpcapi/cdnprefixs/:id/",{id:"@id"})}]).service("OriginServer",["$resource",function(n){return n("/hpcapi/originservers/:id/",{id:"@id"})}]).service("User",["$resource",function(n){return n("/xos/users/:id/",{id:"@id"})}]).directive("cpActions",["ContentProvider","$location",function(n,e){return{restrict:"E",scope:{id:"=id"},bindToController:!0,controllerAs:"vm",templateUrl:"templates/cp_actions.html",controller:function(){this.deleteCp=function(t){n["delete"]({id:t}).$promise.then(function(){e.url("/")})}}}}]).directive("contentProviderList",["ContentProvider","lodash",function(n,e){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_list.html",controller:function(){var t=this;n.query().$promise.then(function(n){t.contentProviderList=n})["catch"](function(n){throw new Error(n)}),this.deleteCp=function(s){n["delete"]({id:s}).$promise.then(function(){e.remove(t.contentProviderList,{id:s})})}}}}]).directive("contentProviderDetail",["ContentProvider","ServiceProvider","$routeParams","$location",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_detail.html",controller:function(){this.pageName="detail";var i=this;t.id?n.get({id:t.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}):i.cp=new n,e.query().$promise.then(function(n){i.sp=n}),this.saveContentProvider=function(n){var e,t=!1;n.id?e=n.$update():(t=!0,n.name=n.humanReadableName,e=n.$save()),e.then(function(n){i.result={status:1,msg:"Content Provider Saved"},t&&s.url("contentProvider/"+n.id+"/")})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderCdn",["$routeParams","CdnPrefix","ContentProvider","lodash",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_cdn_prefix.html",controller:function(){var i=this;this.pageName="cdn",n.id&&t.get({id:n.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),e.query().$promise.then(function(e){i.prf=e,i.cp_prf=s.where(e,{contentProvider:parseInt(n.id)})})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.addPrefix=function(t){t.contentProvider=n.id;var s=new e(t);s.$save().then(function(n){i.cp_prf.push(n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})},this.removePrefix=function(n){n.$delete().then(function(){s.remove(i.cp_prf,n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderServer",["$routeParams","OriginServer","ContentProvider","lodash",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_origin_server.html",controller:function(){this.pageName="server",this.protocols={http:"HTTP",rtmp:"RTMP",rtp:"RTP",shout:"SHOUTcast"};var i=this;n.id&&t.get({id:n.id}).$promise.then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),e.query({contentProvider:n.id}).$promise.then(function(n){i.cp_os=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.addOrigin=function(t){t.contentProvider=n.id;var s=new e(t);s.$save().then(function(n){i.cp_os.push(n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})},this.removeOrigin=function(n){n.$delete().then(function(){s.remove(i.cp_os,n)})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]).directive("contentProviderUsers",["$routeParams","ContentProvider","User","lodash",function(n,e,t,s){return{restrict:"E",controllerAs:"vm",scope:{},templateUrl:"templates/cp_user.html",controller:function(){var i=this;this.pageName="user",this.cp_users=[],n.id&&t.query().$promise.then(function(t){return i.users=t,e.get({id:n.id}).$promise}).then(function(n){return n.users=i.populateUser(n.users,i.users),n}).then(function(n){i.cp=n})["catch"](function(n){i.result={status:0,msg:n.data.detail}}),this.populateUser=function(n,e){for(var t=0;t<n.length;t++)n[t]=s.find(e,{id:n[t]});return n},this.addUserToCp=function(n){i.cp.users.push(n)},this.removeUserFromCp=function(n){s.remove(i.cp.users,n)},this.saveContentProvider=function(n){n.users=s.pluck(n.users,"id"),n.$update().then(function(n){i.cp.users=i.populateUser(n.users,i.users),i.result={status:1,msg:"Content Provider Saved"}})["catch"](function(n){i.result={status:0,msg:n.data.detail}})}}}}]),angular.module("xos.contentProvider").run(["$templateCache",function(n){n.put("templates/cp_actions.html",'<a href="#/" class="btn btn-default">\n  <i class="icon icon-arrow-left"></i>Back\n</a>\n<a href="#/contentProvider/" class="btn btn-success">\n  <i class="icon icon-plus"></i>Create\n</a>\n<a ng-click="vm.deleteCp(vm.id)" class="btn btn-danger">\n  <i class="icon icon-remove"></i>Remove\n</a>'),n.put("templates/cp_cdn_prefix.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_prf" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO show the name instead that id -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removePrefix(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addPrefix(vm.new_prf)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Prefix</label>\n          <input type="text" ng-model="vm.new_prf.prefix" required style="max-width: 90%">\n        </div>\n        <div class="span6">\n          <label>Default Origin Server</label>\n          <select ng-model="vm.new_prf.defaultOriginServer" style="max-width: 100%">\n            <option ng-repeat="prf in vm.prf" ng-value="prf.id">{$ prf.humanReadableName $}</option>\n          </select>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_detail.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div ng-show="vm.cp.id" class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div ng-class="{span10: vm.cp.id, span12: !vm.cp.id}">\n  <!-- TODO hide form on not found -->\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <fieldset>\n        <div class="row-fluid">\n          <div class="span6">\n            <label>Name:</label>\n            <input type="text" ng-model="vm.cp.humanReadableName" required/>\n          </div>\n          <div class="span6">\n            <label class="checkbox">\n              <input type="checkbox" ng-model="vm.cp.enabled" /> Enabled\n            </label>\n          </div>\n        </div>\n        <div class="row-fluid">\n          <div class="span12">\n            <label>Description</label>\n            <textarea style="width: 100%" ng-model="vm.cp.description"></textarea>\n          </div>\n        </div>\n        <div class="row-fluid">\n          <div class="span12">\n            <label>Service provider</label>\n            <select required ng-model="vm.cp.serviceProvider" ng-options="sp.id as sp.humanReadableName for sp in vm.sp"></select>\n          </div>\n        </div>\n        <div class="row-fluid">\n          <div class="span12">\n            <button class="btn btn-success">\n              <span ng-show="vm.cp.id">Save</span>\n              <span ng-show="!vm.cp.id">Create</span>\n            </button>\n          </div>\n        </div>\n      </fieldset>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_list.html",'<table class="table table-striped" ng-show="vm.contentProviderList.length > 0">\n  <thead>\n    <tr>\n      <th>\n        Name\n      </th>\n      <th>Description</th>\n      <th>Status</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tr ng-repeat="item in vm.contentProviderList">\n    <td>\n      <a href="#/contentProvider/{$ item.id $}">{$ item.humanReadableName $}</a>\n    </td>\n    <td>\n      {$ item.description $}\n    </td>\n    <td>\n      {$ item.enabled $}\n    </td>\n    <td class="text-right">\n      <a ng-click="vm.deleteCp(item.id)" class="btn btn-danger"><i class="icon icon-remove"></i></a></td>\n  </tr>\n</table>\n<div class="alert alert-error" ng-show="vm.contentProviderList.length == 0">\n  No Content Provider defined\n</div>\n\n<div class="row">\n  <div class="span12 text-right">\n    <a class="btn btn-success"href="#/contentProvider/">Create</a>\n  </div>\n</div>'),n.put("templates/cp_origin_server.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp_os" class="well">\n      <div class="row-fluid">\n        <div class="span4">\n          {{item.humanReadableName}}\n        </div>\n        <div class="span6">\n          <!-- TODO shoe the name instead that url -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeOrigin(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.addOrigin(vm.new_os)">\n      <div class="row-fluid">\n        <div class="span4">\n          <label>Protocol</label>\n          <select ng-model="vm.new_os.protocol" ng-options="k as v for (k,v) in vm.protocols" style="max-width: 100%;"></select>\n        </div>\n        <div class="span6">\n          <label>Url</label>\n          <input type="text" ng-model="vm.new_os.url" required>\n        </div>\n        <div class="span2 text-right">\n          <button class="btn btn-success margin-wells">\n            <i class="icon icon-plus"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>'),n.put("templates/cp_side_nav.html",'<ul class="nav nav-list">\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'detail\'}" href="#/contentProvider/{$ vm.cp.id $}">Details</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'cdn\'}" href="#/contentProvider/{$ vm.cp.id $}/cdn_prefix">Cdn Prexix</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'server\'}" href="#/contentProvider/{$ vm.cp.id $}/origin_server">Origin Server</a>\n  </li>\n  <li>\n    <a class="btn" ng-class="{\'btn-primary\': vm.pageName == \'user\'}" href="#/contentProvider/{$ vm.cp.id $}/users">Users</a>\n  </li>\n</ul>'),n.put("templates/cp_user.html",'<div class="row-fluid">\n  <div class="span6">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class="span6 text-right">\n    <cp-actions id="vm.cp.id"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class="row-fluid">\n  <div class="span2">\n    <div ng-include="\'templates/cp_side_nav.html\'"></div>\n  </div>\n  <div class="span10">\n    <div ng-repeat="item in vm.cp.users" class="well">\n      <div class="row-fluid">\n        <div class="span3">\n          {{item.firstname}}\n        </div>\n        <div class="span3">\n          {{item.lastname}}\n        </div>\n        <div class="span4">\n          {{item.email}}\n        </div>\n        <div class="span2">\n          <a ng-click="vm.removeUserFromCp(item)" class="btn btn-danger pull-right">\n            <i class="icon icon-remove"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit="vm.saveContentProvider(vm.cp)">\n      <div class="row-fluid">\n        <div class="span8">\n          <label>Select user:</label>\n          <select ng-model="vm.user" ng-options="u as u.username for u in vm.users" ng-change="vm.addUserToCp(vm.user)"></select>\n        </div>  \n        <div class="span4 text-right">\n          <button class="btn btn-success margin-wells">\n            Save\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class="alert" ng-show="vm.result" ng-class="{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>')}]);
\ No newline at end of file
diff --git a/xos/core/xoslib/xos-builder/README.md b/xos/core/xoslib/xos-builder/README.md
deleted file mode 100644
index 7e15de6..0000000
--- a/xos/core/xoslib/xos-builder/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# XOS Lib Helper
-
-This library should help you while developing with:
-
-#### Serve
-- Install Bower deps
-- Load js files (from args folder)
-- Load html templates (from args folder)
-- Compile ES6
-- Compile Scss
-- Compile template using `ng2html`
-- Watch source folder
-- Livereload
-- Generate a basic index.html in a `dist` folder under `args` folder loading files
-
-#### Build
-- Install Bower deps
-- Load js files (from args folder)
-- Load html templates (from args folder)
-- Compile ES6
-- Compile Scss
-- Compile template using `ng2html`
-- Minify Js & Css
-- Prefix Css
-- Cicle trough `bower.json` and diff it with base `bower.json` to exclude already loaded modules (eg: angular) [Optional]
-- Move `dist` under xos folder
-
-## App Structure
-
-App Name
-└- src
-   ├ js
-   ├ templates
-   ├ bower_components
-   └ dist
-
-Angular apps should be saved under `xoslib/source` and builded apps should be moved under `xoslib/static/js`. 
-
-Two files should be generated, `appname_main.js` and `appname_vendor.js`, these file should be included into `xoslib/dashboards/appname.html` (tbd if this file has to be automatically generated during the build)
-
-## Advantages
-
-- Faster development with common tool
-- Standard build for community developer
-- Minified files
-
diff --git a/xos/core/xoslib/xos-builder/gulpfile.js b/xos/core/xoslib/xos-builder/gulpfile.js
deleted file mode 100644
index df133b1..0000000
--- a/xos/core/xoslib/xos-builder/gulpfile.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-var gulp = require('gulp');
-var wrench = require('wrench');
-
-var options = {
-  src: 'src/',
-  scripts: 'src/js/',
-  tmp: 'src/.tmp',
-  dist: 'dist/'
-};
-
-wrench.readdirSyncRecursive('./gulp')
-.map(function(file) {
-  require('./gulp/' + file)(options);
-});
-
-gulp.task('default', ['clean'], function () {
-  gulp.start('build');
-});
diff --git a/xos/core/xoslib/xos-builder/src/contentProvider.html b/xos/core/xoslib/xos-builder/src/contentProvider.html
deleted file mode 100644
index 24cd7f1..0000000
--- a/xos/core/xoslib/xos-builder/src/contentProvider.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!-- 
-To setup hpc:
-- cd /opt/xos/tosca
-- python ./run.py padmin@vicci.org samples/cdn.yaml
-
-To generate hpcapi:
-- cd /opt/xos
-- python apigen/modelgen apigen/hpc-api.template.py -n User -n Service -a hpc > xos/hpcapi.py
- -->
-
-<div ng-app="xos.contentProviderApp">
-  <ng-view></ng-view>
-</div>
-
-<link rel="stylesheet" href="{{ STATIC_URL }}/css/xosLib.css">
-<script src="{{ STATIC_URL }}/js/vendor/angular/angular.min.js"></script>
-<script src="{{ STATIC_URL }}/js/vendor/angular-resource/angular-resource.min.js"></script>
-<script src="{{ STATIC_URL }}/js/vendor/angular-route/angular-route.min.js"></script>
-<script src="{{ STATIC_URL }}/js/vendor/angular-cookies/angular-cookies.min.js"></script>
-<script src="{{ STATIC_URL }}/js/vendor/ng-lodash/build/ng-lodash.min.js"></script>
-<script src="{{ STATIC_URL }}/js/xosContentProvider.js"></script>
diff --git a/xos/core/xoslib/xos-builder/src/js/templates.js b/xos/core/xoslib/xos-builder/src/js/templates.js
deleted file mode 100644
index cec08b1..0000000
--- a/xos/core/xoslib/xos-builder/src/js/templates.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*This code is autogenerated from the templates files */ angular.module("xos.contentProviderApp").run(["$templateCache", function($templateCache) {$templateCache.put("../../static/templates/contentProvider/cp_actions.html","<a href=\"#/\" class=\"btn btn-default\">\n  <i class=\"icon icon-arrow-left\"></i>Back\n</a>\n<a href=\"#/contentProvider/\" class=\"btn btn-success\">\n  <i class=\"icon icon-plus\"></i>Create\n</a>\n<a ng-click=\"vm.deleteCp(vm.id)\" class=\"btn btn-danger\">\n  <i class=\"icon icon-remove\"></i>Remove\n</a>");
-$templateCache.put("../../static/templates/contentProvider/cp_cdn_prefix.html","<div class=\"row-fluid\">\n  <div class=\"span6\">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class=\"span6 text-right\">\n    <cp-actions id=\"vm.cp.id\"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class=\"row-fluid\">\n  <div class=\"span2\">\n    <div ng-include=\"\'../../static/templates/contentProvider/cp_side_nav.html\'\"></div>\n  </div>\n  <div class=\"span10\">\n    <div ng-repeat=\"item in vm.cp_prf\" class=\"well\">\n      <div class=\"row-fluid\">\n        <div class=\"span4\">\n          {{item.humanReadableName}}\n        </div>\n        <div class=\"span6\">\n          <!-- TODO show the name instead that id -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class=\"span2\">\n          <a ng-click=\"vm.removePrefix(item)\" class=\"btn btn-danger pull-right\">\n            <i class=\"icon icon-remove\"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit=\"vm.addPrefix(vm.new_prf)\">\n      <div class=\"row-fluid\">\n        <div class=\"span4\">\n          <label>Prefix</label>\n          <input type=\"text\" ng-model=\"vm.new_prf.prefix\" required style=\"max-width: 90%\">\n        </div>\n        <div class=\"span6\">\n          <label>Default Origin Server</label>\n          <select ng-model=\"vm.new_prf.defaultOriginServer\" style=\"max-width: 100%\">\n            <option ng-repeat=\"prf in vm.prf\" ng-value=\"prf.id\">{$ prf.humanReadableName $}</option>\n          </select>\n        </div>\n        <div class=\"span2 text-right\">\n          <button class=\"btn btn-success margin-wells\">\n            <i class=\"icon icon-plus\"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class=\"alert\" ng-show=\"vm.result\" ng-class=\"{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}\">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>");
-$templateCache.put("../../static/templates/contentProvider/cp_detail.html","<div class=\"row-fluid\">\n  <div class=\"span6\">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class=\"span6 text-right\">\n    <cp-actions id=\"vm.cp.id\"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class=\"row-fluid\">\n  <div ng-show=\"vm.cp.id\" class=\"span2\">\n    <div ng-include=\"\'../../static/templates/contentProvider/cp_side_nav.html\'\"></div>\n  </div>\n  <div ng-class=\"{span10: vm.cp.id, span12: !vm.cp.id}\">\n  <!-- TODO hide form on not found -->\n    <form ng-submit=\"vm.saveContentProvider(vm.cp)\">\n      <fieldset>\n        <div class=\"row-fluid\">\n          <div class=\"span6\">\n            <label>Name:</label>\n            <input type=\"text\" ng-model=\"vm.cp.humanReadableName\" required/>\n          </div>\n          <div class=\"span6\">\n            <label class=\"checkbox\">\n              <input type=\"checkbox\" ng-model=\"vm.cp.enabled\" /> Enabled\n            </label>\n          </div>\n        </div>\n        <div class=\"row-fluid\">\n          <div class=\"span12\">\n            <label>Description</label>\n            <textarea style=\"width: 100%\" ng-model=\"vm.cp.description\"></textarea>\n          </div>\n        </div>\n        <div class=\"row-fluid\">\n          <div class=\"span12\">\n            <label>Service provider</label>\n            <select required ng-model=\"vm.cp.serviceProvider\" ng-options=\"sp.id as sp.humanReadableName for sp in vm.sp\"></select>\n          </div>\n        </div>\n        <div class=\"row-fluid\">\n          <div class=\"span12\">\n            <button class=\"btn btn-success\">\n              <span ng-show=\"vm.cp.id\">Save</span>\n              <span ng-show=\"!vm.cp.id\">Create</span>\n            </button>\n          </div>\n        </div>\n      </fieldset>\n    </form>\n    <div class=\"alert\" ng-show=\"vm.result\" ng-class=\"{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}\">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>");
-$templateCache.put("../../static/templates/contentProvider/cp_list.html","<table class=\"table table-striped\" ng-show=\"vm.contentProviderList.length > 0\">\n  <thead>\n    <tr>\n      <th>\n        Name\n      </th>\n      <th>Description</th>\n      <th>Status</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tr ng-repeat=\"item in vm.contentProviderList\">\n    <td>\n      <a href=\"#/contentProvider/{$ item.id $}\">{$ item.humanReadableName $}</a>\n    </td>\n    <td>\n      {$ item.description $}\n    </td>\n    <td>\n      {$ item.enabled $}\n    </td>\n    <td class=\"text-right\">\n      <a ng-click=\"vm.deleteCp(item.id)\" class=\"btn btn-danger\"><i class=\"icon icon-remove\"></i></a></td>\n  </tr>\n</table>\n<div class=\"alert alert-error\" ng-show=\"vm.contentProviderList.length == 0\">\n  No Content Provider defined\n</div>\n\n<div class=\"row\">\n  <div class=\"span12 text-right\">\n    <a class=\"btn btn-success\"href=\"#/contentProvider/\">Create</a>\n  </div>\n</div>");
-$templateCache.put("../../static/templates/contentProvider/cp_origin_server.html","<div class=\"row-fluid\">\n  <div class=\"span6\">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class=\"span6 text-right\">\n    <cp-actions id=\"vm.cp.id\"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class=\"row-fluid\">\n  <div class=\"span2\">\n    <div ng-include=\"\'../../static/templates/contentProvider/cp_side_nav.html\'\"></div>\n  </div>\n  <div class=\"span10\">\n    <div ng-repeat=\"item in vm.cp_os\" class=\"well\">\n      <div class=\"row-fluid\">\n        <div class=\"span4\">\n          {{item.humanReadableName}}\n        </div>\n        <div class=\"span6\">\n          <!-- TODO shoe the name instead that url -->\n          {{item.defaultOriginServer}}\n        </div>\n        <div class=\"span2\">\n          <a ng-click=\"vm.removeOrigin(item)\" class=\"btn btn-danger pull-right\">\n            <i class=\"icon icon-remove\"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit=\"vm.addOrigin(vm.new_os)\">\n      <div class=\"row-fluid\">\n        <div class=\"span4\">\n          <label>Protocol</label>\n          <select ng-model=\"vm.new_os.protocol\" ng-options=\"k as v for (k,v) in vm.protocols\" style=\"max-width: 100%;\"></select>\n        </div>\n        <div class=\"span6\">\n          <label>Url</label>\n          <input type=\"text\" ng-model=\"vm.new_os.url\" required>\n        </div>\n        <div class=\"span2 text-right\">\n          <button class=\"btn btn-success margin-wells\">\n            <i class=\"icon icon-plus\"></i>\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class=\"alert\" ng-show=\"vm.result\" ng-class=\"{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}\">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>");
-$templateCache.put("../../static/templates/contentProvider/cp_side_nav.html","<ul class=\"nav nav-list\">\n  <li>\n    <a class=\"btn\" ng-class=\"{\'btn-primary\': vm.pageName == \'detail\'}\" href=\"#/contentProvider/{$ vm.cp.id $}\">Details</a>\n  </li>\n  <li>\n    <a class=\"btn\" ng-class=\"{\'btn-primary\': vm.pageName == \'cdn\'}\" href=\"#/contentProvider/{$ vm.cp.id $}/cdn_prefix\">Cdn Prexix</a>\n  </li>\n  <li>\n    <a class=\"btn\" ng-class=\"{\'btn-primary\': vm.pageName == \'server\'}\" href=\"#/contentProvider/{$ vm.cp.id $}/origin_server\">Origin Server</a>\n  </li>\n  <li>\n    <a class=\"btn\" ng-class=\"{\'btn-primary\': vm.pageName == \'user\'}\" href=\"#/contentProvider/{$ vm.cp.id $}/users\">Users</a>\n  </li>\n</ul>");
-$templateCache.put("../../static/templates/contentProvider/cp_user.html","<div class=\"row-fluid\">\n  <div class=\"span6\">\n    <h1>{$ vm.cp.humanReadableName $}</h1>\n  </div>\n  <div class=\"span6 text-right\">\n    <cp-actions id=\"vm.cp.id\"></cp-actions>\n  </div>\n</div>\n<hr>\n<div class=\"row-fluid\">\n  <div class=\"span2\">\n    <div ng-include=\"\'../../static/templates/contentProvider/cp_side_nav.html\'\"></div>\n  </div>\n  <div class=\"span10\">\n    <div ng-repeat=\"item in vm.cp.users\" class=\"well\">\n      <div class=\"row-fluid\">\n        <div class=\"span3\">\n          {{item.firstname}}\n        </div>\n        <div class=\"span3\">\n          {{item.lastname}}\n        </div>\n        <div class=\"span4\">\n          {{item.email}}\n        </div>\n        <div class=\"span2\">\n          <a ng-click=\"vm.removeUserFromCp(item)\" class=\"btn btn-danger pull-right\">\n            <i class=\"icon icon-remove\"></i>\n          </a>\n        </div>\n      </div>\n    </div>\n    <hr>\n    <form ng-submit=\"vm.saveContentProvider(vm.cp)\">\n      <div class=\"row-fluid\">\n        <div class=\"span8\">\n          <label>Select user:</label>\n          <select ng-model=\"vm.user\" ng-options=\"u as u.username for u in vm.users\" ng-change=\"vm.addUserToCp(vm.user)\"></select>\n        </div>  \n        <div class=\"span4 text-right\">\n          <button class=\"btn btn-success margin-wells\">\n            Save\n          </button>\n        </div>\n      </div>\n    </form>\n    <div class=\"alert\" ng-show=\"vm.result\" ng-class=\"{\'alert-success\': vm.result.status === 1,\'alert-error\': vm.result.status === 0}\">\n      {$ vm.result.msg $}\n    </div>\n  </div>\n</div>");}]);
\ No newline at end of file