Changeset 29734
- Timestamp:
- 02/09/09 02:15:19 (4 years ago)
- Location:
- lang/ruby/scaflute
- Files:
-
- 6 added
- 3 modified
-
result/html (added)
-
result/java (added)
-
scaflute.rb (modified) (1 diff)
-
templates/confirm.erb (added)
-
templates/confirm_page.erb (added)
-
templates/edit.erb (added)
-
templates/edit_page.erb (added)
-
templates/list.erb (modified) (4 diffs)
-
templates/list_page.erb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/scaflute/scaflute.rb
r29702 r29734 10 10 tables.each() do |table| 11 11 $table = table 12 ERB.exec_file('templates/list.erb', "result/#{table.javaProperty}List.html") 13 ERB.exec_file('templates/list_page.erb', "result/#{table.javaClass}ListPage.java") 12 ERB.exec_file('templates/list.erb', "result/html/#{table.javaProperty}List.html") 13 ERB.exec_file('templates/list_page.erb', "result/java/#{table.javaClass}ListPage.java") 14 ERB.exec_file('templates/edit.erb', "result/html/#{table.javaProperty}Edit.html") 15 ERB.exec_file('templates/edit_page.erb', "result/java/#{table.javaClass}EditPage.java") 16 ERB.exec_file('templates/confirm.erb', "result/html/#{table.javaProperty}Confirm.html") 17 ERB.exec_file('templates/confirm_page.erb', "result/java/#{table.javaClass}ConfirmPage.java") 14 18 end 15 19 end -
lang/ruby/scaflute/templates/list.erb
r29702 r29734 6 6 </head> 7 7 <body> 8 <span id="messages"></span> 9 8 10 <form id="<%= table.javaProperty %>SearchForm"> 9 11 <table> … … 14 16 <td><label id="<%= id %>Label-search" for="<%= id %>Search"><%= id %></label></td> 15 17 <td><input type="text" id="<%= id %>Search" maxlength="<%= column.htmlMaxLength %>"/></td> 18 <td><span id="<%= id %>SearchMessage"></span></td> 16 19 </tr> 17 20 <%- end -%> … … 19 22 </table> 20 23 <input type="button" id="doSearch" value="Search"/> 24 </form> 25 26 <form id="<%= table.javaProperty %>CreateForm"> 27 <input type="button" id="go<%= table.javaClass %>Edit" value="Create"/> 21 28 </form> 22 29 … … 37 44 <td><span id="<%= id %>" te:omittag="true"><%= id %></span></td> 38 45 <%- end -%> 46 <td> 47 <input type="button" id="doView" value="View"/> 48 <input type="button" id="doEdit" value="Edit"/> 49 <input type="button" id="doDelete" value="Delete"/> 50 </td> 39 51 </tr> 40 52 </tbody> -
lang/ruby/scaflute/templates/list_page.erb
r29702 r29734 5 5 6 6 <%- table.columns.each() do |column| -%> 7 public <%= column.javaType %> <%= column.javaProperty %>Search; 8 <%- end -%> 9 10 <%- table.columns.each() do |column| -%> 7 11 public <%= column.javaType %> <%= column.javaProperty %>; 8 public <%= column.javaType %> <%= column.javaProperty %>Search;9 12 <%- end -%> 10 13 … … 46 49 } 47 50 51 public Class<?> doView() { 52 if (!isValidIndex()) { 53 return null; 54 } 55 initPrimaryKey(); 56 return <%= table.javaClass %>ConfirmPage.class; 57 } 58 59 public Class<?> doEdit() { 60 if (!isValidIndex()) { 61 return null; 62 } 63 initPrimaryKey(); 64 return <%= table.javaClass %>EditPage.class; 65 } 66 67 public Class<?> doDelete() { 68 if (!isValidIndex()) { 69 return null; 70 } 71 initPrimaryKey(); 72 return <%= table.javaClass %>ConfirmPage.class; 73 } 74 75 private void initPrimaryKey() { 76 <%- table.columns.each() do |column| -%> 77 <%- if column.primaryKey -%> 78 <%= column.javaProperty %> = <%= table.javaProperty %>Items.get(<%= table.javaProperty %>Index).get<%= column.javaProperty.upcase_first() %>(); 79 <%- end -%> 80 <%- end -%> 81 } 82 48 83 public void doPrev() { 49 84 if (pageNumber <= 1) { … … 60 95 } 61 96 97 private boolean isValidIndex() { 98 if (<%= table.javaProperty %>Items == null || <%= table.javaProperty %>Items.isEmpty()) { 99 return false; 100 } 101 return (0 <= <%= table.javaProperty %>Index && <%= table.javaProperty %>Index < <%= table.javaProperty %>Items.size()); 102 } 103 62 104 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)