diff --git a/.gitignore b/.gitignore
index 7c92fb9..63a37a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,8 @@ generated-docs/
.purs*
.psa*
.spago/
-
+css
+metajelo-ui-css-classes
prod/
prod/css
diff --git a/README.md b/README.md
index c2cb9dd..b1d6a97 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,14 @@
Web tools to display
[metajelo](https://github.com/labordynamicsinstitute/metajelo) packages.
-# Usage
+# Styling with CSS
+
+By default, CSS files are retrieved from a [separate repository](https://github.com/labordynamicsinstitute/metajelo-ui-css-classes) using `scripts/getcss`; the file `css/style.css` contains some default styles used in our examples.
+Feel free to include it, or modify it (renaming the file is also possible):
+
+```html
+
+```
# Building
diff --git a/css/fonts/icomoon.eot b/css/fonts/icomoon.eot
deleted file mode 100644
index fced330..0000000
Binary files a/css/fonts/icomoon.eot and /dev/null differ
diff --git a/css/fonts/icomoon.svg b/css/fonts/icomoon.svg
deleted file mode 100644
index d8af565..0000000
--- a/css/fonts/icomoon.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/css/fonts/icomoon.ttf b/css/fonts/icomoon.ttf
deleted file mode 100644
index 1f05073..0000000
Binary files a/css/fonts/icomoon.ttf and /dev/null differ
diff --git a/css/fonts/icomoon.woff b/css/fonts/icomoon.woff
deleted file mode 100644
index bf352af..0000000
Binary files a/css/fonts/icomoon.woff and /dev/null differ
diff --git a/css/style.css b/css/style.css
deleted file mode 100644
index 0c3661d..0000000
--- a/css/style.css
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -----------------------------------------------------------------------------
-
- FONTS
-
------------------------------------------------------------------------------ */
-@import url('https://fonts.googleapis.com/css?family=Oxygen:300,400,700');
-
-/* -----------------------------------------------------------------------------
-
- BOX SIZING RESET
-
------------------------------------------------------------------------------ */
-*,
-*::before,
-*::after {
- box-sizing: inherit;
-}
-
-html {
- box-sizing: border-box;
-}
-
-body {
- font-size: 14px;
- line-height: 1.8;
-}
-
-input {
- margin-right: 5px;
-}
-/* -----------------------------------------------------------------------------
-
- ROOT ELEMENTS
-
------------------------------------------------------------------------------ */
-
-.metajelo_record {
- margin: 0;
- padding: 0;
- height: 100%;
- color: #4F4F4F;
- background-color: #FBFBFB;
- font-family: "Oxygen", Helvetica, sans-serif;
- font-size: 14px;
- line-height: 1.8;
- padding: 1em;
-}
-
-.metajelo_productsHeader {
- font-size: 30px;
- color: #3b3b3b;
- line-height: 1.2;
- font-weight: 700;
-}
-
-.metajelo_relatedIdentifiersHeader {
- font-size: 18px;
- color: #3b3b3b;
- line-height: 1.2;
- font-weight: 600;
-}
-
-.metajelo_productCitation {
- font-weight: 650;
- background-color: #FFFEA8;
- padding: 2px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- -o-border-radius: 5px;
- -ms-border-radius: 5px;
- border-radius: 5px;
-}
-
-.metajelo_errorDisplay {
- font-weight: 650;
- color: #ffffff;
- background-color: #f44336;
- padding: 10px;
- -moz-border-radius: 20px;
- -webkit-border-radius: 20px;
- -o-border-radius: 20px;
- -ms-border-radius: 20px;
- border-radius: 20px;
-}
-
-.metajelo_errorDisplayBox {
- padding: 15px;
-}
-
-/* -----------------------------------------------------------------------------
-
- TEXT ELEMENTS
-
------------------------------------------------------------------------------ */
-.metajelo_record a {
- color: #A91919;
- text-decoration: none;
- margin-right: 1px;
-}
-
-.metajelo_record a:hover {
- color: #6B4B00;
-}
-/* #9d1d41; */
-
-.metajelo_record b,
-.metajelo_record strong {
- font-weight: 700;
-}
-
-.metajelo_record i,
-.metajelo_record em {
- font-style: italic;
-}
-
-.metajelo_applies_info {
- display: none;
-}
-
-/* -----------------------------------------------------------------------------
-
- MEDIA ELEMENTS
-
------------------------------------------------------------------------------ */
-.metajelo_record img {
- max-width: 100%;
- height: auto;
-}
-
-/* From icomoon */
-
-@font-face {
- font-family: 'icomoon';
- src: url('fonts/icomoon.eot?vf7xir');
- src: url('fonts/icomoon.eot?vf7xir#iefix') format('embedded-opentype'),
- url('fonts/icomoon.ttf?vf7xir') format('truetype'),
- url('fonts/icomoon.woff?vf7xir') format('woff'),
- url('fonts/icomoon.svg?vf7xir#icomoon') format('svg');
- font-weight: normal;
- font-style: normal;
-}
-
-.metajelo_icon {
- /* use !important to prevent issues with browser extensions that change fonts */
- font-family: 'icomoon' !important;
- speak: none;
- font-style: normal;
- font-weight: normal;
- font-variant: normal;
- text-transform: none;
- line-height: 1;
-
- /* Better Font Rendering =========== */
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-.metajelo_icon-lock:before {
- content: "\f023";
-}
-.metajelo_icon-check-square-o:before {
- content: "\f046";
-}
-.metajelo_icon-square-o:before {
- content: "\f096";
-}
-.metajelo_icon-unlock:before {
- content: "\f09c";
-}
-.metajelo_icon-minus-square-o:before {
- content: "\f147";
-}
-
-/* End of From icomoon */
diff --git a/package.json b/package.json
index 24cd818..000d0cd 100644
--- a/package.json
+++ b/package.json
@@ -5,10 +5,11 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"testbrowser": "../scripts/testbrowser",
- "clean": "rimraf output .cache .psci_modules .pulp-cache .spago dist prod testdist",
+ "clean": "rimraf output .cache .psci_modules .pulp-cache .spago dist prod testdist metajelo-ui-css-classes",
"build": "spago build",
"debug": "./scripts/debug",
"prod": "./scripts/prod",
+ "getcss": "./scripts/getcss",
"parcel": "parcel build --public-url ./ prod/index.html",
"start": "spago build && parcel --no-hmr --public-url ./ static/index.html",
"watch": "spago build && parcel watch static/index.html"
diff --git a/packages.dhall b/packages.dhall
index 338e8d0..67f4bbd 100644
--- a/packages.dhall
+++ b/packages.dhall
@@ -220,7 +220,7 @@ let additions =
mkPackage
[ "prelude", "concur-core", "concur-react" ]
"https://github.com/labordynamicsinstitute/metajelo-ui-css-classes.git"
- "v0.0.2"
+ "v0.1.0"
, naturals =
mkPackage
[ "enums", "maybe", "prelude" ]
diff --git a/scripts/dist_build_commands.sh b/scripts/dist_build_commands.sh
index e6356d1..5b0943b 100755
--- a/scripts/dist_build_commands.sh
+++ b/scripts/dist_build_commands.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-npm install && \
+npm install && npm run getcss && \
(npm run build && npm run prod) && \
(cd tests && npm run testbrowser)
diff --git a/scripts/getcss b/scripts/getcss
new file mode 100755
index 0000000..3700d42
--- /dev/null
+++ b/scripts/getcss
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+
+git clone --depth 1 https://github.com/labordynamicsinstitute/metajelo-ui-css-classes.git
+cp -R metajelo-ui-css-classes/uicss css
+
+# rm -fr metajelo-ui-css-classes
\ No newline at end of file
diff --git a/src/Metajelo/FormUtil.purs b/src/Metajelo/FormUtil.purs
index 9867b41..920e1e2 100644
--- a/src/Metajelo/FormUtil.purs
+++ b/src/Metajelo/FormUtil.purs
@@ -3,7 +3,7 @@ module Metajelo.FormUtil where
import Prelude (class Bounded, class Eq, class Ord, class Show, Void, bind, discard, join, map, max, not, pure, show, ($), (+), (-), (<), (<#>), (<$), (<$>), (<<<), (<>))
import Concur.Core (Widget)
-import Concur.Core.FRP (Signal, display, loopS, step)
+import Concur.Core.FRP (Signal, debounce, display, loopS, step)
import Concur.React (HTML)
import Concur.React.DOM as D
import Concur.React.Props as P
@@ -129,13 +129,19 @@ labelSig widg props sigIn = D.div_ props do
display widg
sigIn
-textInput' :: D.El' -> String -> CtrlSignal HTML String
-textInput' tag label initVal = labelSig' tag label [] $ sig initVal
+textInputWidget :: String -> Widget HTML String
+textInputWidget txt =
+ D.input [P.value txt, P.unsafeTargetValue <$> P.onChange]
+
+-- TODO: remove the first two arguments from textInput', textInput, and urlInput
+textInput' :: CtrlSignal HTML String
+textInput' initVal = sig initVal
where
sig :: String -> Signal HTML String
sig txt = step txt do
- newTxt <- D.input [P.value txt, P.unsafeTargetValue <$> P.onChange]
+ newTxt <- textInputWidget txt
pure $ sig newTxt
+ -- sig txt = debounce 500.0 txt textInputWidget
-- | Reasonable defaults for filtering input text
textFilter :: Signal HTML String -> Signal HTML (Maybe NonEmptyString)
@@ -143,13 +149,12 @@ textFilter txtSig = do
txt <- txtSig
pure $ fromString $ trim txt
-textInput :: D.El' -> String -> CtrlSignal HTML (Maybe NonEmptyString)
-textInput tag label iVal = textFilter $ textInput' tag label
- (foldf toString iVal)
+textInput :: CtrlSignal HTML (Maybe NonEmptyString)
+textInput iVal = textFilter $ textInput' (foldf toString iVal)
-urlInput :: D.El' -> String -> CtrlSignal HTML (Either String URL)
-urlInput tag label iVal = do
- txtMay :: Maybe NonEmptyString <- textInput tag label (fromString prevTxt)
+urlInput :: CtrlSignal HTML (Either String URL)
+urlInput iVal = do
+ txtMay :: Maybe NonEmptyString <- textInput (fromString prevTxt)
urlEi <- pure $ case txtMay of
Nothing -> Left prevErr
Just txt -> parsePublicURL $ toString txt
diff --git a/src/Metajelo/Forms/InstitutionContact.purs b/src/Metajelo/Forms/InstitutionContact.purs
index 057cb4c..5b4552e 100644
--- a/src/Metajelo/Forms/InstitutionContact.purs
+++ b/src/Metajelo/Forms/InstitutionContact.purs
@@ -15,7 +15,7 @@ import Data.Newtype (class Newtype)
import Formless as F
import Metajelo.FormUtil (CtrlSignal, IdentityField, MKFState, MKValidators, errorDisplay, formSaveButton, initFormState, labelSig', menu)
import Metajelo.Types as M
-import Metajelo.UI.CSS.ClassProps as MC
+import Metajelo.CSS.UI.ClassProps as MC
import Metajelo.Validation as V
import Metajelo.View (contactWidg)
import Text.Email.Validate (EmailAddress, toString)
@@ -62,13 +62,13 @@ validators = InstContactForm {
contactForm :: FState -> Widget HTML M.InstitutionContact
contactForm fstate = do
query <- D.div' [
- D.div' [D.text "Email"]
- , D.input [
- P.defaultValue $ F.getInput proxies.email1 fstate.form
+ D.input [
+ MC.contactEmail
+ , P.defaultValue $ F.getInput proxies.email1 fstate.form
, (F.setValidate proxies.email1 <<< P.unsafeTargetValue) <$> P.onChange
]
, errorDisplay $ F.getError proxies.email1 fstate.form
- , D.div' [D.text "Contact type: ", menu fstate.form proxies.contactType]
+ , D.span_ [MC.contactType] $ menu fstate.form proxies.contactType
, D.div' [ F.submit <$ formSaveButton fstate]
]
res <- F.eval query fstate
@@ -79,8 +79,7 @@ contactForm fstate = do
pure {emailAddress: form.email1, contactType: form.contactType}
contactSignal :: CtrlSignal HTML (Maybe M.InstitutionContact)
-contactSignal instContactMay =
- labelSig' D.h2' "Institution Contact" [MC.institutionContact] $
+contactSignal instContactMay = D.div_ [MC.institutionContact] do
sig instContactMay
where
sig icMay = step icMay do
diff --git a/src/Metajelo/Forms/InstitutionPolicy.purs b/src/Metajelo/Forms/InstitutionPolicy.purs
index ff3bf3c..5a68e80 100644
--- a/src/Metajelo/Forms/InstitutionPolicy.purs
+++ b/src/Metajelo/Forms/InstitutionPolicy.purs
@@ -21,7 +21,7 @@ import Formless as F
import Formless.Validation (Validation, hoistFnE)
import Metajelo.FormUtil (CtrlSignal, IdentityField, MKFState, MKValidators, PolPolType(..), errorDisplay, formSaveButton, initFormState, labelSig', menu, nonEmptyArrayView)
import Metajelo.Types as M
-import Metajelo.UI.CSS.ClassProps as MC
+import Metajelo.CSS.UI.ClassProps as MC
import Metajelo.Validation as V
import Metajelo.View (ipolicyWidg)
import Text.URL.Validate (parsePublicURL, urlToString)
@@ -88,14 +88,14 @@ validators = InstPolicyForm {
policyForm :: FState -> Widget HTML M.InstitutionPolicy
policyForm fstate = do
query <- D.div' [
- D.div' [D.text "Policy: ", menu fstate.form proxies.polPolType]
+ D.span_ [MC.policy] $ menu fstate.form proxies.polPolType
, D.input [
P.defaultValue $ F.getInput proxies.policy fstate.form
, (F.setValidate proxies.policy <<< P.unsafeTargetValue) <$> P.onChange
]
, errorDisplay $ F.getError proxies.policy fstate.form
- , D.div' [D.text "Policy type: ", menu fstate.form proxies.policyType]
- , D.div' [D.text "Applies to product? ", menu fstate.form proxies.appliesToProd]
+ , D.span_ [MC.policyType] $ menu fstate.form proxies.policyType
+ , D.span_ [MC.applies] $ menu fstate.form proxies.appliesToProd
, D.div' [ F.submit <$ formSaveButton fstate]
]
res <- F.eval query fstate
@@ -110,18 +110,17 @@ policyForm fstate = do
}
policySignal :: CtrlSignal HTML (Maybe M.InstitutionPolicy)
-policySignal instPolicyMay =
- labelSig' D.h3' "Institution Policy" [MC.institutionPolicy] $
- sig instPolicyMay
- where
- sig ipMay = step ipMay do
- inputs <- pure $ F.wrapInputFields $ outToInRec ipMay
- instPolicy <- D.div' [
- policyForm (initFormState inputs validators)
- , foldMap ipolicyWidg ipMay
- ]
- liftEffect $ logShow instPolicy
- pure $ sig $ Just instPolicy
+policySignal instPolicyMay = D.div_ [MC.institutionPolicy] do
+ sig instPolicyMay
+ where
+ sig ipMay = step ipMay do
+ inputs <- pure $ F.wrapInputFields $ outToInRec ipMay
+ instPolicy <- D.div' [
+ policyForm (initFormState inputs validators)
+ , foldMap ipolicyWidg ipMay
+ ]
+ liftEffect $ logShow instPolicy
+ pure $ sig $ Just instPolicy
checkPolicy :: ∀ m. Monad m => Validation InstPolicyForm m String String M.Policy
checkPolicy = hoistFnE $ \form str ->
@@ -132,6 +131,5 @@ checkPolicy = hoistFnE $ \form str ->
-- | The first element of the tuple is the (desired) number of policies
policySigArray :: CtrlSignal HTML (Tuple Int (Maybe (NonEmptyArray M.InstitutionPolicy)))
-policySigArray instPoliciesMay =
- labelSig' D.h2' "Institution Policies" [MC.institutionPolicies] $
- nonEmptyArrayView policySignal instPoliciesMay
+policySigArray instPoliciesMay = D.div_ [MC.institutionPolicies] do
+ nonEmptyArrayView policySignal instPoliciesMay
diff --git a/src/Metajelo/UI.purs b/src/Metajelo/UI.purs
index dccbba7..fc7becc 100644
--- a/src/Metajelo/UI.purs
+++ b/src/Metajelo/UI.purs
@@ -8,6 +8,7 @@ import Concur.React (HTML)
import Concur.React.DOM as D
import Concur.React.Run (runWidgetInDom)
import Control.Monad.State
+import Control.Plus (empty)
import Data.Array.NonEmpty (NonEmptyArray)
import Data.Either (Either(..), hush)
import Data.Foldable (fold, foldMap)
@@ -23,7 +24,9 @@ import Metajelo.FormUtil (CtrlSignal, arrayView, checkBoxS, dateTimeSig, formatX
urlInput, consoleShow)
import Metajelo.Types as M
import Metajelo.View as MV
-import Metajelo.UI.CSS.ClassProps as MC
+-- import Metajelo.CSS.UI.ClassNames as MCN
+import Metajelo.CSS.UI.ClassProps as MC
+-- import Metajelo.CSS.UI.Util (cList)
import Option as Opt
import Prim.Row as Prim.Row
import Text.URL.Validate (URL)
@@ -36,7 +39,6 @@ runFormSPA divId = runWidgetInDom divId page
page :: ∀ a. Widget HTML a
page = do
-
-- _ <- dyn $ formatSigArray (Tuple 0 [])
D.div [MC.page] $ pure $ dyn $ accumulateMetajeloRecord
--D.text "Hi"
@@ -101,65 +103,61 @@ type PartialRelIds = NonEmptyArray (Opt.Option M.RelatedIdentifierRows)
type PartialProds = NonEmptyArray (Opt.Option SupplementaryProductRowOpts)
accumulateMetajeloRecord :: Signal HTML (Opt.Option MetajeloRecordRowOpts)
-accumulateMetajeloRecord = labelSig' D.h1' "Metajelo Record Form" [MC.record] $
- loopS Opt.empty \recOpt -> D.div_ [] do
- idOpt <- accumulateIdent "Record Identifier" $
- getOpt (SProxy :: _ "identifier_opt") recOpt
- let idMay = Opt.getAll idOpt
- dateMay <- textInput D.span'
- "Original creation date of this metadata record: " $
- Opt.get (SProxy :: _ "date") recOpt
- -- modDateTime <- dateTimeSig
- let modDateTime = initDate
- let xsdDateStr_ei = formatXsdDate modDateTime
- let xsdDateMay = hush xsdDateStr_ei -- TODO: also retain either for errors
+accumulateMetajeloRecord = loopS Opt.empty \recOpt -> D.div_ [MC.record] do
+ idOpt <- D.div_ [MC.recordId] do
+ accumulateIdent $ getOpt (SProxy :: _ "identifier_opt") recOpt
+ let idMay = Opt.getAll idOpt
+ dateMay <- D.div_ [MC.date] <$> textInput $ Opt.get (SProxy :: _ "date") recOpt
+ -- modDateTime <- dateTimeSig
+ let modDateTime = initDate
+ let xsdDateStr_ei = formatXsdDate modDateTime
+ let xsdDateMay = hush xsdDateStr_ei -- TODO: also retain either for errors
- relIdsTup <- relIdSigArray $ Tuple
- (Opt.getWithDefault 0 (SProxy :: _ "_numRelIds") recOpt)
- (Opt.get (SProxy :: _ "relId_opts") recOpt)
- let _numRelIds = fst relIdsTup
- let relIdOpts = snd relIdsTup
- let relIdsMay = join $ (map sequence) $ ((map Opt.getAll) <$> relIdOpts)
+ relIdsTup <- relIdSigArray $ Tuple
+ (Opt.getWithDefault 0 (SProxy :: _ "_numRelIds") recOpt)
+ (Opt.get (SProxy :: _ "relId_opts") recOpt)
+ let _numRelIds = fst relIdsTup
+ let relIdOpts = snd relIdsTup
+ let relIdsMay = join $ (map sequence) $ ((map Opt.getAll) <$> relIdOpts)
- prodsTup <- supProdSigArray $ Tuple
- (Opt.getWithDefault 0 (SProxy :: _ "_numSupProds") recOpt)
- (Opt.get (SProxy :: _ "supProd_opts") recOpt)
- let _numSupProds = fst prodsTup
- let supProdOpts = snd prodsTup
- let supProdsMay = join $ (map sequence) $ ((map Opt.getSubset) <$> supProdOpts)
- newRec <- pure $ execState (do
- get >>= Opt.maySetOptState (SProxy :: _ "identifier_opt") (Just idOpt)
- get >>= Opt.maySetOptState (SProxy :: _ "identifier") idMay
- get >>= Opt.maySetOptState (SProxy :: _ "date") dateMay
- get >>= Opt.maySetOptState (SProxy :: _ "lastModified") xsdDateMay
+ prodsTup <- supProdSigArray $ Tuple
+ (Opt.getWithDefault 0 (SProxy :: _ "_numSupProds") recOpt)
+ (Opt.get (SProxy :: _ "supProd_opts") recOpt)
+ let _numSupProds = fst prodsTup
+ let supProdOpts = snd prodsTup
+ let supProdsMay = join $ (map sequence) $ ((map Opt.getSubset) <$> supProdOpts)
+ newRec <- pure $ execState (do
+ get >>= Opt.maySetOptState (SProxy :: _ "identifier_opt") (Just idOpt)
+ get >>= Opt.maySetOptState (SProxy :: _ "identifier") idMay
+ get >>= Opt.maySetOptState (SProxy :: _ "date") dateMay
+ get >>= Opt.maySetOptState (SProxy :: _ "lastModified") xsdDateMay
- get >>= Opt.maySetOptState (SProxy :: _ "_numRelIds") (Just _numRelIds)
- get >>= Opt.maySetOptState (SProxy :: _ "relId_opts") relIdOpts
- get >>= Opt.maySetOptState (SProxy :: _ "relatedIdentifiers") relIdsMay
+ get >>= Opt.maySetOptState (SProxy :: _ "_numRelIds") (Just _numRelIds)
+ get >>= Opt.maySetOptState (SProxy :: _ "relId_opts") relIdOpts
+ get >>= Opt.maySetOptState (SProxy :: _ "relatedIdentifiers") relIdsMay
- get >>= Opt.maySetOptState (SProxy :: _ "_numSupProds") (Just _numSupProds)
- get >>= Opt.maySetOptState (SProxy :: _ "supProd_opts") supProdOpts
- get >>= Opt.maySetOptState (SProxy :: _ "supplementaryProducts") supProdsMay
- ) recOpt
- let newRecMay = Opt.getSubset newRec
- display $ recWidg newRecMay
- pure newRec
+ get >>= Opt.maySetOptState (SProxy :: _ "_numSupProds") (Just _numSupProds)
+ get >>= Opt.maySetOptState (SProxy :: _ "supProd_opts") supProdOpts
+ get >>= Opt.maySetOptState (SProxy :: _ "supplementaryProducts") supProdsMay
+ ) recOpt
+ let newRecMay = Opt.getSubset newRec
+ display $ recWidg newRecMay
+ pure newRec
where
recWidg :: forall a. Maybe M.MetajeloRecord -> Widget HTML a
- recWidg recMay = D.div' [
- D.h3' [D.text "Metajelo Record preview:"]
- , D.br'
+ recWidg recMay = D.div [MC.recPreview] [
+ D.br'
, fold $ MV.mkRecordWidget <$> recMay
]
-- FIXME: check how the header is grouped into these?
accumulateSuppProd :: CtrlSignal HTML (MayOpt SupplementaryProductRowOpts)
-accumulateSuppProd prodOptMay = labelSig' D.h1' "Product" [MC.product] do
+accumulateSuppProd prodOptMay = D.div_ [MC.product] do
basicMdOpt <- accumulateBasicMetaData $
getOpt (SProxy :: _ "basicMetadata_opt") prodOpt
let basicMdMay = Opt.getAll basicMdOpt
- redIdOpt <- accumulateIdent "Resource ID" $
- getOpt (SProxy :: _ "resourceID_opt") prodOpt
+ redIdOpt <- D.div_ [MC.resourceId] do
+ accumulateIdent $ getOpt (SProxy :: _ "resourceID_opt") prodOpt
let resIdMay = Opt.getAll redIdOpt
resTypeOpt <- accumulateResType $
getOpt (SProxy :: _ "resourceType_opt") prodOpt
@@ -198,27 +196,26 @@ accumulateSuppProd prodOptMay = labelSig' D.h1' "Product" [MC.product] do
where
prodOpt = fromMaybe Opt.empty prodOptMay
prodWidg :: forall a. Maybe M.SupplementaryProduct -> Widget HTML a
- prodWidg prodMay = D.div' [
- D.h3' [D.text "Product preview:"]
- , D.br'
+ prodWidg prodMay = D.div [MC.prodPreview] [
+ D.br'
, fold $ MV.mkSupplementaryProductWidget <$> prodMay
]
supProdSigArray :: CtrlSignal HTML (Tuple Int (Maybe PartialProds))
-supProdSigArray prodsMay = labelSig' D.h1' "Supplementary Products" [MC.products] $
- nonEmptyArrayView accumulateSuppProd prodsMay
+supProdSigArray prodsMay = D.span_ [MC.productsHeader] do
+ D.div_ [MC.productList] $ nonEmptyArrayView accumulateSuppProd prodsMay
accumulateLocation :: CtrlSignal HTML (MayOpt LocationRowOpts)
-accumulateLocation locOptMay = labelSig' D.h1' "Location" [MC.location] do
- identOpt <- accumulateIdent "Identifier" $
+accumulateLocation locOptMay = D.div_ [MC.location] do
+ identOpt <- D.span_ [MC.institutionId] $ accumulateIdent $
getOpt (SProxy :: _ "institutionID_opt") locOpt
let identMay = Opt.getAll identOpt
- instNameMay <- textInput D.span' "Institution Name: " $
+ instNameMay <- textInput $
Opt.get (SProxy :: _ "institutionName") locOpt
- instTypeMay <- labelSig' D.h3' "Institution Type" [] $ menuSignal $
+ instTypeMay <- D.span_ [MC.institutionType] $ menuSignal $
Opt.get (SProxy :: _ "institutionType") locOpt
display D.br'
- sOrgMay <- textInput D.span' "Super Organization (optional): " $
+ sOrgMay <- D.span_ [MC.superOrg] $ textInput $
join $ Opt.get (SProxy :: _ "superOrganizationName") locOpt
icMay <- MF.contactSignal $ Opt.get (SProxy :: _ "institutionContact") locOpt
sustainOpt <- accumulateSustain $ getOpt (SProxy :: _ "iSustain_opt") locOpt
@@ -228,7 +225,7 @@ accumulateLocation locOptMay = labelSig' D.h1' "Location" [MC.location] do
(Opt.get (SProxy :: _ "institutionPolicies") locOpt)
let _numPolicies = fst polsMayTup
let polsMay = snd polsMayTup
- versioning <- labelSig' D.span' "versioning? " [] $ checkBoxS $
+ versioning <- D.span_ [MC.versioning] $ checkBoxS $
Opt.getWithDefault false (SProxy :: _ "versioning") locOpt
newLoc <- pure $ execState (do
get >>= Opt.maySetOptState (SProxy :: _ "institutionID_opt") (Just identOpt)
@@ -249,72 +246,66 @@ accumulateLocation locOptMay = labelSig' D.h1' "Location" [MC.location] do
where
locOpt = fromMaybe Opt.empty locOptMay
locWidg :: forall a. Maybe M.Location -> Widget HTML a
- locWidg locMay = D.div' [
- D.h3' [D.text "Location preview:"]
- , D.br'
+ locWidg locMay = D.div [MC.locPreview] [
+ D.br'
, foldMap (\loc -> fold $ MV.spacify $ MV.locElems loc) locMay
]
accumulateSustain :: CtrlSignal HTML (Opt.Option InstitutionSustainabilityRowOpts)
-accumulateSustain oldSust =
- labelSig' D.h3' "Institution Sustainability:" [MC.sustainability] do
- missionUrl_Ei <- urlInput D.span' "Mission Statement URL: " $
- Opt.getWithDefault (Left "") (SProxy :: _ "missionUrl_Ei") oldSust
- let missionUrlMay = hush missionUrl_Ei
- fundingUrl_Ei <- urlInput D.span' "Funding Statement URL: " $
- Opt.getWithDefault (Left "") (SProxy :: _ "fundingUrl_Ei") oldSust
- let fundingUrlMay = hush fundingUrl_Ei
- pure $ execState (do
- get >>= Opt.maySetOptState (SProxy :: _ "missionUrl_Ei")
- (Just missionUrl_Ei)
- get >>= Opt.maySetOptState (SProxy :: _ "missionStatementURL")
- missionUrlMay
- get >>= Opt.maySetOptState (SProxy :: _ "fundingUrl_Ei")
- (Just fundingUrl_Ei)
- get >>= Opt.maySetOptState (SProxy :: _ "fundingStatementURL")
- fundingUrlMay
- ) oldSust
+accumulateSustain oldSust = D.div_ [MC.sustainability] do
+ missionUrl_Ei <- D.span_ [MC.missionStatement] $ urlInput $
+ Opt.getWithDefault (Left "") (SProxy :: _ "missionUrl_Ei") oldSust
+ let missionUrlMay = hush missionUrl_Ei
+ fundingUrl_Ei <- D.span_ [MC.fundingStatement] $ urlInput $
+ Opt.getWithDefault (Left "") (SProxy :: _ "fundingUrl_Ei") oldSust
+ let fundingUrlMay = hush fundingUrl_Ei
+ pure $ execState (do
+ get >>= Opt.maySetOptState (SProxy :: _ "missionUrl_Ei")
+ (Just missionUrl_Ei)
+ get >>= Opt.maySetOptState (SProxy :: _ "missionStatementURL")
+ missionUrlMay
+ get >>= Opt.maySetOptState (SProxy :: _ "fundingUrl_Ei")
+ (Just fundingUrl_Ei)
+ get >>= Opt.maySetOptState (SProxy :: _ "fundingStatementURL")
+ fundingUrlMay
+ ) oldSust
-accumulateIdent :: String -> CtrlSignal HTML (Opt.Option (M.BaseIdRows ()))
-accumulateIdent idLabel oldId =
- labelSig' D.h3' idLabel [MC.identifier] do
- idMay <- textInput D.span' "Id: " $
- Opt.get (SProxy :: _ "id") oldId
- idTypeMay <- labelSig' D.span' "Identifier Type" [] $ menuSignal $
- Opt.get (SProxy :: _ "idType") oldId
- pure $ execState (do
- get >>= Opt.maySetOptState (SProxy :: _ "id") idMay
- get >>= Opt.maySetOptState (SProxy :: _ "idType") idTypeMay
- ) oldId
+accumulateIdent :: CtrlSignal HTML (Opt.Option (M.BaseIdRows ()))
+accumulateIdent oldId = D.div_ [MC.identifier] do
+ idMay <- D.span_ [MC.id] $ textInput $ Opt.get (SProxy :: _ "id") oldId
+ idTypeMay <- D.span_ [MC.idType] $ menuSignal $
+ Opt.get (SProxy :: _ "idType") oldId
+ pure $ execState (do
+ get >>= Opt.maySetOptState (SProxy :: _ "id") idMay
+ get >>= Opt.maySetOptState (SProxy :: _ "idType") idTypeMay
+ ) oldId
accumulateRelatedIdent :: CtrlSignal HTML (MayOpt M.RelatedIdentifierRows)
-accumulateRelatedIdent oldIdMay =
- labelSig' D.h3' "Related Identifier: " [MC.relatedIdentifier] do
- idMay <- textInput D.span' "Id: " $
- Opt.get (SProxy :: _ "id") oldId
- idTypeMay <- labelSig' D.span' "Identifier Type" [] $ menuSignal $
- Opt.get (SProxy :: _ "idType") oldId
- relTypeMay <- labelSig' D.span' "Relation Type" [] $ menuSignal $
- Opt.get (SProxy :: _ "relType") oldId
- pure $ Just $ execState (do
- get >>= Opt.maySetOptState (SProxy :: _ "id") idMay
- get >>= Opt.maySetOptState (SProxy :: _ "idType") idTypeMay
- get >>= Opt.maySetOptState (SProxy :: _ "relType") relTypeMay
- ) oldId
+accumulateRelatedIdent oldIdMay = D.div_ [MC.relatedId] do
+ idMay <- D.span_ [MC.id] $ textInput $ Opt.get (SProxy :: _ "id") oldId
+ idTypeMay <- D.span_ [MC.idType] $ menuSignal $
+ Opt.get (SProxy :: _ "idType") oldId
+ relTypeMay <- D.span_ [MC.relType] $ menuSignal $
+ Opt.get (SProxy :: _ "relType") oldId
+ pure $ Just $ execState (do
+ get >>= Opt.maySetOptState (SProxy :: _ "id") idMay
+ get >>= Opt.maySetOptState (SProxy :: _ "idType") idTypeMay
+ get >>= Opt.maySetOptState (SProxy :: _ "relType") relTypeMay
+ ) oldId
where oldId = (fromMaybe Opt.empty oldIdMay)
relIdSigArray :: CtrlSignal HTML (Tuple Int (Maybe PartialRelIds))
-relIdSigArray relIdsMay =
- labelSig' D.h2' "Related Identifiers" [MC.relatedIdentifiers] $
+relIdSigArray relIdsMay = D.span_ [MC.relatedIdsHeader] do
+ D.div_ [MC.relatedIdList] $
nonEmptyArrayView accumulateRelatedIdent relIdsMay
accumulateBasicMetaData :: CtrlSignal HTML (Opt.Option M.BasicMetadataRows)
-accumulateBasicMetaData oldBMD = labelSig' D.h3' "Basic Metadata" [MC.basicMetaData] do
- titleMay <- textInput D.span' "Title: " $
+accumulateBasicMetaData oldBMD = D.div_ [MC.basicMetadata] do
+ titleMay <- D.span_ [MC.title] $ textInput $
Opt.get (SProxy :: _ "title") oldBMD
- creatorMay <- textInput D.span' "Creator: " $
+ creatorMay <- D.span_ [MC.creator] $ textInput $
Opt.get (SProxy :: _ "creator") oldBMD
- pubYearMay <- textInput D.span' "Publication Year: " $
+ pubYearMay <- D.span_ [MC.pubyear] $ textInput $
Opt.get (SProxy :: _ "publicationYear") oldBMD
pure $ execState (do
get >>= Opt.maySetOptState (SProxy :: _ "title") titleMay
@@ -323,42 +314,43 @@ accumulateBasicMetaData oldBMD = labelSig' D.h3' "Basic Metadata" [MC.basicMetaD
) oldBMD
accumulateResType :: CtrlSignal HTML (Opt.Option M.ResourceTypeRows)
-accumulateResType oldRT = labelSig' D.h3' "Resource Type" [MC.resourceType] do
- descMay <- textInput D.span' "Description: " $
- join $ fromString <$> Opt.get (SProxy :: _ "description") oldRT
- genTypMay <- labelSig' D.span' "General Type: " [] $ menuSignal $
+accumulateResType oldRT = D.div_ [MC.resourceType] do
+ genTypMay <- D.span_ [MC.resourceTypeGen] $ menuSignal $
Opt.get (SProxy :: _ "generalType") oldRT
+ descMay <- D.span_ [MC.resourceTypeDescr] $ textInput $
+ join $ fromString <$> Opt.get (SProxy :: _ "description") oldRT
pure $ execState (do
get >>= Opt.maySetOptState (SProxy :: _ "description") (toString <$> descMay)
get >>= Opt.maySetOptState (SProxy :: _ "generalType") genTypMay
) oldRT
formatSignal :: CtrlSignal HTML (Maybe M.Format)
-formatSignal formatMay = textInput D.h3' "Format: " formatMay
+formatSignal formatMay = D.div_ [MC.format] do
+ tooltipS $ textInput formatMay
formatSigArray :: CtrlSignal HTML (Tuple Int (Array M.Format))
-formatSigArray formats = labelSig (D.div' [
- D.h2' [D.text "Formats"], D.text tipText
-]) [] $ arrayView formatSignal formats
- where
- tipText = "Technical format of the resource." <>
- "Use file extension or MIME type where possible."
+formatSigArray formats = D.div_ [MC.formatList] $ arrayView formatSignal formats
accumulateResMdSource :: CtrlSignal HTML (Opt.Option ResourceMetadataSourceRowOpts)
-accumulateResMdSource oldRMDS =
- labelSig' D.h3' "Resource Metadata Source" [MC.resourceMDSource] do
- url_Ei <- urlInput D.span' "URL: " $
- Opt.getWithDefault (Left "") (SProxy :: _ "url_Ei") oldRMDS
- let urlMay = hush url_Ei
- relTypMay <- labelSig' D.span' "Relation Type: " [] $ menuSignal $
- Opt.get (SProxy :: _ "relationType") oldRMDS
- pure $ execState (do
- get >>= Opt.maySetOptState (SProxy :: _ "url_Ei")
- (Just url_Ei)
- get >>= Opt.maySetOptState (SProxy :: _ "url")
- urlMay
- get >>= Opt.maySetOptState (SProxy :: _ "relationType") relTypMay
- ) oldRMDS
+accumulateResMdSource oldRMDS = D.div_ [MC.resourceMDSource] do
+ url_Ei <- D.span_ [MC.url] $ urlInput $
+ Opt.getWithDefault (Left "") (SProxy :: _ "url_Ei") oldRMDS
+ let urlMay = hush url_Ei
+ relTypMay <- D.span_ [MC.relType] $ menuSignal $
+ Opt.get (SProxy :: _ "relationType") oldRMDS
+ pure $ execState (do
+ get >>= Opt.maySetOptState (SProxy :: _ "url_Ei")
+ (Just url_Ei)
+ get >>= Opt.maySetOptState (SProxy :: _ "url")
+ urlMay
+ get >>= Opt.maySetOptState (SProxy :: _ "relationType") relTypMay
+ ) oldRMDS
+
+tooltip :: forall a. Widget HTML a
+tooltip = D.div_ [MC.tooltip] empty
+
+tooltipS :: forall a. Signal HTML a -> Signal HTML a
+tooltipS sigIn = D.div_ [MC.tooltip] sigIn
-- TODO: PR to purescript-option
getOpt ::