diff --git a/imgbook/config/app.php b/imgbook/config/app.php index 2f1cf7c..28fcaa2 100644 --- a/imgbook/config/app.php +++ b/imgbook/config/app.php @@ -13,7 +13,7 @@ | */ - 'name' => env('APP_NAME', 'ImgBook'), + 'name' => env('APP_NAME', 'Imgbook'), /* |-------------------------------------------------------------------------- diff --git a/imgbook/public/js/app.js b/imgbook/public/js/app.js index 42f5521..14a4f3f 100644 --- a/imgbook/public/js/app.js +++ b/imgbook/public/js/app.js @@ -1855,6 +1855,16 @@ __webpack_require__.r(__webpack_exports__); // // // +// +// +// +// +// +// +// +// +// +// /* harmony default export */ __webpack_exports__["default"] = ({ props: ['postId', 'userId'], data: function data() { @@ -1877,6 +1887,7 @@ __webpack_require__.r(__webpack_exports__); //success _this.comments = response.data; _this.newComment = ''; + console.log(response.data); })["catch"](function (response) { //failure console.log(response); @@ -37328,63 +37339,95 @@ var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h - return _c("div", { attrs: { id: "root" } }, [ - _vm._v("\n " + _vm._s(_vm.commentMessage) + "\n \n "), - _c("input", { - directives: [ - { - name: "model", - rawName: "v-model", - value: _vm.newComment, - expression: "newComment" - } - ], - attrs: { type: "text", id: "input" }, - domProps: { value: _vm.newComment }, - on: { - input: function($event) { - if ($event.target.composing) { - return - } - _vm.newComment = $event.target.value - } - } - }), - _vm._v(" "), - _c("button", { on: { click: _vm.createComment } }, [ - _vm._v(_vm._s(_vm.changeOrPost)) - ]), - _vm._v("\n\n Comments:\n "), - _c( - "ul", + return _c( + "div", + { attrs: { id: "root" } }, + [ + _c("div", { staticClass: "form-group" }, [ + _c("label", [_c("b", [_vm._v(_vm._s(_vm.commentMessage))])]), + _vm._v(" "), + _c("div", { staticClass: "input-group" }, [ + _c("input", { + directives: [ + { + name: "model", + rawName: "v-model", + value: _vm.newComment, + expression: "newComment" + } + ], + staticClass: "form-control", + attrs: { + type: "textarea", + name: "text", + placeholder: "Enter a comment" + }, + domProps: { value: _vm.newComment }, + on: { + input: function($event) { + if ($event.target.composing) { + return + } + _vm.newComment = $event.target.value + } + } + }), + _vm._v(" "), + _c( + "button", + { + staticClass: "btn btn-primary", + on: { click: _vm.createComment } + }, + [_vm._v(_vm._s(_vm.changeOrPost))] + ) + ]) + ]), + _vm._v(" "), + _c("hr"), + _vm._v(" "), _vm._l(_vm.comments, function(comment) { - return _c("li", { key: comment.id }, [ - _vm._v( - "\n " + - _vm._s(comment.user.username) + - " -- " + - _vm._s(comment.text) + - "\n " - ), - comment.user.id == _vm.userId - ? _c( - "button", - { - attrs: { id: "editButton" }, - on: { - click: function($event) { - return _vm.editCommentButton(comment) - } - } - }, - [_vm._v("Edit")] - ) - : _vm._e() + return _c("div", { key: comment.id }, [ + _c("h4", { staticClass: "media-heading user_name" }, [ + _vm._v(_vm._s(comment.user.username)) + ]), + _vm._v(" "), + _c("p", [_c("small", [_vm._v(_vm._s(comment.updated_at))])]), + _vm._v(" "), + _c("div", { staticClass: "container" }, [ + _c("div", { staticClass: "row" }, [ + _c("div", { staticClass: "col" }, [ + _vm._v( + "\n " + + _vm._s(comment.text) + + "\n " + ) + ]), + _vm._v(" "), + _c("div", { staticClass: "col-md-auto" }, [ + comment.user.id == _vm.userId + ? _c( + "button", + { + staticClass: "btn btn-primary pull-right", + attrs: { id: "editButton" }, + on: { + click: function($event) { + return _vm.editCommentButton(comment) + } + } + }, + [_vm._v("Edit")] + ) + : _vm._e() + ]) + ]) + ]) ]) - }), - 0 - ) - ]) + }) + ], + 2 + ) } var staticRenderFns = [] render._withStripped = true @@ -49720,8 +49763,8 @@ __webpack_require__.r(__webpack_exports__); /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(/*! /home/vagrant/laravel/testsite/resources/js/app.js */"./resources/js/app.js"); -module.exports = __webpack_require__(/*! /home/vagrant/laravel/testsite/resources/sass/app.scss */"./resources/sass/app.scss"); +__webpack_require__(/*! /home/vagrant/laravel/laravel-web-app/imgbook/resources/js/app.js */"./resources/js/app.js"); +module.exports = __webpack_require__(/*! /home/vagrant/laravel/laravel-web-app/imgbook/resources/sass/app.scss */"./resources/sass/app.scss"); /***/ }) diff --git a/imgbook/resources/js/components/CommentComponent.vue b/imgbook/resources/js/components/CommentComponent.vue index fd97758..afbed3b 100644 --- a/imgbook/resources/js/components/CommentComponent.vue +++ b/imgbook/resources/js/components/CommentComponent.vue @@ -1,17 +1,28 @@ @@ -37,6 +48,7 @@ //success this.comments = response.data; this.newComment = ''; + console.log(response.data); }) .catch(response => { //failure diff --git a/imgbook/resources/views/layouts/app.blade.php b/imgbook/resources/views/layouts/app.blade.php index 9b58777..60dd6e0 100644 --- a/imgbook/resources/views/layouts/app.blade.php +++ b/imgbook/resources/views/layouts/app.blade.php @@ -22,7 +22,7 @@
- @yield('title') - @if (session('message')) -

{{ session('message')}}

- @endif - @if ($errors->any()) -
- Errors: -
    - @foreach ($errors->all() as $error) -
  • {{ $error}}
  • - @endforeach -
+
+
+

@yield('title')

+ @yield('back') + @if (session('message')) +
 
{{-- add single space --}} +
+ {{ session('message')}} + × +
+ @endif + @if ($errors->any()) +
 
{{-- add single space --}} +
+ Errors: +
    + @foreach ($errors->all() as $error) +
  • {{ $error}}
  • + @endforeach +
+
+ @endif +
- @endif +
 
{{-- add single space --}} @yield('content')
diff --git a/imgbook/resources/views/posts/create.blade.php b/imgbook/resources/views/posts/create.blade.php index 30a9fad..7ffa98f 100644 --- a/imgbook/resources/views/posts/create.blade.php +++ b/imgbook/resources/views/posts/create.blade.php @@ -7,28 +7,48 @@ @endif @section('content') - @if ($update) -
- @csrf -

Title:

-

Description:

- - Cancel -
- -
- @else -
- @csrf -

Title:

- -

Description:

- - Cancel -
- @endif +
+
+ @if ($update) +
+ Warning! +
+ To change the picture please delete the post and repost it. +
+
+ @csrf +
+ + +
+
+ + +
+ + Cancel +
 
{{-- add single space --}} + +
+ @else +
+ @csrf +
+ + +
+
+ + +
+
+ + +
+ + Cancel +
+ @endif +
+
@endsection \ No newline at end of file diff --git a/imgbook/resources/views/posts/show.blade.php b/imgbook/resources/views/posts/show.blade.php index e256e85..e160171 100644 --- a/imgbook/resources/views/posts/show.blade.php +++ b/imgbook/resources/views/posts/show.blade.php @@ -2,30 +2,45 @@ @section('title', 'Post details') -@section('content') - - - @if ($post->user_id == $user_id) -
- @csrf - @method('DELETE') - -
-
- @csrf - -
- @endif - +@section('back') +Back +@stop -

Back

+@section('content') +
+
+
+ +
+ +
+
+ Posted by: {{ $post->user->username }} +
{{ $post->title }}
+
+ @if ($post->user_id == $user_id) +
+
+ @csrf + +
+
+
+
+ @csrf + @method('DELETE') + +
+ @endif +
+
- id}} :user-id={{Auth::user()->id}}> +

{{ $post->description }}

+ id}} :user-id={{Auth::user()->id}}> +
+
+
+
@endsection \ No newline at end of file