]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/furnace-onigiri/templates/entry-edit.furnace
d112ac531dae7764c5ff8cd1003b75adfcf804db
[factor.git] / unmaintained / furnace-onigiri / templates / entry-edit.furnace
1 <% USING: namespaces io kernel sequences furnace:onigiri html 
2 furnace ; %>
3
4 <script type="text/javascript">
5 function transformWiky() {
6   var wiky = $('wiky').value;
7   var html = Wiky.toHtml(wiky);
8   $('html').value = html;
9   $('preview').innerHTML = html;
10 }
11 function transformHtml() {
12   var html = $('preview').innerHTML;
13   var wiky = Wiky.toWiki(html);
14   $('wiky').value = wiky;
15   $('html').value = html;
16 }
17 </script>
18
19 <p><% "stub" get [ f entry-edit ] curry "Edit in non-Wiky editor" render-link %></p>
20
21 <form method="post" action="entry-update">
22     <% "stub" get [ %><input type="hidden" name="stub" value="<% "stub" get write %>"/><% ] when %>
23     <table><tr><td>Title:</td><td><input type="text" name="title" value="<% "title" get write %>"/></td></tr>
24     <tr><td>Body:</td><td><textarea id="wiky" rows="10" cols="60" name="wiky" onkeyup="transformWiky();"></textarea></td></tr>
25     <tr><td></td><td><input type="submit" name="post" value="<% "stub" get "update" "post" ? write %>"/>
26     
27     <% "stub" get [  [ entry-delete ] curry "Delete" render-link ] when* %> 
28     (preview below)</td></tr>
29     <tr><td></td><td><input id="html" type="hidden" name="body" value=""/><div id="preview"><% "body" get [ write-html ] when* %></div></td></tr>
30     </table>
31 </form>
32 <script type="text/javascript">
33 transformHtml();  
34 </script>