Skip to content

Commit

Permalink
Code improvements
Browse files Browse the repository at this point in the history
Register new delivery cart condition
  • Loading branch information
sampoyigi committed Jul 1, 2018
1 parent fd2640b commit 300e874
Show file tree
Hide file tree
Showing 37 changed files with 1,117 additions and 596 deletions.
14 changes: 14 additions & 0 deletions Extension.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace SamPoyigi\Local;

use SamPoyigi\Cart\Models\CartSettings;
use SamPoyigi\Local\Classes\Location as LocationManager;

class Extension extends \System\Classes\BaseExtension
Expand All @@ -13,6 +14,19 @@ public function register()

return $location;
});

$this->registerCartConditions();
}

public function registerCartConditions()
{
CartSettings::registerConditions(function (CartSettings $settingsModel) {
$settingsModel->registerCondition('SamPoyigi\Local\Conditions\Delivery', [
'name' => 'delivery',
'label' => 'lang:sampoyigi.local::default.text_delivery',
'description' => 'lang:sampoyigi.local::default.help_delivery_condition',
]);
});
}

public function registerComponents()
Expand Down
167 changes: 167 additions & 0 deletions assets/css/local.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
.local-box-fluid {
position: relative;
z-index: 999;
}
.local-box-fluid .panel {
background-color: #FFF;
position: absolute;
bottom: 70px;
left: 0;
right: 0;
width: 50%;
margin: 0 auto;
}
@media (min-width: 768px) {
.local-box-fluid {
}
}
.local-box-fluid .container {
width: 100%;
}
.local-box-fluid h2 {
color: #ED561A;
font-weight: 600;
text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.3);
margin: 0 0 15px;
}
@media (max-width: 768px) {
.local-box-fluid h2 {
font-size: 16px;
}
}
/*** Location Search ***/
.local-search {
margin-bottom: 2px;
}
/*.location-search {*/
/*background-color: #ED561A;*/
/*padding: 15px 15px 20px;*/
/*}*/
/*.location-search .heading-section {*/
/*padding: 0;*/
/*}*/
/*.location-search .heading-section h2 {*/
/*color: #F0F0F0;*/
/*font-size: 48px;*/
/*}*/
/*.location-search .under-heading {*/
/*height: 20px;*/
/*}*/
/*.location-search .search-label {*/
/*color: #FFF;*/
/*}*/
/*.postcode-group {*/
/*width: 100%;*/
/*}*/
/*.postcode-group .input-group {*/
/*margin: 0 auto;*/
/*}*/
/*.postcode-group .input-group-addon {*/
/*color: #FFF;*/
/*width: 35%;*/
/*font-weight: bold;*/
/*}*/
/*.postcode-group .postcode-control {*/
/*border-radius: 5px;*/
/*!*width: 70%;*!*/
/*}*/
/*.location-search .postcode-group .postcode-control {*/
/*width: 100%;*/
/*}*/
/*** Location Search ***/

/*** Location Bar ***/
.panel-local {
margin-bottom: 0;
}
.boxes dd,
.boxes dl {
margin-bottom: 0;
}
.box-divider {
border-bottom: 1px solid #E7E7E7;
padding-bottom: 8px;
margin-bottom: 8px;
}
/*.panel-local .panel-heading {*/
/*border-color: #E7E7E7;*/
/*overflow: visible;*/
/*padding: 0 15px;*/
/*display: block;*/
/*}*/
/*.panel-local.display-local h2 {*/
/*margin: 25px 0;*/
/*}*/
/*.panel-local h4 {*/
/*margin-top: 0;*/
/*margin-bottom: 5px;*/
/*font-weight: normal;*/
/*font-size: 24px;*/
/*}*/
/*@media (max-width: 768px) {*/
/*.panel-local h4 {*/
/*font-size: 14px;*/
/*}*/
/*}*/
/*.panel-local .panel-body > div {*/
/*padding-left: 0;*/
/*padding-right: 0;*/
/*}*/
/*.panel-local dl {*/
/*margin-bottom: 0;*/
/*}*/
/*.panel-local .panel-heading > div {*/
/*line-height: 2.1;*/
/*padding: 10px 0;*/
/*}*/
/*.side-bar .panel-local .panel-body > div {*/
/*width: 100%;*/
/*}*/
/*.side-bar .panel-local {*/
/*margin-bottom: 0;*/
/*}*/
/*.side-bar .container-fluid {*/
/*padding-right: 0;*/
/*padding-left: 0;*/
/*}*/
/*.side-bar .panel-local .box-one, .side-bar .panel-local .box-two {*/
/*margin-bottom: 20px;*/
/*}*/
/*.panel-local dd, .panel-local dt {*/
/*line-height: 1.529;*/
/*}*/
/*.panel-local .box-one dl.box-image {*/
/*margin-left: 95px;*/
/*}*/
/*.side-bar .panel-local .box-one img {*/
/*display: none;*/
/*}*/
/*.panel-local-hours {*/
/*color: #444;*/
/*}*/
/*.opening-hour dd {*/
/*margin-left: 110px;*/
/*}*/
/*.opening-hour dt {*/
/*width: 100px;*/
/*text-align: left;*/
/*}*/
/*#content-top #local-info .panel-local {*/
/*margin-top: 30px;*/
/*}*/
/*!*** End Location Bar ***!*/

/*#local-alert .alert p {*/
/*padding: 10px;*/
/*}*/
/*#local-alert .alert {*/
/*margin-bottom: 0;*/
/*padding: 0;*/
/*border: 0 none;*/
/*}*/

/* Menu Items */

.local-group a:hover {
text-decoration: none;
}
28 changes: 28 additions & 0 deletions assets/js/local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* ========================================================================
* TastyIgniter: local.js v2.2.0
* https://tastyigniter.com/docs/javascript
* ======================================================================== */

+function ($) {
"use strict"

$(document).on('click', '[data-control="search-local"]', function () {
$(this).closest('form').submit()
})

$(document).ready(function () {
var $affixEl = $('.affix-categories'),
offsetTop = $('.navbar-top').height(),
offsetBottom = $('footer.footer').outerHeight(true),
cartWidth = $affixEl.parent().width()

$affixEl.affix({
offset: {top: offsetTop, bottom: offsetBottom}
})

$affixEl.on('affixed.bs.affix', function () {
$affixEl.css('width', cartWidth)
})
})

}(jQuery)
Loading

0 comments on commit 300e874

Please sign in to comment.