Bläddra i källkod

Add attachments to mail list

- Add attaments display to mail list
Alexey Edelev 4 år sedan
förälder
incheckning
6a5b7df32e
3 ändrade filer med 27 tillägg och 2 borttagningar
  1. 2 0
      config/config.go
  2. 17 2
      web/css/index.css
  3. 8 0
      web/templates/maillist.html

+ 2 - 0
config/config.go

@@ -167,11 +167,13 @@ func newConfig() (config *gostfixConfig, err error) {
 
 	webPort := cfg.Section("").Key(KeyWebPort).String()
 	if webPort == "" {
+		log.Printf("Web server port is not specified in configuration file, use default 65200")
 		webPort = "65200"
 	}
 
 	saslPort := cfg.Section("").Key(KeySASLPort).String()
 	if saslPort == "" {
+		log.Printf("SASL server port is not specified in configuration file, use default 65201")
 		saslPort = "65201"
 	}
 

+ 17 - 2
web/css/index.css

@@ -137,7 +137,7 @@ html, body {
     padding: var(--base-text-padding);
     font-size: var(--small-text-size);
     text-align: center;
-    color: var(--secondary-text-dark-color)
+    color: var(--secondary-text-dark-color);
 }
 
 .mailControlPanel {
@@ -229,9 +229,24 @@ html, body {
     transition: background-color .2s, color .2s;
 }
 
-
 .attachment:hover, .attachment:focus {
     background-color: var(--primary-dark-color);
     color: var(--secondary-text-color);
     cursor: pointer;
+}
+
+.listAttachment {
+    background-color: var(--bg-color);
+    border-radius: 20px;
+    border: 1px solid var(--inactive-color);
+    color: var(--secondary-text-dark-color);
+    font-weight: bold;
+    margin-right: 10px;
+    padding: var(--tiny-text-padding) var(--base-text-padding) var(--tiny-text-padding) var(--base-text-padding);
+    transition: color .2s;
+}
+
+.listAttachment:hover, .attachment:focus {
+    color: var(--primary-text-color);
+    cursor: pointer;
 }

+ 8 - 0
web/templates/maillist.html

@@ -12,6 +12,14 @@
         <div class="mailSubject elidedText noselect">{{.Mail.Header.Subject}}</div>
         <div id="mailDate{{.Id}}" class="mailDate elidedText noselect"><script>localDate('mailDate{{.Id}}', {{.Mail.Header.Date}})</script></div>
     </div>
+    {{if len .Mail.Body.Attachments}}
+    <div class="noselect" style="width: 100%; display: flex; flex-direction: row; margin-bottom: 10px;">
+        <img id="attachementIcon" style="width: 20px; margin-left: 60px; margin-right: 10px;" src="/assets/attachments.svg"/>
+        {{range .Mail.Body.Attachments}}
+        <div class="listAttachment" onclick="downloadAttachment({{.Id}}, {{.FileName}}); event.stopPropagation(); return false;">{{.FileName}}</div>
+        {{end}}
+    </div>
+    {{end}}
     <div id="mailControlPanel{{.Id}}" class="mailControlPanel">
         <div style="width: 100%; height: 100%; display: flex; flex-direction: row;">
             <img id="readListIcon{{.Id}}" class="iconBtn" style="width: 20px; margin-left: 40px; margin-right: 10px;" onclick="toggleRead('{{.Id}}', 'readListIcon'); event.stopPropagation(); return false;" src="/assets/{{if .Read}}read{{else}}unread{{end}}.svg"/>