Improved the UI for the Parent Page Route dropdown when adding a new Page / Folder

This commit is contained in:
Djamil Legato
2019-03-21 16:19:10 -07:00
parent 87cf83a546
commit 96ba336ca2
10 changed files with 76 additions and 8 deletions

View File

@@ -1,3 +1,9 @@
# v1.9.0-rc.5
## MM/DD/2019
1. [](#improved)
* Improved the UI for the Parent Page Route dropdown when adding a new Page / Folder
# v1.9.0-rc.4 # v1.9.0-rc.4
## 03/20/2019 ## 03/20/2019

View File

@@ -3,6 +3,22 @@ import 'selectize';
import '../../utils/selectize-required-fix'; import '../../utils/selectize-required-fix';
import '../../utils/selectize-option-click'; import '../../utils/selectize-option-click';
const PagesRoute = {
option: function(item, escape) {
const label = escape(item.text).split(' ');
const arrows = label.shift();
const slug = label.shift();
return `<div class="selectize-route-option">
<span class="text-grey">${arrows}</span>
<span>
<span class="text-update">${slug.replace('(', '/').replace(')', '')}</span>
<span>${label.join(' ')}</span>
</span>
</div>`;
}
};
export default class SelectizeField { export default class SelectizeField {
constructor(options = {}) { constructor(options = {}) {
this.options = Object.assign({}, options); this.options = Object.assign({}, options);
@@ -20,6 +36,10 @@ export default class SelectizeField {
let data = (isInput ? element.closest('[data-grav-selectize]') : element).data('grav-selectize') || {}; let data = (isInput ? element.closest('[data-grav-selectize]') : element).data('grav-selectize') || {};
let field = (isInput ? element : element.find('input, select')); let field = (isInput ? element : element.find('input, select'));
if (field.attr('name') === 'data[route]') {
data = $.extend({}, data, { render: PagesRoute });
}
if (!field.length || field.get(0).selectize) { return; } if (!field.length || field.get(0).selectize) { return; }
const plugins = $.merge(data.plugins ? data.plugins : [], ['required-fix']); const plugins = $.merge(data.plugins ? data.plugins : [], ['required-fix']);
field.selectize($.extend({}, data, { plugins })); field.selectize($.extend({}, data, { plugins }));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -136,6 +136,14 @@ a {
} }
} }
.text-gray, .text-grey {
color: $nav-text;
}
.text-update {
color: $update-bg;
}
// Typography // Typography
blockquote { blockquote {
border-left: 10px solid darken($content-bg, 10%); border-left: 10px solid darken($content-bg, 10%);

View File

@@ -324,6 +324,25 @@
} }
} }
.selectize-route-option {
display: flex;
> :first-child {
flex: 0 0 auto;
width: auto;
margin-right: 10px;
}
> :last-child {
flex: 1 1 auto;
> * {
display: block;
}
}
}
.hidden { .hidden {
display: none!important; display: none!important;
} }