X-Git-Url: https://git.auder.net/variants/Baroque/style.css?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FProblems.vue;h=a55126fa10c12c202360f4d1468fe56930e09584;hb=f0a812b7b11bc2a1514d2aa10ecc257d10d988d5;hp=e8e63f8fff5b125aea0cccb7bbfcbf957c914b2d;hpb=7e4a880ebd1ba36018620beb645f177de7094b58;p=vchess.git
diff --git a/client/src/views/Problems.vue b/client/src/views/Problems.vue
index e8e63f8f..a55126fa 100644
--- a/client/src/views/Problems.vue
+++ b/client/src/views/Problems.vue
@@ -1,8 +1,24 @@
main
- input#modalNewprob.modal(type="checkbox" @change="infoMsg=''")
- div#newprobDiv(role="dialog" data-checkbox="modalNewprob")
- .card(@keyup.enter="sendProblem()")
+ input#modalRules.modal(type="checkbox")
+ div#rulesDiv(
+ role="dialog"
+ data-checkbox="modalRules"
+ )
+ .card
+ label.modal-close(for="modalRules")
+ a#variantNameInProblems(:href="'/#/variants/'+game.vname")
+ | {{ game.vname }}
+ div(v-html="rulesContent")
+ 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,104 +28,122 @@ main
)
option(
v-for="v in [emptyVar].concat(st.variants)"
+ v-if="!v.noProblems"
:value="v.id"
:selected="curproblem.vid==v.id"
)
| {{ v.name }}
fieldset
- label(for="inputFen") FEN
input#inputFen(
type="text"
+ placeholder="FEN"
v-model="curproblem.fen"
@input="trySetDiagram(curproblem)"
)
- div(v-html="curproblem.diag")
+ #diagram(v-html="curproblem.diag")
fieldset
- textarea#instructions(
+ textarea.instructions-edit(
:placeholder="st.tr['Instructions']"
+ @input="adjustHeight('instructions')"
v-model="curproblem.instruction"
)
- p(v-html="parseHtml(curproblem.instruction)")
+ .instructions(v-html="parseHtml(curproblem.instruction)")
fieldset
- textarea#solution(
+ textarea.solution-edit(
:placeholder="st.tr['Solution']"
+ @input="adjustHeight('solution')"
v-model="curproblem.solution"
)
- p(v-html="parseHtml(curproblem.solution)")
+ .solution(v-html="parseHtml(curproblem.solution)")
button(@click="sendProblem()") {{ st.tr["Send"] }}
#dialog.text-center {{ st.tr[infoMsg] }}
- .row
- .col-sm-12
- button#newProblem(onClick="doClick('modalNewprob')")
- | {{ st.tr["New problem"] }}
.row(v-if="showOne")
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
- #actions
- button(@click="showOne=false") {{ st.tr["Back to list"] }}
- button(
- v-if="st.user.id == curproblem.uid"
- @click="editProblem(curproblem)"
- )
- | {{ st.tr["Edit"] }}
- button(
- v-if="st.user.id == curproblem.uid"
- @click="deleteProblem(curproblem)"
- )
- | {{ st.tr["Delete"] }}
- h4 {{ curproblem.vname }}
- p(v-html="parseHtml(curproblem.instruction)")
- h4(@click="curproblem.showSolution=!curproblem.showSolution")
+ #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 }})
+ button.marginleft(@click="backToList()") {{ st.tr["Back to list"] }}
+ button.nomargin(@click="gotoPrevNext(curproblem,1)")
+ | {{ st.tr["Previous_p"] }}
+ button.nomargin(@click="gotoPrevNext(curproblem,-1)")
+ | {{ st.tr["Next_p"] }}
+ .instructions.oneInstructions.clickable(
+ v-html="parseHtml(curproblem.instruction)"
+ @click="curproblem.showSolution=!curproblem.showSolution"
+ )
| {{ st.tr["Show solution"] }}
- p(
+ .solution(
v-show="curproblem.showSolution"
v-html="parseHtml(curproblem.solution)"
)
.row(v-else)
.col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
- label(for="checkboxMine") {{ st.tr["My problems"] }}
- input#checkboxMine(
- type="checkbox"
- v-model="onlyMines"
- )
- label(for="selectVariant") {{ st.tr["Variant"] }}
- select#selectVariant(v-model="selectedVar")
- option(
- v-for="v in [emptyVar].concat(st.variants)"
- :value="v.id"
+ #controls
+ button#newProblem(@click="prepareNewProblem()")
+ | {{ st.tr["New problem"] }}
+ 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#tProblems
+ tr
+ th {{ st.tr["Variant"] }}
+ th {{ st.tr["Instructions"] }}
+ th {{ st.tr["Number"] }}
+ tr(
+ v-for="p in problems[onlyMine ? 'mine' : 'others']"
+ v-show="onlyMine || !selectedVar || p.vid == selectedVar"
+ @click="setHrefPid(p)"
)
- | {{ v.name }}
- div(
- v-for="p in problems"
- v-show="displayProblem(p)"
- @click="showProblem(p)"
+ td {{ p.vname }}
+ td {{ firstChars(p.instruction) }}
+ td {{ p.id }}
+ button#loadMoreBtn(
+ v-if="hasMore[onlyMine ? 'mine' : 'others']"
+ @click="loadMore(onlyMine ? 'mine' : 'others')"
)
- h4 {{ p.vname }}
- p {{ p.fen }}
- p(v-html="p.instruction")
- BaseGame(v-if="showOne" :game="game" :vr="vr")
+ | {{ st.tr["Load more"] }}
+ BaseGame(
+ ref="basegame"
+ v-if="showOne"
+ :game="game"
+ )
+
+