Commit 0e5675ffee7d02a8f06738b56fbced7a677e9e44
1 parent
6f7cf8cf51
Exists in
master
and in
3 other branches
added chapter navigation
Showing
1 changed file
with
33 additions
and
13 deletions
Show diff stats
src/pages/Dashboard/ChapterInfo.vue
... | ... | @@ -47,17 +47,30 @@ |
47 | 47 | </ul> |
48 | 48 | </div> |
49 | 49 | |
50 | - <!-- NEXT CHAPTER --> | |
51 | - <v-flex | |
52 | - class="text-xs-right mt-5" | |
53 | - v-if="indexSelectedChapter < chapterNames.length -1" | |
54 | - @click="showSelectedChapter()" | |
55 | - > | |
56 | - <span style="cursor: pointer;" class="subheading font-weight-bold"> | |
50 | + <!-- SELECT CHAPTERS --> | |
51 | + <v-layout row class="mt-5"> | |
52 | + <!-- PREVIOUS CHAPTER --> | |
53 | + <v-flex | |
54 | + style="cursor: pointer;" | |
55 | + class="subheading font-weight-bold text-xs-left" | |
56 | + v-if="indexSelectedChapter > 0" | |
57 | + @click="showSelectedChapter('back')" | |
58 | + > | |
59 | + <v-icon class="black--text" style="position:relative; top: 4px;">chevron_left</v-icon> | |
60 | + {{chapterNames[indexSelectedChapter - 1]}} | |
61 | + </v-flex> | |
62 | + <v-spacer></v-spacer> | |
63 | + <!-- NEXT CHAPTER --> | |
64 | + <v-flex | |
65 | + style="cursor: pointer;" | |
66 | + class="subheading font-weight-bold text-xs-right" | |
67 | + v-if="indexSelectedChapter < chapterNames.length -1" | |
68 | + @click="showSelectedChapter('forward')" | |
69 | + > | |
57 | 70 | {{chapterNames[indexSelectedChapter + 1]}} |
58 | 71 | <v-icon class="black--text" style="position:relative; top: 4px;">chevron_right</v-icon> |
59 | - </span> | |
60 | - </v-flex> | |
72 | + </v-flex> | |
73 | + </v-layout> | |
61 | 74 | <!-- <v-flex class="text-xs-right mt-5" v-else> |
62 | 75 | <span class="subheading font-weight-bold">Return to chapter one</span> |
63 | 76 | </v-flex>--> |
... | ... | @@ -109,10 +122,17 @@ export default { |
109 | 122 | }; |
110 | 123 | }, |
111 | 124 | methods: { |
112 | - showSelectedChapter() { | |
113 | - this.indexSelectedChapter += 1; | |
114 | - this.selectedChapterId = this.chapterIds[this.indexSelectedChapter]; | |
115 | - this.getParticularChapterDetail(); | |
125 | + showSelectedChapter(newChapter) { | |
126 | + if (newChapter == "forward") { | |
127 | + this.indexSelectedChapter += 1; | |
128 | + this.selectedChapterId = this.chapterIds[this.indexSelectedChapter]; | |
129 | + this.getParticularChapterDetail(); | |
130 | + } | |
131 | + if (newChapter == "back") { | |
132 | + this.indexSelectedChapter -= 1; | |
133 | + this.selectedChapterId = this.chapterIds[this.indexSelectedChapter]; | |
134 | + this.getParticularChapterDetail(); | |
135 | + } | |
116 | 136 | }, |
117 | 137 | getParticularChapterDetail() { |
118 | 138 | http() | ... | ... |