fesplugas-typus 0.9.14 → 0.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ *.swp
1
2
  *.db
2
3
  *.log
3
4
  _dashboard*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.14
1
+ 0.9.15
@@ -293,7 +293,7 @@ private
293
293
  end
294
294
 
295
295
  def set_tiny_mce
296
- if !@resource[:class].typus_tiny_mce_fields.empty? && tiny_mce_plugin_installed?
296
+ if !@resource[:class].typus_tiny_mce_fields.empty? && defined?(TinyMCE)
297
297
  options = @resource[:class].typus_tiny_mce_options
298
298
  self.class.class_eval { uses_tiny_mce :options => options }
299
299
  end
@@ -93,8 +93,7 @@ module TypusHelper
93
93
  resources_partials_path = 'admin/resources'
94
94
 
95
95
  partials = ActionController::Base.view_paths.map do |view_path|
96
- path = Rails.vendor_rails? ? view_path.path : "#{Rails.root}/#{view_path}"
97
- Dir["#{path}/#{partials_path}/*"].map { |f| File.basename(f, '.html.erb') }
96
+ Dir["#{view_path.path}/#{partials_path}/*"].map { |f| File.basename(f, '.html.erb') }
98
97
  end.flatten
99
98
  resources_partials = Dir["#{Rails.root}/app/views/#{resources_partials_path}/*"].map { |f| File.basename(f, '.html.erb') }
100
99
 
@@ -185,8 +184,4 @@ module TypusHelper
185
184
 
186
185
  end
187
186
 
188
- def tiny_mce_plugin_installed?
189
- defined?(TinyMCE)
190
- end
191
-
192
187
  end
@@ -14,7 +14,7 @@
14
14
  <%= yield :stylesheets -%>
15
15
 
16
16
  <%= javascript_include_tag 'admin/application' %>
17
- <%= include_tiny_mce_if_needed if tiny_mce_plugin_installed? %>
17
+ <%= include_tiny_mce_if_needed if defined?(TinyMCE) %>
18
18
  <%= yield :javascripts -%>
19
19
 
20
20
  </head>
@@ -4,24 +4,17 @@ class TypusGenerator < Rails::Generator::Base
4
4
 
5
5
  record do |m|
6
6
 
7
- ##
8
7
  # Default name for our application.
9
- #
10
-
11
8
  application = Rails.root.basename
12
9
 
13
- ##
14
- # To create <tt>application.yml</tt> and <tt>application_roles.yml</tt> detect
15
- # available AR models on the application.
16
- #
17
-
18
- models = Dir["#{Rails.root}/app/models/*.rb"].collect { |x| File.basename(x) }
10
+ # To create <tt>application.yml</tt> and <tt>application_roles.yml</tt>
11
+ # detect available AR models on the application.
12
+ models = Dir['app/models/*.rb'].collect { |x| File.basename(x).sub(/\.rb$/,'').camelize }
19
13
  ar_models = []
20
14
 
21
15
  models.each do |model|
22
- class_name = model.sub(/\.rb$/,'').classify
23
16
  begin
24
- klass = class_name.constantize
17
+ klass = model.constantize
25
18
  active_record_model = klass.superclass.equal?(ActiveRecord::Base) && !klass.abstract_class?
26
19
  active_record_model_with_sti = klass.superclass.superclass.equal?(ActiveRecord::Base)
27
20
  ar_models << klass if active_record_model || active_record_model_with_sti
@@ -30,13 +23,9 @@ class TypusGenerator < Rails::Generator::Base
30
23
  end
31
24
  end
32
25
 
33
- ##
34
26
  # Configuration files
35
- #
36
-
37
27
  config_folder = Typus::Configuration.options[:config_folder]
38
- folder = "#{Rails.root}/#{config_folder}"
39
- Dir.mkdir(folder) unless File.directory?(folder)
28
+ Dir.mkdir(config_folder) unless File.directory?(config_folder)
40
29
 
41
30
  configuration = { :base => '', :roles => '' }
42
31
 
@@ -58,10 +47,8 @@ class TypusGenerator < Rails::Generator::Base
58
47
 
59
48
  # Don't show `text` fields and timestamps in lists.
60
49
  list = model_columns.reject { |c| c.sql_type == 'text' || %w( created_at updated_at ).include?(c.name) }.map(&:name)
61
-
62
50
  # Don't show timestamps in forms.
63
51
  form = model_columns.reject { |c| %w( id created_at updated_at ).include?(c.name) }.map(&:name)
64
-
65
52
  # Show all model columns in the show action.
66
53
  show = model_columns.map(&:name)
67
54
 
@@ -102,35 +89,28 @@ class TypusGenerator < Rails::Generator::Base
102
89
  :assigns => { :configuration => configuration }
103
90
  end
104
91
 
105
- ##
106
- # Initializers
107
- #
92
+ # Initializer
108
93
 
109
- m.template 'config/initializers/typus.rb', 'config/initializers/typus.rb',
110
- :assigns => { :application => application }
94
+ [ 'config/initializers/typus.rb' ].each do |initializer|
95
+ m.template initializer, initializer, :assigns => { :application => application }
96
+ end
111
97
 
112
- ##
113
- # Public folders
114
- #
98
+ # Assets
115
99
 
116
- [ "#{Rails.root}/public/stylesheets/admin",
117
- "#{Rails.root}/public/javascripts/admin",
118
- "#{Rails.root}/public/images/admin" ].each do |folder|
119
- Dir.mkdir(folder) unless File.directory?(folder)
120
- end
100
+ [ 'public/stylesheets/admin',
101
+ 'public/javascripts/admin',
102
+ 'public/images/admin' ].each { |f| Dir.mkdir(f) unless File.directory?(f) }
121
103
 
122
- m.file 'public/stylesheets/admin/screen.css', 'public/stylesheets/admin/screen.css'
123
- m.file 'public/stylesheets/admin/reset.css', 'public/stylesheets/admin/reset.css'
124
- m.file 'public/javascripts/admin/application.js', 'public/javascripts/admin/application.js'
104
+ [ 'public/stylesheets/admin/screen.css',
105
+ 'public/stylesheets/admin/reset.css',
106
+ 'public/javascripts/admin/application.js' ].each { |f| m.file f, f }
125
107
 
126
108
  Dir["#{Typus.path}/generators/typus/templates/public/images/admin/*"].each do |f|
127
- base = File.basename(f)
128
- m.file "public/images/admin/#{base}", "public/images/admin/#{base}"
109
+ file = "public/images/admin/#{File.basename(f)}"
110
+ m.file file, file
129
111
  end
130
112
 
131
- ##
132
113
  # Migration file
133
- #
134
114
 
135
115
  m.migration_template 'db/create_typus_users.rb', 'db/migrate',
136
116
  { :migration_file_name => 'create_typus_users' }
@@ -102,7 +102,7 @@ module Typus
102
102
  end
103
103
 
104
104
  ##
105
- # Tiny_mce fields of the model
105
+ # Tiny_mce fields of the model
106
106
  #
107
107
  def typus_tiny_mce_fields
108
108
  Typus::Configuration.config[name]['fields']['options']['tiny_mce']['fields'].split(', ')
@@ -134,7 +134,7 @@ module Typus
134
134
  end
135
135
 
136
136
  ##
137
- # Extended actions for this model on Typus.
137
+ # Extended actions for this model on Typus.
138
138
  #
139
139
  def typus_actions_for(filter)
140
140
  Typus::Configuration.config[name]['actions'][filter.to_s].split(', ')
data/typus.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{typus}
5
- s.version = "0.9.14"
5
+ s.version = "0.9.15"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Francesc Esplugas"]
9
- s.date = %q{2009-07-01}
9
+ s.date = %q{2009-07-03}
10
10
  s.description = %q{Effortless backend interface for Ruby on Rails applications. (Admin scaffold generator.)}
11
11
  s.email = %q{francesc@intraducibles.com}
12
12
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fesplugas-typus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesc Esplugas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-01 00:00:00 -07:00
12
+ date: 2009-07-03 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15