rack-multipage 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 14684a7c81beb43a4ff9651eb023bb680d945dd2
4
+ data.tar.gz: 3deea093b6f09eba842e03f0be0fbf5b9f6b2e8d
5
+ SHA512:
6
+ metadata.gz: 3e5b349b3fc30df097bbe884fa054b104b59325deffcd3380dc8c472c53ed2980ceedd1c0d15cf76ed76e208b936616d1ca6695775bc3a5c049f55359a03d14f
7
+ data.tar.gz: d0dfd156f6a8db40f5cd55d50a93e8b96ec9bf4223b90ca0e53781274f4f8d57ff3a6dbc6ea360453260c4a2d3859a7baee2af1c0e924e61bca4c7797b164fa0
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rack_multipage.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Graeme Worthy
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # Rack::Multipage
2
+ ## It puts little thumbnails of other pages on a page.
3
+
4
+ Sometimes it's nice to see the effect of changes on multiple pages at once, like for example when you are editing css.
5
+
6
+ This is a rack middleware that creates a page with multiple little, shrunken-down versions of other pages on it. Thumbnails of them. These thumbnails are iFrames, and they've been shunken down with css.
7
+
8
+ It works with any Rack app. Ruby on Rails is a Rack app, so it works with Rails.
9
+
10
+
11
+
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'rack_multipage'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install rack_multipage
26
+
27
+ ### If you are Using Rails
28
+
29
+ in your development.rb file
30
+
31
+ config.middleware.use Rack::MultiPage, pages: ["/", "/users/1", "/login"]
32
+
33
+ then navigate your browser to "/multipage"
34
+
35
+ Those pages will be loaded into a series of iframes.
36
+
37
+ ### If you are using it with other Rack Middlewares
38
+
39
+ probably in your config.ru file:
40
+
41
+ use Rack::MultiPage, pages: ["/", "/users/1", "/login"]
42
+
43
+
44
+ ## Usage
45
+
46
+ to change the path from /multipage to something else
47
+
48
+ use Rack::MultiPage, route: "/something_else"
49
+
50
+ That's maybe unclear: you set the route, and the pages as a configuration hash, so it would most likely look like this in your app.
51
+
52
+ use Rack::MultiPage, route: "/something_else", pages: ["/", "/users/1", "/login"]
53
+
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ module Rack
2
+ end
3
+ class Rack::Multipage
4
+ VERSION = "0.0.2"
5
+ end
@@ -0,0 +1,112 @@
1
+ require "rack_multipage/version"
2
+
3
+ # Rack::MultiPage
4
+ # sometimes it's nice to see the effect of changes on multiple pages at once.
5
+ #
6
+ # in your development.rb file
7
+ # config.middleware.use Rack::MultiPage, pages: ["/", "/users/1", "/login"]
8
+ #
9
+ # then go to "/multipage"
10
+ # Those pages will be loaded into a series of iframes.
11
+
12
+ class Rack::MultiPage
13
+ attr_accessor :app
14
+ attr_reader :pages_list
15
+ attr_reader :route
16
+
17
+ def initialize (app, config = {})
18
+ @app = app
19
+ @pages_list = config.fetch :pages, []
20
+ @route = config.fetch :route, "/multipage"
21
+ end
22
+
23
+ def call(env)
24
+ if env["REQUEST_PATH"] == route
25
+ [200, {"Content-Type" => "text/html"}, [template(insides)]]
26
+ else
27
+ app.call(env)
28
+ end
29
+ end
30
+
31
+ def css
32
+ <<-CSS
33
+ body {
34
+ padding: 0; margin:0;
35
+ }
36
+ div.pageboxes {
37
+ background-color: #ccc;
38
+ height: 100%;
39
+ width: 100p%;
40
+ }
41
+
42
+ div.pageboxes .page {
43
+ height: 600px;
44
+ width: 800px;
45
+ border: solid 1px black;
46
+ background-color: white;
47
+ top: 0;
48
+ -webkit-transform: scale(0.5) ;
49
+ -webkit-transform-origin: top left ;
50
+ -webkit-box-shadow: 1px 1px 5px rgba(100,100,100,0.6)
51
+ }
52
+
53
+ div.pageboxes .box{
54
+ width: 400px;
55
+ height: 300px;
56
+ margin-left: 10px;
57
+ margin-top: 10px;
58
+ float: left;
59
+ }
60
+ div.pageboxes .page iframe{
61
+ height: 100%;
62
+ width: 100%;
63
+ border: solid 1px #eee;
64
+ border-radius: 5px;
65
+
66
+ }
67
+ CSS
68
+
69
+
70
+ end
71
+
72
+ def template(insides)
73
+ <<-TEMPLATE
74
+ <html>
75
+ <head>
76
+ <style>
77
+ #{css}
78
+ </style>
79
+ </head>
80
+ <body>
81
+
82
+ <div id="insides">
83
+ #{insides}
84
+ </div>
85
+ </body>
86
+ </html>
87
+ TEMPLATE
88
+ end
89
+
90
+ def page_boxes
91
+ output = "<div class='pageboxes'>"
92
+ @pages_list.each {|page|
93
+ output << <<-BOX
94
+
95
+ <div class="box">
96
+ <a href="#{page}">#{page}</a>
97
+ <div class="page">
98
+ <iframe src="#{page}"></iframe>
99
+ </div>
100
+ </div>
101
+
102
+ BOX
103
+ }
104
+ output << "</div>"
105
+ output
106
+ end
107
+
108
+ def insides
109
+ page_boxes
110
+ end
111
+
112
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rack-multipage/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rack-multipage"
8
+ spec.version = Rack::Multipage::VERSION
9
+ spec.authors = ["Graeme Worthy"]
10
+ spec.email = ["graeme@workben.ch"]
11
+ spec.description = %q{Rack Middleware that creates a series of thumbnail views of multiple pages in your application.}
12
+ spec.summary = %q{Display iframed versions of multiple pages of your app.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_runtime_dependency "rack"
24
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-multipage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Graeme Worthy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Rack Middleware that creates a series of thumbnail views of multiple
56
+ pages in your application.
57
+ email:
58
+ - graeme@workben.ch
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/rack-multipage.rb
69
+ - lib/rack-multipage/version.rb
70
+ - rack-multipage.gemspec
71
+ homepage: ''
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.1.11
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Display iframed versions of multiple pages of your app.
95
+ test_files: []
96
+ has_rdoc: