sum7/warehost-frontend
sum7
/
warehost-frontend
Archived
1
0
Fork 0

[web] website crud

This commit is contained in:
Martin Geno 2016-09-06 18:19:08 +02:00
parent c9fd753cfa
commit 6d1290e159
7 changed files with 17 additions and 7 deletions

View File

@ -0,0 +1,10 @@
'use strict';
angular.module('config', [])
.factory('config', function() {
return {
api: 'https://apiv2.warehost.de',
table: {
count: 25
}
};
});

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.controller('ListWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){ .controller('ListWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
sorting: { 'invited.username': 'asc' }, sorting: { 'invited.username': 'asc' },
total: 0, total: 0,

View File

@ -9,10 +9,10 @@ angular.module('warehost')
$http.get(config.api+'/web/involve').then(function(res){ $http.get(config.api+'/web/involve').then(function(res){
session.set(res); session.set(res);
alert.set(res); alert.set(res);
$scope.list = res.data.data $scope.list = res.data.data;
for(var key in res.data.data){ for(var key in res.data.data){
var item = res.data.data[key]; var item = res.data.data[key];
if(item.website.ID == $stateParams.websiteid){ if(item.website.ID === $stateParams.websiteid){
$scope.website = item.website; $scope.website = item.website;
} }
} }
@ -21,7 +21,7 @@ angular.module('warehost')
load(); load();
$rootScope.$on('warehost.web.website.update',load); $rootScope.$on('warehost.web.website.update',load);
$scope.add = function(){ $scope.add = function(){
$http.post(config.api+'/web/website',{name:prompt("Name:")}).then(function(res){ $http.post(config.api+'/web/website',{name:window.prompt('Name:')}).then(function(res){
session.set(res); session.set(res);
$rootScope.$broadcast('warehost.web.website.update'); $rootScope.$broadcast('warehost.web.website.update');
}); });

View File

@ -48,6 +48,9 @@
<!-- build:js({.tmp,public}) app/app.js --> <!-- build:js({.tmp,public}) app/app.js -->
<script src="app/app.js"></script> <script src="app/app.js"></script>
<!-- injector:js --> <!-- injector:js -->
<script src="app/components/alert.js"></script>
<script src="app/components/config.js"></script>
<script src="app/components/session.js"></script>
<script src="app/host/index.js"></script> <script src="app/host/index.js"></script>
<script src="app/index.js"></script> <script src="app/index.js"></script>
<script src="app/invites.js"></script> <script src="app/invites.js"></script>
@ -56,9 +59,6 @@
<script src="app/web/index.js"></script> <script src="app/web/index.js"></script>
<script src="app/web/list.js"></script> <script src="app/web/list.js"></script>
<script src="app/web/menu.js"></script> <script src="app/web/menu.js"></script>
<script src="components/alert.js"></script>
<script src="components/config.js"></script>
<script src="components/session.js"></script>
<!-- endinjector --> <!-- endinjector -->
<!-- endbuild --> <!-- endbuild -->
</body> </body>