Created
June 29, 2010 17:57
-
-
Save koduki/457554 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# edit.html | |
<body> | |
<header /> | |
<h1>Edit</h1> | |
<form> | |
<p id="l1"> | |
<label>部署</label> | |
<select> | |
<option>---</option> | |
</select> | |
</p> | |
<p id="l2"> | |
<label>グループ</label> | |
<select> | |
<option>---</option> | |
</select> | |
</p> | |
<ul id="people"> | |
<li> | |
<label>工大花子</label> | |
<select> | |
<option>-</option> | |
<option>○</option> | |
<option>×</option> | |
</select> | |
</li> | |
<li> | |
<label>工大太朗</label> | |
<text></text> | |
</li> | |
</ul> | |
<submit>登録する</submit> | |
</form> | |
<footer /> | |
</body> | |
# edit.view | |
val Attend = Text.clone{ | |
range "", "○", "×" | |
} | |
val l1 = (//form/#l1/select).replace(List.clone("-", findL1() )) | |
val l2 = (//form/#l2/select).replace(List.clone("-", findL2($(l1.selected) )) | |
val people = (//form/#people/li).replace(findPeople($l1.selected, $l2.selected).map{ person => | |
Item{ | |
name => Label.clone(person.name) | |
value => Attend.clone(Kintai.read(person.name)) | |
} | |
}) | |
header.replace(base_header.clone) | |
fotter.replace(base_footer.clone) | |
(//form/#submit).click(:async, update(people)) | |
def update list:List[Item[Label, Attend]] | |
list.each(x => Kintai.put(x.name.value, x.value.value)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment