inline_forms 1.2.0 → 1.2.1
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/README.rdoc +2 -2
- data/bin/inline_forms +10 -10
- data/lib/generators/{inline_forms/USAGE → USAGE} +4 -4
- data/lib/generators/{inline_forms/inline_forms_generator.rb → inline_forms_generator.rb} +8 -8
- data/lib/generators/{inline_forms/templates → templates}/_inline_forms_tabs.html.erb +0 -0
- data/lib/generators/{inline_forms/templates → templates}/controller.erb +0 -0
- data/lib/generators/{inline_forms/templates → templates}/migration.erb +0 -0
- data/lib/generators/{inline_forms/templates → templates}/model.erb +0 -0
- data/lib/inline_forms/version.rb +1 -1
- metadata +9 -9
data/README.rdoc
CHANGED
@@ -7,9 +7,9 @@ Inline Forms is almost a complete admin application. You can try it out easily.
|
|
7
7
|
gem install inline_forms
|
8
8
|
inline_forms MyAppName
|
9
9
|
cd MyAppName
|
10
|
-
rails g inline_forms Picture name:string caption:string image:image_field description:text apartment:belongs_to _presentation:'#{name}' -f
|
10
|
+
rails g inline_forms:install Picture name:string caption:string image:image_field description:text apartment:belongs_to _presentation:'#{name}' -f
|
11
11
|
rails generate uploader Image
|
12
|
-
rails g inline_forms Apartment name:string title:string description:text pictures:has_many pictures:associated _enabled:yes _presentation:'#{name}' -f
|
12
|
+
rails g inline_forms:install Apartment name:string title:string description:text pictures:has_many pictures:associated _enabled:yes _presentation:'#{name}' -f
|
13
13
|
bundle exec rake db:migrate
|
14
14
|
rails s
|
15
15
|
|
data/bin/inline_forms
CHANGED
@@ -145,13 +145,13 @@ puts "\nDevise User model install with added name field..."
|
|
145
145
|
system('bundle exec rails g devise User name:string')
|
146
146
|
puts "\nInstall ckeditor..."
|
147
147
|
system('bundle exec rails g ckeditor:install')
|
148
|
-
puts "Create config file in
|
149
|
-
FileUtils.mkdir_p '
|
150
|
-
system("cp #{src}/lib/app/assets/javascripts/ckeditor/config.js
|
151
|
-
puts "Add remotipart to
|
152
|
-
system('echo >>
|
153
|
-
system('echo "//= require jquery.remotipart" >>
|
154
|
-
system('echo >>
|
148
|
+
puts "Create config file in app/assets/javascripts/ckeditor/config.js"
|
149
|
+
FileUtils.mkdir_p 'app/assets/javascripts/ckeditor'
|
150
|
+
system("cp #{src}/lib/app/assets/javascripts/ckeditor/config.js app/assets/javascripts/ckeditor")
|
151
|
+
puts "Add remotipart to app/assets/javascripts/application.js..."
|
152
|
+
system('echo >> app/assets/javascripts/application.js')
|
153
|
+
system('echo "//= require jquery.remotipart" >> app/assets/javascripts/application.js')
|
154
|
+
system('echo >> app/assets/javascripts/application.js')
|
155
155
|
puts "Paper_trail install..."
|
156
156
|
system('bundle exec rails g paper_trail:install')
|
157
157
|
|
@@ -163,7 +163,7 @@ else
|
|
163
163
|
system('bundle exec rake db:migrate')
|
164
164
|
end
|
165
165
|
|
166
|
-
puts "Creating header in
|
166
|
+
puts "Creating header in app/views/inline_forms/_header.html.erb...\n"
|
167
167
|
header_src = "
|
168
168
|
<div id='Header'>
|
169
169
|
<div id='title'>
|
@@ -177,8 +177,8 @@ header_src = "
|
|
177
177
|
<div style='clear: both;'></div>
|
178
178
|
</div>
|
179
179
|
"
|
180
|
-
FileUtils.mkdir_p '
|
181
|
-
File.open( '
|
180
|
+
FileUtils.mkdir_p 'app/views/inline_forms'
|
181
|
+
File.open( 'app/views/inline_forms/_header.html.erb', 'w') {|f| f.write(header_src) }
|
182
182
|
|
183
183
|
puts "Capify...\n"
|
184
184
|
system('capify .')
|
@@ -6,12 +6,12 @@ Example:
|
|
6
6
|
rails generate inline_forms Thing name:text_field description:text_area yesno:check_box gender:boolean_with_values
|
7
7
|
|
8
8
|
This will create:
|
9
|
-
create
|
10
|
-
create
|
9
|
+
create app/models/thing.rb
|
10
|
+
create app/controllers/things_controller.rb
|
11
11
|
route resources :things
|
12
12
|
create db/migrate/20110204074707_inline_forms_create_things.rb
|
13
13
|
|
14
|
-
|
14
|
+
app/models/thing.rb:
|
15
15
|
class Thing < ActiveRecord::Base
|
16
16
|
def _presentation
|
17
17
|
#define your presentation here
|
@@ -26,7 +26,7 @@ This will create:
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
app/controllers/things_controller.rb
|
30
30
|
class ThingsController < InlineFormsController
|
31
31
|
end
|
32
32
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'../app/helpers/inline_forms_helper.rb'))
|
1
2
|
module InlineForms
|
2
3
|
# == Usage
|
3
4
|
# This generator generates a migration, a model and a controller.
|
@@ -15,7 +16,7 @@ module InlineForms
|
|
15
16
|
# This attribute_type maps column types to form attribute helpers like text_field.
|
16
17
|
# We override it here to make our own.
|
17
18
|
#
|
18
|
-
class
|
19
|
+
class InlineFormsGenerator < Rails::Generators::NamedBase
|
19
20
|
Rails::Generators::GeneratedAttribute.class_eval do #:doc:
|
20
21
|
# Deducts the column_type for migrations from the type.
|
21
22
|
#
|
@@ -70,8 +71,7 @@ module InlineForms
|
|
70
71
|
end
|
71
72
|
argument :attributes, :type => :array, :banner => "[name:form_element]..."
|
72
73
|
|
73
|
-
source_root File.expand_path('
|
74
|
-
|
74
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
75
75
|
|
76
76
|
# using flags.
|
77
77
|
def set_some_flags
|
@@ -105,7 +105,7 @@ module InlineForms
|
|
105
105
|
if attribute.column_type == :belongs_to # :drop_down, :references and :belongs_to all end up with the column_type :belongs_to
|
106
106
|
@belongs_to << ' belongs_to :' + attribute.name + "\n"
|
107
107
|
end
|
108
|
-
if attribute.
|
108
|
+
if attribute.type == :image_field # upload images via carrierwave
|
109
109
|
@carrierwave_mounters << ' mount_uploader :' + attribute.name + ', ' + "#{attribute.name}_uploader".camelcase + "\n"
|
110
110
|
end
|
111
111
|
if attribute.type == :has_many ||
|
@@ -153,7 +153,7 @@ module InlineForms
|
|
153
153
|
" end\n" +
|
154
154
|
"\n"
|
155
155
|
end
|
156
|
-
template "model.erb", "
|
156
|
+
template "model.erb", "app/models/#{model_file_name}.rb"
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
@@ -189,15 +189,15 @@ module InlineForms
|
|
189
189
|
|
190
190
|
def add_tab
|
191
191
|
unless @flag_not_accessible_through_html
|
192
|
-
copy_file "_inline_forms_tabs.html.erb", "
|
193
|
-
inject_into_file "
|
192
|
+
copy_file "_inline_forms_tabs.html.erb", "app/views/_inline_forms_tabs.html.erb" unless File.exists?('app/views/_inline_forms_tabs.html.erb')
|
193
|
+
inject_into_file "app/views/_inline_forms_tabs.html.erb",
|
194
194
|
" <%= tab.#{name.underscore} '#{name}', #{name.pluralize.underscore + '_path'} %>\n",
|
195
195
|
:after => "<% tabs_tag :open_tabs => { :id => \"tabs\" } do |tab| %>\n"
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
199
|
def generate_controller
|
200
|
-
template "controller.erb", "
|
200
|
+
template "controller.erb", "app/controllers/#{controller_file_name}.rb" if @flag_create_controller
|
201
201
|
end
|
202
202
|
|
203
203
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/inline_forms/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ace Suares
|
@@ -195,12 +195,12 @@ files:
|
|
195
195
|
- lib/app/views/inline_forms/update.js.erb
|
196
196
|
- lib/app/views/layouts/devise.html.erb
|
197
197
|
- lib/app/views/layouts/inline_forms.html.erb
|
198
|
-
- lib/generators/
|
199
|
-
- lib/generators/
|
200
|
-
- lib/generators/
|
201
|
-
- lib/generators/
|
202
|
-
- lib/generators/
|
203
|
-
- lib/generators/
|
198
|
+
- lib/generators/USAGE
|
199
|
+
- lib/generators/inline_forms_generator.rb
|
200
|
+
- lib/generators/templates/_inline_forms_tabs.html.erb
|
201
|
+
- lib/generators/templates/controller.erb
|
202
|
+
- lib/generators/templates/migration.erb
|
203
|
+
- lib/generators/templates/model.erb
|
204
204
|
- lib/inline_forms.rb
|
205
205
|
- lib/inline_forms/version.rb
|
206
206
|
- lib/otherstuff/add_roles.sql
|