diff --git a/assets/src/css/base.css b/assets/src/css/base.css index 6f025faf..0bc872b4 100644 --- a/assets/src/css/base.css +++ b/assets/src/css/base.css @@ -133,5 +133,15 @@ main { } #breadcrumbs a { - color: inherit + color: inherit; + transition: .1s ease-in; + border-radius: .125em; +} + +#breadcrumbs a:hover { + background-color: rgba(0,0,0, 0.05); +} + +#breadcrumbs span a { + padding: .2em; } diff --git a/caddy/hugo/rice-box.go b/caddy/hugo/rice-box.go index 5bc7978d..f83cb99e 100644 --- a/caddy/hugo/rice-box.go +++ b/caddy/hugo/rice-box.go @@ -9,17 +9,17 @@ func init() { // define files file2 := &embedded.EmbeddedFile{ - Filename: `hugo.js`, - FileModTime: time.Unix(1501232329, 0), + Filename: "hugo.js", + FileModTime: time.Unix(1501233088, 0), Content: string("'use strict';\r\n\r\n(function () {\r\n if (window.plugins === undefined || window.plugins === null) {\r\n window.plugins = []\r\n }\r\n\r\n let regenerate = function (data, url) {\r\n url = data.api.removePrefix(url)\r\n\r\n return new Promise((resolve, reject) => {\r\n let request = new window.XMLHttpRequest()\r\n request.open('POST', `${data.store.state.baseURL}/api/hugo${url}`, true)\r\n request.setRequestHeader('Authorization', `Bearer ${data.store.state.jwt}`)\r\n request.setRequestHeader('Regenerate', 'true')\r\n\r\n request.onload = () => {\r\n if (request.status === 200) {\r\n resolve()\r\n } else {\r\n reject(request.responseText)\r\n }\r\n }\r\n\r\n request.onerror = (error) => reject(error)\r\n request.send()\r\n })\r\n }\r\n\r\n let newArchetype = function (data, url, type) {\r\n url = data.api.removePrefix(url)\r\n\r\n return new Promise((resolve, reject) => {\r\n let request = new window.XMLHttpRequest()\r\n request.open('POST', `${data.store.state.baseURL}/api/hugo${url}`, true)\r\n request.setRequestHeader('Authorization', `Bearer ${data.store.state.jwt}`)\r\n request.setRequestHeader('Archetype', encodeURIComponent(type))\r\n\r\n request.onload = () => {\r\n if (request.status === 200) {\r\n resolve(request.getResponseHeader('Location'))\r\n } else {\r\n reject(request.responseText)\r\n }\r\n }\r\n\r\n request.onerror = (error) => reject(error)\r\n request.send()\r\n })\r\n }\r\n\r\n let schedule = function (data, file, date) {\r\n file = data.api.removePrefix(file)\r\n\r\n return new Promise((resolve, reject) => {\r\n let request = new window.XMLHttpRequest()\r\n request.open('POST', `${data.store.state.baseURL}/api/hugo${file}`, true)\r\n request.setRequestHeader('Authorization', `Bearer ${data.store.state.jwt}`)\r\n request.setRequestHeader('Schedule', date)\r\n\r\n request.onload = () => {\r\n if (request.status === 200) {\r\n resolve(request.getResponseHeader('Location'))\r\n } else {\r\n reject(request.responseText)\r\n }\r\n }\r\n\r\n request.onerror = (error) => reject(error)\r\n request.send()\r\n })\r\n }\r\n\r\n window.plugins.push({\r\n name: 'hugo',\r\n credits: 'With a flavour of Hugo.',\r\n header: {\r\n visible: [\r\n {\r\n if: function (data, route) {\r\n return (data.store.state.req.kind === 'editor' &&\r\n !data.store.state.loading &&\r\n data.store.state.req.metadata !== undefined &&\r\n data.store.state.req.metadata !== null &&\r\n data.store.state.user.allowEdit &\r\n data.store.state.user.permissions.allowPublish)\r\n },\r\n click: function (event, data, route) {\r\n event.preventDefault()\r\n document.getElementById('save-button').click()\r\n // TODO: wait for save to finish?\r\n data.buttons.loading('publish')\r\n\r\n regenerate(data, route.path)\r\n .then(() => {\r\n data.buttons.done('publish')\r\n data.store.commit('showSuccess', 'Post published!')\r\n data.store.commit('setReload', true)\r\n })\r\n .catch((error) => {\r\n data.buttons.done('publish')\r\n data.store.commit('showError', error)\r\n })\r\n },\r\n id: 'publish-button',\r\n icon: 'send',\r\n name: 'Publish'\r\n }\r\n ],\r\n hidden: [\r\n {\r\n if: function (data, route) {\r\n return (data.store.state.req.kind === 'editor' &&\r\n !data.store.state.loading &&\r\n data.store.state.req.metadata !== undefined &&\r\n data.store.state.req.metadata !== null &&\r\n data.store.state.user.permissions.allowPublish)\r\n },\r\n click: function (event, data, route) {\r\n document.getElementById('save-button').click()\r\n data.store.commit('showHover', 'schedule')\r\n },\r\n id: 'schedule-button',\r\n icon: 'alarm',\r\n name: 'Schedule'\r\n }\r\n ]\r\n },\r\n sidebar: [\r\n {\r\n click: function (event, data, route) {\r\n data.router.push({ path: '/files/settings' })\r\n },\r\n icon: 'settings',\r\n name: 'Hugo Settings'\r\n },\r\n {\r\n click: function (event, data, route) {\r\n data.store.commit('showHover', 'new-archetype')\r\n },\r\n if: function (data, route) {\r\n return data.store.state.user.allowNew\r\n },\r\n icon: 'merge_type',\r\n name: 'Hugo New'\r\n } /* ,\r\n {\r\n click: function (event, data, route) {\r\n console.log('evt')\r\n },\r\n icon: 'remove_red_eye',\r\n name: 'Preview'\r\n } */\r\n ],\r\n prompts: [\r\n {\r\n name: 'new-archetype',\r\n title: 'New file',\r\n description: 'Create a new post based on an archetype. Your file will be created on content folder.',\r\n inputs: [\r\n {\r\n type: 'text',\r\n name: 'file',\r\n placeholder: 'File name'\r\n },\r\n {\r\n type: 'text',\r\n name: 'archetype',\r\n placeholder: 'Archetype'\r\n }\r\n ],\r\n ok: 'Create',\r\n submit: function (event, data, route) {\r\n event.preventDefault()\r\n\r\n let file = event.currentTarget.querySelector('[name=\"file\"]').value\r\n let type = event.currentTarget.querySelector('[name=\"archetype\"]').value\r\n if (type === '') type = 'default'\r\n\r\n data.store.commit('closeHovers')\r\n\r\n newArchetype(data, '/' + file, type)\r\n .then((url) => {\r\n data.router.push({ path: url })\r\n })\r\n .catch(error => {\r\n data.store.commit('showError', error)\r\n })\r\n }\r\n },\r\n {\r\n name: 'schedule',\r\n title: 'Schedule',\r\n description: 'Pick a date and time to schedule the publication of this post.',\r\n inputs: [\r\n {\r\n type: 'datetime-local',\r\n name: 'date',\r\n placeholder: 'Date'\r\n }\r\n ],\r\n ok: 'Schedule',\r\n submit: function (event, data, route) {\r\n event.preventDefault()\r\n data.buttons.loading('schedule')\r\n\r\n let date = event.currentTarget.querySelector('[name=\"date\"]').value\r\n if (date === '') {\r\n data.buttons.done('schedule')\r\n data.store.commit('showError', 'The date must not be empty.')\r\n return\r\n }\r\n\r\n schedule(data, route.path, date)\r\n .then(() => {\r\n data.buttons.done('schedule')\r\n data.store.commit('showSuccess', 'Post scheduled!')\r\n })\r\n .catch((error) => {\r\n data.buttons.done('schedule')\r\n data.store.commit('showError', error)\r\n })\r\n }\r\n }\r\n ]\r\n })\r\n})()\r\n"), } // define dirs dir1 := &embedded.EmbeddedDir{ - Filename: ``, - DirModTime: time.Unix(1501232329, 0), + Filename: "", + DirModTime: time.Unix(1501233088, 0), ChildFiles: []*embedded.EmbeddedFile{ - file2, // hugo.js + file2, // "hugo.js" }, } @@ -30,7 +30,7 @@ func init() { // register embeddedBox embedded.RegisterEmbeddedBox(`./assets/`, &embedded.EmbeddedBox{ Name: `./assets/`, - Time: time.Unix(1501232329, 0), + Time: time.Unix(1501233088, 0), Dirs: map[string]*embedded.EmbeddedDir{ "": dir1, }, diff --git a/rice-box.go.REMOVED.git-id b/rice-box.go.REMOVED.git-id index a72308d8..35339201 100644 --- a/rice-box.go.REMOVED.git-id +++ b/rice-box.go.REMOVED.git-id @@ -1 +1 @@ -8868d0da70d74a9255e7fd2617e88a63ba160479 \ No newline at end of file +e50cb6a99f64eba257617c206897174ed13be0ee \ No newline at end of file