diff --git a/packages/accounts/accounts-tab/admin.js b/packages/accounts/accounts-tab/admin.js index 0c1210f..bf1bb9a 100644 --- a/packages/accounts/accounts-tab/admin.js +++ b/packages/accounts/accounts-tab/admin.js @@ -24,6 +24,7 @@ if (Meteor.isClient) { index: 80, identifier: 'accounts-index', title: i18n('accounts.index.title'), + iconClass: 'fa fa-user', routeName: 'accounts.index', activeRouteRegex: 'accounts', permission: 'accounts.index' diff --git a/packages/base/links.js b/packages/base/links.js index f2ec4b9..d7cdc34 100644 --- a/packages/base/links.js +++ b/packages/base/links.js @@ -18,6 +18,10 @@ orion.links.attachSchema(new SimpleSchema({ title: { type: String }, + iconClass: { + type: String, + optional: true + }, routeName: { type: String, optional: true @@ -38,6 +42,9 @@ orion.links.add = function(options) { if (_.isFunction(options.title)) { options.title = options.title(); } + if (_.isFunction(options.iconClass)) { + options.iconClass = options.iconClass(); + } self.upsert({ identifier: options.identifier }, { $set: options }); }); }; diff --git a/packages/bootstrap/views/sidebar/sidebar.html b/packages/bootstrap/views/sidebar/sidebar.html index d2f32c6..22522df 100644 --- a/packages/bootstrap/views/sidebar/sidebar.html +++ b/packages/bootstrap/views/sidebar/sidebar.html @@ -19,11 +19,11 @@ - {{ title }} + {{>orionBootstrapSidebarLinkIcon}} {{ title }} {{ else }} - {{ title }} + {{>orionBootstrapSidebarLinkIcon}} {{ title }} {{/ if }} @@ -37,7 +37,13 @@ {{ else }}
  • - {{ title }} + {{>orionBootstrapSidebarLinkIcon}} {{ title }}
  • {{/ if }} + + \ No newline at end of file diff --git a/packages/bootstrap/views/sidebar/sidebar.less b/packages/bootstrap/views/sidebar/sidebar.less index d84724f..b2b02a6 100644 --- a/packages/bootstrap/views/sidebar/sidebar.less +++ b/packages/bootstrap/views/sidebar/sidebar.less @@ -11,4 +11,8 @@ padding-right: 20px; cursor: pointer; } + .sidebar-icon { + display: inline; + padding-right: 4px; + } } diff --git a/packages/collections/collections_client.js b/packages/collections/collections_client.js index 9d531a4..5d2f34b 100644 --- a/packages/collections/collections_client.js +++ b/packages/collections/collections_client.js @@ -10,6 +10,7 @@ orion.collections.onCreated(function() { activeRouteRegex: 'collections.' + self.name, permission: 'collections.' + self.name + '.index', title: self.name[0].toUpperCase() + self.name.slice(1), + iconClass: 'fa fa-table', index: 30 }, self.link); orion.links.add(linkOptions); diff --git a/packages/config/admin.js b/packages/config/admin.js index d913bc6..326611d 100644 --- a/packages/config/admin.js +++ b/packages/config/admin.js @@ -28,6 +28,7 @@ if (Meteor.isClient) { index: 100, identifier: 'config-update', title: i18n('config.update.title'), + iconClass: 'fa fa-wrench', routeName: 'config.update', activeRouteRegex: 'config', permission: 'config.update' diff --git a/packages/dictionary/admin.js b/packages/dictionary/admin.js index ed173fb..43bdc0c 100644 --- a/packages/dictionary/admin.js +++ b/packages/dictionary/admin.js @@ -28,6 +28,7 @@ Tracker.autorun(function () { index: 10, identifier: 'dictionary-update', title: i18n('dictionary.update.title'), + iconClass: 'fa fa-at', routeName: 'dictionary.update', activeRouteRegex: 'dictionary', permission: 'dictionary.update', diff --git a/packages/froala/attribute.js b/packages/froala/attribute.js index 32fc9f5..fce6be2 100644 --- a/packages/froala/attribute.js +++ b/packages/froala/attribute.js @@ -7,7 +7,7 @@ orion.attributes.registerAttribute('froala', { }; }, valueOut: function() { - return this.find('.editor').editable('getHTML', false, true); + return this.find('.editor').froalaEditor('html.get', false, true); } }); diff --git a/packages/froala/froala.js b/packages/froala/froala.js index cfd07fa..0c8abb2 100644 --- a/packages/froala/froala.js +++ b/packages/froala/froala.js @@ -4,18 +4,22 @@ ReactiveTemplates.onRendered('attribute.froala', function () { // Find the element var element = parent.find('.editor'); // initialize froala - element.editable({ + element.froalaEditor({ + imageManagerLoadURL: '/api/froala/images', + imageManagerDeleteURL: '/api/froala/images', + imageManagerDeleteMethod: "DELETE", + imageManagerDeleteParams: {user_id: Meteor.userId()}, inlineMode: false, placeholder: '', - minHeight: Options.get('froala.height', 400), // setting a default height + heightMin: Options.get('froala.height', 400), // setting a default height key: orion.config.get('FROALA_ACTIVATION_KEY') // set license key if exists }); // set the current value of the attribute - element.editable("setHTML", this.data.value, true); + element.froalaEditor("html.set", this.data.value, true); // Handle image uploads - element.on('editable.beforeImageUpload', function (e, editor, files) { + element.on('froalaEditor.image.beforeUpload', function (e, editor, files) { var upload = orion.filesystem.upload({ fileList: files, name: files[0].name, @@ -26,16 +30,16 @@ ReactiveTemplates.onRendered('attribute.froala', function () { if (upload.error) { console.log(upload.error, "error uploading file") } else { - element.editable("insertHTML", "", true); + element.froalaEditor("html.insert", "", true); } - element.editable("hidePopups"); + element.froalaEditor("popups.hideAll"); } }); return false; }); // Handle image deletes // If its uploaded through filesystem, it deletes the image and prevent the server call to delete - element.on('editable.beforeRemoveImage', function (e, editor, img) { + element.on('froalaEditor.image.beforeRemove', function (e, editor, img) { var imgId = img.attr("data-file-id"); if (!imgId) { return; diff --git a/packages/froala/froala_server.js b/packages/froala/froala_server.js new file mode 100644 index 0000000..43b8435 --- /dev/null +++ b/packages/froala/froala_server.js @@ -0,0 +1,24 @@ + const Api = new Restivus({ + useDefaultAuth: true, + prettyJson: true + }); + + Api.addRoute('froala/images/', { + get() { + return orion.filesystem.collection.find({ + uploader: {$in: ['image-attribute', 'froala']} + }).map(function(image){ + return { + thumb: image.url, + url: image.url, + tag: "froala" // TODO: add tags to filesystem + } + }); + }, + delete(){ + let {src} = this.bodyParams; + // TODO: only allow admin to delete, see also orion:filesystem permission + orion.filesystem.collection.remove({url: src}); + return ""; + } + }); \ No newline at end of file diff --git a/packages/froala/package.js b/packages/froala/package.js index bc6d622..9f4f0dd 100644 --- a/packages/froala/package.js +++ b/packages/froala/package.js @@ -13,7 +13,8 @@ Package.onUse(function(api) { 'orionjs:attributes@1.7.0', 'less@2.5.0_1', 'orionjs:filesystem@1.7.0', - 'froala:editor@1.2.8', + 'froala:editor@2.0.1', + 'nimble:restivus@0.8.4', ]); api.imply([ @@ -23,6 +24,9 @@ Package.onUse(function(api) { api.addFiles([ 'attribute.js', ]); + api.addFiles([ + 'froala_server.js', + ], 'server'); api.addFiles([ 'froala.html', diff --git a/packages/pages/admin.js b/packages/pages/admin.js index 1dcafc4..dc3a7c5 100644 --- a/packages/pages/admin.js +++ b/packages/pages/admin.js @@ -47,6 +47,7 @@ if (Meteor.isClient) { index: 40, identifier: 'pages-index', title: i18n('pages.index.title'), + iconClass: 'fa fa-file-o', routeName: 'pages.index', activeRouteRegex: 'pages', permission: 'pages.index',