-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.mipage
59 lines (50 loc) · 2.39 KB
/
index.mipage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
:class index : MiPage
⍝ Leitner-methode: https://de.wikipedia.org/wiki/Lernkartei bzw. https://en.wikipedia.org/wiki/Flashcard ( https://de.wikipedia.org/wiki/Sebastian_Leitner )
∇ Compose
:Access public
Use'Bootstrap4'
'class'Body.Set'bg-dark text-white'
prj←⎕NEW #.lBox(#.Boot.AppRoot,'Data/norw-fw.json')
d←Add _.div
'id=titel class=titel .text-center'd.Add _.div'FRAPL''s Leitnerbox'
task←'.w-100 .text-center'Add _.div
'#status .mt-2 .mb-4 style=font-size:1.4em;'task.Add _.div StatusInfo
'#w1 .alert .alert-dark .font-weight-bold .w-100 .text-center'task.Add _.div(1⊃prj.Lesson.GetWord)
'#translate accesskey=S .btn .btn-primary .mt-3 .mb-3'('class="text-center"'task.Add _.div).Add _.button'(S)how translation'
trans←'#trans style=display:none; .mx-auto .w-100 .text-center'Add _.div
'#w2 .alert .alert .alert-info .font-weight-bold .w-100 .text-center'trans.Add _.div(2⊃prj.Lesson.GetWord)
'#ok accesskey=C .btn .btn-success .mr-2'trans.Add _.button((New _.Icon'fas-check-circle'),New _.span' (C)orrect')
'#fail accesskey=N .btn .btn-danger .ml-2'trans.Add _.button((New _.Icon'fas-thumbs-down'),New _.span' Did (n)ot know')
Add _.Handler'button' 'click' 'ClickedButton'
∇
∇ R←ClickedButton
:Access public
R←''
:Select _currentTarget
:Case 'translate'
R←Execute'$("#trans").show();'
R,←Execute'$("#translate").prop("disabled", true);'
:CaseList 'ok' 'fail'
prj.Lesson.Tested _currentTarget≡'ok'
R,←'#status'Replace(renderIt StatusInfo)
:If prj.Lesson.Done
R,←Execute'$("#w1").hide();'
R,←'#trans'Replace(New _.p('Lesson ended, Data saved!'))
prj.data.progress+←1
prj.saveData
:Else
R,←Execute'$("#trans").hide();'
R,←'#w1'Replace(1⊃prj.Lesson.GetWord)
R,←'#w2'Replace(2⊃prj.Lesson.GetWord)
R,←Execute'$("#translate").prop("disabled", false);'
:EndIf
:Else
⎕←'_currentTarget=',_currentTarget
∘∘∘
:EndSelect
∇
∇ R←StatusInfo
si←prj.SectionInfo
R←(si[1]=¯1+⍳≢2⊃si){New _.span(⍕⍵)('.mr-1 .badge .badge-pill .badge-',(1+⍺)⊃'info' 'light')}¨2⊃si
∇
:endclass