diff --git a/publish/style.css b/publish/style.css index 5b5fa4e..8500dcf 100644 --- a/publish/style.css +++ b/publish/style.css @@ -118,11 +118,27 @@ div.note { padding-top: 3px; padding-bottom: 3px; padding-left: 5px; - background-color: #006633; - color: white; + background-color: #e3ebe6; + color: #006633; cursor: pointer; border-radius: 8px 0 0 8px; } +#main .tab:hover { + background-color: #d2e2d8; +} +/* The tab that is showing */ +#main .tab.active { + background-color: #006633; + color: white; + cursor: default; +} +/* A tab whose field failed validation */ +#main .tab.red { + color: #cc0000; +} +#main .tab.active.red { + color: #ffd0d0; +} /* WordCount */ #main .counter { font-size: 11pt; diff --git a/publish/utilities.js b/publish/utilities.js index 0af702b..4a07378 100644 --- a/publish/utilities.js +++ b/publish/utilities.js @@ -19,6 +19,12 @@ function showHide(show) { document.getElementById(show+'parent').style.display = "block"; } + // Mark the tab that is showing + var showTab = document.getElementById(show+'tab'); + var hideTab = document.getElementById(hide+'tab'); + if (showTab) showTab.classList.add('active'); + if (hideTab) hideTab.classList.remove('active'); + return true; } diff --git a/publish/write.inc.php b/publish/write.inc.php index 1bad8a3..77a44ce 100644 --- a/publish/write.inc.php +++ b/publish/write.inc.php @@ -46,8 +46,8 @@ if (count($validate) !== 0) {
(An email address where editors can reach the author.)
- Text: - Image: + Text: + Image:
diff --git a/tests/js/helpers.js b/tests/js/helpers.js index ea0e7c4..2694d9b 100644 --- a/tests/js/helpers.js +++ b/tests/js/helpers.js @@ -19,6 +19,7 @@ const STORY_FORM = ` + Text:Image:
diff --git a/tests/js/utilities.test.js b/tests/js/utilities.test.js index 16cd2be..14b2633 100644 --- a/tests/js/utilities.test.js +++ b/tests/js/utilities.test.js @@ -91,6 +91,16 @@ test("showHide switches between the text and the image tabs", () => { assert.equal(w.showHide("other"), false); }); +test("showHide marks the tab that is showing", () => { + const w = publishWindow(); + const text = w.document.getElementById("texttab"); + const upload = w.document.getElementById("uploadtab"); + w.showHide("upload"); + assert.deepEqual([text.classList.contains("active"), upload.classList.contains("active")], [false, true]); + w.showHide("text"); + assert.deepEqual([text.classList.contains("active"), upload.classList.contains("active")], [true, false]); +}); + test("review asks for a title, then an author", () => { const w = publishWindow("

words

"); assert.equal(w.review(), false);