diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/javascripts/admin_interface.js | 27 | ||||
| -rw-r--r-- | public/javascripts/admin_search.js | 14 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 45 |
3 files changed, 80 insertions, 6 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index 994d3698..ffebb694 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -63,7 +63,6 @@ $(document).ready(function () { | |||
| 63 | search_toggle.addEventListener('click', function (e) { | 63 | search_toggle.addEventListener('click', function (e) { |
| 64 | admin_search.display_toggle(); | 64 | admin_search.display_toggle(); |
| 65 | e.preventDefault(); | 65 | e.preventDefault(); |
| 66 | console.log("Toggle"); | ||
| 67 | }); | 66 | }); |
| 68 | } | 67 | } |
| 69 | 68 | ||
| @@ -124,6 +123,32 @@ $(document).ready(function () { | |||
| 124 | }); | 123 | }); |
| 125 | } | 124 | } |
| 126 | 125 | ||
| 126 | document.querySelectorAll('.field_clear').forEach(function (btn) { | ||
| 127 | btn.addEventListener('click', function () { | ||
| 128 | var wrap = btn.closest('.input_group'); | ||
| 129 | wrap.querySelector('input[type=text]').value = ''; | ||
| 130 | var hidden = wrap.dataset.clears; | ||
| 131 | if (hidden) { document.getElementById(hidden).value = ''; } | ||
| 132 | }); | ||
| 133 | }); | ||
| 134 | |||
| 135 | if (document.getElementById('redirect_search_term')) { | ||
| 136 | redirect_search.initialize_search(); | ||
| 137 | |||
| 138 | var mode = document.getElementById('page_redirect'); | ||
| 139 | var field = document.getElementById('redirect_target_field'); | ||
| 140 | mode.addEventListener('change', function () { | ||
| 141 | field.style.display = mode.checked ? '' : 'none'; | ||
| 142 | }); | ||
| 143 | |||
| 144 | var term = document.getElementById('redirect_search_term'); | ||
| 145 | term.addEventListener('input', function () { | ||
| 146 | if (term.value === '') { | ||
| 147 | document.getElementById('page_redirect_node_id').value = ''; | ||
| 148 | } | ||
| 149 | }); | ||
| 150 | } | ||
| 151 | |||
| 127 | var metadata_details = document.getElementById('metadata_details'); | 152 | var metadata_details = document.getElementById('metadata_details'); |
| 128 | if (metadata_details) { | 153 | if (metadata_details) { |
| 129 | var desktop_mq = window.matchMedia('(min-width: 1016px)'); | 154 | var desktop_mq = window.matchMedia('(min-width: 1016px)'); |
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index e20e511a..746cecc1 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -263,6 +263,20 @@ move_to_search = { | |||
| 263 | } | 263 | } |
| 264 | }; | 264 | }; |
| 265 | 265 | ||
| 266 | redirect_search = { | ||
| 267 | initialize_search : function() { | ||
| 268 | initSearchPicker({ | ||
| 269 | inputSelector: "#redirect_search_term", | ||
| 270 | resultsSelector: "#redirect_search_results", | ||
| 271 | showRestricted: true, | ||
| 272 | onSelect: function(node) { | ||
| 273 | $("#redirect_search_term").val(node.title); | ||
| 274 | $("#page_redirect_node_id").val(node.node_id); | ||
| 275 | } | ||
| 276 | }); | ||
| 277 | } | ||
| 278 | }; | ||
| 279 | |||
| 266 | restore_search = { | 280 | restore_search = { |
| 267 | initialize_search : function() { | 281 | initialize_search : function() { |
| 268 | initSearchPicker({ | 282 | initSearchPicker({ |
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 923cac4b..63333d93 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -446,11 +446,8 @@ form.button_to.computation button[type="submit"]:disabled { | |||
| 446 | pointer-events: none; | 446 | pointer-events: none; |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | /* Native (non-button_to) submit buttons -- Create/Save/Publish forms. | 449 | /* Native (non-button_to) submit buttons used for Create/Save/Publish |
| 450 | Lower specificity than form.button_to's own rule, so button_to forms | 450 | forms. */ |
| 451 | are correctly unaffected. If a button_to output ever loses its class | ||
| 452 | wrapper, it will silently fall through to this bordered style instead | ||
| 453 | of rendering as a plain link -- worth knowing, not necessarily fixing. */ | ||
| 454 | input[type="submit"] { | 451 | input[type="submit"] { |
| 455 | -webkit-appearance: none; | 452 | -webkit-appearance: none; |
| 456 | appearance: none; | 453 | appearance: none; |
| @@ -470,6 +467,44 @@ input[type="submit"]:hover { | |||
| 470 | background-color: var(--text); | 467 | background-color: var(--text); |
| 471 | } | 468 | } |
| 472 | 469 | ||
| 470 | .input_group { | ||
| 471 | width: 100%; | ||
| 472 | position: relative; | ||
| 473 | display: inline-block; | ||
| 474 | } | ||
| 475 | |||
| 476 | .input_group .field_search_icon { | ||
| 477 | position: absolute; | ||
| 478 | left: 0.5rem; | ||
| 479 | top: 55%; | ||
| 480 | transform: translateY(-50%); | ||
| 481 | color: var(--text-muted); | ||
| 482 | pointer-events: none; | ||
| 483 | } | ||
| 484 | |||
| 485 | .input_group .field_search_icon svg { | ||
| 486 | width: 1em; | ||
| 487 | height: 1em; | ||
| 488 | } | ||
| 489 | |||
| 490 | .input_group input[type="text"].clearable_input { | ||
| 491 | padding-left: 2rem; | ||
| 492 | padding-right: 1.75rem; | ||
| 493 | } | ||
| 494 | |||
| 495 | .field_clear { | ||
| 496 | position: absolute; | ||
| 497 | right: 0.25rem; | ||
| 498 | top: 50%; | ||
| 499 | transform: translateY(-50%); | ||
| 500 | appearance: none; | ||
| 501 | background: none; | ||
| 502 | border: 0; | ||
| 503 | color: var(--text-muted); | ||
| 504 | cursor: pointer; | ||
| 505 | line-height: 1; | ||
| 506 | } | ||
| 507 | |||
| 473 | /* ============================================================ | 508 | /* ============================================================ |
| 474 | Admin dashboard | 509 | Admin dashboard |
| 475 | ============================================================ */ | 510 | ============================================================ */ |
