apotomo-animate 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ /.bundle
4
+ /.config
5
+ /.yardoc
6
+ /Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ /coverage
10
+ /doc/
11
+ /lib/bundler/man
12
+ /pkg
13
+ /rdoc
14
+ /spec/reports
15
+ /test/tmp
16
+ /test/version_tmp
17
+ /tmp
18
+ /.rvmrc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format documentation
@@ -0,0 +1,4 @@
1
+ rvm: 1.9.2
2
+ script: "bundle exec rake spec"
3
+ notifications:
4
+ irc: "irc.freenode.org#cells"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in apotomo-animate.gemspec
4
+ gemspec
@@ -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.
@@ -0,0 +1,6 @@
1
+ # apotomo-animate
2
+
3
+ [![Build Status](https://secure.travis-ci.org/docwhat/apotomo-animate.png)](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
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc "Run all specs"
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
@@ -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,3 @@
1
+ require "apotomo-animate/version"
2
+ require "apotomo-animate/javascript_generator"
3
+ require "apotomo-animate/javascript_methods"
@@ -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,9 @@
1
+ require 'apotomo/widget/javascript_methods'
2
+
3
+ module Apotomo
4
+ module JavascriptMethods
5
+ def animated_replace(*args)
6
+ wrap_in_javascript_for(:animate, *args)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Apotomo
2
+ module Animate
3
+ VERSION = "0.0.1"
4
+ end
5
+ 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
@@ -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