[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="'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)}")
|
||||
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.page({websiteid:item.website.ID})")
|
||||
|
@ -26,7 +29,6 @@
|
|||
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-remove-circle
|
||||
span.glyphicon.glyphicon-floppy-disk
|
||||
span.btn.btn-default(ng-click="delete(item)")
|
||||
span.glyphicon.glyphicon-trash
|
||||
|
||||
|
|
|
@ -22,12 +22,10 @@
|
|||
label(for="title") Title
|
||||
input.form-control(id="title",ng-model="obj.title")
|
||||
.form-group
|
||||
label Under Menu
|
||||
i (http(s)://PLACEHOLDER/{{obj.menu.url}})
|
||||
ui-select(ng-model="obj.menu",theme="bootstrap")
|
||||
ui-select-match {{$select.selected.name}}
|
||||
ui-select-choices(repeat="item in menulist | filter:$select.search")
|
||||
div(ng-bind-html="item.name | highlight: $select.search")
|
||||
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
|
||||
textarea.form-control(id="content",markdown-editor="{hiddenButtons:'cmdImage',addExtraButtons: true, resize: 'vertical'}",ng-model="obj.content",rows="10")
|
||||
|
|
|
@ -11,12 +11,9 @@ angular.module('warehost')
|
|||
$scope.obj = {};
|
||||
}
|
||||
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){
|
||||
session.set(res);
|
||||
$scope.data = res.data.data;
|
||||
});
|
||||
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/page').then(function(res){
|
||||
session.set(res);
|
||||
$scope.data = res.data.data;
|
||||
});
|
||||
}
|
||||
function submitresult(res){
|
||||
|
|
|
@ -38,7 +38,9 @@ script#nodes_renderer(type="text/ng-template")
|
|||
label(for="name") Name
|
||||
input.form-control(id="name",ng-model="obj.name")
|
||||
.form-group
|
||||
label(for="shortUrl") URL
|
||||
i (http(s)://PLACEHOLDER/{{obj.url}})
|
||||
input.form-control(id="shortUrl",ng-model="obj.url")
|
||||
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")
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
angular.module('warehost')
|
||||
.controller('WebmenuWebCtrl',function(session,config,alert,$scope,$rootScope,$stateParams,$http){
|
||||
$scope.data = [];
|
||||
$scope.urllist = [];
|
||||
alert.set({});
|
||||
|
||||
$scope.treeOptions = {
|
||||
|
@ -24,10 +25,20 @@ angular.module('warehost')
|
|||
}
|
||||
};
|
||||
|
||||
function load(){
|
||||
$http.get(config.api+'/web/website/'+$stateParams.websiteid+'/menu').then(function(res){
|
||||
session.set(res);
|
||||
$scope.data = res.data.data;
|
||||
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){
|
||||
session.set(res);
|
||||
$scope.data = res.data.data;
|
||||
});
|
||||
});
|
||||
}
|
||||
function submitresult(res){
|
||||
|
|
Reference in New Issue