mirror of
https://github.com/aelve/guide.git
synced 2024-11-27 00:14:03 +03:00
Various small improvements (CSS, etc)
This commit is contained in:
parent
0d1bf6b53a
commit
501efae542
41
src/Main.hs
41
src/Main.hs
@ -323,12 +323,17 @@ renderRoot globalState = do
|
|||||||
-- Include definitions of all Javascript functions that we have defined in
|
-- Include definitions of all Javascript functions that we have defined in
|
||||||
-- this file.
|
-- this file.
|
||||||
script_ (fromJS allJSFunctions)
|
script_ (fromJS allJSFunctions)
|
||||||
|
h1_ "A collaborative guide to Haskell libraries and tools"
|
||||||
|
-- TODO: add a way to hide the rules
|
||||||
div_ [id_ "help"] $ renderMarkdownBlock [text|
|
div_ [id_ "help"] $ renderMarkdownBlock [text|
|
||||||
You can edit everything without registration. Here are some
|
You can edit everything, without registration. (But if you delete
|
||||||
guidelines/observations/etc that probably make sense:
|
everything, I'll roll it back and then make a voodoo doll of you
|
||||||
|
and stick some needles into it).
|
||||||
|
|
||||||
|
Here are some guidelines/observations/etc that probably make sense:
|
||||||
|
|
||||||
* sort pros/cons by importance
|
* sort pros/cons by importance
|
||||||
* if you don't something for any reason, edit it
|
* if you don't like something for any reason, edit it
|
||||||
* if you're unsure about something, still write it
|
* if you're unsure about something, still write it
|
||||||
(just warn others that you're unsure)
|
(just warn others that you're unsure)
|
||||||
* if you have useful information of any kind that doesn't fit,
|
* if you have useful information of any kind that doesn't fit,
|
||||||
@ -336,14 +341,14 @@ renderRoot globalState = do
|
|||||||
|
|
||||||
Subjective judgements and incomplete entries are completely alright –
|
Subjective judgements and incomplete entries are completely alright –
|
||||||
it's not Wikipedia, it's collaborative notes, so don't be afraid to
|
it's not Wikipedia, it's collaborative notes, so don't be afraid to
|
||||||
write anything here. Also, Markdown is supported, so use
|
write anything here. Also, use bold/italics/code/links freely
|
||||||
bold/italics/code if you need to.
|
(Markdown is supported).
|
||||||
|]
|
|]
|
||||||
textInput [placeholder_ "search"] $
|
textInput [id_ "search", placeholder_ "search"] $
|
||||||
JS.search ("#categories" :: Text, inputValue)
|
JS.search ("#categories" :: Text, inputValue)
|
||||||
renderCategoryList (globalState^.categories)
|
textInput [placeholder_ "add a category"] $
|
||||||
textInput [placeholder_ "new category"] $
|
|
||||||
JS.addCategory ("#categories" :: Text, inputValue) <> clearInput
|
JS.addCategory ("#categories" :: Text, inputValue) <> clearInput
|
||||||
|
renderCategoryList (globalState^.categories)
|
||||||
|
|
||||||
renderCategoryList :: [Category] -> HtmlT IO ()
|
renderCategoryList :: [Category] -> HtmlT IO ()
|
||||||
renderCategoryList cats =
|
renderCategoryList cats =
|
||||||
@ -352,7 +357,7 @@ renderCategoryList cats =
|
|||||||
|
|
||||||
renderCategoryTitle :: Editable -> Category -> HtmlT IO ()
|
renderCategoryTitle :: Editable -> Category -> HtmlT IO ()
|
||||||
renderCategoryTitle editable category =
|
renderCategoryTitle editable category =
|
||||||
h2_ [id_ (tshow (category^.uid))] $ do
|
h2_ $ do
|
||||||
a_ [class_ "anchor", href_ ("#" <> tshow (category^.uid))] "#"
|
a_ [class_ "anchor", href_ ("#" <> tshow (category^.uid))] "#"
|
||||||
titleNode <- thisNode
|
titleNode <- thisNode
|
||||||
case editable of
|
case editable of
|
||||||
@ -373,6 +378,7 @@ renderCategoryNotes editable category =
|
|||||||
this <- thisNode
|
this <- thisNode
|
||||||
case editable of
|
case editable of
|
||||||
Editable -> do
|
Editable -> do
|
||||||
|
-- TODO: use shortcut-links
|
||||||
renderMarkdownBlock (category^.notes)
|
renderMarkdownBlock (category^.notes)
|
||||||
textButton "edit" $
|
textButton "edit" $
|
||||||
JS.setCategoryNotesMode (this, category^.uid, InEdit)
|
JS.setCategoryNotesMode (this, category^.uid, InEdit)
|
||||||
@ -385,13 +391,13 @@ renderCategoryNotes editable category =
|
|||||||
|
|
||||||
renderCategory :: Category -> HtmlT IO ()
|
renderCategory :: Category -> HtmlT IO ()
|
||||||
renderCategory category =
|
renderCategory category =
|
||||||
div_ $ do
|
div_ [class_ "category", id_ (tshow (category^.uid))] $ do
|
||||||
renderCategoryTitle Editable category
|
renderCategoryTitle Editable category
|
||||||
renderCategoryNotes Editable category
|
renderCategoryNotes Editable category
|
||||||
itemsNode <- div_ [class_ "items"] $ do
|
itemsNode <- div_ [class_ "items"] $ do
|
||||||
mapM_ renderItem (category^.items)
|
mapM_ renderItem (category^.items)
|
||||||
thisNode
|
thisNode
|
||||||
textInput [placeholder_ "new item"] $
|
textInput [placeholder_ "add an item"] $
|
||||||
JS.addLibrary (itemsNode, category^.uid, inputValue) <> clearInput
|
JS.addLibrary (itemsNode, category^.uid, inputValue) <> clearInput
|
||||||
|
|
||||||
-- TODO: add arrows for moving items left-and-right in the category (or sort
|
-- TODO: add arrows for moving items left-and-right in the category (or sort
|
||||||
@ -443,9 +449,8 @@ renderItemInfo editable item =
|
|||||||
value_ (fromMaybe "" (item^.link))]
|
value_ (fromMaybe "" (item^.link))]
|
||||||
br_ []
|
br_ []
|
||||||
input_ [type_ "submit", value_ "Submit"]
|
input_ [type_ "submit", value_ "Submit"]
|
||||||
let cancelHandler = JS.setItemInfoMode (this, item^.uid, Editable)
|
button "Cancel" [] $
|
||||||
input_ [type_ "button", value_ "Cancel",
|
JS.setItemInfoMode (this, item^.uid, Editable)
|
||||||
onclick_ (fromJS cancelHandler)]
|
|
||||||
|
|
||||||
-- TODO: categories that don't directly compare libraries but just list all
|
-- TODO: categories that don't directly compare libraries but just list all
|
||||||
-- libraries about something (e.g. Yesod plugins, or whatever)
|
-- libraries about something (e.g. Yesod plugins, or whatever)
|
||||||
@ -522,13 +527,19 @@ clearInput = JS "this.value = '';"
|
|||||||
onFormSubmit :: (JS -> JS) -> Attribute
|
onFormSubmit :: (JS -> JS) -> Attribute
|
||||||
onFormSubmit f = onsubmit_ $ format "{} return false;" [f (JS "this")]
|
onFormSubmit f = onsubmit_ $ format "{} return false;" [f (JS "this")]
|
||||||
|
|
||||||
|
button :: Text -> [Attribute] -> JS -> HtmlT IO ()
|
||||||
|
button value attrs handler =
|
||||||
|
input_ (type_ "button" : value_ value : onclick_ handler' : attrs)
|
||||||
|
where
|
||||||
|
handler' = fromJS handler
|
||||||
|
|
||||||
-- A text button looks like “[cancel]”
|
-- A text button looks like “[cancel]”
|
||||||
textButton
|
textButton
|
||||||
:: Text -- ^ Button text
|
:: Text -- ^ Button text
|
||||||
-> JS -- ^ Onclick handler
|
-> JS -- ^ Onclick handler
|
||||||
-> HtmlT IO ()
|
-> HtmlT IO ()
|
||||||
textButton caption (JS handler) =
|
textButton caption (JS handler) =
|
||||||
span_ [class_ "textButton"] $
|
span_ [class_ "text-button"] $
|
||||||
a_ [href_ "javascript:void(0)", onclick_ handler] (toHtml caption)
|
a_ [href_ "javascript:void(0)", onclick_ handler] (toHtml caption)
|
||||||
|
|
||||||
-- So far all icons used here have been from <https://useiconic.com/open/>
|
-- So far all icons used here have been from <https://useiconic.com/open/>
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
|
body {
|
||||||
|
padding: 2em 0em;
|
||||||
|
margin: auto;
|
||||||
|
max-width: 800px;
|
||||||
|
font-family: sans-serif; }
|
||||||
|
|
||||||
|
#search {
|
||||||
|
font-size: 200%;
|
||||||
|
border: 1px solid #d0d0d0;
|
||||||
|
padding: 3px 10px;
|
||||||
|
width: 100%; }
|
||||||
|
|
||||||
|
.category {
|
||||||
|
margin-top: 3em; }
|
||||||
|
|
||||||
.items {
|
.items {
|
||||||
display: flex; }
|
display: flex; }
|
||||||
|
|
||||||
@ -11,11 +26,13 @@
|
|||||||
.traits-group {
|
.traits-group {
|
||||||
margin: 0px 5px; }
|
margin: 0px 5px; }
|
||||||
|
|
||||||
.textButton {
|
.text-button {
|
||||||
margin-left: 1em; }
|
font-size: 80%;
|
||||||
|
margin-left: 2em;
|
||||||
|
vertical-align: 1px; }
|
||||||
|
|
||||||
.textButton::before {content: "[";}
|
.text-button::before {content: "[";}
|
||||||
.textButton::after {content: "]";}
|
.text-button::after {content: "]";}
|
||||||
|
|
||||||
a:link {color: #008ACE; text-decoration: none;}
|
a:link {color: #008ACE; text-decoration: none;}
|
||||||
a:visited {color: #B40EB4; text-decoration: none;}
|
a:visited {color: #B40EB4; text-decoration: none;}
|
||||||
|
Loading…
Reference in New Issue
Block a user