Skip to content

Commit

Permalink
Merge pull request #22 from randombenj/feature/upload-and-help-page
Browse files Browse the repository at this point in the history
Add upload and help page
  • Loading branch information
randombenj authored Nov 21, 2019
2 parents 88a9285 + 41bf801 commit b06e624
Show file tree
Hide file tree
Showing 17 changed files with 529 additions and 39 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# building frontend
FROM node:13.1 as build-deps
COPY web ./
# fix docker not following symlinks
COPY doc/getting-started.md ./src/assets/
RUN yarn install
RUN yarn lint
RUN yarn build

# production
Expand Down
26 changes: 1 addition & 25 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,4 @@ pipenv install

## Usage

### Add documentation

You can uppload any static html site by zipping it and
then posting the file to the backend.

For example to upload the file `docs.zip` as version `1.0.0` for awesome-project.

```sh
curl -X POST -F "file=@docs.zip" http://localhost:5000/api/awesome-project/1.0.0
```

Any other file type is uploaded as well.
An uploaded pdf would be available as
`http://localhost:5000/api/awesome-project/1.0.0/my_awesome.pdf`

### Tag documentation

After this you can tag a version, this can be usefull when
the latest version should be available as `http://localhost:5000/docs/awesome-project/latest`

If you want to tag the version `1.0.0` as `latest` for awesome-project.

```sh
curl -X PUT http://localhost:5000/api/awesome-project/1.0.0/tags/latest
```
See [Help.md](Help.md)
31 changes: 31 additions & 0 deletions doc/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Getting started with DOCAT

### Upload your documentation

You can upload any static html site by zipping it and
then posting the file to the backend.

For example to upload the file `docs.zip` as version `1.0.0` for `awesome-project`.

```sh
curl -X POST -F "file=@docs.zip" http://localhost:8000/api/awesome-project/1.0.0
```

Any other file type is uploaded as well.
An uploaded pdf could be viewed like this:

`http://localhost/#/awesome-project/1.0.0/my_awesome.pdf`

You can also manually upload your documentation.
A very simple web form can be found under [upload](#/upload).

### Tag documentation

After this you can tag a version, this can be usefull when
the latest version should be available as `http://localhost:5000/docs/awesome-project/latest`

If you want to tag the version `1.0.0` as `latest` for awesome-project.

```sh
curl -X PUT http://localhost:5000/api/awesome-project/1.0.0/tags/latest
```
6 changes: 5 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"core-js": "^3.3.2",
"html-loader": "^0.5.5",
"node-sass": "^4.13.0",
"sass-loader": "^8.0.0",
"vue": "^2.6.10"
"vue": "^2.6.10",
"vue-markdown": "^2.2.4",
"vuelidate": "^0.7.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>docat</title>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions web/src/assets/getting-started.md
23 changes: 23 additions & 0 deletions web/src/components/Help.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<vue-markdown>
{{ help }}
</vue-markdown>
</template>

<script>
import VueMarkdown from 'vue-markdown'
import help from '@/assets/getting-started.md'
export default {
name: 'help',
components: {
VueMarkdown
},
data() {
return {
help,
}
}
}
</script>
18 changes: 18 additions & 0 deletions web/src/components/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<div v-if="!fullscreen" class="md-layout-item md-size-15 md-small-hide"></div>
<div class="md-layout-item">
<slot></slot>
<div class="help">
<router-link to="/help" v-if="!fullscreen">help</router-link>
</div>
</div>
<div v-if="!fullscreen" class="md-layout-item md-size-15 md-small-hide"></div>
</div>
Expand Down Expand Up @@ -66,4 +69,19 @@ body,
height: 100%;
}
a {
/* TODO: remove hack */
color: #742a47 !important;
}
.help {
width: 100%;
border-top: 1px solid #e8e8e8;
padding-top: 16px;
margin-top: 16px;
a {
margin-left: 50%;
}
}
</style>
6 changes: 5 additions & 1 deletion web/src/components/ProjectOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@
v-bind:key="project.name"
:project="project.name"
/>
<Help v-if="!projects.length" />
</div>
</template>

<script>
import Help from '@/components/Help.vue'
import Project from '@/components/Project.vue'
import ProjectRepository from '@/repositories/ProjectRepository'
export default {
name: 'ProjectOverview',
components: {
Project
Project,
Help
},
data() {
return {
Expand Down
14 changes: 14 additions & 0 deletions web/src/components/UploadButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<md-button to="/upload" class="md-fab md-primary">
<md-icon>backup</md-icon>
<md-tooltip md-direction="left">upload documentation</md-tooltip>
</md-button>
</template>

<script>
export default {
name: 'UploadButton'
}
</script>


23 changes: 21 additions & 2 deletions web/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ import App from '@/App.vue'
// configure vue material (https://vuematerial.io/getting-started/)
import {
MdCard,
MdButton,
MdAvatar,
MdApp,
MdToolbar,
MdContent,
MdList,
MdField,
MdMenu
MdMenu,
MdProgress,
MdSnackbar,
MdIcon,
MdTooltip
} from 'vue-material/dist/components'
import 'vue-material/dist/vue-material.min.css'
import 'vue-material/dist/theme/default.css'
Expand All @@ -23,6 +28,16 @@ Vue.use(MdList)
Vue.use(MdToolbar)
Vue.use(MdCard)
Vue.use(MdAvatar)
Vue.use(MdProgress)
Vue.use(MdSnackbar)
Vue.use(MdButton)
Vue.use(MdIcon)
Vue.use(MdTooltip)

// configure to use vue-markdown (https://github.com/miaolz123/vue-markdown)
import VueMarkdown from 'vue-markdown'

Vue.use(VueMarkdown);

// configure vue router (https://router.vuejs.org/installation.html)
import VueRouter from 'vue-router'
Expand All @@ -32,10 +47,14 @@ Vue.use(VueRouter)
// configure the app's routing
import Home from '@/pages/Home.vue'
import Docs from '@/pages/Docs.vue'
import Help from '@/pages/Help.vue'
import Upload from '@/pages/Upload.vue'

const routes = [
{ path: '/', component: Home },
{ path: '/:project/:version/:location?', component: Docs }
{ path: '/:project/:version/:location?', component: Docs },
{ path: '/help', component: Help },
{ path: '/upload', component: Upload },
]

const router = new VueRouter({
Expand Down
23 changes: 23 additions & 0 deletions web/src/pages/Help.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div>
<Layout>
<Help class="spacing" />
</Layout>
<UploadButton class="upload-button" />
</div>
</template>

<script>
import Layout from '@/components/Layout.vue'
import Help from '@/components/Help.vue'
import UploadButton from '@/components/UploadButton.vue'
export default {
name: 'help-page',
components: {
Layout,
Help,
UploadButton
}
}
</script>
29 changes: 25 additions & 4 deletions web/src/pages/Home.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<template>
<Layout>
<ProjectOverview class="spacing" />
</Layout>
<div>
<Layout>
<ProjectOverview class="spacing" />
</Layout>
<UploadButton class="upload-button" />
</div>
</template>

<script>
import ProjectOverview from '@/components/ProjectOverview.vue'
import Layout from '@/components/Layout.vue'
import UploadButton from '@/components/UploadButton.vue'
export default {
name: 'home',
components: {
ProjectOverview,
Layout
Layout,
UploadButton
}
}
</script>
Expand All @@ -30,4 +35,20 @@ export default {
.spacing {
padding-top: 20px;
}
.upload-button {
position: fixed;
bottom: 16px;
}
@media all and (max-width: 959px) {
.upload-button {
right: 16px;
}
}
@media all and (min-width: 959px) {
.upload-button {
right: 15%;
}
}
</style>
Loading

0 comments on commit b06e624

Please sign in to comment.