diff --git a/Gruntfile.js b/Gruntfile.js index 815abe9..9c82fd1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -253,6 +253,14 @@ module.exports = function (grunt) { '*.*' ] }, + { + expand: true, + cwd: 'public/bower_components/font-awesome/fonts', + dest: 'build/fonts', + src: [ + '*.*' + ] + }, { expand: true, cwd: '.tmp/img', diff --git a/public/app/web/blog.jade b/public/app/web/blog.jade index df8e7ba..9f89d20 100644 --- a/public/app/web/blog.jade +++ b/public/app/web/blog.jade @@ -23,9 +23,33 @@ 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 + 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)") diff --git a/public/app/web/blog.js b/public/app/web/blog.js index 4989c4b..83fc775 100644 --- a/public/app/web/blog.js +++ b/public/app/web/blog.js @@ -2,6 +2,10 @@ 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 = {}; @@ -16,17 +20,21 @@ angular.module('warehost') resetBlog(); $scope.bloglist = res.data.data; var blog; - for(blog in $scope.bloglist){ - if(blog.ID === $stateParams.blogid) { - $scope.blog = 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'){ - $scope.blog = $scope.bloglist[0]; + $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); diff --git a/public/app/web/blogpost.jade b/public/app/web/blogpost.jade index b6369c5..0000543 100644 --- a/public/app/web/blogpost.jade +++ b/public/app/web/blogpost.jade @@ -1,31 +1,46 @@ h2 Posts .row - .well.col-md-3 - .btn-toolbar - .btn-group - a.btn.btn-default(ng-click="add()") + .col-md-3 + .panel.panel-default + .panel-heading All + a.pull-right.btn.btn-default.btn-xs(ng-click="add()") span.glyphicon.glyphicon-plus - br - .list-group - .list-group-item(ng-repeat="item in data") - .angular-ui-tree-handle {{item.title}} - .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 + 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="obj.ID") Edit - h3(ng-if="!obj.ID") New + 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="obj.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="url") URL - br - i (http(s)://DOMAIN/{{obj.url.path}}) - input.form-control(id="url",ng-model="obj.url.path") + 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="obj.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") diff --git a/public/app/web/blogpost.js b/public/app/web/blogpost.js new file mode 100644 index 0000000..c4fc40d --- /dev/null +++ b/public/app/web/blogpost.js @@ -0,0 +1,45 @@ +'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); + }; + }); diff --git a/public/app/web/index.js b/public/app/web/index.js index dda42e4..f5676b6 100644 --- a/public/app/web/index.js +++ b/public/app/web/index.js @@ -64,7 +64,7 @@ angular.module('warehost') views:{ 'posts':{ templateUrl: 'app/web/blogpost.html', - controller:'BlogWebCtrl' + controller:'BlogPostWebCtrl' } } }) diff --git a/public/app/web/page.jade b/public/app/web/page.jade index 30783f7..66395ed 100644 --- a/public/app/web/page.jade +++ b/public/app/web/page.jade @@ -4,7 +4,7 @@ .row .col-md-3 .panel.panel-default - .panel-heading Pages + .panel-heading All a.pull-right.btn.btn-default.btn-xs(ng-click="add()") span.glyphicon.glyphicon-plus table.table diff --git a/public/app/web/webmenu.js b/public/app/web/webmenu.js index d5bc233..554a676 100644 --- a/public/app/web/webmenu.js +++ b/public/app/web/webmenu.js @@ -35,9 +35,18 @@ angular.module('warehost') 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; + $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; + }); }); }); } diff --git a/public/components/config.js b/public/components/config.js index 582a254..8fc7b42 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://api.warehost.de', table: { count: 25 } diff --git a/public/index.html b/public/index.html index beb2d03..3d90ea6 100644 --- a/public/index.html +++ b/public/index.html @@ -7,7 +7,7 @@ - Warehost v2 + Warehost @@ -22,7 +22,7 @@ - + @@ -77,6 +77,7 @@ +