somatics3-generators 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +9 -1
- data/VERSION +1 -1
- data/bin/somatics +0 -0
- data/bin/somatify +0 -0
- data/lib/generators/somatics/associated/associated_generator.rb +184 -0
- data/lib/generators/somatics/associated/templates/migration.rb +11 -0
- data/lib/generators/somatics/attributes/attributes_generator.rb +8 -5
- data/lib/generators/somatics/authenticated/authenticated_generator.rb +27 -195
- data/lib/generators/somatics/authenticated/templates/partial_form.html.erb +23 -0
- data/lib/generators/somatics/authenticated_controller/authenticated_controller_generator.rb +14 -299
- data/lib/generators/somatics/authenticated_controller/templates/locales_en.yml +6 -0
- data/lib/generators/somatics/authenticated_controller/templates/locales_zh-TW.yml +6 -0
- data/lib/generators/somatics/authenticated_controller/templates/login.html.erb +10 -8
- data/lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb +11 -43
- data/lib/generators/somatics/install/install_generator.rb +26 -3
- data/lib/generators/somatics/install/templates/config/locales/devise_zh-TW.yml +39 -0
- data/lib/generators/somatics/install/templates/controller_admin.rb +8 -4
- data/lib/generators/somatics/install/templates/helper_admin.rb +39 -3
- data/lib/generators/somatics/install/templates/initializer_paper_trail.rb +2 -0
- data/lib/generators/somatics/install/templates/layout_admin.html.erb +4 -4
- data/lib/generators/somatics/install/templates/lib/active_record/diff.rb +61 -0
- data/lib/generators/somatics/install/templates/lib/tasks/heroku.rake +30 -0
- data/lib/generators/somatics/install/templates/lib/tasks/svn.rake +47 -0
- data/lib/generators/somatics/install/templates/partial_versions.html.erb +56 -0
- data/lib/generators/somatics/install/templates/public/stylesheets/application.css +863 -0
- data/lib/generators/somatics/install/templates/public/stylesheets/somatics/base.css +3 -0
- data/lib/generators/somatics/install/templates/public/themes/default/stylesheets/application.css +951 -0
- data/lib/generators/somatics/install/templates/view_index.html.erb +46 -1
- data/lib/generators/somatics/scaffold/scaffold_generator.rb +0 -1
- data/lib/generators/somatics/scaffold_controller/scaffold_controller_generator.rb +31 -60
- data/lib/generators/somatics/scaffold_controller/templates/controller.rb +4 -21
- data/lib/generators/somatics/scaffold_controller/templates/view_index.html.erb +3 -4
- data/lib/generators/somatics/scaffold_controller/templates/view_show.html.erb +2 -0
- data/lib/generators/somatics/settings/settings_generator.rb +7 -3
- data/lib/generators/somatics/settings_controller/templates/controller.rb +4 -20
- data/lib/generators/somatics/settings_controller/templates/partial_form.html.erb +1 -1
- data/lib/generators/somatics/settings_controller/templates/view_index.html.erb +2 -2
- data/somatics3-generators.gemspec +28 -37
- data/templates/somatics.rb +76 -121
- metadata +70 -64
- data/lib/generators/somatics/authenticated/templates/mailer.rb +0 -25
- data/lib/generators/somatics/authenticated/templates/migration.rb +0 -26
- data/lib/generators/somatics/authenticated/templates/model.rb +0 -83
- data/lib/generators/somatics/authenticated/templates/observer.rb +0 -11
- data/lib/generators/somatics/authenticated/templates/test/mailer_test.rb +0 -31
- data/lib/generators/somatics/authenticated/templates/test/model_functional_test.rb +0 -93
- data/lib/generators/somatics/authenticated/templates/test/sessions_functional_test.rb +0 -82
- data/lib/generators/somatics/authenticated/templates/test/unit_test.rb +0 -164
- data/lib/generators/somatics/authenticated/templates/test/users.yml +0 -60
- data/lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb +0 -8
- data/lib/generators/somatics/authenticated_controller/templates/activation.erb +0 -3
- data/lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb +0 -189
- data/lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb +0 -10
- data/lib/generators/somatics/authenticated_controller/templates/config/initializers/site_keys.rb +0 -38
- data/lib/generators/somatics/authenticated_controller/templates/controller.rb +0 -55
- data/lib/generators/somatics/authenticated_controller/templates/helper.rb +0 -91
- data/lib/generators/somatics/authenticated_controller/templates/mailer.rb +0 -25
- data/lib/generators/somatics/authenticated_controller/templates/migration.rb +0 -26
- data/lib/generators/somatics/authenticated_controller/templates/model.rb +0 -83
- data/lib/generators/somatics/authenticated_controller/templates/observer.rb +0 -11
- data/lib/generators/somatics/authenticated_controller/templates/session_helper.rb +0 -2
- data/lib/generators/somatics/authenticated_controller/templates/signup.html.erb +0 -19
- data/lib/generators/somatics/authenticated_controller/templates/signup_notification.erb +0 -8
- data/lib/generators/somatics/authenticated_controller/templates/test/mailer_test.rb +0 -31
- data/lib/generators/somatics/authenticated_controller/templates/test/model_functional_test.rb +0 -93
- data/lib/generators/somatics/authenticated_controller/templates/test/sessions_functional_test.rb +0 -82
- data/lib/generators/somatics/authenticated_controller/templates/test/unit_test.rb +0 -164
- data/lib/generators/somatics/authenticated_controller/templates/test/users.yml +0 -60
- data/lib/generators/somatics/scaffold_controller/templates/builder_index.pdf.prawn +0 -25
- data/lib/generators/somatics/settings_controller/templates/builder_index.pdf.prawn +0 -25
- data/lib/generators/somatics/settings_controller/templates/model.rb +0 -54
@@ -1 +1,46 @@
|
|
1
|
-
<h2><%%= t('Overview') %></h2>
|
1
|
+
<h2><%%= t('Overview') %></h2>
|
2
|
+
<div id="activity">
|
3
|
+
<%% [Date.today, Date.yesterday, 2.days.ago.to_date].each do |day|%>
|
4
|
+
<h3><%%= date_to_words day %></h3>
|
5
|
+
<dl>
|
6
|
+
<%% (versions = Version.where(:created_at => day.beginning_of_day..day.end_of_day ).order('created_at desc')).each do |version|%>
|
7
|
+
<dt class="issue-closed me">
|
8
|
+
<img class="gravatar" alt="" width="24" height="24" src="http://www.gravatar.com/avatar/<%%=Digest::MD5::hexdigest((User.find(version.whodunnit.to_i).email rescue ''))%>?rating=PG&size=24">
|
9
|
+
<span class="time"><%%=version.created_at.to_s(:db)%></span>
|
10
|
+
<%% description = "" %>
|
11
|
+
<%% [:name,:title,:label].each do |d|
|
12
|
+
description = version.item.send(d) if version.item.respond_to? d
|
13
|
+
end
|
14
|
+
%>
|
15
|
+
<%%= link_to "#{version.item.class.model_name.human} ##{version.item.id} - #{description}", [:admin, version.item]%>
|
16
|
+
</dt>
|
17
|
+
<dd>
|
18
|
+
<span class="description">
|
19
|
+
<%% if version.event == 'create'%>
|
20
|
+
Initial Create
|
21
|
+
<%% else %>
|
22
|
+
<%% unless version.next.nil? %>
|
23
|
+
<%% version.reify.diff(version.next.reify).each do |t| %>
|
24
|
+
<%% unless t.first == :updated_at %>
|
25
|
+
<p>"<b><%%= t.first.to_s.humanize %></b>" was changed from "<b><%%= t.last.first.to_s rescue '' %></b>" to "<b><%%= t.last.last.to_s rescue '' %></b>"</p>
|
26
|
+
<%% end %>
|
27
|
+
<%% end rescue 'Undetermined Changes'%>
|
28
|
+
<%% else %>
|
29
|
+
<%% version.reify.diff(obj).each do |t| %>
|
30
|
+
<%% unless t.first == :updated_at %>
|
31
|
+
<p>"<b><%%= t.first.to_s.humanize %></b>" was changed from "<b><%%= t.last.first.to_s rescue '' %></b>" to "<b><%%= t.last.last.to_s rescue '' %></b>"</p>
|
32
|
+
<%% end %>
|
33
|
+
<%% end rescue 'Undetermined Changes'%>
|
34
|
+
<%% end %>
|
35
|
+
<%% end %></span>
|
36
|
+
<span class="author"><%%=User.find(version.whodunnit.to_i).name rescue 'Unknown'%></span>
|
37
|
+
</dd>
|
38
|
+
<%% end %>
|
39
|
+
<%% if versions.blank?%>
|
40
|
+
No Changes in <%%= day %>
|
41
|
+
<%% end %>
|
42
|
+
</dl>
|
43
|
+
<%% end %>
|
44
|
+
|
45
|
+
</div>
|
46
|
+
<div style="clear:both;"></div>
|
@@ -15,9 +15,10 @@ module Somatics
|
|
15
15
|
class_option :orm, :banner => "NAME", :type => :string, :required => true,
|
16
16
|
:desc => "ORM to generate the controller for"
|
17
17
|
class_option :namespace, :banner => "NAME", :type => :string, :required => false, :default => "admin", :desc => "namespace to generate the controller for"
|
18
|
-
class_option :header, :type => :boolean, :default =>
|
18
|
+
class_option :header, :type => :boolean, :default => true, :desc => "generate header menu tab"
|
19
19
|
class_option :locales, :type => :array, :banner => "LOCALE LOCALE", :default => %w( en zh-TW ),
|
20
20
|
:desc => "Supported Locales"
|
21
|
+
class_option :skip_auditing, :type => :boolean, :default => false, :desc => "Don't generate auditing information."
|
21
22
|
|
22
23
|
def create_controller_files
|
23
24
|
template 'controller.rb', File.join('app/controllers', options[:namespace], class_path, "#{controller_file_name}_controller.rb")
|
@@ -34,13 +35,14 @@ module Somatics
|
|
34
35
|
template "view_edit.html.erb", File.join('app/views',options[:namespace], class_path, controller_file_name, "edit.html.erb" )
|
35
36
|
template "builder_index.xml.builder", File.join('app/views',options[:namespace], class_path, controller_file_name, "index.xml.builder")
|
36
37
|
template "builder_index.xls.builder", File.join('app/views',options[:namespace], class_path, controller_file_name, "index.xls.builder")
|
37
|
-
template "builder_index.pdf.prawn", File.join('app/views',options[:namespace], class_path, controller_file_name, "index.pdf.prawn" )
|
38
38
|
end
|
39
39
|
|
40
40
|
def add_header_menu_tab
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
if options[:header]
|
42
|
+
look_for = "<li><%= link_to '#{file_name.humanize}', '/admin/#{controller_file_name}', :class => (match_controller?('#{controller_file_name}')) ? 'selected' : ''%>\n\t<ul class='sub'></ul></li>\n"
|
43
|
+
gsub_file File.join('app/views/admin/shared', "_menu.html.erb"), look_for, ''
|
44
|
+
append_file File.join('app/views/admin/shared', "_menu.html.erb"), look_for
|
45
|
+
end
|
44
46
|
end
|
45
47
|
|
46
48
|
def create_locales_files
|
@@ -59,6 +61,30 @@ module Somatics
|
|
59
61
|
route route_config
|
60
62
|
end
|
61
63
|
|
64
|
+
def inject_somatics_filters
|
65
|
+
filters = [" has_filter :id, :integer, :default => true\n", " has_filter :created_at, :date\n"]
|
66
|
+
filters |= attributes.collect do |attribute|
|
67
|
+
" has_filter :#{attribute.name}, :#{attribute.type}\n"
|
68
|
+
end
|
69
|
+
# FIXME The model generator removes the model.rb already
|
70
|
+
if File.exists?("app/models/#{singular_name}.rb")
|
71
|
+
inject_into_class "app/models/#{singular_name}.rb", class_name, filters.join('')
|
72
|
+
inject_into_class "app/models/#{singular_name}.rb", class_name,
|
73
|
+
<<-RUBY
|
74
|
+
# Somatics Filter (Reference: http://github.com/inspiresynergy/somatics_filter)
|
75
|
+
RUBY
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def inject_paper_trail
|
80
|
+
unless options[:skip_auditing]
|
81
|
+
# FIXME The model generator removes the model.rb already
|
82
|
+
if File.exists?("app/models/#{singular_name}.rb")
|
83
|
+
inject_into_class "app/models/#{singular_name}.rb", class_name, " has_paper_trail :ignore => [:updated_at]\n"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
62
88
|
# Test Cases
|
63
89
|
hook_for :test_framework, :as => :scaffold
|
64
90
|
|
@@ -77,61 +103,6 @@ module Somatics
|
|
77
103
|
# hook_for :helper, :as => :scaffold do |invoked|
|
78
104
|
# invoke invoked, [ controller_name ]
|
79
105
|
# end
|
80
|
-
|
81
|
-
# # Controller, helper, views, test and stylesheets directories.
|
82
|
-
# m.directory(File.join('app/models', class_path))
|
83
|
-
# m.directory(File.join('app/controllers', controller_class_path))
|
84
|
-
# m.directory(File.join('app/helpers', controller_class_path))
|
85
|
-
# m.directory(File.join('app/views', controller_class_path, controller_file_name))
|
86
|
-
# m.directory(File.join('app/views', controller_class_path, "shared"))
|
87
|
-
# m.directory(File.join('test/functional', controller_class_path))
|
88
|
-
# m.directory(File.join('test/unit', class_path))
|
89
|
-
# m.directory(File.join('test/unit/helpers', controller_class_path))
|
90
|
-
# m.directory(File.join('public/stylesheets', class_path))
|
91
|
-
# m.directory(File.join('public/javascripts', class_path))
|
92
|
-
#
|
93
|
-
# m.template 'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
|
94
|
-
# m.template 'helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb")
|
95
|
-
#
|
96
|
-
# # Views and Builders
|
97
|
-
# m.template "partial_form.html.erb", File.join('app/views', controller_class_path, controller_file_name, "_form.html.erb")
|
98
|
-
# m.template "partial_list.html.erb", File.join('app/views', controller_class_path, controller_file_name, "_list.html.erb")
|
99
|
-
# m.template "partial_show.html.erb", File.join('app/views', controller_class_path, controller_file_name, "_show.html.erb")
|
100
|
-
# m.template "partial_edit.html.erb", File.join('app/views', controller_class_path, controller_file_name, "_edit.html.erb")
|
101
|
-
# m.template "partial_bulk.html.erb", File.join('app/views', controller_class_path, controller_file_name, "_bulk.html.erb")
|
102
|
-
# m.template "view_index.html.erb", File.join('app/views', controller_class_path, controller_file_name, "index.html.erb")
|
103
|
-
# m.template "view_new.html.erb", File.join('app/views', controller_class_path, controller_file_name, "new.html.erb")
|
104
|
-
# m.template "view_show.html.erb", File.join('app/views', controller_class_path, controller_file_name, "show.html.erb")
|
105
|
-
# m.template "view_edit.html.erb", File.join('app/views', controller_class_path, controller_file_name, "edit.html.erb")
|
106
|
-
# m.template "builder_index.xml.builder", File.join('app/views', controller_class_path, controller_file_name, "index.xml.builder")
|
107
|
-
# m.template "builder_index.xls.builder", File.join('app/views', controller_class_path, controller_file_name, "index.xls.builder")
|
108
|
-
# m.template "builder_index.pdf.prawn", File.join('app/views', controller_class_path, controller_file_name, "index.pdf.prawn")
|
109
|
-
#
|
110
|
-
# # Locales templates
|
111
|
-
# %w( en zh-TW ).each do |locale|
|
112
|
-
# m.template "locales_#{locale}.yml", File.join('config/locales', "#{controller_file_name}_#{locale}.yml")
|
113
|
-
# end
|
114
|
-
#
|
115
|
-
# # Application, Layout and Stylesheet and Javascript.
|
116
|
-
# # m.template_without_destroy 'layout.html.erb', File.join('app/views/layouts', controller_class_path, "admin.html.erb"), :collision => :skip
|
117
|
-
# # m.template_without_destroy 'application_helper.rb', File.join('app/helpers', controller_class_path, "admin_helper.rb"), :collision => :skip
|
118
|
-
# # m.template_without_destroy 'partial_menu.html.erb', File.join('app/views', controller_class_path, "shared", "_menu.html.erb"), :collision => :skip
|
119
|
-
# m.header_menu(controller_file_name) unless options[:no_header_menu]
|
120
|
-
# # m.template_without_destroy 'context_menu.js', 'public/javascripts/context_menu.js', :collision => :skip
|
121
|
-
# # m.template_without_destroy 'select_list_move.js', 'public/javascripts/select_list_move.js', :collision => :skip
|
122
|
-
# # m.template('style.css', 'public/stylesheets/scaffold.css')
|
123
|
-
#
|
124
|
-
# m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
|
125
|
-
# m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
|
126
|
-
#
|
127
|
-
# m.admin_route_resources controller_file_name
|
128
|
-
#
|
129
|
-
# if options[:admin_authenticated] || options[:authenticated]
|
130
|
-
# generate_sessions_controller(m)
|
131
|
-
# else
|
132
|
-
# m.dependency 'model', [name] + @args, :collision => :skip
|
133
|
-
# end
|
134
|
-
|
135
106
|
end
|
136
107
|
end
|
137
108
|
end
|
@@ -1,16 +1,4 @@
|
|
1
1
|
class <%=namespace_class%>::<%= controller_class_name %>Controller < <%=namespace_class%>::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
2
|
# GET /<%= plural_table_name %>
|
15
3
|
# GET /<%= plural_table_name %>.xml
|
16
4
|
def index
|
@@ -18,13 +6,13 @@ class <%=namespace_class%>::<%= controller_class_name %>Controller < <%=namespac
|
|
18
6
|
@headers = <%= attributes.collect {|attribute| attribute.name.humanize}.inspect %>
|
19
7
|
respond_to do |format|
|
20
8
|
format.html {
|
21
|
-
@<%= plural_table_name %> = <%= class_name %>.paginate(:page => params[:<%= plural_table_name %>_page], :
|
9
|
+
@<%= plural_table_name %> = <%= class_name %>.apply_query(params).paginate(:page => params[:<%= plural_table_name %>_page], :order => (params[:<%= singular_name %>_sort].gsub('_reverse', ' DESC') unless params[:<%= singular_name %>_sort].blank?))
|
22
10
|
}
|
23
11
|
format.xml {
|
24
|
-
@<%= plural_table_name %> = <%= class_name %>.
|
12
|
+
@<%= plural_table_name %> = <%= class_name %>.apply_query(params)
|
25
13
|
}
|
26
14
|
format.csv {
|
27
|
-
@<%= plural_table_name %> = <%= class_name %>.
|
15
|
+
@<%= plural_table_name %> = <%= class_name %>.apply_query(params)
|
28
16
|
csv_string = FasterCSV.generate do |csv|
|
29
17
|
csv << @headers
|
30
18
|
@<%= plural_table_name %>.each do |<%= singular_name %>|
|
@@ -35,14 +23,9 @@ class <%=namespace_class%>::<%= controller_class_name %>Controller < <%=namespac
|
|
35
23
|
:disposition => "attachment; filename=<%= plural_table_name %>.csv"
|
36
24
|
}
|
37
25
|
format.xls {
|
38
|
-
@<%= plural_table_name %> = <%= class_name %>.
|
26
|
+
@<%= plural_table_name %> = <%= class_name %>.apply_query(params)
|
39
27
|
render :xls => @<%= plural_table_name %>
|
40
28
|
}
|
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
29
|
end
|
47
30
|
end
|
48
31
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
<h2><%%= <%= class_name %>.model_name.human %></h2>
|
4
4
|
|
5
|
-
<!--
|
6
|
-
|
5
|
+
<!-- Somatics Filters-->
|
6
|
+
<%%= somatics_filter_for :<%= singular_name %>%>
|
7
7
|
|
8
8
|
<%%# form_tag bulk_admin_<%= plural_name %>_path, :id => :form do -%>
|
9
9
|
<div class="autoscroll">
|
@@ -17,8 +17,7 @@
|
|
17
17
|
<!-- TODO Export-->
|
18
18
|
<p class="other-formats"><%%= t('Also_available_in') %>:
|
19
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>
|
20
|
+
<span><%%= link_to 'XLS', admin_<%= plural_name %>_path(:format => :xls), :class => 'xls' %></span>
|
22
21
|
</p>
|
23
22
|
<div style="clear:both;"></div>
|
24
23
|
|
@@ -59,20 +59,24 @@ module Somatics
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
63
|
-
|
62
|
+
def input_field(form)
|
63
|
+
options = {}
|
64
|
+
input_field_type = case self.field_type
|
64
65
|
when 'integer', 'string', 'float'
|
65
66
|
'text_field'
|
66
67
|
when 'text'
|
67
|
-
|
68
|
+
options[:class] = 'mceEditor'
|
69
|
+
'text_area'
|
68
70
|
when 'boolean'
|
69
71
|
'check_box'
|
70
72
|
else
|
71
73
|
'text_field'
|
72
74
|
end
|
75
|
+
form.send(input_field_type, :value, options)
|
73
76
|
end
|
74
77
|
|
75
78
|
class SettingNotFound < Exception; end
|
79
|
+
|
76
80
|
RUBY
|
77
81
|
end rescue nil
|
78
82
|
|
@@ -1,15 +1,4 @@
|
|
1
1
|
class <%=namespace_class%>::<%= controller_class_name %>Controller < <%=namespace_class%>::AdminController
|
2
|
-
# Redmine Filters
|
3
|
-
# available_filters :id, {:name => 'ID', :type => :integer, :order => 1}
|
4
|
-
<% attributes.each_with_index do |attribute, index| -%>
|
5
|
-
# available_filters :<%= attribute.name %>, {:name => '<%= attribute.name.humanize %>', :type => :<%= attribute.type %>, :order => <%= index %>}
|
6
|
-
<% end -%>
|
7
|
-
|
8
|
-
default_filter :id
|
9
|
-
<% attributes.each do |attribute| -%>
|
10
|
-
# default_filter :<%= attribute.name %>
|
11
|
-
<% end %>
|
12
|
-
|
13
2
|
# GET /<%= table_name %>
|
14
3
|
# GET /<%= table_name %>.xml
|
15
4
|
def index
|
@@ -17,13 +6,13 @@ class <%=namespace_class%>::<%= controller_class_name %>Controller < <%=namespac
|
|
17
6
|
@headers = <%= attributes.collect {|attribute| attribute.name.humanize}.inspect %>
|
18
7
|
respond_to do |format|
|
19
8
|
format.html {
|
20
|
-
@<%= table_name %> = <%= class_name %>.paginate(:page => params[:<%= table_name %>_page], :
|
9
|
+
@<%= table_name %> = <%= class_name %>.apply_query(params).paginate(:page => params[:<%= table_name %>_page], :order => (params[:<%= singular_name %>_sort].gsub('_reverse', ' DESC') unless params[:<%= singular_name %>_sort].blank?))
|
21
10
|
}
|
22
11
|
format.xml {
|
23
|
-
@<%= table_name %> = <%= class_name %>.
|
12
|
+
@<%= table_name %> = <%= class_name %>.apply_query(params)
|
24
13
|
}
|
25
14
|
format.csv {
|
26
|
-
@<%= table_name %> = <%= class_name %>.
|
15
|
+
@<%= table_name %> = <%= class_name %>.apply_query(params)
|
27
16
|
csv_string = FasterCSV.generate do |csv|
|
28
17
|
csv << @headers
|
29
18
|
@<%= table_name %>.each do |<%= singular_name %>|
|
@@ -34,14 +23,9 @@ class <%=namespace_class%>::<%= controller_class_name %>Controller < <%=namespac
|
|
34
23
|
:disposition => "attachment; filename=<%= table_name %>.csv"
|
35
24
|
}
|
36
25
|
format.xls {
|
37
|
-
@<%= table_name %> = <%= class_name %>.
|
26
|
+
@<%= table_name %> = <%= class_name %>.apply_query(params)
|
38
27
|
render :xls => @<%= table_name %>
|
39
28
|
}
|
40
|
-
format.pdf {
|
41
|
-
params[:fields] = @fields
|
42
|
-
@<%= table_name %> = <%= class_name %>.all(:conditions => query_statement)
|
43
|
-
prawnto :prawn => {:text_options => { :wrap => :character }, :page_layout => :portrait }
|
44
|
-
}
|
45
29
|
end
|
46
30
|
end
|
47
31
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<h2><%%= <%= class_name %>.model_name.human %></h2>
|
4
4
|
|
5
5
|
<!-- Redmine Filters-->
|
6
|
-
|
6
|
+
<%%= somatics_filter_for :setting %>
|
7
7
|
|
8
8
|
<div class="autoscroll">
|
9
9
|
<%%= render :partial => 'list', :locals => {:<%= plural_name %> => @<%= plural_name %>} %>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<p class="other-formats"><%%= t('Also_available_in') %>:
|
14
14
|
<span><%%= link_to 'CSV', admin_<%= plural_name %>_path(:format => :csv), :class => 'csv' %></span>
|
15
15
|
<span><%%= link_to 'XLS', admin_<%= plural_name %>_path(:format => :xls), :class => 'xls' %></span>
|
16
|
-
|
16
|
+
<!-- <span><%%= link_to 'PDF', admin_<%= plural_name %>_path(:format => :pdf), :class => 'pdf' %></span> -->
|
17
17
|
</p>
|
18
18
|
<div style="clear:both;"></div>
|
19
19
|
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{somatics3-generators}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Benjamin Wong"]
|
12
|
-
s.date = %q{2010-09
|
12
|
+
s.date = %q{2010-11-09}
|
13
13
|
s.description = %q{Somatics 3 generators is used to generate a resource with skeleton admin panel}
|
14
14
|
s.email = %q{tkwong@inspiresynergy.com}
|
15
15
|
s.executables = ["somatics", "somatify"]
|
@@ -27,50 +27,33 @@ Gem::Specification.new do |s|
|
|
27
27
|
"bin/somatics",
|
28
28
|
"bin/somatify",
|
29
29
|
"lib/generators/somatics.rb",
|
30
|
+
"lib/generators/somatics/associated/associated_generator.rb",
|
31
|
+
"lib/generators/somatics/associated/templates/migration.rb",
|
30
32
|
"lib/generators/somatics/attributes/attributes_generator.rb",
|
31
33
|
"lib/generators/somatics/attributes/templates/migration.rb",
|
32
34
|
"lib/generators/somatics/authenticated/authenticated_generator.rb",
|
33
|
-
"lib/generators/somatics/authenticated/templates/
|
34
|
-
"lib/generators/somatics/authenticated/templates/migration.rb",
|
35
|
-
"lib/generators/somatics/authenticated/templates/model.rb",
|
36
|
-
"lib/generators/somatics/authenticated/templates/observer.rb",
|
37
|
-
"lib/generators/somatics/authenticated/templates/test/mailer_test.rb",
|
38
|
-
"lib/generators/somatics/authenticated/templates/test/model_functional_test.rb",
|
39
|
-
"lib/generators/somatics/authenticated/templates/test/sessions_functional_test.rb",
|
40
|
-
"lib/generators/somatics/authenticated/templates/test/unit_test.rb",
|
41
|
-
"lib/generators/somatics/authenticated/templates/test/users.yml",
|
35
|
+
"lib/generators/somatics/authenticated/templates/partial_form.html.erb",
|
42
36
|
"lib/generators/somatics/authenticated_controller/authenticated_controller_generator.rb",
|
43
|
-
"lib/generators/somatics/authenticated_controller/templates/
|
44
|
-
"lib/generators/somatics/authenticated_controller/templates/
|
45
|
-
"lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb",
|
46
|
-
"lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb",
|
47
|
-
"lib/generators/somatics/authenticated_controller/templates/config/initializers/site_keys.rb",
|
48
|
-
"lib/generators/somatics/authenticated_controller/templates/controller.rb",
|
49
|
-
"lib/generators/somatics/authenticated_controller/templates/helper.rb",
|
37
|
+
"lib/generators/somatics/authenticated_controller/templates/locales_en.yml",
|
38
|
+
"lib/generators/somatics/authenticated_controller/templates/locales_zh-TW.yml",
|
50
39
|
"lib/generators/somatics/authenticated_controller/templates/login.html.erb",
|
51
|
-
"lib/generators/somatics/authenticated_controller/templates/mailer.rb",
|
52
|
-
"lib/generators/somatics/authenticated_controller/templates/migration.rb",
|
53
|
-
"lib/generators/somatics/authenticated_controller/templates/model.rb",
|
54
|
-
"lib/generators/somatics/authenticated_controller/templates/observer.rb",
|
55
|
-
"lib/generators/somatics/authenticated_controller/templates/session_helper.rb",
|
56
40
|
"lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb",
|
57
|
-
"lib/generators/somatics/authenticated_controller/templates/signup.html.erb",
|
58
|
-
"lib/generators/somatics/authenticated_controller/templates/signup_notification.erb",
|
59
|
-
"lib/generators/somatics/authenticated_controller/templates/test/mailer_test.rb",
|
60
|
-
"lib/generators/somatics/authenticated_controller/templates/test/model_functional_test.rb",
|
61
|
-
"lib/generators/somatics/authenticated_controller/templates/test/sessions_functional_test.rb",
|
62
|
-
"lib/generators/somatics/authenticated_controller/templates/test/unit_test.rb",
|
63
|
-
"lib/generators/somatics/authenticated_controller/templates/test/users.yml",
|
64
41
|
"lib/generators/somatics/helper/helper_generator.rb",
|
65
42
|
"lib/generators/somatics/install/install_generator.rb",
|
43
|
+
"lib/generators/somatics/install/templates/config/locales/devise_zh-TW.yml",
|
66
44
|
"lib/generators/somatics/install/templates/config/locales/somatics_en.yml",
|
67
45
|
"lib/generators/somatics/install/templates/config/locales/somatics_zh-TW.yml",
|
68
46
|
"lib/generators/somatics/install/templates/controller_admin.rb",
|
69
47
|
"lib/generators/somatics/install/templates/controller_home.rb",
|
70
48
|
"lib/generators/somatics/install/templates/helper_admin.rb",
|
49
|
+
"lib/generators/somatics/install/templates/initializer_paper_trail.rb",
|
71
50
|
"lib/generators/somatics/install/templates/layout_admin.html.erb",
|
51
|
+
"lib/generators/somatics/install/templates/lib/active_record/diff.rb",
|
72
52
|
"lib/generators/somatics/install/templates/lib/somatic_link_renderer.rb",
|
53
|
+
"lib/generators/somatics/install/templates/lib/tasks/heroku.rake",
|
54
|
+
"lib/generators/somatics/install/templates/lib/tasks/svn.rake",
|
73
55
|
"lib/generators/somatics/install/templates/partial_menu.html.erb",
|
56
|
+
"lib/generators/somatics/install/templates/partial_versions.html.erb",
|
74
57
|
"lib/generators/somatics/install/templates/public/images/somatics/add.png",
|
75
58
|
"lib/generators/somatics/install/templates/public/images/somatics/arrow_collapsed.png",
|
76
59
|
"lib/generators/somatics/install/templates/public/images/somatics/arrow_expanded.png",
|
@@ -166,10 +149,12 @@ Gem::Specification.new do |s|
|
|
166
149
|
"lib/generators/somatics/install/templates/public/javascripts/somatics/prototype.js",
|
167
150
|
"lib/generators/somatics/install/templates/public/javascripts/somatics/rails.js",
|
168
151
|
"lib/generators/somatics/install/templates/public/javascripts/somatics/select_list_move.js",
|
152
|
+
"lib/generators/somatics/install/templates/public/stylesheets/application.css",
|
169
153
|
"lib/generators/somatics/install/templates/public/stylesheets/somatics/base.css",
|
170
154
|
"lib/generators/somatics/install/templates/public/stylesheets/somatics/context_menu.css",
|
171
155
|
"lib/generators/somatics/install/templates/public/stylesheets/somatics/csshover.htc",
|
172
156
|
"lib/generators/somatics/install/templates/public/stylesheets/somatics/jstoolbar.css",
|
157
|
+
"lib/generators/somatics/install/templates/public/themes/default/stylesheets/application.css",
|
173
158
|
"lib/generators/somatics/install/templates/view_index.html.erb",
|
174
159
|
"lib/generators/somatics/relationship/relationship_generator.rb",
|
175
160
|
"lib/generators/somatics/relationship/templates/migration.rb",
|
@@ -181,7 +166,6 @@ Gem::Specification.new do |s|
|
|
181
166
|
"lib/generators/somatics/scaffold/templates/show.html.erb",
|
182
167
|
"lib/generators/somatics/scaffold_controller/USAGE",
|
183
168
|
"lib/generators/somatics/scaffold_controller/scaffold_controller_generator.rb",
|
184
|
-
"lib/generators/somatics/scaffold_controller/templates/builder_index.pdf.prawn",
|
185
169
|
"lib/generators/somatics/scaffold_controller/templates/builder_index.xls.builder",
|
186
170
|
"lib/generators/somatics/scaffold_controller/templates/builder_index.xml.builder",
|
187
171
|
"lib/generators/somatics/scaffold_controller/templates/controller.rb",
|
@@ -200,7 +184,6 @@ Gem::Specification.new do |s|
|
|
200
184
|
"lib/generators/somatics/settings/settings_generator.rb",
|
201
185
|
"lib/generators/somatics/settings_controller/USAGE",
|
202
186
|
"lib/generators/somatics/settings_controller/settings_controller_generator.rb",
|
203
|
-
"lib/generators/somatics/settings_controller/templates/builder_index.pdf.prawn",
|
204
187
|
"lib/generators/somatics/settings_controller/templates/builder_index.xls.builder",
|
205
188
|
"lib/generators/somatics/settings_controller/templates/builder_index.xml.builder",
|
206
189
|
"lib/generators/somatics/settings_controller/templates/controller.rb",
|
@@ -208,7 +191,6 @@ Gem::Specification.new do |s|
|
|
208
191
|
"lib/generators/somatics/settings_controller/templates/locales_en.yml",
|
209
192
|
"lib/generators/somatics/settings_controller/templates/locales_zh-TW.yml",
|
210
193
|
"lib/generators/somatics/settings_controller/templates/migration.rb",
|
211
|
-
"lib/generators/somatics/settings_controller/templates/model.rb",
|
212
194
|
"lib/generators/somatics/settings_controller/templates/partial_bulk.html.erb",
|
213
195
|
"lib/generators/somatics/settings_controller/templates/partial_edit.html.erb",
|
214
196
|
"lib/generators/somatics/settings_controller/templates/partial_form.html.erb",
|
@@ -226,7 +208,7 @@ Gem::Specification.new do |s|
|
|
226
208
|
"test/test_somatics3-generators.rb"
|
227
209
|
]
|
228
210
|
s.homepage = %q{http://github.com/inspiresynergy/somatics3-generators}
|
229
|
-
s.rdoc_options = ["--charset=UTF-8", "--exclude=lib/generators/somatics/
|
211
|
+
s.rdoc_options = ["--charset=UTF-8", "--exclude=lib/generators/somatics/associated/templates/migration.rb", "--exclude=lib/generators/somatics/attributes/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/partial_form.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/config", "--exclude=lib/generators/somatics/authenticated_controller/templates/locales_en.yml", "--exclude=lib/generators/somatics/authenticated_controller/templates/locales_zh-TW.yml", "--exclude=lib/generators/somatics/authenticated_controller/templates/login.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb", "--exclude=lib/generators/somatics/install/templates/config", "--exclude=lib/generators/somatics/install/templates/controller_admin.rb", "--exclude=lib/generators/somatics/install/templates/controller_home.rb", "--exclude=lib/generators/somatics/install/templates/helper_admin.rb", "--exclude=lib/generators/somatics/install/templates/initializer_paper_trail.rb", "--exclude=lib/generators/somatics/install/templates/layout_admin.html.erb", "--exclude=lib/generators/somatics/install/templates/lib", "--exclude=lib/generators/somatics/install/templates/partial_menu.html.erb", "--exclude=lib/generators/somatics/install/templates/partial_versions.html.erb", "--exclude=lib/generators/somatics/install/templates/public", "--exclude=lib/generators/somatics/install/templates/view_index.html.erb", "--exclude=lib/generators/somatics/relationship/templates/migration.rb", "--exclude=lib/generators/somatics/scaffold/templates/_form.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/edit.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/index.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/new.html.erb", "--exclude=lib/generators/somatics/scaffold/templates/show.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.xls.builder", "--exclude=lib/generators/somatics/scaffold_controller/templates/builder_index.xml.builder", "--exclude=lib/generators/somatics/scaffold_controller/templates/controller.rb", "--exclude=lib/generators/somatics/scaffold_controller/templates/locales_en.yml", "--exclude=lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_bulk.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_edit.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_form.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_list.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_menu.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/partial_show.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_edit.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_index.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_new.html.erb", "--exclude=lib/generators/somatics/scaffold_controller/templates/view_show.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/builder_index.xls.builder", "--exclude=lib/generators/somatics/settings_controller/templates/builder_index.xml.builder", "--exclude=lib/generators/somatics/settings_controller/templates/controller.rb", "--exclude=lib/generators/somatics/settings_controller/templates/helper.rb", "--exclude=lib/generators/somatics/settings_controller/templates/locales_en.yml", "--exclude=lib/generators/somatics/settings_controller/templates/locales_zh-TW.yml", "--exclude=lib/generators/somatics/settings_controller/templates/migration.rb", "--exclude=lib/generators/somatics/settings_controller/templates/partial_bulk.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/partial_edit.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/partial_form.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/partial_list.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/partial_menu.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/partial_show.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/view_edit.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/view_index.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/view_new.html.erb", "--exclude=lib/generators/somatics/settings_controller/templates/view_show.html.erb"]
|
230
212
|
s.require_paths = ["lib"]
|
231
213
|
s.rubyforge_project = %q{somatics3}
|
232
214
|
s.rubygems_version = %q{1.3.7}
|
@@ -242,17 +224,26 @@ Gem::Specification.new do |s|
|
|
242
224
|
|
243
225
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
244
226
|
s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
|
245
|
-
s.add_runtime_dependency(%q<prawn>, ["= 0.6.3"])
|
246
227
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
228
|
+
s.add_runtime_dependency(%q<meta_search>, [">= 0"])
|
229
|
+
s.add_runtime_dependency(%q<paper_trail>, [">= 0"])
|
230
|
+
s.add_runtime_dependency(%q<tiny_mce>, [">= 0"])
|
231
|
+
s.add_runtime_dependency(%q<devise>, [">= 0"])
|
247
232
|
else
|
248
233
|
s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
|
249
|
-
s.add_dependency(%q<prawn>, ["= 0.6.3"])
|
250
234
|
s.add_dependency(%q<json>, [">= 0"])
|
235
|
+
s.add_dependency(%q<meta_search>, [">= 0"])
|
236
|
+
s.add_dependency(%q<paper_trail>, [">= 0"])
|
237
|
+
s.add_dependency(%q<tiny_mce>, [">= 0"])
|
238
|
+
s.add_dependency(%q<devise>, [">= 0"])
|
251
239
|
end
|
252
240
|
else
|
253
241
|
s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
|
254
|
-
s.add_dependency(%q<prawn>, ["= 0.6.3"])
|
255
242
|
s.add_dependency(%q<json>, [">= 0"])
|
243
|
+
s.add_dependency(%q<meta_search>, [">= 0"])
|
244
|
+
s.add_dependency(%q<paper_trail>, [">= 0"])
|
245
|
+
s.add_dependency(%q<tiny_mce>, [">= 0"])
|
246
|
+
s.add_dependency(%q<devise>, [">= 0"])
|
256
247
|
end
|
257
248
|
end
|
258
249
|
|