-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9809 from akolson/remove-corebase-from-user-profi…
…le-and-auth Refactors UserAuth and ProfileEdit pages not to use Corebase
- Loading branch information
Showing
15 changed files
with
230 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
187 changes: 187 additions & 0 deletions
187
kolibri/plugins/user_auth/assets/src/views/UserAuthLayout.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
<template> | ||
|
||
<div | ||
ref="mainWrapper" | ||
class="main-wrapper" | ||
:style="mainWrapperStyles" | ||
> | ||
|
||
<div v-if="blockDoubleClicks" class="click-mask"></div> | ||
|
||
<div | ||
v-if="!loading" | ||
class="scrolling-pane" | ||
> | ||
<CoreBanner v-if="coreBannerComponent && showDemoBanner"> | ||
<template #default="props"> | ||
<component | ||
:is="coreBannerComponent" | ||
:bannerClosed="props.bannerClosed" | ||
/> | ||
</template> | ||
</CoreBanner> | ||
|
||
<KPageContainer v-if="!isAuthorized"> | ||
<AuthMessage /> | ||
</KPageContainer> | ||
<KPageContainer v-else-if="error"> | ||
<AppError /> | ||
</KPageContainer> | ||
|
||
<div | ||
v-else | ||
id="main" | ||
role="main" | ||
tabindex="-1" | ||
class="main" | ||
> | ||
<slot></slot> | ||
</div> | ||
</div> | ||
|
||
<!-- Monitor snackbar changes so they can be announced by assistive technologies --> | ||
<div aria-live="polite"> | ||
<GlobalSnackbar /> | ||
</div> | ||
|
||
</div> | ||
|
||
</template> | ||
|
||
|
||
<script> | ||
import { mapState } from 'vuex'; | ||
import AuthMessage from 'kolibri.coreVue.components.AuthMessage'; | ||
import coreBannerContent from 'kolibri.utils.coreBannerContent'; | ||
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; | ||
import AppError from 'kolibri-common/components/AppError'; | ||
import GlobalSnackbar from 'kolibri-common/components/GlobalSnackbar'; | ||
import CoreBanner from '../../../../../core/assets/src/views/CoreBanner'; | ||
import { ComponentMap } from '../constants'; | ||
export default { | ||
name: 'UserAuthLayout', | ||
metaInfo() { | ||
return { | ||
// Use arrow function to bind $tr to this component | ||
titleTemplate: title => { | ||
if (this.error) { | ||
return this.$tr('kolibriTitleMessage', { title: this.$tr('errorPageTitle') }); | ||
} | ||
// If no child component sets title, it reads 'Kolibri' | ||
if (!title) { | ||
return this.coreString('kolibriLabel'); | ||
} | ||
// If child component sets title, it reads 'Child Title - Kolibri' | ||
return this.$tr('kolibriTitleMessage', { title }); | ||
}, | ||
}; | ||
}, | ||
components: { | ||
AppError, | ||
CoreBanner, | ||
AuthMessage, | ||
GlobalSnackbar, | ||
}, | ||
mixins: [commonCoreStrings], | ||
computed: { | ||
...mapState({ | ||
error: state => state.core.error, | ||
loading: state => state.core.loading, | ||
blockDoubleClicks: state => state.core.blockDoubleClicks, | ||
}), | ||
isAuthorized() { | ||
return !( | ||
this.error && | ||
this.error.response && | ||
this.error.response.status && | ||
this.error.response.status == 403 | ||
); | ||
}, | ||
mainWrapperStyles() { | ||
return { | ||
width: '100vw', | ||
backgroundColor: this.$themePalette.grey.v_100, | ||
paddingTop: '0px', | ||
paddingBottom: '0px', | ||
}; | ||
}, | ||
coreBannerComponent() { | ||
return coreBannerContent[0]; | ||
}, | ||
showDemoBanner() { | ||
return [ | ||
ComponentMap.SIGN_IN, | ||
ComponentMap.FACILITY_SELECT, | ||
ComponentMap.AUTH_SELECT, | ||
ComponentMap.NEW_PASSWORD, | ||
].includes(this.$route.name); | ||
}, | ||
}, | ||
$trs: { | ||
kolibriTitleMessage: { | ||
message: '{ title } - Kolibri', | ||
context: 'DO NOT TRANSLATE\nCopy the source string.', | ||
}, | ||
errorPageTitle: { | ||
message: 'Error', | ||
context: | ||
"When Kolibri throws an error, this is the text that's used as the title of the error page. The description of the error follows below.", | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
|
||
<style lang="scss" scoped> | ||
.main-wrapper { | ||
display: inline-block; | ||
width: 100vw; | ||
@media print { | ||
/* Without this, things won't print correctly | ||
* - Firefox: Tables will get cutoff | ||
* - Chrome: Table header won't repeat correctly on each page | ||
*/ | ||
display: block; | ||
} | ||
} | ||
.main { | ||
height: 100%; | ||
margin-right: auto; | ||
margin-left: auto; | ||
} | ||
.scrolling-pane { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
padding: 0; | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
overflow-x: auto; | ||
} | ||
.click-mask { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
z-index: 24; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.debug { | ||
font-family: monospace; | ||
font-size: large; | ||
font-weight: bold; | ||
line-height: 2em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.