Skip to content

Commit

Permalink
Create production assets
Browse files Browse the repository at this point in the history
  • Loading branch information
mckenziearts committed May 4, 2019
2 parents c8ffbe3 + cf5b7de commit c00098a
Show file tree
Hide file tree
Showing 17 changed files with 268 additions and 9,083 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/vendor
composer.lock
package-lock.json
yarn.lock
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to `Shopper` will be documented in this file.

## version 1.1.3
- Security release

## Changed
- Load custom css and js to admin dashboard
- Update jQuery version

## Version 1.1.2
### Changed
- Return index Lists of Model by last created
Expand Down
8,941 changes: 0 additions & 8,941 deletions package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"bootstrap-tagsinput": "^0.7",
"element-react": "^1.4.24",
"element-theme-default": "^1.4.13",
"jquery": "^3.3.1",
"jquery": ">=3.4.0",
"lang.js": "^1.1.14",
"laravel-file-manager": "^2.1.4",
"laravel-mix": "^4.0.7",
Expand Down
2 changes: 1 addition & 1 deletion public/css/login.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions public/css/login.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/shopper.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/shopper.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"/js/login.js": "/js/login.js?id=4582565fbd468d95e68e",
"/css/login.css": "/css/login.css?id=d5210ae8b9e982a48aa2",
"/js/login.js": "/js/login.js?id=0ead881a9e848c53d468",
"/css/login.css": "/css/login.css?id=bcece9b51815964b959b",
"/css/shopper.css": "/css/shopper.css?id=09fa142477d7a67721b5",
"/js/shopper.js": "/js/shopper.js?id=63751ae37466661da603"
"/js/shopper.js": "/js/shopper.js?id=61bf2cbd50dbd9af26a3"
}
156 changes: 79 additions & 77 deletions resources/js/shopper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const messages = window.messages
*/

// Button Menu Sidebar
let buttonMenu = document.getElementById('menu-burger')
const buttonMenu = document.getElementById('menu-burger')

buttonMenu.addEventListener('click', function (event) {
event.preventDefault()
Expand All @@ -48,7 +48,7 @@ buttonMenu.addEventListener('click', function (event) {
})

// Click on tr table record
let trs = document.querySelectorAll('.record-link')
const trs = document.querySelectorAll('.record-link')

trs.forEach((tr) => {
tr.addEventListener('click', function (event) {
Expand All @@ -60,7 +60,7 @@ trs.forEach((tr) => {
})

// Hide alert
let alerts = document.querySelectorAll('.alert')
const alerts = document.querySelectorAll('.alert')

if (alerts.length > 0) {
alerts.forEach((alert) => {
Expand All @@ -87,96 +87,98 @@ function toggleSidebar() {
* Algolia search
* ==============================================================================
*/
let autocomplete = require('autocomplete.js'),
algolia = document.getElementById('algolia'),
algoliaLogo = algolia.getAttribute('data-logo'),
client = algoliasearch(algolia.getAttribute('data-appID'), algolia.getAttribute('data-client-secret')),
products = client.initIndex('shopper_catalogue_products'),
categories = client.initIndex('shopper_catalogue_categories'),
brands = client.initIndex('shopper_catalogue_brands'),
users = client.initIndex('shopper_users')
const algolia = document.getElementById('algolia')
if (algolia) {
const autocomplete = require('autocomplete.js'),
algoliaLogo = algolia.getAttribute('data-logo'),
client = algoliasearch(algolia.getAttribute('data-appID'), algolia.getAttribute('data-client-secret')),
products = client.initIndex('shopper_catalogue_products'),
categories = client.initIndex('shopper_catalogue_categories'),
brands = client.initIndex('shopper_catalogue_brands'),
users = client.initIndex('shopper_users')

autocomplete('#search-input', { hint: false }, [
{
source: autocomplete.sources.hits(products, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Products</h4>',
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value}</span>`
},
empty: function (result) {
return `<span>Sorry no results for ${result.query}</span>`
autocomplete('#search-input', { hint: false }, [
{
source: autocomplete.sources.hits(products, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Products</h4>',
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value}</span>`
},
empty: function (result) {
return `<span>Sorry no results for ${result.query}</span>`
}
}
}
},
{
source: autocomplete.sources.hits(categories, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Categories</h4>',
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value}</span>`
},
empty: function (result) {
return `<span>No categories for the query ${result.query}</span>`
},
{
source: autocomplete.sources.hits(categories, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Categories</h4>',
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value}</span>`
},
empty: function (result) {
return `<span>No categories for the query ${result.query}</span>`
}
}
}
},
{
source: autocomplete.sources.hits(brands, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Brands</h4>',
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value}</span>`
},
empty: function (result) {
return `<span>No brand for the query ${result.query}</span>`
},
{
source: autocomplete.sources.hits(brands, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Brands</h4>',
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value}</span>`
},
empty: function (result) {
return `<span>No brand for the query ${result.query}</span>`
}
}
}
},
{
source: autocomplete.sources.hits(users, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Users</h4>',
footer: `<span class="search-foot">
},
{
source: autocomplete.sources.hits(users, { hitsPerPage: 5 }),
displayKey: 'name',
templates: {
header: '<h4 class="algolia-search-title">Users</h4>',
footer: `<span class="search-foot">
<a href="https://www.algolia.com" target="_blank">
<img src="${algoliaLogo}" width="75" height="25">
</a>
</span>`,
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value +' '+ suggestion.last_name}</span>`
},
empty: function (result) {
return `<span>No users for the query ${result.query}</span>`
suggestion: function(suggestion) {
return `<span>${suggestion._highlightResult.name.value +' '+ suggestion.last_name}</span>`
},
empty: function (result) {
return `<span>No users for the query ${result.query}</span>`
}
}
}
}
]).on('autocomplete:selected', function(event, suggestion, dataset, context) {
switch (dataset) {
case 1:
window.location.href = route('shopper.catalogue.products.edit', {id: suggestion.id})
break
case 2:
window.location.href = route('shopper.catalogue.categories.edit', {id: suggestion.id})
break
case 3:
window.location.href = route('shopper.catalogue.brands.edit', {id: suggestion.id})
break
case 4:
window.location.href = route('shopper.users.edit', {id: suggestion.id})
break
}
})
]).on('autocomplete:selected', function(event, suggestion, dataset, context) {
switch (dataset) {
case 1:
window.location.href = route('shopper.catalogue.products.edit', {id: suggestion.id})
break
case 2:
window.location.href = route('shopper.catalogue.categories.edit', {id: suggestion.id})
break
case 3:
window.location.href = route('shopper.catalogue.brands.edit', {id: suggestion.id})
break
case 4:
window.location.href = route('shopper.users.edit', {id: suggestion.id})
break
}
})
}

/**
* ==============================================================================
* Filemanager
* ==============================================================================
*/
let filemaner = document.getElementById('fm')
const filemaner = document.getElementById('fm')

if (filemaner) {
document.addEventListener('DOMContentLoaded', function() {
Expand Down
20 changes: 19 additions & 1 deletion resources/views/layouts/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
@endif
@stack('css')
<link rel="stylesheet" type="text/css" href="{{ mix('/css/shopper.css', 'shopper') }}">

@if(!empty(config('shopper.resources.stylesheets')))
<!-- Additional CSS -->
@foreach(config('shopper.resources.stylesheets') as $css)
<link rel="stylesheet" type="text/css" href="{{ asset($css) }}">
@endforeach
@endif

</head>
<body>

Expand Down Expand Up @@ -56,7 +64,11 @@
window.messages = @json($messages)
</script>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>

@if (!is_null(env('ALGOLIA_APP_ID')) && !empty(env('ALGOLIA_APP_ID')))
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>
@endif

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"></script>
@if ( request()->route()->getName() === 'shopper.settings.mails.templates.newTemplate' ||
request()->route()->getName() === 'shopper.settings.mails.mailables.editMailable' ||
Expand All @@ -72,6 +84,12 @@
@endif
<script src="{{ mix('/js/shopper.js','shopper')}}" type="text/javascript"></script>
@stack('scripts')
@if(!empty(config('shopper.resources.scripts')))
<!-- Additional Javascript -->
@foreach(config('shopper.resources.scripts') as $js)
<script type="text/javascript" src="{{ asset($js) }}"></script>
@endforeach
@endif

</body>
</html>
71 changes: 48 additions & 23 deletions resources/views/pages/dashboard/_algolia-indices.blade.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['products'] }}</h2>
<p class="card-content">{{ __('Records in products') }}</p>
@if (!is_null(env('ALGOLIA_APP_ID')) && !empty(env('ALGOLIA_APP_ID')))

<div class="algolia-items bg-white">
<div class="algolia-header mb-4">
<h3 class="text-lg font-bold nova-algolia-card-title">
<svg class="nova-algolia-card-title-logo" data-icon="algolia" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path fill="#5468ff" d="M229.3 182.6c-49.3 0-89.2 39.9-89.2 89.2 0 49.3 39.9 89.2 89.2 89.2s89.2-39.9 89.2-89.2c0-49.3-40-89.2-89.2-89.2zm62.7 56.6l-58.9 30.6c-1.8.9-3.8-.4-3.8-2.3V201c0-1.5 1.3-2.7 2.7-2.6 26.2 1 48.9 15.7 61.1 37.1.7 1.3.2 3-1.1 3.7zM389.1 32H58.9C26.4 32 0 58.4 0 90.9V421c0 32.6 26.4 59 58.9 59H389c32.6 0 58.9-26.4 58.9-58.9V90.9C448 58.4 421.6 32 389.1 32zm-202.6 84.7c0-10.8 8.7-19.5 19.5-19.5h45.3c10.8 0 19.5 8.7 19.5 19.5v15.4c0 1.8-1.7 3-3.3 2.5-12.3-3.4-25.1-5.1-38.1-5.1-13.5 0-26.7 1.8-39.4 5.5-1.7.5-3.4-.8-3.4-2.5v-15.8zm-84.4 37l9.2-9.2c7.6-7.6 19.9-7.6 27.5 0l7.7 7.7c1.1 1.1 1 3-.3 4-6.2 4.5-12.1 9.4-17.6 14.9-5.4 5.4-10.4 11.3-14.8 17.4-1 1.3-2.9 1.5-4 .3l-7.7-7.7c-7.6-7.5-7.6-19.8 0-27.4zm127.2 244.8c-70 0-126.6-56.7-126.6-126.6s56.7-126.6 126.6-126.6c70 0 126.6 56.6 126.6 126.6 0 69.8-56.7 126.6-126.6 126.6z" class=""></path>
</svg>
Algolia
</h3>
<a href="https://www.algolia.com/dashboard" target="_blank">{{ __('Go to Algolia Dashboard') }} <i class="fas fa-angle-double-right"></i></a>
</div>
<div class="row">
@if ($algolia['status'] === 'error')
<div class="col-sm-12 text-center">
<span class="text-danger"><i class="far fa-3x fa-frown"></i></span>
<h4 class="text-danger">{{ $algolia['message'] }}</h4>
<p class="text-helper">{{ __("Or you don't have an Algolia App. Please go to Algolia website and create an App.") }}</p>
</div>
@else
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['products'] }}</h2>
<p class="card-content">{{ __('Records in products') }}</p>
</div>
</div>
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['categories'] }}</h2>
<p class="card-content">{{ __('Records in categories') }}</p>
</div>
</div>
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['brands'] }}</h2>
<p class="card-content">{{ __('Records in brands') }}</p>
</div>
</div>
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['users'] }}</h2>
<p class="card-content">{{ __('Records in users') }}</p>
</div>
</div>
@endif
</div>
</div>
</div>
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['categories'] }}</h2>
<p class="card-content">{{ __('Records in categories') }}</p>
</div>
</div>
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['brands'] }}</h2>
<p class="card-content">{{ __('Records in brands') }}</p>
</div>
</div>
<div class="col-sm-12 col-md-3">
<div class="card">
<h2 class="card-title">{{ $algolia['users'] }}</h2>
<p class="card-content">{{ __('Records in users') }}</p>
</div>
</div>

@endif
24 changes: 2 additions & 22 deletions resources/views/pages/dashboard/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,8 @@
</div>
</div>

<div class="algolia-items bg-white">
<div class="algolia-header mb-4">
<h3 class="text-lg font-bold nova-algolia-card-title">
<svg class="nova-algolia-card-title-logo" data-icon="algolia" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path fill="#5468ff" d="M229.3 182.6c-49.3 0-89.2 39.9-89.2 89.2 0 49.3 39.9 89.2 89.2 89.2s89.2-39.9 89.2-89.2c0-49.3-40-89.2-89.2-89.2zm62.7 56.6l-58.9 30.6c-1.8.9-3.8-.4-3.8-2.3V201c0-1.5 1.3-2.7 2.7-2.6 26.2 1 48.9 15.7 61.1 37.1.7 1.3.2 3-1.1 3.7zM389.1 32H58.9C26.4 32 0 58.4 0 90.9V421c0 32.6 26.4 59 58.9 59H389c32.6 0 58.9-26.4 58.9-58.9V90.9C448 58.4 421.6 32 389.1 32zm-202.6 84.7c0-10.8 8.7-19.5 19.5-19.5h45.3c10.8 0 19.5 8.7 19.5 19.5v15.4c0 1.8-1.7 3-3.3 2.5-12.3-3.4-25.1-5.1-38.1-5.1-13.5 0-26.7 1.8-39.4 5.5-1.7.5-3.4-.8-3.4-2.5v-15.8zm-84.4 37l9.2-9.2c7.6-7.6 19.9-7.6 27.5 0l7.7 7.7c1.1 1.1 1 3-.3 4-6.2 4.5-12.1 9.4-17.6 14.9-5.4 5.4-10.4 11.3-14.8 17.4-1 1.3-2.9 1.5-4 .3l-7.7-7.7c-7.6-7.5-7.6-19.8 0-27.4zm127.2 244.8c-70 0-126.6-56.7-126.6-126.6s56.7-126.6 126.6-126.6c70 0 126.6 56.6 126.6 126.6 0 69.8-56.7 126.6-126.6 126.6z" class=""></path>
</svg>
Algolia
</h3>
<a href="https://www.algolia.com/dashboard" target="_blank">{{ __('Go to Algolia Dashboard') }} <i class="fas fa-angle-double-right"></i></a>
</div>
<div class="row">
@if ($algolia['status'] === 'error')
<div class="col-sm-12 text-center">
<span class="text-danger"><i class="far fa-3x fa-frown"></i></span>
<h4 class="text-danger">{{ $algolia['message'] }}</h4>
<p class="text-helper">{{ __("Or you don't have an Algolia App. Please go to Algolia website and create an App.") }}</p>
</div>
@else
@include('shopper::pages.dashboard._algolia-indices')
@endif
</div>
</div>
@include('shopper::pages.dashboard._algolia-indices')

</div>

@stop
Loading

0 comments on commit c00098a

Please sign in to comment.