inline_forms 1.1.20 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ end
15
15
  Signal.trap("INT") { puts; exit }
16
16
 
17
17
  src = File.join(File.dirname(__FILE__), "..")
18
-
18
+ require "#{src}/lib/inline_forms/version.rb"
19
19
 
20
20
  USAGE = "
21
21
  USAGE: inline_forms <options> <app-name>
@@ -29,6 +29,7 @@ Options:
29
29
  --skip-db-setup # skip setup of mysql development database
30
30
  --help # show this message
31
31
 
32
+ VERSION: #{InlineForms::VERSION}
32
33
  "
33
34
 
34
35
 
@@ -144,13 +145,13 @@ puts "\nDevise User model install with added name field..."
144
145
  system('bundle exec rails g devise User name:string')
145
146
  puts "\nInstall ckeditor..."
146
147
  system('bundle exec rails g ckeditor:install')
147
- puts "Create config file in app/assets/javascripts/ckeditor/config.js"
148
- FileUtils.mkdir_p 'app/assets/javascripts/ckeditor'
149
- system("cp #{src}/app/assets/javascripts/ckeditor/config.js app/assets/javascripts/ckeditor")
150
- puts "Add remotipart to app/assets/javascripts/application.js..."
151
- system('echo >> app/assets/javascripts/application.js')
152
- system('echo "//= require jquery.remotipart" >> app/assets/javascripts/application.js')
153
- system('echo >> app/assets/javascripts/application.js')
148
+ puts "Create config file in lib/app/assets/javascripts/ckeditor/config.js"
149
+ FileUtils.mkdir_p 'lib/app/assets/javascripts/ckeditor'
150
+ system("cp #{src}/lib/app/assets/javascripts/ckeditor/config.js lib/app/assets/javascripts/ckeditor")
151
+ puts "Add remotipart to lib/app/assets/javascripts/application.js..."
152
+ system('echo >> lib/app/assets/javascripts/application.js')
153
+ system('echo "//= require jquery.remotipart" >> lib/app/assets/javascripts/application.js')
154
+ system('echo >> lib/app/assets/javascripts/application.js')
154
155
  puts "Paper_trail install..."
155
156
  system('bundle exec rails g paper_trail:install')
156
157
 
@@ -162,7 +163,7 @@ else
162
163
  system('bundle exec rake db:migrate')
163
164
  end
164
165
 
165
- puts "Creating header in app/views/inline_forms/_header.html.erb...\n"
166
+ puts "Creating header in lib/app/views/inline_forms/_header.html.erb...\n"
166
167
  header_src = "
167
168
  <div id='Header'>
168
169
  <div id='title'>
@@ -176,8 +177,8 @@ header_src = "
176
177
  <div style='clear: both;'></div>
177
178
  </div>
178
179
  "
179
- FileUtils.mkdir_p 'app/views/inline_forms'
180
- File.open( 'app/views/inline_forms/_header.html.erb', 'w') {|f| f.write(header_src) }
180
+ FileUtils.mkdir_p 'lib/app/views/inline_forms'
181
+ File.open( 'lib/app/views/inline_forms/_header.html.erb', 'w') {|f| f.write(header_src) }
181
182
 
182
183
  puts "Capify...\n"
183
184
  system('capify .')
@@ -1,11 +1,18 @@
1
+ //http://flowplayer.org/tools/forum/30/37281
1
2
  $(document).ready(function() {
2
- $(document).delegate(".attribute_name", "mouseover", function() {
3
+ $(document).delegate(".has_validations", "mouseover", function() {
3
4
  if (!$(this).data("tooltip")) {
4
5
  $(this).tooltip({
5
6
  effect: "fade",
6
- predelay: 200
7
+ fadeInSpeed: 300,
8
+ fadeOutSpeed: 150,
9
+ opacity: 0.9,
10
+ position: 'top right',
11
+ offset: [ 25, 20 ],
12
+ // positioning is NOT according to documentation! Should be relative to parent element but it is not.'
13
+ relative: true
7
14
  });
8
15
  $(this).trigger("mouseover");
9
16
  }
10
17
  });
11
- });
18
+ });
@@ -134,6 +134,10 @@ a {
134
134
  -webkit-border-radius: 5px;
135
135
  }
136
136
 
137
+ .edit_form_field {
138
+ position: relative;
139
+ }
140
+
137
141
  .edit_form_checklist ul {
138
142
  list-style-type: none;
139
143
  }
@@ -1,9 +1,17 @@
1
1
  .validation_help_tooltip {
2
- display:none;
3
- height:163px;
4
- padding:40px 30px 10px 30px;
5
- width:310px;
6
- font-size:11px;
7
- color:#fff;
8
- background-color: #B94C32
9
- }
2
+ display: none;
3
+ width: 250px;
4
+ height: 175px;
5
+ background-image: url('/assets/tooltip-bubble-up-left.png');
6
+ background-color: transparent;
7
+ }
8
+
9
+ .validation_help_content {
10
+ margin-top: 18px;
11
+ margin-left: 18px;
12
+ font-size: 9pt;
13
+ color: #3399cc;
14
+ height: 100px;
15
+ width: 215px;
16
+ overflow: auto;
17
+ }
@@ -13,6 +13,10 @@ module InlineFormsHelper
13
13
  InlineForms::VERSION
14
14
  end
15
15
 
16
+ def has_validations(object, attribute)
17
+ "has_validations " unless object.class.validators_on(attribute).empty?
18
+ end
19
+
16
20
  def validation_help_as_list_for(object, attribute)
17
21
  "" and return if object.class.validators_on(attribute).empty?
18
22
  content_tag(:ul, validation_help_for(object, attribute).map { |help_message| content_tag(:li, help_message ) }.to_s.html_safe )
@@ -24,9 +24,16 @@
24
24
  <% css_class_id = "attribute_#{attribute}_#{@object.id}" -%>
25
25
  <tr>
26
26
  <td valign="top">
27
- <div class='<%= "attribute_name attribute_#{attribute} form_element_#{form_element}" -%>' >
27
+ <div class='<%= has_validations(@object, attribute) -%><%= "attribute_name attribute_#{attribute} form_element_#{form_element}" -%>' >
28
28
  <%= h(name) -%>
29
29
  </div>
30
+ <% if has_validations(@object, attribute) %>
31
+ <div class='validation_help_tooltip'>
32
+ <div class='validation_help_content'>
33
+ <%= validation_help_as_list_for(@object, attribute) -%>
34
+ </div>
35
+ </div>
36
+ <% end -%>
30
37
  </td>
31
38
  <td valign="top">
32
39
  <div class='<%= "attribute_value attribute_#{attribute} form_element_#{form_element}" -%>' >
@@ -51,6 +58,6 @@
51
58
  <div style="clear: both;"></div>
52
59
  <% end %>
53
60
  </li>
54
- <script type="text/javascript">
55
- $(function() { $("#newnew").slideDown(4000); } );
56
- </script>
61
+ <script type="text/javascript">
62
+ $(function() { $("#newnew").slideDown(4000); } );
63
+ </script>
@@ -16,12 +16,16 @@
16
16
  <% css_class_id = "#{@object.class.to_s.underscore}_#{@object.id}_#{attribute}" -%>
17
17
  <tr>
18
18
  <td valign="top">
19
- <div class='<%= "attribute_name attribute_#{attribute} form_element_#{form_element}" -%>' >
19
+ <div class='<%= has_validations(@object, attribute) -%><%= "attribute_name attribute_#{attribute} form_element_#{form_element}" -%>' >
20
20
  <%= h(name) -%>
21
21
  </div>
22
- <div class='validation_help_tooltip'>
23
- <%= validation_help_as_list_for(@object, attribute) -%>
24
- </div>
22
+ <% if has_validations(@object, attribute) %>
23
+ <div class='validation_help_tooltip'>
24
+ <div class='validation_help_content'>
25
+ <%= validation_help_as_list_for(@object, attribute) -%>
26
+ </div>
27
+ </div>
28
+ <% end -%>
25
29
  </td>
26
30
  <td valign="top">
27
31
  <div class='<%= "attribute_value attribute_#{attribute} form_element_#{form_element}" -%>' >
@@ -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 app/models/thing.rb
10
- create app/controllers/things_controller.rb
9
+ create lib/app/models/thing.rb
10
+ create lib/app/controllers/things_controller.rb
11
11
  route resources :things
12
12
  create db/migrate/20110204074707_inline_forms_create_things.rb
13
13
 
14
- app/models/thing.rb:
14
+ lib/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
- app/controllers/things_controller.rb
29
+ lib/app/controllers/things_controller.rb
30
30
  class ThingsController < InlineFormsController
31
31
  end
32
32
 
@@ -153,7 +153,7 @@ module InlineForms
153
153
  " end\n" +
154
154
  "\n"
155
155
  end
156
- template "model.erb", "app/models/#{model_file_name}.rb"
156
+ template "model.erb", "lib/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", "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",
192
+ copy_file "_inline_forms_tabs.html.erb", "lib/app/views/_inline_forms_tabs.html.erb" unless File.exists?('lib/app/views/_inline_forms_tabs.html.erb')
193
+ inject_into_file "lib/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", "app/controllers/#{controller_file_name}.rb" if @flag_create_controller
200
+ template "controller.erb", "lib/app/controllers/#{controller_file_name}.rb" if @flag_create_controller
201
201
  end
202
202
 
203
203
 
@@ -41,7 +41,7 @@ module InlineForms
41
41
  }
42
42
 
43
43
  # DEFAULT_FORM_ELEMENTS holds a mapping from Default Column Types to
44
- # Form Elements. Form Elements are defined in app/helpers/form_elements
44
+ # Form Elements. Form Elements are defined in lib/app/helpers/form_elements
45
45
  # and are pieces of code that display a form for a field.
46
46
  #
47
47
  # Example:
@@ -73,10 +73,10 @@ module InlineForms
73
73
  }
74
74
 
75
75
  # SPECIAL_COLUMN_TYPES maps the column types that we define here and in
76
- # app/helpers/form_elements to the standard ActiveRecord::Migration column
76
+ # lib/app/helpers/form_elements to the standard ActiveRecord::Migration column
77
77
  # types
78
78
  #
79
- # Example: in app/helpers/form_elements/dropdown.rb
79
+ # Example: in lib/app/helpers/form_elements/dropdown.rb
80
80
  # InlineForms::SPECIAL_COLUMN_TYPES[:dropdown]=:belongs_to
81
81
  # this maps the :dropdown form element to the :belongs_to column type.
82
82
  #
@@ -1,3 +1,3 @@
1
1
  module InlineForms
2
- VERSION = "1.1.20"
2
+ VERSION = "1.2.0"
3
3
  end
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: 59
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
9
- - 20
10
- version: 1.1.20
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ace Suares
@@ -113,6 +113,10 @@ files:
113
113
  - lib/app/assets/images/add.png
114
114
  - lib/app/assets/images/close.png
115
115
  - lib/app/assets/images/glass_plate.gif
116
+ - lib/app/assets/images/tooltip-bubble-down-left.png
117
+ - lib/app/assets/images/tooltip-bubble-down-right.png
118
+ - lib/app/assets/images/tooltip-bubble-up-left.png
119
+ - lib/app/assets/images/tooltip-bubble-up-right.png
116
120
  - lib/app/assets/images/trash.png
117
121
  - lib/app/assets/images/ui-bg_diagonals-medium_20_d34d17_40x40.png
118
122
  - lib/app/assets/images/ui-bg_flat_30_cccccc_40x100.png