havior 0.1.0

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.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/lib/generators/havior/USAGE +8 -0
  6. data/lib/generators/havior/havior_generator.rb +63 -0
  7. data/lib/generators/havior/install_generator.rb +32 -0
  8. data/lib/generators/havior/templates/haviors/controller.rb.erb +12 -0
  9. data/lib/generators/havior/templates/haviors/haxe/Havior.hx.erb +26 -0
  10. data/lib/generators/havior/templates/haviors/model.rb.erb +15 -0
  11. data/lib/generators/havior/templates/haviors/routes.rb.erb +7 -0
  12. data/lib/generators/havior/templates/haxe/havior.hxml.erb +7 -0
  13. data/lib/generators/havior/templates/haxe/lib/Havior.hx +83 -0
  14. data/lib/havior.rb +11 -0
  15. data/lib/havior/builder.rb +34 -0
  16. data/lib/havior/helper.rb +13 -0
  17. data/lib/havior/model.rb +33 -0
  18. data/lib/havior/routes.rb +12 -0
  19. data/lib/havior/version.rb +3 -0
  20. data/lib/tasks/havior_tasks.rake +4 -0
  21. data/test/dummy/Gemfile +46 -0
  22. data/test/dummy/Gemfile.lock +171 -0
  23. data/test/dummy/README.rdoc +28 -0
  24. data/test/dummy/Rakefile +6 -0
  25. data/test/dummy/app/assets/javascripts/application.js +16 -0
  26. data/test/dummy/app/assets/javascripts/top.coffee +3 -0
  27. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  28. data/test/dummy/app/assets/stylesheets/top.scss +3 -0
  29. data/test/dummy/app/controllers/application_controller.rb +5 -0
  30. data/test/dummy/app/controllers/top_controller.rb +4 -0
  31. data/test/dummy/app/haviors/misc/todo/haxe/Todo.hx +42 -0
  32. data/test/dummy/app/haviors/misc/todo/model.rb +15 -0
  33. data/test/dummy/app/haviors/misc/todo/routes.rb +11 -0
  34. data/test/dummy/app/haviors/misc/todo/todo_controller.rb +24 -0
  35. data/test/dummy/app/haviors/misc/todo/views/todo.html.erb +1 -0
  36. data/test/dummy/app/helpers/application_helper.rb +2 -0
  37. data/test/dummy/app/helpers/top_helper.rb +2 -0
  38. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  39. data/test/dummy/app/views/top/index.html.erb +6 -0
  40. data/test/dummy/bin/bundle +3 -0
  41. data/test/dummy/bin/rails +8 -0
  42. data/test/dummy/bin/rake +8 -0
  43. data/test/dummy/bin/setup +29 -0
  44. data/test/dummy/bin/spring +18 -0
  45. data/test/dummy/config.ru +4 -0
  46. data/test/dummy/config/application.rb +26 -0
  47. data/test/dummy/config/boot.rb +3 -0
  48. data/test/dummy/config/database.yml +25 -0
  49. data/test/dummy/config/environment.rb +5 -0
  50. data/test/dummy/config/environments/development.rb +41 -0
  51. data/test/dummy/config/environments/production.rb +79 -0
  52. data/test/dummy/config/environments/test.rb +42 -0
  53. data/test/dummy/config/initializers/assets.rb +11 -0
  54. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  56. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  57. data/test/dummy/config/initializers/inflections.rb +16 -0
  58. data/test/dummy/config/initializers/mime_types.rb +4 -0
  59. data/test/dummy/config/initializers/session_store.rb +3 -0
  60. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/test/dummy/config/locales/en.yml +23 -0
  62. data/test/dummy/config/routes.rb +58 -0
  63. data/test/dummy/config/secrets.yml +22 -0
  64. data/test/dummy/db/development.sqlite3 +0 -0
  65. data/test/dummy/db/seeds.rb +7 -0
  66. data/test/dummy/haxe/havior.hxml +7 -0
  67. data/test/dummy/haxe/lib/Havior.hx +83 -0
  68. data/test/dummy/log/development.log +96 -0
  69. data/test/dummy/public/404.html +67 -0
  70. data/test/dummy/public/422.html +67 -0
  71. data/test/dummy/public/500.html +66 -0
  72. data/test/dummy/public/favicon.ico +0 -0
  73. data/test/dummy/public/javascripts/misc/todo/todo.js +206 -0
  74. data/test/dummy/public/robots.txt +5 -0
  75. data/test/dummy/public/stylesheets/misc/todo/todo.css +0 -0
  76. data/test/dummy/test/controllers/top_controller_test.rb +9 -0
  77. data/test/dummy/test/test_helper.rb +10 -0
  78. data/test/dummy/tmp/cache/assets/development/sass/f3ea2a11dd4dcf99bc71cead6095f5bcdec0e3c1/top.scssc +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/144480218666373c17378e01c880a73e +0 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/18d2cbb0f2269d20680f775d08981e72 +0 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/34226a9205e8dd111f3fd667140e3557 +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/55775c8c8fb4940e0575e4087043324a +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/69a055f006179beba2a830d88e39fa88 +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/7c6e5314d519217e99ce56f93eacb7ca +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/82ac2910cee5ad83240253d81fd60ad8 +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/86d34baf8dfb1e16ed00123e1e2a2190 +0 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/9c1b6c9edc5c7d33d390964b955748a8 +0 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/a69a6a0e8b2413a18e01dcc9e07b7263 +0 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/ccf10475f5be0d54da1c2c223b3fca5d +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sprockets/cdf84c819e9ef95e6edb7a5d36549ca4 +0 -0
  94. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  95. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  96. data/test/dummy/tmp/cache/assets/development/sprockets/f4779bd843bfdc90d8c4fe47fcfc5c02 +0 -0
  97. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  98. data/test/dummy/tmp/cache/assets/development/sprockets/fe9f4bf7a4d033c8ec226c659ceba27e +0 -0
  99. data/test/dummy/tmp/cache/assets/development/sprockets/ffa538b8e1d908ed228e70f373c3aa00 +0 -0
  100. data/test/dummy/tmp/pids/server.pid +1 -0
  101. data/test/havior_test.rb +7 -0
  102. data/test/test_helper.rb +18 -0
  103. metadata +255 -0
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 02748f185d901033dcc89ac939a8ec7eaee91d1e5f85cc2ba51685db2e24d8f7b6d98b4789d8f94390acd17674d39c2adb0433a68d8d03a715ea22b9d6b65324
15
+
16
+ test:
17
+ secret_key_base: 96419574e6281e692168678fb472f4953e1b6dcf04c519046c67a7338c1214dcb78c4bd8ee896978619109066c32e65365c40cc8b8def2c6fab83c13fa7a01e2
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
File without changes
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -0,0 +1,7 @@
1
+
2
+ --next
3
+ -lib JQueryExtern
4
+ -cp haxe/lib
5
+ -cp app/haviors/misc/todo/haxe
6
+ -main Todo
7
+ -js public/javascripts/misc/todo/todo.js
@@ -0,0 +1,83 @@
1
+ import jQuery.*;
2
+
3
+ typedef AsyncCallback = Dynamic -> Void
4
+
5
+ class Havior {
6
+ public static var com_name : String;
7
+
8
+ public static function start(name, ?pos:haxe.PosInfos){
9
+ com_name = name;
10
+ var klass = Type.resolveClass(pos.className);
11
+ var class_name = StringTools.replace(name, "/", "-");
12
+ var coms = new JQuery(".havior-"+class_name);
13
+ for(com in coms){
14
+ var id = new JQuery(com).attr("id");
15
+ var c = Type.createInstance(klass, [id]);
16
+ c.onLoad();
17
+ }
18
+ }
19
+
20
+ public function onLoad(){}
21
+
22
+ private var id : String;
23
+ private var dom : JQuery;
24
+ private var callbacks = new Map<String, Array<AsyncCallback>>();
25
+
26
+ public function new(id : String){
27
+ this.id = id;
28
+ this.dom = new JQuery("#"+id);
29
+ }
30
+
31
+ public function getId(){ return this.id;}
32
+ public function getDOM(){ return this.dom; }
33
+
34
+ public function addCallback(route:String, func:AsyncCallback){
35
+ if(!this.callbacks.exists(route)){
36
+ this.callbacks.set(route, new Array<AsyncCallback>());
37
+ }
38
+ this.callbacks.get(route).push(func);
39
+ }
40
+ private function callCallback(route:String, data:Dynamic){
41
+ if(this.callbacks.exists(route)){
42
+ for(func in this.callbacks.get(route)){
43
+ func(data);
44
+ }
45
+ }
46
+ }
47
+
48
+ public function children(selector){
49
+ return new JQuery("#"+getId()+" ,#"+getId()+" *").children(selector);
50
+ }
51
+ public function getParams(){
52
+ return getDOM().data();
53
+ }
54
+ public function getParam(name:String){
55
+ return Reflect.field(getParams(), name);
56
+ }
57
+ public function getParamNames(){
58
+ return Reflect.fields(getParams);
59
+ }
60
+
61
+
62
+ public function sendAsync(route:String, params:Dynamic){
63
+ var xs = route.split("@");
64
+ var action = xs[0];
65
+ var method = xs[1];
66
+ var url = "/havior/"+ com_name +"/"+ action;
67
+ var callback = function(data,status,xhr){
68
+ callCallback(route, data);
69
+ }
70
+ var query = switch(method){
71
+ case "get":
72
+ JQueryStatic.get(url, params, callback);
73
+ case "post", _:
74
+ JQueryStatic.post(url, params, callback);
75
+ }
76
+ query.fail(function(e){
77
+ trace("ERROR:"+e);
78
+ });
79
+ }
80
+ }
81
+
82
+
83
+
@@ -0,0 +1,96 @@
1
+
2
+
3
+ Started GET "/" for ::1 at 2015-02-10 16:57:27 +0900
4
+ Processing by TopController#index as HTML
5
+ Rendered app/haviors/misc/todo/views/todo.html.erb (0.3ms)
6
+ Rendered top/index.html.erb within layouts/application (9.2ms)
7
+ Completed 200 OK in 1209ms (Views: 1199.8ms | ActiveRecord: 0.0ms)
8
+
9
+
10
+ Started GET "/" for ::1 at 2015-02-10 16:57:28 +0900
11
+ Processing by TopController#index as HTML
12
+ Rendered app/haviors/misc/todo/views/todo.html.erb (0.3ms)
13
+ Rendered top/index.html.erb within layouts/application (3.0ms)
14
+ Completed 200 OK in 39ms (Views: 37.5ms | ActiveRecord: 0.0ms)
15
+
16
+
17
+ Started GET "/assets/top-64e62ddc273c2f5847f30d698ca14b67.css?body=1" for ::1 at 2015-02-10 16:57:28 +0900
18
+
19
+
20
+ Started GET "/assets/top-fcec5b5a277ac7c20cc9f45a209a3bcd.js?body=1" for ::1 at 2015-02-10 16:57:28 +0900
21
+
22
+
23
+ Started GET "/assets/application-79e1233a68e5fdd328d8a2ea17ddef8a.js?body=1" for ::1 at 2015-02-10 16:57:28 +0900
24
+
25
+
26
+ Started GET "/assets/application-5266d2988799ecc8fe6e81eaab412e7d.css?body=1" for ::1 at 2015-02-10 16:57:28 +0900
27
+
28
+
29
+ Started GET "/assets/jquery_ujs-e27bd20a10d28155845a22d71ef94f2f.js?body=1" for ::1 at 2015-02-10 16:57:28 +0900
30
+
31
+
32
+ Started GET "/assets/jquery-87424c3c19e96d4fb033c10ebe21ec40.js?body=1" for ::1 at 2015-02-10 16:57:28 +0900
33
+
34
+
35
+ Started GET "/assets/turbolinks-da8ddad9c2c5483d4c5c30c1ce325253.js?body=1" for ::1 at 2015-02-10 16:57:29 +0900
36
+
37
+
38
+ Started GET "/" for ::1 at 2015-02-10 16:57:30 +0900
39
+ Processing by TopController#index as HTML
40
+ Rendered app/haviors/misc/todo/views/todo.html.erb (0.3ms)
41
+ Rendered top/index.html.erb within layouts/application (3.4ms)
42
+ Completed 200 OK in 44ms (Views: 43.5ms | ActiveRecord: 0.0ms)
43
+
44
+
45
+ Started GET "/assets/application-5266d2988799ecc8fe6e81eaab412e7d.css?body=1" for ::1 at 2015-02-10 16:57:30 +0900
46
+
47
+
48
+ Started GET "/assets/top-64e62ddc273c2f5847f30d698ca14b67.css?body=1" for ::1 at 2015-02-10 16:57:30 +0900
49
+
50
+
51
+ Started GET "/assets/jquery-87424c3c19e96d4fb033c10ebe21ec40.js?body=1" for ::1 at 2015-02-10 16:57:30 +0900
52
+
53
+
54
+ Started GET "/assets/top-fcec5b5a277ac7c20cc9f45a209a3bcd.js?body=1" for ::1 at 2015-02-10 16:57:30 +0900
55
+
56
+
57
+ Started GET "/assets/jquery_ujs-e27bd20a10d28155845a22d71ef94f2f.js?body=1" for ::1 at 2015-02-10 16:57:30 +0900
58
+
59
+
60
+ Started GET "/assets/turbolinks-da8ddad9c2c5483d4c5c30c1ce325253.js?body=1" for ::1 at 2015-02-10 16:57:30 +0900
61
+
62
+
63
+ Started GET "/assets/application-79e1233a68e5fdd328d8a2ea17ddef8a.js?body=1" for ::1 at 2015-02-10 16:57:30 +0900
64
+
65
+
66
+ Started GET "/" for ::1 at 2015-02-10 16:57:52 +0900
67
+ Processing by TopController#index as HTML
68
+ Rendered app/haviors/misc/todo/views/todo.html.erb (0.2ms)
69
+ Rendered top/index.html.erb within layouts/application (2.9ms)
70
+ Completed 200 OK in 41ms (Views: 40.9ms | ActiveRecord: 0.0ms)
71
+
72
+
73
+ Started GET "/assets/top-64e62ddc273c2f5847f30d698ca14b67.css?body=1" for ::1 at 2015-02-10 16:57:52 +0900
74
+
75
+
76
+ Started GET "/assets/application-5266d2988799ecc8fe6e81eaab412e7d.css?body=1" for ::1 at 2015-02-10 16:57:52 +0900
77
+
78
+
79
+ Started GET "/assets/jquery-87424c3c19e96d4fb033c10ebe21ec40.js?body=1" for ::1 at 2015-02-10 16:57:52 +0900
80
+
81
+
82
+ Started GET "/assets/top-fcec5b5a277ac7c20cc9f45a209a3bcd.js?body=1" for ::1 at 2015-02-10 16:57:52 +0900
83
+
84
+
85
+ Started GET "/assets/jquery_ujs-e27bd20a10d28155845a22d71ef94f2f.js?body=1" for ::1 at 2015-02-10 16:57:52 +0900
86
+
87
+
88
+ Started GET "/assets/turbolinks-da8ddad9c2c5483d4c5c30c1ce325253.js?body=1" for ::1 at 2015-02-10 16:57:52 +0900
89
+
90
+
91
+ Started GET "/assets/application-79e1233a68e5fdd328d8a2ea17ddef8a.js?body=1" for ::1 at 2015-02-10 16:57:52 +0900
92
+
93
+
94
+ Started GET "/havior/misc/todo/list" for ::1 at 2015-02-10 16:57:52 +0900
95
+ Processing by Misc::Todo::TodoController#list as */*
96
+ Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,206 @@
1
+ (function () { "use strict";
2
+ var $hxClasses = {};
3
+ function $extend(from, fields) {
4
+ function Inherit() {} Inherit.prototype = from; var proto = new Inherit();
5
+ for (var name in fields) proto[name] = fields[name];
6
+ if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString;
7
+ return proto;
8
+ }
9
+ var Havior = function(id) {
10
+ this.callbacks = new haxe.ds.StringMap();
11
+ this.id = id;
12
+ this.dom = new $("#" + id);
13
+ };
14
+ $hxClasses["Havior"] = Havior;
15
+ Havior.__name__ = true;
16
+ Havior.start = function(name,pos) {
17
+ Havior.com_name = name;
18
+ var klass = Type.resolveClass(pos.className);
19
+ var class_name = StringTools.replace(name,"/","-");
20
+ var coms = new $(".havior-" + class_name);
21
+ var _g = 0;
22
+ while(_g < coms.length) {
23
+ var com = coms[_g];
24
+ ++_g;
25
+ var id = new $(com).attr("id");
26
+ var c = Type.createInstance(klass,[id]);
27
+ c.onLoad();
28
+ }
29
+ };
30
+ Havior.prototype = {
31
+ onLoad: function() {
32
+ }
33
+ ,getId: function() {
34
+ return this.id;
35
+ }
36
+ ,getDOM: function() {
37
+ return this.dom;
38
+ }
39
+ ,addCallback: function(route,func) {
40
+ if(!this.callbacks.exists(route)) {
41
+ var value = new Array();
42
+ this.callbacks.set(route,value);
43
+ }
44
+ this.callbacks.get(route).push(func);
45
+ }
46
+ ,callCallback: function(route,data) {
47
+ if(this.callbacks.exists(route)) {
48
+ var _g = 0;
49
+ var _g1 = this.callbacks.get(route);
50
+ while(_g < _g1.length) {
51
+ var func = _g1[_g];
52
+ ++_g;
53
+ func(data);
54
+ }
55
+ }
56
+ }
57
+ ,children: function(selector) {
58
+ return new $("#" + this.getId() + " ,#" + this.getId() + " *").children(selector);
59
+ }
60
+ ,getParams: function() {
61
+ return this.getDOM().data();
62
+ }
63
+ ,getParam: function(name) {
64
+ return Reflect.field(this.getParams(),name);
65
+ }
66
+ ,getParamNames: function() {
67
+ return Reflect.fields($bind(this,this.getParams));
68
+ }
69
+ ,sendAsync: function(route,params) {
70
+ var _g = this;
71
+ var xs = route.split("@");
72
+ var action = xs[0];
73
+ var method = xs[1];
74
+ var url = "/havior/" + Havior.com_name + "/" + action;
75
+ var callback = function(data,status,xhr) {
76
+ _g.callCallback(route,data);
77
+ };
78
+ var query;
79
+ switch(method) {
80
+ case "get":
81
+ query = $.get(url,params,callback);
82
+ break;
83
+ case "post":
84
+ query = $.post(url,params,callback);
85
+ break;
86
+ default:
87
+ query = $.post(url,params,callback);
88
+ }
89
+ query.fail(function(e) {
90
+ console.log("ERROR:" + e);
91
+ });
92
+ }
93
+ };
94
+ var IMap = function() { };
95
+ $hxClasses["IMap"] = IMap;
96
+ IMap.__name__ = true;
97
+ var Reflect = function() { };
98
+ $hxClasses["Reflect"] = Reflect;
99
+ Reflect.__name__ = true;
100
+ Reflect.field = function(o,field) {
101
+ try {
102
+ return o[field];
103
+ } catch( e ) {
104
+ return null;
105
+ }
106
+ };
107
+ Reflect.fields = function(o) {
108
+ var a = [];
109
+ if(o != null) {
110
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
111
+ for( var f in o ) {
112
+ if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) a.push(f);
113
+ }
114
+ }
115
+ return a;
116
+ };
117
+ var StringTools = function() { };
118
+ $hxClasses["StringTools"] = StringTools;
119
+ StringTools.__name__ = true;
120
+ StringTools.replace = function(s,sub,by) {
121
+ return s.split(sub).join(by);
122
+ };
123
+ var Todo = function(id) {
124
+ Havior.call(this,id);
125
+ };
126
+ $hxClasses["Todo"] = Todo;
127
+ Todo.__name__ = true;
128
+ Todo.main = function() {
129
+ Havior.start("misc/todo",{ fileName : "Todo.hx", lineNumber : 5, className : "Todo", methodName : "main"});
130
+ };
131
+ Todo.__super__ = Havior;
132
+ Todo.prototype = $extend(Havior.prototype,{
133
+ onLoad: function() {
134
+ var _g = this;
135
+ this.addCallback("list@get",function(data) {
136
+ _g.getDOM().html("list@get:" + data.message);
137
+ });
138
+ this.addCallback("add@post",function(data1) {
139
+ _g.getDOM().html("add@post:" + data1.message);
140
+ });
141
+ this.addCallback("del@get",function(data2) {
142
+ _g.getDOM().html("del@get:" + data2.message);
143
+ });
144
+ this.sendAsync("list@get",{ });
145
+ }
146
+ });
147
+ var Type = function() { };
148
+ $hxClasses["Type"] = Type;
149
+ Type.__name__ = true;
150
+ Type.resolveClass = function(name) {
151
+ var cl = $hxClasses[name];
152
+ if(cl == null || !cl.__name__) return null;
153
+ return cl;
154
+ };
155
+ Type.createInstance = function(cl,args) {
156
+ var _g = args.length;
157
+ switch(_g) {
158
+ case 0:
159
+ return new cl();
160
+ case 1:
161
+ return new cl(args[0]);
162
+ case 2:
163
+ return new cl(args[0],args[1]);
164
+ case 3:
165
+ return new cl(args[0],args[1],args[2]);
166
+ case 4:
167
+ return new cl(args[0],args[1],args[2],args[3]);
168
+ case 5:
169
+ return new cl(args[0],args[1],args[2],args[3],args[4]);
170
+ case 6:
171
+ return new cl(args[0],args[1],args[2],args[3],args[4],args[5]);
172
+ case 7:
173
+ return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);
174
+ case 8:
175
+ return new cl(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
176
+ default:
177
+ throw "Too many arguments";
178
+ }
179
+ return null;
180
+ };
181
+ var haxe = {};
182
+ haxe.ds = {};
183
+ haxe.ds.StringMap = function() {
184
+ this.h = { };
185
+ };
186
+ $hxClasses["haxe.ds.StringMap"] = haxe.ds.StringMap;
187
+ haxe.ds.StringMap.__name__ = true;
188
+ haxe.ds.StringMap.__interfaces__ = [IMap];
189
+ haxe.ds.StringMap.prototype = {
190
+ set: function(key,value) {
191
+ this.h["$" + key] = value;
192
+ }
193
+ ,get: function(key) {
194
+ return this.h["$" + key];
195
+ }
196
+ ,exists: function(key) {
197
+ return this.h.hasOwnProperty("$" + key);
198
+ }
199
+ };
200
+ var $_, $fid = 0;
201
+ function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $fid++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; o.hx__closures__[m.__id__] = f; } return f; }
202
+ String.__name__ = true;
203
+ $hxClasses.Array = Array;
204
+ Array.__name__ = true;
205
+ Todo.main();
206
+ })();