Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,260 changes: 2,260 additions & 0 deletions user-guide/app-patterns.html

Large diffs are not rendered by default.

818 changes: 818 additions & 0 deletions user-guide/css/app-patterns.css

Large diffs are not rendered by default.

650 changes: 650 additions & 0 deletions user-guide/css/guide.css

Large diffs are not rendered by default.

Binary file added user-guide/img/avatar-a-128.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/avatar-b-128.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/cta-faculty-550x370.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/cta-staff-550x370.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/news-building-388x246.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/news-faculty-388x246.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/news-staff-388x246.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/tile-building-550x370.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/tile-faculty-550x370.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added user-guide/img/tile-staff-550x370.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,420 changes: 1,420 additions & 0 deletions user-guide/index.html

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions user-guide/js/guide.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Decorator Kit Developer Guide — copy-to-clipboard for prompt blocks.
*
* Touches only elements inside the canvas (main#main-content). Each
* button.guide-copy names the <pre> it copies with data-copy-target.
*/
(function () {
"use strict";

var canvas = document.getElementById("main-content");
if (!canvas) return;

var status = canvas.querySelector(".guide-status");

function announce(message) {
if (!status) return;
status.textContent = "";
window.setTimeout(function () {
status.textContent = message;
}, 50);
}

function fallbackCopy(text) {
var area = document.createElement("textarea");
area.value = text;
area.setAttribute("readonly", "");
area.className = "sr-only";
canvas.appendChild(area);
area.select();
var ok = false;
try {
ok = document.execCommand("copy");
} catch (e) {
ok = false;
}
canvas.removeChild(area);
return ok;
}

function flash(button, ok) {
var label = button.querySelector(".guide-copy-label");
var icon = button.querySelector(".glyphicon");
if (!label) return;
window.clearTimeout(button._guideTimer);
label.textContent = ok ? "Copied" : "Press Ctrl+C";
if (icon) icon.className = "glyphicon " + (ok ? "glyphicon-ok" : "glyphicon-copy");
button.classList.toggle("is-copied", ok);
button._guideTimer = window.setTimeout(function () {
label.textContent = "Copy";
if (icon) icon.className = "glyphicon glyphicon-copy";
button.classList.remove("is-copied");
}, 2000);
}

canvas.addEventListener("click", function (event) {
var button = event.target.closest("button.guide-copy");
if (!button || !canvas.contains(button)) return;

var target = document.getElementById(button.getAttribute("data-copy-target"));
if (!target) return;
var text = target.textContent.trim();

function done(ok) {
flash(button, ok);
announce(ok ? "Prompt copied to clipboard." : "Copy failed. Select the prompt text and copy it manually.");
}

if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(text).then(
function () { done(true); },
function () { done(fallbackCopy(text)); }
);
} else {
done(fallbackCopy(text));
}
});
})();
58 changes: 58 additions & 0 deletions user-guide/js/status-board.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Working example: IT service status board (Decorator Kit Developer Guide, App Patterns).
*
* Progressive enhancement over markup that already lists every service, so
* the board is readable with JavaScript off. The script adds filtering (All /
* Needs attention), search by name, a live result count for screen readers,
* and an empty state. It reads and writes only elements inside #its-board,
* which lives in the canvas.
*
* jQuery is used for the change listener because Bootstrap's button.js
* (data-toggle="buttons") announces radio changes with jQuery's trigger(),
* which native addEventListener handlers never see.
*/
(function ($) {
"use strict";

var board = document.getElementById("its-board");
if (!board || !$) return;

var items = Array.prototype.slice.call(board.querySelectorAll("[data-service]"));
var search = board.querySelector("#its-q");
var count = board.querySelector(".app-live-count");
var empty = board.querySelector(".app-empty");
var form = board.querySelector("form.app-toolbar-search");

function currentFilter() {
var checked = board.querySelector('input[name="its-show"]:checked');
return checked ? checked.value : "all";
}

function apply() {
var filter = currentFilter();
var term = (search.value || "").trim().toLowerCase();
var shown = 0;

items.forEach(function (item) {
var name = item.getAttribute("data-service").toLowerCase();
var status = item.getAttribute("data-status");
var visible = (filter === "all" || status !== "ok") && (!term || name.indexOf(term) !== -1);
item.classList.toggle("hidden", !visible);
if (visible) shown += 1;
});

count.textContent = shown + (shown === 1 ? " service" : " services") + " shown";
empty.classList.toggle("hidden", shown > 0);
}

$(board).on("change", 'input[name="its-show"]', apply);
search.addEventListener("input", apply);
if (form) {
form.addEventListener("submit", function (event) {
event.preventDefault();
apply();
});
}

apply();
})(window.jQuery);
Loading