[TASK] [web] switch model url binding
This commit is contained in:
parent
521949bcb0
commit
e7dc403ddc
|
@ -15,10 +15,13 @@
|
||||||
td(data-title="'#'") {{item.website.ID}}
|
td(data-title="'#'") {{item.website.ID}}
|
||||||
td(data-title="'Name'")
|
td(data-title="'Name'")
|
||||||
span(ng-if="!item.isEditing") {{item.website.name}}
|
span(ng-if="!item.isEditing") {{item.website.name}}
|
||||||
form(name="myform",ng-if="item.isEditing")
|
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)}")
|
.form-group(ng-class="{'has-error': (error.fields.indexOf('name') >= 0 || !myform.name.$valid)}")
|
||||||
label(for="name") Name
|
label(for="name") Name
|
||||||
input.form-control(id="name",name="name",ng-model="item.website.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'")
|
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})")
|
a.btn.btn-default(ui-sref="app.webS.page({websiteid:item.website.ID})")
|
||||||
|
@ -26,7 +29,6 @@
|
||||||
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")
|
||||||
span.glyphicon.glyphicon-remove-circle
|
span.glyphicon.glyphicon-floppy-disk
|
||||||
span.btn.btn-default(ng-click="delete(item)")
|
span.btn.btn-default(ng-click="delete(item)")
|
||||||
span.glyphicon.glyphicon-trash
|
span.glyphicon.glyphicon-trash
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,10 @@
|
||||||
label(for="title") Title
|
label(for="title") Title
|
||||||
input.form-control(id="title",ng-model="obj.title")
|
input.form-control(id="title",ng-model="obj.title")
|
||||||
.form-group
|
.form-group
|
||||||
label Under Menu
|
label(for="url") URL
|
||||||
i (http(s)://PLACEHOLDER/{{obj.menu.url}})
|
br
|
||||||
ui-select(ng-model="obj.menu",theme="bootstrap")
|
i (http(s)://DOMAIN/{{obj.url.path}})
|
||||||
ui-select-match {{$select.selected.name}}
|
input.form-control(id="url",ng-model="obj.url.path")
|
||||||
ui-select-choices(repeat="item in menulist | filter:$select.search")
|
|
||||||
div(ng-bind-html="item.name | highlight: $select.search")
|
|
||||||
.form-group
|
.form-group
|
||||||
label(for="content") Content
|
label(for="content") Content
|
||||||
textarea.form-control(id="content",markdown-editor="{hiddenButtons:'cmdImage',addExtraButtons: true, resize: 'vertical'}",ng-model="obj.content",rows="10")
|
textarea.form-control(id="content",markdown-editor="{hiddenButtons:'cmdImage',addExtraButtons: true, resize: 'vertical'}",ng-model="obj.content",rows="10")
|
||||||
|
|
|
@ -11,13 +11,10 @@ angular.module('warehost')
|
||||||
$scope.obj = {};
|
$scope.obj = {};
|
||||||
}
|
}
|
||||||
function load(){
|
function load(){
|
||||||
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/menu/list').then(function(res){
|
|
||||||
$scope.menulist = res.data.data;
|
|
||||||
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/page').then(function(res){
|
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/page').then(function(res){
|
||||||
session.set(res);
|
session.set(res);
|
||||||
$scope.data = res.data.data;
|
$scope.data = res.data.data;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function submitresult(res){
|
function submitresult(res){
|
||||||
session.set(res);
|
session.set(res);
|
||||||
|
|
|
@ -38,7 +38,9 @@ script#nodes_renderer(type="text/ng-template")
|
||||||
label(for="name") Name
|
label(for="name") Name
|
||||||
input.form-control(id="name",ng-model="obj.name")
|
input.form-control(id="name",ng-model="obj.name")
|
||||||
.form-group
|
.form-group
|
||||||
label(for="shortUrl") URL
|
label Link to:
|
||||||
i (http(s)://PLACEHOLDER/{{obj.url}})
|
ui-select(ng-model="obj.url",theme="bootstrap")
|
||||||
input.form-control(id="shortUrl",ng-model="obj.url")
|
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")
|
input.btn.btn-default(type="submit",value="Save")
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
angular.module('warehost')
|
angular.module('warehost')
|
||||||
.controller('WebmenuWebCtrl',function(session,config,alert,$scope,$rootScope,$stateParams,$http){
|
.controller('WebmenuWebCtrl',function(session,config,alert,$scope,$rootScope,$stateParams,$http){
|
||||||
$scope.data = [];
|
$scope.data = [];
|
||||||
|
$scope.urllist = [];
|
||||||
alert.set({});
|
alert.set({});
|
||||||
|
|
||||||
$scope.treeOptions = {
|
$scope.treeOptions = {
|
||||||
|
@ -25,10 +26,20 @@ angular.module('warehost')
|
||||||
};
|
};
|
||||||
|
|
||||||
function load() {
|
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+'/menu').then(function(res){
|
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/menu').then(function(res){
|
||||||
session.set(res);
|
session.set(res);
|
||||||
$scope.data = res.data.data;
|
$scope.data = res.data.data;
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function submitresult(res){
|
function submitresult(res){
|
||||||
session.set(res);
|
session.set(res);
|
||||||
|
|
Reference in New Issue