somatics3-generators 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +87 -13
- data/VERSION +1 -1
- data/bin/somatics +1 -0
- data/lib/generators/somatics/authenticated_controller/authenticated_controller_generator.rb +8 -8
- data/lib/generators/somatics/install/install_generator.rb +17 -4
- data/lib/generators/somatics/scaffold_controller/templates/controller.rb +1 -1
- data/lib/generators/somatics/settings/settings_generator.rb +82 -0
- data/lib/generators/somatics/settings_controller/USAGE +20 -0
- data/lib/generators/somatics/settings_controller/settings_controller_generator.rb +11 -0
- data/lib/generators/somatics/settings_controller/templates/builder_index.pdf.prawn +25 -0
- data/lib/generators/somatics/settings_controller/templates/builder_index.xls.builder +24 -0
- data/lib/generators/somatics/settings_controller/templates/builder_index.xml.builder +10 -0
- data/lib/generators/somatics/settings_controller/templates/controller.rb +80 -0
- data/lib/generators/somatics/settings_controller/templates/helper.rb +2 -0
- data/lib/generators/somatics/settings_controller/templates/locales_en.yml +9 -0
- data/lib/generators/somatics/settings_controller/templates/locales_zh-TW.yml +28 -0
- data/lib/generators/somatics/settings_controller/templates/migration.rb +17 -0
- data/lib/generators/somatics/settings_controller/templates/model.rb +54 -0
- data/lib/generators/somatics/settings_controller/templates/partial_bulk.html.erb +12 -0
- data/lib/generators/somatics/settings_controller/templates/partial_edit.html.erb +7 -0
- data/lib/generators/somatics/settings_controller/templates/partial_form.html.erb +15 -0
- data/lib/generators/somatics/settings_controller/templates/partial_list.html.erb +28 -0
- data/lib/generators/somatics/settings_controller/templates/partial_menu.html.erb +1 -0
- data/lib/generators/somatics/settings_controller/templates/partial_show.html.erb +13 -0
- data/lib/generators/somatics/settings_controller/templates/view_edit.html.erb +23 -0
- data/lib/generators/somatics/settings_controller/templates/view_index.html.erb +22 -0
- data/lib/generators/somatics/settings_controller/templates/view_new.html.erb +14 -0
- data/lib/generators/somatics/settings_controller/templates/view_show.html.erb +23 -0
- data/lib/somatics3-generators.rb +1 -0
- data/somatics3-generators.gemspec +25 -3
- data/templates/somatics.rb +5 -10
- metadata +45 -4
data/README.rdoc
CHANGED
@@ -1,17 +1,91 @@
|
|
1
|
-
|
1
|
+
=== Welcome to Somatics3
|
2
2
|
|
3
|
-
|
3
|
+
Somatics3 is next generation open source scaffolding template that kick-starts your next Rails project.
|
4
|
+
Active development has started in July 2010; new features, enhancements, and updates appear
|
5
|
+
on daily basis.
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
7
|
+
Here are the steps to get Somatics up and running on your system.
|
14
8
|
|
15
|
-
|
9
|
+
Somatics3 Support Rails 3 Now!
|
16
10
|
|
17
|
-
|
11
|
+
|
12
|
+
=== System Requirements
|
13
|
+
|
14
|
+
* Ruby v1.8.7 or v1.9.2
|
15
|
+
* Ruby on Rails v3.0+
|
16
|
+
* MySQL v4.1.1 or later (v5+ is recommended) or SQLite v3.4 or later
|
17
|
+
|
18
|
+
|
19
|
+
== Getting Started
|
20
|
+
|
21
|
+
1. Install \Somatics at the command prompt if you haven't yet:
|
22
|
+
|
23
|
+
gem install somatics3-generators
|
24
|
+
|
25
|
+
2. At the command prompt, create a new \Somatics application:
|
26
|
+
|
27
|
+
somatics new myapp
|
28
|
+
|
29
|
+
where "myapp" is the application name.
|
30
|
+
|
31
|
+
3. Change directory to +myapp+ and start the web server:
|
32
|
+
|
33
|
+
cd myapp; rails server
|
34
|
+
|
35
|
+
Run with <tt>--help</tt> for options.
|
36
|
+
|
37
|
+
4. Open up http://localhost:3000/admin and login with username ‘admin’ and password ‘somatics’.
|
38
|
+
|
39
|
+
=== Downloads
|
40
|
+
|
41
|
+
* Git source code repository: git://github.com/inspiresynergy/somatics3-generators.git
|
42
|
+
* .zip or .tgz archives: http://github.com/inspiresynergy/somatics3-generators/downloads
|
43
|
+
|
44
|
+
=== Resources
|
45
|
+
|
46
|
+
* Home page: http://www.somaticsapp.com
|
47
|
+
* Project page: http://github.com/inspiresynergy/somatics3-generators/tree/master
|
48
|
+
* Features and bugs: http://somatics.lighthouseapp.com
|
49
|
+
* Twitter commit updates: http://twitter.com/somaticsapp
|
50
|
+
* Discussion group for developers: http://groups.google.com/group/somaticsapp
|
51
|
+
* IRC channel: #somaticsapp on irc.freenode.net
|
52
|
+
|
53
|
+
=== Generate the Admin Model
|
54
|
+
|
55
|
+
You can test drive Somatics by generating models.
|
56
|
+
|
57
|
+
$ rails generate somatics:scaffold products title:string description:text
|
58
|
+
|
59
|
+
Among other things the generator creates admin user records and administration panels.
|
60
|
+
You can log in the admin panel using the default login and password.(+admin+/+password+)
|
61
|
+
The admin site is at http://localhost:3000/admin .
|
62
|
+
|
63
|
+
=== Deploying The App
|
64
|
+
|
65
|
+
TODO
|
66
|
+
|
67
|
+
=== For Developers
|
68
|
+
|
69
|
+
TODO
|
70
|
+
|
71
|
+
=== Features
|
72
|
+
|
73
|
+
Somatic is open source software and relies on your contributions to grow!
|
74
|
+
|
75
|
+
http://github.com/inspiresynergy/somatics3-generators
|
76
|
+
|
77
|
+
GitHub always contains the latest BaseApp code. Fork your own development branch here if you wish to contribute code.
|
78
|
+
|
79
|
+
Pull requests should be send to ‘inspiresynergy’ to include them in the main Somatics code base.
|
80
|
+
|
81
|
+
http://inspiresynergy.lighthouseapp.com/projects/53315-somatics/overview
|
82
|
+
|
83
|
+
Bug reports and feature requests should be posted in LightHouse.
|
84
|
+
|
85
|
+
Bugs always have priority over new features! But, you’re free to help out with whatever you want.
|
86
|
+
|
87
|
+
=== Credits
|
88
|
+
|
89
|
+
Somatics is developed by Inspire Synergy – Benjamin Wong, Gary Or and a whole bunch of cool contributors.
|
90
|
+
|
91
|
+
Somatics is released to the public under the MIT license.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/bin/somatics
CHANGED
@@ -97,21 +97,21 @@ module Somatics
|
|
97
97
|
unless options[:skip_routes]
|
98
98
|
route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
|
99
99
|
route_config << "\n"
|
100
|
-
route_config << %Q{match '#{file_name}_signup' => '#{controller_plural_name}#new'}
|
100
|
+
route_config << %Q{ match '#{file_name}_signup' => '#{controller_plural_name}#new'}
|
101
101
|
route_config << "\n"
|
102
|
-
route_config << %Q{match '#{file_name}_register' => '#{controller_plural_name}#create'}
|
102
|
+
route_config << %Q{ match '#{file_name}_register' => '#{controller_plural_name}#create'}
|
103
103
|
route_config << "\n"
|
104
|
-
route_config << %Q{match '#{file_name}_login' => '#{sessions_controller_controller_name}#new'}
|
104
|
+
route_config << %Q{ match '#{file_name}_login' => '#{sessions_controller_controller_name}#new'}
|
105
105
|
route_config << "\n"
|
106
|
-
route_config << %Q{match '#{file_name}_logout' => '#{sessions_controller_controller_name}#destroy'}
|
106
|
+
route_config << %Q{ match '#{file_name}_logout' => '#{sessions_controller_controller_name}#destroy'}
|
107
107
|
route_config << "\n"
|
108
|
-
route_config << "match '/activate/:activation_code' => '#{ controller_plural_name }#activate', :as => :activate, :activation_code => nil"
|
108
|
+
route_config << " match '/activate/:activation_code' => '#{ controller_plural_name }#activate', :as => :activate, :activation_code => nil"
|
109
109
|
route_config << "\n"
|
110
|
-
route_config << "resource #{ sessions_controller_singular_name.to_sym.inspect }, :only => [:new, :create, :destroy]"
|
110
|
+
route_config << " resource #{ sessions_controller_singular_name.to_sym.inspect }, :only => [:new, :create, :destroy]"
|
111
111
|
route_config << "\n"
|
112
|
-
route_config << "resources #{ controller_plural_name.to_sym.inspect }"
|
112
|
+
route_config << " resources #{ controller_plural_name.to_sym.inspect }"
|
113
113
|
route_config << "\n"
|
114
|
-
route_config << "
|
114
|
+
route_config << " end" * class_path.size
|
115
115
|
route route_config
|
116
116
|
end
|
117
117
|
end
|
@@ -47,12 +47,25 @@ module Somatics
|
|
47
47
|
directory "config/locales"
|
48
48
|
end
|
49
49
|
|
50
|
+
def default_admin
|
51
|
+
rakefile "somatics.rake" do
|
52
|
+
<<-RUBY
|
53
|
+
namespace :somatics do
|
54
|
+
desc "Create Default Admin User"
|
55
|
+
task :create_user => :environment do
|
56
|
+
User.find_or_create_by_name(:name => 'Admin', :login => 'admin', :password => 'somatics', :password_confirmation => 'somatics', :email => 'admin@admin.com')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
RUBY
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
50
63
|
def add_route
|
51
64
|
route_config = ""
|
52
|
-
route_config << "
|
53
|
-
route_config << "
|
54
|
-
route_config << "
|
55
|
-
route_config << "\
|
65
|
+
route_config << " namespace :#{options[:namespace]} do \n" if options[:namespace].present?
|
66
|
+
route_config << " root :to => 'home#index'\n"
|
67
|
+
route_config << " match 'home' => 'home#index'\n"
|
68
|
+
route_config << " end\n" if options[:namespace].present?
|
56
69
|
route route_config
|
57
70
|
end
|
58
71
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class <%=namespace_class%>::<%= controller_class_name %>Controller <
|
1
|
+
class <%=namespace_class%>::<%= controller_class_name %>Controller < <%=namespace_class%>::AdminController
|
2
2
|
|
3
3
|
# Redmine Filters
|
4
4
|
# available_filters :id, {:name => 'ID', :type => :integer, :order => 1}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'generators/somatics'
|
2
|
+
require 'rails/generators/rails/resource/resource_generator'
|
3
|
+
require 'rails/generators/resource_helpers'
|
4
|
+
require 'rails/generators/migration'
|
5
|
+
|
6
|
+
module Somatics
|
7
|
+
module Generators
|
8
|
+
class SettingsGenerator < Rails::Generators::Base
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
|
11
|
+
def generate_model
|
12
|
+
invoke "somatics:scaffold", ["settings" , "name:string", "field_type:string", "value:text", "category:string", "description:text", "mce_editable:boolean"], {:scaffold_controller => "settings_controller"}
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_name_index
|
16
|
+
inject_into_file Dir.glob("db/migrate/[0-9]*_*.rb").last, :before => "end\n\n def self.down" do
|
17
|
+
"add_index :settings, :name, :unique => true\n"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def inject_model_validators
|
22
|
+
inject_into_class 'app/models/setting.rb', 'Setting' do
|
23
|
+
<<-RUBY
|
24
|
+
GENERAL = 'General'
|
25
|
+
CATEGORIES = [GENERAL]
|
26
|
+
FIELD_TYPES = ['integer', 'string', 'float', 'text', 'boolean']
|
27
|
+
|
28
|
+
attr_protected :name, :field_type, :description, :category, :mce_editable
|
29
|
+
|
30
|
+
validates_presence_of :name
|
31
|
+
validates_uniqueness_of :name
|
32
|
+
validates_presence_of :field_type
|
33
|
+
validates_inclusion_of :field_type, :in => FIELD_TYPES
|
34
|
+
validates_presence_of :category
|
35
|
+
validates_inclusion_of :category, :in => CATEGORIES
|
36
|
+
validates_presence_of :value, :allow_blank => true
|
37
|
+
validates_numericality_of :value, :if => Proc.new {|setting| ['integer', 'float'].include?(setting.field_type) }
|
38
|
+
|
39
|
+
def self.[](name)
|
40
|
+
raise SettingNotFound unless setting = Setting.find_by_name(name)
|
41
|
+
setting.parsed_value
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.[]=(name, value)
|
45
|
+
raise SettingNotFound unless setting = Setting.find_by_name(name)
|
46
|
+
setting.update_attribute(:value, value)
|
47
|
+
end
|
48
|
+
|
49
|
+
def parsed_value
|
50
|
+
case self.field_type
|
51
|
+
when 'integer'
|
52
|
+
self.value.to_i
|
53
|
+
when 'float'
|
54
|
+
self.value.to_f
|
55
|
+
when 'boolean'
|
56
|
+
self.value == '1'
|
57
|
+
else
|
58
|
+
self.value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def input_field_type
|
63
|
+
case self.field_type
|
64
|
+
when 'integer', 'string', 'float'
|
65
|
+
'text_field'
|
66
|
+
when 'text'
|
67
|
+
self.mce_editable ? 'tinymce' : 'text_area'
|
68
|
+
when 'boolean'
|
69
|
+
'check_box'
|
70
|
+
else
|
71
|
+
'text_field'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class SettingNotFound < Exception; end
|
76
|
+
RUBY
|
77
|
+
end rescue nil
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Description:
|
2
|
+
Stubs out a scaffolded controller and its views. Pass the model name,
|
3
|
+
either CamelCased or under_scored, and a list of views as arguments.
|
4
|
+
The controller name is retrieved as a pluralized version of the model
|
5
|
+
name.
|
6
|
+
|
7
|
+
To create a controller within a module, specify the model name as a
|
8
|
+
path like 'parent_module/controller_name'.
|
9
|
+
|
10
|
+
This generates a controller class in app/controllers and invokes helper,
|
11
|
+
template engine and test framework generators.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
`rails generate scaffold_controller CreditCard`
|
15
|
+
|
16
|
+
Credit card controller with URLs like /credit_card/debit.
|
17
|
+
Controller: app/controllers/credit_cards_controller.rb
|
18
|
+
Functional Test: test/functional/credit_cards_controller_test.rb
|
19
|
+
Views: app/views/credit_cards/index.html.erb [...]
|
20
|
+
Helper: app/helpers/credit_cards_helper.rb
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'generators/somatics'
|
2
|
+
require 'rails/generators/resource_helpers'
|
3
|
+
require 'generators/somatics/scaffold_controller/scaffold_controller_generator'
|
4
|
+
|
5
|
+
module Somatics
|
6
|
+
module Generators
|
7
|
+
class SettingsControllerGenerator < ScaffoldControllerGenerator
|
8
|
+
extend TemplatePath
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
pdf.header pdf.margin_box.top_left do
|
2
|
+
# pdf.image "#{RAILS_ROOT}/public/images/logo.png", :fit => [60,24]
|
3
|
+
pdf.text "<%= plural_name.humanize %>", :size => 16, :align => :center
|
4
|
+
end
|
5
|
+
|
6
|
+
fields = params[:fields]# - [""]
|
7
|
+
|
8
|
+
entries = @<%= plural_name %>.collect do |<%= singular_name %>|
|
9
|
+
fields.collect do |f|
|
10
|
+
<%= singular_name %>.send(f)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
x_pos = ((pdf.bounds.width / 2) - 150)
|
15
|
+
y_pos = ((pdf.bounds.height / 2) + 300)
|
16
|
+
pdf.bounding_box([x_pos, y_pos], :width => 300, :height => 450) do
|
17
|
+
pdf.table entries, :border_style => :grid,
|
18
|
+
:row_colors => ["FFFFFF","DDDDDD"],
|
19
|
+
:headers => @headers,
|
20
|
+
:position => :center,
|
21
|
+
:font_size => 9
|
22
|
+
end
|
23
|
+
|
24
|
+
pdf.number_pages "<page>/<total>", [pdf.bounds.right - 50, 0]
|
25
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
excel_document(xml) do
|
2
|
+
xml.Worksheet 'ss:Name' => '<%= plural_name.humanize %>' do
|
3
|
+
xml.Table do
|
4
|
+
# Header
|
5
|
+
xml.Row do
|
6
|
+
@headers.each do |header|
|
7
|
+
xml.Cell { xml.Data header, 'ss:Type' => 'String' }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Rows
|
12
|
+
unless @<%= plural_name %>.blank?
|
13
|
+
for <%= singular_name %> in @<%= plural_name %>
|
14
|
+
xml.Row do
|
15
|
+
@fields.each do |f|
|
16
|
+
xml.Cell { xml.Data <%= singular_name %>.send(f), 'ss:Type' => 'String' }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,80 @@
|
|
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
|
+
# GET /<%= table_name %>
|
14
|
+
# GET /<%= table_name %>.xml
|
15
|
+
def index
|
16
|
+
@fields = <%= attributes.collect {|attribute| attribute.name}.inspect %>
|
17
|
+
@headers = <%= attributes.collect {|attribute| attribute.name.humanize}.inspect %>
|
18
|
+
respond_to do |format|
|
19
|
+
format.html {
|
20
|
+
@<%= table_name %> = <%= class_name %>.paginate(:page => params[:<%= table_name %>_page], :conditions => query_statement, :order => (params[:<%= singular_name %>_sort].gsub('_reverse', ' DESC') unless params[:<%= singular_name %>_sort].blank?))
|
21
|
+
}
|
22
|
+
format.xml {
|
23
|
+
@<%= table_name %> = <%= class_name %>.all(:conditions => query_statement)
|
24
|
+
}
|
25
|
+
format.csv {
|
26
|
+
@<%= table_name %> = <%= class_name %>.all(:conditions => query_statement)
|
27
|
+
csv_string = FasterCSV.generate do |csv|
|
28
|
+
csv << @headers
|
29
|
+
@<%= table_name %>.each do |<%= singular_name %>|
|
30
|
+
csv << @fields.collect { |f| <%= singular_name %>.send(f) }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
send_data csv_string, :type => 'text/csv; charset=iso-8859-1; header=present',
|
34
|
+
:disposition => "attachment; filename=<%= table_name %>.csv"
|
35
|
+
}
|
36
|
+
format.xls {
|
37
|
+
@<%= table_name %> = <%= class_name %>.all(:conditions => query_statement)
|
38
|
+
render :xls => @<%= table_name %>
|
39
|
+
}
|
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
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# GET /<%= table_name %>/1
|
49
|
+
# GET /<%= table_name %>/1.xml
|
50
|
+
def show
|
51
|
+
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
52
|
+
|
53
|
+
respond_to do |format|
|
54
|
+
format.html # show.html.erb
|
55
|
+
format.xml { render :xml => @<%= file_name %> }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# GET /<%= table_name %>/1/edit
|
60
|
+
def edit
|
61
|
+
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
62
|
+
end
|
63
|
+
|
64
|
+
# PUT /<%= table_name %>/1
|
65
|
+
# PUT /<%= table_name %>/1.xml
|
66
|
+
def update
|
67
|
+
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
68
|
+
|
69
|
+
respond_to do |format|
|
70
|
+
if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
|
71
|
+
flash[:notice] = '<%= class_name %> was successfully updated.'
|
72
|
+
format.html { redirect_to([:admin,@<%= file_name %>]) }
|
73
|
+
format.xml { head :ok }
|
74
|
+
else
|
75
|
+
format.html { render :action => "edit" }
|
76
|
+
format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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
|
+
<% if options[:authenticated] -%>
|
19
|
+
login: 註冊
|
20
|
+
name: 名稱
|
21
|
+
email: 電子郵件
|
22
|
+
created_at: 註冊日期
|
23
|
+
password: 密碼
|
24
|
+
password_confirmation: 確認密碼
|
25
|
+
<% end -%>
|
26
|
+
<% attributes.each do |attribute| -%>
|
27
|
+
<%= attribute.name %>: <%= GoogleTranslate.t attribute.name.humanize %>
|
28
|
+
<% end -%>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class <%= migration_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table "<%= table_name %>" do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :field_type
|
6
|
+
t.text :value
|
7
|
+
t.string :category
|
8
|
+
t.text :description
|
9
|
+
t.boolean :mce_editable
|
10
|
+
end
|
11
|
+
add_index :<%= table_name %>, :name, :unique => true
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table "<%= table_name %>"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class <%= model_name %> < ActiveRecord::Base
|
2
|
+
GENERAL = 'General'
|
3
|
+
CATEGORIES = [GENERAL]
|
4
|
+
FIELD_TYPES = ['integer', 'string', 'float', 'text', 'boolean']
|
5
|
+
|
6
|
+
attr_protected :name, :field_type, :description, :category, :mce_editable
|
7
|
+
|
8
|
+
validates_presence_of :name
|
9
|
+
validates_uniqueness_of :name
|
10
|
+
validates_presence_of :field_type
|
11
|
+
validates_inclusion_of :field_type, :in => FIELD_TYPES
|
12
|
+
validates_presence_of :category
|
13
|
+
validates_inclusion_of :category, :in => CATEGORIES
|
14
|
+
validates_presence_of :value, :allow_blank => true
|
15
|
+
validates_numericality_of :value, :if => Proc.new {|setting| ['integer', 'float'].include?(setting.field_type) }
|
16
|
+
|
17
|
+
def self.[](name)
|
18
|
+
raise SettingNotFound unless <%= singular_name %> = <%= model_name %>.find_by_name(name)
|
19
|
+
setting.parsed_value
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.[]=(name, value)
|
23
|
+
raise SettingNotFound unless <%= singular_name %> = <%= model_name %>.find_by_name(name)
|
24
|
+
<%= singular_name %>.update_attribute(:value, value)
|
25
|
+
end
|
26
|
+
|
27
|
+
def parsed_value
|
28
|
+
case self.field_type
|
29
|
+
when 'integer'
|
30
|
+
self.value.to_i
|
31
|
+
when 'float'
|
32
|
+
self.value.to_f
|
33
|
+
when 'boolean'
|
34
|
+
self.value == '1'
|
35
|
+
else
|
36
|
+
self.value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def input_field_type
|
41
|
+
case self.field_type
|
42
|
+
when 'integer', 'string', 'float'
|
43
|
+
'text_field'
|
44
|
+
when 'text'
|
45
|
+
self.mce_editable ? 'tinymce' : 'text_area'
|
46
|
+
when 'boolean'
|
47
|
+
'check_box'
|
48
|
+
else
|
49
|
+
'text_field'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class SettingNotFound < Exception; end
|
54
|
+
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,15 @@
|
|
1
|
+
<table width="100%">
|
2
|
+
<tbody>
|
3
|
+
<tr>
|
4
|
+
<td colspan="2"><br/><h3><%%= <%= class_name %>.human_name %></h3></td>
|
5
|
+
</tr>
|
6
|
+
<tr>
|
7
|
+
<td><b><%%= <%= class_name %>.human_attribute_name(:name) %></b></td>
|
8
|
+
<td><%%=h @<%= singular_name %>.name %></td>
|
9
|
+
</tr>
|
10
|
+
<tr>
|
11
|
+
<td><b><%%= <%= class_name %>.human_attribute_name(:value) %></b></td>
|
12
|
+
<td><%%= f.send(@<%= singular_name %>.input_field_type, :value) %></td>
|
13
|
+
</tr>
|
14
|
+
</tbody>
|
15
|
+
</table>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<table class="list issues">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th title="Sort by "#""><%%= sort_link_helper t('ID'), '<%=singular_name%>', 'id' %></th>
|
5
|
+
<% %w(name value description).each do |attribute| -%>
|
6
|
+
<th title="Sort by "<%= attribute.humanize %>""><%%= sort_link_helper <%= class_name %>.human_attribute_name(:<%= attribute %>), '<%=singular_name%>', '<%= attribute %>' %></th>
|
7
|
+
<% end -%>
|
8
|
+
<!-- More Sort Link Helper -->
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<%% unless <%= plural_name %>.empty? %>
|
13
|
+
<%% for <%= singular_name %> in <%= plural_name %> %>
|
14
|
+
<tr id="<%% dom_id(<%=singular_name%>)%>" class="hascontextmenu <%%= cycle 'odd' , 'even' %> issue">
|
15
|
+
<td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);"><%%= link_to <%= singular_name %>.id, [:admin, <%= singular_name %>]%></td>
|
16
|
+
<% %w(name value description).each do |attribute| -%>
|
17
|
+
<td onclick="link_to(<%%= "'#{admin_<%=singular_name%>_path(<%=singular_name%>)}'" %>);" class="<%= attribute %>"><%%=h <%= singular_name %>.<%= attribute %> %></td>
|
18
|
+
<% end -%>
|
19
|
+
<!-- More Fields -->
|
20
|
+
</tr>
|
21
|
+
<%% end %>
|
22
|
+
<%% else -%>
|
23
|
+
<tr class="datos">
|
24
|
+
<td colspan="100" align="center">No Data available</td>
|
25
|
+
</tr>
|
26
|
+
<%% end -%>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<li><%%= link_to 'Home', '/admin', :class => (match_controller?("home")) ? 'selected' : ''%></li>
|
@@ -0,0 +1,13 @@
|
|
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
|
+
<% for attribute in attributes -%>
|
7
|
+
<tr>
|
8
|
+
<td><b><%%= <%= class_name %>.human_attribute_name(:<%= attribute.name %>) %></b></td>
|
9
|
+
<td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
|
10
|
+
</tr>
|
11
|
+
<% end -%>
|
12
|
+
</tbody>
|
13
|
+
</table>
|
@@ -0,0 +1,23 @@
|
|
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
|
+
</div>
|
4
|
+
|
5
|
+
<h2><%%= "#{<%= class_name %>.human_name} ##{@<%= singular_name %>.id}" %></h2>
|
6
|
+
|
7
|
+
<div class="issue details">
|
8
|
+
<%%= render :partial => 'show' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<!-- More List View -->
|
12
|
+
|
13
|
+
<div id="update">
|
14
|
+
<h3><%%= t('Update') %></h3>
|
15
|
+
<div id="focus"></div>
|
16
|
+
<%%= render :partial => 'edit' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
|
17
|
+
</div>
|
18
|
+
<div style="clear: both;"></div>
|
19
|
+
|
20
|
+
<%% content_for :sidebar do %>
|
21
|
+
<h3>Actions</h3>
|
22
|
+
<%%= link_to "#{t('Back_to')} #{<%= class_name %>.human_name}", admin_<%= plural_name %>_path %>
|
23
|
+
<%% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="contextual"></div>
|
2
|
+
|
3
|
+
<h2><%%= <%= class_name %>.model_name.human %></h2>
|
4
|
+
|
5
|
+
<!-- Redmine Filters-->
|
6
|
+
<%%#= filters %>
|
7
|
+
|
8
|
+
<div class="autoscroll">
|
9
|
+
<%%= render :partial => 'list', :locals => {:<%= plural_name %> => @<%= plural_name %>} %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<!-- TODO Export-->
|
13
|
+
<p class="other-formats"><%%= t('Also_available_in') %>:
|
14
|
+
<span><%%= link_to 'CSV', admin_<%= plural_name %>_path(:format => :csv), :class => 'csv' %></span>
|
15
|
+
<span><%%= link_to 'XLS', admin_<%= plural_name %>_path(:format => :xls), :class => 'xls' %></span>
|
16
|
+
<span><%%= link_to 'PDF', admin_<%= plural_name %>_path(:format => :pdf), :class => 'pdf' %></span>
|
17
|
+
</p>
|
18
|
+
<div style="clear:both;"></div>
|
19
|
+
|
20
|
+
<%%# content_for :sidebar do %>
|
21
|
+
<!-- <h3>Actions</h3> -->
|
22
|
+
<%%# end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<h2><%%= "#{t('New')} #{<%= class_name %>.model_name.human}" %></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 %>.model_name.human}", admin_<%= plural_name %>_path %>
|
14
|
+
<%% end %>
|
@@ -0,0 +1,23 @@
|
|
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
|
+
</div>
|
4
|
+
|
5
|
+
<h2><%%= "#{<%= class_name %>.human_name} ##{@<%= singular_name %>.id}" %></h2>
|
6
|
+
|
7
|
+
<div class="issue details">
|
8
|
+
<%%= render :partial => 'show' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<!-- More List View -->
|
12
|
+
|
13
|
+
<div id="update" style="display:none;">
|
14
|
+
<h3><%%= t('Update') %></h3>
|
15
|
+
<div id="focus"></div>
|
16
|
+
<%%= render :partial => 'edit' , :locals => {:<%= singular_name %> => @<%= singular_name %>} %>
|
17
|
+
</div>
|
18
|
+
<div style="clear: both;"></div>
|
19
|
+
|
20
|
+
<%% content_for :sidebar do %>
|
21
|
+
<h3>Actions</h3>
|
22
|
+
<%%= link_to "#{t('Back_to')} #{<%= class_name %>.human_name}", admin_<%= plural_name %>_path %>
|
23
|
+
<%% end %>
|
data/lib/somatics3-generators.rb
CHANGED
@@ -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.8"
|
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-09-17}
|
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"]
|
@@ -197,6 +197,28 @@ Gem::Specification.new do |s|
|
|
197
197
|
"lib/generators/somatics/scaffold_controller/templates/view_index.html.erb",
|
198
198
|
"lib/generators/somatics/scaffold_controller/templates/view_new.html.erb",
|
199
199
|
"lib/generators/somatics/scaffold_controller/templates/view_show.html.erb",
|
200
|
+
"lib/generators/somatics/settings/settings_generator.rb",
|
201
|
+
"lib/generators/somatics/settings_controller/USAGE",
|
202
|
+
"lib/generators/somatics/settings_controller/settings_controller_generator.rb",
|
203
|
+
"lib/generators/somatics/settings_controller/templates/builder_index.pdf.prawn",
|
204
|
+
"lib/generators/somatics/settings_controller/templates/builder_index.xls.builder",
|
205
|
+
"lib/generators/somatics/settings_controller/templates/builder_index.xml.builder",
|
206
|
+
"lib/generators/somatics/settings_controller/templates/controller.rb",
|
207
|
+
"lib/generators/somatics/settings_controller/templates/helper.rb",
|
208
|
+
"lib/generators/somatics/settings_controller/templates/locales_en.yml",
|
209
|
+
"lib/generators/somatics/settings_controller/templates/locales_zh-TW.yml",
|
210
|
+
"lib/generators/somatics/settings_controller/templates/migration.rb",
|
211
|
+
"lib/generators/somatics/settings_controller/templates/model.rb",
|
212
|
+
"lib/generators/somatics/settings_controller/templates/partial_bulk.html.erb",
|
213
|
+
"lib/generators/somatics/settings_controller/templates/partial_edit.html.erb",
|
214
|
+
"lib/generators/somatics/settings_controller/templates/partial_form.html.erb",
|
215
|
+
"lib/generators/somatics/settings_controller/templates/partial_list.html.erb",
|
216
|
+
"lib/generators/somatics/settings_controller/templates/partial_menu.html.erb",
|
217
|
+
"lib/generators/somatics/settings_controller/templates/partial_show.html.erb",
|
218
|
+
"lib/generators/somatics/settings_controller/templates/view_edit.html.erb",
|
219
|
+
"lib/generators/somatics/settings_controller/templates/view_index.html.erb",
|
220
|
+
"lib/generators/somatics/settings_controller/templates/view_new.html.erb",
|
221
|
+
"lib/generators/somatics/settings_controller/templates/view_show.html.erb",
|
200
222
|
"lib/somatics3-generators.rb",
|
201
223
|
"somatics3-generators.gemspec",
|
202
224
|
"templates/somatics.rb",
|
@@ -204,7 +226,7 @@ Gem::Specification.new do |s|
|
|
204
226
|
"test/test_somatics3-generators.rb"
|
205
227
|
]
|
206
228
|
s.homepage = %q{http://github.com/inspiresynergy/somatics3-generators}
|
207
|
-
s.rdoc_options = ["--charset=UTF-8", "--exclude=lib/generators/somatics/attributes/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/model.rb", "--exclude=lib/generators/somatics/authenticated/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated/templates/test", "--exclude=lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/activation.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/config", "--exclude=lib/generators/somatics/authenticated_controller/templates/controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/login.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/model.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/session_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup_notification.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/test", "--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/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/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.pdf.prawn", "--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"]
|
229
|
+
s.rdoc_options = ["--charset=UTF-8", "--exclude=lib/generators/somatics/attributes/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated/templates/model.rb", "--exclude=lib/generators/somatics/authenticated/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated/templates/test", "--exclude=lib/generators/somatics/authenticated_controller/templates/_model_partial.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/activation.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_system.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/authenticated_test_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/config", "--exclude=lib/generators/somatics/authenticated_controller/templates/controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/login.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/mailer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/migration.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/model.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/observer.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/session_helper.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup.html.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/signup_notification.erb", "--exclude=lib/generators/somatics/authenticated_controller/templates/test", "--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/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/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.pdf.prawn", "--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.pdf.prawn", "--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/model.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"]
|
208
230
|
s.require_paths = ["lib"]
|
209
231
|
s.rubyforge_project = %q{somatics3}
|
210
232
|
s.rubygems_version = %q{1.3.7}
|
data/templates/somatics.rb
CHANGED
@@ -90,24 +90,19 @@ rakefile "setup_svn.rake" do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
generate "somatics:install"
|
93
|
+
# generate "tinymce_installation"
|
94
|
+
|
93
95
|
environment 'config.autoload_paths += %W(#{config.root}/lib)'
|
94
96
|
generate "somatics:authenticated user"
|
95
97
|
generate "somatics:authenticated_controller admin/user --model=User"
|
96
98
|
|
99
|
+
generate "somatics:settings"
|
100
|
+
|
97
101
|
rake "db:create"
|
98
102
|
rake "db:migrate"
|
99
103
|
|
100
|
-
|
101
|
-
|
104
|
+
rake "somatics:create_user" if yes?(%(Create Default Admin User (username:admin, password:somatics)?))
|
102
105
|
|
103
|
-
#
|
104
|
-
# generate "tinymce_installation"
|
105
|
-
# generate "admin_controllers"
|
106
|
-
# generate "admin_scaffold user --admin-authenticated"
|
107
|
-
# generate "admin_setting"
|
108
|
-
#
|
109
|
-
# rake "db:create"
|
110
|
-
# rake "db:migrate"
|
111
106
|
|
112
107
|
# unless app_name.blank?
|
113
108
|
# run "git init"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: somatics3-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Wong
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-17 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -254,6 +254,28 @@ files:
|
|
254
254
|
- lib/generators/somatics/scaffold_controller/templates/view_index.html.erb
|
255
255
|
- lib/generators/somatics/scaffold_controller/templates/view_new.html.erb
|
256
256
|
- lib/generators/somatics/scaffold_controller/templates/view_show.html.erb
|
257
|
+
- lib/generators/somatics/settings/settings_generator.rb
|
258
|
+
- lib/generators/somatics/settings_controller/USAGE
|
259
|
+
- lib/generators/somatics/settings_controller/settings_controller_generator.rb
|
260
|
+
- lib/generators/somatics/settings_controller/templates/builder_index.pdf.prawn
|
261
|
+
- lib/generators/somatics/settings_controller/templates/builder_index.xls.builder
|
262
|
+
- lib/generators/somatics/settings_controller/templates/builder_index.xml.builder
|
263
|
+
- lib/generators/somatics/settings_controller/templates/controller.rb
|
264
|
+
- lib/generators/somatics/settings_controller/templates/helper.rb
|
265
|
+
- lib/generators/somatics/settings_controller/templates/locales_en.yml
|
266
|
+
- lib/generators/somatics/settings_controller/templates/locales_zh-TW.yml
|
267
|
+
- lib/generators/somatics/settings_controller/templates/migration.rb
|
268
|
+
- lib/generators/somatics/settings_controller/templates/model.rb
|
269
|
+
- lib/generators/somatics/settings_controller/templates/partial_bulk.html.erb
|
270
|
+
- lib/generators/somatics/settings_controller/templates/partial_edit.html.erb
|
271
|
+
- lib/generators/somatics/settings_controller/templates/partial_form.html.erb
|
272
|
+
- lib/generators/somatics/settings_controller/templates/partial_list.html.erb
|
273
|
+
- lib/generators/somatics/settings_controller/templates/partial_menu.html.erb
|
274
|
+
- lib/generators/somatics/settings_controller/templates/partial_show.html.erb
|
275
|
+
- lib/generators/somatics/settings_controller/templates/view_edit.html.erb
|
276
|
+
- lib/generators/somatics/settings_controller/templates/view_index.html.erb
|
277
|
+
- lib/generators/somatics/settings_controller/templates/view_new.html.erb
|
278
|
+
- lib/generators/somatics/settings_controller/templates/view_show.html.erb
|
257
279
|
- lib/somatics3-generators.rb
|
258
280
|
- somatics3-generators.gemspec
|
259
281
|
- templates/somatics.rb
|
@@ -320,6 +342,25 @@ rdoc_options:
|
|
320
342
|
- --exclude=lib/generators/somatics/scaffold_controller/templates/view_index.html.erb
|
321
343
|
- --exclude=lib/generators/somatics/scaffold_controller/templates/view_new.html.erb
|
322
344
|
- --exclude=lib/generators/somatics/scaffold_controller/templates/view_show.html.erb
|
345
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/builder_index.pdf.prawn
|
346
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/builder_index.xls.builder
|
347
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/builder_index.xml.builder
|
348
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/controller.rb
|
349
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/helper.rb
|
350
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/locales_en.yml
|
351
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/locales_zh-TW.yml
|
352
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/migration.rb
|
353
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/model.rb
|
354
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/partial_bulk.html.erb
|
355
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/partial_edit.html.erb
|
356
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/partial_form.html.erb
|
357
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/partial_list.html.erb
|
358
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/partial_menu.html.erb
|
359
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/partial_show.html.erb
|
360
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/view_edit.html.erb
|
361
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/view_index.html.erb
|
362
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/view_new.html.erb
|
363
|
+
- --exclude=lib/generators/somatics/settings_controller/templates/view_show.html.erb
|
323
364
|
require_paths:
|
324
365
|
- lib
|
325
366
|
required_ruby_version: !ruby/object:Gem::Requirement
|