Skip to content

Commit

Permalink
Close navigation on mobile on new form
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
  • Loading branch information
jotoeri committed May 12, 2020
1 parent 14213f9 commit 3c9d295
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
</template>

<script>
import { emit } from '@nextcloud/event-bus'
import { showError } from '@nextcloud/dialogs'
import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
Expand All @@ -74,6 +75,7 @@ import AppContent from '@nextcloud/vue/dist/Components/AppContent'
import AppNavigation from '@nextcloud/vue/dist/Components/AppNavigation'
import AppNavigationNew from '@nextcloud/vue/dist/Components/AppNavigationNew'
import Content from '@nextcloud/vue/dist/Components/Content'
import isMobile from '@nextcloud/vue/src/mixins/isMobile'

import AppNavigationForm from './components/AppNavigationForm'
import EmptyContent from './components/EmptyContent'
Expand All @@ -90,6 +92,8 @@ export default {
EmptyContent,
},

mixins: [isMobile],

data() {
return {
loading: true,
Expand Down Expand Up @@ -150,6 +154,12 @@ export default {
const newForm = response.data
this.forms.push(newForm)
this.$router.push({ name: 'edit', params: { hash: newForm.hash } })

// Close Navigation on Mobile
if (this.isMobile) {
emit('toggle-navigation', { open: false })
}

} catch (error) {
showError(t('forms', 'Unable to create a new form'))
console.error(error)
Expand Down
1 change: 1 addition & 0 deletions src/components/EmptyContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default {

&__desc {
margin-bottom: 16px;
text-align: center;
}
}

Expand Down

0 comments on commit 3c9d295

Please sign in to comment.