plinth 0.0.1.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (237) hide show
  1. data/.codoopts +10 -0
  2. data/.env +1 -0
  3. data/.gitignore +23 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +1 -0
  6. data/Capfile +4 -0
  7. data/Gemfile +52 -0
  8. data/Gemfile.lock +243 -0
  9. data/Guardfile +9 -0
  10. data/LICENSE +22 -0
  11. data/Procfile +1 -0
  12. data/README.md +79 -0
  13. data/Rakefile +35 -0
  14. data/app/assets/images/layouts/basic-marketing-site.png +0 -0
  15. data/app/assets/images/layouts/jumbotron-site.png +0 -0
  16. data/app/assets/images/rails.png +0 -0
  17. data/app/assets/javascripts/application.js +17 -0
  18. data/app/assets/javascripts/base.js.coffee +3 -0
  19. data/app/assets/javascripts/grids.js.coffee +3 -0
  20. data/app/assets/javascripts/javascript.js.coffee +3 -0
  21. data/app/assets/javascripts/lib/modernizr.js +4 -0
  22. data/app/assets/javascripts/modules.js.coffee +3 -0
  23. data/app/assets/stylesheets/application-old-ie.css.scss +10 -0
  24. data/app/assets/stylesheets/application.css.scss +57 -0
  25. data/app/assets/stylesheets/base/_all.scss +6 -0
  26. data/app/assets/stylesheets/base/_reset.css.scss +16 -0
  27. data/app/assets/stylesheets/base/_type.scss +16 -0
  28. data/app/assets/stylesheets/modules/_coderay.css.scss +171 -0
  29. data/app/assets/stylesheets/modules/_layout_examples.css.scss +13 -0
  30. data/app/assets/stylesheets/modules/_webfont_table.css.scss +47 -0
  31. data/app/assets/stylesheets/vanilla-normal-old-ie.css.scss +11 -0
  32. data/app/assets/stylesheets/vanilla-normal.css.scss +33 -0
  33. data/app/controllers/application_controller.rb +5 -0
  34. data/app/controllers/base_controller.rb +52 -0
  35. data/app/controllers/grids_controller.rb +48 -0
  36. data/app/controllers/javascript_controller.rb +20 -0
  37. data/app/controllers/javascripts_controller.rb +4 -0
  38. data/app/controllers/modules_controller.rb +43 -0
  39. data/app/controllers/ui_controller.rb +2 -0
  40. data/app/helpers/plinth_helper.rb +33 -0
  41. data/app/views/base/_webfonts_social_standard.html +429 -0
  42. data/app/views/base/_webfonts_ss_standard.html +2413 -0
  43. data/app/views/base/buttons.html.haml +20 -0
  44. data/app/views/base/forms.html.haml +40 -0
  45. data/app/views/base/images.html.haml +20 -0
  46. data/app/views/base/index.html.haml +68 -0
  47. data/app/views/base/labels.html.haml +22 -0
  48. data/app/views/base/lists.html.haml +20 -0
  49. data/app/views/base/webfonts.html.haml +17 -0
  50. data/app/views/grids/index.html.haml +73 -0
  51. data/app/views/grids/layouts/basic-marketing-site.haml +69 -0
  52. data/app/views/grids/layouts/jumbotron-site.haml +92 -0
  53. data/app/views/grids/layouts.html.haml +9 -0
  54. data/app/views/layouts/_main_nav.html.haml +15 -0
  55. data/app/views/layouts/application.html.haml +15 -0
  56. data/app/views/modules/alerts.html.haml +12 -0
  57. data/app/views/modules/footer.html.haml +2 -0
  58. data/app/views/modules/index.html.haml +5 -0
  59. data/app/views/modules/nav.html.haml +12 -0
  60. data/app/views/modules/panels.html.haml +3 -0
  61. data/app/views/modules/tabs.html.haml +58 -0
  62. data/app/views/old_javascript/close.html.haml +2 -0
  63. data/app/views/old_javascript/forms.html.haml +2 -0
  64. data/app/views/old_javascript/ga_events.html.haml +2 -0
  65. data/app/views/old_javascript/index.html.haml +2 -0
  66. data/app/views/old_javascript/responsive_resize.html.haml +2 -0
  67. data/app/views/old_javascript/switch.html.haml +2 -0
  68. data/app/views/parts/base/_button.haml +3 -0
  69. data/app/views/parts/base/_button_colours.haml +4 -0
  70. data/app/views/parts/base/_button_group.haml +4 -0
  71. data/app/views/parts/base/_button_sizing.haml +3 -0
  72. data/app/views/parts/base/_button_states.haml +3 -0
  73. data/app/views/parts/base/_form_example.haml +26 -0
  74. data/app/views/parts/base/_form_example_horizontal.haml +26 -0
  75. data/app/views/parts/base/_form_group.haml +10 -0
  76. data/app/views/parts/base/_form_location.haml +3 -0
  77. data/app/views/parts/base/_labels.haml +5 -0
  78. data/app/views/parts/base/_labels_sizing.haml +3 -0
  79. data/app/views/parts/base/_list.haml +10 -0
  80. data/app/views/parts/base/_list_action.haml +5 -0
  81. data/app/views/parts/base/_list_nav.haml +12 -0
  82. data/app/views/parts/base/_list_unset.haml +10 -0
  83. data/app/views/parts/base/_type_body.haml +2 -0
  84. data/app/views/parts/base/_type_headings.haml +5 -0
  85. data/app/views/parts/base/_type_helpers.haml +3 -0
  86. data/app/views/parts/base/_type_links.haml +9 -0
  87. data/app/views/parts/base/_type_shouts.haml +4 -0
  88. data/app/views/parts/grids/_example_layout_1.haml +10 -0
  89. data/app/views/parts/grids/_live_grid.haml +29 -0
  90. data/app/views/parts/modules/_alerts.haml +11 -0
  91. data/app/views/parts/modules/_nav_footer.haml +34 -0
  92. data/app/views/parts/modules/_nav_header.haml +18 -0
  93. data/app/views/parts/modules/_panels.haml +9 -0
  94. data/app/views/parts/modules/_tabs_minimal.haml +11 -0
  95. data/app/views/parts/modules/_tabs_simple_group.haml +11 -0
  96. data/app/views/parts/modules/_tabs_simple_group_toggle.haml +11 -0
  97. data/app/views/parts/modules/_tabs_toggle.haml +5 -0
  98. data/app/views/parts/modules/_tabs_traditional.haml +11 -0
  99. data/app/views/shared/_placeholder_text.html.haml +1 -0
  100. data/app/views/shared/_title.html.haml +8 -0
  101. data/app/views/shared/_ui_nav.html.haml +5 -0
  102. data/app/views/ui/alert.html.haml +35 -0
  103. data/app/views/ui/buttons.html.haml +116 -0
  104. data/app/views/ui/footer.html.haml +69 -0
  105. data/app/views/ui/forms/_vertical_form.haml +7 -0
  106. data/app/views/ui/forms.html.haml +59 -0
  107. data/app/views/ui/grids.html.haml +18 -0
  108. data/app/views/ui/index.html.haml +5 -0
  109. data/app/views/ui/labels.html.haml +15 -0
  110. data/app/views/ui/modules/panel.html.haml +3 -0
  111. data/app/views/ui/nav.html.haml +48 -0
  112. data/app/views/ui/tabs.html.haml +171 -0
  113. data/app/views/ui/typography.html.haml +118 -0
  114. data/db/development.sqlite3 +0 -0
  115. data/db/seeds.rb +7 -0
  116. data/doc/README_FOR_APP +2 -0
  117. data/lib/assets/.gitkeep +0 -0
  118. data/lib/plinth/version.rb +3 -0
  119. data/lib/plinth.rb +11 -0
  120. data/lib/tasks/.gitkeep +0 -0
  121. data/lib/templates/haml/scaffold/_form.html.haml +8 -0
  122. data/log/.gitkeep +0 -0
  123. data/plinth.gemspec +33 -0
  124. data/public/404.html +26 -0
  125. data/public/422.html +26 -0
  126. data/public/500.html +25 -0
  127. data/public/favicon.ico +0 -0
  128. data/public/javascripts/LICENSE.html +158 -0
  129. data/public/javascripts/README.md.html +163 -0
  130. data/public/javascripts/assets/codo.css +1 -0
  131. data/public/javascripts/assets/codo.js +21 -0
  132. data/public/javascripts/assets/search_data.js +1 -0
  133. data/public/javascripts/class_index.html +215 -0
  134. data/public/javascripts/class_list.html +58 -0
  135. data/public/javascripts/classes/Close.html +259 -0
  136. data/public/javascripts/classes/GAEvent.html +231 -0
  137. data/public/javascripts/classes/ResizeHandler.html +225 -0
  138. data/public/javascripts/classes/Switch.html +318 -0
  139. data/public/javascripts/classes/TBGForm.html +373 -0
  140. data/public/javascripts/extra_list.html +36 -0
  141. data/public/javascripts/file_list.html +74 -0
  142. data/public/javascripts/files/styleguide/plugins/tbg-close.js.coffee.html +160 -0
  143. data/public/javascripts/files/styleguide/plugins/tbg-forms.js.coffee.html +160 -0
  144. data/public/javascripts/files/styleguide/plugins/tbg-ga-events.js.coffee.html +160 -0
  145. data/public/javascripts/files/styleguide/plugins/tbg-respinsiveresize.js.coffee.html +160 -0
  146. data/public/javascripts/files/styleguide/plugins/tbg-switch.js.coffee.html +160 -0
  147. data/public/javascripts/index.html +14 -0
  148. data/public/javascripts/method_list.html +187 -0
  149. data/public/javascripts/mixin_list.html +28 -0
  150. data/public/robots.txt +5 -0
  151. data/script/rails +6 -0
  152. data/spec/javascripts/fixtures/plugins/tbg-close_fixture.html.haml +4 -0
  153. data/spec/javascripts/fixtures/plugins/tbg-forms_fixture.html.haml +12 -0
  154. data/spec/javascripts/fixtures/plugins/tbg-ga-events_fixture.html.haml +9 -0
  155. data/spec/javascripts/fixtures/plugins/tbg-switch_fixture.html.haml +11 -0
  156. data/spec/javascripts/plugins/tbg-close_spec.js.coffee +54 -0
  157. data/spec/javascripts/plugins/tbg-forms_spec.js.coffee +87 -0
  158. data/spec/javascripts/plugins/tbg-ga-events_spec.js.coffee +83 -0
  159. data/spec/javascripts/plugins/tbg-switch_spec.js.coffee +96 -0
  160. data/spec/javascripts/spec.js.coffee +2 -0
  161. data/vendor/assets/fonts/ss-social-circle.eot +0 -0
  162. data/vendor/assets/fonts/ss-social-circle.svg +139 -0
  163. data/vendor/assets/fonts/ss-social-circle.ttf +0 -0
  164. data/vendor/assets/fonts/ss-social-circle.woff +0 -0
  165. data/vendor/assets/fonts/ss-social-regular.eot +0 -0
  166. data/vendor/assets/fonts/ss-social-regular.svg +133 -0
  167. data/vendor/assets/fonts/ss-social-regular.ttf +0 -0
  168. data/vendor/assets/fonts/ss-social-regular.woff +0 -0
  169. data/vendor/assets/fonts/ss-social.js +75 -0
  170. data/vendor/assets/fonts/ss-standard.eot +0 -0
  171. data/vendor/assets/fonts/ss-standard.js +75 -0
  172. data/vendor/assets/fonts/ss-standard.svg +207 -0
  173. data/vendor/assets/fonts/ss-standard.ttf +0 -0
  174. data/vendor/assets/fonts/ss-standard.woff +0 -0
  175. data/vendor/assets/images/background.png +0 -0
  176. data/vendor/assets/images/logos/sb-logo-white.png +0 -0
  177. data/vendor/assets/images/logos/sb-logo-white.svg +5 -0
  178. data/vendor/assets/images/middleman.png +0 -0
  179. data/vendor/assets/index.html.haml +8 -0
  180. data/vendor/assets/javascripts/.gitkeep +0 -0
  181. data/vendor/assets/javascripts/plinth/lib/handlebars.js +3 -0
  182. data/vendor/assets/javascripts/plinth/lib/jquery.fitvids.js +81 -0
  183. data/vendor/assets/javascripts/plinth/lib/ss-social.js +75 -0
  184. data/vendor/assets/javascripts/plinth/lib/ss-standard.js +78 -0
  185. data/vendor/assets/javascripts/plinth/plugins/doc/assets/codo.css +1 -0
  186. data/vendor/assets/javascripts/plinth/plugins/doc/assets/codo.js +21 -0
  187. data/vendor/assets/javascripts/plinth/plugins/doc/assets/search_data.js +1 -0
  188. data/vendor/assets/javascripts/plinth/plugins/doc/class_index.html +194 -0
  189. data/vendor/assets/javascripts/plinth/plugins/doc/class_list.html +58 -0
  190. data/vendor/assets/javascripts/plinth/plugins/doc/classes/Close.html +215 -0
  191. data/vendor/assets/javascripts/plinth/plugins/doc/classes/GAEvent.html +235 -0
  192. data/vendor/assets/javascripts/plinth/plugins/doc/classes/ResizeHandler.html +192 -0
  193. data/vendor/assets/javascripts/plinth/plugins/doc/classes/Switch.html +233 -0
  194. data/vendor/assets/javascripts/plinth/plugins/doc/classes/TBGForm.html +318 -0
  195. data/vendor/assets/javascripts/plinth/plugins/doc/extra_list.html +30 -0
  196. data/vendor/assets/javascripts/plinth/plugins/doc/file_list.html +58 -0
  197. data/vendor/assets/javascripts/plinth/plugins/doc/files/tbg-close.js.coffee.html +154 -0
  198. data/vendor/assets/javascripts/plinth/plugins/doc/files/tbg-forms.js.coffee.html +154 -0
  199. data/vendor/assets/javascripts/plinth/plugins/doc/files/tbg-ga-events.js.coffee.html +154 -0
  200. data/vendor/assets/javascripts/plinth/plugins/doc/files/tbg-respinsiveresize.js.coffee.html +154 -0
  201. data/vendor/assets/javascripts/plinth/plugins/doc/files/tbg-switch.js.coffee.html +154 -0
  202. data/vendor/assets/javascripts/plinth/plugins/doc/index.html +14 -0
  203. data/vendor/assets/javascripts/plinth/plugins/doc/method_list.html +163 -0
  204. data/vendor/assets/javascripts/plinth/plugins/doc/mixin_list.html +28 -0
  205. data/vendor/assets/javascripts/plinth/plugins/tbg-close.js.coffee +97 -0
  206. data/vendor/assets/javascripts/plinth/plugins/tbg-forms.js.coffee +156 -0
  207. data/vendor/assets/javascripts/plinth/plugins/tbg-ga-events.js.coffee +107 -0
  208. data/vendor/assets/javascripts/plinth/plugins/tbg-respinsiveresize.js.coffee +73 -0
  209. data/vendor/assets/javascripts/plinth/plugins/tbg-switch.js.coffee +121 -0
  210. data/vendor/assets/stylesheets/.gitkeep +0 -0
  211. data/vendor/assets/stylesheets/_functions.scss +28 -0
  212. data/vendor/assets/stylesheets/_mixins.css.scss +273 -0
  213. data/vendor/assets/stylesheets/_settings.css.scss +120 -0
  214. data/vendor/assets/stylesheets/plinth/base/_all.css.scss +7 -0
  215. data/vendor/assets/stylesheets/plinth/base/_buttons.css.scss +166 -0
  216. data/vendor/assets/stylesheets/plinth/base/_form.css.scss +196 -0
  217. data/vendor/assets/stylesheets/plinth/base/_labels.css.scss +58 -0
  218. data/vendor/assets/stylesheets/plinth/base/_lists.css.scss +57 -0
  219. data/vendor/assets/stylesheets/plinth/base/_reset.css.scss +284 -0
  220. data/vendor/assets/stylesheets/plinth/base/_type.css.scss +328 -0
  221. data/vendor/assets/stylesheets/plinth/base/webfonts/_all.css.scss +2 -0
  222. data/vendor/assets/stylesheets/plinth/base/webfonts/ss-social.css.scss +57 -0
  223. data/vendor/assets/stylesheets/plinth/base/webfonts/ss-standard.css.scss +48 -0
  224. data/vendor/assets/stylesheets/plinth/grid/_grid.css.scss +127 -0
  225. data/vendor/assets/stylesheets/plinth/modules/_alert.css.scss +71 -0
  226. data/vendor/assets/stylesheets/plinth/modules/_all-grid.css.scss +1 -0
  227. data/vendor/assets/stylesheets/plinth/modules/_all-no-grid.css.scss +4 -0
  228. data/vendor/assets/stylesheets/plinth/modules/_footer.css.scss +93 -0
  229. data/vendor/assets/stylesheets/plinth/modules/_nav.css.scss +106 -0
  230. data/vendor/assets/stylesheets/plinth/modules/_panel.css.scss +28 -0
  231. data/vendor/assets/stylesheets/plinth/modules/_switch.css.scss +88 -0
  232. data/vendor/assets/stylesheets/plinth.css.scss +15 -0
  233. data/vendor/assets/views/buttons/_buttons.haml +9 -0
  234. data/vendor/assets/views/forms/_vertical_form.haml +7 -0
  235. data/vendor/assets/views/type/_headings.haml +6 -0
  236. data/vendor/assets/views/type/_paragraphs.haml +4 -0
  237. metadata +537 -0
@@ -0,0 +1,163 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='UTF-8'>
5
+ <title>CoffeeScript API Documentation</title>
6
+ <link rel='stylesheet' href='assets/codo.css' type='text/css'>
7
+ <script src='assets/codo.js'></script>
8
+ <script src='assets/search_data.js'></script>
9
+ </head>
10
+ <body class='list'>
11
+ <div class='list' id='content'>
12
+ <h1 class='full_list_header'>Method List</h1>
13
+ <nav>
14
+ <a target='_self' href='class_list.html'>Classes</a>
15
+ <a target='_self' href='file_list.html'>Files</a>
16
+ <a target='_self' href='method_list.html'>Methods</a>
17
+ <a target='_self' href='extra_list.html'>Extras</a>
18
+ </nav>
19
+ <div id='search'>
20
+ Search:
21
+ <input type='text'>
22
+ </div>
23
+ <ul>
24
+ <li>
25
+ <a href='classes/Switch.html#_closeGroup-instance' target='main' title='_closeGroup'>
26
+ #_closeGroup
27
+ </a>
28
+ <small>
29
+ (Switch)
30
+ </small>
31
+ </li>
32
+ <li>
33
+ <a href='classes/Switch.html#_getContent-instance' target='main' title='_getContent'>
34
+ #_getContent
35
+ </a>
36
+ <small>
37
+ (Switch)
38
+ </small>
39
+ </li>
40
+ <li>
41
+ <a href='classes/Switch.html#changeStateTo-instance' target='main' title='changeStateTo'>
42
+ #changeStateTo
43
+ </a>
44
+ <small>
45
+ (Switch)
46
+ </small>
47
+ </li>
48
+ <li>
49
+ <a href='classes/Switch.html#click-instance' target='main' title='click'>
50
+ #click
51
+ </a>
52
+ <small>
53
+ (Switch)
54
+ </small>
55
+ </li>
56
+ <li>
57
+ <a href='classes/Close.html#close-instance' target='main' title='close'>
58
+ #close
59
+ </a>
60
+ <small>
61
+ (Close)
62
+ </small>
63
+ </li>
64
+ <li>
65
+ <a href='files/tbg-close.js.coffee.html#plugin-file' target='main' title='plugin'>
66
+ .plugin
67
+ </a>
68
+ <small>
69
+ (tbg-close.js.coffee)
70
+ </small>
71
+ </li>
72
+ <li>
73
+ <a href='files/tbg-forms.js.coffee.html#plugin-file' target='main' title='plugin'>
74
+ .plugin
75
+ </a>
76
+ <small>
77
+ (tbg-forms.js.coffee)
78
+ </small>
79
+ </li>
80
+ <li>
81
+ <a href='files/tbg-ga-events.js.coffee.html#plugin-file' target='main' title='plugin'>
82
+ .plugin
83
+ </a>
84
+ <small>
85
+ (tbg-ga-events.js.coffee)
86
+ </small>
87
+ </li>
88
+ <li>
89
+ <a href='files/tbg-respinsiveresize.js.coffee.html#plugin-file' target='main' title='plugin'>
90
+ .plugin
91
+ </a>
92
+ <small>
93
+ (tbg-respinsiveresize.js.coffee)
94
+ </small>
95
+ </li>
96
+ <li>
97
+ <a href='files/tbg-switch.js.coffee.html#plugin-file' target='main' title='plugin'>
98
+ .plugin
99
+ </a>
100
+ <small>
101
+ (tbg-switch.js.coffee)
102
+ </small>
103
+ </li>
104
+ <li>
105
+ <a href='classes/ResizeHandler.html#resize-instance' target='main' title='resize'>
106
+ #resize
107
+ </a>
108
+ <small>
109
+ (ResizeHandler)
110
+ </small>
111
+ </li>
112
+ <li>
113
+ <a href='classes/TBGForm.html#send-instance' target='main' title='send'>
114
+ #send
115
+ </a>
116
+ <small>
117
+ (TBGForm)
118
+ </small>
119
+ </li>
120
+ <li>
121
+ <a href='classes/GAEvent.html#sendEvent-instance' target='main' title='sendEvent'>
122
+ #sendEvent
123
+ </a>
124
+ <small>
125
+ (GAEvent)
126
+ </small>
127
+ </li>
128
+ <li>
129
+ <a href='classes/TBGForm.html#sendRequest-instance' target='main' title='sendRequest'>
130
+ #sendRequest
131
+ </a>
132
+ <small>
133
+ (TBGForm)
134
+ </small>
135
+ </li>
136
+ <li>
137
+ <a href='classes/TBGForm.html#showErrors-instance' target='main' title='showErrors'>
138
+ #showErrors
139
+ </a>
140
+ <small>
141
+ (TBGForm)
142
+ </small>
143
+ </li>
144
+ <li>
145
+ <a href='classes/TBGForm.html#showSuccess-instance' target='main' title='showSuccess'>
146
+ #showSuccess
147
+ </a>
148
+ <small>
149
+ (TBGForm)
150
+ </small>
151
+ </li>
152
+ <li>
153
+ <a href='classes/ResizeHandler.html#size-instance' target='main' title='size'>
154
+ #size
155
+ </a>
156
+ <small>
157
+ (ResizeHandler)
158
+ </small>
159
+ </li>
160
+ </ul>
161
+ </div>
162
+ </body>
163
+ </html>
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='UTF-8'>
5
+ <title>CoffeeScript API Documentation</title>
6
+ <link rel='stylesheet' href='assets/codo.css' type='text/css'>
7
+ <script src='assets/codo.js'></script>
8
+ <script src='assets/search_data.js'></script>
9
+ </head>
10
+ <body class='list'>
11
+ <div class='list tree' id='content'>
12
+ <h1 class='full_list_header'>Mixin List</h1>
13
+ <nav>
14
+ <a target='_self' href='class_list.html'>Classes</a>
15
+ <a target='_self' href='file_list.html'>Files</a>
16
+ <a target='_self' href='method_list.html'>Methods</a>
17
+ <a target='_self' href='extra_list.html'>Extras</a>
18
+ </nav>
19
+ <div id='search'>
20
+ Search:
21
+ <input type='text'>
22
+ </div>
23
+ <ul>
24
+ </ul>
25
+
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,97 @@
1
+ # ============================================================
2
+ # TBG close v0.0.1
3
+ # http://URL
4
+ # ============================================================
5
+ # Copyright 2012 The Beans Group
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ plugin = ($)->
21
+
22
+ "use strict"
23
+
24
+ # CLOSE CLASS DEFINITION
25
+ #
26
+ # @example How to use the class
27
+ # closeInstance = new Close $('.my-element')
28
+ # # Close element
29
+ # closeInstance.close()
30
+ #
31
+ # @example How to use the class with jQuery
32
+ # $('.my-element').close('close')
33
+ #
34
+ # @example How to ensure plugin self initialises on element
35
+ # <div data-close> Close me </div>
36
+ #
37
+ class Close
38
+
39
+ # Construct a new Close instance
40
+ #
41
+ # @param [Object] element HTMLElement on which we will try to close
42
+ #
43
+ constructor: ( element ) ->
44
+ $el = $(element)
45
+ @$target = @_getTarget $el
46
+
47
+ # Expose the Class
48
+ _constructor: Close
49
+
50
+ # Close the element - Triggers 'close' event on this.$target then removes this.$target
51
+ #
52
+ close : ->
53
+ if not @$target then return false
54
+ @$target.trigger 'close'
55
+ @$target.remove()
56
+
57
+ # Get the target element to be closed
58
+ #
59
+ # @private
60
+ # @param [Object] $el jQuery wrapped HTMLElement to get target to be closed from
61
+ # @return [Object] jQuery wrapped HTMLElement to be closed
62
+ #
63
+ _getTarget: ($el) ->
64
+ # Get target from data element
65
+ target = (dataEl = $( $el.attr('data-close') )).length && dataEl
66
+ # else get from href
67
+ if not target then target = (dataEl = $( $el.attr('href') )).length && dataEl
68
+ target
69
+
70
+ # CLOSE PLUGIN DEFINITION
71
+ # ==========================
72
+
73
+ $.fn.close = ( option ) ->
74
+ this.each ->
75
+ $this = $(@)
76
+ data = $this.data 'closePlugin'
77
+ if !data then $this.data 'closePlugin', (data = new Close @)
78
+ if typeof option is 'string' then data[option]()
79
+
80
+ $.fn.close.Constructor = Close
81
+
82
+
83
+ # DATA API
84
+ # ===================================
85
+
86
+ $ ->
87
+ $('body').on 'click.close.data-api', '[data-close]', ( e ) ->
88
+ $(e.target).close('close')
89
+ e.preventDefault()
90
+
91
+ do ( plugin ) ->
92
+ if typeof define is 'function' and define.amd
93
+ # AMD. Register as an anonymous module.
94
+ define(['jquery'], plugin);
95
+ else
96
+ # Browser globals
97
+ plugin(jQuery)
@@ -0,0 +1,156 @@
1
+ # ============================================================
2
+ # Forms v0.0.1
3
+ # ============================================================
4
+ # Copyright 2012 The Beans Group
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+
20
+ plugin = ($)->
21
+
22
+ "use strict"
23
+
24
+ # FORM CLASS DEFINITION
25
+ #
26
+ # @example How to use the class
27
+ # formInstance = new TBGForm $('.my-element')
28
+ # # Send form
29
+ # formInstance.send()
30
+ #
31
+ # @example How to use the class with jQuery
32
+ # $('.my-element').send()
33
+ #
34
+ # @example How to ensure plugin self initialises on element
35
+ # <form data-forms="/endpoint"> ... </form>
36
+ #
37
+ class TBGForm
38
+
39
+ # Construct a new TBGForm instance
40
+ #
41
+ # @param [Object] element form we will attach the TBGForm to
42
+ #
43
+ constructor: ( element ) ->
44
+ @form = $(element)
45
+ @send()
46
+
47
+ _constructor: TBGForm
48
+
49
+ # Send the form, calls sendRequest passing form data and url to post to
50
+ #
51
+ send : ->
52
+ if not (url = @form.data('forms') || @form.attr('action')) then return false
53
+ @sendRequest @form.serialize(), url
54
+
55
+ # Execute ajax post
56
+ #
57
+ # @param [String] data serialized form data
58
+ # @param [String] url URL to post form to
59
+ #
60
+ sendRequest : (data, url)->
61
+ $.ajax
62
+ type: 'POST'
63
+ url: url
64
+ data: data
65
+ dataType: "json"
66
+ success: (successData)=>
67
+ @showSuccess(successData)
68
+ error: (err) =>
69
+ @showErrors $.parseJSON(err.responseText)
70
+
71
+ # Handle form post errors - called from sendRequest error callback.
72
+ #
73
+ # Clear previous errors, add error classes to relevent fields and labels and add error message summary
74
+ #
75
+ # @param [Object] errors errors object
76
+ #
77
+ showErrors :( errors )->
78
+ @form.find('.form-msg.is-error').remove()
79
+ @form.find('.is-error').removeClass('is-error')
80
+
81
+ for field, error of errors
82
+ $this = @form.find("[id$=#{field}]").addClass('is-error')
83
+ if not msg = ($this.siblings(".form-msg"))[0] then msg = $("<small class='form-msg'></small>").insertAfter($this)
84
+ msg.text( "#{field} " + error.join(' & ') ).addClass('is-error')
85
+ $this.siblings('label').addClass('is-error')
86
+
87
+ # Handle form post success - called from sendRequest success callback.
88
+ #
89
+ # Pass empty error object to showErrors; if Handlebars defined
90
+ # call _showSuccessTemplated with data object otherwise call
91
+ # _showSuccessPlain; trigger 'tbgform-success' event with form data; fade form if necessary
92
+ #
93
+ # @param [Object] data response from ajax post
94
+ #
95
+ showSuccess: (data)->
96
+ @showErrors {}
97
+ if Handlebars?
98
+ @_showSuccessTemplated data
99
+ else
100
+ @_showSuccessPlain()
101
+ $('body').trigger 'tbgform-success', [@form]
102
+ if @form.data 'formsSuccessFormfade' then @form.fadeOut()
103
+
104
+ # Display compiled success template
105
+ #
106
+ # Compile template from data-formsSuccessContent; display with data object
107
+ #
108
+ # @private
109
+ # @param [Object] data data object from showSuccess
110
+ #
111
+ _showSuccessTemplated: (data)->
112
+ template = Handlebars.compile @form.data('formsSuccessContent')
113
+ successArea = $(@form.data 'formsSuccessReplace')
114
+ successArea.fadeOut().html( template(data) ).fadeIn()
115
+
116
+ # Display success with replaced content
117
+ #
118
+ # Display data-formsSuccessContent HTML
119
+ #
120
+ # @private
121
+ #
122
+ _showSuccessPlain: ->
123
+ @successArea = $(@form.data 'formsSuccessReplace')
124
+ @successHTML = @form.data 'formsSuccessContent'
125
+ @successArea.fadeOut().html(@successHTML).fadeIn()
126
+
127
+
128
+
129
+
130
+ # DOWNLOADFORM PLUGIN DEFINITION
131
+ # ==========================
132
+
133
+ $.fn.forms = ( option ) ->
134
+ this.each ->
135
+ $this = $(@)
136
+ data = $this.data 'formsPlugin'
137
+ if !data then $this.data 'formsPlugin', (data = new TBGForm @) else data[option]()
138
+
139
+ $.fn.forms.Constructor = TBGForm
140
+
141
+
142
+ # DATA API
143
+ # ===================================
144
+
145
+ $ ->
146
+ $('body').on 'submit.forms.data-api', '[data-forms]' , ( e ) ->
147
+ $(e.target).forms('send')
148
+ return false
149
+
150
+ do ( plugin ) ->
151
+ if typeof define is 'function' and define.amd
152
+ # AMD. Register as an anonymous module.
153
+ define(['jquery'], plugin);
154
+ else
155
+ # Browser globals
156
+ plugin(jQuery)
@@ -0,0 +1,107 @@
1
+ # ============================================================
2
+ # GAEvents v0.0.0
3
+ # http://URL
4
+ # ============================================================
5
+ # Copyright 2012 The Beans Group
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ plugin = ($)->
21
+
22
+ "use strict"
23
+
24
+ # GAEVENT CLASS DEFINITION
25
+ #
26
+ # @example How to use with Haml
27
+ # %a{ :href => '/some/link', :class => 'btn', :data => { :gaevent => 'category|action|opt_label|opt_value|opt_noninteraction' } }
28
+ # # See: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
29
+ #
30
+ # @example How to ensure plugin self initialises on element
31
+ # <form data-gaevent-load="true"> ... </form>
32
+ #
33
+ class GAEvent
34
+
35
+ # Construct a GAEvent instance - split the event content string and pass to sendEvent
36
+ #
37
+ # @param [Object] element HTMLElement
38
+ # @param [String] eventcontent Pipe delimited string of event content
39
+ #
40
+ constructor: ( element, @eventcontent ) ->
41
+ $el = $(element)
42
+ @sendEvent (if typeof eventcontent.split('|') isnt "array" then eventcontent.split('|') else [eventcontent])
43
+
44
+ _constructor: GAEvent
45
+
46
+ # Send the event to Google Analytics
47
+ #
48
+ # @param [Array] data If Google Analytics _gaq array defined then push data array after inserting '_trackEvent' string at beginning of data array
49
+ #
50
+ sendEvent : (data)->
51
+ data.unshift('_trackEvent')
52
+ _gaq?.push data
53
+
54
+ # Remove data and data attributes from jQuery object
55
+ #
56
+ # @param [Object] $el jQuery wrapped HTMLElement from which to remove data
57
+ # @param [String] ev Data string to be removed
58
+ #
59
+ removeData = ( $el, ev )->
60
+ $el.removeAttr('data-' + ev)
61
+ $el.removeData(ev)
62
+
63
+
64
+ # GAEVENT PLUGIN DEFINITION
65
+ # ==========================
66
+
67
+ $.fn.gaEvent = ( option , type = "gaevent") ->
68
+ this.each ->
69
+ $this = $(@)
70
+ $this = if ($t = $(this)).is("[data-#{type}]") then $t else $t.closest("[data-#{type}]")
71
+ data = $this.data 'gaeventplugin'
72
+ if not (eventContent= $this.data type ) then return removeData($this, type)
73
+ if !data then $this.data 'gaeventplugin', (data = new GAEvent @, eventContent)
74
+ if typeof option is 'string' then data[option].call $this
75
+
76
+ $.fn.gaEvent.Constructor = GAEvent
77
+
78
+ # DATA API
79
+ # ===================================
80
+
81
+ # On document ready, delegate a click handler on the body for 'click.gaEvent.data-api'
82
+ # event with target of '[data-gaevent]' and attach plugin; attach a handler for
83
+ # 'tbgform-success.gaEvent.data-api' event and attach plugin; attach plugin to each
84
+ # element with '[data-gaevent-load]' attribute
85
+ #
86
+ $ ->
87
+
88
+ $('body').on 'click.gaEvent.data-api', '[data-gaevent]' , ( e ) ->
89
+ $this = $(e.target)
90
+ $this.gaEvent()
91
+
92
+ $('body').on 'tbgform-success.gaEvent.data-api', (e, $form)->
93
+ $form.gaEvent null, 'gaevent-form'
94
+
95
+ # Can't turn this off via the data API
96
+ # @todo Enable Data API ga-event-load method
97
+ $('[data-gaevent-load]').each ->
98
+ $(this).gaEvent null, 'gaevent-load'
99
+
100
+
101
+ do ( plugin ) ->
102
+ if typeof define is 'function' and define.amd
103
+ # AMD. Register as an anonymous module.
104
+ define(['jquery'], plugin)
105
+ else
106
+ # Browser globals
107
+ plugin(jQuery)
@@ -0,0 +1,73 @@
1
+ # ============================================================
2
+ # TBG Responsive Resize v0.0.1
3
+ # http://URL
4
+ # ============================================================
5
+ # Copyright 2012 The Beans Group
6
+ #
7
+ # This plugin gives an event that is only fired once abrowser resize
8
+ # finished. This stops your 'resize' event handler being called
9
+ # continuously during a resize.
10
+ #
11
+ # Licensed under the Apache License, Version 2.0 (the "License");
12
+ # you may not use this file except in compliance with the License.
13
+ # You may obtain a copy of the License at
14
+ #
15
+ # http://www.apache.org/licenses/LICENSE-2.0
16
+ #
17
+ # Unless required by applicable law or agreed to in writing, software
18
+ # distributed under the License is distributed on an "AS IS" BASIS,
19
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ # See the License for the specific language governing permissions and
21
+ # limitations under the License.
22
+ #
23
+
24
+ plugin = ($)->
25
+
26
+ "use strict"
27
+
28
+ # RESIZEHANDLER CLASS DEFINITION
29
+ #
30
+ # @example How to use the class
31
+ # resizeHandlerInstance = new ResizeHandler()
32
+ #
33
+ class ResizeHandler
34
+
35
+ # Construct a new ResizeHandler instance
36
+ #
37
+ # Create resizeEvent method to trigger 'responsiveResize' event with current size
38
+ #
39
+ constructor: ->
40
+ $window = $(window)
41
+ @resizeEvent = =>
42
+ $window.trigger 'responsiveResize', @size()
43
+ @resizeTimer = null
44
+
45
+ # Set a timeout to call resizeEvent after 100ms, clearing existing timeout if one set
46
+ #
47
+ resize: ->
48
+ if @resizeTimer then clearTimeout @resizeTimer
49
+ @resizeTimer = setTimeout @resizeEvent, 100
50
+
51
+ # Get a string representation of grid name
52
+ #
53
+ # Grid name set in CSS content on body::after pseudo-element
54
+ #
55
+ # @return [String] Grid name if available or empty string
56
+ #
57
+ size: ->
58
+ if not window.getComputedStyle? then return ''
59
+ window.getComputedStyle(document.body,':after').getPropertyValue('content').replace('-','') || ''
60
+
61
+ # Create instance of ResizeHandler on document ready, call resize() on window 'resize' event
62
+ #
63
+ $ ->
64
+ resizeHandler = new ResizeHandler()
65
+ $(window).on 'resize', ()=> resizeHandler.resize()
66
+
67
+ do ( plugin ) ->
68
+ if typeof define is 'function' and define.amd
69
+ # AMD. Register as an anonymous module.
70
+ define(['jquery'], plugin);
71
+ else
72
+ # Browser globals
73
+ plugin(jQuery)