inline_forms 1.3.48 → 1.3.49

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 CHANGED
@@ -5,21 +5,37 @@ Inline Forms is almost a complete admin application. You can try it out easily.
5
5
  = Usage
6
6
 
7
7
  gem install inline_forms
8
- inline_forms create MyAppName
9
- cd MyAppName
8
+
9
+ If you want to just start a new app called MyApp:
10
+
11
+ inline_forms create MyApp
12
+
13
+ If you want to use mysql instead of sqlite as development database:
14
+
15
+ inline_forms create MyApp --database mysql
16
+
17
+ If you want to install the example application:
18
+
19
+ inline_forms create MyApp --example
20
+
21
+ You can install the example application manually if you like:
22
+
23
+ inline_forms create MyApp
24
+ cd MyApp
10
25
  rails g inline_forms Picture name:string caption:string image:image_field description:text apartment:belongs_to _presentation:'#{name}'
11
26
  rails generate uploader Image
12
27
  rails g inline_forms Apartment name:string title:string description:text pictures:has_many pictures:associated _enabled:yes _presentation:'#{name}'
13
28
  bundle exec rake db:migrate
14
29
  rails s
15
30
 
16
- point your browser to http://localhost:3000/apartments (make sure JavaScript is enabled)
31
+ Now point your browser to http://localhost:3000/apartments and make sure JavaScript is enabled.
32
+
33
+ == Disclaimer
17
34
 
18
- It's work in progress.
35
+ It's work in progress. Until I learn to use git branch, new releases break as easy as Elijah Price's bones.
19
36
 
20
37
 
21
38
  == Copyright
22
39
 
23
- Copyright (c) 2011 Ace Suares. See LICENSE.txt for
24
- further details.
40
+ Copyright (c) 2011-2012 Ace Suares. See LICENSE.txt for further details.
25
41
 
data/bin/inline_forms CHANGED
@@ -32,17 +32,33 @@ module InlineForms
32
32
  DATABASE_OPTIONS = %w(sqlite mysql)
33
33
  method_option :database, :aliases => "-d", :default => DATABASE_OPTIONS.first, :banner => DATABASE_OPTIONS.join('|'), :desc => 'specify development database'
34
34
  method_option :dry, :type => :boolean, :desc => 'dry run. Do not do most things. Only useful for development of inline_forms'
35
+ method_option :example, :type => :boolean, :desc => 'install the example app. incompatible with --dry and uses sqlite as development database'
35
36
 
36
37
  def create(app_name)
37
38
 
38
- def dry_run?
39
+ def self.dry_run?
39
40
  options[:dry]
40
41
  end
41
42
 
42
- options_database = DATABASE_OPTIONS.include?(options[:database]) ? options[:database] : DATABASE_OPTIONS.first
43
+ def self.install_example?
44
+ options[:example]
45
+ end
46
+
47
+ database = DATABASE_OPTIONS.include?(options[:database]) ? options[:database] : DATABASE_OPTIONS.first
48
+
49
+ if install_example? && dry_run?
50
+ say "--example and --dry-run can not be used together", :red
51
+ exit 1
52
+ end
53
+
54
+ if install_example? && (database != 'sqlite')
55
+ say "--example can only be used with an sqlite development database", :red
56
+ exit 1
57
+ end
43
58
 
44
59
  say "This is a dry run. I hope you know what you are doing...", :red if dry_run?
45
- say "Creating #{app_name} with inline_forms v#{VERSION} and development database #{options_database}...", :green
60
+
61
+ say "Creating #{app_name} with inline_forms v#{VERSION} and development database #{database}...", :green
46
62
 
47
63
  regex = /\A[0-9a-zA-Z][0-9a-zA-Z_-]+[0-9a-zA-Z]\Z/
48
64
  if ! regex.match(app_name)
@@ -62,7 +78,7 @@ module InlineForms
62
78
  say "- Creating and trusting .rvmrc..."
63
79
  ruby_version = %x[rvm current]
64
80
  create_file "#{app_name}/.rvmrc", "rvm use #{ruby_version.chop}@#{app_name} --create"
65
- say ("- " + %x[cd #{app_name} && rvm rvmrc trust .rvmrc]).chop, :green
81
+ say ("- " + %x[cd #{app_name} && rvm rvmrc trust .rvmrc]).chop
66
82
 
67
83
  say "- Changing to '#{app_name}' with RVM..."
68
84
  RVM.chdir(app_name) do
@@ -123,9 +139,9 @@ module InlineForms
123
139
  say "- Running bundle..."
124
140
  system "bundle install" unless dry_run?
125
141
 
126
- say "- Database setup: creating config/database.yml with development database #{options_database}"
142
+ say "- Database setup: creating config/database.yml with development database #{database}"
127
143
  remove_file "#{app_name}/config/database.yml" # the one that 'rails new' created
128
- if options_database == 'mysql'
144
+ if database == 'mysql'
129
145
  create_file "#{app_name}/config/database.yml", <<-END_DATABASEYML.strip_heredoc_with_indent
130
146
  development:
131
147
  adapter: mysql2
@@ -271,8 +287,19 @@ module InlineForms
271
287
  RVM.run 'git add .'
272
288
  RVM.run 'git commit -a -m " * Initial"'
273
289
 
274
- say "\nDone! Now make your tables with 'rails g inline_forms ...", :green
275
- #say "- Don't forget: edit .rvmrc, config/{routes.rb, deploy.rb}, .git/config, delete public/index.html\n"
290
+ if install_example?
291
+ say "\nInstalling example application..."
292
+ RVM.run 'rails g inline_forms Picture name:string caption:string image:image_field description:text apartment:belongs_to _presentation:\'#{name}\''
293
+ RVM.run 'rails generate uploader Image'
294
+ RVM.run 'rails g inline_forms Apartment name:string title:string description:text pictures:has_many pictures:associated _enabled:yes _presentation:\'#{name}\''
295
+ RVM.run 'bundle exec rake db:migrate'
296
+ say "\nDone! Now point your browser to http://localhost:3000/apartments !", :yellow
297
+ say "\nPress ctlr-C to quit...", :yellow
298
+ RVM.run 'rails s'
299
+ else
300
+ say "\nDone! Now make your tables with 'rails g inline_forms ...", :yellow
301
+ #say "- Don't forget: edit .rvmrc, config/{routes.rb, deploy.rb}, .git/config, delete public/index.html\n"
302
+ end
276
303
 
277
304
  end
278
305
  end
@@ -2,12 +2,16 @@
2
2
  InlineForms::SPECIAL_COLUMN_TYPES[:image_field]=:string
3
3
 
4
4
  def image_field_show(object, attribute)
5
- # if object.send(attribute).send(:present?)
6
- # title = "Full Size: #{object.send(attribute).send(:url)}.<br />" + image_tag(object.send(attribute).send(:palm).send(:url))
7
- # else
8
- # title = ''
9
- # end
10
- link_to_inline_edit object, attribute, object.send(attribute).send(:present?) ? image_tag(object.send(attribute).send(:palm).send(:url)) : object.send(attribute).to_s
5
+ o = object.send(attribute)
6
+ msg = o.to_s
7
+ if o.send(:present?)
8
+ if o.respond_to? :palm
9
+ msg = image_tag(o.send(:palm).send(:url))
10
+ else
11
+ msg = image_tag(o.send(:url))
12
+ end
13
+ end
14
+ link_to_inline_edit object, attribute, msg
11
15
  end
12
16
 
13
17
  def image_field_edit(object, attribute)
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "1.3.48"
3
+ VERSION = "1.3.49"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.48
4
+ version: 1.3.49
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: