fix non-exhaustive pattern for modals and remove remaining jquery integration

closes #188
This commit is contained in:
Felix Hamann 2018-09-30 22:50:06 +02:00
parent 9e076cf9e5
commit 267abc939c
3 changed files with 9 additions and 32 deletions

View File

@ -25,3 +25,8 @@ modal :: Text -> Maybe [Char] -> WidgetT site IO ()
modal triggerId (Just modalContent) = do
modalId <- newIdent
$(widgetFile "widgets/modal")
modal triggerId Nothing = do
modalId <- newIdent
let modalContent :: [Char]
modalContent = "placeholder"
$(widgetFile "widgets/modal")

View File

@ -22,7 +22,6 @@
<li .list-group-item>
<a href=@{CourseNewR}>Kurse anlegen
<hr>
<div .container>
<h2>Funktionen zum Testen
@ -33,9 +32,9 @@
^{btnWdgt}
<li><br>
Modals:
^{modal ".toggler1" Nothing}
<a href=@{UsersR} .btn.toggler1>Klick mich für Ajax-Test
^{modal "#toggler1" Nothing}
<a href=@{UsersR} .btn #toggler1>Klick mich für Ajax-Test
<noscript>(Für Modals bitte JS aktivieren)</noscript>
^{modal ".toggler2" (Just "Test Inhalt für Modal")}
<div .btn.toggler2>Klick mich für Content-Test
^{modal "#toggler2" (Just "Test Inhalt für Modal")}
<div .btn #toggler2>Klick mich für Content-Test
<noscript>(Für Modals bitte JS aktivieren)</noscript>

View File

@ -7,38 +7,11 @@ $newline never
<html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>#{pageTitle pc}
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
^{pageHead pc}
\<!--[if lt IE 9]>
\<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
\<![endif]-->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.0.3/js.cookie.min.js">
<script>
/* The `defaultCsrfMiddleware` Middleware added in Foundation.hs adds a CSRF token to the request cookies. */
/* AJAX requests should add that token to a header to be validated by the server. */
/* See the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package for details. */
var csrfHeaderName = "#{TE.decodeUtf8 $ CI.foldedCase defaultCsrfHeaderName}";
var csrfCookieName = "#{TE.decodeUtf8 defaultCsrfCookieName}";
var csrfToken = Cookies.get(csrfCookieName);
if (csrfToken) {
\ $.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
\ if (!options.crossDomain) {
\ jqXHR.setRequestHeader(csrfHeaderName, csrfToken);
\ }
\ });
}
<body .no-js .theme--#{toPathPiece currentTheme} :isAuth:.logged-in>
<!-- removes no-js class from body if client supports javascript -->
<script>