jintastic 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/MIT-LICENSE +21 -0
  4. data/README.md +97 -0
  5. data/Rakefile +59 -0
  6. data/VERSION.yml +5 -0
  7. data/assets/app/views/jintastic/_in_place_editor.html.erb +16 -0
  8. data/assets/public/javascripts/jintastic.js +35 -0
  9. data/config/locale/en.yml +4 -0
  10. data/init.rb +3 -0
  11. data/jintastic.gemspec +111 -0
  12. data/lib/jintastic.rb +61 -0
  13. data/test/jintastic_test.rb +7 -0
  14. data/test/test_helper.rb +10 -0
  15. data/vendor/plugins/formtastic/.gitignore +5 -0
  16. data/vendor/plugins/formtastic/MIT-LICENSE +20 -0
  17. data/vendor/plugins/formtastic/README.textile +553 -0
  18. data/vendor/plugins/formtastic/RELEASE_PROCESS +11 -0
  19. data/vendor/plugins/formtastic/Rakefile +101 -0
  20. data/vendor/plugins/formtastic/VERSION.yml +4 -0
  21. data/vendor/plugins/formtastic/formtastic.gemspec +142 -0
  22. data/vendor/plugins/formtastic/generators/form/USAGE +16 -0
  23. data/vendor/plugins/formtastic/generators/form/form_generator.rb +120 -0
  24. data/vendor/plugins/formtastic/generators/form/templates/view__form.html.erb +5 -0
  25. data/vendor/plugins/formtastic/generators/form/templates/view__form.html.haml +4 -0
  26. data/vendor/plugins/formtastic/generators/formtastic/formtastic_generator.rb +24 -0
  27. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic.css +144 -0
  28. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic_changes.css +10 -0
  29. data/vendor/plugins/formtastic/generators/formtastic/templates/formtastic_config.rb +54 -0
  30. data/vendor/plugins/formtastic/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb +16 -0
  31. data/vendor/plugins/formtastic/install.rb +2 -0
  32. data/vendor/plugins/formtastic/lib/formtastic.rb +1687 -0
  33. data/vendor/plugins/formtastic/lib/formtastic/i18n.rb +32 -0
  34. data/vendor/plugins/formtastic/lib/locale/en.yml +8 -0
  35. data/vendor/plugins/formtastic/rails/init.rb +3 -0
  36. data/vendor/plugins/formtastic/spec/buttons_spec.rb +149 -0
  37. data/vendor/plugins/formtastic/spec/commit_button_spec.rb +369 -0
  38. data/vendor/plugins/formtastic/spec/custom_builder_spec.rb +62 -0
  39. data/vendor/plugins/formtastic/spec/custom_macros.rb +561 -0
  40. data/vendor/plugins/formtastic/spec/defaults_spec.rb +20 -0
  41. data/vendor/plugins/formtastic/spec/error_proc_spec.rb +27 -0
  42. data/vendor/plugins/formtastic/spec/errors_spec.rb +85 -0
  43. data/vendor/plugins/formtastic/spec/form_helper_spec.rb +126 -0
  44. data/vendor/plugins/formtastic/spec/i18n_spec.rb +131 -0
  45. data/vendor/plugins/formtastic/spec/include_blank_spec.rb +70 -0
  46. data/vendor/plugins/formtastic/spec/input_spec.rb +628 -0
  47. data/vendor/plugins/formtastic/spec/inputs/boolean_input_spec.rb +93 -0
  48. data/vendor/plugins/formtastic/spec/inputs/check_boxes_input_spec.rb +162 -0
  49. data/vendor/plugins/formtastic/spec/inputs/country_input_spec.rb +80 -0
  50. data/vendor/plugins/formtastic/spec/inputs/date_input_spec.rb +60 -0
  51. data/vendor/plugins/formtastic/spec/inputs/datetime_input_spec.rb +169 -0
  52. data/vendor/plugins/formtastic/spec/inputs/file_input_spec.rb +33 -0
  53. data/vendor/plugins/formtastic/spec/inputs/hidden_input_spec.rb +52 -0
  54. data/vendor/plugins/formtastic/spec/inputs/numeric_input_spec.rb +44 -0
  55. data/vendor/plugins/formtastic/spec/inputs/password_input_spec.rb +46 -0
  56. data/vendor/plugins/formtastic/spec/inputs/radio_input_spec.rb +149 -0
  57. data/vendor/plugins/formtastic/spec/inputs/select_input_spec.rb +459 -0
  58. data/vendor/plugins/formtastic/spec/inputs/string_input_spec.rb +47 -0
  59. data/vendor/plugins/formtastic/spec/inputs/text_input_spec.rb +33 -0
  60. data/vendor/plugins/formtastic/spec/inputs/time_input_spec.rb +44 -0
  61. data/vendor/plugins/formtastic/spec/inputs/time_zone_input_spec.rb +102 -0
  62. data/vendor/plugins/formtastic/spec/inputs_spec.rb +395 -0
  63. data/vendor/plugins/formtastic/spec/label_spec.rb +48 -0
  64. data/vendor/plugins/formtastic/spec/semantic_errors_spec.rb +98 -0
  65. data/vendor/plugins/formtastic/spec/semantic_fields_for_spec.rb +44 -0
  66. data/vendor/plugins/formtastic/spec/spec.opts +2 -0
  67. data/vendor/plugins/formtastic/spec/spec_helper.rb +218 -0
  68. data/vendor/plugins/formtastic/uninstall.rb +1 -0
  69. metadata +132 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2008 Nandor Komzak
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README.md ADDED
@@ -0,0 +1,97 @@
1
+ #Jintastic
2
+
3
+ Jintastic is a **j**Query based **in**-place editor generated by [Form**tastic**](http://github.com/justinfrench/formtastic/tree/master).
4
+
5
+ ## Features
6
+
7
+ * easy usage
8
+ * you can reuse your partials and controller actions
9
+ * you can edit more than one attribute at once
10
+ * you can use nested resources
11
+
12
+ ## Install
13
+
14
+ **Gem**
15
+
16
+ It’s hosted on Gemcutter, so you’ll need to set that up first, if you haven’t already: gem sources -a http://gemcutter.org/
17
+
18
+ sudo gem install jintastic
19
+
20
+ Add Jintastic as a dependency in your environment.rb file:
21
+
22
+ config.gem 'jintastic'
23
+
24
+ **Plugin**
25
+
26
+ script/plugin install git://github.com/rubymood/jintastic.git
27
+
28
+ ## Usage
29
+
30
+ Having downloaded jQuery(>=1.3.2) include javascript files in your template:
31
+
32
+ <%= javascripts_include_tag 'jquery', 'jintastic' %>
33
+
34
+ **Example**
35
+
36
+ Let's say you have a bookmark resource and you have this haml files:
37
+
38
+ # bookmarks/index.html.haml
39
+ %ul
40
+ = render @bookmarks
41
+
42
+ # bookmarks/_bookmark.html.haml
43
+ %li
44
+ = bookmark.name
45
+
46
+ # bookmarks/edit.html.haml
47
+ -# with formtastic
48
+ - semantic_form_for @bookmark do |f|
49
+ -f.inputs
50
+ = render :partial=>'form', :locals=>{:f=>f}
51
+ = f.commit_button
52
+ -# or with default form_for helper
53
+ - form_for @bookmark do |f|
54
+ = render :partial=>'form'
55
+ = f.submit_tag 'Save'
56
+
57
+ # bookmarks/_form.html.haml
58
+ -# with formtastic
59
+ = f.input :name
60
+ = f.input :url
61
+ -# or with default form_for helper
62
+ = error_messages_for :bookmark
63
+ = f.text_field :name
64
+ = f.text_field :url
65
+
66
+ This is simple. If you organize your views in this way you just follows the rails conventions. Now if you want to in-place editing a bookmark inside your index page just simply do one of the below:
67
+
68
+ # bookmarks/_bookmark.html.haml
69
+ %li{:id=>dom_id(bookmark)} # we are referencing the id later in a js file (see below)
70
+ -# this shows name attribute, and if you click on it, you can edit it
71
+ = in_place_editor_for bookmark, :name
72
+ -# this shows name attribute, and if you click on it, it will show your bookmark form partial
73
+ = in_place_editor_for bookmark, :name=>:form
74
+ -# this shows name attribute, and if you click on it, it will show your custom form partial
75
+ = in_place_editor_for bookmark, :name=>'bookmarks/custom_form'
76
+ -# this shows name attribute, and if you click on it, you can edit both the name and url attributes
77
+ = in_place_editor_for bookmark, :name=>[:name, :bookmark]
78
+ -# so you can edit something else (this shows name attribute, but when you click on it, you will edit the url attribute)
79
+ = in_place_editor_for bookmark, :name=>:url
80
+ -# and finally, you can add nested resource
81
+ = in_place_editor_for [:admin, bookmark], :name
82
+
83
+ Inside your bookmark controller you have to make nothing new. The only thing you have to do is some javascript magic:
84
+
85
+ # bookmarks/update.js.erb
86
+ $('#<%= dom_id @bookmark %>').replaceWith('<%= escape_javascript render @bookmark %>')
87
+
88
+ ## And finally, what happens at validation error?
89
+
90
+ With formtastic input helper the validation errors will be displayed automatic. If you use rails default input helpers you could display the errors in your form partial (see above in the example).
91
+
92
+ ## TODO
93
+
94
+ * some options to customize in place editor form
95
+ * make some tests
96
+
97
+ Copyright (c) 2009 Nandor Komzak, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,59 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "jintastic"
8
+ gem.summary = %Q{jQuery based in-place editor generated by Formtastic}
9
+ gem.email = "nandor.komzak@gmail.com"
10
+ gem.homepage = "http://github.com/rubymood/jintastic"
11
+ gem.authors = ["Nandor Komzak"]
12
+ gem.description = gem.summary
13
+ gem.files.include FileList["{assets}/**/*"]
14
+ gem.add_dependency("formtastic")
15
+ gem.has_rdoc = false
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/*_test.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/*_test.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ if File.exist?('VERSION.yml')
48
+ config = YAML.load(File.read('VERSION.yml'))
49
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "jintastic #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
59
+
data/VERSION.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ :build:
3
+ :major: 1
4
+ :minor: 0
5
+ :patch: 2
@@ -0,0 +1,16 @@
1
+ <div class="in_place_editor_wrapper">
2
+ <%= content_tag container_tag, h(html_text), content_tag_options %>
3
+ <% semantic_form_for path_spec_or_object, form_tag_options do |f| %>
4
+ <% f.inputs do %>
5
+ <% if input_attributes %>
6
+ <% input_attributes.each do |attr| %>
7
+ <%= f.input attr %>
8
+ <% end %>
9
+ <% else %>
10
+ <%= render :partial=>form_partial, :locals=>{:f=>f} %>
11
+ <% end %>
12
+ <% end %>
13
+ <%= f.commit_button :button_html => {:class => 'in_place_save', :style=>"float:left"} %>
14
+ <input type='button' value='<%= I18n.t('formtastic.actions.cancel', :default=>'Cancel') %>' class='in_place_cancel' />
15
+ <% end %>
16
+ </div>
@@ -0,0 +1,35 @@
1
+ (function($){
2
+ $(function(){
3
+ $.inPlaceEditor = {
4
+ toggle: function() {
5
+ $([this.attribute, this.form]).toggle()
6
+
7
+ if (this.form.is(':visible'))
8
+ $.inPlaceEditor.form.find('fieldset li:nth-child(1)')
9
+ }
10
+ }
11
+
12
+ $('.in_place_attribute').live('click', function() {
13
+ $.inPlaceEditor.attribute = $(this)
14
+ $.inPlaceEditor.form = $.inPlaceEditor.attribute.next()
15
+ $.inPlaceEditor.toggle()
16
+ })
17
+
18
+ $('.in_place_save').live('click', function() {
19
+ form = $(this).parents('form') // return size always must be eql 1
20
+ $.ajax({
21
+ url: form.attr('action'),
22
+ type: "POST",
23
+ dataType: "script",
24
+ data: form.serializeArray()
25
+ })
26
+ return false
27
+ })
28
+
29
+ $('.in_place_cancel').live('click', function() {
30
+ $.inPlaceEditor.form = $(this).parent('form')
31
+ $.inPlaceEditor.attribute = $.inPlaceEditor.form.prev()
32
+ $.inPlaceEditor.toggle()
33
+ })
34
+ })
35
+ })(jQuery)
@@ -0,0 +1,4 @@
1
+ en:
2
+ formtastic:
3
+ actions:
4
+ cancel: Cancel
data/init.rb ADDED
@@ -0,0 +1,3 @@
1
+ require File.join File.dirname(__FILE__), *%w{vendor plugins formtastic rails init}
2
+ require 'jintastic'
3
+ I18n.load_path.unshift File.join File.dirname(__FILE__), 'config', 'locale', 'en.yml'
data/jintastic.gemspec ADDED
@@ -0,0 +1,111 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{jintastic}
8
+ s.version = "1.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Nandor Komzak"]
12
+ s.date = %q{2010-02-13}
13
+ s.description = %q{jQuery based in-place editor generated by Formtastic}
14
+ s.email = %q{nandor.komzak@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ ".gitignore",
21
+ "MIT-LICENSE",
22
+ "README.md",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "assets/app/views/jintastic/_in_place_editor.html.erb",
26
+ "assets/public/javascripts/jintastic.js",
27
+ "config/locale/en.yml",
28
+ "init.rb",
29
+ "jintastic.gemspec",
30
+ "lib/jintastic.rb",
31
+ "test/jintastic_test.rb",
32
+ "test/test_helper.rb",
33
+ "vendor/plugins/formtastic/.gitignore",
34
+ "vendor/plugins/formtastic/MIT-LICENSE",
35
+ "vendor/plugins/formtastic/README.textile",
36
+ "vendor/plugins/formtastic/RELEASE_PROCESS",
37
+ "vendor/plugins/formtastic/Rakefile",
38
+ "vendor/plugins/formtastic/VERSION.yml",
39
+ "vendor/plugins/formtastic/formtastic.gemspec",
40
+ "vendor/plugins/formtastic/generators/form/USAGE",
41
+ "vendor/plugins/formtastic/generators/form/form_generator.rb",
42
+ "vendor/plugins/formtastic/generators/form/templates/view__form.html.erb",
43
+ "vendor/plugins/formtastic/generators/form/templates/view__form.html.haml",
44
+ "vendor/plugins/formtastic/generators/formtastic/formtastic_generator.rb",
45
+ "vendor/plugins/formtastic/generators/formtastic/templates/formtastic.css",
46
+ "vendor/plugins/formtastic/generators/formtastic/templates/formtastic_changes.css",
47
+ "vendor/plugins/formtastic/generators/formtastic/templates/formtastic_config.rb",
48
+ "vendor/plugins/formtastic/generators/formtastic_stylesheets/formtastic_stylesheets_generator.rb",
49
+ "vendor/plugins/formtastic/install.rb",
50
+ "vendor/plugins/formtastic/lib/formtastic.rb",
51
+ "vendor/plugins/formtastic/lib/formtastic/i18n.rb",
52
+ "vendor/plugins/formtastic/lib/locale/en.yml",
53
+ "vendor/plugins/formtastic/rails/init.rb",
54
+ "vendor/plugins/formtastic/spec/buttons_spec.rb",
55
+ "vendor/plugins/formtastic/spec/commit_button_spec.rb",
56
+ "vendor/plugins/formtastic/spec/custom_builder_spec.rb",
57
+ "vendor/plugins/formtastic/spec/custom_macros.rb",
58
+ "vendor/plugins/formtastic/spec/defaults_spec.rb",
59
+ "vendor/plugins/formtastic/spec/error_proc_spec.rb",
60
+ "vendor/plugins/formtastic/spec/errors_spec.rb",
61
+ "vendor/plugins/formtastic/spec/form_helper_spec.rb",
62
+ "vendor/plugins/formtastic/spec/i18n_spec.rb",
63
+ "vendor/plugins/formtastic/spec/include_blank_spec.rb",
64
+ "vendor/plugins/formtastic/spec/input_spec.rb",
65
+ "vendor/plugins/formtastic/spec/inputs/boolean_input_spec.rb",
66
+ "vendor/plugins/formtastic/spec/inputs/check_boxes_input_spec.rb",
67
+ "vendor/plugins/formtastic/spec/inputs/country_input_spec.rb",
68
+ "vendor/plugins/formtastic/spec/inputs/date_input_spec.rb",
69
+ "vendor/plugins/formtastic/spec/inputs/datetime_input_spec.rb",
70
+ "vendor/plugins/formtastic/spec/inputs/file_input_spec.rb",
71
+ "vendor/plugins/formtastic/spec/inputs/hidden_input_spec.rb",
72
+ "vendor/plugins/formtastic/spec/inputs/numeric_input_spec.rb",
73
+ "vendor/plugins/formtastic/spec/inputs/password_input_spec.rb",
74
+ "vendor/plugins/formtastic/spec/inputs/radio_input_spec.rb",
75
+ "vendor/plugins/formtastic/spec/inputs/select_input_spec.rb",
76
+ "vendor/plugins/formtastic/spec/inputs/string_input_spec.rb",
77
+ "vendor/plugins/formtastic/spec/inputs/text_input_spec.rb",
78
+ "vendor/plugins/formtastic/spec/inputs/time_input_spec.rb",
79
+ "vendor/plugins/formtastic/spec/inputs/time_zone_input_spec.rb",
80
+ "vendor/plugins/formtastic/spec/inputs_spec.rb",
81
+ "vendor/plugins/formtastic/spec/label_spec.rb",
82
+ "vendor/plugins/formtastic/spec/semantic_errors_spec.rb",
83
+ "vendor/plugins/formtastic/spec/semantic_fields_for_spec.rb",
84
+ "vendor/plugins/formtastic/spec/spec.opts",
85
+ "vendor/plugins/formtastic/spec/spec_helper.rb",
86
+ "vendor/plugins/formtastic/uninstall.rb"
87
+ ]
88
+ s.homepage = %q{http://github.com/rubymood/jintastic}
89
+ s.rdoc_options = ["--charset=UTF-8"]
90
+ s.require_paths = ["lib"]
91
+ s.rubygems_version = %q{1.3.5}
92
+ s.summary = %q{jQuery based in-place editor generated by Formtastic}
93
+ s.test_files = [
94
+ "test/test_helper.rb",
95
+ "test/jintastic_test.rb"
96
+ ]
97
+
98
+ if s.respond_to? :specification_version then
99
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
100
+ s.specification_version = 3
101
+
102
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
103
+ s.add_runtime_dependency(%q<formtastic>, [">= 0"])
104
+ else
105
+ s.add_dependency(%q<formtastic>, [">= 0"])
106
+ end
107
+ else
108
+ s.add_dependency(%q<formtastic>, [">= 0"])
109
+ end
110
+ end
111
+
data/lib/jintastic.rb ADDED
@@ -0,0 +1,61 @@
1
+ require 'formtastic'
2
+
3
+ class ActionView::Base
4
+ def in_place_editor_for(path_spec_or_object, attributes, html_text = nil)
5
+ instance = path_spec_or_object.kind_of?(Array) ? path_spec_or_object.last : path_spec_or_object
6
+
7
+ if attributes.class==Symbol
8
+ #simple one attribute in place editor
9
+ #in_place_editor_for @user, :name
10
+ attribute = attributes
11
+ input_attributes = Array(attribute)
12
+
13
+ elsif attributes.values.first==:form
14
+ #render default form partial
15
+ #in_place_editor_for @user, :name=>:form
16
+ attribute = attributes.keys.first
17
+
18
+ elsif attributes.values.first.class==String
19
+ #render custom form partial
20
+ #in_place_editor_for @user, :name=>'users/custom_form'
21
+ attribute = attributes.keys.first
22
+ form_partial = attributes[attribute]
23
+
24
+ else
25
+ #attribute is an array
26
+ #in_place_editor_for @user, :name=>[:name,:address]
27
+ attribute = attributes.keys.first
28
+ input_attributes = attributes[attribute]
29
+ end
30
+
31
+ container_tag = instance.respond_to?(:column_for_attribute) ?
32
+ instance.column_for_attribute(attribute).type == :text ? :pre : :span : :span
33
+
34
+ form_tag_options = {}
35
+ content_tag_options = {:class=>'in_place_attribute'}
36
+
37
+ form_partial ||= "#{instance.class.to_s.downcase.pluralize}/form" unless input_attributes
38
+
39
+ html_text ||= instance[attribute]
40
+
41
+ if instance.valid?
42
+ form_tag_options.merge!({:html=>{:style=>"display: none"}})
43
+ else
44
+ content_tag_options.merge!({:style=>"display: none"})
45
+ end
46
+
47
+ render :partial => 'jintastic/in_place_editor',
48
+ :locals => {:container_tag=>container_tag,
49
+ :input_attributes=>input_attributes,
50
+ :path_spec_or_object=>path_spec_or_object,
51
+ :html_text=>html_text,
52
+ :content_tag_options=>content_tag_options,
53
+ :form_tag_options=>form_tag_options,
54
+ :form_partial=>form_partial}
55
+ end
56
+ end
57
+
58
+ # hack for assets because gems hasn't got rake tasks
59
+ #
60
+ # copy assets at every server start because after update maybe they have to update too
61
+ FileUtils.cp_r File.join(File.dirname(__FILE__), *%w{.. assets .}), Rails.root
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class JintasticTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end