laces 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +122 -0
- data/LICENSE +21 -0
- data/README.md +5 -0
- data/Rakefile +8 -0
- data/bin/laces +16 -0
- data/features/creating_a_heroku_app.feature +9 -0
- data/features/rake_clean.feature +21 -0
- data/features/skipping_clearance.feature +13 -0
- data/features/step_definitions/gem_steps.rb +5 -0
- data/features/step_definitions/heroku_steps.rb +3 -0
- data/features/step_definitions/shell_steps.rb +55 -0
- data/features/support/bin/heroku +5 -0
- data/features/support/env.rb +15 -0
- data/features/support/fake_heroku.rb +21 -0
- data/laces-0.0.1.gem +0 -0
- data/laces.gemspec +35 -0
- data/lib/laces/actions.rb +35 -0
- data/lib/laces/app_builder.rb +237 -0
- data/lib/laces/generators/app_generator.rb +111 -0
- data/lib/laces/version.rb +3 -0
- data/templates/.DS_Store +0 -0
- data/templates/Gemfile_template +76 -0
- data/templates/HEROKU_README.md +66 -0
- data/templates/Procfile +1 -0
- data/templates/README.md +81 -0
- data/templates/app/assets/imgs/glyphicons-halflings-white.png +0 -0
- data/templates/app/assets/imgs/glyphicons-halflings.png +0 -0
- data/templates/app/assets/javascripts/admin.coffee +20 -0
- data/templates/app/assets/javascripts/application.coffee +21 -0
- data/templates/app/assets/javascripts/lib/actinology.coffee +47 -0
- data/templates/app/assets/javascripts/lib/analytics.js +11 -0
- data/templates/app/assets/javascripts/lib/auth_token_sync.js +17 -0
- data/templates/app/assets/javascripts/lib/backbone-ui.js +2455 -0
- data/templates/app/assets/javascripts/lib/backbone.coffee +27 -0
- data/templates/app/assets/javascripts/lib/backbone/collection.js +249 -0
- data/templates/app/assets/javascripts/lib/backbone/events.js +64 -0
- data/templates/app/assets/javascripts/lib/backbone/helpers.js +68 -0
- data/templates/app/assets/javascripts/lib/backbone/history.js +144 -0
- data/templates/app/assets/javascripts/lib/backbone/model.js +291 -0
- data/templates/app/assets/javascripts/lib/backbone/router.coffee +45 -0
- data/templates/app/assets/javascripts/lib/backbone/sync.coffee +38 -0
- data/templates/app/assets/javascripts/lib/backbone/view.js +150 -0
- data/templates/app/assets/javascripts/lib/backbone_extended.coffee +276 -0
- data/templates/app/assets/javascripts/lib/bootstrap.js +1836 -0
- data/templates/app/assets/javascripts/lib/inflection.js +658 -0
- data/templates/app/assets/javascripts/lib/jquery-ui.js +343 -0
- data/templates/app/assets/javascripts/lib/jquery.hotkeys.js +102 -0
- data/templates/app/assets/javascripts/lib/jquery.js +4 -0
- data/templates/app/assets/javascripts/lib/milk.js.coffee +265 -0
- data/templates/app/assets/javascripts/lib/raw.js +143 -0
- data/templates/app/assets/javascripts/lib/strftime.js +732 -0
- data/templates/app/assets/javascripts/lib/throttle-debounce.js +251 -0
- data/templates/app/assets/javascripts/lib/timeago.js +148 -0
- data/templates/app/assets/javascripts/lib/underscore.js +28 -0
- data/templates/app/assets/styles/application.sass +21 -0
- data/templates/app/assets/styles/layouts/default.sass +15 -0
- data/templates/app/assets/styles/layouts/footer.sass +0 -0
- data/templates/app/assets/styles/layouts/forms.sass +34 -0
- data/templates/app/assets/styles/layouts/header.sass +0 -0
- data/templates/app/assets/styles/layouts/navigation.sass +0 -0
- data/templates/app/assets/styles/lib/backbone-ui.css +580 -0
- data/templates/app/assets/styles/lib/bootstrap.sass +4248 -0
- data/templates/app/assets/styles/pages/home.sass +0 -0
- data/templates/app/assets/styles/sessions/new.sass +0 -0
- data/templates/app/assets/styles/users/activate.sass +0 -0
- data/templates/app/assets/styles/users/new.sass +0 -0
- data/templates/app/assets/styles/users/suspended.sass +0 -0
- data/templates/app/controllers/app_controller.rb +14 -0
- data/templates/app/controllers/pages_controller.rb +2 -0
- data/templates/app/controllers/sessions_controller.rb +2 -0
- data/templates/app/controllers/templating_controller.rb +31 -0
- data/templates/app/controllers/users_controller.rb +2 -0
- data/templates/app/helpers/app_helper.rb +94 -0
- data/templates/app/helpers/users_helper.rb +53 -0
- data/templates/app/models/user.rb +9 -0
- data/templates/app/views/devise/confirmations/new.haml +9 -0
- data/templates/app/views/devise/passwords/edit.haml +11 -0
- data/templates/app/views/devise/passwords/new.haml +9 -0
- data/templates/app/views/devise/registrations/edit.haml +13 -0
- data/templates/app/views/devise/registrations/new.haml +8 -0
- data/templates/app/views/devise/sessions/_form.haml +7 -0
- data/templates/app/views/devise/sessions/new.haml +5 -0
- data/templates/app/views/devise/unlocks/new.haml +7 -0
- data/templates/app/views/layouts/_ascii.haml +0 -0
- data/templates/app/views/layouts/_column.haml +0 -0
- data/templates/app/views/layouts/_content.haml +1 -0
- data/templates/app/views/layouts/_extra.haml +0 -0
- data/templates/app/views/layouts/_footer.haml +9 -0
- data/templates/app/views/layouts/_head.haml +13 -0
- data/templates/app/views/layouts/_header.haml +6 -0
- data/templates/app/views/layouts/application.html.haml +16 -0
- data/templates/app/views/pages/home.haml +1 -0
- data/templates/config/app.yml +29 -0
- data/templates/config/application.erb +28 -0
- data/templates/config/database.yml +32 -0
- data/templates/config/initializers/devise.rb +232 -0
- data/templates/config/initializers/rabl_init.rb +4 -0
- data/templates/config/initializers/setup_mail.rb +13 -0
- data/templates/config/initializers/wrap_parameters.rb +12 -0
- data/templates/db/migrate/user_migration.rb +36 -0
- data/templates/laces_gitignore +9 -0
- data/templates/lib/development_mail_interceptor.rb +7 -0
- data/templates/lib/templating.rb +40 -0
- metadata +225 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jQuery throttle / debounce - v1.1 - 3/7/2010
|
|
3
|
+
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
|
6
|
+
* Dual licensed under the MIT and GPL licenses.
|
|
7
|
+
* http://benalman.com/about/license/
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Script: jQuery throttle / debounce: Sometimes, less is more!
|
|
11
|
+
//
|
|
12
|
+
// *Version: 1.1, Last updated: 3/7/2010*
|
|
13
|
+
//
|
|
14
|
+
// Project Home - http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
|
15
|
+
// GitHub - http://github.com/cowboy/jquery-throttle-debounce/
|
|
16
|
+
// Source - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.js
|
|
17
|
+
// (Minified) - http://github.com/cowboy/jquery-throttle-debounce/raw/master/jquery.ba-throttle-debounce.min.js (0.7kb)
|
|
18
|
+
//
|
|
19
|
+
// About: License
|
|
20
|
+
//
|
|
21
|
+
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
|
22
|
+
// Dual licensed under the MIT and GPL licenses.
|
|
23
|
+
// http://benalman.com/about/license/
|
|
24
|
+
//
|
|
25
|
+
// About: Examples
|
|
26
|
+
//
|
|
27
|
+
// These working examples, complete with fully commented code, illustrate a few
|
|
28
|
+
// ways in which this plugin can be used.
|
|
29
|
+
//
|
|
30
|
+
// Throttle - http://benalman.com/code/projects/jquery-throttle-debounce/examples/throttle/
|
|
31
|
+
// Debounce - http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/
|
|
32
|
+
//
|
|
33
|
+
// About: Support and Testing
|
|
34
|
+
//
|
|
35
|
+
// Information about what version or versions of jQuery this plugin has been
|
|
36
|
+
// tested with, what browsers it has been tested in, and where the unit tests
|
|
37
|
+
// reside (so you can test it yourself).
|
|
38
|
+
//
|
|
39
|
+
// jQuery Versions - none, 1.3.2, 1.4.2
|
|
40
|
+
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome 4-5, Opera 9.6-10.1.
|
|
41
|
+
// Unit Tests - http://benalman.com/code/projects/jquery-throttle-debounce/unit/
|
|
42
|
+
//
|
|
43
|
+
// About: Release History
|
|
44
|
+
//
|
|
45
|
+
// 1.1 - (3/7/2010) Fixed a bug in <jQuery.throttle> where trailing callbacks
|
|
46
|
+
// executed later than they should. Reworked a fair amount of internal
|
|
47
|
+
// logic as well.
|
|
48
|
+
// 1.0 - (3/6/2010) Initial release as a stand-alone project. Migrated over
|
|
49
|
+
// from jquery-misc repo v0.4 to jquery-throttle repo v1.0, added the
|
|
50
|
+
// no_trailing throttle parameter and debounce functionality.
|
|
51
|
+
//
|
|
52
|
+
// Topic: Note for non-jQuery users
|
|
53
|
+
//
|
|
54
|
+
// jQuery isn't actually required for this plugin, because nothing internal
|
|
55
|
+
// uses any jQuery methods or properties. jQuery is just used as a namespace
|
|
56
|
+
// under which these methods can exist.
|
|
57
|
+
//
|
|
58
|
+
// Since jQuery isn't actually required for this plugin, if jQuery doesn't exist
|
|
59
|
+
// when this plugin is loaded, the method described below will be created in
|
|
60
|
+
// the `Cowboy` namespace. Usage will be exactly the same, but instead of
|
|
61
|
+
// $.method() or jQuery.method(), you'll need to use Cowboy.method().
|
|
62
|
+
|
|
63
|
+
(function(window,undefined){
|
|
64
|
+
'$:nomunge'; // Used by YUI compressor.
|
|
65
|
+
|
|
66
|
+
// Since jQuery really isn't required for this plugin, use `jQuery` as the
|
|
67
|
+
// namespace only if it already exists, otherwise use the `Cowboy` namespace,
|
|
68
|
+
// creating it if necessary.
|
|
69
|
+
var $ = window.jQuery || window.Cowboy || ( window.Cowboy = {} ),
|
|
70
|
+
|
|
71
|
+
// Internal method reference.
|
|
72
|
+
jq_throttle;
|
|
73
|
+
|
|
74
|
+
// Method: jQuery.throttle
|
|
75
|
+
//
|
|
76
|
+
// Throttle execution of a function. Especially useful for rate limiting
|
|
77
|
+
// execution of handlers on events like resize and scroll. If you want to
|
|
78
|
+
// rate-limit execution of a function to a single time, see the
|
|
79
|
+
// <jQuery.debounce> method.
|
|
80
|
+
//
|
|
81
|
+
// In this visualization, | is a throttled-function call and X is the actual
|
|
82
|
+
// callback execution:
|
|
83
|
+
//
|
|
84
|
+
// > Throttled with `no_trailing` specified as false or unspecified:
|
|
85
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
|
86
|
+
// > X X X X X X X X X X X X
|
|
87
|
+
// >
|
|
88
|
+
// > Throttled with `no_trailing` specified as true:
|
|
89
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
|
90
|
+
// > X X X X X X X X X X
|
|
91
|
+
//
|
|
92
|
+
// Usage:
|
|
93
|
+
//
|
|
94
|
+
// > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback );
|
|
95
|
+
// >
|
|
96
|
+
// > jQuery('selector').bind( 'someevent', throttled );
|
|
97
|
+
// > jQuery('selector').unbind( 'someevent', throttled );
|
|
98
|
+
//
|
|
99
|
+
// This also works in jQuery 1.4+:
|
|
100
|
+
//
|
|
101
|
+
// > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) );
|
|
102
|
+
// > jQuery('selector').unbind( 'someevent', callback );
|
|
103
|
+
//
|
|
104
|
+
// Arguments:
|
|
105
|
+
//
|
|
106
|
+
// delay - (Number) A zero-or-greater delay in milliseconds. For event
|
|
107
|
+
// callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
108
|
+
// no_trailing - (Boolean) Optional, defaults to false. If no_trailing is
|
|
109
|
+
// true, callback will only execute every `delay` milliseconds while the
|
|
110
|
+
// throttled-function is being called. If no_trailing is false or
|
|
111
|
+
// unspecified, callback will be executed one final time after the last
|
|
112
|
+
// throttled-function call. (After the throttled-function has not been
|
|
113
|
+
// called for `delay` milliseconds, the internal counter is reset)
|
|
114
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
|
115
|
+
// The `this` context and all arguments are passed through, as-is, to
|
|
116
|
+
// `callback` when the throttled-function is executed.
|
|
117
|
+
//
|
|
118
|
+
// Returns:
|
|
119
|
+
//
|
|
120
|
+
// (Function) A new, throttled, function.
|
|
121
|
+
|
|
122
|
+
$.throttle = jq_throttle = function( delay, no_trailing, callback, debounce_mode ) {
|
|
123
|
+
// After wrapper has stopped being called, this timeout ensures that
|
|
124
|
+
// `callback` is executed at the proper times in `throttle` and `end`
|
|
125
|
+
// debounce modes.
|
|
126
|
+
var timeout_id,
|
|
127
|
+
|
|
128
|
+
// Keep track of the last time `callback` was executed.
|
|
129
|
+
last_exec = 0;
|
|
130
|
+
|
|
131
|
+
// `no_trailing` defaults to falsy.
|
|
132
|
+
if ( typeof no_trailing !== 'boolean' ) {
|
|
133
|
+
debounce_mode = callback;
|
|
134
|
+
callback = no_trailing;
|
|
135
|
+
no_trailing = undefined;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// The `wrapper` function encapsulates all of the throttling / debouncing
|
|
139
|
+
// functionality and when executed will limit the rate at which `callback`
|
|
140
|
+
// is executed.
|
|
141
|
+
function wrapper() {
|
|
142
|
+
var that = this,
|
|
143
|
+
elapsed = +new Date() - last_exec,
|
|
144
|
+
args = arguments;
|
|
145
|
+
|
|
146
|
+
// Execute `callback` and update the `last_exec` timestamp.
|
|
147
|
+
function exec() {
|
|
148
|
+
last_exec = +new Date();
|
|
149
|
+
callback.apply( that, args );
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// If `debounce_mode` is true (at_begin) this is used to clear the flag
|
|
153
|
+
// to allow future `callback` executions.
|
|
154
|
+
function clear() {
|
|
155
|
+
timeout_id = undefined;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
if ( debounce_mode && !timeout_id ) {
|
|
159
|
+
// Since `wrapper` is being called for the first time and
|
|
160
|
+
// `debounce_mode` is true (at_begin), execute `callback`.
|
|
161
|
+
exec();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Clear any existing timeout.
|
|
165
|
+
timeout_id && clearTimeout( timeout_id );
|
|
166
|
+
|
|
167
|
+
if ( debounce_mode === undefined && elapsed > delay ) {
|
|
168
|
+
// In throttle mode, if `delay` time has been exceeded, execute
|
|
169
|
+
// `callback`.
|
|
170
|
+
exec();
|
|
171
|
+
|
|
172
|
+
} else if ( no_trailing !== true ) {
|
|
173
|
+
// In trailing throttle mode, since `delay` time has not been
|
|
174
|
+
// exceeded, schedule `callback` to execute `delay` ms after most
|
|
175
|
+
// recent execution.
|
|
176
|
+
//
|
|
177
|
+
// If `debounce_mode` is true (at_begin), schedule `clear` to execute
|
|
178
|
+
// after `delay` ms.
|
|
179
|
+
//
|
|
180
|
+
// If `debounce_mode` is false (at end), schedule `callback` to
|
|
181
|
+
// execute after `delay` ms.
|
|
182
|
+
timeout_id = setTimeout( debounce_mode ? clear : exec, debounce_mode === undefined ? delay - elapsed : delay );
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// Set the guid of `wrapper` function to the same of original callback, so
|
|
187
|
+
// it can be removed in jQuery 1.4+ .unbind or .die by using the original
|
|
188
|
+
// callback as a reference.
|
|
189
|
+
if ( $.guid ) {
|
|
190
|
+
wrapper.guid = callback.guid = callback.guid || $.guid++;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Return the wrapper function.
|
|
194
|
+
return wrapper;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// Method: jQuery.debounce
|
|
198
|
+
//
|
|
199
|
+
// Debounce execution of a function. Debouncing, unlike throttling,
|
|
200
|
+
// guarantees that a function is only executed a single time, either at the
|
|
201
|
+
// very beginning of a series of calls, or at the very end. If you want to
|
|
202
|
+
// simply rate-limit execution of a function, see the <jQuery.throttle>
|
|
203
|
+
// method.
|
|
204
|
+
//
|
|
205
|
+
// In this visualization, | is a debounced-function call and X is the actual
|
|
206
|
+
// callback execution:
|
|
207
|
+
//
|
|
208
|
+
// > Debounced with `at_begin` specified as false or unspecified:
|
|
209
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
|
210
|
+
// > X X
|
|
211
|
+
// >
|
|
212
|
+
// > Debounced with `at_begin` specified as true:
|
|
213
|
+
// > ||||||||||||||||||||||||| (pause) |||||||||||||||||||||||||
|
|
214
|
+
// > X X
|
|
215
|
+
//
|
|
216
|
+
// Usage:
|
|
217
|
+
//
|
|
218
|
+
// > var debounced = jQuery.debounce( delay, [ at_begin, ] callback );
|
|
219
|
+
// >
|
|
220
|
+
// > jQuery('selector').bind( 'someevent', debounced );
|
|
221
|
+
// > jQuery('selector').unbind( 'someevent', debounced );
|
|
222
|
+
//
|
|
223
|
+
// This also works in jQuery 1.4+:
|
|
224
|
+
//
|
|
225
|
+
// > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) );
|
|
226
|
+
// > jQuery('selector').unbind( 'someevent', callback );
|
|
227
|
+
//
|
|
228
|
+
// Arguments:
|
|
229
|
+
//
|
|
230
|
+
// delay - (Number) A zero-or-greater delay in milliseconds. For event
|
|
231
|
+
// callbacks, values around 100 or 250 (or even higher) are most useful.
|
|
232
|
+
// at_begin - (Boolean) Optional, defaults to false. If at_begin is false or
|
|
233
|
+
// unspecified, callback will only be executed `delay` milliseconds after
|
|
234
|
+
// the last debounced-function call. If at_begin is true, callback will be
|
|
235
|
+
// executed only at the first debounced-function call. (After the
|
|
236
|
+
// throttled-function has not been called for `delay` milliseconds, the
|
|
237
|
+
// internal counter is reset)
|
|
238
|
+
// callback - (Function) A function to be executed after delay milliseconds.
|
|
239
|
+
// The `this` context and all arguments are passed through, as-is, to
|
|
240
|
+
// `callback` when the debounced-function is executed.
|
|
241
|
+
//
|
|
242
|
+
// Returns:
|
|
243
|
+
//
|
|
244
|
+
// (Function) A new, debounced, function.
|
|
245
|
+
|
|
246
|
+
$.debounce = function( delay, at_begin, callback ) {
|
|
247
|
+
return callback === undefined
|
|
248
|
+
? jq_throttle( delay, at_begin, false )
|
|
249
|
+
: jq_throttle( delay, callback, at_begin !== false );
|
|
250
|
+
};
|
|
251
|
+
})(this);
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* timeago: a jQuery plugin, version: 0.9.3 (2011-01-21)
|
|
3
|
+
* @requires jQuery v1.2.3 or later
|
|
4
|
+
*
|
|
5
|
+
* Timeago is a jQuery plugin that makes it easy to support automatically
|
|
6
|
+
* updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
|
|
7
|
+
*
|
|
8
|
+
* For usage and examples, visit:
|
|
9
|
+
* http://timeago.yarp.com/
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the MIT:
|
|
12
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) 2008-2011, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
|
|
15
|
+
*/
|
|
16
|
+
(function($) {
|
|
17
|
+
$.timeago = function(timestamp) {
|
|
18
|
+
if (timestamp instanceof Date) {
|
|
19
|
+
return inWords(timestamp);
|
|
20
|
+
} else if (typeof timestamp === "string") {
|
|
21
|
+
return inWords($.timeago.parse(timestamp));
|
|
22
|
+
} else {
|
|
23
|
+
return inWords($.timeago.datetime(timestamp));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var $t = $.timeago;
|
|
27
|
+
|
|
28
|
+
$.extend($.timeago, {
|
|
29
|
+
settings: {
|
|
30
|
+
refreshMillis: 60000,
|
|
31
|
+
allowFuture: false,
|
|
32
|
+
strings: {
|
|
33
|
+
prefixAgo: null,
|
|
34
|
+
prefixFromNow: null,
|
|
35
|
+
suffixAgo: "ago",
|
|
36
|
+
suffixFromNow: "from now",
|
|
37
|
+
seconds: "less than a minute",
|
|
38
|
+
minute: "about a minute",
|
|
39
|
+
minutes: "%d minutes",
|
|
40
|
+
hour: "about an hour",
|
|
41
|
+
hours: "about %d hours",
|
|
42
|
+
day: "a day",
|
|
43
|
+
days: "%d days",
|
|
44
|
+
month: "about a month",
|
|
45
|
+
months: "%d months",
|
|
46
|
+
year: "about a year",
|
|
47
|
+
years: "%d years",
|
|
48
|
+
numbers: []
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
inWords: function(distanceMillis) {
|
|
52
|
+
var $l = this.settings.strings;
|
|
53
|
+
var prefix = $l.prefixAgo;
|
|
54
|
+
var suffix = $l.suffixAgo;
|
|
55
|
+
if (this.settings.allowFuture) {
|
|
56
|
+
if (distanceMillis < 0) {
|
|
57
|
+
prefix = $l.prefixFromNow;
|
|
58
|
+
suffix = $l.suffixFromNow;
|
|
59
|
+
}
|
|
60
|
+
distanceMillis = Math.abs(distanceMillis);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var seconds = distanceMillis / 1000;
|
|
64
|
+
var minutes = seconds / 60;
|
|
65
|
+
var hours = minutes / 60;
|
|
66
|
+
var days = hours / 24;
|
|
67
|
+
var years = days / 365;
|
|
68
|
+
|
|
69
|
+
function substitute(stringOrFunction, number) {
|
|
70
|
+
var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
|
|
71
|
+
var value = ($l.numbers && $l.numbers[number]) || number;
|
|
72
|
+
return string.replace(/%d/i, value);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
|
|
76
|
+
seconds < 90 && substitute($l.minute, 1) ||
|
|
77
|
+
minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
|
|
78
|
+
minutes < 90 && substitute($l.hour, 1) ||
|
|
79
|
+
hours < 24 && substitute($l.hours, Math.round(hours)) ||
|
|
80
|
+
hours < 48 && substitute($l.day, 1) ||
|
|
81
|
+
days < 30 && substitute($l.days, Math.floor(days)) ||
|
|
82
|
+
days < 60 && substitute($l.month, 1) ||
|
|
83
|
+
days < 365 && substitute($l.months, Math.floor(days / 30)) ||
|
|
84
|
+
years < 2 && substitute($l.year, 1) ||
|
|
85
|
+
substitute($l.years, Math.floor(years));
|
|
86
|
+
|
|
87
|
+
return $.trim([prefix, words, suffix].join(" "));
|
|
88
|
+
},
|
|
89
|
+
parse: function(iso8601) {
|
|
90
|
+
var s = $.trim(iso8601);
|
|
91
|
+
s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
|
|
92
|
+
s = s.replace(/-/,"/").replace(/-/,"/");
|
|
93
|
+
s = s.replace(/T/," ").replace(/Z/," UTC");
|
|
94
|
+
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
|
|
95
|
+
return new Date(s);
|
|
96
|
+
},
|
|
97
|
+
datetime: function(elem) {
|
|
98
|
+
// jQuery's `is()` doesn't play well with HTML5 in IE
|
|
99
|
+
var isTime = $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
|
|
100
|
+
var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title");
|
|
101
|
+
return $t.parse(iso8601);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
$.fn.timeago = function() {
|
|
106
|
+
var self = this;
|
|
107
|
+
self.each(refresh);
|
|
108
|
+
|
|
109
|
+
var $s = $t.settings;
|
|
110
|
+
if ($s.refreshMillis > 0) {
|
|
111
|
+
setInterval(function() { self.each(refresh); }, $s.refreshMillis);
|
|
112
|
+
}
|
|
113
|
+
return self;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function refresh() {
|
|
117
|
+
var data = prepareData(this);
|
|
118
|
+
if (!isNaN(data.datetime)) {
|
|
119
|
+
$(this).text(inWords(data.datetime));
|
|
120
|
+
}
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function prepareData(element) {
|
|
125
|
+
element = $(element);
|
|
126
|
+
if (!element.data("timeago")) {
|
|
127
|
+
element.data("timeago", { datetime: $t.datetime(element) });
|
|
128
|
+
var text = $.trim(element.text());
|
|
129
|
+
if (text.length > 0) {
|
|
130
|
+
element.attr("title", text);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return element.data("timeago");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function inWords(date) {
|
|
137
|
+
return $t.inWords(distance(date));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function distance(date) {
|
|
141
|
+
return (new Date().getTime() - date.getTime());
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// fix for IE6 suckage
|
|
145
|
+
document.createElement("abbr");
|
|
146
|
+
document.createElement("time");
|
|
147
|
+
}(jQuery));
|
|
148
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Underscore.js 1.1.7
|
|
2
|
+
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
|
|
3
|
+
// Underscore is freely distributable under the MIT license.
|
|
4
|
+
// Portions of Underscore are inspired or borrowed from Prototype,
|
|
5
|
+
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
|
6
|
+
// For all details and documentation:
|
|
7
|
+
// http://documentcloud.github.com/underscore
|
|
8
|
+
(function(){var p=this,C=p._,m={},i=Array.prototype,n=Object.prototype,f=i.slice,D=i.unshift,E=n.toString,l=n.hasOwnProperty,s=i.forEach,t=i.map,u=i.reduce,v=i.reduceRight,w=i.filter,x=i.every,y=i.some,o=i.indexOf,z=i.lastIndexOf;n=Array.isArray;var F=Object.keys,q=Function.prototype.bind,b=function(a){return new j(a)};typeof module!=="undefined"&&module.exports?(module.exports=b,b._=b):p._=b;b.VERSION="1.1.7";var h=b.each=b.forEach=function(a,c,b){if(a!=null)if(s&&a.forEach===s)a.forEach(c,b);else if(a.length===
|
|
9
|
+
+a.length)for(var e=0,k=a.length;e<k;e++){if(e in a&&c.call(b,a[e],e,a)===m)break}else for(e in a)if(l.call(a,e)&&c.call(b,a[e],e,a)===m)break};b.map=function(a,c,b){var e=[];if(a==null)return e;if(t&&a.map===t)return a.map(c,b);h(a,function(a,g,G){e[e.length]=c.call(b,a,g,G)});return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var k=d!==void 0;a==null&&(a=[]);if(u&&a.reduce===u)return e&&(c=b.bind(c,e)),k?a.reduce(c,d):a.reduce(c);h(a,function(a,b,f){k?d=c.call(e,d,a,b,f):(d=a,k=!0)});if(!k)throw new TypeError("Reduce of empty array with no initial value");
|
|
10
|
+
return d};b.reduceRight=b.foldr=function(a,c,d,e){a==null&&(a=[]);if(v&&a.reduceRight===v)return e&&(c=b.bind(c,e)),d!==void 0?a.reduceRight(c,d):a.reduceRight(c);a=(b.isArray(a)?a.slice():b.toArray(a)).reverse();return b.reduce(a,c,d,e)};b.find=b.detect=function(a,c,b){var e;A(a,function(a,g,f){if(c.call(b,a,g,f))return e=a,!0});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(w&&a.filter===w)return a.filter(c,b);h(a,function(a,g,f){c.call(b,a,g,f)&&(e[e.length]=a)});return e};
|
|
11
|
+
b.reject=function(a,c,b){var e=[];if(a==null)return e;h(a,function(a,g,f){c.call(b,a,g,f)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=!0;if(a==null)return e;if(x&&a.every===x)return a.every(c,b);h(a,function(a,g,f){if(!(e=e&&c.call(b,a,g,f)))return m});return e};var A=b.some=b.any=function(a,c,d){c=c||b.identity;var e=!1;if(a==null)return e;if(y&&a.some===y)return a.some(c,d);h(a,function(a,b,f){if(e|=c.call(d,a,b,f))return m});return!!e};b.include=b.contains=function(a,c){var b=
|
|
12
|
+
!1;if(a==null)return b;if(o&&a.indexOf===o)return a.indexOf(c)!=-1;A(a,function(a){if(b=a===c)return!0});return b};b.invoke=function(a,c){var d=f.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,
|
|
13
|
+
c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};h(a,function(a,b,f){b=c?c.call(d,a,b,f):a;b<e.computed&&(e={value:a,computed:b})});return e.value};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,f){return{value:a,criteria:c.call(d,a,b,f)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,b){var d={};h(a,function(a,f){var g=b(a,f);(d[g]||(d[g]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||
|
|
14
|
+
(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(b.isArray(a))return f.call(a);if(b.isArguments(a))return f.call(a);return b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?f.call(a,0,b):a[0]};b.rest=b.tail=function(a,b,d){return f.call(a,b==null||d?1:b)};b.last=function(a){return a[a.length-1]};b.compact=function(a){return b.filter(a,
|
|
15
|
+
function(a){return!!a})};b.flatten=function(a){return b.reduce(a,function(a,d){if(b.isArray(d))return a.concat(b.flatten(d));a[a.length]=d;return a},[])};b.without=function(a){return b.difference(a,f.call(arguments,1))};b.uniq=b.unique=function(a,c){return b.reduce(a,function(a,e,f){if(0==f||(c===!0?b.last(a)!=e:!b.include(a,e)))a[a.length]=e;return a},[])};b.union=function(){return b.uniq(b.flatten(arguments))};b.intersection=b.intersect=function(a){var c=f.call(arguments,1);return b.filter(b.uniq(a),
|
|
16
|
+
function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a,c){return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=f.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(o&&a.indexOf===o)return a.indexOf(c);d=0;for(e=a.length;d<e;d++)if(a[d]===c)return d;return-1};b.lastIndexOf=function(a,
|
|
17
|
+
b){if(a==null)return-1;if(z&&a.lastIndexOf===z)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);d=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};b.bind=function(a,b){if(a.bind===q&&q)return q.apply(a,f.call(arguments,1));var d=f.call(arguments,2);return function(){return a.apply(b,d.concat(f.call(arguments)))}};b.bindAll=function(a){var c=f.call(arguments,1);
|
|
18
|
+
c.length==0&&(c=b.functions(a));h(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,c){var d={};c||(c=b.identity);return function(){var b=c.apply(this,arguments);return l.call(d,b)?d[b]:d[b]=a.apply(this,arguments)}};b.delay=function(a,b){var d=f.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(f.call(arguments,1)))};var B=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;
|
|
19
|
+
a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};b.throttle=function(a,b){return B(a,b,!1)};b.debounce=function(a,b){return B(a,b,!0)};b.once=function(a){var b=!1,d;return function(){if(b)return d;b=!0;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(f.call(arguments));return b.apply(this,d)}};b.compose=function(){var a=f.call(arguments);return function(){for(var b=f.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=
|
|
20
|
+
function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}};b.keys=F||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)l.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){h(f.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){h(f.call(arguments,
|
|
21
|
+
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,c){if(a===c)return!0;var d=typeof a;if(d!=typeof c)return!1;if(a==c)return!0;if(!a&&c||a&&!c)return!1;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual)return a.isEqual(c);if(c.isEqual)return c.isEqual(a);if(b.isDate(a)&&b.isDate(c))return a.getTime()===c.getTime();if(b.isNaN(a)&&b.isNaN(c))return!1;
|
|
22
|
+
if(b.isRegExp(a)&&b.isRegExp(c))return a.source===c.source&&a.global===c.global&&a.ignoreCase===c.ignoreCase&&a.multiline===c.multiline;if(d!=="object")return!1;if(a.length&&a.length!==c.length)return!1;d=b.keys(a);var e=b.keys(c);if(d.length!=e.length)return!1;for(var f in a)if(!(f in c)||!b.isEqual(a[f],c[f]))return!1;return!0};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(l.call(a,c))return!1;return!0};b.isElement=function(a){return!!(a&&a.nodeType==
|
|
23
|
+
1)};b.isArray=n||function(a){return E.call(a)==="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return!(!a||!l.call(a,"callee"))};b.isFunction=function(a){return!(!a||!a.constructor||!a.call||!a.apply)};b.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};b.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===!0||a===!1};b.isDate=function(a){return!(!a||!a.getTimezoneOffset||
|
|
24
|
+
!a.setUTCFullYear)};b.isRegExp=function(a){return!(!a||!a.test||!a.exec||!(a.ignoreCase||a.ignoreCase===!1))};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){p._=C;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.mixin=function(a){h(b.functions(a),function(c){H(c,b[c]=a[c])})};var I=0;b.uniqueId=function(a){var b=I++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};
|
|
25
|
+
b.template=function(a,c){var d=b.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return c?d(c):d};
|
|
26
|
+
var j=function(a){this._wrapped=a};b.prototype=j.prototype;var r=function(a,c){return c?b(a).chain():a},H=function(a,c){j.prototype[a]=function(){var a=f.call(arguments);D.call(a,this._wrapped);return r(c.apply(b,a),this._chain)}};b.mixin(b);h(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=i[a];j.prototype[a]=function(){b.apply(this._wrapped,arguments);return r(this._wrapped,this._chain)}});h(["concat","join","slice"],function(a){var b=i[a];j.prototype[a]=function(){return r(b.apply(this._wrapped,
|
|
27
|
+
arguments),this._chain)}});j.prototype.chain=function(){this._chain=!0;return this};j.prototype.value=function(){return this._wrapped}})();
|
|
28
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@import compass/css3/border-radius
|
|
2
|
+
@import "compass/css3/box-shadow"
|
|
3
|
+
@import "compass/css3/text-shadow"
|
|
4
|
+
@import "compass/css3/background-clip"
|
|
5
|
+
@import "compass/css3/box-sizing"
|
|
6
|
+
|
|
7
|
+
@import lib/bootstrap.sass
|
|
8
|
+
|
|
9
|
+
//@import layouts/default.sass
|
|
10
|
+
@import layouts/header.sass
|
|
11
|
+
@import layouts/navigation.sass
|
|
12
|
+
@import layouts/footer.sass
|
|
13
|
+
@import layouts/forms.sass
|
|
14
|
+
|
|
15
|
+
@import pages/home.sass
|
|
16
|
+
|
|
17
|
+
@import sessions/new.sass
|
|
18
|
+
|
|
19
|
+
@import users/new.sass
|
|
20
|
+
@import users/activate.sass
|
|
21
|
+
@import users/suspended.sass
|