mirror of
https://github.com/aelve/guide.git
synced 2024-11-23 12:15:06 +03:00
Remove help
This commit is contained in:
parent
2c6046b08f
commit
92d8c53776
30
src/JS.hs
30
src/JS.hs
@ -42,8 +42,6 @@ allJSFunctions = JS . T.unlines . map fromJS $ [
|
||||
switchSection, switchSectionsEverywhere,
|
||||
fadeIn, fadeOutAndRemove,
|
||||
setMonospace,
|
||||
-- Help
|
||||
showOrHideHelp, showHelp, hideHelp,
|
||||
-- Misc
|
||||
createAjaxIndicator,
|
||||
autosizeTextarea,
|
||||
@ -254,34 +252,6 @@ setMonospace =
|
||||
autosize.update($(node));
|
||||
|]
|
||||
|
||||
showHelp :: JSFunction a => a
|
||||
showHelp =
|
||||
makeJSFunction "showHelp" ["node", "version"]
|
||||
[text|
|
||||
localStorage.removeItem("help-hidden-"+version);
|
||||
switchSection(node, "expanded");
|
||||
|]
|
||||
|
||||
hideHelp :: JSFunction a => a
|
||||
hideHelp =
|
||||
makeJSFunction "hideHelp" ["node", "version"]
|
||||
[text|
|
||||
localStorage.setItem("help-hidden-"+version, "");
|
||||
switchSection(node, "collapsed");
|
||||
|]
|
||||
|
||||
-- TODO: find a better name for this (to distinguish it from 'showHelp' and
|
||||
-- 'hideHelp')
|
||||
showOrHideHelp :: JSFunction a => a
|
||||
showOrHideHelp =
|
||||
makeJSFunction "showOrHideHelp" ["node", "version"]
|
||||
[text|
|
||||
if (localStorage.getItem("help-hidden-"+version) === null)
|
||||
showHelp(node, version)
|
||||
else
|
||||
hideHelp(node, version);
|
||||
|]
|
||||
|
||||
createAjaxIndicator :: JSFunction a => a
|
||||
createAjaxIndicator =
|
||||
makeJSFunction "createAjaxIndicator" []
|
||||
|
38
src/View.hs
38
src/View.hs
@ -26,7 +26,6 @@ module View
|
||||
renderTracking,
|
||||
|
||||
-- * Methods
|
||||
renderHelp,
|
||||
-- ** Categories
|
||||
renderCategoryList,
|
||||
renderCategory,
|
||||
@ -115,7 +114,7 @@ instead of simple
|
||||
{- Note [show-hide]
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
A lot of things (help, notes, etc) can be expanded/collapsed by pressing a button. Similarly, pressing “edit” replaces rendered text with a textbox, or adds buttons to pros/cons. All this is done with sections and show/hide.
|
||||
A lot of things (notes, etc) can be expanded/collapsed by pressing a button. Similarly, pressing “edit” replaces rendered text with a textbox, or adds buttons to pros/cons. All this is done with sections and show/hide.
|
||||
|
||||
A section is something that can be shown or hidden. You define a section by using 'section' (which creates a <div>) or 'sectionSpan' (which creates a <span>).
|
||||
|
||||
@ -365,7 +364,6 @@ renderHaskellRoot globalState mbSearchQuery =
|
||||
-- A search page isn't the main page, so we need a link to the main page
|
||||
Just _ -> h1_ (a_ [href_ "/haskell"] "The Haskeller's guide")
|
||||
renderNoScriptWarning
|
||||
renderHelp
|
||||
renderSearch mbSearchQuery
|
||||
textInput [
|
||||
placeholder_ "add a category",
|
||||
@ -397,7 +395,6 @@ renderCategoryPage category = do
|
||||
-- TODO: another absolute link [absolute-links]
|
||||
h1_ (a_ [href_ "/haskell"] "The Haskeller's guide")
|
||||
renderNoScriptWarning
|
||||
renderHelp
|
||||
renderSearch Nothing
|
||||
renderCategory category
|
||||
|
||||
@ -497,6 +494,8 @@ wrapPage pageTitle page = doctypehtml_ $ do
|
||||
"/"
|
||||
a_ [href_ "https://github.com/aelve/guide/issues"] "issue tracker"
|
||||
emptySpan "2em"
|
||||
a_ [href_ "/unwritten-rules"] "rules"
|
||||
emptySpan "2em"
|
||||
a_ [href_ "/donate"] "donate"
|
||||
sub_ [style_ "font-size:50%"] "to an unemployed guy"
|
||||
emptySpan "2em"
|
||||
@ -516,37 +515,6 @@ renderSearch mbSearchQuery = do
|
||||
input_ [type_ "text", name_ "q", id_ "search", placeholder_ "search",
|
||||
value_ (fromMaybe "" mbSearchQuery)]
|
||||
|
||||
renderHelp :: (MonadIO m, MonadRandom m, MonadReader Config m) => HtmlT m ()
|
||||
renderHelp = do
|
||||
div_ [id_ "help"] $ do
|
||||
|
||||
-- If you're going to change section names, look at 'JS.showHelp' and
|
||||
-- 'JS.hideHelp'
|
||||
section "collapsed" [shown] $ do
|
||||
textButton "show help" $
|
||||
JS.showHelp (JS.selectId "help", helpVersion)
|
||||
|
||||
section "expanded" [noScriptShown] $ do
|
||||
textButton "hide help" $
|
||||
JS.hideHelp (JS.selectId "help", helpVersion)
|
||||
-- Don't forget to change 'helpVersion' when the text changes
|
||||
-- substantially and you think the users should reread it
|
||||
help <- liftIO $ T.readFile "static/help.md"
|
||||
toHtml $ renderMarkdownBlock help
|
||||
-- Replicating “hide help” so that it would be more noticeable
|
||||
p_ $ do
|
||||
let handler =
|
||||
fromJS (JS.hideHelp (JS.selectId "help", helpVersion)) <>
|
||||
"return false;"
|
||||
"If you're finished reading, "
|
||||
a_ [href_ "#", onclick_ handler] "hide this message"
|
||||
"."
|
||||
|
||||
onPageLoad $ JS.showOrHideHelp (JS.selectId "help", helpVersion)
|
||||
|
||||
helpVersion :: Int
|
||||
helpVersion = 3
|
||||
|
||||
-- If the presentation of the category list ever changes (e.g. to include
|
||||
-- lists of items in categories, or their counts, or something), you might
|
||||
-- have to start invalidating 'CacheCategoryList' in more things in
|
||||
|
@ -1,8 +0,0 @@
|
||||
You can edit everything, without registration. (But if you delete everything, I'll roll it back and then make a voodoo doll of you and stick some needles into it).
|
||||
|
||||
The most important rule is: **it's collaborative notes, not Wikipedia**. This implies two things. First, incomplete entries like this are welcome here:
|
||||
|
||||
> **pros:** pretty nice API\
|
||||
> **cons:** buggy (see an example on my Github, here's the link)
|
||||
|
||||
Second, you should write as if you were writing for a friend. If a friend asks you about X, you don't go on X's site and copy the standard “X is a powerful modern framework blah blah blah” blurb – well, don't do it here either. Here is the whole version of the [unwritten rules](/unwritten-rules), except that they are written and aren't rules.
|
Loading…
Reference in New Issue
Block a user