pakyow 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE +20 -0
  4. data/README.md +86 -0
  5. data/lib/commands/console.rb +1 -1
  6. data/lib/commands/server.rb +1 -1
  7. data/lib/generators/pakyow/app/templates/Gemfile +13 -4
  8. data/lib/generators/pakyow/app/templates/README.md +9 -9
  9. data/lib/generators/pakyow/app/templates/app/lib/routes.rb +4 -5
  10. data/lib/generators/pakyow/app/templates/{app.rb → app/setup.rb} +7 -1
  11. data/lib/generators/pakyow/app/templates/app/views/_templates/default.html +31 -0
  12. data/lib/generators/pakyow/app/templates/app/views/index.html +96 -0
  13. data/lib/generators/pakyow/app/templates/config.ru +1 -1
  14. data/lib/generators/pakyow/app/templates/public/apple-touch-icon-precomposed.png +0 -0
  15. data/lib/generators/pakyow/app/templates/public/apple-touch-icon.png +0 -0
  16. data/lib/generators/pakyow/app/templates/public/favicon.ico +0 -0
  17. data/{MIT-LICENSE → lib/generators/pakyow/app/templates/public/scripts/ring/LICENSE} +2 -2
  18. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/fastlink.js +13 -0
  19. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/fastlink.min.js +1 -0
  20. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/loader.js +9 -0
  21. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/loader.min.js +1 -0
  22. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/modal.js +78 -0
  23. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/modal.min.js +1 -0
  24. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/mutable.js +61 -0
  25. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/mutable.min.js +1 -0
  26. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/navigator.js +142 -0
  27. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/navigator.min.js +1 -0
  28. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/notifier.js +20 -0
  29. data/lib/generators/pakyow/app/templates/public/scripts/ring/components/notifier.min.js +1 -0
  30. data/lib/generators/pakyow/app/templates/public/scripts/ring/pakyow.js +1801 -0
  31. data/lib/generators/pakyow/app/templates/public/scripts/ring/pakyow.min.js +1 -0
  32. data/lib/generators/pakyow/app/templates/public/styles/pakyow-css/LICENSE +20 -0
  33. data/lib/generators/pakyow/app/templates/public/styles/pakyow-css/VERSION +1 -0
  34. data/lib/generators/pakyow/app/templates/public/styles/pakyow-css/reset.css +2 -0
  35. data/lib/generators/pakyow/app/templates/public/styles/pakyow-css/structure.css +2 -0
  36. data/lib/generators/pakyow/app/templates/public/styles/pakyow-css/syntax.css +2 -0
  37. data/lib/generators/pakyow/app/templates/public/styles/pakyow-css/theme.css +2 -0
  38. data/lib/generators/pakyow/app/templates/spec/integration/app_spec.rb +17 -0
  39. data/lib/generators/pakyow/app/templates/spec/spec_helper.rb +7 -0
  40. data/lib/pakyow.rb +6 -4
  41. data/lib/version.rb +3 -0
  42. metadata +93 -36
  43. data/lib/generators/pakyow/app/templates/app/views/_templates/pakyow.html +0 -17
  44. data/lib/generators/pakyow/app/templates/public/pakyow-css/CHANGES +0 -7
  45. data/lib/generators/pakyow/app/templates/public/pakyow-css/README.md +0 -3
  46. data/lib/generators/pakyow/app/templates/public/pakyow-css/VERSION +0 -1
  47. data/lib/generators/pakyow/app/templates/public/pakyow-css/examples/extension.css +0 -7
  48. data/lib/generators/pakyow/app/templates/public/pakyow-css/examples/structure-fluid.html +0 -151
  49. data/lib/generators/pakyow/app/templates/public/pakyow-css/examples/structure.html +0 -157
  50. data/lib/generators/pakyow/app/templates/public/pakyow-css/examples/styled.html +0 -114
  51. data/lib/generators/pakyow/app/templates/public/pakyow-css/reset.css +0 -46
  52. data/lib/generators/pakyow/app/templates/public/pakyow-css/structure.css +0 -199
  53. data/lib/generators/pakyow/app/templates/public/pakyow-css/style.css +0 -191
  54. data/lib/generators/pakyow/app/templates/public/pakyow-css/syntax.css +0 -279
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0196fc05cda2ed329d3043ad7b5541a386da93cc
4
- data.tar.gz: 22c0fa93bc38ce6de66aeb8a20a9346b2225e012
3
+ metadata.gz: 0ef3516f5955639e910668c039ccc52302453426
4
+ data.tar.gz: 87dec5942d0b34f6109dd2f8e4f5452ae21ce27e
5
5
  SHA512:
6
- metadata.gz: 5322b06c42a16e68e59fa3d3fb782770b20fc2b02c2ad58afa698100d4bdf2e2291636622ff43ad4c6041b8abd03dcea74a932236f3bbc39ba045fa1c37572ff
7
- data.tar.gz: 733e3f692fccf51b93cfc15c80571fb3772c12a1b12a2c705b9f0cc473af89211035a364b9e81404e0d860fb4aaec2d7fb884708222c8ecdf4dac4cc4bab46d5
6
+ metadata.gz: 11e159d2d315517b53f3ad49725d04e2f7608123439443c48f63e4168beeeb1ac795015327cf72eb0587de3d4cfa1132d9b780053433e76afef85ae5fd11a926
7
+ data.tar.gz: cbaa7ae39e057a0d3a89d75b9636b695635208984a8dccfa5bd3ddac7f2612d03b5d7d2a91efd56626e180ba06be5cf173bb1693f566afb6a4f4b4282aeb1b18
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # 0.10.0 (to be released)
2
+
3
+ * Rename `app.rb` to `setup/app.rb`
4
+ * Adds Pakyow icons to generated app
5
+ * Adds Ring to generated app
6
+ * Updates Pakyow CSS in generated app
7
+ * Adds session middleware to generated app
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011-2015 Bryan Powell
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.md ADDED
@@ -0,0 +1,86 @@
1
+ [gem]: https://rubygems.org/gems/pakyow
2
+ [travis]: https://travis-ci.org/pakyow/pakyow
3
+ [gemnasium]: https://gemnasium.com/pakyow/pakyow
4
+
5
+ # Pakyow Framework [![Gitter chat](https://badges.gitter.im/pakyow/chat.svg)](https://gitter.im/pakyow/chat)
6
+
7
+ Pakyow is a framework for building modern websites and web apps. Views update in
8
+ realtime to stay in sync with backend state. This is done using a traditional,
9
+ backend-driven architecture, which means business logic is written once and
10
+ stays on the server (write no JavaScript).
11
+
12
+ Pakyow is also designed with progressive enhancement in mind. Because views are
13
+ rendered on the server, they remain accessible to users who happen to be using
14
+ unsupported browsers. The realtime layer is simply disabled, while all content
15
+ continues to remain accessible.
16
+
17
+ There are three core concepts you should be familiar with:
18
+
19
+ **View-First Development**
20
+
21
+ View-First Development is a process that enables the presentation layer of a
22
+ website or web app to be built completely separate from the backend code. Read
23
+ more:
24
+
25
+ - http://pakyow.org/docs/presentation
26
+
27
+ **Simple State Propagation**
28
+
29
+ Simple State Propagation is the mechanism through which Pakyow propagates
30
+ changes in state from one client to another. It prioritizes user trust and makes
31
+ it easier to reason about your program. Read more:
32
+
33
+ - http://pakyow.org/docs/concepts/simple-state-propagation
34
+
35
+ **View Transformation Protocol**
36
+
37
+ The View Transformation Protocol is a way to represent view rendering as a set
38
+ of instructions that can later be applied to the view template. Pakyow
39
+ implements this protocol on the backend for initial rendering and in
40
+ [Ring](https://github.com/pakyow/ring) for client-side rendering. Read more:
41
+
42
+ - http://pakyow.org/docs/concepts/view-transformation-protocol
43
+
44
+ ---
45
+
46
+ [![Gem Version](https://badge.fury.io/rb/pakyow.svg)][gem]
47
+ [![Build Status](https://travis-ci.org/pakyow/pakyow.svg?branch=master)][travis]
48
+ [![Dependency Status](https://gemnasium.com/pakyow/pakyow.svg)][gemnasium]
49
+
50
+ ---
51
+
52
+ # Getting Started
53
+
54
+ 1. Install Pakyow:
55
+
56
+ `gem install pakyow`
57
+
58
+ 2. Create a new Pakyow project from the command line:
59
+
60
+ `pakyow new webapp`
61
+
62
+ 3. Move to the new directory and start the server:
63
+
64
+ `cd webapp; pakyow server`
65
+
66
+ 4. You'll find your project running at [http://localhost:3000](http://localhost:3000)!
67
+
68
+ # Next Steps
69
+
70
+ The following resources might be handy:
71
+
72
+ - [Website](http://pakyow.org)
73
+ - [Docs](http://pakyow.org/docs)
74
+ - [Code](http://github.com/pakyow/pakyow)
75
+
76
+ Want to keep up with the latest development? Follow along:
77
+
78
+ - [Blog](http://pakyow.org/blog)
79
+ - [Forums](http://forums.pakyow.org)
80
+ - [Gitter](https://gitter.im/pakyow/chat)
81
+ - [Twitter](http://twitter.com/pakyow)
82
+
83
+ # License
84
+
85
+ Pakyow is released free and open-source under the [MIT
86
+ License](http://opensource.org/licenses/MIT).
@@ -3,7 +3,7 @@ if ARGV.first == '--help' || ARGV.first == '-h'
3
3
  else
4
4
  $:.unshift(Dir.pwd)
5
5
 
6
- require 'app'
6
+ require 'app/setup'
7
7
  Pakyow::App.stage(ARGV.first)
8
8
 
9
9
  def reload
@@ -3,7 +3,7 @@ if ARGV.first == '--help' || ARGV.first == '-h'
3
3
  else
4
4
  $:.unshift(Dir.pwd)
5
5
 
6
- require 'app'
6
+ require 'app/setup'
7
7
 
8
8
  valid_args = true
9
9
  if port_arg = ARGV.index("-p")
@@ -1,8 +1,17 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem "pakyow", "0.9.1"
3
+ # live on the edge and uncomment this line
4
+ # gem 'pakyow', github: 'pakyow/pakyow'
4
5
 
5
- # application server
6
- gem "puma"
6
+ # use the latest released version
7
+ gem 'pakyow', '0.10'
8
+
9
+ # app server
10
+ gem 'puma', platforms: :ruby
11
+ gem 'thin', platforms: :mswin
12
+
13
+ group :test do
14
+ gem 'rspec'
15
+ end
7
16
 
8
17
  # your gems here
@@ -1,14 +1,14 @@
1
- This is a Pakyow v0.9 app.
1
+ This is a Pakyow v0.10 project.
2
2
 
3
3
  # Getting Started
4
4
 
5
- Start the app server:
5
+ Start the server:
6
6
 
7
7
  `pakyow server`
8
8
 
9
9
  You'll find your app running at [http://localhost:3000](http://localhost:3000)!
10
10
 
11
- Need to interact with your app? Fire up a console:
11
+ Need to interact with your code? Fire up a console:
12
12
 
13
13
  `pakyow console`
14
14
 
@@ -16,13 +16,13 @@ Need to interact with your app? Fire up a console:
16
16
 
17
17
  The following resources might be handy:
18
18
 
19
- - [Website](http://pakyow.com)
20
- - [Warmup](http://pakyow.com/warmup)
21
- - [Docs](http://pakyow.com/docs)
22
- - [Code](http://github.com/metabahn/pakyow)
19
+ - [Website](http://pakyow.org)
20
+ - [Docs](http://pakyow.org/docs)
21
+ - [Code](http://github.com/pakyow/pakyow)
23
22
 
24
23
  Want to keep up with the latest development? Follow along:
25
24
 
26
- - [Blog](http://pakyow.com/blog)
27
- - [Mailing List](http://groups.google.com/group/pakyow)
25
+ - [Blog](http://pakyow.org/blog)
26
+ - [Forums](http://forums.pakyow.org)
27
+ - [Gitter](https://gitter.im/pakyow/chat)
28
28
  - [Twitter](http://twitter.com/pakyow)
@@ -1,8 +1,7 @@
1
1
  Pakyow::App.routes do
2
- # define your routes here
2
+ default do
3
+ logger.info 'hello'
4
+ end
3
5
 
4
- # see something working by uncommenting the line below
5
- # default do
6
- # puts 'hello'
7
- # end
6
+ # define application routes here
8
7
  end
@@ -1,9 +1,10 @@
1
1
  require 'bundler/setup'
2
-
3
2
  require 'pakyow'
4
3
 
5
4
  Pakyow::App.define do
6
5
  configure :global do
6
+ Bundler.require :default, Pakyow::Config.env
7
+
7
8
  # put global config here and they'll be available across environments
8
9
  app.name = 'Pakyow'
9
10
  end
@@ -24,4 +25,9 @@ Pakyow::App.define do
24
25
  configure :production do
25
26
  # put your production config here
26
27
  end
28
+
29
+ middleware do |builder|
30
+ # TODO: you will most definitely want to change this secret
31
+ builder.use Rack::Session::Cookie, key: "#{Pakyow::Config.app.name}.session", secret: 'sekret'
32
+ end
27
33
  end
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>
5
+ Pakyow
6
+ </title>
7
+
8
+ <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0" name="viewport">
9
+
10
+ <link rel="stylesheet" type="text/css" href="/styles/pakyow-css/reset.css">
11
+ <link rel="stylesheet" type="text/css" href="/styles/pakyow-css/structure.css">
12
+ <link rel="stylesheet" type="text/css" href="/styles/pakyow-css/syntax.css">
13
+ <link rel="stylesheet" type="text/css" href="/styles/pakyow-css/theme.css">
14
+
15
+ <script src="/scripts/ring/pakyow.js"></script>
16
+ </head>
17
+
18
+ <body>
19
+ <main class="container-1">
20
+ <!-- @container -->
21
+ </main>
22
+
23
+ <footer class="container-1 margin-t">
24
+ <p>
25
+ Built with
26
+ <svg class="icon" width="10" height="10" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M896 1664q-26 0-44-18l-624-602q-10-8-27.5-26t-55.5-65.5-68-97.5-53.5-121-23.5-138q0-220 127-344t351-124q62 0 126.5 21.5t120 58 95.5 68.5 76 68q36-36 76-68t95.5-68.5 120-58 126.5-21.5q224 0 351 124t127 344q0 221-229 450l-623 600q-18 18-44 18z"></svg>
27
+ and <a href="http://pakyow.org">Pakyow</a>.
28
+ </p>
29
+ </footer>
30
+ </body>
31
+ </html>
@@ -0,0 +1,96 @@
1
+ <h1>
2
+ Welcome to Pakyow :)
3
+ </h1>
4
+
5
+ <p class="lead margin-t">
6
+ The following links might be handy:
7
+ </p>
8
+
9
+ <ul>
10
+ <li>
11
+ <a href="http://pakyow.org/">Official Website</a>
12
+ </li>
13
+
14
+ <li>
15
+ <a href="http://pakyow.org/docs">Guides &amp; Documentation</a>
16
+ </li>
17
+
18
+ <li>
19
+ <a href="http://github.com/pakyow/pakyow">Source Code</a>
20
+ </li>
21
+ </ul>
22
+
23
+ <h3 class="margin-t">
24
+ Show Your Support
25
+ </h3>
26
+
27
+ <p>
28
+ Give us a star on <a href="http://github.com/pakyow">Github</a>. But don't
29
+ stop there &ndash; tell your friends about the project! Writing blog posts,
30
+ giving talks to local user groups, and screencasting your experiences with
31
+ Pakyow all help spread the word. We'll return the favor by helping promote
32
+ the things you create. Also consider adding a link back to pakyow.org from your
33
+ project.
34
+ </p>
35
+
36
+ <ul class="plain social-links inline margin-t">
37
+ <li>
38
+ <iframe src="https://ghbtns.com/github-btn.html?user=pakyow&repo=pakyow&type=star&count=true&v=2" frameborder="0" scrolling="0" width="85px" height="20px"></iframe>
39
+ </li>
40
+
41
+ <li>
42
+ <a href="https://twitter.com/pakyow" class="twitter-follow-button" data-show-count="false">Follow @pakyow</a>
43
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
44
+ </li>
45
+
46
+ <li>
47
+ <div id="fb-root"></div>
48
+ <script>(function(d, s, id) {
49
+ var js, fjs = d.getElementsByTagName(s)[0];
50
+ if (d.getElementById(id)) return;
51
+ js = d.createElement(s); js.id = id;
52
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3&appId=1611480632444271";
53
+ fjs.parentNode.insertBefore(js, fjs);
54
+ }(document, 'script', 'facebook-jssdk'));</script>
55
+ <div class="fb-like" data-href="https://www.facebook.com/pakyow.rb" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
56
+ </li>
57
+
58
+ <li>
59
+ <!-- Place this tag in your head or just before your close body tag. -->
60
+ <script src="https://apis.google.com/js/platform.js" async defer></script>
61
+ <!-- Place this tag where you want the +1 button to render. -->
62
+ <div class="g-plusone" data-size="medium" data-href="http://pakyow.org"></div>
63
+ </li>
64
+ </ul>
65
+
66
+ <div style="clear:both"></div>
67
+
68
+ <h3 class="margin-t">
69
+ Join the Conversation
70
+ </h3>
71
+
72
+ <p>
73
+ Come hang out on our <a href="https://gitter.im/pakyow/chat">Gitter channel</a>,
74
+ which took the place of our IRC channel in 2015. You should also join the
75
+ <a href="http://forums.pakyow.org">forums</a>, where early discussions about new Pakyow features often take place.
76
+ Don't forget to lend a hand &ndash; ask and answer <a href="http://stackoverflow.com/questions/tagged/pakyow">questions on Stack Overflow</a>.
77
+ </p>
78
+
79
+ <h3 class="margin-t">
80
+ Contribute to the Project
81
+ </h3>
82
+
83
+ <p>
84
+ We'd love your contributions to Pakyow code or documentation. Everything is hosted publicly on <a href="http://github.com/pakyow">Github</a>.
85
+ Looking through the list of open issues would be a great place to start. If you need more direction, jump on
86
+ one of the communication channels listed above; we're happy to help!
87
+ </p>
88
+
89
+ <h3 class="margin-t">
90
+ Report Problems you Encounter
91
+ </h3>
92
+
93
+ <p>
94
+ Found a bug or have an idea for a new feature?
95
+ Open up an issue on our <a href="https://github.com/pakyow/pakyow/issues">Github issues page</a>.
96
+ </p>
@@ -1,4 +1,4 @@
1
- require File.expand_path('../app', __FILE__)
1
+ require File.expand_path('../app/setup', __FILE__)
2
2
 
3
3
  app = Pakyow::App
4
4
  app.builder.run(app.stage(ENV['APP_ENV'] || ENV['RACK_ENV']))
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Bryan Powell
1
+ Copyright (c) 2015 Bryan Powell
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
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.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ pw.component.register('fastlink', function (view, config) {
2
+ var that = this;
3
+
4
+ if (window.history) {
5
+ view.node.addEventListener('click', function (evt) {
6
+ evt.preventDefault();
7
+ window.history.pushState({ uri: this.href }, this.href, this.href);
8
+ return false;
9
+ });
10
+ } else {
11
+ // unsupported
12
+ }
13
+ });
@@ -0,0 +1 @@
1
+ pw.component.register("fastlink",function(t,e){window.history&&t.node.addEventListener("click",function(t){return t.preventDefault(),window.history.pushState({uri:this.href},this.href,this.href),!1})});
@@ -0,0 +1,9 @@
1
+ pw.component.register('loader', function (view) {
2
+ this.listen('socket:loading', function () {
3
+ view.node.classList.add('ui-show');
4
+ });
5
+
6
+ this.listen('socket:loaded', function () {
7
+ view.node.classList.remove('ui-show');
8
+ });
9
+ });
@@ -0,0 +1 @@
1
+ pw.component.register("loader",function(o){this.listen("socket:loading",function(){o.node.classList.add("ui-show")}),this.listen("socket:loaded",function(){o.node.classList.remove("ui-show")})});
@@ -0,0 +1,78 @@
1
+ pw.component.register('modal', function (view, config, name, id) {
2
+ var self = this;
3
+ var channel = 'modal:' + id;
4
+ var blinder;
5
+ var modal;
6
+
7
+ this.listen(channel + ':navigator:enter', function (response) {
8
+ if (!blinder) {
9
+ blinder = document.createElement('DIV');
10
+ blinder.classList.add('ui-modal-blinder');
11
+
12
+ modal = document.createElement('DIV');
13
+ modal.classList.add('ui-modal');
14
+
15
+ blinder.appendChild(modal);
16
+ document.body.appendChild(blinder);
17
+
18
+ blinder.addEventListener('click', function (evt) {
19
+ if (evt.target === blinder) {
20
+ evt.preventDefault();
21
+ self.close();
22
+
23
+ var uri = window.location.pathname;
24
+
25
+ var opts = {
26
+ uri: uri
27
+ };
28
+
29
+ window.history.pushState(opts, uri, uri);
30
+ }
31
+ });
32
+ }
33
+
34
+ modal.innerHTML = response.body;
35
+ pw.component.findAndInit(blinder);
36
+
37
+ blinder.classList.add('ui-appear');
38
+ });
39
+
40
+ this.listen(channel + ':navigator:exit', function () {
41
+ console.log('exit');
42
+ self.close();
43
+ });
44
+
45
+ this.listen(channel + ':navigator:boot', function (uri) {
46
+ self.load(uri);
47
+ });
48
+
49
+ view.node.addEventListener('click', function (evt) {
50
+ evt.preventDefault();
51
+ self.load(this.href);
52
+ return false;
53
+ });
54
+
55
+ this.load = function (uri) {
56
+ if (!window.socket) {
57
+ document.location = uri;
58
+ return;
59
+ }
60
+
61
+ var opts = {
62
+ uri: uri,
63
+ context: 'modal:' + id
64
+ }
65
+
66
+ if (config.container) {
67
+ opts.container = config.container;
68
+ }
69
+
70
+ window.history.pushState(opts, uri, uri);
71
+ };
72
+
73
+ this.close = function () {
74
+ pw.node.remove(blinder);
75
+ blinder = null;
76
+ modal = null;
77
+ };
78
+ });