diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/javascripts/admin_interface.js | 116 | ||||
| -rw-r--r-- | public/javascripts/admin_search.js | 43 | ||||
| -rw-r--r-- | public/javascripts/related_assets.js | 9 | ||||
| -rw-r--r-- | public/stylesheets/admin.css | 112 |
4 files changed, 191 insertions, 89 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index 0c9ec66..b7bdc10 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -1,15 +1,3 @@ | |||
| 1 | function hide_all() { | ||
| 2 | $('#recent_changes_toggle').attr("class", "unselected"); | ||
| 3 | $('#my_work_toggle').attr("class", "unselected"); | ||
| 4 | $('#current_drafts_toggle').attr("class", "unselected"); | ||
| 5 | $('#admin_sitemap_toggle').attr("class", "unselected"); | ||
| 6 | |||
| 7 | $('#current_drafts_table').hide(); | ||
| 8 | $('#my_work_table').hide(); | ||
| 9 | $('#recent_changes_table').hide(); | ||
| 10 | $('#admin_sitemap_table').hide(); | ||
| 11 | } | ||
| 12 | |||
| 13 | $(document).ready(function () { | 1 | $(document).ready(function () { |
| 14 | admin_search.initialize(); | 2 | admin_search.initialize(); |
| 15 | 3 | ||
| @@ -69,6 +57,10 @@ $(document).ready(function () { | |||
| 69 | move_to_search.initialize_search(); | 57 | move_to_search.initialize_search(); |
| 70 | } | 58 | } |
| 71 | 59 | ||
| 60 | if ($("#restore_search_term").length != 0) { | ||
| 61 | restore_search.initialize_search(); | ||
| 62 | } | ||
| 63 | |||
| 72 | if ($("#event_node_search_term").length != 0) { | 64 | if ($("#event_node_search_term").length != 0) { |
| 73 | event_search.initialize_search(); | 65 | event_search.initialize_search(); |
| 74 | } | 66 | } |
| @@ -85,63 +77,13 @@ $(document).ready(function () { | |||
| 85 | cccms.preview.initialize(); | 77 | cccms.preview.initialize(); |
| 86 | } | 78 | } |
| 87 | 79 | ||
| 88 | if ($('#recent_changes_toggle').length != 0) { | ||
| 89 | hide_all(); | ||
| 90 | $('#recent_changes_toggle').attr("class", "selected"); | ||
| 91 | $('#recent_changes_table').show(); | ||
| 92 | |||
| 93 | $('#recent_changes_toggle').bind("click", function(){ | ||
| 94 | hide_all(); | ||
| 95 | $('#recent_changes_toggle').attr("class", "selected"); | ||
| 96 | $('#recent_changes_table').show(); | ||
| 97 | return false; | ||
| 98 | }); | ||
| 99 | |||
| 100 | $('#my_work_toggle').bind("click", function(){ | ||
| 101 | hide_all(); | ||
| 102 | $('#my_work_toggle').attr("class", "selected"); | ||
| 103 | $('#my_work_table').show(); | ||
| 104 | return false; | ||
| 105 | }); | ||
| 106 | |||
| 107 | $('#admin_wizard_my_work').bind("click", function(){ | ||
| 108 | hide_all(); | ||
| 109 | $('#my_work_toggle').attr("class", "selected"); | ||
| 110 | $('#my_work_table').show(); | ||
| 111 | return false; | ||
| 112 | }); | ||
| 113 | |||
| 114 | $('#current_drafts_toggle').bind("click", function(){ | ||
| 115 | hide_all(); | ||
| 116 | $('#current_drafts_toggle').attr("class", "selected"); | ||
| 117 | $('#current_drafts_table').show(); | ||
| 118 | return false; | ||
| 119 | }); | ||
| 120 | |||
| 121 | $('#admin_sitemap_toggle').bind("click", function(){ | ||
| 122 | hide_all(); | ||
| 123 | $('#admin_sitemap_toggle').attr("class", "selected"); | ||
| 124 | $('#admin_sitemap_table').show(); | ||
| 125 | return false; | ||
| 126 | }); | ||
| 127 | |||
| 128 | $('#admin_wizard_create_page').bind("click", function(){ | ||
| 129 | hide_all(); | ||
| 130 | $('#admin_sitemap_toggle').attr("class", "selected"); | ||
| 131 | $('#admin_sitemap_table').show(); | ||
| 132 | return false; | ||
| 133 | }); | ||
| 134 | } | ||
| 135 | |||
| 136 | jQuery.ajaxSetup({ | 80 | jQuery.ajaxSetup({ |
| 137 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");} | 81 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");} |
| 138 | }); | 82 | }); |
| 139 | 83 | ||
| 140 | $(document).ajaxSend(function(event, request, settings) { | 84 | $(document).ajaxSend(function(event, request, settings) { |
| 141 | if (typeof(AUTH_TOKEN) == "undefined") return; | 85 | var meta = document.querySelector("meta[name='csrf-token']"); |
| 142 | // settings.data is a serialized string like "foo=bar&baz=boink" (or null) | 86 | if (meta) request.setRequestHeader("X-CSRF-Token", meta.content); |
| 143 | settings.data = settings.data || ""; | ||
| 144 | settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN); | ||
| 145 | }); | 87 | }); |
| 146 | 88 | ||
| 147 | }); | 89 | }); |
| @@ -475,8 +417,10 @@ rrule_builder = { | |||
| 475 | }); | 417 | }); |
| 476 | $("#rrule_monthly_ordinal").bind("change", function() { | 418 | $("#rrule_monthly_ordinal").bind("change", function() { |
| 477 | $("#rrule_ordinal_fields").toggle($(this).is(":checked")); | 419 | $("#rrule_ordinal_fields").toggle($(this).is(":checked")); |
| 420 | rrule_builder.toggle_custom_ordinal_fields(); | ||
| 478 | rrule_builder.sync(); | 421 | rrule_builder.sync(); |
| 479 | }); | 422 | }); |
| 423 | $("#rrule_ordinal").bind("change", rrule_builder.toggle_custom_ordinal_fields); | ||
| 480 | $("#rrule_exclude_month").bind("change", function() { | 424 | $("#rrule_exclude_month").bind("change", function() { |
| 481 | $("#rrule_excluded_month").toggle($(this).is(":checked")); | 425 | $("#rrule_excluded_month").toggle($(this).is(":checked")); |
| 482 | rrule_builder.sync(); | 426 | rrule_builder.sync(); |
| @@ -493,6 +437,12 @@ rrule_builder = { | |||
| 493 | $("#rrule_monthly_options").show(); | 437 | $("#rrule_monthly_options").show(); |
| 494 | }, | 438 | }, |
| 495 | 439 | ||
| 440 | toggle_custom_ordinal_fields : function() { | ||
| 441 | $("#rrule_custom_ordinal_fields").toggle( | ||
| 442 | $("#rrule_monthly_ordinal").is(":checked") && $("#rrule_ordinal").val() === "custom" | ||
| 443 | ); | ||
| 444 | }, | ||
| 445 | |||
| 496 | sync : function() { | 446 | sync : function() { |
| 497 | var freq = $("input[name='rrule_freq']:checked").val(); | 447 | var freq = $("input[name='rrule_freq']:checked").val(); |
| 498 | var parts = []; | 448 | var parts = []; |
| @@ -508,7 +458,16 @@ rrule_builder = { | |||
| 508 | } else { | 458 | } else { |
| 509 | parts.push("FREQ=MONTHLY"); | 459 | parts.push("FREQ=MONTHLY"); |
| 510 | if ($("#rrule_monthly_ordinal").is(":checked")) { | 460 | if ($("#rrule_monthly_ordinal").is(":checked")) { |
| 511 | parts.push("BYDAY=" + $("#rrule_ordinal").val() + $("#rrule_ordinal_day").val()); | 461 | var ordinal = $("#rrule_ordinal").val(); |
| 462 | if (ordinal === "custom") { | ||
| 463 | var customDays = []; | ||
| 464 | $("input[id^='rrule_custom_ordinal_']:checked").each(function() { | ||
| 465 | customDays.push($(this).attr("id").replace("rrule_custom_ordinal_", "") + $("#rrule_ordinal_day").val()); | ||
| 466 | }); | ||
| 467 | if (customDays.length > 0) parts.push("BYDAY=" + customDays.join(",")); | ||
| 468 | } else { | ||
| 469 | parts.push("BYDAY=" + ordinal + $("#rrule_ordinal_day").val()); | ||
| 470 | } | ||
| 512 | } | 471 | } |
| 513 | } | 472 | } |
| 514 | 473 | ||
| @@ -543,8 +502,33 @@ rrule_builder = { | |||
| 543 | } else if (parts.FREQ === "MONTHLY") { | 502 | } else if (parts.FREQ === "MONTHLY") { |
| 544 | $("input[name='rrule_freq'][value='monthly']").prop("checked", true); | 503 | $("input[name='rrule_freq'][value='monthly']").prop("checked", true); |
| 545 | rrule_builder.show_monthly_options(); | 504 | rrule_builder.show_monthly_options(); |
| 505 | var ordinalDays = parts.BYDAY && parts.BYDAY.split(","); | ||
| 506 | var customOrdinalDay = null; | ||
| 507 | var customOrdinals = []; | ||
| 508 | var customOrdinalsValid = ordinalDays && ordinalDays.length > 0; | ||
| 509 | if (customOrdinalsValid) { | ||
| 510 | ordinalDays.forEach(function(value) { | ||
| 511 | var customMatch = value.match(/^([1-5])([A-Z]{2})$/); | ||
| 512 | if (!customMatch || (customOrdinalDay && customOrdinalDay !== customMatch[2])) { | ||
| 513 | customOrdinalsValid = false; | ||
| 514 | return; | ||
| 515 | } | ||
| 516 | customOrdinalDay = customMatch[2]; | ||
| 517 | customOrdinals.push(customMatch[1]); | ||
| 518 | }); | ||
| 519 | } | ||
| 520 | |||
| 546 | var match = parts.BYDAY && parts.BYDAY.match(/^(-?\d+)([A-Z]{2})$/); | 521 | var match = parts.BYDAY && parts.BYDAY.match(/^(-?\d+)([A-Z]{2})$/); |
| 547 | if (match) { | 522 | if (customOrdinalsValid && (customOrdinals.length > 1 || customOrdinals[0] === "5")) { |
| 523 | $("#rrule_monthly_ordinal").prop("checked", true); | ||
| 524 | $("#rrule_ordinal_fields").show(); | ||
| 525 | $("#rrule_ordinal").val("custom"); | ||
| 526 | $("#rrule_ordinal_day").val(customOrdinalDay); | ||
| 527 | customOrdinals.forEach(function(ordinal) { | ||
| 528 | $("#rrule_custom_ordinal_" + ordinal).prop("checked", true); | ||
| 529 | }); | ||
| 530 | rrule_builder.toggle_custom_ordinal_fields(); | ||
| 531 | } else if (match) { | ||
| 548 | $("#rrule_monthly_ordinal").prop("checked", true); | 532 | $("#rrule_monthly_ordinal").prop("checked", true); |
| 549 | $("#rrule_ordinal_fields").show(); | 533 | $("#rrule_ordinal_fields").show(); |
| 550 | $("#rrule_ordinal").val(match[1]); | 534 | $("#rrule_ordinal").val(match[1]); |
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index 7604bb7..b53c931 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -72,24 +72,20 @@ function initSearchPicker(options) { | |||
| 72 | found = false; | 72 | found = false; |
| 73 | for (var i = 0; i < data.length; i++) { | 73 | for (var i = 0; i < data.length; i++) { |
| 74 | (function(node) { | 74 | (function(node) { |
| 75 | var link; | 75 | var anchor = $("<a>").attr("href", onSelect ? "#" : node.node_path); |
| 76 | anchor.append(document.createTextNode(node.title || "")); | ||
| 77 | anchor.append($("<span>", { "class": "result_path" }).text(node.unique_name || "")); | ||
| 78 | var link = $("<p>").append(anchor); | ||
| 79 | |||
| 76 | if (onSelect) { | 80 | if (onSelect) { |
| 77 | link = $( | 81 | anchor.bind("click", function() { |
| 78 | "<p><a href='#'>" + node.title + | ||
| 79 | "<span class='result_path'>" + node.unique_name + "</span></a></p>" | ||
| 80 | ); | ||
| 81 | link.find("a").bind("click", function() { | ||
| 82 | onSelect(node); | 82 | onSelect(node); |
| 83 | results.slideUp(); | 83 | results.slideUp(); |
| 84 | results.empty(); | 84 | results.empty(); |
| 85 | return false; | 85 | return false; |
| 86 | }); | 86 | }); |
| 87 | } else { | ||
| 88 | link = $( | ||
| 89 | "<p><a href='" + node.node_path + "'>" + node.title + | ||
| 90 | "<span class='result_path'>" + node.unique_name + "</span></a></p>" | ||
| 91 | ); | ||
| 92 | } | 87 | } |
| 88 | |||
| 93 | results.append(link); | 89 | results.append(link); |
| 94 | found = true; | 90 | found = true; |
| 95 | })(data[i]); | 91 | })(data[i]); |
| @@ -150,7 +146,9 @@ dashboard_search = { | |||
| 150 | results.append("<p class='search_group_label'>Tags</p>"); | 146 | results.append("<p class='search_group_label'>Tags</p>"); |
| 151 | var tag_row = $("<div class='search_tag_row'></div>"); | 147 | var tag_row = $("<div class='search_tag_row'></div>"); |
| 152 | data.tags.forEach(function(tag) { | 148 | data.tags.forEach(function(tag) { |
| 153 | tag_row.append("<a class='search_tag_pill' href='" + tag.tag_path + "'>" + tag.name + "</a>"); | 149 | tag_row.append( |
| 150 | $("<a>", { "class": "search_tag_pill" }).attr("href", tag.tag_path).text(tag.name || "") | ||
| 151 | ); | ||
| 154 | found = true; | 152 | found = true; |
| 155 | }); | 153 | }); |
| 156 | results.append(tag_row); | 154 | results.append(tag_row); |
| @@ -159,10 +157,10 @@ dashboard_search = { | |||
| 159 | if (data.nodes.length) { | 157 | if (data.nodes.length) { |
| 160 | results.append("<p class='search_group_label'>Pages</p>"); | 158 | results.append("<p class='search_group_label'>Pages</p>"); |
| 161 | data.nodes.forEach(function(node) { | 159 | data.nodes.forEach(function(node) { |
| 162 | results.append( | 160 | var anchor = $("<a>").attr("href", node.node_path); |
| 163 | "<p><a href='" + node.node_path + "'>" + node.title + | 161 | anchor.append(document.createTextNode(node.title || "")); |
| 164 | "<span class='result_path'>" + node.unique_name + "</span></a></p>" | 162 | anchor.append($("<span>", { "class": "result_path" }).text(node.unique_name || "")); |
| 165 | ); | 163 | results.append($("<p>").append(anchor)); |
| 166 | found = true; | 164 | found = true; |
| 167 | }); | 165 | }); |
| 168 | } | 166 | } |
| @@ -264,6 +262,19 @@ move_to_search = { | |||
| 264 | } | 262 | } |
| 265 | }; | 263 | }; |
| 266 | 264 | ||
| 265 | restore_search = { | ||
| 266 | initialize_search : function() { | ||
| 267 | initSearchPicker({ | ||
| 268 | inputSelector: "#restore_search_term", | ||
| 269 | resultsSelector: "#restore_search_results", | ||
| 270 | onSelect: function(node) { | ||
| 271 | $("#restore_search_term").val(node.title); | ||
| 272 | $("#parent_id").val(node.node_id); | ||
| 273 | } | ||
| 274 | }); | ||
| 275 | } | ||
| 276 | }; | ||
| 277 | |||
| 267 | event_search = { | 278 | event_search = { |
| 268 | initialize_search : function() { | 279 | initialize_search : function() { |
| 269 | initSearchPicker({ | 280 | initSearchPicker({ |
diff --git a/public/javascripts/related_assets.js b/public/javascripts/related_assets.js index 803332f..3340fa7 100644 --- a/public/javascripts/related_assets.js +++ b/public/javascripts/related_assets.js | |||
| @@ -15,12 +15,9 @@ related_assets = { | |||
| 15 | renderResults: function(data, results) { | 15 | renderResults: function(data, results) { |
| 16 | var found = false; | 16 | var found = false; |
| 17 | data.forEach(function(asset) { | 17 | data.forEach(function(asset) { |
| 18 | var item = $( | 18 | var item = $("<a>", { href: "#", "class": "related_asset_result" }); |
| 19 | "<a href='#' class='related_asset_result'>" + | 19 | item.append($("<img>", { src: asset.thumb_url, alt: "" })); |
| 20 | "<img src='" + asset.thumb_url + "' alt=''>" + | 20 | item.append($("<span>").text(asset.name || "")); |
| 21 | "<span>" + asset.name + "</span>" + | ||
| 22 | "</a>" | ||
| 23 | ); | ||
| 24 | item.bind("click", function() { | 21 | item.bind("click", function() { |
| 25 | related_assets.attach(asset.id, createUrl, list); | 22 | related_assets.attach(asset.id, createUrl, list); |
| 26 | return false; | 23 | return false; |
diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index b5b8707..05e47e7 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css | |||
| @@ -37,10 +37,13 @@ td { | |||
| 37 | depend on this rule for vertical padding. table.node_table td resets | 37 | depend on this rule for vertical padding. table.node_table td resets |
| 38 | padding-top/bottom to 0 explicitly and does not depend on it. */ | 38 | padding-top/bottom to 0 explicitly and does not depend on it. */ |
| 39 | 39 | ||
| 40 | input[type=text], textarea { | 40 | input[type=text], |
| 41 | input[type=password], | ||
| 42 | textarea { | ||
| 41 | font-size: 1rem; | 43 | font-size: 1rem; |
| 42 | font-family: Helvetica; | 44 | font-family: Helvetica; |
| 43 | border: 1px solid #989898; | 45 | border: 1px solid #989898; |
| 46 | border-radius: 2px; | ||
| 44 | } | 47 | } |
| 45 | 48 | ||
| 46 | select { | 49 | select { |
| @@ -881,6 +884,10 @@ form.button_to button[type="submit"] { | |||
| 881 | margin-top: -5px; | 884 | margin-top: -5px; |
| 882 | } | 885 | } |
| 883 | 886 | ||
| 887 | .aligned_action_row .action_button.action_button_no_margin_top { | ||
| 888 | margin-top: 0; | ||
| 889 | } | ||
| 890 | |||
| 884 | /* ============================================================ | 891 | /* ============================================================ |
| 885 | Page editor / metadata forms | 892 | Page editor / metadata forms |
| 886 | ============================================================ */ | 893 | ============================================================ */ |
| @@ -1121,6 +1128,25 @@ div#draft_list table td.actions a { | |||
| 1121 | font-size: 0.9em; | 1128 | font-size: 0.9em; |
| 1122 | } | 1129 | } |
| 1123 | 1130 | ||
| 1131 | #recent_changes_full_list { | ||
| 1132 | list-style: none; | ||
| 1133 | padding: 0; | ||
| 1134 | margin: 0; | ||
| 1135 | } | ||
| 1136 | |||
| 1137 | #recent_changes_full_list li { | ||
| 1138 | padding: 0.75rem 0; | ||
| 1139 | border-bottom: 1px solid #eee; | ||
| 1140 | } | ||
| 1141 | |||
| 1142 | #recent_changes_full_list li:last-child { | ||
| 1143 | border-bottom: none; | ||
| 1144 | } | ||
| 1145 | |||
| 1146 | #recent_changes_full_list li > div { | ||
| 1147 | margin-bottom: 0.25rem; | ||
| 1148 | } | ||
| 1149 | |||
| 1124 | /* ============================================================ | 1150 | /* ============================================================ |
| 1125 | Search widgets | 1151 | Search widgets |
| 1126 | ============================================================ */ | 1152 | ============================================================ */ |
| @@ -1475,3 +1501,87 @@ div#image_browser ul li { | |||
| 1475 | gap: 8px; | 1501 | gap: 8px; |
| 1476 | flex-wrap: wrap; | 1502 | flex-wrap: wrap; |
| 1477 | } | 1503 | } |
| 1504 | |||
| 1505 | /* ============================================================ | ||
| 1506 | Action log | ||
| 1507 | ============================================================ */ | ||
| 1508 | |||
| 1509 | #node_action_list td.node_action_body { | ||
| 1510 | border-bottom: 1px solid #f1f1f1; | ||
| 1511 | } | ||
| 1512 | |||
| 1513 | .dashboard_widget .node_action_time span { | ||
| 1514 | display: block; | ||
| 1515 | } | ||
| 1516 | |||
| 1517 | #node_action_list td.node_action_time { | ||
| 1518 | white-space: nowrap; | ||
| 1519 | vertical-align: top; | ||
| 1520 | font-family: monospace; | ||
| 1521 | font-size: 0.8em; | ||
| 1522 | color: #777; | ||
| 1523 | padding-right: 1em; | ||
| 1524 | } | ||
| 1525 | |||
| 1526 | #node_action_list td.node_action_body { | ||
| 1527 | vertical-align: top; | ||
| 1528 | } | ||
| 1529 | |||
| 1530 | .node_action_inferred { | ||
| 1531 | opacity: 0.5; | ||
| 1532 | font-size: smaller; | ||
| 1533 | margin-left: 0.5em; | ||
| 1534 | } | ||
| 1535 | |||
| 1536 | .node_action_zoom { | ||
| 1537 | font-size: smaller; | ||
| 1538 | margin-left: 0.5em; | ||
| 1539 | } | ||
| 1540 | |||
| 1541 | .node_action_details summary { | ||
| 1542 | cursor: pointer; | ||
| 1543 | font-size: smaller; | ||
| 1544 | color: #777; | ||
| 1545 | } | ||
| 1546 | |||
| 1547 | .node_action_icon { | ||
| 1548 | color: #777; | ||
| 1549 | margin-right: 0.35em; | ||
| 1550 | vertical-align: text-bottom; | ||
| 1551 | } | ||
| 1552 | |||
| 1553 | .revision_lifecycle { | ||
| 1554 | font-size: 0.85rem; | ||
| 1555 | color: #777; | ||
| 1556 | } | ||
| 1557 | |||
| 1558 | /* ============================================================ | ||
| 1559 | Trash section | ||
| 1560 | ============================================================ */ | ||
| 1561 | |||
| 1562 | .restore_form { | ||
| 1563 | display: flex; | ||
| 1564 | align-items: center; | ||
| 1565 | gap: 8px; | ||
| 1566 | } | ||
| 1567 | |||
| 1568 | .restore_picker { | ||
| 1569 | position: relative; | ||
| 1570 | } | ||
| 1571 | |||
| 1572 | .restore_picker input[type=text] { | ||
| 1573 | width: 22em; | ||
| 1574 | } | ||
| 1575 | |||
| 1576 | .restore_picker .search_results { | ||
| 1577 | position: absolute; | ||
| 1578 | top: 100%; | ||
| 1579 | left: 0; | ||
| 1580 | right: 0; | ||
| 1581 | z-index: 10; | ||
| 1582 | background: #fff; | ||
| 1583 | border: 1px solid #989898; | ||
| 1584 | border-top: none; | ||
| 1585 | max-height: 20em; | ||
| 1586 | overflow-y: auto; | ||
| 1587 | } | ||
