Implemented the category composer for header in shop bundle and removed some bugs

This commit is contained in:
prashant-webkul 2018-07-30 19:51:06 +05:30
parent 1442733f30
commit 9de89a319d
17 changed files with 115 additions and 239 deletions

View File

@ -10,23 +10,13 @@ use Webkul\Ui\DataGrid\Facades\DataGrid;
class UserComposer
{
/**
* The user repository implementation.
* The Data Grid implementation.
*
* @var UserRepository
* @var UserComposer
* for admin
*/
protected $users;
/**
* Create a new profile composer.
*
* @param UserRepository $users
* @return void
*/
// public function __construct(UserRepository $users)
// {
// // Dependencies automatically resolved by service container...
// $this->users = $users;
// }
/**
* Bind data to the view.

View File

@ -20,7 +20,7 @@ Route::group(['middleware' => ['web']], function () {
Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
'redirect' => 'customer.account.profile',
])->name('customer.register.create');
])->name('customer.register.create'); //redirect attribute will get changed immediately to account.index when account's index page will be made
// Auth Routes
Route::group(['middleware' => ['customer']], function () {
@ -33,12 +33,12 @@ Route::group(['middleware' => ['web']], function () {
//customer account
Route::prefix('account')->group(function () {
Route::get('profile', 'Webkul\Customer\Http\Controllers\CustomerController@profile')->defaults('_config', [
'view' => 'shop::customers.profile.home.index'
'view' => 'shop::customers.account.profile.home.index'
])->name('customer.account.profile');
//profile edit
Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@editProfile')->defaults('_config', [
'view' => 'shop::customers.profile.edit.index'
'view' => 'shop::customers.account.profile.edit.index'
])->name('customer.profile.edit');
});
});

View File

@ -27,10 +27,6 @@ class CustomerServiceProvider extends ServiceProvider
$this->composeView();
Blade::directive('continue', function () {
return "<?php continue; ?>";
});
$this->app->register(EventServiceProvider::class);
}
@ -46,7 +42,7 @@ class CustomerServiceProvider extends ServiceProvider
protected function composeView()
{
view()->composer(['shop::customers.profile.partials.sidemenu'], function ($view) {
view()->composer(['shop::customers.account.partials.sidemenu'], function ($view) {
$menu = current(Event::fire('customer.menu.create'));
$view->with('menu', $menu);

View File

@ -1,6 +0,0 @@
$sign-up-text-color: #5e5e5e;
$login-text: #3a3a3a;
$background-color: #ffffff;
$border-color: #ffe8e8e8;
$forgot-password-color: #0031f0;
$profile-content-color: #5e5e5e;

View File

@ -1,162 +0,0 @@
@import "mixins";
@import "variables";
.content {
padding-top: 15%;
padding-bottom: 15%;
.sign-up-text {
margin-bottom: 2%;
margin-left: auto;
margin-right: auto;
text-align: center;
font-size: 18px;
color: $sign-up-text-color;
letter-spacing: -0.29px;
text-align: center;
}
.login-form {
margin-left: auto;
margin-right: auto;
display: flex;
background: $background-color;
border: 1px solid $border-color;
flex-direction: column;
max-width: 530px;
min-width: 380px;
min-height: 345px;
padding-left: 25px;
padding-right: 25px;
.login-text {
font-size: 24px;
font-weight: bold;
color: $login-text;
letter-spacing: -0.23px;
margin-top: 5%;
margin-bottom: 3%;
}
.control-group {
margin-bottom: 15px !important;
.control {
width: 100% !important;
}
}
.forgot-password-link {
font-size: 17px;
color: $forgot-password-color;
letter-spacing: -0.11px;
margin-bottom: 5%;
}
.signup-confirm {
letter-spacing: -0.11px;
margin-bottom: 5%;
}
.btn-primary {
width: 100%;
text-transform: uppercase;
border-radius: 0px;
height: 45px;
margin-bottom: 4%;
}
}
}
.dashboard-content {
width: 100%;
display: flex;
flex-direction: row;
// border: 1px solid red;
margin-top: 5.5%;
margin-bottom: 5.5%;
.dashboard-side-menu {
display: flex;
flex-direction: column;
align-content: center;
justify-content: flex-start;
border: 1px solid #e8e8e8;
background: #ffffff;
width: 25%;
height: 100%;
text-transform: capitalize;
font-size: 16px;
color: #5e5e5e;
li {
font-size: 16px;
width: 100%;
height: 50px;
margin-left: 15px;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
// border: 1px solid $border-color;
// border-left: none;
// border-bottom: none;
border-bottom: 1px solid $border-color;
text-align: center;
}
li:first-child {
border-top: none;
}
li:last-child {
border-bottom: none;
}
}
.profile {
margin-left: 5.5%;
margin-top: 1%;
width: 100%;
.section-head {
// height: 50px;
.profile-heading {
font-size: 28px;
color: #242424;
text-transform: capitalize;
text-align: left;
}
.profile-edit {
font-size: 17px;
margin-top: 1%;
color: #0031f0;
letter-spacing: -0.11px;
float: right;
}
.horizontal-rule {
margin-top: 1.1%;
width: 100%;
height: 1px;
vertical-align: middle;
background: #e8e8e8;
}
}
}
.profile-content {
font-size: 16px;
color: $profile-content-color;
margin-top: 1.4%;
table {
tbody {
tr {
height: 45px;
td {
width: 250px;
}
}
}
}
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Webkul\Shop\Http\ViewComposers\Categories;
use Illuminate\View\View;
use Illuminate\Support\Collection;
use Webkul\Category\Repositories\CategoryRepository as Category;
class CategoryComposer
{
/**
* The category implementation.
*
* for shop bundle's navigation
* menu
*/
protected $category;
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function __construct(Category $category)
{
$this->category = $category;
}
public function compose(View $view)
{
$collected_cat = array();
$categories = $this->category->getCategoryTree();
foreach ($categories as $category) {
array_push($collected_cat, collect($category));
}
dd(count($collected_cat[0]['children']));
$view->with('categories', $collected_cat);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Webkul\Shop\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use View;
class ComposerServiceProvider extends ServiceProvider
{
/**
* Register bindings in the container.
*
* @return void
*/
public function boot()
{
//using the class based composers...
View::composer('shop::store.header.index', 'Webkul\Shop\Http\ViewComposers\Categories\CategoryComposer');
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
}
}

View File

@ -6,6 +6,7 @@ use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Blade;
use Webkul\Shop\Providers\ComposerServiceProvider;
// use Webkul\Shop\Providers\EventServiceProvider;
@ -32,7 +33,7 @@ class ShopServiceProvider extends ServiceProvider
return "<?php continue; ?>";
});
// $this->app->register(EventServiceProvider::class);
$this->app->register(ComposerServiceProvider::class);
}
/**

View File

@ -30,6 +30,7 @@ $(window).resize(function() {
$(document).ready(function() {
Vue.component("image-slider", require("./components/imageSlider.vue"));
// Vue.component("nav-view", require("./components/navVue.vue"));
/* Responsiveness script goes here */
var w = $(document).width();
var window = {};

View File

@ -1,7 +1,7 @@
@extends('shop::store.layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.profile.partials.sidemenu')
@include('shop::customers.account.partials.sidemenu')
<div class="edit-form-content">
<div class="edit-text">Edit Profile</div>
<form method="post" action="{{ route('customer.register.create') }}">

View File

@ -1,7 +1,7 @@
@extends('shop::store.layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.profile.partials.sidemenu')
@include('shop::customers.account.partials.sidemenu')
<div class="profile">
<div class="section-head">
<span class="profile-heading">Profile</span>

View File

@ -2,6 +2,9 @@
<div class="header-top">
<div class="left-content">
<ul class="logo-container">
{{-- @for($i=0;$i<sizeof($categories);$i++)
{{ $categories[$i] }}
@endfor --}}
<li>
<a href="">
<img class="logo" src="vendor/webkul/shop/assets/images/logo.svg" />
@ -55,16 +58,6 @@
</div>
</div>
<div class="header-bottom">
<ul class="menu-bar">
<li>Men</li>
<li>Women</li>
<li>Kids</li>
<li>Accessories</li>
<li>Home & Living</li>
<li>
<img class="icon" src="vendor/webkul/shop/assets/images/offer-zone.svg" style="margin-right:5px;" />Offer
Zone
</li>
</ul>
@include('shop::store.header.nav-menu.navmenu')
</div>
</div>

View File

@ -0,0 +1,11 @@
<ul class="menu-bar">
<li>Men</li>
<li>Women</li>
<li>Kids</li>
<li>Accessories</li>
<li>Home & Living</li>
<li>
<img class="icon" src="vendor/webkul/shop/assets/images/offer-zone.svg" style="margin-right:5px;" />Offer Zone
</li>
<nav-view></nav-view>
</ul>

View File

@ -1,17 +1,3 @@
<section class="slider-block">
{{-- <div class="slider-content">
<ul class="slider-images">
@for($i=0;$i<1;$i++)
<li data-slider-id="{{ $i }}">
<img class="slider-item" src="vendor/webkul/shop/assets/images/banner.png" />
</li>
@endfor
<div class="slider-control">
<span class="icon dark-left-icon slider-left"></span>
<span class="icon light-right-icon slider-right"></span>
</div>
</ul>
</div> --}}
<image-slider></image-slider>
</section>

View File

@ -95,7 +95,7 @@ module.exports = g;
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(2);
module.exports = __webpack_require__(9);
module.exports = __webpack_require__(13);
/***/ }),
@ -133,7 +133,8 @@ $(window).resize(function () {
});
$(document).ready(function () {
Vue.component("image-slider", __webpack_require__(14));
Vue.component("image-slider", __webpack_require__(9));
// Vue.component("nav-view", require("./components/navVue.vue"));
/* Responsiveness script goes here */
var w = $(document).width();
var window = {};
@ -28970,24 +28971,14 @@ var index_esm = {
/***/ }),
/* 9 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 10 */,
/* 11 */,
/* 12 */,
/* 13 */,
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
var disposed = false
var normalizeComponent = __webpack_require__(19)
var normalizeComponent = __webpack_require__(10)
/* script */
var __vue_script__ = __webpack_require__(20)
var __vue_script__ = __webpack_require__(11)
/* template */
var __vue_template__ = __webpack_require__(21)
var __vue_template__ = __webpack_require__(12)
/* template functional */
var __vue_template_functional__ = false
/* styles */
@ -29026,11 +29017,7 @@ module.exports = Component.exports
/***/ }),
/* 15 */,
/* 16 */,
/* 17 */,
/* 18 */,
/* 19 */
/* 10 */
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
@ -29139,7 +29126,7 @@ module.exports = function normalizeComponent (
/***/ }),
/* 20 */
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -29185,7 +29172,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
});
/***/ }),
/* 21 */
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
var render = function() {
@ -29225,5 +29212,11 @@ if (false) {
}
}
/***/ }),
/* 13 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);