-
Notifications
You must be signed in to change notification settings - Fork 1
/
attendance-bug.eve
111 lines (80 loc) · 3.29 KB
/
attendance-bug.eve
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Attendance Bug
This is a simple webapp with an equally simple issue: When navigated to the "attendance" page, nothing shows up! It provides a playground for using the inspector (the magic wand button in the top right of the editor). By clicking the inspect button and then anything in the IDE, Eve will tell you what it knows about your target. From there, it works with you to understand both what was intended and what's actually happening. The inspector is still in its infancy, so the UX is pretty rough. Any and all feedback is welcome on the [mailing list](https://groups.google.com/forum/#!forum/eve-talk).
### Setup
Create some students, teachers, syllabi, and schools.
~~~
commit
middlington = [#school name: "Middlington Jr. High"]
[#student name: "John" school: middlington class: 1 grade: 85 absences: 1]
[#student name: "Beth" school: middlington class: 1 grade: 78 absences: 4]
[#student name: "Jorge" school: middlington class: 2 grade: 92 absences: 1]
[#student name: "Rin" school: middlington class: 1 grade: 91 absences: 0]
user = [#teacher name: "George" school: middlington class: 1]
[#teacher name: "Alice" school: middlington class: 2]
[#syllabus name: "Intro to Introductory Courses" class: 1 | assignment: ("homework 1", "homework 2", "quiz 1", "finals")]
[#syllabus name: "Advanced Rocket Surgery" class: 2 | assignment: ("self study", "group project", "finals")]
[#app page: "grades" user]
~~~
### Events
When a `#nav` button is clicked, update the app's current page.
~~~
search @event
[#click #direct-target element]
search @browser
element = [#button #nav app text: page]
commit
app.page := page
~~~
### Drawing
Draw the page template. The specific page will be drawn into `#content` later on.
~~~
search
app = [#app]
bind @browser
app <- [#div children:
[#div style: [margin-bottom: 20] children:
[#button #nav app text: "grades"]
[#button #nav app text: "syllabus"]
[#button #nav app text: "attendance"]]
[#div #content app style: [min-height: 500] sort: 2]]
~~~
### Pages
When the page is "grades", show the student's grades for the current teacher.
~~~
search
app = [#app page: "grades" user: teacher]
student = [#student name school: teacher.school class: teacher.class grade]
ix = sort[value: name]
search @browser
content = [#content app]
bind @browser
content <- [children:
[#header sort: 0 text: "Grades for {{teacher.name}}'s class"]
[#div sort: ix text: "{{name}}'s grade is {{grade}}"]]
~~~
When the page is "syllabus", show the syllabus for the current teacher's class.
~~~
search
app = [#app page: "syllabus" user: teacher]
syllabus = [#syllabus class: teacher.class assignment]
search @browser
content = [#content app]
bind @browser
content <- [children:
[#header sort: 0 text: "Syllabus for {{syllabus.name}}"]
[#div text: assignment]]
~~~
When the page is "attendance", show each student's number of absences.
~~~
search
app = [#app page: "attendance" user: teacher]
teacher.school = [#school name]
student = [#student name school: teacher.school class: teacher.class grade]
ix = sort[value: name]
search @browser
content = [#content app]
bind @browser
content <- [children:
[#header sort: 0 text: "Attendance for {{name}}"]
[#div sort: ix text: "{{name}}'s grade is {{grade}}"]]
~~~