-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·67 lines (58 loc) · 1.6 KB
/
app.js
File metadata and controls
executable file
·67 lines (58 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Quick and dirty "proof of concept" hack for displaying
* a spreedsheet from Google Docs...with automatic syncing
* that gets paused if the user moves the mouse/types in the input field.
* The polling could also be turned on/off, by pressing the poll button.
*
* Uses:
* > Require.js
* > LoDash
* > Backbone.js
* > Handlebars.js (template)
* > List.js (sorting and filtering)
* > jQuery 2.0.3
*
* Needs some refactoring...
*
*/
define([
'jquery',
'./models/SpreedSheetModel',
'./views/SpreedSheetView',
'./views/PollView',
'./views/LoadingView'
],
function($, SpreedSheetModel, SpreedSheetView, PollView, LoadingView) {
'use strict';
var setup = function() {
var parts = window.location.hash.substr(1).split('/'),
modelOptions = {
key: parts[0] || 'o13394135408524254648.240766968415752635',
name: decodeURI(parts[1] || 'No name'),
polltime: parts[2]
};
var sheetModel = new SpreedSheetModel(modelOptions);
new SpreedSheetView({
// Adds CSS-class to cells with '1'/'0' values ... could of course be removed
cssConverter: {
'2': 'alert alert-warning',
'1': 'alert alert-success',
'0': 'alert alert-danger'
},
// Replace '1'/'0' values to 'Done/Missing'... could of course be removed
valueConverter: {
'2': 'Pågår',
'1': 'Klar',
'0': 'Ej klar'
},
model: sheetModel
});
new LoadingView({ model: sheetModel });
new PollView({ model: sheetModel });
};
return {
start: function() {
$(document).ready(setup);
}
};
});