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

[web] domains added

This commit is contained in:
Martin Geno 2016-09-11 23:03:41 +02:00
parent ed433dc66f
commit 58aab8dfd8
11 changed files with 72 additions and 8 deletions

View File

@ -5,7 +5,7 @@
span.glyphicon.glyphicon-remove(ng-if="!invitor.admin") span.glyphicon.glyphicon-remove(ng-if="!invitor.admin")
a.btn.btn-default(ng-click="isAdding=true") a.btn.btn-default(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus 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 .form-group
label(for="username") Username label(for="username") Username
input.form-control(id="username",name="username",ng-model="obj.username",ng-minlength="3") input.form-control(id="username",name="username",ng-model="obj.username",ng-minlength="3")

View File

@ -1,6 +1,6 @@
.container .container
h1 Settings h1 Settings
form(ng-submit="submit()",name="myform") form.well(ng-submit="submit()",name="myform")
.form-group .form-group
label(for="globalUsername") Username label(for="globalUsername") Username
input.form-control(id="globalUsername",ng-model="session.login.username",readonly) input.form-control(id="globalUsername",ng-model="session.login.username",readonly)

View File

@ -2,7 +2,7 @@
h1 User Managment h1 User Managment
a.btn.btn-default(ng-click="isAdding=true") a.btn.btn-default(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus 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 .form-group
label(for="username") Username label(for="username") Username
input.form-control(id="username",name="username",ng-model="obj.username",ng-minlength="3") input.form-control(id="username",name="username",ng-model="obj.username",ng-minlength="3")

View File

@ -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

40
public/app/web/domain.js Normal file
View File

@ -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);
};
});

View File

@ -3,7 +3,7 @@
div (where you are involved) div (where you are involved)
a.btn.btn-default(ng-click="isAdding=true") a.btn.btn-default(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus 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 .form-group
label(for="name") Name label(for="name") Name
input.form-control(id="name",name="name",ng-model="obj.name",ng-minlength="3") 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") input.form-control(id="name",name="name",ng-model="item.website.name")
td(data-title="'Option'") td(data-title="'Option'")
.btn-group.btn-group-xs .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.btn.btn-default(ng-click="item.isEditing = true",ng-if="!item.isEditing")
span.glyphicon.glyphicon-pencil span.glyphicon.glyphicon-pencil
span.btn.btn-default(ng-click="edit(item)",ng-if="item.isEditing") span.btn.btn-default(ng-click="edit(item)",ng-if="item.isEditing")

View File

@ -9,7 +9,7 @@ li.dropdown
a(href="",ng-click="add()") Add a(href="",ng-click="add()") Add
li.dropdown-header Websites: li.dropdown-header Websites:
li(ng-repeat="item in list") 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") li(ng-if="website.name")
a(ui-sref="app.webS.menu({websiteid:website.ID})") Menu a(ui-sref="app.webS.menu({websiteid:website.ID})") Menu
li(ng-if="website.name") li(ng-if="website.name")

View File

@ -12,7 +12,7 @@ angular.module('warehost')
$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;
} }
} }

View File

@ -2,7 +2,7 @@
h1 Permissions h1 Permissions
a.btn.btn-default(ng-click="isAdding=true") a.btn.btn-default(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus 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 .form-group
ui-select(ng-model="obj.login",theme="bootstrap") ui-select(ng-model="obj.login",theme="bootstrap")
ui-select-match {{$select.selected.username}} ui-select-match {{$select.selected.username}}

View File

@ -2,7 +2,7 @@
angular.module('config', []) angular.module('config', [])
.factory('config', function() { .factory('config', function() {
return { return {
api: 'http://[::1]:8080', api: 'https://apiv2.warehost.de',
table: { table: {
count: 25 count: 25
} }

View File

@ -16,6 +16,7 @@
<!-- build:css(public) app/vendor.css --> <!-- build:css(public) app/vendor.css -->
<!-- bower:css --> <!-- bower:css -->
<link rel="stylesheet" href="bower_components/ng-table/dist/ng-table.css" /> <link rel="stylesheet" href="bower_components/ng-table/dist/ng-table.css" />
<link rel="stylesheet" href="bower_components/angular-ui-select/dist/select.css" />
<!-- endbower --> <!-- endbower -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css" /> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="bower_components/bootswatch/paper/bootstrap.min.css" /> <link rel="stylesheet" href="bower_components/bootswatch/paper/bootstrap.min.css" />
@ -43,6 +44,7 @@
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script> <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script> <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/ng-table/dist/ng-table.js"></script> <script src="bower_components/ng-table/dist/ng-table.js"></script>
<script src="bower_components/angular-ui-select/dist/select.js"></script>
<!-- endbower --> <!-- endbower -->
<script src="bower_components/ng-table/dist/ng-table.min.js"></script> <script src="bower_components/ng-table/dist/ng-table.min.js"></script>
<script src="bower_components/angular-ui-select/dist/select.min.js"></script> <script src="bower_components/angular-ui-select/dist/select.min.js"></script>
@ -57,6 +59,7 @@
<script src="app/main.js"></script> <script src="app/main.js"></script>
<script src="app/setting.js"></script> <script src="app/setting.js"></script>
<script src="app/user.js"></script> <script src="app/user.js"></script>
<script src="app/web/domain.js"></script>
<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>