Просмотр исходного кода

- Admin Panel / Layout / Custom HTML after <body> start, and Custom HTML before </body> end.
In progress, does not work yet.

Thanks to xet7 !

Lauri Ojansivu 6 лет назад
Родитель
Сommit
f1ed6304a4

+ 2 - 0
client/components/boards/boardBody.jade

@@ -12,6 +12,7 @@ template(name="board")
     +spinner
     +spinner
 
 
 template(name="boardBody")
 template(name="boardBody")
+  | {{currentSetting.customHTMLafterBodyStart}}
   .board-wrapper(class=currentBoard.colorClass)
   .board-wrapper(class=currentBoard.colorClass)
     +sidebar
     +sidebar
     .board-canvas.js-swimlanes.js-perfect-scrollbar(
     .board-canvas.js-swimlanes.js-perfect-scrollbar(
@@ -27,6 +28,7 @@ template(name="boardBody")
         +listsGroup
         +listsGroup
       if isViewCalendar
       if isViewCalendar
         +calendarView
         +calendarView
+  | {{currentSetting.customHTMLbeforeBodyEnd}}
 
 
 template(name="calendarView")
 template(name="calendarView")
   .calendar-view.swimlane
   .calendar-view.swimlane

+ 6 - 0
client/components/settings/settingBody.jade

@@ -145,5 +145,11 @@ template(name='layoutSettings')
       .title {{_ 'custom-product-name'}}
       .title {{_ 'custom-product-name'}}
       .form-group
       .form-group
         input.form-control#product-name(type="text", placeholder="Wekan" value="{{currentSetting.productName}}")
         input.form-control#product-name(type="text", placeholder="Wekan" value="{{currentSetting.productName}}")
+    li.layout-form
+      .title {{_ 'add-custom-html-after-body-start'}}
+      textarea#customHTMLafterBodyStart.form-control= currentSetting.customHTMLafterBodyStart
+    li.layout-form
+      .title {{_ 'add-custom-html-before-body-end'}}
+      textarea#customHTMLbeforeBodyEnd.form-control= currentSetting.customHTMLbeforeBodyEnd
     li
     li
       button.js-save-layout.primary {{_ 'save'}}
       button.js-save-layout.primary {{_ 'save'}}

+ 4 - 0
client/components/settings/settingBody.js

@@ -140,6 +140,8 @@ BlazeComponent.extendComponent({
 
 
     const productName = $('#product-name').val().trim();
     const productName = $('#product-name').val().trim();
     const hideLogoChange = ($('input[name=hideLogo]:checked').val() === 'true');
     const hideLogoChange = ($('input[name=hideLogo]:checked').val() === 'true');
+    const customHTMLafterBodyStart = $('#customHTMLafterBodyStart').val().trim();
+    const customHTMLbeforeBodyEnd = $('#customHTMLbeforeBodyEnd').val().trim();
 
 
     try {
     try {
 
 
@@ -147,6 +149,8 @@ BlazeComponent.extendComponent({
         $set: {
         $set: {
           productName,
           productName,
           hideLogo: hideLogoChange,
           hideLogo: hideLogoChange,
+          customHTMLafterBodyStart,
+          customHTMLbeforeBodyEnd,
         },
         },
       });
       });
     } catch (e) {
     } catch (e) {

+ 3 - 1
i18n/en.i18n.json

@@ -618,5 +618,7 @@
     "authentication-type": "Authentication type",
     "authentication-type": "Authentication type",
     "custom-product-name": "Custom Product Name",
     "custom-product-name": "Custom Product Name",
     "layout": "Layout",
     "layout": "Layout",
-    "hide-logo": "Hide Logo"
+    "hide-logo": "Hide Logo",
+    "add-custom-html-after-body-start": "Add Custom HTML after <body> start",
+    "add-custom-html-before-body-end": "Add Custom HTML before </body> end"
 }
 }

+ 8 - 0
models/settings.js

@@ -32,6 +32,14 @@ Settings.attachSchema(new SimpleSchema({
     type: String,
     type: String,
     optional: true,
     optional: true,
   },
   },
+  customHTMLafterBodyStart: {
+    type: String,
+    optional: true,
+  },
+  customHTMLbeforeBodyEnd: {
+    type: String,
+    optional: true,
+  },
   hideLogo: {
   hideLogo: {
     type: Boolean,
     type: Boolean,
     optional: true,
     optional: true,

+ 24 - 0
server/migrations.js

@@ -374,3 +374,27 @@ Migrations.add('add-hide-logo', () => {
     },
     },
   }, noValidateMulti);
   }, noValidateMulti);
 });
 });
+
+Migrations.add('add-custom-html-after-body-start', () => {
+  Settings.update({
+    customHTMLafterBodyStart: {
+      $exists: false,
+    },
+  }, {
+    $set: {
+      customHTMLafterBodyStart:'',
+    },
+  }, noValidateMulti);
+});
+
+Migrations.add('add-custom-html-before-body-end', () => {
+  Settings.update({
+    customHTMLbeforeBodyEnd: {
+      $exists: false,
+    },
+  }, {
+    $set: {
+      customHTMLbeforeBodyEnd:'',
+    },
+  }, noValidateMulti);
+});

+ 1 - 1
server/publications/settings.js

@@ -1,5 +1,5 @@
 Meteor.publish('setting', () => {
 Meteor.publish('setting', () => {
-  return Settings.find({}, {fields:{disableRegistration: 1, productName: 1, hideLogo: 1}});
+  return Settings.find({}, {fields:{disableRegistration: 1, productName: 1, hideLogo: 1, customHTMLafterBodyStart: 1, customHTMLbeforeBodyEnd: 1}});
 });
 });
 
 
 Meteor.publish('mailServer', function () {
 Meteor.publish('mailServer', function () {