diff --git a/src/Foundation.hs b/src/Foundation.hs index 0a6a3b50d..90fb562c2 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -187,7 +187,7 @@ getTimeLocale' = $(timeLocaleMap [("de", "de_DE.utf8")]) appTZ :: TZ appTZ = $(includeSystemTZ "Europe/Berlin") - + -- Access Control data AccessPredicate = APPure (Route UniWorX -> Bool -> Reader MsgRenderer AuthResult) @@ -604,7 +604,7 @@ instance YesodBreadcrumbs UniWorX where breadcrumb UsersR = return ("Benutzer", Just HomeR) breadcrumb AdminTestR = return ("Test" , Just HomeR) breadcrumb (AdminUserR _) = return ("Users" , Just UsersR) - breadcrumb VersionR = return ("Info" , Just HomeR) + breadcrumb VersionR = return ("Impressum" , Just HomeR) breadcrumb ProfileR = return ("Profile" , Just HomeR) breadcrumb ProfileDataR = return ("Data" , Just ProfileR) diff --git a/src/Handler/Utils/Rating.hs b/src/Handler/Utils/Rating.hs index dfe7845c3..2bb15c23f 100644 --- a/src/Handler/Utils/Rating.hs +++ b/src/Handler/Utils/Rating.hs @@ -68,6 +68,8 @@ instance Pretty x => Pretty (CI x) where data Rating = Rating { ratingCourseName :: Text , ratingSheetName :: Text + , ratingCorrectorName :: Maybe Text + , ratingSheetType :: SheetType , ratingValues :: Rating' } deriving (Read, Show, Eq, Generic, Typeable) @@ -89,15 +91,18 @@ instance Exception RatingException getRating :: SubmissionId -> YesodDB UniWorX (Maybe Rating) getRating submissionId = runMaybeT $ do - let query = E.select . E.from $ \(submission `E.InnerJoin` sheet `E.InnerJoin` course) -> do + let query = E.select . E.from $ \(corrector `E.RightOuterJoin` (submission `E.InnerJoin` sheet `E.InnerJoin` course)) -> do E.on $ course E.^. CourseId E.==. sheet E.^. SheetCourse E.on $ sheet E.^. SheetId E.==. submission E.^. SubmissionSheet + E.on $ corrector E.?. UserId E.==. submission E.^. SubmissionRatingBy E.where_ $ submission E.^. SubmissionId E.==. E.val submissionId -- Yes, we can only pass a tuple through 'E.select' return ( course E.^. CourseName , sheet E.^. SheetName + , corrector E.?. UserDisplayName + , sheet E.^. SheetType , submission E.^. SubmissionRatingPoints , submission E.^. SubmissionRatingComment , submission E.^. SubmissionRatingTime @@ -105,6 +110,8 @@ getRating submissionId = runMaybeT $ do [ ( E.unValue -> ratingCourseName , E.unValue -> ratingSheetName + , E.unValue -> ratingCorrectorName + , E.unValue -> ratingSheetType , E.unValue -> ratingPoints , E.unValue -> ratingComment , E.unValue -> ratingTime @@ -117,12 +124,14 @@ formatRating cID Rating{ ratingValues = Rating'{..}, ..} = let doc = renderPretty 1 45 $ foldr (<$$>) mempty [ "= Bitte nur Bewertung und Kommentare ändern =" , "=============================================" - , "========== Uni2work Bewertungsdatei ==========" + , "========== Uni2work Bewertungsdatei =========" , "======= diese Datei ist UTF8 encodiert ======" , "Informationen zum Übungsblatt:" - , indent 2 $ foldr (<$$>) mempty - [ "Veranstaltung:" <+> pretty ratingCourseName - , "Blatt:" <+> pretty ratingSheetName + , indent 2 . foldr (<$$>) mempty . catMaybes $ + [ Just $ "Veranstaltung:" <+> pretty ratingCourseName + , Just $ "Blatt:" <+> pretty ratingSheetName + , ("Korrektor:" <+>) . pretty <$> ratingCorrectorName + , Just $ "Bewertung:" <+> pretty (display ratingSheetType) ] , "Abgabe-Id:" <+> pretty (ciphertext cID) , "=============================================" diff --git a/templates/default-layout.lucius b/templates/default-layout.lucius index 8d24883c3..9ec372125 100644 --- a/templates/default-layout.lucius +++ b/templates/default-layout.lucius @@ -24,6 +24,7 @@ box-sizing: border-box; padding: 0; margin: 0; + -webkit-font-smoothing: antialiased; } body { @@ -152,13 +153,16 @@ h4 { /* LAYOUT */ .main { + position: relative; min-height: calc(100vh - var(--header-height)); + padding: 20px; } @media (max-width: 768px) { .main { min-height: calc(100vh - var(--header-height-collapsed)); + padding: 10px; } } @@ -166,7 +170,6 @@ h4 { position: relative; background-color: white; overflow: hidden; - padding-left: 24%; transition: padding-left .2s ease-out; > .container { @@ -182,42 +185,36 @@ h4 { } } +@media (max-width: 768px) { + .logged-in { + .main__content { + padding-left: 60px; + } + } +} + +@media (max-width: 425px) { + .logged-in { + .main__content { + padding-left: 0; + } + } +} + +@media (min-width: 769px) { + .logged-in { + .main__content { + padding-left: calc(24% + 30px); + } + } +} + @media (min-width: 1200px) { - .main__content { - padding-left: 300px; - } -} - -@media (max-width: 768px) { - - .main__content { - padding-left: 50px; - } -} - -@media (max-width: 425px) { - - .main__content { - padding-left: 0; - } -} - -.main__content-body { - padding: 30px 40px 60px; -} - -@media (max-width: 768px) { - - .main__content-body { - padding: 30px 20px 60px; - } -} - -@media (max-width: 425px) { - - .main__content-body { - padding: 20px 10px 60px; + .logged-in { + .main__content { + padding-left: 320px; + } } } @@ -419,7 +416,7 @@ input[type="button"].btn-info:hover, } /* LIST MODIFIERS */ -.list--inline > li { +.list--inline li { display: inline-block; } diff --git a/templates/standalone/alerts.lucius b/templates/standalone/alerts.lucius index 356ccf723..d8118762f 100644 --- a/templates/standalone/alerts.lucius +++ b/templates/standalone/alerts.lucius @@ -43,10 +43,7 @@ padding-left: 20px; margin-left: 20px; animation: slide-in-alert .2s ease-out forwards; - - + .alert:not(.alert--invisible) { - margin-top: 20px; - } + margin-bottom: 20px; &:hover { @@ -100,13 +97,14 @@ font-weight: 600; justify-content: flex-end; align-items: center; + text-align: left; } @media (max-width: 768px) { .alert__content { padding: 4px 7px; - padding-left: 20px; + padding-left: 25px; } } @@ -190,4 +188,6 @@ .alert--invisible { max-height: 0; transform: translateX(120%); + margin-bottom: 0; + overflow: hidden; } diff --git a/templates/standalone/inputs.julius b/templates/standalone/inputs.julius index 0c5624444..ed129274e 100644 --- a/templates/standalone/inputs.julius +++ b/templates/standalone/inputs.julius @@ -59,6 +59,7 @@ resetFileLabel(); input.classList.add('file-input__input--hidden'); input.addEventListener('change', function() { + input.dispatchEvent(new Event('input')); if (isMulti) { renderFileList(input.files); } diff --git a/templates/table/layout.julius b/templates/table/layout.julius index a9885d599..79862009f 100644 --- a/templates/table/layout.julius +++ b/templates/table/layout.julius @@ -3,27 +3,21 @@ document.addEventListener('DOMContentLoaded', function DOMContentLoaded() { - var ASC = 'asc'; - var DESC = 'desc'; - function setupAsync(wrapper) { var table = wrapper.querySelector('#' + #{String $ dbtIdent}); var ths = Array.from(table.querySelectorAll('th.sortable')); - if (ths) { - // attach click handler to each sortable column if any - ths.forEach(function(th) { - th.addEventListener('click', clickHandler); - }); - } - var pagination = wrapper.querySelector('#' + #{String $ dbtIdent} + '-pagination'); + + ths.forEach(function(th) { + th.addEventListener('click', clickHandler); + }); + if (pagination) { - var paginationLinks = Array.from(pagination.querySelectorAll('.pagination-link')); - // attach click handler to pagination links if any - paginationLinks.forEach(function(p) { - p.addEventListener('click', clickHandler); - }); + Array.from(pagination.querySelectorAll('.pagination-link')) + .forEach(function(p) { + p.addEventListener('click', clickHandler); + }); } function clickHandler(event) { @@ -31,12 +25,20 @@ var url = new URL(window.location.origin + window.location.pathname + getClickDestination(this)); url.searchParams.set(#{String $ wIdent "table-only"}, 'yes'); updateTableFrom(url); + + + ths.forEach(function(th) { + // th.removeEventListener('click', clickHandler); + console.log('removed handler from', th); + }); } function getClickDestination(el) { - var link = el.querySelector('a'); - if (!link) { return false; } - return link.getAttribute('href'); + console.log(el); + if (!el.querySelector('a')) { + return false; + } + return el.querySelector('a').getAttribute('href'); } // fetches new sorted table from url with params and replaces contents of current table @@ -47,14 +49,19 @@ 'Accept': 'text/html' } }).then(function(response) { - var contentType = response.headers.get("content-type"); if (!response.ok) { throw ('Looks like there was a problem fetching ' + url.toString() + '. Status Code: ' + response.status); } return response.text(); }).then(function(data) { + // remove listeners + ths.forEach(function(th) { + th.removeEventListener('click', clickHandler); + }); + // replace contents of table body wrapper.innerHTML = data; + // set up async functionality again setupAsync(wrapper); table.querySelector('tbody').innerHTML = data; diff --git a/templates/widgets/asidenav.julius b/templates/widgets/asidenav.julius index 843f2eba9..b43b2f97c 100644 --- a/templates/widgets/asidenav.julius +++ b/templates/widgets/asidenav.julius @@ -8,6 +8,7 @@ function init() { var favoritesBtn = document.querySelector('.navbar__list-item--favorite'); favoritesBtn.addEventListener('click', function(event) { + favoritesBtn.classList.toggle('navbar__list-item--active'); asideEl.classList.toggle('main__aside--expanded'); event.preventDefault(); }, true); @@ -19,21 +20,6 @@ document.addEventListener('DOMContentLoaded', function() { var asidenavEl = document.querySelector('.main__aside'); - var mainContentEl = document.querySelector('.main__content'); - - function adjustHeight() { - window.requestAnimationFrame(function() { - asidenavEl.style.height = mainContentEl.clientHeight + 'px'; - }); - } - - // unbeknownst to the user (below the fold), this happes slightly delayed - // because of dynamic changes to the styles inside the main__content - setTimeout(function() { - adjustHeight(); - }, 10); - - window.addEventListener('resize', adjustHeight); window.utils.aside(asidenavEl); diff --git a/templates/widgets/asidenav.lucius b/templates/widgets/asidenav.lucius index 781bd1742..3e0613284 100644 --- a/templates/widgets/asidenav.lucius +++ b/templates/widgets/asidenav.lucius @@ -1,12 +1,22 @@ .main__aside { position: absolute; + display: none; background-color: var(--color-dark); box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); z-index: 1; + top: 0; + left: 0; flex: 0 0 300px; min-height: calc(100% - var(--header-height)); transition: all .2s ease-out; width: 24%; + height: 100%; +} + +.logged-in { + .main__aside { + display: block; + } } /* maximum width of 300px for wide screens */ @@ -168,7 +178,6 @@ color: var(--color-font); transform: translateX(0); opacity: 0; - transition: all .2s ease-out; width: 0; overflow: hidden; z-index: -1; diff --git a/templates/widgets/breadcrumbs.lucius b/templates/widgets/breadcrumbs.lucius index 9611ad068..e0a3cd9ea 100644 --- a/templates/widgets/breadcrumbs.lucius +++ b/templates/widgets/breadcrumbs.lucius @@ -1,26 +1,9 @@ .breadcrumbs__container { position: relative; color: var(--color-font); - margin-left: 40px; - margin-top: 25px; margin-bottom: 10px; } -@media (max-width: 768px) { - - .breadcrumbs__container { - margin-left: 20px; - } -} - -@media (max-width: 425px) { - - .breadcrumbs__container { - margin-left: 10px; - margin-top: 10px; - } -} - .breadcrumbs__link { &:hover { diff --git a/templates/widgets/navbar.lucius b/templates/widgets/navbar.lucius index 0c41669d7..532186bfc 100644 --- a/templates/widgets/navbar.lucius +++ b/templates/widgets/navbar.lucius @@ -56,7 +56,6 @@ min-width: 70px; height: calc(100% - 4px); padding: 0 6px 4px; - box-shadow: 0 0 0 1px inset var(--color-lmu-box-border); } &::after { @@ -70,7 +69,14 @@ width: 100%; height: calc(100% - 4px); padding: 0 6px 4px; - box-shadow: 0 0 0 1px inset var(--color-lmu-box-border); + } +} + +@media (min-width: 769px) { + + .navbar__logo::before, + .navbar__logo::after { + border: 1px solid var(--color-lmu-box-border); } } @@ -114,7 +120,10 @@ min-width: 90px; color: var(--color-lightwhite); transition: height .2s cubic-bezier(0.03, 0.43, 0.58, 1); - box-shadow: 0 0 0 1px inset var(--color-lmu-box-border); + + &:hover { + color: var(--color-lightwhite); + } } .navbar__link-label { @@ -123,6 +132,13 @@ text-transform: uppercase; } +@media (min-width: 769px) { + + .navbar__link-wrapper { + border: 1px solid var(--color-lmu-box-border); + } +} + @media (max-width: 768px) { .navbar__link-wrapper { @@ -217,20 +233,33 @@ } } -/* "Favorites" list item, only visible on small screens */ -.navbar__list { - - .navbar__list-item--favorite { +/* "Favorites" list item, only visible on small screens and logged in */ +.navbar__list-item { + &.navbar__list-item--favorite { display: none; - background-color: var(--color-primary); + } +} +.navbar__list-item--favorite { + display: none; + background-color: var(--color-primary); +} + +.logged-in { + .navbar__list { + li.navbar__list-item--favorite, + .navbar__list-item--favorite { + display: inline-block; + } } } -@media (max-width: 425px) { +@media (min-width: 426px) { - .navbar__list { - .navbar__list-item--favorite { - display: inline-block; + .logged-in { + .navbar__list { + .navbar__list-item--favorite { + display: none !important; + } } } } @@ -241,7 +270,15 @@ .navbar__link-wrapper { color: var(--color-grey); - box-shadow: 0 0 0 1px inset var(--color-grey); + } +} + +@media (min-width: 769px) { + + .navbar__list-item--secondary { + .navbar__link-wrapper { + border: 1px solid var(--color-grey); + } } }