Code Monkey home page Code Monkey logo

salted-knowledge-hub's Introduction

Salted Knowledge Hub

Salted Herring's Knowledge Hub module

Manual

Installation

Step 1 Because this module isn’t public, you will need to make changes in composer.json to be able to access to it:

"repositories": [
        {
            "type": "vcs",
            "url": "[email protected]:salted-herring/salted-knowledge-hub.git"
        }
    ]
"require": {
        …
        "salted-herring/salted-knowledge-hub": "dev-master”,
    …

And then you run composer update

Once the installation is done, do dev/build?flush=all on the browser

Step 2 To give support to the frontend, you also need below JS libraries installed. Please add them into your bower’s dependencies block, and then run bower update

"salted-js": "*",
"handlebars": "^4.0.10",
"fancySelect": "fancyselect#^1.1.0",
"isotope": "^3.0.4",
"isotope-packery": "^2.0.0",
"imagesloaded": "^4.1.3"

Step 3 Now go to mainsite/code/Page.php file, find init function, and add below code accordingly

$combined_file = 'scripts.js';
Requirements::combine_files(
    $combined_file,
    array(
        ...
        'themes/default/js/components/salted-js/dist/salted-js.min.js',
        'themes/default/js/components/fancySelect/fancySelect.js',
        'themes/default/js/components/isotope/dist/isotope.pkgd.min.js',
        'themes/default/js/components/isotope-packery/packery-mode.pkgd.min.js',
        'themes/default/js/components/imagesloaded/imagesloaded.pkgd.min.js',
        ...
    )
);

$this->KnowledgeHubJSinit($combined_file);

Step 4 … Almost there — now open themes/[theme_name]/templates/Page.ss file, and add below line before the </head> tag:

<script src="/$themeDir/js/components/handlebars/handlebars.min.js"></script>

The reason we have to include Handlebars’ library separately, because when we switch the site to Live mode, it will complain - seems Handlebars have a very picky lifestyle :/

Backend

All your articles need to extend: KnowledgeArticle, and then do your fancy stuff from there.

CMS

The page hierarchy is like this:

Knowledge Hub Landing Page
  |-Knowledge Hub Group Page A
    |-Knowledge Article Page 1
    |-Knowledge Article Page 2
    |-Knowledge Article Page 3
  |-Knowledge Hub Group Page B
    |-Knowledge Article Page 4
    |-Knowledge Article Page 5
    |-Knowledge Article Page 6

There is a possible gotcha after a Knowledge Hub Group page is created: After the page is created, you won’t see the Child Page tab straightaway. You need to open up the right sidebar (assume it’s closed), and select the article types that you are going to allow in this particular group

screengrab

Oh by the way, the right sidebar in Knowledge Hub Group Page editing interface is also where you define how many items per page

Frontend

This module leaves the canvas blank for your awesome painting to take place. If you find the default templates trip you, just feel free to override them

salted-knowledge-hub's People

Contributors

simonwinter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.