Skip to content

Commit

Permalink
Merge pull request #34 from mark-fajardo/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
mark-fajardo authored Nov 14, 2021
2 parents ba7ed3a + 6cf2945 commit f2ee944
Show file tree
Hide file tree
Showing 30 changed files with 169 additions and 60 deletions.
3 changes: 3 additions & 0 deletions app/Constants/AppConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,7 @@ class AppConstants
public const INT = 'int';
public const REQUIRED_INT = 'required|int';
public const NULLABLE = 'nullable';

/** Page Tags' Constants **/
public const PAGE_TAG_HOME = 'home_page';
}
2 changes: 2 additions & 0 deletions app/Repository/RecipeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function getRecommendedRecipes(): array
->where(AppConstants::STATUS, 1)
->orderBy(AppConstants::ID, AppConstants::DESC)
->orderBy(AppConstants::UPDATED_AT, AppConstants::DESC)
->limit(20)
->get()
);
}
Expand All @@ -52,6 +53,7 @@ public function getRecommendedVideoRecipes(): array
->where(AppConstants::STATUS, 1)
->orderBy(AppConstants::ID, AppConstants::DESC)
->orderBy(AppConstants::UPDATED_AT, AppConstants::DESC)
->limit(6)
->get()
);
}
Expand Down
39 changes: 34 additions & 5 deletions app/Services/PageConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ class PageConfigService extends Service
*/
private $oPageConfigRepository;

/**
* File utils
* @var FileUtils
*/
private $oFileUtils;

/**
* PageConfigService constructor
* @param PageConfigRepository $oPageConfigRepository
* @param FileUtils $oFileUtils
*/
public function __construct(PageConfigRepository $oPageConfigRepository)
public function __construct(PageConfigRepository $oPageConfigRepository, FileUtils $oFileUtils)
{
$this->oPageConfigRepository = $oPageConfigRepository;
$this->oFileUtils = $oFileUtils;
}

/**
Expand All @@ -51,6 +59,12 @@ public function pageConfig(Request $oRequest): PageConfigService
return $this;
}

if ($this->aRequest[AppConstants::PAGE_TAG] !== AppConstants::PAGE_TAG_HOME) {
$aJsonConfig = $this->manageCommonPageConfig($sPageConfig);
$this->aResponse = DBUtils::formatResponse(true, $aJsonConfig);
return $this;
}

$aJsonConfig = $this->assignImage($sPageConfig);
$this->aResponse = DBUtils::formatResponse(true, $aJsonConfig);
return $this;
Expand All @@ -64,15 +78,30 @@ public function pageConfig(Request $oRequest): PageConfigService
private function assignImage(string $sPageConfig): array
{
$aJsonConfig = json_decode($sPageConfig, true);
$oFileUtils = new FileUtils();
$aLandscapeImages = $oFileUtils->assignMultipleURL(data_get($aJsonConfig, 'sliders.*.image_url', []));
$aPortraitImages = $oFileUtils->assignMultipleURL(data_get($aJsonConfig, 'sliders.*.image_url_portrait', []));
data_set($aJsonConfig, 'mini_about.img', $oFileUtils->assignMultipleURL(data_get($aJsonConfig, 'mini_about.img', [])));
$aLandscapeImages = $this->oFileUtils->assignMultipleURL(data_get($aJsonConfig, 'sliders.*.image_url', []));
$aPortraitImages = $this->oFileUtils->assignMultipleURL(data_get($aJsonConfig, 'sliders.*.image_url_portrait', []));
data_set($aJsonConfig, 'mini_about.img', $this->oFileUtils->assignMultipleURL(data_get($aJsonConfig, 'mini_about.img', [])));
foreach ($aJsonConfig['sliders'] as $iKey => $sValue) {
data_set($aJsonConfig['sliders'], $iKey . '.image_url', data_get($aLandscapeImages, $iKey, ''));
data_set($aJsonConfig['sliders'], $iKey . '.image_url_portrait', data_get($aPortraitImages, $iKey, ''));
}

return $aJsonConfig;
}

/**
* Manage common page config.
* @param string $sPageConfig
* @return array
*/
private function manageCommonPageConfig(string $sPageConfig): array
{
$aJsonConfig = json_decode($sPageConfig, true);
data_set(
$aJsonConfig['header'],
'img',
$this->oFileUtils->url(data_get($aJsonConfig, 'header.img', ''))
);
return $aJsonConfig;
}
}
2 changes: 1 addition & 1 deletion public/css/front.css

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"/js/aboutMe.js": "/js/aboutMe.js?id=dde3471de76bdb40cb5f",
"/js/contact.js": "/js/contact.js?id=85e49f8df9a2750ece07",
"/js/gallery.js": "/js/gallery.js?id=100802fead61b2f8e05d",
"/js/home.js": "/js/home.js?id=cd7ff3f3d93997986b3d",
"/js/aboutMe.js": "/js/aboutMe.js?id=cc4c8d3857c662630872",
"/js/contact.js": "/js/contact.js?id=9d7b68851c9996faf939",
"/js/gallery.js": "/js/gallery.js?id=0406988388a5f52b170e",
"/js/home.js": "/js/home.js?id=7451d3186ebb6329b902",
"/js/main.js": "/js/main.js?id=854411fbff00fb88e082",
"/js/maintenance.js": "/js/maintenance.js?id=88edd1f4e1664776f5a5",
"/css/maintenance.css": "/css/maintenance.css?id=117c1b2d2d14734e56c0",
"/css/front.css": "/css/front.css?id=16a0bf9d2863e42aac51",
"/js/notFound.js": "/js/notFound.js?id=f7b8ede3bdefba896bc6",
"/js/recipe.js": "/js/recipe.js?id=0534b9b3bf6bb5c840f2",
"/js/recipeList.js": "/js/recipeList.js?id=f364552dbfb586ef198d",
"/js/timeline.js": "/js/timeline.js?id=826049b253ca7a3c672f"
"/css/front.css": "/css/front.css?id=182cb4147266a0e4f325",
"/js/notFound.js": "/js/notFound.js?id=024809506ee623c9eb8c",
"/js/recipe.js": "/js/recipe.js?id=87cc8ba315406e8a1b85",
"/js/recipeList.js": "/js/recipeList.js?id=50c8290af994d3fdd95b",
"/js/timeline.js": "/js/timeline.js?id=d845e30ff1a2441d91da"
}
24 changes: 0 additions & 24 deletions resources/css/common/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -1737,10 +1737,6 @@ option {
width: 100%;
}

.about-page .page-barner-bg {
background: rgba(0, 0, 0, 0) url("/img/chef_morris/far_with_pepper_landscape_cropped.jpg") no-repeat scroll center center / cover;
}

.count-area-bg:after,
.page-barner-bg::after {
background: #000;
Expand Down Expand Up @@ -2251,10 +2247,6 @@ ul.page-pagination li a {
18. BLOG PAGE
=================================*/

.blog-page .page-barner-bg {
background: rgba(0, 0, 0, 0) url("/img/chef_morris/tinola_noodles.jpg") no-repeat scroll center center / cover;
}

.blog-page.section-padding {
padding-top: 50px;
}
Expand Down Expand Up @@ -2574,10 +2566,6 @@ ul.blog-instagram-feed-widget li {
19. SINGLE BLOG PAGE
================================*/

.single-blog-page .page-barner-bg {
background: rgba(0, 0, 0, 0) url("/img/chef_morris/seafood_in_coconut_milk_pasta_square.jpg") no-repeat scroll center center / cover;
}

.single-blog-page .title-and-meta::after {
left: 0;
margin-left: auto;
Expand All @@ -2587,10 +2575,6 @@ ul.blog-instagram-feed-widget li {
Gallery Page
*/

.gallery-page .page-barner-bg {
background: rgba(0, 0, 0, 0) url("/img/chef_morris/rana_1_landscape.jpg") no-repeat scroll center center / cover;
}

.gallery-page .title-and-meta::after {
left: 0;
margin-left: auto;
Expand Down Expand Up @@ -2651,10 +2635,6 @@ ul.blog-instagram-feed-widget li {
20. MENU PAGE
================================*/

.menu-page .page-barner-bg {
background: rgba(0, 0, 0, 0) url("/img/chef_morris/recipe_book.jpg") no-repeat scroll center center / cover;
}

.style-three .promotion-area-bg {
background: #f4f4f4 none repeat scroll 0 0;
}
Expand Down Expand Up @@ -2737,10 +2717,6 @@ ul.blog-instagram-feed-widget li {
21. CONTACT US PAGE
==================================*/

.contact-us-page .page-barner-bg {
background: rgba(0, 0, 0, 0) url("/img/chef_morris/tiramisu_2_landscape.jpg") no-repeat scroll center center / cover;
}

.single-contact-widget {
margin-bottom: 30px;
}
Expand Down
6 changes: 5 additions & 1 deletion resources/js/Components/AboutMe/Header.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<header class="top-area single-page about-page" id="home">
<div class="page-barner-bg"></div>
<div class="page-barner-bg" :style="'background: rgba(0, 0, 0, 0) url(\'' + this.header_img + '\') no-repeat scroll center center / cover'"></div>
<Nav/>
<PageBanner banner-for="about_me"/>
</header>
Expand All @@ -9,9 +9,13 @@
<script>
import Nav from '../../Common/Nav';
import PageBanner from '../../Common/PageBanner';
import { mapGetters } from 'vuex';
export default {
name: 'Header',
computed: {
...mapGetters('PageConfig', ['header_img']),
},
components: { PageBanner, Nav }
}
</script>
6 changes: 5 additions & 1 deletion resources/js/Components/Contact/Header.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<header class="top-area single-page contact-us-page" id="home">
<div class="page-barner-bg"></div>
<div class="page-barner-bg" :style="'background: rgba(0, 0, 0, 0) url(\'' + this.header_img + '\') no-repeat scroll center center / cover'"></div>
<Nav/>
<PageBanner banner-for="contact"/>
</header>
Expand All @@ -9,9 +9,13 @@
<script>
import Nav from '../../Common/Nav';
import PageBanner from '../../Common/PageBanner';
import { mapGetters } from 'vuex';
export default {
name: 'Header',
computed: {
...mapGetters('PageConfig', ['header_img']),
},
components: { PageBanner, Nav }
}
</script>
6 changes: 5 additions & 1 deletion resources/js/Components/Gallery/Header.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<header class="top-area single-page gallery-page" id="home">
<div class="page-barner-bg"></div>
<div class="page-barner-bg" :style="'background: rgba(0, 0, 0, 0) url(\'' + this.header_img + '\') no-repeat scroll center center / cover'"></div>
<Nav/>
<PageBanner banner-for="gallery"/>
</header>
Expand All @@ -9,9 +9,13 @@
<script>
import Nav from '../../Common/Nav';
import PageBanner from '../../Common/PageBanner';
import { mapGetters } from 'vuex';
export default {
name: 'Header',
computed: {
...mapGetters('PageConfig', ['header_img']),
},
components: { PageBanner, Nav }
}
</script>
4 changes: 3 additions & 1 deletion resources/js/Components/Modules/AboutMe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import { mapActions } from 'vuex';
import Content from '../AboutMe/Content';
import SocialMediaFeed from '../../Common/SocialMediaFeed';
import { PageTags } from '../../constants';
export default {
components: { SocialMediaFeed, Content, Footer },
Expand All @@ -28,7 +29,8 @@
*/
async prepareData() {
Promise.all([
await this.getPageConfig('home_page')
await this.getPageConfig(PageTags.HOME),
await this.getPageConfig(PageTags.ABOUT_ME),
]).then(() => {
jQueryMixin.method.loadSticky();
jQueryMixin.method.loadSearch();
Expand Down
8 changes: 8 additions & 0 deletions resources/js/Components/Modules/Contact.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@
import Content from '../Contact/Content';
import ContactDetails from '../Contact/ContactDetails';
import ContactFormHeader from '../Contact/ContactFormHeader';
import { mapActions } from 'vuex';
import { PageTags } from '../../constants';
export default {
components: { ContactFormHeader, ContactDetails, Content, Footer },
async created() {
jQueryMixin.method.loadSticky();
jQueryMixin.method.loadSearch();
jQueryMixin.method.removeLoader();
await this.getPageConfig(PageTags.CONTACT);
},
methods: {
...mapActions('PageConfig', {
getPageConfig: 'getPageConfig'
}),
}
}
</script>
8 changes: 8 additions & 0 deletions resources/js/Components/Modules/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@
import SocialMediaFeed from '../../Common/SocialMediaFeed';
import GalleryView from '../Gallery/GalleryView';
import Promotions from '../Home/Promotions';
import { mapActions } from 'vuex';
import { PageTags } from '../../constants';
export default {
components: { Promotions, GalleryView, SocialMediaFeed, Footer },
async created() {
jQueryMixin.method.loadSticky();
jQueryMixin.method.loadSearch();
jQueryMixin.method.removeLoader();
await this.getPageConfig(PageTags.GALLERY);
},
methods: {
...mapActions('PageConfig', {
getPageConfig: 'getPageConfig'
}),
}
}
</script>
3 changes: 2 additions & 1 deletion resources/js/Components/Modules/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import SocialMediaFeed from '../../Common/SocialMediaFeed';
import Vlogs from '../../Common/Vlogs';
import { jQueryMixin } from '../../main';
import { PageTags } from '../../constants';
export default {
components: { Vlogs, SocialMediaFeed, Footer, RecipeList, Promotions, MiniAbout },
Expand All @@ -34,7 +35,7 @@
*/
async prepareData() {
Promise.all([
await this.getPageConfig('home_page')
await this.getPageConfig(PageTags.HOME),
]).then(() => {
jQueryMixin.method.init();
})
Expand Down
7 changes: 7 additions & 0 deletions resources/js/Components/Modules/RecipeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@
import RecommendedRecipes from '../RecipeList/RecommendedRecipes';
import SocialMediaFeed from '../../Common/SocialMediaFeed';
import RecipeListView from "../RecipeList/RecipeListView";
import { mapActions } from 'vuex';
import { PageTags } from '../../constants';
export default {
components: { RecipeListView, SocialMediaFeed, RecommendedRecipes, Promotions, Footer },
async created() {
await this.prepareData();
await this.getPageConfig(PageTags.RECIPES);
},
methods: {
...mapActions('PageConfig', {
getPageConfig: 'getPageConfig'
}),
/**
* Prepare data for the components config.
*/
Expand Down
8 changes: 8 additions & 0 deletions resources/js/Components/Modules/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@
import Content from '../../Components/Timeline/Content';
import TimelineSidebar from '../Timeline/TimelineSidebar';
import Promotions from '../Home/Promotions';
import { mapActions } from 'vuex';
import { PageTags } from '../../constants';
export default {
components: { Promotions, TimelineSidebar, SocialMediaFeed, Footer, Content },
async created() {
jQueryMixin.method.loadSticky();
jQueryMixin.method.loadSearch();
jQueryMixin.method.removeLoader();
await this.getPageConfig(PageTags.TIMELINE);
},
methods: {
...mapActions('PageConfig', {
getPageConfig: 'getPageConfig'
}),
}
}
</script>
8 changes: 6 additions & 2 deletions resources/js/Components/Recipe/Header.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<header class="top-area single-page single-blog-page" id="home">
<div class="page-barner-bg"></div>
<div class="page-barner-bg" :style="'background: rgba(0, 0, 0, 0) url(\'' + this.recipe.main_image + '\') no-repeat scroll center center / cover'"></div>
<Nav/>
<PageBanner banner-for="recipe"/>
</header>
Expand All @@ -9,9 +9,13 @@
<script>
import Nav from '../../Common/Nav';
import PageBanner from '../../Common/PageBanner';
import { mapGetters } from 'vuex';
export default {
name: 'Header',
components: { PageBanner, Nav }
components: { PageBanner, Nav },
computed: {
...mapGetters('Recipe', ['recipe']),
}
}
</script>
Loading

0 comments on commit f2ee944

Please sign in to comment.