Upgrade ps + halogen versions.
[?]
Feb 22, 2016, 1:15 AM
JXG3FCXYBDKMUD77DOM7RCIJYKB7BILC43OHHDZBE7YQRGAMUCCACDependencies
- [2]
QQXR7DTORework login component to use more appropriate Bootstrap theme. - [3]
RB2ETNIFAdd skeletal PureScript client project. - [4]
HO2PFRABClient login now handles response correctly. - [5]
ARX7SHY5Begin work on login UI. - [6]
EA5BFM5GSplit Login component into its own module. - [*]
ADMKQQGCInitial empty Snap project. - [*]
PGZJ736CUpdate aftok.cfg.example and revise INSTALL instructions
Change contents
- edit in .gitignore at line 6[9.33][9.33]
.stack-work - edit in client/.gitignore at line 8[3.31]
.psc-package - replacement in client/bower.json at line 14
"purescript-console": "^0.1.0","purescript-halogen": "~0.5.14","purescript-affjax": "~0.10.1""purescript-halogen": "^1.2.1","purescript-css": "^2.1.0","purescript-halogen-css": "^5.0.0","purescript-dom": "^3.7.0","purescript-affjax": "^3.0.2","purescript-now": "^2.0.0" - edit in client/dist/aftok.css at line 41[2.821]
.tl-wrapper {height: 45px;width: 962px;margin-left: auto;margin-right: auto;} - file addition: package.json[3.1]
{"devDependencies": {"pulp": "^10.0.0","purescript": "^0.10.7","purescript-psa": "^0.4.0","rimraf": "^2.5.4"}} - edit in client/src/Aftok/Login.purs at line 2
import Prelude (type (~>), Void, bind, pure, ($), ($>), (<$>), const) - edit in client/src/Aftok/Login.purs at line 5
import Prelude - edit in client/src/Aftok/Login.purs at line 8
import Data.Either (Either(..)) - edit in client/src/Aftok/Login.purs at line 10
import Data.Functor (($>)) - replacement in client/src/Aftok/Login.purs at line 11
import Halogenimport Halogen.HTML.Core (className)import qualified Halogen.HTML.Indexed as Himport qualified Halogen.HTML.Events.Indexed as Eimport qualified Halogen.HTML.Properties.Indexed as Pimport Halogen as Himport Halogen.Aff (HalogenEffects)import Halogen.HTML.Core (ClassName(..))import Halogen.HTML as HHimport Halogen.HTML.Events as Eimport Halogen.HTML.Properties as P - replacement in client/src/Aftok/Login.purs at line 19
import Network.HTTP.Methodimport Network.HTTP.StatusCodeimport Data.HTTP.Method (Method(..))import Network.HTTP.StatusCode (StatusCode(..)) - replacement in client/src/Aftok/Login.purs at line 37
ui :: forall eff. Component LoginState LoginAction (Aff (LoginEffects eff))ui = component render evalwhereui :: forall eff. H.Component HH.HTML LoginAction LoginState Void (Aff (LoginEffects eff))ui = H.component{ initialState: const initialState, render, eval, receiver: const Nothing} where - replacement in client/src/Aftok/Login.purs at line 45
render :: LoginState -> ComponentHTML LoginActionrender :: LoginState -> H.ComponentHTML LoginAction - replacement in client/src/Aftok/Login.purs at line 47
H.div[ P.classes (className <$> ["container"]) ][ H.form[ P.classes [ className "form-signin" ] ][ H.h2 [ P.classes [ className "form-signin-heading" ]] [ H.text "Aftok Login" ], H.label [ P.for "inputUsername", P.classes [ className "sr-only" ]] [ H.text "username" ], H.input[ P.inputType P.InputTextHH.div[ P.classes (ClassName <$> ["container"]) ][ HH.form[ P.classes [ ClassName "form-signin" ] ][ HH.h2 [ P.classes [ ClassName "form-signin-heading" ]] [ HH.text "Aftok Login" ], HH.label [ P.for "inputUsername", P.classes [ ClassName "sr-only" ]] [ HH.text "username" ], HH.input[ P.type_ P.InputText - replacement in client/src/Aftok/Login.purs at line 56
, P.classes [ className "form-control" ], P.classes [ ClassName "form-control" ] - replacement in client/src/Aftok/Login.purs at line 63
, H.label [ P.for "inputPassword", P.classes [ className "sr-only" ]] [ H.text "username" ], H.input[ P.inputType P.InputPassword, HH.label [ P.for "inputPassword", P.classes [ ClassName "sr-only" ]] [ HH.text "username" ], HH.input[ P.type_ P.InputPassword - replacement in client/src/Aftok/Login.purs at line 67
, P.classes [ className "form-control" ], P.classes [ ClassName "form-control" ] - replacement in client/src/Aftok/Login.purs at line 73
, H.button[ P.classes (className <$> ["btn", "btn-primary"]), HH.button[ P.classes (ClassName <$> ["btn", "btn-primary"]) - replacement in client/src/Aftok/Login.purs at line 77
[ H.text "Sign in" ][ HH.text "Sign in" ] - replacement in client/src/Aftok/Login.purs at line 81
eval :: Natural LoginAction (ComponentDSL LoginState LoginAction (Aff (LoginEffects eff)))eval (SetUsername user next) = modify (_ { username = user }) $> nexteval (SetPassword pass next) = modify (_ { password = pass }) $> nexteval :: LoginAction ~> H.ComponentDSL LoginState LoginAction Void (Aff (LoginEffects eff))eval (SetUsername user next) = H.modify (_ { username = user }) $> nexteval (SetPassword pass next) = H.modify (_ { password = pass }) $> next - replacement in client/src/Aftok/Login.purs at line 85
result <- liftAff' (login user pass)result <- H.liftAff (login user pass) - replacement in client/src/Aftok/Login.purs at line 96
result <- affjax $ { method: POSTresult <- affjax $ { method: Left POST - edit in client/src/Aftok/Login.purs at line 102
, withCredentials: true - file addition: Timeline.purs[3.1]
module Aftok.Timeline whereimport Preludeimport Control.Monad.Eff (Eff())import Control.Monad.Eff.Class (liftEff)import Control.Monad.Eff.Now (NOW, nowDateTime, now)import Control.Monad.Aff (Aff())import Control.Alt ((<|>))import Data.Array (cons)--import Data.Bounded (bottom)--import Data.Date (Date(..), day, month, year)import Data.DateTime (DateTime(..), date, adjust)import Data.DateTime.Instant (Instant, unInstant, fromDateTime)import Data.DateTime.Locale (LocalValue(..))import Data.Int (toNumber)import Data.Time.Duration (Milliseconds(..), Days(..))import Data.Maybe (Maybe(..), maybe)import Math (abs)import CSS.Display (position, absolute)import CSS.Geometry (left) --, width, top, height)import CSS.Size (px)import Halogen as Himport Halogen.Aff (HalogenEffects)import Halogen.HTML.CSS as CSSimport Halogen.HTML as HH-- import Halogen.HTML.Events as Eimport Halogen.HTML.Properties as Ptype Interval ={ start :: Instant, end :: Instant}type TimelineLimits ={ start :: Instant, current :: Instant, end :: Instant}type TimelineConfig ={ width :: Number}type TimelineState ={ limits :: TimelineLimits, history :: Array Interval, active :: Maybe Interval}data TimelineAction a= Start a| Stop a| Refresh a-- | Open a-- | Close atype TimelineEffects eff = HalogenEffects (now :: NOW | eff)initialState :: forall eff. Eff (now :: NOW | eff) TimelineStateinitialState = doLocalValue l t <- nowDateTimelet startOfDay = DateTime (date t) bottomendOfDay = adjust (Days (toNumber 1)) startOfDaystartInstant = fromDateTime startOfDaylimits ={ start: startInstant, current: fromDateTime t, end: maybe startInstant fromDateTime endOfDay}pure $ { limits : limits, history : [], active : Nothing}ui :: forall eff. TimelineConfig -> TimelineState -> H.Component HH.HTML TimelineAction TimelineState Void (Aff (TimelineEffects eff))ui conf s = H.component{ initialState: const s, render, eval, receiver: const Nothing} whereintervalHtml :: forall f. TimelineLimits -> Interval -> H.ComponentHTML fintervalHtml limits i =let offset = ((ilen limits.start i.start) / (ilen limits.start limits.end)) * conf.widthin HH.div[ CSS.style doposition absoluteleft (px offset)][ HH.div[ P.classes (H.ClassName <$> ["center"]) ][]]-- <div style="position: absolute; left: 582.268px; width: 92.4619px; top: 6px; height: 33px;" class="TimelineElement Element ui-resizable ui-draggable" data-original-title=""><div class="center" style="background-color: rgb(255, 0, 0);"></div><div class="ui-resizable-w ui-resizable-handle"></div><div class="ui-draggable-pad"></div><div class="ui-resizable-e ui-resizable-handle"></div></div>render :: TimelineState -> H.ComponentHTML TimelineActionrender st =HH.div[ P.classes (H.ClassName <$> ["container"]) ][ HH.div[ P.classes (H.ClassName <$> ["tl-wrapper"]) ](intervalHtml st.limits <$> st.history)]eval :: TimelineAction ~> H.ComponentDSL TimelineState TimelineAction Void (Aff (TimelineEffects eff))-- The user has requested to start the clock.eval (Start next) = dot <- liftEff nowH.modify (start t)pure next-- The user has requested to stop the clockeval (Stop next) = dot <- liftEff nowH.modify (stop t)pure next-- The runtime system renders a clock tickeval (Refresh next) = dot <- liftEff nowH.modify (refresh t)pure next-- The user has requested to open a new interval beginning at a-- specific point on the timeline (mouse down)-- The user has requested to close the currently open interval-- at a specific point on the timeline (mouse up)--start :: Instant -> TimelineState -> TimelineStatestart t s ={ limits: s.limits, history: s.history, active: s.active <|> Just { start: t, end: t }}stop :: Instant -> TimelineState -> TimelineStatestop t s ={ limits: s.limits, history: maybe s.history (\st -> cons { start: st.start, end: t } s.history) s.active, active: Nothing}refresh :: Instant -> TimelineState -> TimelineStaterefresh t s ={ limits: s.limits, history: s.history, active: map (\a -> { start: a.start, end: t }) s.active}ilen :: Instant -> Instant -> Numberilen d d' =let n (Milliseconds x) = xin abs $ n (unInstant d) - n (unInstant d') - replacement in client/src/Main.purs at line 3
import Preludeimport Prelude (Unit, bind, ($)) - edit in client/src/Main.purs at line 6
import Control.Monad.Eff.Exception (throwException) - edit in client/src/Main.purs at line 7
import Control.Monad.Aff (runAff) - replacement in client/src/Main.purs at line 8
import Halogenimport Halogen.Util (appendToBody, onLoad)import Halogen.Util (appendToBody, onLoad)import qualified Aftok.Login as Limport Halogen.Aff (HalogenEffects)import Halogen.VDom.Driver (runUI)import Halogen.Aff as HAimport Aftok.Login as L - replacement in client/src/Main.purs at line 18[3.3548]→[3.3548:3602](∅→∅),[3.3602]→[3.3398:3433](∅→∅),[3.3433]→[3.3633:3666](∅→∅),[3.3633]→[3.3633:3666](∅→∅)
main = runAff throwException (const (pure unit)) $ doapp <- runUI L.ui L.initialStateonLoad $ appendToBody app.node[3.3548]main = HA.runHalogenAff $ dobody <- HA.awaitBodyrunUI L.ui L.initialState body