beautiful_scaffold 0.0.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. data/Gemfile +21 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +10 -0
  4. data/beautiful_scaffold.gemspec +18 -0
  5. data/lib/generators/USAGE +15 -0
  6. data/lib/generators/beautiful_locale_generator.rb +34 -0
  7. data/lib/generators/beautiful_migration_generator.rb +53 -0
  8. data/lib/generators/beautiful_scaffold_common_methods.rb +104 -0
  9. data/lib/generators/beautiful_scaffold_generator.rb +158 -0
  10. data/lib/generators/templates/app/assets/images/bg-bottom-login.jpg +0 -0
  11. data/lib/generators/templates/app/assets/images/bg-error.png +0 -0
  12. data/lib/generators/templates/app/assets/images/bg-left.jpg +0 -0
  13. data/lib/generators/templates/app/assets/images/bg-notice.jpg +0 -0
  14. data/lib/generators/templates/app/assets/images/bg-notice.png +0 -0
  15. data/lib/generators/templates/app/assets/images/bg-success.png +0 -0
  16. data/lib/generators/templates/app/assets/images/bg-top-login.jpg +0 -0
  17. data/lib/generators/templates/app/assets/images/bg-warning.png +0 -0
  18. data/lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js +80 -0
  19. data/lib/generators/templates/app/assets/javascripts/jquery.pjax.js +370 -0
  20. data/lib/generators/templates/app/assets/javascripts/modernizr.custom.js +4 -0
  21. data/lib/generators/templates/app/assets/stylesheets/beautiful_scaffold.css.scss +719 -0
  22. data/lib/generators/templates/app/assets/stylesheets/reset.css +48 -0
  23. data/lib/generators/templates/app/controllers/base.rb +177 -0
  24. data/lib/generators/templates/app/controllers/master_base.rb +37 -0
  25. data/lib/generators/templates/app/helpers/beautiful_helper.rb +130 -0
  26. data/lib/generators/templates/app/helpers/model_helper.rb +4 -0
  27. data/lib/generators/templates/app/locales/beautiful_scaffold.en.yml +30 -0
  28. data/lib/generators/templates/app/locales/beautiful_scaffold.fr.yml +30 -0
  29. data/lib/generators/templates/app/models/pdf_report.rb +40 -0
  30. data/lib/generators/templates/app/views/_beautiful_menu.html.erb +9 -0
  31. data/lib/generators/templates/app/views/_form.html.erb +24 -0
  32. data/lib/generators/templates/app/views/edit.html.erb +6 -0
  33. data/lib/generators/templates/app/views/index.html.erb +86 -0
  34. data/lib/generators/templates/app/views/layout.html.erb +70 -0
  35. data/lib/generators/templates/app/views/new.html.erb +5 -0
  36. data/lib/generators/templates/app/views/partials/_form_field.html.erb +37 -0
  37. data/lib/generators/templates/app/views/partials/_index_batch.html.erb +6 -0
  38. data/lib/generators/templates/app/views/partials/_index_column.html.erb +19 -0
  39. data/lib/generators/templates/app/views/partials/_index_header.html.erb +9 -0
  40. data/lib/generators/templates/app/views/partials/_index_search.html.erb +10 -0
  41. data/lib/generators/templates/app/views/partials/_show_field.html.erb +14 -0
  42. data/lib/generators/templates/app/views/show.html.erb +7 -0
  43. data/lib/generators/templates/markitup/jquery.markitup.js +593 -0
  44. data/lib/generators/templates/markitup/sets/bbcode/images/bold.png +0 -0
  45. data/lib/generators/templates/markitup/sets/bbcode/images/clean.png +0 -0
  46. data/lib/generators/templates/markitup/sets/bbcode/images/code.png +0 -0
  47. data/lib/generators/templates/markitup/sets/bbcode/images/fonts.png +0 -0
  48. data/lib/generators/templates/markitup/sets/bbcode/images/italic.png +0 -0
  49. data/lib/generators/templates/markitup/sets/bbcode/images/link.png +0 -0
  50. data/lib/generators/templates/markitup/sets/bbcode/images/list-bullet.png +0 -0
  51. data/lib/generators/templates/markitup/sets/bbcode/images/list-item.png +0 -0
  52. data/lib/generators/templates/markitup/sets/bbcode/images/list-numeric.png +0 -0
  53. data/lib/generators/templates/markitup/sets/bbcode/images/picture.png +0 -0
  54. data/lib/generators/templates/markitup/sets/bbcode/images/preview.png +0 -0
  55. data/lib/generators/templates/markitup/sets/bbcode/images/quotes.png +0 -0
  56. data/lib/generators/templates/markitup/sets/bbcode/images/stroke.png +0 -0
  57. data/lib/generators/templates/markitup/sets/bbcode/images/underline.png +0 -0
  58. data/lib/generators/templates/markitup/sets/bbcode/readme.txt +11 -0
  59. data/lib/generators/templates/markitup/sets/bbcode/set.js +39 -0
  60. data/lib/generators/templates/markitup/sets/bbcode/style.css +47 -0
  61. data/lib/generators/templates/markitup/sets/default/images/bold.png +0 -0
  62. data/lib/generators/templates/markitup/sets/default/images/clean.png +0 -0
  63. data/lib/generators/templates/markitup/sets/default/images/image.png +0 -0
  64. data/lib/generators/templates/markitup/sets/default/images/italic.png +0 -0
  65. data/lib/generators/templates/markitup/sets/default/images/link.png +0 -0
  66. data/lib/generators/templates/markitup/sets/default/images/list-bullet.png +0 -0
  67. data/lib/generators/templates/markitup/sets/default/images/list-numeric.png +0 -0
  68. data/lib/generators/templates/markitup/sets/default/images/picture.png +0 -0
  69. data/lib/generators/templates/markitup/sets/default/images/preview.png +0 -0
  70. data/lib/generators/templates/markitup/sets/default/images/stroke.png +0 -0
  71. data/lib/generators/templates/markitup/sets/default/set.js +30 -0
  72. data/lib/generators/templates/markitup/sets/default/style.css +34 -0
  73. data/lib/generators/templates/markitup/sets/html/images/bold.png +0 -0
  74. data/lib/generators/templates/markitup/sets/html/images/clean.png +0 -0
  75. data/lib/generators/templates/markitup/sets/html/images/h1.png +0 -0
  76. data/lib/generators/templates/markitup/sets/html/images/h2.png +0 -0
  77. data/lib/generators/templates/markitup/sets/html/images/h3.png +0 -0
  78. data/lib/generators/templates/markitup/sets/html/images/h4.png +0 -0
  79. data/lib/generators/templates/markitup/sets/html/images/h5.png +0 -0
  80. data/lib/generators/templates/markitup/sets/html/images/h6.png +0 -0
  81. data/lib/generators/templates/markitup/sets/html/images/image.png +0 -0
  82. data/lib/generators/templates/markitup/sets/html/images/italic.png +0 -0
  83. data/lib/generators/templates/markitup/sets/html/images/link.png +0 -0
  84. data/lib/generators/templates/markitup/sets/html/images/list-bullet.png +0 -0
  85. data/lib/generators/templates/markitup/sets/html/images/list-item.png +0 -0
  86. data/lib/generators/templates/markitup/sets/html/images/list-numeric.png +0 -0
  87. data/lib/generators/templates/markitup/sets/html/images/paragraph.png +0 -0
  88. data/lib/generators/templates/markitup/sets/html/images/picture.png +0 -0
  89. data/lib/generators/templates/markitup/sets/html/images/preview.png +0 -0
  90. data/lib/generators/templates/markitup/sets/html/images/stroke.png +0 -0
  91. data/lib/generators/templates/markitup/sets/html/readme.txt +11 -0
  92. data/lib/generators/templates/markitup/sets/html/set.js +39 -0
  93. data/lib/generators/templates/markitup/sets/html/style.css +59 -0
  94. data/lib/generators/templates/markitup/sets/markdown/images/bold.png +0 -0
  95. data/lib/generators/templates/markitup/sets/markdown/images/code.png +0 -0
  96. data/lib/generators/templates/markitup/sets/markdown/images/h1.png +0 -0
  97. data/lib/generators/templates/markitup/sets/markdown/images/h2.png +0 -0
  98. data/lib/generators/templates/markitup/sets/markdown/images/h3.png +0 -0
  99. data/lib/generators/templates/markitup/sets/markdown/images/h4.png +0 -0
  100. data/lib/generators/templates/markitup/sets/markdown/images/h5.png +0 -0
  101. data/lib/generators/templates/markitup/sets/markdown/images/h6.png +0 -0
  102. data/lib/generators/templates/markitup/sets/markdown/images/italic.png +0 -0
  103. data/lib/generators/templates/markitup/sets/markdown/images/link.png +0 -0
  104. data/lib/generators/templates/markitup/sets/markdown/images/list-bullet.png +0 -0
  105. data/lib/generators/templates/markitup/sets/markdown/images/list-numeric.png +0 -0
  106. data/lib/generators/templates/markitup/sets/markdown/images/picture.png +0 -0
  107. data/lib/generators/templates/markitup/sets/markdown/images/preview.png +0 -0
  108. data/lib/generators/templates/markitup/sets/markdown/images/quotes.png +0 -0
  109. data/lib/generators/templates/markitup/sets/markdown/readme.txt +11 -0
  110. data/lib/generators/templates/markitup/sets/markdown/set.js +52 -0
  111. data/lib/generators/templates/markitup/sets/markdown/style.css +54 -0
  112. data/lib/generators/templates/markitup/sets/textile/images/bold.png +0 -0
  113. data/lib/generators/templates/markitup/sets/textile/images/code.png +0 -0
  114. data/lib/generators/templates/markitup/sets/textile/images/h1.png +0 -0
  115. data/lib/generators/templates/markitup/sets/textile/images/h2.png +0 -0
  116. data/lib/generators/templates/markitup/sets/textile/images/h3.png +0 -0
  117. data/lib/generators/templates/markitup/sets/textile/images/h4.png +0 -0
  118. data/lib/generators/templates/markitup/sets/textile/images/h5.png +0 -0
  119. data/lib/generators/templates/markitup/sets/textile/images/h6.png +0 -0
  120. data/lib/generators/templates/markitup/sets/textile/images/italic.png +0 -0
  121. data/lib/generators/templates/markitup/sets/textile/images/link.png +0 -0
  122. data/lib/generators/templates/markitup/sets/textile/images/list-bullet.png +0 -0
  123. data/lib/generators/templates/markitup/sets/textile/images/list-numeric.png +0 -0
  124. data/lib/generators/templates/markitup/sets/textile/images/paragraph.png +0 -0
  125. data/lib/generators/templates/markitup/sets/textile/images/picture.png +0 -0
  126. data/lib/generators/templates/markitup/sets/textile/images/preview.png +0 -0
  127. data/lib/generators/templates/markitup/sets/textile/images/quotes.png +0 -0
  128. data/lib/generators/templates/markitup/sets/textile/images/stroke.png +0 -0
  129. data/lib/generators/templates/markitup/sets/textile/readme.txt +11 -0
  130. data/lib/generators/templates/markitup/sets/textile/set.js +40 -0
  131. data/lib/generators/templates/markitup/sets/textile/style.css +60 -0
  132. data/lib/generators/templates/markitup/sets/wiki/images/bold.png +0 -0
  133. data/lib/generators/templates/markitup/sets/wiki/images/code.png +0 -0
  134. data/lib/generators/templates/markitup/sets/wiki/images/h1.png +0 -0
  135. data/lib/generators/templates/markitup/sets/wiki/images/h2.png +0 -0
  136. data/lib/generators/templates/markitup/sets/wiki/images/h3.png +0 -0
  137. data/lib/generators/templates/markitup/sets/wiki/images/h4.png +0 -0
  138. data/lib/generators/templates/markitup/sets/wiki/images/h5.png +0 -0
  139. data/lib/generators/templates/markitup/sets/wiki/images/h6.png +0 -0
  140. data/lib/generators/templates/markitup/sets/wiki/images/italic.png +0 -0
  141. data/lib/generators/templates/markitup/sets/wiki/images/link.png +0 -0
  142. data/lib/generators/templates/markitup/sets/wiki/images/list-bullet.png +0 -0
  143. data/lib/generators/templates/markitup/sets/wiki/images/list-numeric.png +0 -0
  144. data/lib/generators/templates/markitup/sets/wiki/images/picture.png +0 -0
  145. data/lib/generators/templates/markitup/sets/wiki/images/preview.png +0 -0
  146. data/lib/generators/templates/markitup/sets/wiki/images/quotes.png +0 -0
  147. data/lib/generators/templates/markitup/sets/wiki/images/stroke.png +0 -0
  148. data/lib/generators/templates/markitup/sets/wiki/images/url.png +0 -0
  149. data/lib/generators/templates/markitup/sets/wiki/readme.txt +11 -0
  150. data/lib/generators/templates/markitup/sets/wiki/set.js +37 -0
  151. data/lib/generators/templates/markitup/sets/wiki/style.css +57 -0
  152. data/lib/generators/templates/markitup/skins/markitup/images/bg-container.png +0 -0
  153. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
  154. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
  155. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-html.png +0 -0
  156. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-json.png +0 -0
  157. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
  158. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
  159. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
  160. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
  161. data/lib/generators/templates/markitup/skins/markitup/images/bg-editor.png +0 -0
  162. data/lib/generators/templates/markitup/skins/markitup/images/handle.png +0 -0
  163. data/lib/generators/templates/markitup/skins/markitup/images/menu.png +0 -0
  164. data/lib/generators/templates/markitup/skins/markitup/images/submenu.png +0 -0
  165. data/lib/generators/templates/markitup/skins/markitup/style.css +147 -0
  166. data/lib/generators/templates/markitup/skins/simple/images/handle.png +0 -0
  167. data/lib/generators/templates/markitup/skins/simple/images/menu.png +0 -0
  168. data/lib/generators/templates/markitup/skins/simple/images/submenu.png +0 -0
  169. data/lib/generators/templates/markitup/skins/simple/style.css +118 -0
  170. data/lib/generators/templates/markitup/templates/preview.css +5 -0
  171. data/lib/generators/templates/markitup/templates/preview.html +11 -0
  172. data/lib/generators/templates/modules/beautiful_scaffold_module.rb +28 -0
  173. metadata +175 -3
@@ -0,0 +1,370 @@
1
+ // jquery.pjax.js
2
+ // copyright chris wanstrath
3
+ // https://github.com/defunkt/jquery-pjax
4
+
5
+ (function($){
6
+
7
+ // When called on a link, fetches the href with ajax into the
8
+ // container specified as the first parameter or with the data-pjax
9
+ // attribute on the link itself.
10
+ //
11
+ // Tries to make sure the back button and ctrl+click work the way
12
+ // you'd expect.
13
+ //
14
+ // Accepts a jQuery ajax options object that may include these
15
+ // pjax specific options:
16
+ //
17
+ // container - Where to stick the response body. Usually a String selector.
18
+ // $(container).html(xhr.responseBody)
19
+ // push - Whether to pushState the URL. Defaults to true (of course).
20
+ // replace - Want to use replaceState instead? That's cool.
21
+ //
22
+ // For convenience the first parameter can be either the container or
23
+ // the options object.
24
+ //
25
+ // Returns the jQuery object
26
+ $.fn.pjax = function( container, options ) {
27
+ options = optionsFor(container, options)
28
+ return this.live('click', function(event){
29
+ return handleClick(event, options)
30
+ })
31
+ }
32
+
33
+ // Public: pjax on click handler
34
+ //
35
+ // Exported as $.pjax.click.
36
+ //
37
+ // event - "click" jQuery.Event
38
+ // options - pjax options
39
+ //
40
+ // Examples
41
+ //
42
+ // $('a').live('click', $.pjax.click)
43
+ // // is the same as
44
+ // $('a').pjax()
45
+ //
46
+ // $(document).on('click', 'a', function(event) {
47
+ // var container = $(this).closest('[data-pjax-container]')
48
+ // return $.pjax.click(event, container)
49
+ // })
50
+ //
51
+ // Returns false if pjax runs, otherwise nothing.
52
+ function handleClick(event, container, options) {
53
+ options = optionsFor(container, options)
54
+
55
+ var link = event.currentTarget
56
+
57
+ // Middle click, cmd click, and ctrl click should open
58
+ // links in a new tab as normal.
59
+ if ( event.which > 1 || event.metaKey )
60
+ return
61
+
62
+ // Ignore cross origin links
63
+ if ( location.protocol !== link.protocol || location.host !== link.host )
64
+ return
65
+
66
+ // Ignore anchors on the same page
67
+ if ( link.hash && link.href.replace(link.hash, '') ===
68
+ location.href.replace(location.hash, '') )
69
+ return
70
+
71
+ var defaults = {
72
+ url: link.href,
73
+ container: $(link).attr('data-pjax'),
74
+ clickedElement: $(link),
75
+ fragment: null
76
+ }
77
+
78
+ $.pjax($.extend({}, defaults, options))
79
+
80
+ event.preventDefault()
81
+ return false
82
+ }
83
+
84
+
85
+ // Loads a URL with ajax, puts the response body inside a container,
86
+ // then pushState()'s the loaded URL.
87
+ //
88
+ // Works just like $.ajax in that it accepts a jQuery ajax
89
+ // settings object (with keys like url, type, data, etc).
90
+ //
91
+ // Accepts these extra keys:
92
+ //
93
+ // container - Where to stick the response body.
94
+ // $(container).html(xhr.responseBody)
95
+ // push - Whether to pushState the URL. Defaults to true (of course).
96
+ // replace - Want to use replaceState instead? That's cool.
97
+ //
98
+ // Use it just like $.ajax:
99
+ //
100
+ // var xhr = $.pjax({ url: this.href, container: '#main' })
101
+ // console.log( xhr.readyState )
102
+ //
103
+ // Returns whatever $.ajax returns.
104
+ var pjax = $.pjax = function( options ) {
105
+ var $container = findContainerFor(options.container),
106
+ success = options.success || $.noop
107
+
108
+ // We don't want to let anyone override our success handler.
109
+ delete options.success
110
+
111
+ options = $.extend(true, {}, pjax.defaults, options)
112
+
113
+ if ( $.isFunction(options.url) ) {
114
+ options.url = options.url()
115
+ }
116
+
117
+ options.context = $container
118
+
119
+ options.success = function(data){
120
+ if ( options.fragment ) {
121
+ // If they specified a fragment, look for it in the response
122
+ // and pull it out.
123
+ var $fragment = $(data).find(options.fragment)
124
+ if ( $fragment.length )
125
+ data = $fragment.children()
126
+ else
127
+ return window.location = options.url
128
+ } else {
129
+ // If we got no data or an entire web page, go directly
130
+ // to the page and let normal error handling happen.
131
+ if ( !$.trim(data) || /<html/i.test(data) )
132
+ return window.location = options.url
133
+ }
134
+
135
+ // Make it happen.
136
+ this.html(data)
137
+
138
+ // If there's a <title> tag in the response, use it as
139
+ // the page's title.
140
+ var oldTitle = document.title,
141
+ title = $.trim( this.find('title').remove().text() )
142
+
143
+ // No <title>? Fragment? Look for data-title and title attributes.
144
+ if ( !title && options.fragment ) {
145
+ title = $fragment.attr('title') || $fragment.data('title')
146
+ }
147
+
148
+ if ( title ) document.title = title
149
+
150
+ var state = {
151
+ pjax: $container.selector,
152
+ fragment: options.fragment,
153
+ timeout: options.timeout
154
+ }
155
+
156
+ // If there are extra params, save the complete URL in the state object
157
+ var query = $.param(options.data)
158
+ if ( query != "_pjax=true" )
159
+ state.url = options.url + (/\?/.test(options.url) ? "&" : "?") + query
160
+
161
+ if ( options.replace ) {
162
+ pjax.active = true
163
+ window.history.replaceState(state, document.title, options.url)
164
+ } else if ( options.push ) {
165
+ // this extra replaceState before first push ensures good back
166
+ // button behavior
167
+ if ( !pjax.active ) {
168
+ window.history.replaceState($.extend({}, state, {url:null}), oldTitle)
169
+ pjax.active = true
170
+ }
171
+
172
+ window.history.pushState(state, document.title, options.url)
173
+ }
174
+
175
+ // Google Analytics support
176
+ if ( (options.replace || options.push) && window._gaq )
177
+ _gaq.push(['_trackPageview'])
178
+
179
+ // If the URL has a hash in it, make sure the browser
180
+ // knows to navigate to the hash.
181
+ var hash = window.location.hash.toString()
182
+ if ( hash !== '' ) {
183
+ window.location.href = hash
184
+ }
185
+
186
+ // Invoke their success handler if they gave us one.
187
+ success.apply(this, arguments)
188
+ }
189
+
190
+ // Cancel the current request if we're already pjaxing
191
+ var xhr = pjax.xhr
192
+ if ( xhr && xhr.readyState < 4) {
193
+ xhr.onreadystatechange = $.noop
194
+ xhr.abort()
195
+ }
196
+
197
+ pjax.options = options
198
+ pjax.xhr = $.ajax(options)
199
+ $(document).trigger('pjax', [pjax.xhr, options])
200
+
201
+ return pjax.xhr
202
+ }
203
+
204
+
205
+ // Internal: Build options Object for arguments.
206
+ //
207
+ // For convenience the first parameter can be either the container or
208
+ // the options object.
209
+ //
210
+ // Examples
211
+ //
212
+ // optionsFor('#container')
213
+ // // => {container: '#container'}
214
+ //
215
+ // optionsFor('#container', {push: true})
216
+ // // => {container: '#container', push: true}
217
+ //
218
+ // optionsFor({container: '#container', push: true})
219
+ // // => {container: '#container', push: true}
220
+ //
221
+ // Returns options Object.
222
+ function optionsFor(container, options) {
223
+ // Both container and options
224
+ if ( container && options )
225
+ options.container = container
226
+
227
+ // First argument is options Object
228
+ else if ( $.isPlainObject(container) )
229
+ options = container
230
+
231
+ // Only container
232
+ else
233
+ options = {container: container}
234
+
235
+ // Find and validate container
236
+ if (options.container)
237
+ options.container = findContainerFor(options.container)
238
+
239
+ return options
240
+ }
241
+
242
+ // Internal: Find container element for a variety of inputs.
243
+ //
244
+ // Because we can't persist elements using the history API, we must be
245
+ // able to find a String selector that will consistently find the Element.
246
+ //
247
+ // container - A selector String, jQuery object, or DOM Element.
248
+ //
249
+ // Returns a jQuery object whose context is `document` and has a selector.
250
+ function findContainerFor(container) {
251
+ container = $(container)
252
+
253
+ if ( !container.length ) {
254
+ throw "no pjax container for " + container.selector
255
+ } else if ( container.selector !== '' && container.context === document ) {
256
+ return container
257
+ } else if ( container.attr('id') ) {
258
+ return $('#' + container.attr('id'))
259
+ } else {
260
+ throw "cant get selector for pjax container!"
261
+ }
262
+ }
263
+
264
+
265
+ var timeoutTimer = null
266
+
267
+ pjax.defaults = {
268
+ timeout: 650,
269
+ push: true,
270
+ replace: false,
271
+ // We want the browser to maintain two separate internal caches: one for
272
+ // pjax'd partial page loads and one for normal page loads. Without
273
+ // adding this secret parameter, some browsers will often confuse the two.
274
+ data: { _pjax: true },
275
+ type: 'GET',
276
+ dataType: 'html',
277
+ beforeSend: function(xhr, settings){
278
+ var context = this
279
+
280
+ if (settings.async && settings.timeout > 0) {
281
+ timeoutTimer = setTimeout(function() {
282
+ var event = $.Event('pjax:timeout')
283
+ context.trigger(event, [xhr, pjax.options])
284
+ if (event.result !== false)
285
+ xhr.abort('timeout')
286
+ }, settings.timeout)
287
+
288
+ // Clear timeout setting so jquerys internal timeout isn't invoked
289
+ settings.timeout = 0
290
+ }
291
+
292
+ this.trigger('pjax:start', [xhr, pjax.options])
293
+ // start.pjax is deprecated
294
+ this.trigger('start.pjax', [xhr, pjax.options])
295
+ xhr.setRequestHeader('X-PJAX', 'true')
296
+ },
297
+ error: function(xhr, textStatus, errorThrown){
298
+ if ( textStatus !== 'abort' )
299
+ window.location = pjax.options.url
300
+ },
301
+ complete: function(xhr){
302
+ if (timeoutTimer)
303
+ clearTimeout(timeoutTimer)
304
+
305
+ this.trigger('pjax:end', [xhr, pjax.options])
306
+ // end.pjax is deprecated
307
+ this.trigger('end.pjax', [xhr, pjax.options])
308
+ }
309
+ }
310
+
311
+ // Export $.pjax.click
312
+ pjax.click = handleClick
313
+
314
+
315
+ // Used to detect initial (useless) popstate.
316
+ // If history.state exists, assume browser isn't going to fire initial popstate.
317
+ var popped = ('state' in window.history), initialURL = location.href
318
+
319
+
320
+ // popstate handler takes care of the back and forward buttons
321
+ //
322
+ // You probably shouldn't use pjax on pages with other pushState
323
+ // stuff yet.
324
+ $(window).bind('popstate', function(event){
325
+ // Ignore inital popstate that some browsers fire on page load
326
+ var initialPop = !popped && location.href == initialURL
327
+ popped = true
328
+ if ( initialPop ) return
329
+
330
+ var state = event.state
331
+
332
+ if ( state && state.pjax ) {
333
+ var container = state.pjax
334
+ if ( $(container+'').length )
335
+ $.pjax({
336
+ url: state.url || location.href,
337
+ fragment: state.fragment,
338
+ container: container,
339
+ push: false,
340
+ timeout: state.timeout
341
+ })
342
+ else
343
+ window.location = location.href
344
+ }
345
+ })
346
+
347
+
348
+ // Add the state property to jQuery's event object so we can use it in
349
+ // $(window).bind('popstate')
350
+ if ( $.inArray('state', $.event.props) < 0 )
351
+ $.event.props.push('state')
352
+
353
+
354
+ // Is pjax supported by this browser?
355
+ $.support.pjax =
356
+ window.history && window.history.pushState && window.history.replaceState
357
+ // pushState isn't reliable on iOS until 5.
358
+ && !navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/)
359
+
360
+
361
+ // Fall back to normalcy for older browsers.
362
+ if ( !$.support.pjax ) {
363
+ $.pjax = function( options ) {
364
+ window.location = $.isFunction(options.url) ? options.url() : options.url
365
+ }
366
+ $.pjax.click = $.noop
367
+ $.fn.pjax = function() { return this }
368
+ }
369
+
370
+ })(jQuery);
@@ -0,0 +1,4 @@
1
+ /* Modernizr 2.0.6 (Custom Build) | MIT & BSD
2
+ * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-iepp-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
3
+ */
4
+ ;window.Modernizr=function(a,b,c){function H(){e.input=function(a){for(var b=0,c=a.length;b<c;b++)t[a[b]]=a[b]in l;return t}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)l.setAttribute("type",f=a[d]),e=l.type!=="text",e&&(l.value=m,l.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&l.style.WebkitAppearance!==c?(g.appendChild(l),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(l,null).WebkitAppearance!=="textfield"&&l.offsetHeight!==0,g.removeChild(l)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=l.checkValidity&&l.checkValidity()===!1:/^color$/.test(f)?(g.appendChild(l),g.offsetWidth,e=l.value!=m,g.removeChild(l)):e=l.value!=m)),s[a[d]]=!!e;return s}("search tel url email datetime date month week time datetime-local number range color".split(" "))}function F(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+p.join(c+" ")+c).split(" ");return E(d,b)}function E(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function D(a,b){return!!~(""+a).indexOf(b)}function C(a,b){return typeof a===b}function B(a,b){return A(o.join(a+";")+(b||""))}function A(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l=b.createElement("input"),m=":)",n=Object.prototype.toString,o=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),p="Webkit Moz O ms Khtml".split(" "),q={svg:"http://www.w3.org/2000/svg"},r={},s={},t={},u=[],v=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["&shy;","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},w=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=C(e[d],"function"),C(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),x,y={}.hasOwnProperty,z;!C(y,c)&&!C(y.call,c)?z=function(a,b){return y.call(a,b)}:z=function(a,b){return b in a&&C(a.constructor.prototype[b],c)};var G=function(c,d){var f=c.join(""),g=d.length;v(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9,e.csstransforms3d=j.csstransforms3d.offsetLeft===9,e.generatedcontent=j.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!C(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return e.touch},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b<c;)if(a[p[b].toLowerCase()+"IndexedDB"])return!0;return!!a.indexedDB},r.hashchange=function(){return w("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){return w("dragstart")&&w("drop")},r.websockets=function(){for(var b=-1,c=p.length;++b<c;)if(a[p[b]+"WebSocket"])return!0;return"WebSocket"in a},r.rgba=function(){A("background-color:rgba(150,255,150,.5)");return D(k.backgroundColor,"rgba")},r.hsla=function(){A("background-color:hsla(120,40%,100%,.5)");return D(k.backgroundColor,"rgba")||D(k.backgroundColor,"hsla")},r.multiplebgs=function(){A("background:url(https://),url(https://),red url(https://)");return/(url\s*\(.*?){3}/.test(k.background)},r.backgroundsize=function(){return F("backgroundSize")},r.borderimage=function(){return F("borderImage")},r.borderradius=function(){return F("borderRadius")},r.boxshadow=function(){return F("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){B("opacity:.55");return/^0.55$/.test(k.opacity)},r.cssanimations=function(){return F("animationName")},r.csscolumns=function(){return F("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";A((a+o.join(b+a)+o.join(c+a)).slice(0,-a.length));return D(k.backgroundImage,"gradient")},r.cssreflections=function(){return F("boxReflect")},r.csstransforms=function(){return!!E(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},r.csstransforms3d=function(){var a=!!E(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);a&&"webkitPerspective"in g.style&&(a=e.csstransforms3d);return a},r.csstransitions=function(){return F("transitionProperty")},r.fontface=function(){return e.fontface},r.generatedcontent=function(){return e.generatedcontent},r.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType){c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(e){}return c},r.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"'),c.mp3=a.canPlayType("audio/mpeg;"),c.wav=a.canPlayType('audio/wav; codecs="1"'),c.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}catch(d){}return c},r.localstorage=function(){try{return!!localStorage.getItem}catch(a){return!1}},r.sessionstorage=function(){try{return!!sessionStorage.getItem}catch(a){return!1}},r.webworkers=function(){return!!a.Worker},r.applicationcache=function(){return!!a.applicationCache},r.svg=function(){return!!b.createElementNS&&!!b.createElementNS(q.svg,"svg").createSVGRect},r.inlinesvg=function(){var a=b.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var I in r)z(r,I)&&(x=I.toLowerCase(),e[x]=r[I](),u.push((e[x]?"":"no-")+x));e.input||H(),A(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e._prefixes=o,e._domPrefixes=p,e.hasEvent=w,e.testProp=function(a){return E([a])},e.testAllProps=F,e.testStyles=v,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+u.join(" "):"");return e}(this,this.document),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};