Starter repository for creating a new website.
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Move the grouping of the events into the cache Nov 20, 2018
bootstrap initial set up of laravel 5.5 Aug 31, 2017
config fix spacing and append View to the end of it to match the others Nov 2, 2018
contracts Add page_id as a parameter to getHomepagePromos since its needed often. Sep 25, 2018
factories Footer contact content more in line with multi-column implementation Jan 15, 2019
hooks If the app completely fails before running tests we should stop the p… Oct 9, 2018
public Merge branch 'feature/laravel5.5' into develop Dec 5, 2017
resources make clean to restore svg to http Dec 20, 2018
routes Make the controller a config option so later we can introduce Article… Nov 2, 2018
storage Get the .env.example file copied over and a key generated Nov 14, 2017
stubs Fix factory stub for Feature generating to match the Factory contract Oct 8, 2018
styleguide Frameborder removed from output since it is stripped from CMS now Jan 14, 2019
tests fix comments Nov 20, 2018
.babelrc update env to include the namespace for babel due to the change to Ba… Jan 4, 2019
.coveralls.yml Set up coveralls Apr 27, 2017
.editorconfig Initial import of base. Apr 26, 2017
.env.example Switch to using .env to change the logging Aug 27, 2018
.eslintrc Add new accordion May 4, 2018
.gitattributes initial set up of laravel 5.5 Aug 31, 2017
.gitignore Ignore diff files in the root so someone doesn't accidentally commit … Sep 21, 2018
.nvmrc Update nodejs version to v10 LTS Jan 4, 2019
.php_cs Add more rules for arrays that we always have been following Oct 16, 2018
.phpbrewrc update .phpbrewrc to PHP 7.2.4 to use Apr 23, 2018
.stylelintrc Package updates May 21, 2018
.travis.yml update `.travis.yml` to use nodejs 10 Jan 8, 2019
CONTRIBUTING.md Correct the wording for contributing May 11, 2017
Envoy.blade.php Remove setting the cache for the WSU API Connector since we utilize t… Sep 26, 2018
LICENSE Initial import of base. Apr 26, 2017
README.md Remove laravel version so we don't have to maintain that. Oct 5, 2018
artisan initial set up of laravel 5.5 Aug 31, 2017
composer.json Upgrade composer and npm packages Sep 5, 2018
composer.lock Update all composer and npm packages Dec 20, 2018
fontello-config.json Convert icon fonts over to unicode and SVGs May 18, 2018
makefile Generate the artisan key on deploy May 30, 2018
package.json Footer contact content more in line with multi-column implementation Jan 15, 2019
phpunit.xml Upgrade composer and npm packages Sep 5, 2018
sami.php First pass of deleting code that we won't be using/supporting in a ba… Nov 21, 2017
server.php initial set up of laravel 5.5 Aug 31, 2017
tailwind.js Menu top and responsive embed converting over to tailwind classes Dec 11, 2018
webpack.mix.js Using sass and styles call makes an infinite loop with make watch run… Aug 27, 2018
yarn.lock additional packages required by laravel-mix Jan 4, 2019

README.md

Base Template

Branch Build Coverage
Master Master Build Status Coverage Status
Develop Develop Build Status Coverage Status

Starter repository for creating a new website. Live demo can be found at https://base.wayne.edu/.

Features

  • Backend built on Laravel
  • Frontend built on Tailwind
  • Module bundling using Webpack
  • Fluent webpack API using Laravel Mix
  • Zero downtime deployment using Envoy
  • Configure multiple enviorments using PHPDotenv
  • SCSS support
  • Automatically inject JS/CSS while developing using BrowserSync
  • NewRelic support via the NewRelic middleware if the php extension is installed
  • 100% test code coverage
  • Public API documentation
  • Commit hook that require the following to pass:
  • Menus
    • Top level menu carried across all pages that follows you down the page as you scroll
    • Left menu if a page has subitems, otherwise its a full width page
    • Slideout menu that is triggered on a variable breakpoint that includes
      • The top level menu grouped together
      • Left menu
      • Under menu promotions
      • Banner promotion
  • Full styleguide detailing out every available component using PHP faker data
  • Single or rotating hero images using Flickity
  • Automatically lightbox youtube videos using Media Box
  • Easy integration with a CMS by writing custom .json files to the public directory which are matched by to a route and sent to the specified controller

Setup

  1. Setup laravel homestead: http://laravel.com/docs/homestead
  2. Clone the repository
  3. run make install
  4. run make build
  5. run make watch
  6. open https://domain.local:3000/ (for BrowserySync)

Deployment

  • Setup the following config variables in Envoy.blade.php
    • $appname
    • $server_map
    • $source_repo
    • $deploy_basepath
  • Development: envoy run deploy or make deploy
  • Production: envoy run deploy --on="production" or make deployproduction
  • Any branch: envoy run deploy --branch=feature/feature

Run tests

phpunit

Run test coverage

  1. make coverage
  2. Open the coverages/index.html file in your browser

Check for outdated packages

make status

Update packages

make update

Configure the site

  1. Open /config/base.php
  2. Edit the options to configure the site, some values are present in the .env file.
  3. Server specific configuration options come from the .env file which need to be manually created/updated on the servers the app is deployed to.

Request a WSU API key

Email web@wayne.edu with your request.

Adding .env variables

  1. Add a config option to config/base.php called your_key using the env() function.
  2. Using it in blade: <script>var KEY = { API_KEY: {{ config('base.your_key' }} };</script> .
  3. Using it in PHP: <?php $key = config('base.your_key'); ?>
  4. Add a blank entry to your local .env.example file for your_key
  5. Add an entry with the actual value to your local .env file.
  6. Commit the .env.example file. You may want to put the actual value in the example file when necessary.
  7. Once the site is deployed you will want to add the actual value to the .env on each server.

Developing global data that is passed down to all views via the $request->data variable

  1. Open the folder /app/Repositories.
  2. Create new class and implement the interface RequestDataRepositoryContract.
  3. Fill out the getRequestData method and return an array.
  4. Call the getRequestData method in the /app/Http/Middleware/Data.php file.

Developing controllers

  1. Open the folder /app/Http/Controllers/
  2. This folder contains all the selectable templates from the CMS.
  3. Controllers should:
    • Dependency inject repositories into the constructor.
    • Call repositories to obtain data to send to the view.

Developing views

  1. Open /resources/views/
  2. This folder contains all the views for the front-end using the blade templating engine
  3. Files must be saved in the format of: homepage.blade.php
  4. Components: Contains views that are reusable

Pages

Pages are written from the content management system automatically. To replicate what it writes you can use the following JSON format to create pages. Example homeage: storage/app/public/index.json.

{
    "site" : {
        "id" : 1,
        "title" : "Base Site",
        "subsite-folder" : null,
        "parent" : {
            "id" : null
        }
    },
    "page" : {
        "id" : 1,
        "controller" : "HomepageController",
        "title" : "Welcome!",
        "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed turpis lorem, malesuada eu tellus vel, pharetra consequat lacus. Vestibulum eu metus nec massa viverra iaculis. Pellentesque libero eros, varius non sem et, dapibus aliquam magna. Praesent ultri",
        "content" : {
            "main" : "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed turpis lorem, malesuada eu tellus vel, pharetra consequat lacus. Vestibulum eu metus nec massa viverra iaculis. Pellentesque libero eros, varius non sem et, dapibus aliquam magna.</p>"
        },
        "keywords" : "",
        "updated-at" : "",
        "canonical" : ""
    },
    "menu" : {
        "id" : 1
    },
    "data" : {

    }
}

Menus

Menus are automatically pulled from the content management system. To replicate the structure you can use the following array and replace the code in App\Repositories\MenuRepository@getAllMenus.

<?php

$menus = [
    1 => [ // The menu_id specified from the .json file
        1 => [ // First menu item
            'menu_item_id' => '1', // Auto incrementing ID
            'is_active' => '1', // To output the menu item or not
            'page_id' => '1', // Page ID specified from the .json file
            'target' => '', // HTML <a target="">
            'display_name' => 'Home', // Title of the menu item
            'class_name' => '', // CSS class name to be appended to the menu item
            'relative_url' => '/', // The relative URL to this page
            'submenu' => [], // Subitems, follow same structure and include another submenu => []
        ],
        2 => [ // Second menu item...

        ],
    ],
];

News listing & view

  1. Create a CMS page called news in the root of the site and select the NewsController as the template.
  2. This will handle both the listing & view for this particular site. If you need news for a subsite, follow #1 while being within that subsite.

Profile listing & view

  1. Create a CMS page for the profile listing page (ex: profiles) and select the ProfileController as the template.
  2. Create a CMS page for the profile view, it must be: profile and select the ProfileController as the template.
  3. You can now visit https://domain.dev/profiles and http://domain.dev/profile/{accessid}.

Style guide development for a new feature

Feature names should be singular and CamelCased. To create a new feature called "Spotlight": php artisan base:feature Spotlight

Adding SVG icons

  1. Load the fontello-config.json file into http://fontello.com/
  2. Select the new icons and download the set.
  3. Load the waynestate.svg file into https://icomoon.io/app/#/select
  4. Select all the icons and download the set.
  5. Open the new SVG icon(s) in the editor of your choice.
  6. Save each file under resources/views/svg as a blade partial.
  7. Remove the comment from the svg file.
  8. Apply this code to the svg tag: class="{{ $class ?? '' }}" aria-labelledby="{{ $name ?? '' }}".

Using SVG icons

  1. <svg> replace with: @svg('filename', 'optional classes')

Lazy loading

  1. <img> replace with: @image('/path/to/image.jpg', 'alt text', 'optional classes')
  2. Background images: <div data-src="/path/to/image.jpg"></div>

Contributing

Please see CONTRIBUTING for details.

Licensing

Base Template is open-sourced software licensed under the MIT license.