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

delete web(site) app

This commit is contained in:
Martin Geno 2017-10-04 10:18:09 +02:00
parent ecc85b574e
commit 7737da0a1e
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
21 changed files with 26 additions and 811 deletions

View File

@ -3,10 +3,7 @@ angular.module('warehost')
.config(['$stateProvider',function ($stateProvider) {
$stateProvider
.state('app.host', {
url:'/host',
views:{
'menu':{templateUrl:'app/host/menu.html',controller:'MenuHostCtrl'}
}
url:'/host'
})
.state('app.host.index', {
url:'/',

View File

@ -1,24 +0,0 @@
ui.nav.navbar-nav
.navbar-text Hosting
li
a(ui-sref="app.host.index",ui-sref-active="active") Home
li(ng-if='!profil.ID')
a(ui-sref="app.host.signup",ui-sref-active="active") Signup
li(ng-if='profil.ID')
a(ui-sref="app.host.domain",ui-sref-active="active") Domains
li(ng-if='profil.ID')
a(ui-sref="app.host.database",ui-sref-active="active") Databases
ui.nav.navbar-nav.navbar-right
li.dropdown(ng-if="session.login.superadmin")
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
span.glyphicon.glyphicon-console
| Admin
span.caret
ul.dropdown-menu
li
a(ui-sref="app.host.A.profil") Profiles
li
a(ui-sref="app.host.A.domain") Domains
li
a(ui-sref="app.host.A.database") Databases

View File

@ -11,18 +11,6 @@
span.icon-bar
.navbar-collapse.collapse(uib-collapse="!isOpen")
ui.nav.navbar-nav.navbar-right(ng-if="session.login.active")
li.dropdown(ng-if="modules.length>0")
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
span.glyphicon.glyphicon-th-large
| Apps
span.caret
ul.dropdown-menu
li(ng-if="modules.indexOf('web')>-1")
a(ui-sref="app.web.index") Websites
li(ng-if="modules.indexOf('host')>-1")
a(ui-sref="app.host.index") Hosting
li(ng-if="modules.indexOf('test')>-1")
a Testing
li.dropdown
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
span.glyphicon.glyphicon-user
@ -54,7 +42,31 @@
.input-group-btn
button.btn.btn-default(type="submit")
span.glyphicon.glyphicon-log-in
div(ui-view="menu")
div(ui-view="menu",ng-controller="MenuHostCtrl")
ui.nav.navbar-nav
.navbar-text Hosting
li
a(ui-sref="app.host.index",ui-sref-active="active") Home
li(ng-if='!profil.ID')
a(ui-sref="app.host.signup",ui-sref-active="active") Signup
li(ng-if='profil.ID')
a(ui-sref="app.host.domain",ui-sref-active="active") Domains
li(ng-if='profil.ID')
a(ui-sref="app.host.database",ui-sref-active="active") Databases
ui.nav.navbar-nav.navbar-right
li.dropdown(ng-if="session.login.superadmin")
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false")
span.glyphicon.glyphicon-console
| Admin
span.caret
ul.dropdown-menu
li
a(ui-sref="app.host.A.profil") Profiles
li
a(ui-sref="app.host.A.domain") Domains
li
a(ui-sref="app.host.A.database") Databases
div(style="margin-top:53px;")
.container(ng-if="error.msg")
.alert.alert-danger(style="margin-top:20px;") {{error.msg}}

View File

@ -1,55 +0,0 @@
.container
h1 Blogs
.row
ul.nav.nav-tabs
li(ng-repeat="item in bloglist", ng-class="{'active':item.ID == blog.ID}")
a(ui-sref="app.webS.blog.post({websiteid:websiteid, blogid:item.ID})",ui-sref-active="active") {{item.title}}
li
a(ui-sref="app.webS.blog({websiteid:websiteid, blogid:-1})")
span.glyphicon.glyphicon-plus
li(style="float:right")
a(ui-sref="app.webS.blog({websiteid:websiteid, blogid:blog.ID})",ui-sref-active="active")
span.glyphicon.glyphicon-cog
.row(ui-view="posts")
form(ng-submit="save()")
h3(ng-if="blog.ID") Edit
h3(ng-if="!blog.ID") New
.form-group
label(for="title") Title
input.form-control(id="title",ng-model="blog.title")
.form-group
label(for="url") URL
br
i (http(s)://DOMAIN/{{blog.url.path}})
input.form-control(id="url",ng-model="blog.url.path")
.form-group
label(for="posturl") Post url schema
.input-group
.input-group-addon http(s)://DOMAIN/{{blog.url.path}}
select.form-control(ng-model="blog.posturl",ng-options="item.key as item.label for item in posturlOptions")
.form-group
label(for="content") Content
div(id="content",text-angular,ta-text-editor-class="clearfix border-around" ta-html-editor-class="border-around",ng-model="blog.content")
// .form-group
.checkbox
label
input(type="checkbox",ng-model="blog.preview_enable")
| Preview image
.form-group
.checkbox
label
input(type="checkbox",ng-model="blog.author_enable")
| Show author
.form-group
.checkbox
label
input(type="checkbox",ng-model="blog.createat_enable")
| Show create at
.form-group
.checkbox
label
input(type="checkbox",ng-model="blog.timerange_enable")
| Manage timerange in post
input.btn.btn-default(type="submit",value="Save")
input.btn.btn-danger(ng-if="blog.ID",value="Delete",ng-click="delete(blog)")

View File

@ -1,59 +0,0 @@
'use strict';
angular.module('warehost')
.controller('BlogWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){
$scope.posturlOptions = [
{key:0, label: '/title'},
{key:1, label: '/year/month/title'}
];
$scope.bloglist = [];
alert.set({});
$scope.blog = {};
$scope.websiteid = $stateParams.websiteid;
function resetBlog(){
$scope.blog = {};
}
function load(){
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/blog').then(function(res){
session.set(res);
resetBlog();
$scope.bloglist = res.data.data;
var blog;
for(var i in $scope.bloglist){
blog = $scope.bloglist[i];
if(blog.ID === Number($stateParams.blogid)) {
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+$stateParams.blogid).then(setBlog);
return;
}
}
if($scope.bloglist.length > 0 && $stateParams.blogid !== '-1'){
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+$scope.bloglist[0].ID).then(setBlog);
}
});
}
function setBlog(res) {
$scope.blog = res.data.data;
}
function submitresult(res){
session.set(res);
alert.set(res);
if(res.data.data){
load();
}
}
resetBlog();
load();
$rootScope.$on('warehost.session',load);
$scope.save = function(){
if($scope.blog.ID){
$http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+$scope.blog.ID,$scope.blog).then(submitresult);
}else{
$http.post(config.api+'/web/website/'+$stateParams.websiteid+'/blog',$scope.blog).then(submitresult);
}
};
$scope.delete = function(a){
$http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+a.ID).then(submitresult);
};
});

View File

@ -1,46 +0,0 @@
h2 Posts
.row
.col-md-3
.panel.panel-default
.panel-heading All
a.pull-right.btn.btn-default.btn-xs(ng-click="add()")
span.glyphicon.glyphicon-plus
table.table
tr(ng-repeat="item in blog.posts")
td {{item.title}}
td
.pull-right.btn-group.btn-group-xs
a.btn.btn-default(ng-click="edit(item)")
span.glyphicon.glyphicon-pencil
a.btn.btn-default(ng-click="delete(item)")
span.glyphicon.glyphicon-remove
form.col-md-9(ng-submit="save()")
h3(ng-if="post.ID") Edit
h3(ng-if="!post.ID") New
.form-group
label(for="title") Title
input.form-control(id="title",ng-model="post.title")
.form-group(ng-if="blog.author_enable")
label(for="author") Author
input.form-control(id="author",ng-model="post.author")
.form-group(ng-if="blog.createat_enable")
label(for="date") Create at
input.form-control(id="date",ng-model="post.createat")
.form-group(ng-if="blog.timerange_enable")
label(for="timerange") Timerange
.row
.col-md-6
.input-group
.input-group-addon start
input.form-control(id="timerange",ng-model="post.start")
.col-md-6
.input-group
.input-group-addon end
input.form-control(id="timerange",ng-model="post.end")
.form-group
label(for="summary") Summary
div(id="summary",text-angular,ta-text-editor-class="clearfix border-around",ta-html-editor-class="border-around",ng-model="post.summary")
.form-group
label(for="content") Content
div(id="content",text-angular,ta-text-editor-class="clearfix border-around",ta-html-editor-class="border-around",ng-model="post.content")
input.btn.btn-default(type="submit",value="Save")

View File

@ -1,45 +0,0 @@
'use strict';
angular.module('warehost')
.controller('BlogPostWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){
alert.set({});
$scope.post = {};
$scope.websiteid = $stateParams.websiteid;
function reset(){
$scope.post = {};
}
function load(){
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+$scope.blog.ID).then(function(res){
session.set(res);
reset();
$scope.blog = res.data.data;
});
}
function submitresult(res){
session.set(res);
alert.set(res);
if(res.data.data){
load();
}
}
reset();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){
$scope.post = a;
};
$scope.add = function(){
$scope.post = {};
};
$scope.save = function(){
if($scope.post.ID){
$http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+$scope.blog.ID+'/post/'+$scope.post.ID, $scope.post).then(submitresult);
}else{
$http.post(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+$scope.blog.ID+'/post', $scope.post).then(submitresult);
}
};
$scope.delete = function(a){
$http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/blog/'+$scope.blog.ID+'/post/'+a.ID).then(submitresult);
};
});

View File

@ -1,22 +0,0 @@
.container
h1 Domains
.panel.panel-default
.panel-heading All
a.pull-right.btn.btn-default.btn-xs(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus
.panel-body(ng-if="isAdding")
form(ng-submit="add()",name="addform")
.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(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

View File

@ -1,40 +0,0 @@
'use strict';
angular.module('warehost')
.controller('DomainWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){
$scope.tableParams = new NgTableParams({
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();
$rootScope.$on('warehost.session',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

@ -1,80 +0,0 @@
'use strict';
angular.module('warehost')
.config(['$stateProvider',function ($stateProvider) {
$stateProvider
.state('app.web', {
url:'/web',
views:{
'menu':{templateUrl:'app/web/menu.html',controller:'MenuWebCtrl'}
}
})
.state('app.web.index', {
url:'/',
views:{
'@app':{
templateUrl: 'app/web/list.html',
controller:'ListWebCtrl'
}
}
})
.state('app.webS', {
url:'/web/:websiteid',
views:{
'menu':{templateUrl:'app/web/menu.html',controller:'MenuWebCtrl'}
}
})
.state('app.webS.menu', {
url:'/menu',
views:{
'@app':{
templateUrl: 'app/web/webmenu.html',
controller:'WebmenuWebCtrl'
}
}
})
.state('app.webS.domain', {
url:'/domain',
views:{
'@app':{
templateUrl: 'app/web/domain.html',
controller:'DomainWebCtrl'
}
}
})
.state('app.webS.page', {
url:'/page',
views:{
'@app':{
templateUrl: 'app/web/page.html',
controller:'PageWebCtrl'
}
}
})
.state('app.webS.blog', {
url:'/blog/:blogid',
views:{
'@app':{
templateUrl: 'app/web/blog.html',
controller:'BlogWebCtrl'
}
}
})
.state('app.webS.blog.post', {
url:'/post',
views:{
'posts':{
templateUrl: 'app/web/blogpost.html',
controller:'BlogPostWebCtrl'
}
}
})
.state('app.webS.permission', {
url:'/permission',
views:{
'@app':{
templateUrl: 'app/web/permission.html',
controller:'PermissionWebCtrl'
}
}
});
}]);

View File

@ -1,37 +0,0 @@
.container
h1 Websites
div (where you are involved)
.panel.panel-default
.panel-heading All
a.pull-right.btn.btn-default.btn-xs(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus
.panel-body(ng-if="isAdding")
form(ng-submit="add()",name="addform")
.form-group
label(for="name") Name
input.form-control(id="name",name="name",ng-model="obj.name",ng-minlength="3")
button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk
| Save
table.table(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'#'") {{item.website.ID}}
td(data-title="'Name'")
span(ng-if="!item.isEditing") {{item.website.name}}
form(name="myform",ng-if="item.isEditing",ng-submit="edit(item)")
.form-group(ng-class="{'has-error': (error.fields.indexOf('name') >= 0 || !myform.name.$valid)}")
label(for="name") Name
input.form-control(id="name",name="name",ng-model="item.website.name")
button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk
| Save
td(data-title="'Option'")
.btn-group.btn-group-xs
a.btn.btn-default(ui-sref="app.webS.blog.post({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")
span.glyphicon.glyphicon-floppy-disk
span.btn.btn-default(ng-click="delete(item)")
span.glyphicon.glyphicon-trash

View File

@ -1,45 +0,0 @@
'use strict';
angular.module('warehost')
.controller('ListWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http){
$scope.tableParams = new NgTableParams({
sorting: { 'website.name': 'asc' },
total: 0,
count: config.table.count
}, { dataset: [] });
alert.set({});
$scope.obj = {};
function resetObj(){
$scope.obj = {};
}
function load(){
$http.get(config.api+'/web/involve').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){
$rootScope.$broadcast('warehost.web.website.update');
resetObj();
$scope.isAdding = false;
}
}
resetObj();
load();
$rootScope.$on('warehost.session',load);
$rootScope.$on('warehost.web.website.update',load);
$scope.edit = function(a){
$http.patch(config.api+'/web/website/'+a.website.ID,a.website).then(submitresult);
};
$scope.delete = function(a){
$http.delete(config.api+'/web/website/'+a.website.ID).then(submitresult);
};
$scope.add = function(){
$http.post(config.api+'/web/website',$scope.obj).then(submitresult);
};
});

View File

@ -1,23 +0,0 @@
ui.nav.navbar-nav
.navbar-text Website
li.dropdown
a.dropdown-toggle(data-toggle="dropdown",role="button",aria-haspopup="true",aria-expanded="false") {{website.name||'Websites'}}
span.caret
ul.dropdown-menu
li
a(ui-sref="app.web.index",ui-sref-active="active") Alle
li
a(href="",ng-click="add()") Add
li.dropdown-header Websites:
li(ng-repeat="item in list")
a(ui-sref="app.webS.blog.post({websiteid:item.website.ID})") {{item.website.name}}
li(ng-if="website.name")
a(ui-sref="app.webS.blog.post({websiteid:website.ID})") Blog
li(ng-if="website.name")
a(ui-sref="app.webS.menu({websiteid:website.ID})") Menu
li(ng-if="website.name")
a(ui-sref="app.webS.page({websiteid:website.ID})") Pages
li(ng-if="website.name")
a(ui-sref="app.webS.domain({websiteid:website.ID})") Domains
li(ng-if="website.name")
a(ui-sref="app.webS.permission({websiteid:website.ID})") Permissions

View File

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

View File

@ -1,33 +0,0 @@
.container
.page-header
h1 Pages
.row
.col-md-3
.panel.panel-default
.panel-heading All
a.pull-right.btn.btn-default.btn-xs(ng-click="add()")
span.glyphicon.glyphicon-plus
table.table
tr(ng-repeat="item in data")
td {{item.title}}
td
.pull-right.btn-group.btn-group-xs
a.btn.btn-default(ng-click="edit(item)")
span.glyphicon.glyphicon-pencil
a.btn.btn-default(ng-click="delete(item)")
span.glyphicon.glyphicon-remove
form.col-md-9(ng-submit="save()")
h3(ng-if="obj.ID") Edit
h3(ng-if="!obj.ID") New
.form-group
label(for="title") Title
input.form-control(id="title",ng-model="obj.title")
.form-group
label(for="url") URL
br
i (http(s)://DOMAIN/{{obj.url.path}})
input.form-control(id="url",ng-model="obj.url.path")
.form-group
label(for="content") Content
div(id="content",text-angular,ta-text-editor-class="clearfix border-around" ta-html-editor-class="border-around",ng-model="obj.content")
input.btn.btn-default(type="submit",value="Save")

View File

@ -1,45 +0,0 @@
'use strict';
angular.module('warehost')
.controller('PageWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){
$scope.data = [];
alert.set({});
$scope.obj = {};
function resetObj(){
$scope.obj = {};
}
function load(){
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/page').then(function(res){
session.set(res);
$scope.data = res.data.data;
});
}
function submitresult(res){
session.set(res);
alert.set(res);
if(res.data.data){
load();
}
}
resetObj();
load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){
$scope.obj = a;
};
$scope.add = function(){
$scope.obj = {};
};
$scope.save = function(){
if($scope.obj.ID){
$http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/page/'+$scope.obj.ID,$scope.obj).then(submitresult);
}else{
$http.post(config.api+'/web/website/'+$stateParams.websiteid+'/page',$scope.obj).then(submitresult);
}
};
$scope.delete = function(a){
$http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/page/'+a.ID).then(submitresult);
};
});

View File

@ -1,25 +0,0 @@
.container
h1 Permissions
.panel.panel-default
.panel-heading All
a.pull-right.btn.btn-default.btn-xs(ng-click="isAdding=true")
span.glyphicon.glyphicon-plus
.panel-body(ng-if="isAdding")
form(ng-submit="add()",name="addform")
.form-group
ui-select(ng-model="obj.login",theme="bootstrap")
ui-select-match {{$select.selected.username}}
ui-select-choices(repeat="item in loginlist | filter: $select.search")
div(ng-bind-html="item.username | highlight: $select.search")
button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk
| Save
table.table(ng-table="tableParams")
tr(ng-hide='group.$hideRows',ng-repeat="item in $data")
td(data-title="'#'") {{item.login.ID}}
td(data-title="'Username'")
span(ng-if="!item.isEditing") {{item.login.username}}
td(data-title="'Option'")
.btn-group.btn-group-xs
span.btn.btn-default(ng-click="delete(item)")
span.glyphicon.glyphicon-trash

View File

@ -1,45 +0,0 @@
'use strict';
angular.module('warehost')
.controller('PermissionWebCtrl',function(session,config,alert,NgTableParams,$scope,$rootScope,$http,$stateParams){
$scope.tableParams = new NgTableParams({
sorting: { 'login.username': 'asc' },
total: 0,
count: config.table.count
}, { dataset: [] });
alert.set({});
$scope.obj = {};
$scope.loginlist = [];
function resetObj(){
$scope.obj = {};
}
function load(){
$http.get(config.api+'/user').then(function(res){
$scope.loginlist = res.data.data;
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/permission').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();
$rootScope.$on('warehost.session',load);
$scope.delete = function(a){
$http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/permission/'+a.login.ID).then(submitresult);
};
$scope.add = function(){
$http.post(config.api+'/web/website/'+$stateParams.websiteid+'/permission/'+$scope.obj.login.ID,{}).then(submitresult);
};
});

View File

@ -1,46 +0,0 @@
script#nodes_renderer(type="text/ng-template")
div(ui-tree-handle)
a.btn.btn-defualt.btn-xs(ng-if="node.children && node.children.length > 0",data-nodrag,ng-click="toggle(this)")
span.glyphicon(ng-class="{'glyphicon-menu-right': collapsed,'glyphicon-menu-down': !collapsed}")
| (\#{{node.ID}}) {{node.name}}
.pull-right.btn-group.btn-group-xs(data-nodrag)
a.btn.btn-default(data-nodrag,ng-click="add(this)")
span.glyphicon.glyphicon-plus
a.btn.btn-default(data-nodrag,ng-click="edit(this)")
span.glyphicon.glyphicon-pencil
a.btn.btn-default(data-nodrag,ng-click="delete(this)")
span.glyphicon.glyphicon-remove
.list-group(ui-tree-nodes,ng-model="node.children",ng-class="{hidden: collapsed}")
.list-group-item(ui-tree-node,ng-repeat="node in node.children",ng-include="'nodes_renderer'")
.container
h1 Menu
.row
.well.col-md-6(ui-tree)
.btn-toolbar
.btn-group
a.btn.btn-default(ng-click="$broadcast('angular-ui-tree:collapse-all')")
span.glyphicon.glyphicon-chevron-right
a.btn.btn-default(ng-click="$broadcast('angular-ui-tree:expand-all')")
span.glyphicon.glyphicon-chevron-down
.btn-group
a.btn.btn-default(ng-click="add(null)")
span.glyphicon.glyphicon-plus
br
.list-group(ui-tree-nodes,data-ui-tree="treeOptions",ng-model="data")
.list-group-item(ui-tree-node,ng-repeat="node in data",ng-include="'nodes_renderer'")
form.col-md-6(ng-submit="save()")
h3(ng-if="obj.ID") Edit
h3(ng-if="!obj.ID") New
.form-group(ng-if="parent")
label Under Parent
input.form-control(id="name",ng-model="parent.name",readonly)
.form-group
label(for="name") Name
input.form-control(id="name",ng-model="obj.name")
.form-group
label Link to:
ui-select(ng-model="obj.url",theme="bootstrap")
ui-select-match http(s)://DOMAIN/{{$select.selected.path}}
ui-select-choices(repeat="item in urllist | filter:$select.search")
div {{item.type.toUpperCase()}}: http(s)://DOMAIN/{{ item.path }}
input.btn.btn-default(type="submit",value="Save")

View File

@ -1,85 +0,0 @@
'use strict';
angular.module('warehost')
.controller('WebmenuWebCtrl',function(session,config,alert,$scope,$rootScope,$stateParams,$http){
$scope.data = [];
$scope.urllist = [];
alert.set({});
$scope.treeOptions = {
accept: function(){
return true;
},
beforeDrop: function (){
return true;
},
dropped: function(e){
$scope.obj = e.source.nodeScope.$modelValue;
$scope.obj.position = e.dest.index;
if(e.dest.nodesScope.$nodeScope){
$scope.obj.parentid = e.dest.nodesScope.$nodeScope.$modelValue.ID;
}else{
$scope.obj.parentid = null;
}
$http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/menu/'+$scope.obj.ID,$scope.obj).then(submitresult);
}
};
function load() {
$scope.urllist = [];
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/page').then(function(res){
res.data.data.forEach(function (d) {
var url = d.url;
url.type = 'page';
url.obj = d;
url.obj.url = null;
$scope.urllist.push(url);
});
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/blog').then(function(res){
res.data.data.forEach(function (d) {
var url = d.url;
url.type = 'blog';
url.obj = d;
url.obj.url = null;
$scope.urllist.push(url);
});
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/menu').then(function(res){
session.set(res);
$scope.data = res.data.data;
});
});
});
}
function submitresult(res){
session.set(res);
alert.set(res);
if(res.data.data){
load();
}
}
load();
$rootScope.$on('warehost.session',load);
$scope.edit = function(a){
$scope.obj = a.$modelValue;
};
$scope.save = function(){
if($scope.obj.ID){
$http.patch(config.api+'/web/website/'+$stateParams.websiteid+'/menu/'+$scope.obj.ID,$scope.obj).then(submitresult);
}else{
$http.post(config.api+'/web/website/'+$stateParams.websiteid+'/menu',$scope.obj).then(submitresult);
}
};
$scope.delete = function(a){
$http.delete(config.api+'/web/website/'+$stateParams.websiteid+'/menu/'+a.$modelValue.ID).then(submitresult);
};
$scope.add = function(a){
$scope.obj = {};
if(a){
$scope.obj.parentid = a.$modelValue.ID;
$scope.parent = a.$modelValue;
}else{
$scope.parent = null;
}
};
});

View File

@ -82,15 +82,6 @@
<script src="app/main.js"></script>
<script src="app/setting.js"></script>
<script src="app/user.js"></script>
<script src="app/web/blog.js"></script>
<script src="app/web/blogpost.js"></script>
<script src="app/web/domain.js"></script>
<script src="app/web/index.js"></script>
<script src="app/web/list.js"></script>
<script src="app/web/menu.js"></script>
<script src="app/web/page.js"></script>
<script src="app/web/permission.js"></script>
<script src="app/web/webmenu.js"></script>
<script src="components/alert.js"></script>
<script src="components/config.js"></script>
<script src="components/session.js"></script>