X-Git-Url: https://git.auder.net/pieces/Cwda/n_white_knight.svg?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FProblems.vue;h=f1c2d08a13088fb2fd88014517fcd99479a7cec8;hb=6f2f94374f1e73c375edf732d9425e575e81fff7;hp=7c81e6782447e4e0dec7263f1f09755cfe215b6e;hpb=bd76b45611cbb58dcf774745a4d690277a82aacd;p=vchess.git
diff --git a/client/src/views/Problems.vue b/client/src/views/Problems.vue
index 7c81e678..f1c2d08a 100644
--- a/client/src/views/Problems.vue
+++ b/client/src/views/Problems.vue
@@ -1,8 +1,14 @@
main
- input#modalNewprob.modal(type="checkbox" @change="infoMsg=''")
- div#newprobDiv(role="dialog" data-checkbox="modalNewprob")
- .card(@keyup.enter="sendProblem()")
+ input#modalNewprob.modal(
+ type="checkbox"
+ @change="fenFocusIfOpened($event)"
+ )
+ div#newprobDiv(
+ role="dialog"
+ data-checkbox="modalNewprob"
+ )
+ .card
label#closeNewprob.modal-close(for="modalNewprob")
fieldset
label(for="selectVariant") {{ st.tr["Variant"] }}
@@ -41,20 +47,18 @@ main
.row(v-if="showOne")
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
#topPage
- span {{ curproblem.vname }}
+ .button-group(v-if="st.user.id == curproblem.uid")
+ button(@click="editProblem(curproblem)") {{ st.tr["Edit"] }}
+ button(@click="deleteProblem(curproblem)") {{ st.tr["Delete"] }}
+ span.vname {{ curproblem.vname }}
+ span.uname ({{ curproblem.uname }})
button.marginleft(@click="backToList()") {{ st.tr["Back to list"] }}
- button.nomargin(
- v-if="st.user.id == curproblem.uid"
- @click="editProblem(curproblem)"
- )
- | {{ st.tr["Edit"] }}
- button.nomargin(
- v-if="st.user.id == curproblem.uid"
- @click="deleteProblem(curproblem)"
- )
- | {{ st.tr["Delete"] }}
- p.clickable(
- v-html="curproblem.uname + ' : ' + parseHtml(curproblem.instruction)"
+ button.nomargin(@click="gotoPrevNext($event,curproblem,1)")
+ | {{ st.tr["Previous"] }}
+ button.nomargin(@click="gotoPrevNext($event,curproblem,-1)")
+ | {{ st.tr["Next_p"] }}
+ p.oneInstructions.clickable(
+ v-html="parseHtml(curproblem.instruction)"
@click="curproblem.showSolution=!curproblem.showSolution"
)
| {{ st.tr["Show solution"] }}
@@ -65,13 +69,14 @@ main
.row(v-else)
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
#controls
- button#newProblem(onClick="doClick('modalNewprob')")
+ button#newProblem(@click="prepareNewProblem()")
| {{ st.tr["New problem"] }}
- label(for="checkboxMine") {{ st.tr["My problems"] }}
- input#checkboxMine(
- type="checkbox"
- v-model="onlyMines"
- )
+ div#myProblems(v-if="st.user.id > 0")
+ label(for="checkboxMine") {{ st.tr["My problems"] }}
+ input#checkboxMine(
+ type="checkbox"
+ v-model="onlyMine"
+ )
label(for="selectVariant") {{ st.tr["Variant"] }}
select#selectVariant(v-model="selectedVar")
option(
@@ -79,18 +84,29 @@ main
:value="v.id"
)
| {{ v.name }}
- table
+ table#tProblems
tr
th {{ st.tr["Variant"] }}
th {{ st.tr["Instructions"] }}
+ th {{ st.tr["Number"] }}
tr(
- v-for="p in problems"
- v-show="displayProblem(p)"
+ v-for="p in problems[onlyMine ? 'mine' : 'others']"
+ v-show="onlyMine || !selectedVar || p.vid == selectedVar"
@click="setHrefPid(p)"
)
td {{ p.vname }}
- td(v-html="p.instruction")
- BaseGame(v-if="showOne" :game="game" :vr="vr")
+ td {{ firstChars(p.instruction) }}
+ td {{ p.id }}
+ button#loadMoreBtn(
+ v-if="hasMore[onlyMine ? 'mine' : 'others']"
+ @click="loadMore(onlyMine ? 'mine' : 'others')"
+ )
+ | {{ st.tr["Load more"] }}
+ BaseGame(
+ ref="basegame"
+ v-if="showOne"
+ :game="game"
+ )
@@ -323,26 +445,52 @@ export default {
[type="checkbox"].modal+div .card
max-width: 767px
max-height: 100%
+
#inputFen
width: 100%
+
textarea
width: 100%
+
#diagram
margin: 0 auto
max-width: 400px
+
+table#tProblems
+ max-height: 100%
+
+button#loadMoreBtn
+ display: block
+ margin: 0 auto
+
#controls
margin: 0
width: 100%
text-align: center
& > *
margin: 0
+
+p.oneInstructions
+ margin: 0
+ padding: 2px 5px
+ background-color: lightgreen
+
+#myProblems
+ display: inline-block
+
#topPage
- span
+ span.vname
font-weight: bold
+ padding-left: var(--universal-margin)
+ span.uname
+ padding-left: var(--universal-margin)
margin: 0 auto
& > .nomargin
margin: 0
& > .marginleft
margin: 0 0 0 15px
+@media screen and (max-width: 767px)
+ #topPage
+ text-align: center