somatics3-generators 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +60 -0
  6. data/VERSION +1 -0
  7. data/bin/somatics +21 -0
  8. data/bin/somatify +21 -0
  9. data/lib/generators/somatics/authenticated/authenticated_generator.rb +220 -0
  10. data/lib/generators/somatics/authenticated/templates/mailer.rb +25 -0
  11. data/lib/generators/somatics/authenticated/templates/migration.rb +26 -0
  12. data/lib/generators/somatics/authenticated/templates/model.rb +83 -0
  13. data/lib/generators/somatics/authenticated/templates/observer.rb +11 -0
  14. data/lib/generators/somatics/authenticated/templates/test/mailer_test.rb +31 -0
  15. data/lib/generators/somatics/authenticated/templates/test/model_functional_test.rb +93 -0
  16. data/lib/generators/somatics/authenticated/templates/test/sessions_functional_test.rb +82 -0
  17. data/lib/generators/somatics/authenticated/templates/test/unit_test.rb +164 -0
  18. data/lib/generators/somatics/authenticated/templates/test/users.yml +60 -0
  19. data/lib/generators/somatics/authenticated_controller/authenticated_controller_generator.rb +323 -0
  20. data/lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb +8 -0
  21. data/lib/generators/somatics/authenticated_controller/templates/activation.erb +3 -0
  22. data/lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb +189 -0
  23. data/lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb +10 -0
  24. data/lib/generators/somatics/authenticated_controller/templates/config/initializers/site_keys.rb +38 -0
  25. data/lib/generators/somatics/authenticated_controller/templates/controller.rb +55 -0
  26. data/lib/generators/somatics/authenticated_controller/templates/helper.rb +91 -0
  27. data/lib/generators/somatics/authenticated_controller/templates/login.html.erb +29 -0
  28. data/lib/generators/somatics/authenticated_controller/templates/mailer.rb +25 -0
  29. data/lib/generators/somatics/authenticated_controller/templates/migration.rb +26 -0
  30. data/lib/generators/somatics/authenticated_controller/templates/model.rb +83 -0
  31. data/lib/generators/somatics/authenticated_controller/templates/observer.rb +11 -0
  32. data/lib/generators/somatics/authenticated_controller/templates/session_helper.rb +2 -0
  33. data/lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb +43 -0
  34. data/lib/generators/somatics/authenticated_controller/templates/signup.html.erb +19 -0
  35. data/lib/generators/somatics/authenticated_controller/templates/signup_notification.erb +8 -0
  36. data/lib/generators/somatics/authenticated_controller/templates/test/mailer_test.rb +31 -0
  37. data/lib/generators/somatics/authenticated_controller/templates/test/model_functional_test.rb +93 -0
  38. data/lib/generators/somatics/authenticated_controller/templates/test/sessions_functional_test.rb +82 -0
  39. data/lib/generators/somatics/authenticated_controller/templates/test/unit_test.rb +164 -0
  40. data/lib/generators/somatics/authenticated_controller/templates/test/users.yml +60 -0
  41. data/lib/generators/somatics/helper/helper_generator.rb +16 -0
  42. data/lib/generators/somatics/install/install_generator.rb +65 -0
  43. data/lib/generators/somatics/install/templates/config/locales/somatics_en.yml +33 -0
  44. data/lib/generators/somatics/install/templates/config/locales/somatics_zh-TW.yml +33 -0
  45. data/lib/generators/somatics/install/templates/controller_admin.rb +16 -0
  46. data/lib/generators/somatics/install/templates/controller_home.rb +4 -0
  47. data/lib/generators/somatics/install/templates/helper_admin.rb +68 -0
  48. data/lib/generators/somatics/install/templates/layout_admin.html.erb +88 -0
  49. data/lib/generators/somatics/install/templates/lib/somatic_link_renderer.rb +42 -0
  50. data/lib/generators/somatics/install/templates/partial_menu.html.erb +1 -0
  51. data/lib/generators/somatics/install/templates/public/images/somatics/add.png +0 -0
  52. data/lib/generators/somatics/install/templates/public/images/somatics/arrow_collapsed.png +0 -0
  53. data/lib/generators/somatics/install/templates/public/images/somatics/arrow_expanded.png +0 -0
  54. data/lib/generators/somatics/install/templates/public/images/somatics/attachment.png +0 -0
  55. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_arrow_left.png +0 -0
  56. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_arrow_right.png +0 -0
  57. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_diamond.png +0 -0
  58. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_end.png +0 -0
  59. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_go.png +0 -0
  60. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_toggle_minus.png +0 -0
  61. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_toggle_plus.png +0 -0
  62. data/lib/generators/somatics/install/templates/public/images/somatics/c.png +0 -0
  63. data/lib/generators/somatics/install/templates/public/images/somatics/cancel.png +0 -0
  64. data/lib/generators/somatics/install/templates/public/images/somatics/changeset.png +0 -0
  65. data/lib/generators/somatics/install/templates/public/images/somatics/comment.png +0 -0
  66. data/lib/generators/somatics/install/templates/public/images/somatics/comments.png +0 -0
  67. data/lib/generators/somatics/install/templates/public/images/somatics/content-left.png +0 -0
  68. data/lib/generators/somatics/install/templates/public/images/somatics/content-right.png +0 -0
  69. data/lib/generators/somatics/install/templates/public/images/somatics/copy.png +0 -0
  70. data/lib/generators/somatics/install/templates/public/images/somatics/csharp.png +0 -0
  71. data/lib/generators/somatics/install/templates/public/images/somatics/database_key.png +0 -0
  72. data/lib/generators/somatics/install/templates/public/images/somatics/default.png +0 -0
  73. data/lib/generators/somatics/install/templates/public/images/somatics/delete.png +0 -0
  74. data/lib/generators/somatics/install/templates/public/images/somatics/document.png +0 -0
  75. data/lib/generators/somatics/install/templates/public/images/somatics/draft.png +0 -0
  76. data/lib/generators/somatics/install/templates/public/images/somatics/duplicate.png +0 -0
  77. data/lib/generators/somatics/install/templates/public/images/somatics/edit.png +0 -0
  78. data/lib/generators/somatics/install/templates/public/images/somatics/exclamation.png +0 -0
  79. data/lib/generators/somatics/install/templates/public/images/somatics/external.png +0 -0
  80. data/lib/generators/somatics/install/templates/public/images/somatics/fav.png +0 -0
  81. data/lib/generators/somatics/install/templates/public/images/somatics/fav_off.png +0 -0
  82. data/lib/generators/somatics/install/templates/public/images/somatics/feed.png +0 -0
  83. data/lib/generators/somatics/install/templates/public/images/somatics/folder.png +0 -0
  84. data/lib/generators/somatics/install/templates/public/images/somatics/folder_open.png +0 -0
  85. data/lib/generators/somatics/install/templates/public/images/somatics/footer-bg.png +0 -0
  86. data/lib/generators/somatics/install/templates/public/images/somatics/footer-left.png +0 -0
  87. data/lib/generators/somatics/install/templates/public/images/somatics/footer-right.png +0 -0
  88. data/lib/generators/somatics/install/templates/public/images/somatics/group.png +0 -0
  89. data/lib/generators/somatics/install/templates/public/images/somatics/help.png +0 -0
  90. data/lib/generators/somatics/install/templates/public/images/somatics/history.png +0 -0
  91. data/lib/generators/somatics/install/templates/public/images/somatics/image.png +0 -0
  92. data/lib/generators/somatics/install/templates/public/images/somatics/lightning.png +0 -0
  93. data/lib/generators/somatics/install/templates/public/images/somatics/link.png +0 -0
  94. data/lib/generators/somatics/install/templates/public/images/somatics/loading.gif +0 -0
  95. data/lib/generators/somatics/install/templates/public/images/somatics/locked.png +0 -0
  96. data/lib/generators/somatics/install/templates/public/images/somatics/message.png +0 -0
  97. data/lib/generators/somatics/install/templates/public/images/somatics/milestone.png +0 -0
  98. data/lib/generators/somatics/install/templates/public/images/somatics/move.png +0 -0
  99. data/lib/generators/somatics/install/templates/public/images/somatics/news.png +0 -0
  100. data/lib/generators/somatics/install/templates/public/images/somatics/openid-bg.gif +0 -0
  101. data/lib/generators/somatics/install/templates/public/images/somatics/package.png +0 -0
  102. data/lib/generators/somatics/install/templates/public/images/somatics/pdf.png +0 -0
  103. data/lib/generators/somatics/install/templates/public/images/somatics/php.png +0 -0
  104. data/lib/generators/somatics/install/templates/public/images/somatics/plugin.png +0 -0
  105. data/lib/generators/somatics/install/templates/public/images/somatics/projects.png +0 -0
  106. data/lib/generators/somatics/install/templates/public/images/somatics/rails.png +0 -0
  107. data/lib/generators/somatics/install/templates/public/images/somatics/reload.png +0 -0
  108. data/lib/generators/somatics/install/templates/public/images/somatics/report.png +0 -0
  109. data/lib/generators/somatics/install/templates/public/images/somatics/ruby.png +0 -0
  110. data/lib/generators/somatics/install/templates/public/images/somatics/save.png +0 -0
  111. data/lib/generators/somatics/install/templates/public/images/somatics/sort_asc.png +0 -0
  112. data/lib/generators/somatics/install/templates/public/images/somatics/sort_desc.png +0 -0
  113. data/lib/generators/somatics/install/templates/public/images/somatics/stats.png +0 -0
  114. data/lib/generators/somatics/install/templates/public/images/somatics/table_multiple.png +0 -0
  115. data/lib/generators/somatics/install/templates/public/images/somatics/task_done.png +0 -0
  116. data/lib/generators/somatics/install/templates/public/images/somatics/task_late.png +0 -0
  117. data/lib/generators/somatics/install/templates/public/images/somatics/task_parent_end.png +0 -0
  118. data/lib/generators/somatics/install/templates/public/images/somatics/task_todo.png +0 -0
  119. data/lib/generators/somatics/install/templates/public/images/somatics/text.png +0 -0
  120. data/lib/generators/somatics/install/templates/public/images/somatics/text_list_bullets.png +0 -0
  121. data/lib/generators/somatics/install/templates/public/images/somatics/textfield.png +0 -0
  122. data/lib/generators/somatics/install/templates/public/images/somatics/ticket.png +0 -0
  123. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_checked.png +0 -0
  124. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_edit.png +0 -0
  125. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_go.png +0 -0
  126. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_note.png +0 -0
  127. data/lib/generators/somatics/install/templates/public/images/somatics/time.png +0 -0
  128. data/lib/generators/somatics/install/templates/public/images/somatics/time_add.png +0 -0
  129. data/lib/generators/somatics/install/templates/public/images/somatics/toggle_check.png +0 -0
  130. data/lib/generators/somatics/install/templates/public/images/somatics/true.png +0 -0
  131. data/lib/generators/somatics/install/templates/public/images/somatics/unlock.png +0 -0
  132. data/lib/generators/somatics/install/templates/public/images/somatics/user.png +0 -0
  133. data/lib/generators/somatics/install/templates/public/images/somatics/warning.png +0 -0
  134. data/lib/generators/somatics/install/templates/public/images/somatics/wiki_edit.png +0 -0
  135. data/lib/generators/somatics/install/templates/public/images/somatics/xml.png +0 -0
  136. data/lib/generators/somatics/install/templates/public/images/somatics/zip.png +0 -0
  137. data/lib/generators/somatics/install/templates/public/images/somatics/zoom_in.png +0 -0
  138. data/lib/generators/somatics/install/templates/public/javascripts/somatics/base.js +231 -0
  139. data/lib/generators/somatics/install/templates/public/javascripts/somatics/context_menu.js +237 -0
  140. data/lib/generators/somatics/install/templates/public/javascripts/somatics/controls.js +965 -0
  141. data/lib/generators/somatics/install/templates/public/javascripts/somatics/dragdrop.js +974 -0
  142. data/lib/generators/somatics/install/templates/public/javascripts/somatics/effects.js +1123 -0
  143. data/lib/generators/somatics/install/templates/public/javascripts/somatics/prototype.js +6001 -0
  144. data/lib/generators/somatics/install/templates/public/javascripts/somatics/rails.js +175 -0
  145. data/lib/generators/somatics/install/templates/public/javascripts/somatics/select_list_move.js +82 -0
  146. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/base.css +948 -0
  147. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/context_menu.css +52 -0
  148. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/csshover.htc +122 -0
  149. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/jstoolbar.css +95 -0
  150. data/lib/generators/somatics/install/templates/view_index.html.erb +1 -0
  151. data/lib/generators/somatics/scaffold/scaffold_generator.rb +25 -0
  152. data/lib/generators/somatics/scaffold/templates/_form.html.erb +23 -0
  153. data/lib/generators/somatics/scaffold/templates/edit.html.erb +6 -0
  154. data/lib/generators/somatics/scaffold/templates/index.html.erb +27 -0
  155. data/lib/generators/somatics/scaffold/templates/new.html.erb +5 -0
  156. data/lib/generators/somatics/scaffold/templates/show.html.erb +12 -0
  157. data/lib/generators/somatics/scaffold_controller/USAGE +20 -0
  158. data/lib/generators/somatics/scaffold_controller/scaffold_controller_generator.rb +137 -0
  159. data/lib/generators/somatics/scaffold_controller/templates/builder_index.pdf.prawn +25 -0
  160. data/lib/generators/somatics/scaffold_controller/templates/builder_index.xls.builder +24 -0
  161. data/lib/generators/somatics/scaffold_controller/templates/builder_index.xml.builder +10 -0
  162. data/lib/generators/somatics/scaffold_controller/templates/controller.rb +140 -0
  163. data/lib/generators/somatics/scaffold_controller/templates/locales_en.yml +17 -0
  164. data/lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml +20 -0
  165. data/lib/generators/somatics/scaffold_controller/templates/partial_bulk.html.erb +12 -0
  166. data/lib/generators/somatics/scaffold_controller/templates/partial_edit.html.erb +7 -0
  167. data/lib/generators/somatics/scaffold_controller/templates/partial_form.html.erb +13 -0
  168. data/lib/generators/somatics/scaffold_controller/templates/partial_list.html.erb +42 -0
  169. data/lib/generators/somatics/scaffold_controller/templates/partial_menu.html.erb +1 -0
  170. data/lib/generators/somatics/scaffold_controller/templates/partial_show.html.erb +31 -0
  171. data/lib/generators/somatics/scaffold_controller/templates/view_edit.html.erb +24 -0
  172. data/lib/generators/somatics/scaffold_controller/templates/view_index.html.erb +28 -0
  173. data/lib/generators/somatics/scaffold_controller/templates/view_new.html.erb +14 -0
  174. data/lib/generators/somatics/scaffold_controller/templates/view_show.html.erb +24 -0
  175. data/lib/generators/somatics.rb +95 -0
  176. data/lib/somatics3-generators.rb +19 -0
  177. data/somatics3-generators.gemspec +223 -0
  178. data/templates/somatics.rb +128 -0
  179. data/test/helper.rb +10 -0
  180. data/test/test_somatics3-generators.rb +7 -0
  181. metadata +301 -0
@@ -0,0 +1,140 @@
1
+ class <%=namespace_class%>::<%= controller_class_name %>Controller < Admin::AdminController
2
+
3
+ # Redmine Filters
4
+ # available_filters :id, {:name => 'ID', :type => :integer, :order => 1}
5
+ <% attributes.each_with_index do |attribute, index| -%>
6
+ # available_filters :<%=attribute.name%>, {:name => '<%=attribute.name.humanize%>', :type => :<%=attribute.type%>, :order => <%=index%>}
7
+ <% end -%>
8
+
9
+ # default_filter :id
10
+ <% attributes.each do |attribute| -%>
11
+ # default_filter :<%=attribute.name%>
12
+ <% end %>
13
+
14
+ # GET /<%= plural_table_name %>
15
+ # GET /<%= plural_table_name %>.xml
16
+ def index
17
+ @fields = <%= attributes.collect {|attribute| attribute.name}.inspect %>
18
+ @headers = <%= attributes.collect {|attribute| attribute.name.humanize}.inspect %>
19
+ respond_to do |format|
20
+ format.html {
21
+ @<%= plural_table_name %> = <%= class_name %>.paginate(:page => params[:<%= plural_table_name %>_page], :conditions => query_statement, :order => (params[:<%= singular_name %>_sort].gsub('_reverse', ' DESC') unless params[:<%= singular_name %>_sort].blank?))
22
+ }
23
+ format.xml {
24
+ @<%= plural_table_name %> = <%= class_name %>.all(:conditions => query_statement)
25
+ }
26
+ format.csv {
27
+ @<%= plural_table_name %> = <%= class_name %>.all(:conditions => query_statement)
28
+ csv_string = FasterCSV.generate do |csv|
29
+ csv << @headers
30
+ @<%= plural_table_name %>.each do |<%= singular_name %>|
31
+ csv << @fields.collect { |f| <%= singular_name %>.send(f) }
32
+ end
33
+ end
34
+ send_data csv_string, :type => 'text/csv; charset=iso-8859-1; header=present',
35
+ :disposition => "attachment; filename=<%= plural_table_name %>.csv"
36
+ }
37
+ format.xls {
38
+ @<%= plural_table_name %> = <%= class_name %>.all(:conditions => query_statement)
39
+ render :xls => @<%= plural_table_name %>
40
+ }
41
+ format.pdf {
42
+ params[:fields] = @fields
43
+ @<%= plural_table_name %> = <%= class_name %>.all(:conditions => query_statement)
44
+ prawnto :prawn => {:text_options => { :wrap => :character }, :page_layout => :portrait }
45
+ }
46
+ end
47
+ end
48
+
49
+ # GET /<%= plural_table_name %>/1
50
+ # GET /<%= plural_table_name %>/1.xml
51
+ def show
52
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
53
+
54
+ respond_to do |format|
55
+ format.html # show.html.erb
56
+ format.xml { render :xml => @<%= file_name %> }
57
+ end
58
+ end
59
+
60
+ # GET /<%= plural_table_name %>/new
61
+ # GET /<%= plural_table_name %>/new.xml
62
+ def new
63
+ @<%= file_name %> = <%= class_name %>.new
64
+
65
+ respond_to do |format|
66
+ format.html # new.html.erb
67
+ format.xml { render :xml => @<%= file_name %> }
68
+ end
69
+ end
70
+
71
+ # GET /<%= plural_table_name %>/1/edit
72
+ def edit
73
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
74
+ end
75
+
76
+ # POST /<%= plural_table_name %>
77
+ # POST /<%= plural_table_name %>.xml
78
+ def create
79
+ @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
80
+
81
+ respond_to do |format|
82
+ if @<%= file_name %>.save
83
+ flash[:notice] = '<%= class_name %> was successfully created.'
84
+ format.html { redirect_to(params[:return_to] || [:admin,@<%= file_name %>]) }
85
+ format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
86
+ else
87
+ format.html { render :action => "new" }
88
+ format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
89
+ end
90
+ end
91
+ end
92
+
93
+ # PUT /<%= plural_table_name %>/1
94
+ # PUT /<%= plural_table_name %>/1.xml
95
+ def update
96
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
97
+
98
+ respond_to do |format|
99
+ if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
100
+ flash[:notice] = '<%= class_name %> was successfully updated.'
101
+ format.html { redirect_to([:admin,@<%= file_name %>]) }
102
+ format.xml { head :ok }
103
+ else
104
+ format.html { render :action => "edit" }
105
+ format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
106
+ end
107
+ end
108
+ end
109
+
110
+ # DELETE /<%= plural_table_name %>/1
111
+ # DELETE /<%= plural_table_name %>/1.xml
112
+ def destroy
113
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
114
+ @<%= file_name %>.destroy
115
+ flash[:notice] = '<%= class_name %> was successfully deleted.'
116
+ respond_to do |format|
117
+ format.html { redirect_to(admin_<%= plural_table_name %>_url) }
118
+ format.xml { head :ok }
119
+ end
120
+ end
121
+
122
+ # def bulk
123
+ # unless params[:ids].blank?
124
+ # <%= plural_table_name %> = <%= class_name %>.find(params[:ids])
125
+ # success = true
126
+ # params[:<%= file_name %>].delete_if {|k, v| v.blank?}
127
+ # <%= plural_table_name %>.each do |<%= file_name %>|
128
+ # success &&= <%= file_name %>.update_attributes(params[:<%= file_name %>])
129
+ # end
130
+ # success ? flash[:notice] = '<%= class_name.pluralize %> were successfully updated.' : flash[:error] = 'Bulk Update Failed.'
131
+ # else
132
+ # flash[:error] = 'No <%= class_name %> record is selected.'
133
+ # end
134
+ #
135
+ # respond_to do |format|
136
+ # format.html { redirect_to(admin_<%= plural_table_name %>_path) }
137
+ # format.xml { head :ok }
138
+ # end
139
+ # end
140
+ end
@@ -0,0 +1,17 @@
1
+ en:
2
+ activerecord:
3
+ models:
4
+ <%= singular_name %>: <%= singular_name.humanize %>
5
+ attributes:
6
+ <%= singular_name %>:
7
+ <% if options[:authenticated] -%>
8
+ login: Login
9
+ name: Name
10
+ email: Email
11
+ created_at: Created At
12
+ password: Password
13
+ password_confirmation: Password Confirmation
14
+ <% end -%>
15
+ <% attributes.each do |attribute| -%>
16
+ <%= attribute.name %>: <%= attribute.name.humanize %>
17
+ <% end -%>
@@ -0,0 +1,20 @@
1
+ <%-
2
+ require 'net/http'
3
+ require 'uri'
4
+ require 'json'
5
+ class GoogleTranslate
6
+ def self.t(text)
7
+ uri = URI.parse('http://ajax.googleapis.com/ajax/services/language/translate')
8
+ JSON.parse(Net::HTTP.post_form(uri, {"q" => text, "langpair" => "en|zh-TW", "v" => '1.0'}).body)['responseData']['translatedText'] rescue text.humanize
9
+ end
10
+ end
11
+ -%>
12
+ "zh-TW":
13
+ activerecord:
14
+ models:
15
+ <%= singular_name %>: <%= GoogleTranslate.t singular_name.humanize %>
16
+ attributes:
17
+ <%= singular_name %>:
18
+ <% attributes.each do |attribute| -%>
19
+ <%= attribute.name %>: <%= GoogleTranslate.t attribute.name.humanize %>
20
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ <h3><%%= "#{t('Bulk')} #{t('Update')}" %></h3>
2
+ <div class="issue">
3
+ <table width="100%">
4
+ <tbody>
5
+ <!-- <tr>
6
+ <td><b>Field</b></td>
7
+ <td><%%#= text_field_tag '<%= singular_name %>[field]' %></td>
8
+ </tr> -->
9
+ </tbody>
10
+ </table>
11
+ </div>
12
+ <%%= submit_tag("#{t('Bulk')} #{t('Update')}") %>
@@ -0,0 +1,7 @@
1
+ <%% form_for([:admin, @<%= singular_name %>]) do |f| %>
2
+ <div class="box tabular settings">
3
+ <%%= f.error_messages %>
4
+ <%%= render :partial => 'form' , :locals => {:f => f} %>
5
+ </div>
6
+ <%%= f.submit t('Update') %>
7
+ <%% end %>
@@ -0,0 +1,13 @@
1
+ <table width="100%">
2
+ <tbody>
3
+ <tr>
4
+ <td colspan="2"><br/><h3><%%= <%=class_name %>.human_name %></h3></td>
5
+ </tr>
6
+ <% for attribute in attributes -%>
7
+ <tr>
8
+ <td><b><%%= <%= class_name %>.human_attribute_name(:<%=attribute.name%>) %></b></td>
9
+ <td><%%= f.<%= attribute.field_type %> :<%= attribute.name %> %></td>
10
+ </tr>
11
+ <% end -%>
12
+ </tbody>
13
+ </table>
@@ -0,0 +1,42 @@
1
+ <table class="list issues">
2
+ <thead>
3
+ <tr>
4
+ <!-- <th><%%#= link_to image_tag('toggle_check.png', :alt => "Toggle_check"), admin_<%= plural_name %>_path, :onclick => "toggleIssuesSelection(Element.up(this, &quot;form&quot;)); return false;", :title => "Check all/Uncheck all" %></th> -->
5
+ <th title="Sort by &quot;#&quot;"><%%= sort_link_helper t('ID'), '<%=singular_name%>', 'id' %></th>
6
+ <% if options[:admin_authenticated] || options[:authenticated] -%>
7
+ <th title="Sort by &quot;Login&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:login), '<%=singular_name%>', 'login' %></th>
8
+ <th title="Sort by &quot;Name&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:name), '<%=singular_name%>', 'name' %></th>
9
+ <th title="Sort by &quot;Email&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:email), '<%=singular_name%>', 'email' %></th>
10
+ <th title="Sort by &quot;Created At&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:created_at), '<%=singular_name%>', 'created_at' %></th>
11
+ <% end -%>
12
+ <% for attribute in attributes -%>
13
+ <th title="Sort by &quot;<%= attribute.name.humanize %>&quot;"><%%= sort_link_helper <%= class_name %>.human_attribute_name(:<%= attribute.name %>), '<%=singular_name%>', '<%= attribute.name %>' %></th>
14
+ <% end -%>
15
+ <!-- More Sort Link Helper -->
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <%% unless <%= plural_name %>.empty? %>
20
+ <%% for <%= singular_name %> in <%= plural_name %> %>
21
+ <tr id="<%% dom_id(<%=singular_name%>)%>" class="hascontextmenu <%%= cycle 'odd' , 'even' %> issue">
22
+ <!-- <td class="checkbox"><input name="ids[]" type="checkbox" value="<%%#= <%=singular_name%>.id %>" /></td> -->
23
+ <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);"><%%= link_to <%= singular_name %>.id, [:admin, <%= singular_name %>]%></td>
24
+ <% if options[:admin_authenticated] || options[:authenticated] -%>
25
+ <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="login"><%%=h <%= singular_name %>.login %></td>
26
+ <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="name"><%%=h <%= singular_name %>.name %></td>
27
+ <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="email"><%%=h <%= singular_name %>.email %></td>
28
+ <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="created_at"><%%=h <%= singular_name %>.created_at %></td>
29
+ <% end -%>
30
+ <% for attribute in attributes -%>
31
+ <td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="<%= attribute.name %>"><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
32
+ <% end -%>
33
+ <!-- More Fields -->
34
+ </tr>
35
+ <%% end %>
36
+ <%% else -%>
37
+ <tr class="datos">
38
+ <td colspan="100" align="center"><%%=t :no_data_available%></td>
39
+ </tr>
40
+ <%% end -%>
41
+ </tbody>
42
+ </table>
@@ -0,0 +1 @@
1
+ <li><%%= link_to 'Home', '/admin', :class => (match_controller?("home")) ? 'selected' : ''%></li>
@@ -0,0 +1,31 @@
1
+ <table class="attributes" width="100%">
2
+ <tbody>
3
+ <tr>
4
+ <td colspan="2"><br/><h3><%%= "#{<%= class_name %>.human_name} #{t('Information')}" %></h3></td>
5
+ </tr>
6
+ <% if options[:admin_authenticated] || options[:authenticated] -%>
7
+ <tr>
8
+ <td><b><%%= <%= class_name %>.human_attribute_name(:login) %></b></td>
9
+ <td><%%=h <%= singular_name %>.login %></td>
10
+ </tr>
11
+ <tr>
12
+ <td><b><%%= <%= class_name %>.human_attribute_name(:name) %></b></td>
13
+ <td><%%=h <%= singular_name %>.name %></td>
14
+ </tr>
15
+ <tr>
16
+ <td><b><%%= <%= class_name %>.human_attribute_name(:email) %></b></td>
17
+ <td><%%=h <%= singular_name %>.email %></td>
18
+ </tr>
19
+ <tr>
20
+ <td><b><%%= <%= class_name %>.human_attribute_name(:created_at) %></b></td>
21
+ <td><%%=h <%= singular_name %>.created_at %></td>
22
+ </tr>
23
+ <% end -%>
24
+ <% for attribute in attributes -%>
25
+ <tr>
26
+ <td><b><%%= <%= class_name %>.human_attribute_name(:<%= attribute.name %>) %></b></td>
27
+ <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
28
+ </tr>
29
+ <% end -%>
30
+ </tbody>
31
+ </table>
@@ -0,0 +1,24 @@
1
+ <div class="contextual">
2
+ <%%= link_to t('Update'), edit_admin_<%= singular_name %>_path(@<%= singular_name %>), :accesskey => "e", :class => "icon icon-edit", :onclick => "showAndScrollTo('update','focus'); return false;"%>
3
+ <%%= link_to t('Delete'), [:admin,@<%= singular_name %>], :confirm => 'Are you sure?', :method => :delete ,:class => 'icon icon-del' %>
4
+ </div>
5
+
6
+ <h2><%%= "#{<%= class_name %>.human_name} ##{@<%= singular_name %>.id}" %></h2>
7
+
8
+ <div class="issue details">
9
+ <%%= render :partial => 'show' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
10
+ </div>
11
+
12
+ <!-- More List View -->
13
+
14
+ <div id="update">
15
+ <h3><%%= t('Update') %></h3>
16
+ <div id="focus"></div>
17
+ <%%= render :partial => 'edit' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
18
+ </div>
19
+ <div style="clear: both;"></div>
20
+
21
+ <%% content_for :sidebar do %>
22
+ <h3>Actions</h3>
23
+ <%%= link_to "#{t('Back_to')} #{<%= class_name %>.human_name}", admin_<%= plural_name %>_path %>
24
+ <%% end %>
@@ -0,0 +1,28 @@
1
+ <div class="contextual"></div>
2
+
3
+ <h2><%%= <%= class_name %>.human_name %></h2>
4
+
5
+ <!-- Redmine Filters-->
6
+ <%%#= filters %>
7
+
8
+ <%%# form_tag bulk_admin_<%= plural_name %>_path, :id => :form do -%>
9
+ <div class="autoscroll">
10
+ <%%= render :partial => 'list', :locals => {:<%= plural_name %> => @<%= plural_name %>} %>
11
+ </div>
12
+ <%%= will_paginate @<%= plural_name%>, :renderer => SomaticLinkRenderer %>
13
+
14
+ <%%#= render :partial => 'bulk' %>
15
+ <%%# end %>
16
+
17
+ <!-- TODO Export-->
18
+ <p class="other-formats"><%%= t('Also_available_in') %>:
19
+ <span><%%= link_to 'CSV', admin_<%= plural_name %>_path(:format => :csv), :class => 'csv' %></span>
20
+ <span><%%= link_to 'XLS', admin_<%= plural_name %>_path(:format => :xls), :class => 'xls' %></span>
21
+ <span><%%= link_to 'PDF', admin_<%= plural_name %>_path(:format => :pdf), :class => 'pdf' %></span>
22
+ </p>
23
+ <div style="clear:both;"></div>
24
+
25
+ <%% content_for :sidebar do %>
26
+ <h3>Actions</h3>
27
+ <%%= link_to "#{t('new')} #{<%= class_name %>.human_name}", new_admin_<%= singular_name %>_path %>
28
+ <%% end %>
@@ -0,0 +1,14 @@
1
+ <h2><%%= "#{t('New')} #{<%= class_name %>.human_name}" %></h2>
2
+ <%% form_for([:admin, @<%= singular_name %>]) do |f| %>
3
+ <%%= f.error_messages %>
4
+ <div class="issue">
5
+ <%%= render :partial => 'form' , :locals => {:f => f} %>
6
+ </div>
7
+ <%%= f.submit t('Create') %>
8
+ <%% end %>
9
+ <%%= link_to t('Back'), admin_<%= plural_name %>_path %>
10
+
11
+ <%% content_for :sidebar do %>
12
+ <h3>Actions</h3>
13
+ <%%= link_to "#{t('Back_to')} #{<%= class_name %>.human_name}", admin_<%= plural_name %>_path %>
14
+ <%% end %>
@@ -0,0 +1,24 @@
1
+ <div class="contextual">
2
+ <%%= link_to t('Update'), edit_admin_<%= singular_name %>_path(@<%= singular_name %>), :accesskey => "e", :class => "icon icon-edit", :onclick => "showAndScrollTo('update','focus'); return false;"%>
3
+ <%%= link_to t('Delete'), [:admin,@<%= singular_name %>], :confirm => 'Are you sure?', :method => :delete ,:class => 'icon icon-del' %>
4
+ </div>
5
+
6
+ <h2><%%= "#{<%= class_name %>.human_name} ##{@<%= singular_name %>.id}" %></h2>
7
+
8
+ <div class="issue details">
9
+ <%%= render :partial => 'show' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
10
+ </div>
11
+
12
+ <!-- More List View -->
13
+
14
+ <div id="update" style="display:none;">
15
+ <h3><%%= t('Update') %></h3>
16
+ <div id="focus"></div>
17
+ <%%= render :partial => 'edit' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
18
+ </div>
19
+ <div style="clear: both;"></div>
20
+
21
+ <%% content_for :sidebar do %>
22
+ <h3>Actions</h3>
23
+ <%%= link_to "#{t('Back_to')} #{<%= class_name %>.human_name}", admin_<%= plural_name %>_path %>
24
+ <%% end %>
@@ -0,0 +1,95 @@
1
+ require 'rails/generators/named_base'
2
+
3
+ module Somatics
4
+ module Generators
5
+ module TemplatePath
6
+ def source_root
7
+ @_somaitcs_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'somatics', generator_name, 'templates'))
8
+ end
9
+ end
10
+
11
+ module SomaticsHelpers
12
+ def self.included(base) #:nodoc:
13
+ base.class_option :namespace, :banner => "NAME", :type => :string, :required => false, :default => "admin",
14
+ :desc => "namespace to generate the controller for"
15
+ end
16
+ end
17
+
18
+ # class AssetsGenerator < Rails::Generators::Base
19
+ #
20
+ # # include Rails::Generators::Migration
21
+ #
22
+ # # source_root File.expand_path("../../templates", __FILE__)
23
+ #
24
+ # namespace "somatics"
25
+ #
26
+ # class_option :admin_title, :default => Rails.root.basename
27
+ #
28
+ # def generate_initializer
29
+ # # template "config/initializers/somatics.rb", "config/initializers/somatics.rb"
30
+ # # template "config/initializers/somatics_resources.rb", "config/initializers/somatics_resources.rb"
31
+ # end
32
+ #
33
+ # def copy_assets
34
+ # # templates_path = File.expand_path("../../templates", __FILE__)
35
+ # # Dir["#{templates_path}/public/**/*.*"].each do |file|
36
+ # # copy_file file.split("#{templates_path}/").last
37
+ # # end
38
+ # end
39
+ #
40
+ # #--
41
+ # # Generate files for models:
42
+ # # `#{controllers_path}/#{resource}_controller.rb`
43
+ # # `#{tests_path}/#{resource}_controller_test.rb`
44
+ # #++
45
+ # def generate_controllers
46
+ # # Somatics.application_models.each do |model|
47
+ # # klass = model.constantize
48
+ # # @resource = klass.name.pluralize
49
+ # # template "controller.rb", "#{controllers_path}/#{klass.to_resource}_controller.rb"
50
+ # # template "functional_test.rb", "#{tests_path}/#{klass.to_resource}_controller_test.rb"
51
+ # # end
52
+ # end
53
+ #
54
+ # def generate_config
55
+ # # configuration = generate_yaml_files
56
+ # # unless configuration[:base].empty?
57
+ # # %w( application.yml application_roles.yml ).each do |file|
58
+ # # from = to = "config/typus/#{file}"
59
+ # # if File.exists?(from) then to = "config/typus/#{timestamp}_#{file}" end
60
+ # # @configuration = configuration
61
+ # # template from, to
62
+ # # end
63
+ # # end
64
+ # end
65
+ #
66
+ # protected
67
+ #
68
+ # end
69
+
70
+ # class Base < Rails::Generators::NamedBase
71
+ # # include Rails::Generators::ResourceHelpers
72
+ #
73
+ # def self.source_root
74
+ # @_somatics_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'somatics', generator_name, 'templates'))
75
+ # end
76
+ # protected
77
+ #
78
+ # def format
79
+ # :html
80
+ # end
81
+ #
82
+ # def handler
83
+ # :erb
84
+ # end
85
+ #
86
+ # def filename_with_extensions(name)
87
+ # [name, format, handler].compact.join(".")
88
+ # end
89
+ #
90
+ # def template_filename_with_extensions(name)
91
+ # [name, format, handler, :erb].compact.join(".")
92
+ # end
93
+ # end
94
+ end
95
+ end
@@ -0,0 +1,19 @@
1
+ require 'rails/generators'
2
+
3
+ module Somatics3Generators
4
+ end
5
+
6
+ Rails::Generators.hidden_namespaces << "rails"
7
+
8
+ %w(somatics).each do |template|
9
+ Rails::Generators.hidden_namespaces <<
10
+ [
11
+ # "#{template}:controller",
12
+ # "#{template}:scaffold",
13
+ # "#{template}:scaffold_controller"
14
+ "#{template}:assets",
15
+ "#{template}:helper"
16
+ ]
17
+ end
18
+
19
+ Rails::Generators.hidden_namespaces.flatten!