浏览代码

Custom Logo for Login and Top Left Corner. Optional link when clicking logo. Settings at Admin Panel / Layout.

Thanks to xet7 !

Fixes #1493,
fixes #2721,
fixes #2681,
fixes #1583,
fixes #1196,
fixes #336,
fixes wekan/wekan-snap#130
Lauri Ojansivu 4 年之前
父节点
当前提交
a7c3317ed6

+ 13 - 11
client/components/main/header.jade

@@ -19,6 +19,19 @@ template(name="header")
                   = title
                   = title
         #header-new-board-icon
         #header-new-board-icon
       else
       else
+        //-
+          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
+          the list of all boards.
+        unless currentSetting.hideLogo
+          if currentSetting.customTopLeftCornerLogoImageUrl
+            if currentSetting.customTopLeftCornerLogoTargetUrl
+              a(href="{{currentSetting.customTopLeftCornerLogoTargetUrl}}")
+                img(src="{{currentSetting.customTopLeftCornerLogoImageUrl}}" height="27" width="auto" margin="0" padding="0")
+            unless currentSetting.customTopLeftCornerLogoTargetUrl
+              img(src="{{currentSetting.customTopLeftCornerLogoImageUrl}}" height="27" width="auto" margin="0" padding="0")
+          unless currentSetting.customTopLeftCornerLogoImageUrl
+            img(src="{{pathFor '/logo-header.png'}}" alt="")
         ul
         ul
           li
           li
             a(href="{{pathFor 'home'}}")
             a(href="{{pathFor 'home'}}")
@@ -52,17 +65,6 @@ template(name="header")
     #header-main-bar(class="{{#if wrappedHeader}}wrapper{{/if}}")
     #header-main-bar(class="{{#if wrappedHeader}}wrapper{{/if}}")
       +Template.dynamic(template=headerBar)
       +Template.dynamic(template=headerBar)
 
 
-      //unless hideLogo
-
-        //-
-          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
-          the list of all boards.
-
-      //  unless currentSetting.hideLogo
-      //    a.wekan-logo(href="{{pathFor 'home'}}" title="{{_ 'header-logo-title'}}")
-      //    img(src="{{pathFor '/logo-header.png'}}" alt="")
-
   if appIsOffline
   if appIsOffline
     +offlineWarning
     +offlineWarning
 
 

+ 17 - 0
client/components/main/layouts.jade

@@ -19,6 +19,23 @@ head
 
 
 template(name="userFormsLayout")
 template(name="userFormsLayout")
   section.auth-layout
   section.auth-layout
+    if currentSetting.hideLogo
+      h1.at-form-landing-logo
+        br
+        br
+    unless currentSetting.hideLogo
+      h1.at-form-landing-logo
+      if currentSetting.customLoginLogoImageUrl
+        if currentSetting.customLoginLogoTargetUrl
+          a(href="{{currentSetting.customLoginLogoTargetUrl}}")
+            img(src="{{currentSetting.customLoginLogoImageUrl}}" width="300" height="auto")
+          br
+        unless currentSetting.customLoginLogoTargetUrl
+          img(src="{{currentSetting.customLoginLogoImageUrl}}" width="300" height="auto")
+          br
+      unless currentSetting.customLoginLogoImageUrl
+        img(src="{{pathFor '/wekan-logo.svg'}}" alt="" width="300" height="auto")
+        br
     section.auth-dialog
     section.auth-dialog
       if isLoading
       if isLoading
         +loader
         +loader

+ 0 - 1
client/components/main/layouts.styl

@@ -447,7 +447,6 @@ a
   flex-direction: column
   flex-direction: column
   align-items: center
   align-items: center
   justify-content: center
   justify-content: center
-  height: 100%
 
 
   .auth-dialog
   .auth-dialog
     margin: 0 !important
     margin: 0 !important

+ 23 - 8
client/components/settings/settingBody.jade

@@ -163,13 +163,6 @@ 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.wekan-form-control#hide-logo(type="radio" name="hideLogo" value="true" checked="{{#if currentSetting.hideLogo}}checked{{/if}}")
-        span {{_ 'yes'}}
-        input.wekan-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 {{_ 'display-authentication-method'}}
       .title {{_ 'display-authentication-method'}}
       .form-group.flex
       .form-group.flex
@@ -184,10 +177,32 @@ template(name='layoutSettings')
       .title {{_ 'custom-product-name'}}
       .title {{_ 'custom-product-name'}}
       .form-group
       .form-group
         input.wekan-form-control#product-name(type="text", placeholder="" value="{{currentSetting.productName}}")
         input.wekan-form-control#product-name(type="text", placeholder="" value="{{currentSetting.productName}}")
+    li.layout-form
+      .title {{_ 'hide-logo'}}
+      .form-group.flex
+        input.wekan-form-control#hide-logo(type="radio" name="hideLogo" value="true" checked="{{#if currentSetting.hideLogo}}checked{{/if}}")
+        span {{_ 'yes'}}
+        input.wekan-form-control#hide-logo(type="radio" name="hideLogo" value="false" checked="{{#unless currentSetting.hideLogo}}checked{{/unless}}")
+        span {{_ 'no'}}
+    li.layout-form
+      .title {{_ 'custom-login-logo-image-url'}}
+      .form-group
+        input.wekan-form-control#custom-login-logo-image-url(type="text", placeholder="" value="{{currentSetting.customLoginLogoImageUrl}}")
+    li.layout-form
+      .title {{_ 'custom-login-logo-target-url'}}
+      .form-group
+        input.wekan-form-control#custom-login-logo-target-url(type="text", placeholder="" value="{{currentSetting.customLoginLogoTargetUrl}}")
+    li.layout-form
+      .title {{_ 'custom-top-left-corner-logo-image-url'}}
+      .form-group
+        input.wekan-form-control#custom-top-left-corner-logo-image-url(type="text", placeholder="" value="{{currentSetting.customTopLeftCornerLogoImageUrl}}")
+    li.layout-form
+      .title {{_ 'custom-top-left-corner-logo-target-url'}}
+      .form-group
+        input.wekan-form-control#custom-top-left-corner-logo-target-url(type="text", placeholder="" value="{{currentSetting.customTopLeftCornerLogoTargetUrl}}")
     li
     li
       button.js-save-layout.primary {{_ 'save'}}
       button.js-save-layout.primary {{_ 'save'}}
 
 
-
 template(name='selectAuthenticationMethod')
 template(name='selectAuthenticationMethod')
   select#defaultAuthenticationMethod
   select#defaultAuthenticationMethod
     each authentications
     each authentications

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

@@ -167,6 +167,22 @@ BlazeComponent.extendComponent({
     const productName = $('#product-name')
     const productName = $('#product-name')
       .val()
       .val()
       .trim();
       .trim();
+    const customLoginLogoImageUrl = $('#custom-login-logo-image-url')
+      .val()
+      .trim();
+    const customLoginLogoTargetUrl = $('#custom-login-logo-target-url')
+      .val()
+      .trim();
+    const customTopLeftCornerLogoImageUrl = $(
+      '#custom-top-left-corner-logo-image-url',
+    )
+      .val()
+      .trim();
+    const customTopLeftCornerLogoTargetUrl = $(
+      '#custom-top-left-corner-logo-target-url',
+    )
+      .val()
+      .trim();
     const hideLogoChange = $('input[name=hideLogo]:checked').val() === 'true';
     const hideLogoChange = $('input[name=hideLogo]:checked').val() === 'true';
     const displayAuthenticationMethod =
     const displayAuthenticationMethod =
       $('input[name=displayAuthenticationMethod]:checked').val() === 'true';
       $('input[name=displayAuthenticationMethod]:checked').val() === 'true';
@@ -177,6 +193,10 @@ BlazeComponent.extendComponent({
         $set: {
         $set: {
           productName,
           productName,
           hideLogo: hideLogoChange,
           hideLogo: hideLogoChange,
+          customLoginLogoImageUrl,
+          customLoginLogoTargetUrl,
+          customTopLeftCornerLogoImageUrl,
+          customTopLeftCornerLogoTargetUrl,
           displayAuthenticationMethod,
           displayAuthenticationMethod,
           defaultAuthenticationMethod,
           defaultAuthenticationMethod,
         },
         },

+ 6 - 0
i18n/en.i18n.json

@@ -511,9 +511,15 @@
   "unassign-member": "Unassign member",
   "unassign-member": "Unassign member",
   "unsaved-description": "You have an unsaved description.",
   "unsaved-description": "You have an unsaved description.",
   "unwatch": "Unwatch",
   "unwatch": "Unwatch",
+  "url-when-custom-login-logo-clicked": "URL when Custom Login Logo clicked",
+  "url-when-custom-top-left-corner-logo-clicked": "URL when Custom Top Left Corner Logo clicked",
   "upload": "Upload",
   "upload": "Upload",
   "upload-avatar": "Upload an avatar",
   "upload-avatar": "Upload an avatar",
   "uploaded-avatar": "Uploaded an avatar",
   "uploaded-avatar": "Uploaded an avatar",
+  "custom-top-left-corner-logo-image-url": "Custom Top Left Corner Logo Image URL",
+  "custom-top-left-corner-logo-target-url": "Custom Top Left Corner Logo Target URL",
+  "custom-login-logo-image-url": "Custom Login Logo Image URL",
+  "custom-login-logo-target-url": "Custom Login Logo Target URL",
   "username": "Username",
   "username": "Username",
   "view-it": "View it",
   "view-it": "View it",
   "warn-list-archived": "warning: this card is in an list at Archive",
   "warn-list-archived": "warning: this card is in an list at Archive",

+ 16 - 0
models/settings.js

@@ -45,6 +45,22 @@ Settings.attachSchema(
       type: Boolean,
       type: Boolean,
       optional: true,
       optional: true,
     },
     },
+    customLoginLogoImageUrl: {
+      type: String,
+      optional: true,
+    },
+    customLoginLogoTargetUrl: {
+      type: String,
+      optional: true,
+    },
+    customTopLeftCornerLogoImageUrl: {
+      type: String,
+      optional: true,
+    },
+    customTopLeftCornerLogoTargetUrl: {
+      type: String,
+      optional: true,
+    },
     createdAt: {
     createdAt: {
       type: Date,
       type: Date,
       denyUpdate: true,
       denyUpdate: true,

文件差异内容过多而无法显示
+ 0 - 0
public/wekan-logo.svg


+ 16 - 0
server/migrations.js

@@ -1044,3 +1044,19 @@ Migrations.add('add-default-profile-view', () => {
     }
     }
   });
   });
 });
 });
+
+Migrations.add('add-hide-logo-by-default', () => {
+  Settings.update(
+    {
+      hideLogo: {
+        hideLogo: false,
+      },
+    },
+    {
+      $set: {
+        hideLogo: true,
+      },
+    },
+    noValidateMulti,
+  );
+});

+ 4 - 0
server/publications/settings.js

@@ -12,6 +12,10 @@ Meteor.publish('setting', () => {
         disableRegistration: 1,
         disableRegistration: 1,
         productName: 1,
         productName: 1,
         hideLogo: 1,
         hideLogo: 1,
+        customLoginLogoImageUrl: 1,
+        customLoginLogoTargetUrl: 1,
+        customTopLeftCornerLogoImageUrl: 1,
+        customTopLeftCornerLogoTargetUrl: 1,
         customHTMLafterBodyStart: 1,
         customHTMLafterBodyStart: 1,
         customHTMLbeforeBodyEnd: 1,
         customHTMLbeforeBodyEnd: 1,
         displayAuthenticationMethod: 1,
         displayAuthenticationMethod: 1,

部分文件因为文件数量过多而无法显示