0.1.29 • Published 7 years ago

datacat-cms v0.1.29

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Installation

npm install datacat-cms

Requirements

VueJS 2.x

Add this code to these files

build/build.js

const indexer = require('datacat-cms/build')
indexer.indexFiles()
indexer.indexContent()

src/main.js

require('datacat-cms/admin')

And to load content for displaying:

store.commit('content/loadConfig')
store.commit('content/loadContent')

App.vue

Replace #app with:

#app(v-if='$route.path.indexOf("/admin") !== 0')

index.html

    <div id="admin"></div>

below the app tag.

router/index.js

    {
      path: '/admin',
      beforeEnter: (to, from, next) => {
        if (from.matched.length > 0) { // experimental fix for multi routers
          next()
          return location.reload()
        }

        next()
      }
    },

Before your 404 route. This is experimental for now.

Content

Add a content folder to your project root.

Inside this new folder, add config.json with these defaults:

{
  "upload_folder": "static/content",
  "contenttypes": [
    "blogpost"
  ]
}

And since we have now defined a content type named blogpost, add a blogpost folder inside the content folder. Here is an example for it:

{
  "name": "blogpost",
  "create": true,
  "fields": [
    {
      "name": "slug",
      "type": "hidden",
      "required": true
    },
    {
      "name": "draft",
      "type": "boolean",
      "label": "Draft (drafts are not published)",
      "default": true
    },
    {
      "name": "title",
      "type": "string",
      "label": "Title",
      "required": true,
      "overviewShow": true
    },
    {
      "name": "subtitle",
      "type": "string",
      "label": "Subtitle",
      "default": "default subtitle"
    },
    {
      "name": "readtime_minutes",
      "type": "number",
      "label": "Read time (in minutes)"
    },
    {
      "name": "publishdate",
      "type": "date",
      "label": "Publish Date",
      "overviewShow": true
    },
    {
      "name": "body",
      "type": "markdown",
      "label": "Body",
      "required": true,
      "overviewShow": true
    },
    {
      "name": "tags",
      "type": "array",
      "arraytype": "string",
      "label": "Tags",
      "default": [123, 4]
    }
  ]
}

overviewShow means that the specified field will be used in the overview list preview.

And to prevent _content.json and _files.json to get added to git, .gitignore them:

content/_content.json
content/_files.json

VueX

To use the content, add the datacat client module to your VueX instance:

import content from 'datacat-cms/client'

Auth0

Datacat uses auth0 for authentication. You must set your domain and client id in the config/settings.json file:

{
  "auth0": {
    "domain": "my.auth0.domain",
    "clientId" "client-id"
  }
}


# Improvements

So yea obviously this is alot of work, but this is a very early version of this system.
0.1.29

7 years ago

0.1.28

7 years ago

0.1.27

7 years ago

0.1.26

7 years ago

0.1.25

7 years ago

0.1.24

7 years ago

0.1.23

7 years ago

0.1.22

7 years ago

0.1.21

7 years ago

0.1.20

7 years ago

0.1.19

7 years ago

0.1.18

7 years ago

0.1.17

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.0

7 years ago