stay 0.1.4.0 → 0.1.4.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/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('stay', '0.1.4.0') do |p|
5
+ Echoe.new('stay', '0.1.4.1') do |p|
6
6
  p.description = "Form ajax helper with tinymce support"
7
7
  p.summary = "Helper for building ajax form, inspired by best_in_place, with some modifications, support tinymce as editor"
8
8
  p.url = "http://github.com/tejanium/stay"
@@ -44,6 +44,7 @@ Stay = (function() {
44
44
  } else {
45
45
  this.initDefault();
46
46
  }
47
+ this.defaultValue = this.stayFormInput.val();
47
48
  this.bindCallback();
48
49
  }
49
50
  Stay.prototype.initTinyMCE = function() {
@@ -135,6 +136,7 @@ Stay = (function() {
135
136
  };
136
137
  Stay.prototype.processCallback = function(cb) {
137
138
  this.stayFormInput.val(cb.input || "");
139
+ this.defaultValue = this.stayFormInput.val();
138
140
  this.stayObjectContainer.html(cb.display || "");
139
141
  return this.showObject();
140
142
  };
@@ -149,6 +151,7 @@ Stay = (function() {
149
151
  return this.stayObjectContainer.hide();
150
152
  };
151
153
  Stay.prototype.showObject = function() {
154
+ this.stayFormInput.val(this.defaultValue);
152
155
  this.stayFormContainer.hide();
153
156
  if (this.usingSubmitter) {
154
157
  this.submitter.hide();
data/lib/stay/helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Stay
2
- module FormHelper
2
+ module FormHelper
3
3
  def generate_form(object, field, type = :text_field)
4
4
  form_for(object, remote: true, format: :json) do |f|
5
5
  if type == :tiny_mce || type.is_a?(Array)
@@ -18,11 +18,11 @@ module Stay
18
18
  end
19
19
  end
20
20
  end
21
-
21
+
22
22
  ActionView::Helpers::FormHelper.send(:include, FormHelper)
23
-
23
+
24
24
  module StayHelpers
25
- def stay(record, field, opts = {})
25
+ def stay(record, field, opts = {})
26
26
  raise ArgumentError, "Can't have Canceller without Submitter" if opts[:canceller] && opts[:submitter].nil?
27
27
  opts[:type] ||= :text_field
28
28
  html = "<span class='stay' "
@@ -36,7 +36,7 @@ module Stay
36
36
  val = (record.is_a?(Array) ? record.last : record).send(field)
37
37
  if val.nil?
38
38
  html << "-"
39
- else
39
+ else
40
40
  html << val.to_html
41
41
  end
42
42
  html << "</span>"
@@ -1,7 +1,7 @@
1
1
  module Stay
2
2
  module StringExtensions
3
3
  def to_html
4
- html = self.gsub(" ", "&nbsp;&nbsp;").gsub("\n", "<br />").gsub("<p>", "").gsub("</p>","")
4
+ html = self.gsub(" ", "&nbsp;&nbsp;").gsub("\n", "<br />")
5
5
  html
6
6
  end
7
7
  end
data/stay.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "stay"
5
- s.version = "0.1.4.0"
5
+ s.version = "0.1.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Teja Sophista"]
9
- s.date = "2012-03-10"
9
+ s.date = "2012-03-12"
10
10
  s.description = "Form ajax helper with tinymce support"
11
11
  s.email = "tejanium@yahoo.com"
12
12
  s.extra_rdoc_files = ["README.md", "README.rdoc", "lib/assets/javascripts/stay.js", "lib/stay.rb", "lib/stay/controller_extensions.rb", "lib/stay/engine.rb", "lib/stay/helper.rb", "lib/stay/string_extensions.rb"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4.0
4
+ version: 0.1.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-10 00:00:00.000000000Z
12
+ date: 2012-03-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
16
- requirement: &16640280 !ruby/object:Gem::Requirement
16
+ requirement: &28151000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16640280
24
+ version_requirements: *28151000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tinymce-rails
27
- requirement: &16639820 !ruby/object:Gem::Requirement
27
+ requirement: &28183420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *16639820
35
+ version_requirements: *28183420
36
36
  description: Form ajax helper with tinymce support
37
37
  email: tejanium@yahoo.com
38
38
  executables: []