Skip to content

Commit

Permalink
Add button to append a new section.
Browse files Browse the repository at this point in the history
ISSUE=#7
  • Loading branch information
sonph committed Apr 12, 2020
1 parent 6191e0c commit 464c6d5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pug/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ html(lang='en')
div.section(v-for='(section, index) in songChart.sections')
div(v-bind:class='{ bold: index == songChart.curSectionIndex, hide: index < songChart.curSectionIndex }')
| {{ index }}: {{ section.name }} ({{ section.length }})
div
span(v-on:click='songChartAppendSection()')
| + Add section
4 changes: 3 additions & 1 deletion src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ window.init = function() {
metronomeTempoIncrement: (() => { metronome.tempoIncrement(); }),
metronomeTempoIncrementBy5: (() => { metronome.tempoIncrementBy5(); }),
metronomeTempoIncrementBy10: (() => { metronome.tempoIncrementBy10(); }),
metronomeTempoDouble: (() => { metronome.tempoDouble(); })
metronomeTempoDouble: (() => { metronome.tempoDouble(); }),

songChartAppendSection: (() => { songChart.appendSection(); })
}
});

Expand Down
7 changes: 7 additions & 0 deletions src/js/songchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ class SongChart {
return this.uiData;
}

appendSection() {
this.json.sections.push({
"name": "Untitled",
"length": 8,
});
}

/**
* Fetches song chart from given url.
* @param {string} url Url.
Expand Down

0 comments on commit 464c6d5

Please sign in to comment.