Skip to content

Commit

Permalink
Initial implementation of bookmarks display on browser page.
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsapp committed Oct 31, 2021
1 parent 59908c4 commit c0109a7
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 10 deletions.
24 changes: 24 additions & 0 deletions _includes/browse/highlightSortedTableColumn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% comment %}
//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Wed Oct 6 12:27:04 PDT 2021
// Last Modified: Wed Oct 6 12:27:07 PDT 2021
// Filename: _includes/browse/highlightSortedTableColumn.js
// Used by: _includes/browse/displayBrowsePage.js
// Included in: _includes/browse/main.html
// Syntax: ECMAScript 6
// vim: ts=3:nowrap
//
// Description: Generate contents for all fields in browwe search form.
//
{% endcomment %}

POPC2.prototype.highlightSortedTableColumn = function (index) {
this.DebugMessageFunction();

};

Object.defineProperty(POPC2.prototype.highlightSortedTableColumn, "name", { value: "highlightSortedTableColumn" });



1 change: 1 addition & 0 deletions _includes/browse/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
{% include browse/showResultsCount.js %}
{% include browse/showShelfmarkColumn.js %}
{% include browse/storeSearchInfo.js %}
{% include browse/toggleBookmarkDisplay.js %}
{% include browse/toggleBrowseStyle.js %}
{% include browse/toggleComposerSort.js %}
{% include browse/toggleShelfmarkSort.js %}
Expand Down
59 changes: 59 additions & 0 deletions _includes/browse/toggleBookmarkDisplay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{% comment %}
//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Sat Oct 30 20:51:13 PDT 2021
// Last Modified: Sat Oct 30 20:51:17 PDT 2021
// Filename: _includes/browse/toggleBookmarkDisplay.js
// Used by: _includes/handlebars/template-browse.html
// Included in: _includes/browse/main.html
// Syntax: ECMAScript 6
// vim: ts=3:nowrap
//
// Description: Toggle between bookmark and browse search results.
//
{% endcomment %}

POPC2.prototype.toggleBookmarkDisplay = function () {
this.DebugMessageFunction();

let belement = document.querySelector("#bookmark-browse-button");
if (!belement) {
console.log("CANNOT FIND B ELEMENT");
return;
}

let state = 0;
if (belement.classList.contains("selected")) {
state = 1;
}

let felement = document.querySelector("#filters");
let h1element = document.querySelector("h1");

state = !state;
if (state) {
belement.classList.add("selected");
if (felement) {
felement.classList.add("hidden");
}
this.VARS.SEARCH_RESULTS = this.VARS.WORK_BOOKMARKS;
if (h1element) {
h1element.innerHTML = this.getTranslation("bookmarks");
}
} else {
belement.classList.remove("selected");
if (felement) {
felement.classList.remove("hidden");
}
if (h1element) {
h1element.innerHTML = this.getTranslation("title");
}
}

this.displayBrowseTable();
};

Object.defineProperty(POPC2.prototype.toggleBookmarkDisplay, "name", { value: "toggleBookmarkDisplay" });



31 changes: 31 additions & 0 deletions _includes/handlebars/helper-bookmarkHide.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{% comment %}
//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Sat Oct 30 22:36:48 PDT 2021
// Last Modified: Sat Oct 30 22:36:51 PDT 2021
// Filename: _includes/handlebars/helper-bookmarkHide.js
// Used by:
// Included in: _includes/handlebars/main.html
// Syntax: ECMAScript 6
// vim: ts=3:nowrap
//
// Description: Hide something (filter menu) if bookmarks are active.
//
{% endcomment %}

Handlebars.registerHelper("bookmarkHide", function() {
let belement = document.querySelector("#bookmark-browse-button");
let bookmarks = false;
if (belement && belement.classList.contains("selected")) {
bookmarks = true;
}

if (bookmarks) {
return new Handlebars.SafeString("hidden");
}

return new Handlebars.SafeString("");
});



33 changes: 33 additions & 0 deletions _includes/handlebars/helper-showTitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% comment %}
//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Sat Oct 30 22:22:19 PDT 2021
// Last Modified: Sat Oct 30 22:22:22 PDT 2021
// Filename: _includes/handlebars/helper-showTitle.js
// Used by:
// Included in: _includes/handlebars/main.html
// Syntax: ECMAScript 6
// vim: ts=3:nowrap
//
// Description: Display the page title (on the browse page). This is
// usually the website title, but could be "Bookmarks" or
// "History" view.
//
{% endcomment %}

Handlebars.registerHelper("showTitle", function() {
let belement = document.querySelector("#bookmark-browse-button");
let bookmarks = false;
if (belement && belement.classList.contains("selected")) {
bookmarks = true;
}

if (bookmarks) {
return new Handlebars.SafeString(popc2.getTranslation("bookmarks"));
}

return new Handlebars.SafeString(popc2.getTranslation("title"));
});



2 changes: 2 additions & 0 deletions _includes/handlebars/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

<script>
{% include handlebars/helper-trans.js %}
{% include handlebars/helper-showTitle.js %}
{% include handlebars/helper-bookmarkHide.js %}
</script>


Expand Down
6 changes: 3 additions & 3 deletions _includes/handlebars/template-browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Fri Oct 8 23:22:31 PDT 2021
// Last Modified: Sat Oct 16 17:21:01 PDT 2021
// Last Modified: Sat Oct 30 22:21:12 PDT 2021
// Filename: _includes/handlebars/template-browse.html
// Included in: _includes/handlebars/main.html
// Syntax: HTML; Handlebars; Jekyll/Liquid
Expand All @@ -15,10 +15,10 @@
{% raw %}
<script id="template-browse" type="text/x-handlebars-template">

<h1>{{trans "title"}}</h1>
<h1>{{showTitle}}</h1>

<center>
<div id="filters">
<div id="filters" class="{{bookmarkHide}}">
<div class="filter-div" id="filter-composer"></div>
<div class="filter-div" id="filter-nationality" style="display:none;"></div>

Expand Down
9 changes: 4 additions & 5 deletions _includes/navigator/toolbar-browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,17 @@
data-transatt="title:incipit_tool_compress" onclick="popc2.toggleBrowseStyle();">
</div>

<div id="random-button" class="trans worknav-tool fas fa-random"
<div id="random-browse-button" class="trans worknav-tool fas fa-random"
data-transatt="title:random_tool" onclick="popc2.displayRandomWork();">
</div>

<div id="worklink-button" class="trans worknav-tool fas fa-link"
<div id="worklink-browse-button" class="trans worknav-tool fas fa-link"
data-transatt="title:worklink_tool" onclick="popc2.copySearchLink();">
</div>

<div id="bookmark-button" class="trans worknav-tool fas fa-star"
data-transatt="title:bookmark_tool" onclick="alert('this button will show bookmark list')">
<div id="bookmark-browse-button" class="trans worknav-tool fas fa-star"
data-transatt="title:bookmark_tool" onclick="popc2.toggleBookmarkDisplay()">
</div>




4 changes: 2 additions & 2 deletions _includes/styles/navigator.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
flex: 1 0 auto;
}

[id^="navigator-"] .selected {
color: {{ site.selected_language_color }};
.worknav-tool.selected {
color: {{ site.selected_language_color }} !important;
}

#next-work:hover,
Expand Down
6 changes: 6 additions & 0 deletions _includes/translations/basic.aton
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
@PL: Portal Muzyki Polskie
@@END: ENTRY

@@BEGIN: ENTRY
@TAG: bookmarks
@EN: Bookmarks
@PL: Zakładki
@@END: ENTRY


0 comments on commit c0109a7

Please sign in to comment.