Skip to content

Commit

Permalink
0.9.0: Added toggles for #{add,edit}-slogan
Browse files Browse the repository at this point in the history
  • Loading branch information
Antifantwerp-Pigeon committed Sep 17, 2024
1 parent ef30036 commit 99d78d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protest-comms",
"version": "0.8.1",
"version": "0.9.0",
"description": "Coordinate slogans, moving, and communicate the needs of your group",
"pwaManifest": {
"name": "Protest Communicator",
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/settings.pug
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ mixin settings()
section#editor-change-slogans
h2 Editor: Change slogans
fieldset
input(type="button" aria-pressed="false" value="Add slogan")#add-slogan
input(type="button" value="Add slogan")#add-slogan
input(type="button" aria-pressed="false" value="Edit slogans")#edit-slogans
ol
8 changes: 5 additions & 3 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ function onInputSignalQuickSelect() {

function toggleButton(selector: string) {
const button = $(selector);
const wasPressed = button.attr("aria-pressed") === "true";
if (wasPressed) {
const unpressing = button.attr("aria-pressed") === "true";
if (unpressing) {
button.attr("aria-pressed", "false").removeClass("outline");
return false;
} else {
Expand All @@ -155,13 +155,14 @@ function onClickAddSlogan(e) {
if (!addingSlogan) {
addSlogan.before(`<label for="new-slogan" id="new-slogan-label" />`)
.before(`<input type="text" id="new-slogan" name="new-slogan" placeholder="New slogan text..." />`)
addSlogan.val("Save new slogan");
addSlogan.val("Save new slogan").addClass("outline");
} else {
pb.collection("slogans").create({
text: $("#new-slogan").val()
});
$("#new-slogan").remove();
$("#new-slogan-label").remove();
addSlogan.val("Add slogan").removeClass("outline")
}
addingSlogan = !addingSlogan;
}
Expand Down Expand Up @@ -191,6 +192,7 @@ function _createAddSloganForm(sloganId: string, sloganText: string) {

async function onClickEditSlogans() {
const slogansList = $("#slogans ol");
toggleButton("#edit-slogans")

if (editorCleanup()) {
return;
Expand Down

0 comments on commit 99d78d2

Please sign in to comment.