X-Git-Url: https://git.auder.net/images/pieces/Cwda/bt.svg?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FProblems.vue;h=a62949c823bec860807d08c140e706ca00094cc9;hb=5f918a278904266a2a66a3c8e2a3655f37c2d2a7;hp=d3dfdfd2913c6a779616bec576054b393de3919c;hpb=2f258c37c19c5be20ec68695ddfaec2c21f7f0ae;p=vchess.git
diff --git a/client/src/views/Problems.vue b/client/src/views/Problems.vue
index d3dfdfd2..a62949c8 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"] }}
@@ -12,6 +18,7 @@ main
)
option(
v-for="v in [emptyVar].concat(st.variants)"
+ v-if="!v.noProblems"
:value="v.id"
:selected="curproblem.vid==v.id"
)
@@ -39,22 +46,19 @@ main
button(@click="sendProblem()") {{ st.tr["Send"] }}
#dialog.text-center {{ st.tr[infoMsg] }}
.row(v-if="showOne")
- .col-sm-12.col-md-10.col-md-offset-2
+ .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
#topPage
+ .button-group(v-if="canIedit(curproblem.uid)")
+ button(@click="editProblem(curproblem)") {{ st.tr["Edit"] }}
+ button(@click="deleteProblem(curproblem)") {{ st.tr["Delete"] }}
span.vname {{ curproblem.vname }}
- span.uname {{ "(" + curproblem.uname + ")" }}
+ 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(
+ button.nomargin(@click="gotoPrevNext(curproblem,1)")
+ | {{ st.tr["Previous_p"] }}
+ button.nomargin(@click="gotoPrevNext(curproblem,-1)")
+ | {{ st.tr["Next_p"] }}
+ p.oneInstructions.clickable(
v-html="parseHtml(curproblem.instruction)"
@click="curproblem.showSolution=!curproblem.showSolution"
)
@@ -66,34 +70,45 @@ 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(
v-for="v in [emptyVar].concat(st.variants)"
+ v-if="!v.noProblems"
: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 {{ firstChars(p.instruction) }}
td {{ p.id }}
- BaseGame(v-if="showOne" :game="game" :vr="vr")
+ 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"
+ )
@@ -344,13 +473,24 @@ 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%
@@ -358,6 +498,14 @@ textarea
& > *
margin: 0
+p.oneInstructions
+ margin: 0
+ padding: 2px 5px
+ background-color: lightgreen
+
+#myProblems
+ display: inline-block
+
#topPage
span.vname
font-weight: bold
@@ -373,5 +521,4 @@ textarea
@media screen and (max-width: 767px)
#topPage
text-align: center
-