mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 10:07:02 +00:00
ui: Reformat with elm-format 0.8.1
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
module Data.Date exposing (..)
|
module Data.Date exposing (date)
|
||||||
|
|
||||||
import Date exposing (Date)
|
import Date exposing (Date)
|
||||||
import Json.Decode as Decode exposing (..)
|
import Json.Decode as Decode exposing (..)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Data.Message exposing (..)
|
module Data.Message exposing (Attachment, Message, attachmentDecoder, decoder)
|
||||||
|
|
||||||
import Data.Date exposing (date)
|
import Data.Date exposing (date)
|
||||||
import Date exposing (Date)
|
import Date exposing (Date)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Data.MessageHeader exposing (..)
|
module Data.MessageHeader exposing (MessageHeader, decoder)
|
||||||
|
|
||||||
import Data.Date exposing (date)
|
import Data.Date exposing (date)
|
||||||
import Date exposing (Date)
|
import Date exposing (Date)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Data.Metrics exposing (..)
|
module Data.Metrics exposing (Metrics, decodeIntList, decoder)
|
||||||
|
|
||||||
import Json.Decode as Decode exposing (..)
|
import Json.Decode as Decode exposing (..)
|
||||||
import Json.Decode.Pipeline exposing (..)
|
import Json.Decode.Pipeline exposing (..)
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
module Data.Session
|
module Data.Session exposing
|
||||||
exposing
|
( Msg(..)
|
||||||
( Msg(..)
|
, Persistent
|
||||||
, Persistent
|
, Session
|
||||||
, Session
|
, decodeValueWithDefault
|
||||||
, decodeValueWithDefault
|
, decoder
|
||||||
, decoder
|
, init
|
||||||
, init
|
, none
|
||||||
, none
|
, update
|
||||||
, update
|
)
|
||||||
)
|
|
||||||
|
|
||||||
import Json.Decode as Decode exposing (..)
|
import Json.Decode as Decode exposing (..)
|
||||||
import Json.Decode.Pipeline exposing (..)
|
import Json.Decode.Pipeline exposing (..)
|
||||||
@@ -63,6 +62,7 @@ update msg session =
|
|||||||
AddRecent mailbox ->
|
AddRecent mailbox ->
|
||||||
if List.head session.persistent.recentMailboxes == Just mailbox then
|
if List.head session.persistent.recentMailboxes == Just mailbox then
|
||||||
session
|
session
|
||||||
|
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
recent =
|
recent =
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module HttpUtil exposing (..)
|
module HttpUtil exposing (delete, errorString, patch)
|
||||||
|
|
||||||
import Http
|
import Http
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Main exposing (..)
|
module Main exposing (Model, Msg(..), Page(..), applySession, init, main, pageSubscriptions, sessionChange, setRoute, subscriptions, update, updatePage, view)
|
||||||
|
|
||||||
import Data.Session as Session exposing (Session, decoder)
|
import Data.Session as Session exposing (Session, decoder)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
@@ -13,6 +13,7 @@ import Route exposing (Route)
|
|||||||
import Views.Page as Page exposing (ActivePage(..), frame)
|
import Views.Page as Page exposing (ActivePage(..), frame)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- MODEL
|
-- MODEL
|
||||||
|
|
||||||
|
|
||||||
@@ -112,6 +113,7 @@ update msg model =
|
|||||||
-- Responds to new browser URL.
|
-- Responds to new browser URL.
|
||||||
if model.session.routing then
|
if model.session.routing then
|
||||||
setRoute route model
|
setRoute route model
|
||||||
|
|
||||||
else
|
else
|
||||||
-- Skip once, but re-enable routing.
|
-- Skip once, but re-enable routing.
|
||||||
( model, Cmd.none, Session.EnableRouting )
|
( model, Cmd.none, Session.EnableRouting )
|
||||||
@@ -256,6 +258,7 @@ applySession ( model, cmd, sessionMsg ) =
|
|||||||
if session.persistent == model.session.persistent then
|
if session.persistent == model.session.persistent then
|
||||||
-- No change
|
-- No change
|
||||||
( newModel, cmd )
|
( newModel, cmd )
|
||||||
|
|
||||||
else
|
else
|
||||||
( newModel
|
( newModel
|
||||||
, Cmd.batch [ cmd, Ports.storeSession session.persistent ]
|
, Cmd.batch [ cmd, Ports.storeSession session.persistent ]
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Json.Encode as Encode
|
|||||||
import Ports
|
import Ports
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- MODEL --
|
-- MODEL --
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import Task
|
|||||||
import Time exposing (Time)
|
import Time exposing (Time)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- MODEL
|
-- MODEL
|
||||||
|
|
||||||
|
|
||||||
@@ -105,6 +106,7 @@ subscriptions model =
|
|||||||
ShowingList _ (ShowingMessage { message }) ->
|
ShowingList _ (ShowingMessage { message }) ->
|
||||||
if message.seen then
|
if message.seen then
|
||||||
Sub.none
|
Sub.none
|
||||||
|
|
||||||
else
|
else
|
||||||
Time.every (250 * Time.millisecond) SeenTick
|
Time.every (250 * Time.millisecond) SeenTick
|
||||||
|
|
||||||
@@ -212,6 +214,7 @@ update session msg model =
|
|||||||
ShowingList list (ShowingMessage visible) ->
|
ShowingList list (ShowingMessage visible) ->
|
||||||
if visible.message.seen then
|
if visible.message.seen then
|
||||||
( model, Cmd.none, Session.none )
|
( model, Cmd.none, Session.none )
|
||||||
|
|
||||||
else
|
else
|
||||||
-- Set delay before reporting message as seen to backend.
|
-- Set delay before reporting message as seen to backend.
|
||||||
( { model
|
( { model
|
||||||
@@ -246,6 +249,7 @@ update session msg model =
|
|||||||
Just deadline ->
|
Just deadline ->
|
||||||
if now >= deadline then
|
if now >= deadline then
|
||||||
updateMarkMessageSeen model message
|
updateMarkMessageSeen model message
|
||||||
|
|
||||||
else
|
else
|
||||||
( model, Cmd.none, Session.none )
|
( model, Cmd.none, Session.none )
|
||||||
|
|
||||||
@@ -267,6 +271,7 @@ updateMessageResult model message =
|
|||||||
bodyMode =
|
bodyMode =
|
||||||
if message.html == "" then
|
if message.html == "" then
|
||||||
TextBody
|
TextBody
|
||||||
|
|
||||||
else
|
else
|
||||||
model.bodyMode
|
model.bodyMode
|
||||||
in
|
in
|
||||||
@@ -313,6 +318,7 @@ updateSearchInput model searchInput =
|
|||||||
searchFilter =
|
searchFilter =
|
||||||
if String.length searchInput > 1 then
|
if String.length searchInput > 1 then
|
||||||
String.toLower searchInput
|
String.toLower searchInput
|
||||||
|
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
in
|
in
|
||||||
@@ -393,6 +399,7 @@ updateMarkMessageSeen model message =
|
|||||||
updateSeen header =
|
updateSeen header =
|
||||||
if header.id == message.id then
|
if header.id == message.id then
|
||||||
{ header | seen = True }
|
{ header | seen = True }
|
||||||
|
|
||||||
else
|
else
|
||||||
header
|
header
|
||||||
|
|
||||||
@@ -568,6 +575,7 @@ messageBody message bodyMode =
|
|||||||
tabs =
|
tabs =
|
||||||
if message.html == "" then
|
if message.html == "" then
|
||||||
[ plainText ]
|
[ plainText ]
|
||||||
|
|
||||||
else
|
else
|
||||||
[ safeHtml, plainText ]
|
[ safeHtml, plainText ]
|
||||||
in
|
in
|
||||||
@@ -592,6 +600,7 @@ attachments message =
|
|||||||
in
|
in
|
||||||
if List.isEmpty message.attachments then
|
if List.isEmpty message.attachments then
|
||||||
div [] []
|
div [] []
|
||||||
|
|
||||||
else
|
else
|
||||||
table [ class "attachments well" ] (List.map (attachmentRow baseUrl) message.attachments)
|
table [ class "attachments well" ] (List.map (attachmentRow baseUrl) message.attachments)
|
||||||
|
|
||||||
@@ -645,6 +654,7 @@ filterMessageList : MessageList -> List MessageHeader
|
|||||||
filterMessageList list =
|
filterMessageList list =
|
||||||
if list.searchFilter == "" then
|
if list.searchFilter == "" then
|
||||||
list.headers
|
list.headers
|
||||||
|
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
matches header =
|
matches header =
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import Ports
|
|||||||
import Route
|
import Route
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- MODEL
|
-- MODEL
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +105,7 @@ view session model =
|
|||||||
[ text
|
[ text
|
||||||
(if model.connected then
|
(if model.connected then
|
||||||
"Connected."
|
"Connected."
|
||||||
|
|
||||||
else
|
else
|
||||||
"Disconnected!"
|
"Disconnected!"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import Svg.Attributes as SvgAttrib
|
|||||||
import Time exposing (Time)
|
import Time exposing (Time)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- MODEL --
|
-- MODEL --
|
||||||
|
|
||||||
|
|
||||||
@@ -381,6 +382,7 @@ zeroPadList numbers =
|
|||||||
in
|
in
|
||||||
if needed > 0 then
|
if needed > 0 then
|
||||||
List.repeat needed 0 ++ numbers
|
List.repeat needed 0 ++ numbers
|
||||||
|
|
||||||
else
|
else
|
||||||
numbers
|
numbers
|
||||||
|
|
||||||
@@ -394,6 +396,7 @@ fmtInt n =
|
|||||||
thousands str =
|
thousands str =
|
||||||
if String.length str <= 3 then
|
if String.length str <= 3 then
|
||||||
str
|
str
|
||||||
|
|
||||||
else
|
else
|
||||||
thousands (String.slice 0 -3 str) ++ "," ++ String.right 3 str
|
thousands (String.slice 0 -3 str) ++ "," ++ String.right 3 str
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
port module Ports
|
port module Ports exposing
|
||||||
exposing
|
( monitorCommand
|
||||||
( monitorCommand
|
, monitorMessage
|
||||||
, monitorMessage
|
, onSessionChange
|
||||||
, onSessionChange
|
, storeSession
|
||||||
, storeSession
|
, windowTitle
|
||||||
, windowTitle
|
)
|
||||||
)
|
|
||||||
|
|
||||||
import Data.Session exposing (Persistent)
|
import Data.Session exposing (Persistent)
|
||||||
import Json.Encode exposing (Value)
|
import Json.Encode exposing (Value)
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ fromLocation : Location -> Route
|
|||||||
fromLocation location =
|
fromLocation location =
|
||||||
if String.isEmpty location.hash then
|
if String.isEmpty location.hash then
|
||||||
Home
|
Home
|
||||||
|
|
||||||
else
|
else
|
||||||
case parseHash matcher location of
|
case parseHash matcher location of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ navbarRecent page controls =
|
|||||||
title =
|
title =
|
||||||
if active then
|
if active then
|
||||||
controls.recentActive
|
controls.recentActive
|
||||||
|
|
||||||
else
|
else
|
||||||
"Recent Mailboxes"
|
"Recent Mailboxes"
|
||||||
|
|
||||||
@@ -98,6 +99,7 @@ navbarRecent page controls =
|
|||||||
items =
|
items =
|
||||||
if active then
|
if active then
|
||||||
List.tail controls.recentOptions |> Maybe.withDefault []
|
List.tail controls.recentOptions |> Maybe.withDefault []
|
||||||
|
|
||||||
else
|
else
|
||||||
controls.recentOptions
|
controls.recentOptions
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
module Tests exposing (..)
|
module Tests exposing (all)
|
||||||
|
|
||||||
import Expect
|
import Expect
|
||||||
import Test exposing (..)
|
import Test exposing (..)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Check out http://package.elm-lang.org/packages/elm-community/elm-test/latest to learn more about testing in Elm!
|
-- Check out http://package.elm-lang.org/packages/elm-community/elm-test/latest to learn more about testing in Elm!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user