Explorar el Código

Admin Panel / Layout: Hide Logo: Yes / No. This does hide Wekan logo on Login page and Board page. Thanks to xet7.

Lauri Ojansivu hace 6 años
padre
commit
dd6ba152a0

+ 5 - 1
CHANGELOG.md

@@ -1,6 +1,10 @@
 # Upcoming Wekan release
 # Upcoming Wekan release
 
 
-This release fixes the following bugs:
+This release adds the following new features:
+
+- Admin Panel / Layout: Hide Logo: Yes / No. This does hide Wekan logo on Login page and Board page. Thanks to xet7.
+
+and fixes the following bugs:
 
 
 - [Fix Snap database-list-backups command](https://github.com/wekan/wekan-snap/issues/26). Thanks to WaryWolf.
 - [Fix Snap database-list-backups command](https://github.com/wekan/wekan-snap/issues/26). Thanks to WaryWolf.
 
 

+ 4 - 2
client/components/main/header.jade

@@ -47,6 +47,7 @@ template(name="header")
       +Template.dynamic(template=headerBar)
       +Template.dynamic(template=headerBar)
 
 
       unless hideLogo
       unless hideLogo
+
         //-
         //-
           On sandstorm, the logo shouldn't be clickable, because we only have one
           On sandstorm, the logo shouldn't be clickable, because we only have one
           page/document on it, and we don't want to see the home page containing
           page/document on it, and we don't want to see the home page containing
@@ -55,8 +56,9 @@ template(name="header")
           .wekan-logo
           .wekan-logo
             img(src="{{pathFor '/wekan-logo-header.png'}}" alt="Wekan")
             img(src="{{pathFor '/wekan-logo-header.png'}}" alt="Wekan")
         else
         else
-          a.wekan-logo(href="{{pathFor 'home'}}" title="{{_ 'header-logo-title'}}")
-            img(src="{{pathFor '/wekan-logo-header.png'}}" alt="Wekan")
+          unless currentSetting.hideLogo
+            a.wekan-logo(href="{{pathFor 'home'}}" title="{{_ 'header-logo-title'}}")
+              img(src="{{pathFor '/wekan-logo-header.png'}}" alt="Wekan")
 
 
   if appIsOffline
   if appIsOffline
     +offlineWarning
     +offlineWarning

+ 5 - 0
client/components/main/header.js

@@ -1,11 +1,16 @@
 Meteor.subscribe('user-admin');
 Meteor.subscribe('user-admin');
 Meteor.subscribe('boards');
 Meteor.subscribe('boards');
+Meteor.subscribe('setting');
 
 
 Template.header.helpers({
 Template.header.helpers({
   wrappedHeader() {
   wrappedHeader() {
     return !Session.get('currentBoard');
     return !Session.get('currentBoard');
   },
   },
 
 
+  currentSetting() {
+    return Settings.findOne();
+  },
+
   hideLogo() {
   hideLogo() {
     return Utils.isMiniScreen() && Session.get('currentBoard');
     return Utils.isMiniScreen() && Session.get('currentBoard');
   },
   },

+ 7 - 2
client/components/main/layouts.jade

@@ -14,8 +14,13 @@ head
 
 
 template(name="userFormsLayout")
 template(name="userFormsLayout")
   section.auth-layout
   section.auth-layout
-    h1.at-form-landing-logo
-      img(src="{{pathFor '/wekan-logo.png'}}" alt="Wekan")
+    unless currentSetting.hideLogo
+      h1.at-form-landing-logo
+        img(src="{{pathFor '/wekan-logo.png'}}" alt="Wekan")
+    if currentSetting.hideLogo
+      h1
+        br
+        br
     section.auth-dialog
     section.auth-dialog
       +Template.dynamic(template=content)
       +Template.dynamic(template=content)
       +connectionMethod
       +connectionMethod

+ 11 - 0
client/components/main/layouts.js

@@ -20,7 +20,13 @@ const validator = {
   },
   },
 };
 };
 
 
+Template.userFormsLayout.onCreated(() => {
+  Meteor.subscribe('setting');
+
+});
+
 Template.userFormsLayout.onRendered(() => {
 Template.userFormsLayout.onRendered(() => {
+
   AccountsTemplates.state.form.keys = new Proxy(AccountsTemplates.state.form.keys, validator);
   AccountsTemplates.state.form.keys = new Proxy(AccountsTemplates.state.form.keys, validator);
 
 
   const i18nTag = navigator.language;
   const i18nTag = navigator.language;
@@ -31,6 +37,11 @@ Template.userFormsLayout.onRendered(() => {
 });
 });
 
 
 Template.userFormsLayout.helpers({
 Template.userFormsLayout.helpers({
+
+  currentSetting() {
+    return Settings.findOne();
+  },
+
   languages() {
   languages() {
     return _.map(TAPi18n.getLanguages(), (lang, code) => {
     return _.map(TAPi18n.getLanguages(), (lang, code) => {
       const tag = code;
       const tag = code;

+ 7 - 1
client/components/settings/settingBody.jade

@@ -134,10 +134,16 @@ template(name='announcementSettings')
 
 
 template(name='layoutSettings')
 template(name='layoutSettings')
   ul#layout-setting.setting-detail
   ul#layout-setting.setting-detail
+    li.layout-form
+      .title {{_ 'hide-logo'}}
+      .form-group.flex
+        input.form-control#hide-logo(type="radio" name="hideLogo" value="true" checked="{{#if currentSetting.hideLogo}}checked{{/if}}")
+        span {{_ 'yes'}}
+        input.form-control#hide-logo(type="radio" name="hideLogo" value="false" checked="{{#unless currentSetting.hideLogo}}checked{{/unless}}")
+        span {{_ 'no'}}
     li.layout-form
     li.layout-form
       .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
     li
       button.js-save-layout.primary {{_ 'save'}}
       button.js-save-layout.primary {{_ 'save'}}

+ 9 - 1
client/components/settings/settingBody.js

@@ -59,6 +59,9 @@ BlazeComponent.extendComponent({
   toggleTLS() {
   toggleTLS() {
     $('#mail-server-tls').toggleClass('is-checked');
     $('#mail-server-tls').toggleClass('is-checked');
   },
   },
+  toggleHideLogo() {
+    $('#hide-logo').toggleClass('is-checked');
+  },
   switchMenu(event) {
   switchMenu(event) {
     const target = $(event.target);
     const target = $(event.target);
     if (!target.hasClass('active')) {
     if (!target.hasClass('active')) {
@@ -135,11 +138,15 @@ BlazeComponent.extendComponent({
     this.setLoading(true);
     this.setLoading(true);
     $('li').removeClass('has-error');
     $('li').removeClass('has-error');
 
 
+    const productName = $('#product-name').val().trim();
+    const hideLogoChange = ($('input[name=hideLogo]:checked').val() === 'true');
+
     try {
     try {
-      const productName = $('#product-name').val().trim();
+
       Settings.update(Settings.findOne()._id, {
       Settings.update(Settings.findOne()._id, {
         $set: {
         $set: {
           productName,
           productName,
+          hideLogo: hideLogoChange,
         },
         },
       });
       });
     } catch (e) {
     } catch (e) {
@@ -175,6 +182,7 @@ BlazeComponent.extendComponent({
       'click button.js-email-invite': this.inviteThroughEmail,
       'click button.js-email-invite': this.inviteThroughEmail,
       'click button.js-save': this.saveMailServerInfo,
       'click button.js-save': this.saveMailServerInfo,
       'click button.js-send-smtp-test-email': this.sendSMTPTestEmail,
       'click button.js-send-smtp-test-email': this.sendSMTPTestEmail,
+      'click a.js-toggle-hide-logo': this.toggleHideLogo,
       'click button.js-save-layout': this.saveLayout,
       'click button.js-save-layout': this.saveLayout,
     }];
     }];
   },
   },

+ 2 - 1
i18n/en.i18n.json

@@ -618,5 +618,6 @@
     "authentication-method": "Authentication method",
     "authentication-method": "Authentication method",
     "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"
 }
 }

+ 4 - 0
models/settings.js

@@ -32,6 +32,10 @@ Settings.attachSchema(new SimpleSchema({
     type: String,
     type: String,
     optional: true,
     optional: true,
   },
   },
+  hideLogo: {
+    type: Boolean,
+    optional: true,
+  },
   createdAt: {
   createdAt: {
     type: Date,
     type: Date,
     denyUpdate: true,
     denyUpdate: true,

+ 12 - 0
server/migrations.js

@@ -362,3 +362,15 @@ Migrations.add('add-product-name', () => {
     },
     },
   }, noValidateMulti);
   }, noValidateMulti);
 });
 });
+
+Migrations.add('add-hide-logo', () => {
+  Settings.update({
+    hideLogo: {
+      $exists: false,
+    },
+  }, {
+    $set: {
+      hideLogo: false,
+    },
+  }, 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}});
+  return Settings.find({}, {fields:{disableRegistration: 1, productName: 1, hideLogo: 1}});
 });
 });
 
 
 Meteor.publish('mailServer', function () {
 Meteor.publish('mailServer', function () {