Merge branch 'master' into 'live'

Design touches & more information in rating files

See merge request !56
This commit is contained in:
Gregor Kleen 2018-07-18 10:14:04 +02:00
commit e6c3e51448
14 changed files with 136 additions and 114 deletions

View File

@ -1,3 +1,6 @@
* Version 10.07.2018
Bugfixes, wählbares Format für Datum
* Version 04.07.2018
Hinweis eingefügt, dass alle Daten des Systems spätestens im Dezember 2018

View File

@ -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)
@ -478,6 +478,8 @@ instance Yesod UniWorX where
menuTypes <- filterM (menuItemAccessCallback . menuItem) menu
isAuth <- isJust <$> maybeAuthId
-- Lookup Favourites & Theme if possible -- TODO: cache this info in a cookie?!
(favourites',show -> currentTheme) <- do
muid <- maybeAuthPair
@ -604,7 +606,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)

View File

@ -34,6 +34,12 @@ getUsersR = do
, sortable (Just "display-name") (i18nCell MsgName) $ \DBRow{ dbrOutput = Entity uid User{..} } -> anchorCellM
(AdminUserR <$> encrypt uid)
(toWidget . display $ userDisplayName)
, sortable (Just "matriculation") (i18nCell MsgMatrikelNr) $ \DBRow{ dbrOutput = Entity uid User{..} } -> anchorCellM
(AdminUserR <$> encrypt uid)
(toWidget . display $ userMatrikelnummer)
-- , sortable (Just "last-name") (i18nCell MsgName) $ \DBRow{ dbrOutput = Entity uid User{..} } -> anchorCellM
-- (AdminUserR <$> encrypt uid)
-- (toWidget . display $ last $ impureNonNull $ words $ userDisplayName)
, sortable Nothing (i18nCell MsgAdminFor) $ \DBRow{ dbrOutput = Entity uid _ } -> mempty
{ dbCellContents = do
schools <- E.select . E.from $ \(school `E.InnerJoin` userAdmin) -> do
@ -78,6 +84,12 @@ getUsersR = do
[ ( "display-name"
, SortColumn $ \user -> user E.^. UserDisplayName
)
, ( "matriculation"
, SortColumn $ \user -> user E.^. UserMatrikelnummer
)
-- , ( "last-name"
-- , SortColumn $ \user -> (last . impureNonNull . words) <$> (user E.^. UserDisplayName)
-- )
]
, dbtFilter = mempty
, dbtStyle = def

View File

@ -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)
, "============================================="

View File

@ -39,7 +39,7 @@ $newline never
}
<body .no-js .#{currentTheme}>
<body .no-js .#{currentTheme} :isAuth:.logged-in>
<!-- removes no-js class from body if client supports javascript -->
<script>
document.body.classList.remove('no-js');

View File

@ -153,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;
}
}
@ -167,7 +170,6 @@ h4 {
position: relative;
background-color: white;
overflow: hidden;
padding-left: 24%;
transition: padding-left .2s ease-out;
> .container {
@ -183,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;
}
}
}
@ -420,7 +416,7 @@ input[type="button"].btn-info:hover,
}
/* LIST MODIFIERS */
.list--inline > li {
.list--inline li {
display: inline-block;
}

View File

@ -9,10 +9,12 @@
<li> Studiengänge von Benutzern werden noch ignoriert
<li> Übungsgruppen
<li> Klausuren
<li> Zentralanmeldungen
<li>
<h4>
neue geplante Features:
<ul>
<li> Studenplan/Kalender
<li> Stundenplan/Kalender
<li> Vollständige Vorlesungshomepages
<li> Vollständige Internationalisierung deutsch/englisch/...

View File

@ -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;
}

View File

@ -9,12 +9,12 @@ $newline never
$nothing
<tbody>
$if null wRows && (dbsEmptyStyle == DBESHeading)
<tr>
<td colspan=#{show columnCount}>
<tr .table__row>
<td .table__td colspan=#{show columnCount}>
_{dbsEmptyMessage}
$else
$forall row <- wRows
<tr .table__row>
$forall widget <- row
$# cell/body.hamlet
$# cell/body.hamlet
^{widget}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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 {

View File

@ -233,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;
}
}
}
}