apphtml 0.0.1.p0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +38 -0
  4. data/app/assets/javascripts/apphtml/ajax_setup.js +6 -0
  5. data/app/assets/javascripts/apphtml/debug/ajax_setup.js +9 -0
  6. data/app/assets/javascripts/apphtml/debug/error_message.js +8 -0
  7. data/app/assets/javascripts/apphtml/debug.js +1 -0
  8. data/app/assets/stylesheets/apphtml/base.css.sass +19 -0
  9. data/app/assets/stylesheets/apphtml/system.css.sass +20 -0
  10. data/app/assets/stylesheets/apphtml/website.css.sass +1 -0
  11. data/app/assets/stylesheets/apphtml/yui/base-min.css +7 -0
  12. data/app/assets/stylesheets/apphtml/yui/fonts-min.css +7 -0
  13. data/app/assets/stylesheets/apphtml/yui/reset-min.css +7 -0
  14. data/app/assets/stylesheets/apphtml/yui.css +4 -0
  15. data/app/assets/stylesheets/apphtml/yui_readable/base.css +137 -0
  16. data/app/assets/stylesheets/apphtml/yui_readable/fonts.css +55 -0
  17. data/app/assets/stylesheets/apphtml/yui_readable/reset.css +123 -0
  18. data/app/views/apphtml/_body.html.haml +4 -0
  19. data/app/views/apphtml/_head.html.haml +26 -0
  20. data/lib/apphtml/version.rb +3 -0
  21. data/lib/apphtml.rb +114 -0
  22. data/lib/tasks/apphtml_tasks.rake +4 -0
  23. data/lib/u.rb +14 -0
  24. data/test/apphtml_test.rb +7 -0
  25. data/test/dummy/README.rdoc +261 -0
  26. data/test/dummy/Rakefile +7 -0
  27. data/test/dummy/app/assets/images/favicon.ico +0 -0
  28. data/test/dummy/app/assets/javascripts/application.js +15 -0
  29. data/test/dummy/app/assets/javascripts/index.js +2 -0
  30. data/test/dummy/app/assets/stylesheets/application.css +12 -0
  31. data/test/dummy/app/assets/stylesheets/index.css.sass +10 -0
  32. data/test/dummy/app/controllers/application_controller.rb +3 -0
  33. data/test/dummy/app/controllers/index_controller.rb +5 -0
  34. data/test/dummy/app/helpers/application_helper.rb +5 -0
  35. data/test/dummy/app/helpers/index_helper.rb +2 -0
  36. data/test/dummy/app/views/index/index.html.haml +0 -0
  37. data/test/dummy/app/views/layouts/application.html.haml +16 -0
  38. data/test/dummy/config/application.rb +56 -0
  39. data/test/dummy/config/boot.rb +10 -0
  40. data/test/dummy/config/database.yml +25 -0
  41. data/test/dummy/config/environment.rb +5 -0
  42. data/test/dummy/config/environments/development.rb +37 -0
  43. data/test/dummy/config/environments/production.rb +67 -0
  44. data/test/dummy/config/environments/test.rb +37 -0
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  46. data/test/dummy/config/initializers/inflections.rb +15 -0
  47. data/test/dummy/config/initializers/mime_types.rb +5 -0
  48. data/test/dummy/config/initializers/secret_token.rb +7 -0
  49. data/test/dummy/config/initializers/session_store.rb +8 -0
  50. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  51. data/test/dummy/config/locales/en.yml +5 -0
  52. data/test/dummy/config/routes.rb +61 -0
  53. data/test/dummy/config.ru +4 -0
  54. data/test/dummy/db/development.sqlite3 +0 -0
  55. data/test/dummy/db/test.sqlite3 +0 -0
  56. data/test/dummy/log/development.log +9886 -0
  57. data/test/dummy/public/404.html +26 -0
  58. data/test/dummy/public/422.html +26 -0
  59. data/test/dummy/public/500.html +25 -0
  60. data/test/dummy/public/favicon.ico +0 -0
  61. data/test/dummy/script/rails +6 -0
  62. data/test/dummy/start +0 -0
  63. data/test/dummy/test/functional/index_controller_test.rb +7 -0
  64. data/test/dummy/test/unit/helpers/index_helper_test.rb +4 -0
  65. data/test/dummy/tmp/cache/assets/C29/8A0/sprockets%2Fa899e19256a0845205636938010c6fe5 +0 -0
  66. data/test/dummy/tmp/cache/assets/C49/430/sprockets%2F4e36c950f4917dcc021513981e310293 +0 -0
  67. data/test/dummy/tmp/cache/assets/C87/1C0/sprockets%2Fb2a07598ec8676fd44014a486a458460 +0 -0
  68. data/test/dummy/tmp/cache/assets/C8D/0B0/sprockets%2F5614aa284165993682a4e8e466d8f1b4 +0 -0
  69. data/test/dummy/tmp/cache/assets/CAF/DA0/sprockets%2F314d48e543146f617c4d3439a4d8d40d +0 -0
  70. data/test/dummy/tmp/cache/assets/CB4/900/sprockets%2F227078d8e0c764457ca362a5be105f98 +0 -0
  71. data/test/dummy/tmp/cache/assets/CB5/B70/sprockets%2Fc88e5062809d81b3071f019bf94093bf +0 -0
  72. data/test/dummy/tmp/cache/assets/CB7/A00/sprockets%2F03e3188795591534b3acf2136efdc288 +0 -0
  73. data/test/dummy/tmp/cache/assets/CB7/FD0/sprockets%2F3168514d7061dec24e89184af67a48d3 +0 -0
  74. data/test/dummy/tmp/cache/assets/CD4/550/sprockets%2F472d1f090d8120e367d857eab60ea304 +0 -0
  75. data/test/dummy/tmp/cache/assets/CD4/8F0/sprockets%2F4dab8b3886537611a531e525c7b01a5e +0 -0
  76. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  77. data/test/dummy/tmp/cache/assets/CE8/2F0/sprockets%2F8cf22735d6b28a41fa7930239c76c87b +0 -0
  78. data/test/dummy/tmp/cache/assets/CEB/DC0/sprockets%2Ff8737d1c89a437f3b92c44b425e83b62 +0 -0
  79. data/test/dummy/tmp/cache/assets/CEC/B40/sprockets%2F11c8d9b8f85d581f493cf417386a630a +0 -0
  80. data/test/dummy/tmp/cache/assets/CEC/FA0/sprockets%2Fcee8c6b09c33d2b276753e959712724e +0 -0
  81. data/test/dummy/tmp/cache/assets/CED/280/sprockets%2F59b8c958db242ff5556d389c30a143c7 +0 -0
  82. data/test/dummy/tmp/cache/assets/CEF/0E0/sprockets%2Fd7f791872fb2276d38d671c83166c0ec +0 -0
  83. data/test/dummy/tmp/cache/assets/D03/480/sprockets%2Fcba0b685ff1ac41213841c472973bc56 +0 -0
  84. data/test/dummy/tmp/cache/assets/D17/4C0/sprockets%2F700827acd727b6fc8361f454c68a5cd7 +0 -0
  85. data/test/dummy/tmp/cache/assets/D1A/100/sprockets%2Ffe0850643ef7c8b518659d4a9ae206e3 +0 -0
  86. data/test/dummy/tmp/cache/assets/D2F/850/sprockets%2F27aca49313b0d78232e87514fe3baad1 +0 -0
  87. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  88. data/test/dummy/tmp/cache/assets/D37/340/sprockets%2F00f6571c18af6734fd1dfb8453e2dd10 +0 -0
  89. data/test/dummy/tmp/cache/assets/D3C/DE0/sprockets%2Fdc5ae80aee3e2395db726269a353a373 +0 -0
  90. data/test/dummy/tmp/cache/assets/D4B/960/sprockets%2Ff5c9b5dae466208deda3ad5645888452 +0 -0
  91. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  92. data/test/dummy/tmp/cache/assets/D4F/7B0/sprockets%2F7999e525c88173c1beb785f002effc1d +0 -0
  93. data/test/dummy/tmp/cache/assets/D54/4B0/sprockets%2F18a639ca4023b15ae6f84122c1fa2abd +0 -0
  94. data/test/dummy/tmp/cache/assets/D54/900/sprockets%2F16f82ae781f5ab37ac8296ff3c7e4983 +0 -0
  95. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  96. data/test/dummy/tmp/cache/assets/D64/B40/sprockets%2F5b8762a88ebdaa7520ecb8b125004ec6 +0 -0
  97. data/test/dummy/tmp/cache/assets/D65/970/sprockets%2Fcdc330f1802d7abeae452947c2949ab2 +0 -0
  98. data/test/dummy/tmp/cache/assets/D69/1E0/sprockets%2F4b1d56ea3daee79d9a23b805803d543b +0 -0
  99. data/test/dummy/tmp/cache/assets/D6A/240/sprockets%2F15a21b2d1a981bb73eed9b489fb183d4 +0 -0
  100. data/test/dummy/tmp/cache/assets/D6F/5F0/sprockets%2Fbd810fbc2e8c4583ced3bc923753084f +0 -0
  101. data/test/dummy/tmp/cache/assets/D70/2D0/sprockets%2F2c853768baf811357d81d41bdfd05dcf +0 -0
  102. data/test/dummy/tmp/cache/assets/D72/490/sprockets%2F9927c98e1fe41c23a72aa35bfa46b65e +0 -0
  103. data/test/dummy/tmp/cache/assets/D8A/210/sprockets%2Fb2a0d21e0543acee1dc3a67b60f0e986 +0 -0
  104. data/test/dummy/tmp/cache/assets/D8C/A10/sprockets%2Ffc7201c6cbef32453aa4175c520c8eae +0 -0
  105. data/test/dummy/tmp/cache/assets/D93/360/sprockets%2Fdf600f50f002512c95d93bcfbab891ed +0 -0
  106. data/test/dummy/tmp/cache/assets/D94/E60/sprockets%2Fdce974fbaccc9019214e2560ace91a51 +0 -0
  107. data/test/dummy/tmp/cache/assets/D97/BF0/sprockets%2F37fcabfe92168900f0a42413b7edecb6 +0 -0
  108. data/test/dummy/tmp/cache/assets/D98/C60/sprockets%2Fb90a82cea51687db74c5c4453fc2aa3f +0 -0
  109. data/test/dummy/tmp/cache/assets/D9D/8E0/sprockets%2Fbfddf0fd5b094919c60260c69c570eab +0 -0
  110. data/test/dummy/tmp/cache/assets/D9D/FD0/sprockets%2F26a15db3aa6687bdfd2d41892db82fc5 +0 -0
  111. data/test/dummy/tmp/cache/assets/D9F/A70/sprockets%2F6b0ce813f35afb25d2d9af6f7172c3e7 +0 -0
  112. data/test/dummy/tmp/cache/assets/DAA/F30/sprockets%2F4e39d9c5bf36af8ec625d3abd6c47913 +0 -0
  113. data/test/dummy/tmp/cache/assets/DB5/3D0/sprockets%2F776d3ceda6fc9d2a7d7640568df7e2e6 +0 -0
  114. data/test/dummy/tmp/cache/assets/DC1/4F0/sprockets%2F2c600d881fc9b1c0b6292de2bcaf5ad7 +0 -0
  115. data/test/dummy/tmp/cache/assets/DCE/8A0/sprockets%2Fa4e6fc850dd95639b4e6147abea22ddb +0 -0
  116. data/test/dummy/tmp/cache/assets/DD3/330/sprockets%2Fde2de79c456e9df401b6e2f3843ad2cc +0 -0
  117. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  118. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  119. data/test/dummy/tmp/cache/assets/E53/0A0/sprockets%2F8bc9d0ac1fb3e4f9a43ba61b2f6c5bfc +0 -0
  120. data/test/test_helper.rb +15 -0
  121. metadata +278 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
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.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Apphtml
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Apphtml'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
28
+ require 'rake/testtask'
29
+
30
+ Rake::TestTask.new(:test) do |t|
31
+ t.libs << 'lib'
32
+ t.libs << 'test'
33
+ t.pattern = 'test/**/*_test.rb'
34
+ t.verbose = false
35
+ end
36
+
37
+
38
+ task :default => :test
@@ -0,0 +1,6 @@
1
+ $.ajaxSetup({
2
+ cache: true,
3
+ dataType: 'json',
4
+ timeout: 20000,
5
+ type: 'post'
6
+ });
@@ -0,0 +1,9 @@
1
+ $.ajaxSetup({
2
+ cache: false,
3
+ dataType: 'json',
4
+ error: function(xhr, status, error) {
5
+ $("#ex").html("<p>" + error + "</p>");
6
+ },
7
+ timeout: 60000,
8
+ type: 'post'
9
+ });
@@ -0,0 +1,8 @@
1
+ window.onerror = function(msg, url, line){
2
+ if (onerror.num++ < onerror.max) {
3
+ alert("ERROR:" + msg + "\n" + url + ":" + line);
4
+ return true;
5
+ }
6
+ };
7
+ onerror.max = 3;
8
+ onerror.num = 0;
@@ -0,0 +1 @@
1
+ //= require_tree ./debug
@@ -0,0 +1,19 @@
1
+ .btn:hover
2
+ filter: alpha(opacity=60)
3
+ opacity: 0.6
4
+
5
+ .none
6
+ display: none
7
+
8
+ .hidden, .empty
9
+ visibility: hidden
10
+
11
+ @media print
12
+
13
+ .nonprint, .nonePrint
14
+ display: none
15
+ margin: 0
16
+ padding: 0
17
+
18
+ .hiddenPrint, emptyPrint
19
+ visibility: hidden
@@ -0,0 +1,20 @@
1
+ //= require apphtml/base
2
+
3
+ @media print
4
+ html
5
+ background-color: #ffffff
6
+ margin: 0
7
+ padding: 0
8
+
9
+ body
10
+ min-width: 0
11
+ margin: 0
12
+ padding: 0
13
+
14
+ header, nav, .toTop
15
+ display: none
16
+ margin: 0
17
+ padding: 0
18
+
19
+ input, textarea
20
+ border: none
@@ -0,0 +1 @@
1
+ //= require base
@@ -0,0 +1,7 @@
1
+ /*
2
+ Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.9.0
6
+ */
7
+ body{margin:10px}h1{font-size:138.5%}h2{font-size:123.1%}h3{font-size:108%}h1,h2,h3{margin:1em 0}h1,h2,h3,h4,h5,h6,strong,dt{font-weight:bold}optgroup{font-weight:normal}abbr,acronym{border-bottom:1px dotted #000;cursor:help}em{font-style:italic}del{text-decoration:line-through}blockquote,ul,ol,dl{margin:1em}ol,ul,dl{margin-left:2em}ol{list-style:decimal outside}ul{list-style:disc outside}dl dd{margin-left:1em}th,td{border:1px solid #000;padding:.5em}th{font-weight:bold;text-align:center}caption{margin-bottom:.5em;text-align:center}sup{vertical-align:super}sub{vertical-align:sub}p,fieldset,table,pre{margin-bottom:1em}button,input[type="checkbox"],input[type="radio"],input[type="reset"],input[type="submit"]{padding:1px}img{-ms-interpolation-mode:bicubic}
@@ -0,0 +1,7 @@
1
+ /*
2
+ Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.9.0
6
+ */
7
+ body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small}select,input,textarea,button{font:99% arial,helvetica,clean,sans-serif}table{font-size:inherit;font:100%}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%}
@@ -0,0 +1,7 @@
1
+ /*
2
+ Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.9.0
6
+ */
7
+ html{color:#000;background:#FFF}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,select,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,button,caption,cite,code,dfn,em,input,optgroup,option,select,strong,textarea,th,var{font:inherit}del,ins{text-decoration:none}li{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:baseline}sub{vertical-align:baseline}legend{color:#000}
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require ./yui/reset-min
3
+ *= require ./yui/fonts-min
4
+ */
@@ -0,0 +1,137 @@
1
+ /*
2
+ Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.9.0
6
+ */
7
+ /**
8
+ * YUI Base
9
+ * @module base
10
+ * @namespace yui-
11
+ * @requires reset, fonts
12
+ */
13
+
14
+ body {
15
+ /* For breathing room between content and viewport. */
16
+ margin:10px;
17
+ }
18
+
19
+ h1 {
20
+ /* 18px via YUI Fonts CSS foundation. */
21
+ font-size: 138.5%;
22
+ }
23
+
24
+ h2 {
25
+ /* 16px via YUI Fonts CSS foundation. */
26
+ font-size: 123.1%;
27
+ }
28
+
29
+ h3 {
30
+ /* 14px via YUI Fonts CSS foundation. */
31
+ font-size: 108%;
32
+ }
33
+
34
+ h1,h2,h3 {
35
+ /* Top & bottom margin based on font size. */
36
+ margin: 1em 0;
37
+ }
38
+
39
+ h1,h2,h3,h4,h5,h6,strong,dt {
40
+ /* Bringing boldness back to headers and the strong element. */
41
+ font-weight: bold;
42
+ }
43
+ optgroup {
44
+ font-weight:normal;
45
+ }
46
+
47
+ abbr,acronym {
48
+ /* Indicating to users that more info is available. */
49
+ border-bottom: 1px dotted #000;
50
+ cursor: help;
51
+ }
52
+
53
+ em {
54
+ /* Bringing italics back to the em element. */
55
+ font-style: italic;
56
+ }
57
+
58
+ del {
59
+ /* Striking deleted phrases. */
60
+ text-decoration: line-through;
61
+ }
62
+
63
+ blockquote,ul,ol,dl {
64
+ /* Giving blockquotes and lists room to breath. */
65
+ margin: 1em;
66
+ }
67
+
68
+ ol,ul,dl {
69
+ /* Bringing lists on to the page with breathing room. */
70
+ margin-left: 2em;
71
+ }
72
+
73
+ ol {
74
+ /* Giving OL's LIs generated numbers. */
75
+ list-style: decimal outside;
76
+ }
77
+
78
+ ul {
79
+ /* Giving UL's LIs generated disc markers. */
80
+ list-style: disc outside;
81
+ }
82
+
83
+ dl dd {
84
+ /* Giving DD default indent. */
85
+ margin-left: 1em;
86
+ }
87
+
88
+ th,td {
89
+ /* Borders and padding to make the table readable. */
90
+ border: 1px solid #000;
91
+ padding: .5em;
92
+ }
93
+
94
+ th {
95
+ /* Distinguishing table headers from data cells. */
96
+ font-weight: bold;
97
+ text-align: center;
98
+ }
99
+
100
+ caption {
101
+ /* Coordinated margin to match cell's padding. */
102
+ margin-bottom: .5em;
103
+ /* Centered so it doesn't blend in to other content. */
104
+ text-align: center;
105
+ }
106
+
107
+ sup {
108
+ /* to preserve line-height and selector appearance */
109
+ vertical-align: super;
110
+ }
111
+
112
+ sub {
113
+ /* to preserve line-height and selector appearance */
114
+ vertical-align: sub;
115
+ }
116
+
117
+ p,
118
+ fieldset,
119
+ table,
120
+ pre {
121
+ /* So things don't run into each other. */
122
+ margin-bottom: 1em;
123
+ }
124
+ /* Opera requires 1px of padding to render with contemporary native chrome */
125
+ button,
126
+ input[type="checkbox"],
127
+ input[type="radio"],
128
+ input[type="reset"],
129
+ input[type="submit"] {
130
+ padding:1px;
131
+ }
132
+
133
+ /* make IE scale images properly */
134
+ /* see http://code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ */
135
+ img {
136
+ -ms-interpolation-mode:bicubic;
137
+ }
@@ -0,0 +1,55 @@
1
+ /*
2
+ Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.9.0
6
+ */
7
+ /**
8
+ * YUI Fonts
9
+ * @module fonts
10
+ * @namespace yui-
11
+ * @requires
12
+ */
13
+
14
+ /**
15
+ * Percents could work for IE, but for backCompat purposes, we are using keywords.
16
+ * x-small is for IE6/7 quirks mode.
17
+ */
18
+ body {
19
+ font:13px/1.231 arial,helvetica,clean,sans-serif;
20
+ /* for IE6/7 */
21
+ *font-size:small;
22
+ /* for IE Quirks Mode */
23
+ *font:x-small;
24
+ }
25
+
26
+ /**
27
+ * Nudge down to get to 13px equivalent for these form elements
28
+ */
29
+ select,
30
+ input,
31
+ textarea,
32
+ button {
33
+ font:99% arial,helvetica,clean,sans-serif;
34
+ }
35
+
36
+ /**
37
+ * To help tables remember to inherit
38
+ */
39
+ table {
40
+ font-size:inherit;
41
+ font:100%;
42
+ }
43
+
44
+ /**
45
+ * Bump up IE to get to 13px equivalent for these fixed-width elements
46
+ */
47
+ pre,
48
+ code,
49
+ kbd,
50
+ samp,
51
+ tt {
52
+ font-family:monospace;
53
+ *font-size:108%;
54
+ line-height:100%;
55
+ }
@@ -0,0 +1,123 @@
1
+ /*
2
+ Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.9.0
6
+ */
7
+ /**
8
+ * YUI Reset
9
+ * @module reset
10
+ * @namespace
11
+ * @requires
12
+ */
13
+ html {
14
+ color: #000;
15
+ background: #FFF;
16
+ }
17
+
18
+ body,
19
+ div,
20
+ dl,
21
+ dt,
22
+ dd,
23
+ ul,
24
+ ol,
25
+ li,
26
+ h1,
27
+ h2,
28
+ h3,
29
+ h4,
30
+ h5,
31
+ h6,
32
+ pre,
33
+ code,
34
+ form,
35
+ fieldset,
36
+ legend,
37
+ input,
38
+ button,
39
+ textarea,
40
+ select,
41
+ p,
42
+ blockquote,
43
+ th,
44
+ td {
45
+ margin: 0;
46
+ padding: 0;
47
+ }
48
+
49
+ table {
50
+ border-collapse: collapse;
51
+ border-spacing: 0;
52
+ }
53
+
54
+ fieldset,
55
+ img {
56
+ border: 0;
57
+ }
58
+
59
+ address,
60
+ button,
61
+ caption,
62
+ cite,
63
+ code,
64
+ dfn,
65
+ em,
66
+ input,
67
+ optgroup,
68
+ option,
69
+ select,
70
+ strong,
71
+ textarea,
72
+ th,
73
+ var {
74
+ font:inherit;
75
+ }
76
+
77
+ del,
78
+ ins {
79
+ text-decoration: none;
80
+ }
81
+
82
+ li {
83
+ list-style: none;
84
+ }
85
+
86
+ caption,
87
+ th {
88
+ text-align: left;
89
+ }
90
+
91
+ h1,
92
+ h2,
93
+ h3,
94
+ h4,
95
+ h5,
96
+ h6 {
97
+ font-size: 100%;
98
+ font-weight: normal;
99
+ }
100
+
101
+ q:before,
102
+ q:after {
103
+ content: '';
104
+ }
105
+
106
+ abbr,
107
+ acronym {
108
+ border: 0;
109
+ font-variant: normal;
110
+ }
111
+
112
+ sup {
113
+ vertical-align: baseline;
114
+ }
115
+
116
+ sub {
117
+ vertical-align: baseline;
118
+ }
119
+
120
+ /*because legend doesn't inherit in IE */
121
+ legend {
122
+ color: #000;
123
+ }
@@ -0,0 +1,4 @@
1
+ - if javascripts = apphtml.js_based_on_params(request.path)
2
+ = javascript_include_tag *javascripts
3
+ - unless Rails.env.production?
4
+ #ajax_error_message
@@ -0,0 +1,26 @@
1
+ %head
2
+ %meta(charset="utf-8")
3
+ - if request.user_agent =~ /MSIE\s*(6|7|8)/
4
+ %meta(http-equiv="X-UA-Compatible" content="chrome=1")
5
+ = csrf_meta_tags
6
+ - if defined? @description
7
+ %meta(content="#{@description}" name="description")
8
+ - if defined? @keywords
9
+ %meta(content="#{@keywords}" name="keywords")
10
+ = stylesheet_link_tag 'apphtml/yui', media: media_type
11
+ = stylesheet_link_tag 'application', media: media_type
12
+ - if defined? application_type
13
+ = stylesheet_link_tag "apphtml/#{application_type}", media: media_type
14
+ - unless Dir[%(#{Rails.root}/app/assets/images/favicon.ico)].empty?
15
+ = favicon_link_tag 'favicon.ico'
16
+ - if request.user_agent =~ /MSIE\s*(6|7|8)/
17
+ %script(src="//html5shiv.googlecode.com/svn/trunk/html5.js")
18
+ = javascript_include_tag 'application'
19
+ - unless Rails.env.production?
20
+ = javascript_include_tag 'apphtml/debug'
21
+ - else
22
+ = javascript_include_tag 'apphtml/ajax_setup'
23
+ - if stylesheets = apphtml.css_based_on_params(request.path)
24
+ = stylesheet_link_tag *stylesheets, media: media_type
25
+ - if defined? @title
26
+ %title= @title
@@ -0,0 +1,3 @@
1
+ module Apphtml
2
+ VERSION = "0.0.1.p0"
3
+ end
data/lib/apphtml.rb ADDED
@@ -0,0 +1,114 @@
1
+ require 'u'
2
+
3
+ environment = Sprockets::Environment.new
4
+ environment.append_path File.expand_path('../../app/assets/javascripts', __FILE__)
5
+ environment.append_path File.expand_path('../../app/assets/stylesheets', __FILE__)
6
+
7
+ module Apphtml
8
+ class Engine < Rails::Engine
9
+ paths['app'] << File.expand_path('../../app', __FILE__)
10
+ end
11
+
12
+ module ActionController
13
+ private
14
+ def css
15
+ @css ||= U::uni_array
16
+ end
17
+
18
+ def js
19
+ @js ||= U::uni_array
20
+ end
21
+ end
22
+
23
+
24
+ module ApplicationHelper
25
+ def media_type
26
+ @media_type ||= :"screen, handheld, tv, projection, print"
27
+ end
28
+
29
+ def media_type= typ
30
+ @media_type = typ
31
+ end
32
+
33
+ def css
34
+ @css ||= U::uni_array
35
+ end
36
+
37
+ def js
38
+ @js ||= U::uni_array
39
+ end
40
+ end
41
+
42
+
43
+ class Helper
44
+
45
+ @@helperself = nil
46
+
47
+ def initialize css, js
48
+ @css = css
49
+ @js = js
50
+ end
51
+
52
+ def css_based_on_params request_path
53
+ add *(to_path(based_on_params(request_path), :css))
54
+ end
55
+
56
+ def js_based_on_params request_path
57
+ add *(to_path(based_on_params(request_path), :js))
58
+ end
59
+
60
+ def based_on_params request_path
61
+ pathset = []
62
+ request_path.split('/').each_with_object("") do |dir,txt|
63
+ unless dir =~ /^\s*$/
64
+ txt << "/#{dir}"
65
+ pathset << txt.dup unless pathset.include?(txt)
66
+ end
67
+ end
68
+ pathset
69
+ end
70
+
71
+ def to_path pathset, typ
72
+ resp = pathset.each_with_object([]) do |pth,resp|
73
+ pth.sub!(%r{^/}, '')
74
+ unless Dir[(dir(typ) % pth)].empty?
75
+ resp << pth
76
+ end
77
+ end
78
+ [resp, typ]
79
+ end
80
+
81
+ def dir typ
82
+ case
83
+ when :css
84
+ @css_dir ||= %{#{Rails.root}/app/assets/stylesheets/%s.css*}
85
+ when :js
86
+ @js_dir ||= %{#{Rails.root}/app/assets/javascripts/%s.js*}
87
+ end
88
+ end
89
+
90
+ def js_dir
91
+ @js_dir ||= %{#{Rails.root}/app/assets/javascripts/%s.js*}
92
+ end
93
+
94
+ def add pathset, typ
95
+ subject = case typ
96
+ when :css then @css
97
+ when :js then @js
98
+ end
99
+
100
+ if subject
101
+ subject.each do |pth|
102
+ pathset << pth unless Dir[(dir(typ) % pth)].empty?
103
+ end
104
+ end
105
+ pathset
106
+ end
107
+ end
108
+
109
+ end
110
+
111
+ ActionController::Base.send :include, Apphtml::ActionController
112
+ module ApplicationHelper
113
+ include Apphtml::ApplicationHelper
114
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :apphtml do
3
+ # # Task goes here
4
+ # end
data/lib/u.rb ADDED
@@ -0,0 +1,14 @@
1
+ # coding: utf-8
2
+
3
+ module U
4
+
5
+ def uni_array *args
6
+ uni_a = Array.new(*args)
7
+ def uni_a.<<(v)
8
+ super unless include?(v)
9
+ end
10
+ uni_a
11
+ end
12
+ module_function :uni_array
13
+
14
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class ApphtmlTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Apphtml
6
+ end
7
+ end