Skip to content

Commit

Permalink
Fix template picker styling with new Modal size
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Mar 2, 2022
1 parent 89dbe05 commit edeffc8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
3 changes: 2 additions & 1 deletion apps/files/js/newfilemenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@
var self = this;
var newname = $target.attr('data-templatename');
var action = _.filter(self._menuItems, function(item) {
return item.id == $target.attr('data-action');
return item.id == $target.attr('data-action');
}).pop();

action.actionHandler(newname);
OC.hideMenus();
},
Expand Down
24 changes: 18 additions & 6 deletions apps/files/src/views/TemplatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Modal v-if="opened"
:clear-view-delay="-1"
class="templates-picker"
size="large"
size="normal"
@close="close">
<form class="templates-picker__form"
:style="style"
Expand Down Expand Up @@ -64,18 +64,19 @@
</template>

<script>
import { normalize } from 'path'
import { showError } from '@nextcloud/dialogs'
import { generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
import Modal from '@nextcloud/vue/dist/Components/Modal'
import { getCurrentDirectory } from '../utils/davUtils'
import { createFromTemplate, getTemplates } from '../services/Templates'
import { getTemplates } from '../services/Templates'
import TemplatePreview from '../components/TemplatePreview'
const border = 2
const margin = 8
const width = margin * 20
const width = margin * 18
export default {
name: 'TemplatePicker',
Expand Down Expand Up @@ -214,6 +215,7 @@ export default {
const options = _.extend({ scrollTo: true }, { showDetailsView: false } || {})
await fileList?.addAndFetchFileInfo(this.name, undefined, options)
fileList.rename(this.name)
this.close()
} catch (error) {
this.logger.error('Error while creating the new file from template')
Expand All @@ -233,6 +235,11 @@ export default {
padding: calc(var(--margin) * 2);
// Will be handled by the buttons
padding-bottom: 0;
// Dynamix height content
display: flex;
flex-direction: column;
height: 100%;
box-sizing: border-box;
h2 {
text-align: center;
Expand All @@ -252,6 +259,11 @@ export default {
grid-auto-rows: 1fr;
// Center the columns set
justify-content: center;
// Fit max size and grow, scroll if necessary
flex: 1 1 100%;
height: 100%;
min-height: 0;
overflow-y: auto;
}
&__buttons {
Expand All @@ -270,7 +282,7 @@ export default {
// Make sure we're relative for the loading emptycontent on top
::v-deep .modal-container {
position: relative;
height: fit-content;
height: fit-content !important;
}
&__loading {
Expand All @@ -280,7 +292,7 @@ export default {
justify-content: center;
width: 100%;
height: 100%;
margin: 0;
margin: 0 !important;
background-color: var(--color-main-background-translucent);
}
}
Expand Down
Loading

0 comments on commit edeffc8

Please sign in to comment.