@oxygen-cms/ui 1.6.1 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxygen-cms/ui",
3
- "version": "1.6.1",
3
+ "version": "1.6.4",
4
4
  "description": "Various utilities for UI-building in Vue.js",
5
5
  "main": "none",
6
6
  "repository": {
package/src/EventsApi.js CHANGED
@@ -13,4 +13,9 @@ export default class EventsApi extends CrudApi {
13
13
  return 'upcoming-events';
14
14
  }
15
15
 
16
+ async listTrybookingSessions() {
17
+ return this.request('get')
18
+ .fetch(this.constructor.getResourceRoot() + '/trybooking-sessions');
19
+ }
20
+
16
21
  }
@@ -28,4 +28,16 @@ export default class Internationalize {
28
28
  }
29
29
  return format.format(datetime);
30
30
  }
31
+
32
+ static formatDateTimeRange(from, to) {
33
+ let format = new Intl.DateTimeFormat(this.locale , {
34
+ hour: 'numeric', minute: 'numeric'
35
+ });
36
+
37
+ if(from.getDate() === to.getDate() && from.getMonth() === to.getMonth() && from.getYear() === to.getYear()) {
38
+ return this.formatDate(from) + " " + format.format(from) + " - " + format.format(to);
39
+ } else {
40
+ return this.formatDate(from) + " " + format.format(from) + " - " + this.formatDate(to) + format.format(to);
41
+ }
42
+ }
31
43
  }
@@ -1,22 +1,23 @@
1
1
  <template>
2
2
  <div style="height: 100%;">
3
- <!-- <transition name="slide-left" mode="out-in">-->
4
3
  <router-view @logout="signOut">
5
4
  <template #main-navigation>
6
- <slot name="app-navigation"></slot>
5
+ <MainMenu :items="mainMenuItems" />
7
6
  </template>
8
7
  </router-view>
9
- <!-- </transition>-->
10
8
  </div>
11
9
  </template>
12
10
 
13
11
  <script>
14
12
  import AuthApi from "../AuthApi";
13
+ import MainMenu from "./MainMenu.vue";
15
14
  export default {
16
15
  name: "App",
16
+ components: {MainMenu},
17
17
  props: {
18
18
  appTitle: { type: String, required: true },
19
19
  defaultRouteTitle: { type: String, required: true },
20
+ mainMenuItems: { type: Object, required: true },
20
21
  impersonating: {
21
22
  type: Boolean,
22
23
  default: false
@@ -84,7 +84,7 @@
84
84
  <script>
85
85
  import {FetchBuilder} from "../api";
86
86
  import Internationalize from "../Internationalize";
87
- import UAParser from 'ua-parser-js';
87
+ import { UAParser } from 'ua-parser-js';
88
88
  import AuthApi from "../AuthApi";
89
89
  import {getApiRoot} from "../CrudApi";
90
90
 
@@ -32,11 +32,44 @@
32
32
  <script>
33
33
 
34
34
  import AceEditor from 'vue2-ace-editor';
35
- import 'brace/ext/language_tools'; //language extension prerequsite...
35
+ // language extension pre-requisite...
36
+ import 'brace/ext/language_tools';
36
37
  import 'brace/mode/html';
37
38
  import 'brace/mode/twig';
39
+ import 'brace/snippets/html';
40
+ import 'brace/snippets/twig';
38
41
  import 'brace/theme/tomorrow_night_eighties';
39
42
  import 'brace/theme/tomorrow_night';
43
+ import 'brace/theme/ambiance';
44
+ import 'brace/theme/chaos';
45
+ import 'brace/theme/clouds_midnight';
46
+ import 'brace/theme/cobalt';
47
+ import 'brace/theme/idle_fingers';
48
+ import 'brace/theme/merbivore';
49
+ import 'brace/theme/merbivore_soft';
50
+ import 'brace/theme/mono_industrial';
51
+ import 'brace/theme/monokai';
52
+ import 'brace/theme/pastel_on_dark';
53
+ import 'brace/theme/solarized_dark';
54
+ import 'brace/theme/terminal';
55
+ import 'brace/theme/tomorrow_night';
56
+ import 'brace/theme/tomorrow_night_blue';
57
+ import 'brace/theme/tomorrow_night_bright';
58
+ import 'brace/theme/tomorrow_night_eighties';
59
+ import 'brace/theme/twilight';
60
+ import 'brace/theme/vibrant_ink';
61
+ import 'brace/theme/chrome';
62
+ import 'brace/theme/clouds';
63
+ import 'brace/theme/crimson_editor';
64
+ import 'brace/theme/dawn';
65
+ import 'brace/theme/dreamweaver';
66
+ import 'brace/theme/eclipse';
67
+ import 'brace/theme/github';
68
+ import 'brace/theme/kr_theme';
69
+ import 'brace/theme/solarized_light';
70
+ import 'brace/theme/textmate';
71
+ import 'brace/theme/tomorrow';
72
+ import 'brace/theme/xcode';
40
73
 
41
74
  export default {
42
75
  name: "CodeEditor",
@@ -134,7 +134,7 @@ export default {
134
134
  }
135
135
  },
136
136
  vuePathToURL(path) {
137
- return getApiHost() + this.legacyPrefix + path;
137
+ return getApiHost() + this.legacyPrefix.replace(/^\//, '') + path;
138
138
  },
139
139
  // We detect when the iframe url changes, and update our window accordingly...
140
140
  onNavigated(newURL) {
@@ -4,7 +4,7 @@
4
4
  <b-tab-item v-if="slotProps.canAccessPrefs(['appearance.themes', 'appearance.pages', 'appearance.events'].concat(getExtraPrefsPermissions('appearance')))" label="Website Theme">
5
5
  <PreferencesThemeChooser @theme-changed="onThemeChanged" />
6
6
  <PreferencesPageTemplates :current-theme="currentTheme" />
7
- <PreferencesEventTemplates :current-theme="currentTheme" />
7
+
8
8
  <PreferencesSiteAppearance :current-theme="currentTheme" />
9
9
  <component :is="pref.component" v-for="pref in getExtraPrefs('appearance')" :key="pref.key" :current-theme="currentTheme" />
10
10
  </b-tab-item>
@@ -46,5 +46,5 @@ export default {
46
46
  </script>
47
47
 
48
48
  <style scoped>
49
-
49
+ @import '../util.css';
50
50
  </style>
@@ -4,6 +4,7 @@
4
4
  <PreferencesField data-key="appearance.themes::theme" label="">
5
5
  <template #default="slotProps">
6
6
  <b-table
7
+ v-if="Object.values(slotProps.options).length > 0"
7
8
  :data="Object.values(slotProps.options)"
8
9
  :striped="false">
9
10
  <b-table-column v-slot="props" label="Key">
@@ -26,6 +27,7 @@
26
27
  <b-button v-else type="is-success" disabled>Theme is already active</b-button>
27
28
  </b-table-column>
28
29
  </b-table>
30
+ <p v-else class="has-text-centered"><em>No themes loaded.</em></p>
29
31
  </template>
30
32
  </PreferencesField>
31
33
  </ShowIfPermitted>
package/src/icons.js CHANGED
@@ -74,7 +74,7 @@ import {
74
74
  faFolderOpen,
75
75
  faImages,
76
76
  faMinusCircle,
77
- faCalendarPlus, faPaperPlane
77
+ faCalendarPlus, faPaperPlane, faHandshakeSlash, faHandshake
78
78
  } from "@fortawesome/free-solid-svg-icons";
79
79
 
80
80
  export const addIconsToLibrary = () => {
@@ -87,5 +87,5 @@ export const addIconsToLibrary = () => {
87
87
  faFileExcel, faFileCsv, faChevronCircleDown, faChevronCircleUp, faTrash,
88
88
  faEye, faEyeSlash, faCaretDown, faCaretUp, faUpload, faUser, faFolder, faHome, faFilePdf, faSignOutAlt, faTag,
89
89
  faFolderPlus, faTimes, faQuestionCircle, faFileUpload, faLandmark,
90
- faFolderOpen, faFile, faFileAudio, faFileImage, faShare, faImages, faCalendarPlus, faPaperPlane);
90
+ faFolderOpen, faFile, faFileAudio, faFileImage, faShare, faImages, faCalendarPlus, faPaperPlane, faHandshake, faHandshakeSlash);
91
91
  };
package/src/main.js CHANGED
@@ -12,7 +12,7 @@ import { AuthRoutes, makeAuthenticatedRoute } from "./routes";
12
12
  import createStore from "./store/index";
13
13
  import { checkAuthenticated } from "./AuthApi";
14
14
  import Error404 from "./components/Error404.vue";
15
- import MainMenu from "./components/MainMenu.vue";
15
+ import Preferences from "./components/preferences/Preferences.vue";
16
16
 
17
17
  /**
18
18
  * Creates the Vue.js Oxygen application, allowing for a few points of customization (i.e.: adding modules)
@@ -28,8 +28,11 @@ export default class OxygenUI {
28
28
  this.authenticatedRoutes = []
29
29
  this.unauthenticatedRoutes = []
30
30
  this.mainMenuItems = {}
31
- this.rootComponents = { App, MainMenu }
32
31
  this.beforeMountHooks = []
32
+ this.extraPrefs = {
33
+ 'appearance': [],
34
+ 'external': []
35
+ }
33
36
  }
34
37
 
35
38
  addAuthenticatedRoutes(routes) {
@@ -82,6 +85,15 @@ export default class OxygenUI {
82
85
 
83
86
  const store = createStore(this.Vue);
84
87
 
88
+ this.authenticatedRoutes.push({
89
+ path: '/preferences',
90
+ component: Preferences,
91
+ props: {
92
+ extraPrefs: this.extraPrefs
93
+ },
94
+ meta: { title: 'System Preferences' }
95
+ });
96
+
85
97
  const routes = AuthRoutes
86
98
  .concat([
87
99
  makeAuthenticatedRoute(this.authenticatedRoutes)
@@ -110,11 +122,13 @@ export default class OxygenUI {
110
122
 
111
123
  this.app = new this.Vue({
112
124
  router: router,
113
- data: {
114
- existingAppTitle: document.title,
115
- mainMenuItems: this.mainMenuItems
116
- },
117
- components: this.rootComponents,
125
+ render: (h) => h(App, {
126
+ props: {
127
+ appTitle: document.title,
128
+ defaultRouteTitle: 'Administration Panel',
129
+ mainMenuItems: this.mainMenuItems
130
+ }
131
+ }),
118
132
  store
119
133
  });
120
134
 
@@ -0,0 +1,35 @@
1
+ import LegacyPage from "../components/LegacyPage.vue";
2
+ import { WEB_CONTENT } from "../main.js";
3
+ import PreferencesEventTemplates from "../components/preferences/PreferencesEventTemplates.vue";
4
+
5
+ export default function(ui) {
6
+ ui.addMainMenuGroup(WEB_CONTENT, {
7
+ name: 'Events',
8
+ icon: 'calendar-alt',
9
+ listAction: '/upcoming-events',
10
+ listPermission: 'upcomingEvents.getList',
11
+ addIcon: 'calendar-plus',
12
+ addPermission: 'upcomingEvents.postCreate',
13
+ addAction: '/upcoming-events/create',
14
+ items: {
15
+ }
16
+ });
17
+ ui.extraPrefs['appearance'].push({
18
+ key: 'appearance.events',
19
+ component: PreferencesEventTemplates
20
+ });
21
+ ui.addAuthenticatedRoutes([
22
+ {
23
+ // will match everything, try to render a legacy Oxygen page...
24
+ path: 'upcoming-events/:subpath*',
25
+ component: LegacyPage,
26
+ props: (route) => {
27
+ return {
28
+ fullPath: route.fullPath,
29
+ legacyPrefix: '/oxygen/view',
30
+ adminPrefix: '/oxygen'
31
+ }
32
+ }
33
+ }
34
+ ]);
35
+ }
@@ -24,21 +24,10 @@ export default function(ui) {
24
24
  items: {
25
25
  }
26
26
  });
27
- ui.addMainMenuGroup(WEB_CONTENT, {
28
- name: 'Events',
29
- icon: 'calendar-alt',
30
- listAction: '/upcoming-events',
31
- listPermission: 'upcomingEvents.getList',
32
- addIcon: 'calendar-plus',
33
- addPermission: 'upcomingEvents.postCreate',
34
- addAction: '/upcoming-events/create',
35
- items: {
36
- }
37
- });
38
27
  ui.addAuthenticatedRoutes([
39
28
  {
40
29
  // will match everything, try to render a legacy Oxygen page...
41
- path: '(pages|partials|upcoming-events)/:subpath*',
30
+ path: '(pages|partials)/:subpath*',
42
31
  component: LegacyPage,
43
32
  props: (route) => {
44
33
  return {