Skip to content

Commit

Permalink
Merge pull request #151 from AfricasVoices/optional-auto-advance
Browse files Browse the repository at this point in the history
Optional auto advance
  • Loading branch information
as2388 authored Aug 22, 2018
2 parents db1d808 + e8bca81 commit 6a7af86
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
6 changes: 6 additions & 0 deletions coda-prototype/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ SOFTWARE.
padding: 14px 15px;
}

#auto-advance-label {
font-weight: normal;
user-select: none;
cursor: pointer;
}

thead {
border-top: none;
border-bottom: none;
Expand Down
4 changes: 4 additions & 0 deletions coda-prototype/src/ui/initUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,10 @@ function initUI(dataset) {
});
});

$("#auto-advance-checkbox").change(function() {
messageViewerManager.autoAdvance = this.checked;
});

$("#code-now-button").on("click", () => {

// code and re-sort dataset
Expand Down
10 changes: 9 additions & 1 deletion coda-prototype/src/ui/tableUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var messageViewerManager = {
currentSort: null,
firstScheme: "",
horizontal: true,
autoAdvance: true,
initialMessageTableWidth: 800,

init: function(messageContainer, data, rowsInTable) {
Expand All @@ -64,10 +65,10 @@ var messageViewerManager = {
this.decorationTable = $("#deco-table");
this.lastLoadedPageIndex = 1;
this.currentSort = this.sortUtils.restoreDefaultSort;
this.autoAdvance = $("#auto-advance-checkbox").prop("checked");

if (!data) {
this.buildTable();

} else {
newDataset.restoreDefaultSort();
this.buildTable(data, rowsInTable);
Expand Down Expand Up @@ -1304,6 +1305,10 @@ var messageViewerManager = {
},

verticalCoding: function(eventId) {
if (!this.autoAdvance) {
return;
}

/*
get new active row, keeping the active scheme
N.B. will wrap if no uncoded events are found between eventId and end of list
Expand Down Expand Up @@ -1343,6 +1348,9 @@ var messageViewerManager = {
},

horizontalCoding: function(eventId) {
if (!this.autoAdvance) {
return;
}

// switch to next active scheme: next uncoded column
let eventObj = newDataset.getEvent(eventId);
Expand Down
7 changes: 6 additions & 1 deletion coda-prototype/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ <h4 class="modal-title">Import Error</h4>
</li>
<li>
<div class="btn-toolbar" role="toolbar">

<div class="btn-group" role="group" aria-label="save">
<button id="save-all-button" type="button" class="navbar-btn btn btn-success"
data-toggle="tooltip" data-placement="bottom" title="Save changes within Coda"
Expand Down Expand Up @@ -225,6 +224,12 @@ <h4 class="modal-title">Import Error</h4>
</button>
</div>

<div class="navbar-text" >
<label id="auto-advance-label">
<input id="auto-advance-checkbox" type="checkbox" value="" checked>
Auto-Advance
</label>
</div>

<!-- Navigate between recent active messages -->
<!--
Expand Down

0 comments on commit 6a7af86

Please sign in to comment.