apotomo-animate 0.0.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/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.mkd +6 -0
- data/Rakefile +8 -0
- data/apotomo-animate.gemspec +22 -0
- data/lib/apotomo-animate.rb +3 -0
- data/lib/apotomo-animate/javascript_generator.rb +33 -0
- data/lib/apotomo-animate/javascript_methods.rb +9 -0
- data/lib/apotomo-animate/version.rb +5 -0
- data/spec/javascript_generator_spec.rb +33 -0
- data/spec/javascript_method_spec.rb +38 -0
- data/spec/spec_helper.rb +26 -0
- metadata +89 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Vivisimo, Inc., Christian Höltje, Jean Lange, Peter Powlowski
|
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.
|
data/README.mkd
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
# apotomo-animate
|
2
|
+
|
3
|
+
[](http://travis-ci.org/docwhat/apotomo-animate)
|
4
|
+
|
5
|
+
This gem adds the `animated_replace()` to your widgets, an alternative to `replace()` that fades in slowly to the [Apotomo](http://apotomo.de/) widget framework.
|
6
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/apotomo-animate/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Christian Höltje", "Jean Lange", "Peter Pawlowski"]
|
6
|
+
gem.email = ["docwhat@gerf.org"]
|
7
|
+
gem.description = %q{Make your AJAX powered apotomo widgets have more sizzle; animate them as the appear!}
|
8
|
+
gem.summary = %q{Adds an animated replace() method.}
|
9
|
+
gem.homepage = "http://github.com/docwhat/apotomo-animate"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "apotomo-animate"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Apotomo::Animate::VERSION
|
17
|
+
gem.license = "MIT"
|
18
|
+
|
19
|
+
gem.add_runtime_dependency('apotomo', ['>= 1.1.4'])
|
20
|
+
|
21
|
+
gem.add_development_dependency('rspec-apotomo')
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'apotomo/javascript_generator'
|
2
|
+
|
3
|
+
module Apotomo
|
4
|
+
class JavascriptGenerator
|
5
|
+
module Prototype
|
6
|
+
def animate(id, markup)
|
7
|
+
replace(id, markup)
|
8
|
+
end
|
9
|
+
def animate_id(id, markup)
|
10
|
+
replace_id(id, markup)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
module Right
|
14
|
+
def animate(id, markup)
|
15
|
+
replace(id, markup)
|
16
|
+
end
|
17
|
+
def animate_id(id, markup)
|
18
|
+
replace_id(id, markup)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
module Jquery
|
22
|
+
def animate(id, markup)
|
23
|
+
wrapped_markup = "<div id=\"wrapper-#{id}\" style=\"opacity: 0\">#{markup}</div>"
|
24
|
+
|
25
|
+
"#{element(id)}.replaceWith('#{escape(wrapped_markup)}');" +
|
26
|
+
"#{element("wrapper-#{id}")}.animate({ 'opacity': 1}, 400);"
|
27
|
+
end
|
28
|
+
def animate_id(id, markup)
|
29
|
+
animate("##{id}", markup)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples_for "JavascriptGenerator" do
|
4
|
+
it "should respond to #animate" do
|
5
|
+
Apotomo.js_generator.should respond_to :animate
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "Apotomo.js_generator" do
|
10
|
+
context "using Prototype" do
|
11
|
+
before :each do
|
12
|
+
Apotomo.js_framework = :prototype
|
13
|
+
end
|
14
|
+
|
15
|
+
it_behaves_like "JavascriptGenerator"
|
16
|
+
end
|
17
|
+
|
18
|
+
context "using Right" do
|
19
|
+
before :each do
|
20
|
+
Apotomo.js_framework = :right
|
21
|
+
end
|
22
|
+
|
23
|
+
it_behaves_like "JavascriptGenerator"
|
24
|
+
end
|
25
|
+
|
26
|
+
context "using JQuery" do
|
27
|
+
before :each do
|
28
|
+
Apotomo.js_framework = :jquery
|
29
|
+
end
|
30
|
+
|
31
|
+
it_behaves_like "JavascriptGenerator"
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class Bogon
|
4
|
+
include Apotomo::JavascriptMethods
|
5
|
+
def name
|
6
|
+
"bogon-name"
|
7
|
+
end
|
8
|
+
|
9
|
+
def render *args
|
10
|
+
"render-output"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
describe "integration testing" do
|
17
|
+
describe "#animate_replace()" do
|
18
|
+
context "JQuery" do
|
19
|
+
before :each do
|
20
|
+
Apotomo.js_framework = :jquery
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should accept a css-id" do
|
24
|
+
output = Bogon.new.instance_eval do
|
25
|
+
animated_replace("#foobar")
|
26
|
+
end
|
27
|
+
output.should match /\#foobar/
|
28
|
+
end
|
29
|
+
it "should accept no css-id" do
|
30
|
+
output = Bogon.new.instance_eval do
|
31
|
+
animated_replace
|
32
|
+
end
|
33
|
+
output.should match /\#bogon-name/
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require "action_controller/railtie"
|
5
|
+
|
6
|
+
Rails.application = Class.new(Rails::Application)
|
7
|
+
# Rails.application.routes.append do |r|
|
8
|
+
# r.match "/render_event_response", :as => :apotomo_event_path
|
9
|
+
# end
|
10
|
+
|
11
|
+
# This class is used as a dummy widget for testing
|
12
|
+
|
13
|
+
module Rails
|
14
|
+
def root
|
15
|
+
Pathname.new(__FILE__).dirname.dirname.dirname
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# require "action_controller/railtie"
|
20
|
+
# require 'rails'
|
21
|
+
# require "rails/test_help" # sets up ActionController::TestCase's @routes
|
22
|
+
# require 'action_view/template/handlers'
|
23
|
+
# require 'rspec/rails'
|
24
|
+
|
25
|
+
require 'apotomo'
|
26
|
+
require 'apotomo-animate'
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: apotomo-animate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Christian Höltje
|
9
|
+
- Jean Lange
|
10
|
+
- Peter Pawlowski
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2011-10-12 00:00:00.000000000Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: apotomo
|
18
|
+
requirement: &70333118573460 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.1.4
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *70333118573460
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-apotomo
|
29
|
+
requirement: &70333118571200 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *70333118571200
|
38
|
+
description: Make your AJAX powered apotomo widgets have more sizzle; animate them
|
39
|
+
as the appear!
|
40
|
+
email:
|
41
|
+
- docwhat@gerf.org
|
42
|
+
executables: []
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
46
|
+
- .gitignore
|
47
|
+
- .rspec
|
48
|
+
- .travis.yml
|
49
|
+
- Gemfile
|
50
|
+
- MIT-LICENSE
|
51
|
+
- README.mkd
|
52
|
+
- Rakefile
|
53
|
+
- apotomo-animate.gemspec
|
54
|
+
- lib/apotomo-animate.rb
|
55
|
+
- lib/apotomo-animate/javascript_generator.rb
|
56
|
+
- lib/apotomo-animate/javascript_methods.rb
|
57
|
+
- lib/apotomo-animate/version.rb
|
58
|
+
- spec/javascript_generator_spec.rb
|
59
|
+
- spec/javascript_method_spec.rb
|
60
|
+
- spec/spec_helper.rb
|
61
|
+
homepage: http://github.com/docwhat/apotomo-animate
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.8.11
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: Adds an animated replace() method.
|
86
|
+
test_files:
|
87
|
+
- spec/javascript_generator_spec.rb
|
88
|
+
- spec/javascript_method_spec.rb
|
89
|
+
- spec/spec_helper.rb
|