From 58aab8dfd889cc4b5101524e8340c0f1321d7faa Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Sun, 11 Sep 2016 23:03:41 +0200 Subject: [PATCH] [web] domains added --- public/app/invite.jade | 2 +- public/app/setting.jade | 2 +- public/app/user.jade | 2 +- public/app/web/domain.jade | 19 ++++++++++++++++ public/app/web/domain.js | 40 ++++++++++++++++++++++++++++++++++ public/app/web/list.jade | 4 +++- public/app/web/menu.jade | 2 +- public/app/web/menu.js | 2 +- public/app/web/permission.jade | 2 +- public/components/config.js | 2 +- public/index.html | 3 +++ 11 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 public/app/web/domain.jade create mode 100644 public/app/web/domain.js diff --git a/public/app/invite.jade b/public/app/invite.jade index 81695ed..d129db0 100644 --- a/public/app/invite.jade +++ b/public/app/invite.jade @@ -5,7 +5,7 @@ span.glyphicon.glyphicon-remove(ng-if="!invitor.admin") a.btn.btn-default(ng-click="isAdding=true") span.glyphicon.glyphicon-plus - form(ng-submit="add()",name="addform",ng-if="isAdding") + form.well(ng-submit="add()",name="addform",ng-if="isAdding") .form-group label(for="username") Username input.form-control(id="username",name="username",ng-model="obj.username",ng-minlength="3") diff --git a/public/app/setting.jade b/public/app/setting.jade index 4475639..c4a45e9 100644 --- a/public/app/setting.jade +++ b/public/app/setting.jade @@ -1,6 +1,6 @@ .container h1 Settings - form(ng-submit="submit()",name="myform") + form.well(ng-submit="submit()",name="myform") .form-group label(for="globalUsername") Username input.form-control(id="globalUsername",ng-model="session.login.username",readonly) diff --git a/public/app/user.jade b/public/app/user.jade index 867d393..4da1dd1 100644 --- a/public/app/user.jade +++ b/public/app/user.jade @@ -2,7 +2,7 @@ h1 User Managment a.btn.btn-default(ng-click="isAdding=true") span.glyphicon.glyphicon-plus - form(ng-submit="add()",name="addform",ng-if="isAdding") + form.well(ng-submit="add()",name="addform",ng-if="isAdding") .form-group label(for="username") Username input.form-control(id="username",name="username",ng-model="obj.username",ng-minlength="3") diff --git a/public/app/web/domain.jade b/public/app/web/domain.jade new file mode 100644 index 0000000..94c61ab --- /dev/null +++ b/public/app/web/domain.jade @@ -0,0 +1,19 @@ +.container + h1 Domains + a.btn.btn-default(ng-click="isAdding=true") + span.glyphicon.glyphicon-plus + form.well(ng-submit="add()",name="addform",ng-if="isAdding") + .form-group + label(for="domain") Domain + input.form-control(id="domain",name="domain",ng-model="obj.domain",ng-minlength="3") + button.btn.btn-primary(type="submit") + span.glyphicon.glyphicon-floppy-disk + | Save + table.table.table-bordered(ng-table="tableParams") + tr(ng-hide='group.$hideRows',ng-repeat="item in $data") + td(data-title="'Domain'") + span(ng-if="!item.isEditing") {{item.name}} + td(data-title="'Option'") + .btn-group.btn-group-xs + span.btn.btn-default(ng-click="delete(item)") + span.glyphicon.glyphicon-trash diff --git a/public/app/web/domain.js b/public/app/web/domain.js new file mode 100644 index 0000000..759418e --- /dev/null +++ b/public/app/web/domain.js @@ -0,0 +1,40 @@ +'use strict'; + +angular.module('warehost') + .controller('DomainWebCtrl',function(session,config,alert,NgTableParams,$scope,$http,$stateParams){ + $scope.tableParams = new NgTableParams({ + sorting: { 'invited.username': 'asc' }, + total: 0, + count: config.table.count + }, { dataset: [] }); + alert.set({}); + $scope.obj = {}; + + function resetObj(){ + $scope.obj = {}; + } + function load(){ + $http.get(config.api+'/web/website/'+$stateParams.websiteid+'/domain').then(function(res){ + session.set(res); + $scope.tableParams.settings({dataset: angular.copy(res.data.data),total: (res.data.data).length}); + }); + } + function submitresult(res){ + session.set(res); + alert.set(res); + if(res.data.data){ + resetObj(); + $scope.isAdding = false; + load(); + } + } + resetObj(); + load(); + + $scope.delete = function(a){ + $http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/domain/'+a.name).then(submitresult); + }; + $scope.add = function(){ + $http.post(config.api+'/web/website/'+$stateParams.websiteid+'/domain/'+$scope.obj.domain).then(submitresult); + }; + }); diff --git a/public/app/web/list.jade b/public/app/web/list.jade index ac8f1e8..efaad96 100644 --- a/public/app/web/list.jade +++ b/public/app/web/list.jade @@ -3,7 +3,7 @@ div (where you are involved) a.btn.btn-default(ng-click="isAdding=true") span.glyphicon.glyphicon-plus - form(ng-submit="add()",name="addform",ng-if="isAdding") + form.well(ng-submit="add()",name="addform",ng-if="isAdding") .form-group label(for="name") Name input.form-control(id="name",name="name",ng-model="obj.name",ng-minlength="3") @@ -21,6 +21,8 @@ input.form-control(id="name",name="name",ng-model="item.website.name") td(data-title="'Option'") .btn-group.btn-group-xs + a.btn.btn-default(ui-sref="app.webS.page({websiteid:item.website.ID})") + span.glyphicon.glyphicon-dashboard span.btn.btn-default(ng-click="item.isEditing = true",ng-if="!item.isEditing") span.glyphicon.glyphicon-pencil span.btn.btn-default(ng-click="edit(item)",ng-if="item.isEditing") diff --git a/public/app/web/menu.jade b/public/app/web/menu.jade index fd9ca5c..5ccb7e3 100644 --- a/public/app/web/menu.jade +++ b/public/app/web/menu.jade @@ -9,7 +9,7 @@ li.dropdown a(href="",ng-click="add()") Add li.dropdown-header Websites: li(ng-repeat="item in list") - a(ui-sref="app.webS({websiteid:item.website.ID})") {{item.website.name}} + a(ui-sref="app.webS.page({websiteid:item.website.ID})") {{item.website.name}} li(ng-if="website.name") a(ui-sref="app.webS.menu({websiteid:website.ID})") Menu li(ng-if="website.name") diff --git a/public/app/web/menu.js b/public/app/web/menu.js index 4592c03..891a6a8 100644 --- a/public/app/web/menu.js +++ b/public/app/web/menu.js @@ -12,7 +12,7 @@ angular.module('warehost') $scope.list = res.data.data; for(var key in res.data.data){ var item = res.data.data[key]; - if(item.website.ID+"" === $stateParams.websiteid){ + if(item.website.ID+'' === $stateParams.websiteid){ $scope.website = item.website; } } diff --git a/public/app/web/permission.jade b/public/app/web/permission.jade index 4f3b61b..99daf3b 100644 --- a/public/app/web/permission.jade +++ b/public/app/web/permission.jade @@ -2,7 +2,7 @@ h1 Permissions a.btn.btn-default(ng-click="isAdding=true") span.glyphicon.glyphicon-plus - form(ng-submit="add()",name="addform",ng-if="isAdding") + form.well(ng-submit="add()",name="addform",ng-if="isAdding") .form-group ui-select(ng-model="obj.login",theme="bootstrap") ui-select-match {{$select.selected.username}} diff --git a/public/components/config.js b/public/components/config.js index 582a254..181cfdc 100644 --- a/public/components/config.js +++ b/public/components/config.js @@ -2,7 +2,7 @@ angular.module('config', []) .factory('config', function() { return { - api: 'http://[::1]:8080', + api: 'https://apiv2.warehost.de', table: { count: 25 } diff --git a/public/index.html b/public/index.html index 29b9014..342cc78 100644 --- a/public/index.html +++ b/public/index.html @@ -16,6 +16,7 @@ + @@ -43,6 +44,7 @@ + @@ -57,6 +59,7 @@ +