spontaneous 0.2.0.beta5 → 0.2.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +2 -0
- data/Readme.markdown +4 -4
- data/application/css/core.css.scss +144 -43
- data/application/css/definitions.css.scss +50 -16
- data/application/css/dialogue.css.scss +5 -2
- data/application/css/editing.css.scss +7 -7
- data/application/css/font.css.scss +1 -1
- data/application/css/meta.css.scss +6 -6
- data/application/css/popover.css.scss +6 -6
- data/application/css/top.css.scss +8 -1
- data/application/js/add_alias_dialogue.js +137 -36
- data/application/js/add_home_dialogue.js +10 -10
- data/application/js/ajax.js +26 -26
- data/application/js/authentication.js +2 -2
- data/application/js/box.js +21 -10
- data/application/js/box_container.js +13 -7
- data/application/js/compatibility.js +19 -17
- data/application/js/conflicted_field_dialogue.js +5 -5
- data/application/js/content.js +22 -16
- data/application/js/content_area.js +62 -33
- data/application/js/dialogue.js +16 -16
- data/application/js/dom.js +9 -10
- data/application/js/edit_panel.js +25 -20
- data/application/js/editing.js +21 -8
- data/application/js/entry.js +1 -1
- data/application/js/extensions.js +11 -11
- data/application/js/field/boolean.js +6 -6
- data/application/js/field/date.js +1 -1
- data/application/js/field/file.js +17 -17
- data/application/js/field/image.js +27 -27
- data/application/js/field/markdown.js +72 -71
- data/application/js/field/select.js +9 -9
- data/application/js/field/string.js +3 -3
- data/application/js/field/webvideo.js +2 -2
- data/application/js/field_preview.js +3 -0
- data/application/js/init.js +3 -2
- data/application/js/jquery-selection-position.js +13 -13
- data/application/js/location.js +17 -12
- data/application/js/login.js +2 -2
- data/application/js/meta_view/user_admin.js +101 -101
- data/application/js/metadata.js +1 -1
- data/application/js/page.js +2 -2
- data/application/js/page_browser.js +13 -13
- data/application/js/page_entry.js +1 -1
- data/application/js/panel/root_menu.js +10 -10
- data/application/js/popover.js +6 -5
- data/application/js/popover_view.js +5 -5
- data/application/js/preview.js +10 -4
- data/application/js/progress.js +6 -6
- data/application/js/properties.js +35 -6
- data/application/js/publish.js +43 -43
- data/application/js/require.js +14 -14
- data/application/js/services.js +3 -3
- data/application/js/sharded_upload.js +9 -8
- data/application/js/side_bar.js +5 -5
- data/application/js/state.js +2 -2
- data/application/js/status_bar.js +6 -6
- data/application/js/top_bar.js +97 -65
- data/application/js/types.js +9 -6
- data/application/js/upload.js +4 -4
- data/application/js/upload_manager.js +21 -21
- data/application/js/user.js +1 -1
- data/application/js/vendor/jquery.velocity.min.js +7 -0
- data/application/js/views.js +32 -8
- data/application/js/views/box_view.js +51 -31
- data/application/js/views/page_piece_view.js +17 -15
- data/application/js/views/page_view.js +54 -43
- data/application/js/views/piece_view.js +44 -37
- data/application/static/font/fontawesome-webfont-4f0022f25672c7f501c339cbf98d9117.ttf +0 -0
- data/application/views/index.erb +1 -0
- data/db/migrations/20130114120000_create_revision_tables.rb +2 -1
- data/db/migrations/20130813111009_increase_path_length.rb +11 -2
- data/db/migrations/20140506171823_add_index_to_target_id.rb +11 -0
- data/db/migrations/20140514090204_add_content_hash.rb +59 -0
- data/db/migrations/20140519150253_add_content_hash_timestamp.rb +20 -0
- data/lib/spontaneous.rb +0 -1
- data/lib/spontaneous/asset/environment.rb +77 -15
- data/lib/spontaneous/box.rb +21 -0
- data/lib/spontaneous/capistrano/deploy.rb +1 -1
- data/lib/spontaneous/capistrano/sync.rb +8 -7
- data/lib/spontaneous/change.rb +4 -2
- data/lib/spontaneous/cli/fields.rb +7 -3
- data/lib/spontaneous/cli/generate.rb +2 -0
- data/lib/spontaneous/cli/init.rb +24 -93
- data/lib/spontaneous/cli/init/db.rb +94 -0
- data/lib/spontaneous/cli/init/mysql.rb +17 -0
- data/lib/spontaneous/cli/init/postgresql.rb +33 -0
- data/lib/spontaneous/cli/init/sqlite.rb +14 -0
- data/lib/spontaneous/cli/site.rb +45 -20
- data/lib/spontaneous/collections/box_set.rb +3 -0
- data/lib/spontaneous/collections/entry_set.rb +43 -4
- data/lib/spontaneous/collections/field_set.rb +14 -2
- data/lib/spontaneous/data_mapper.rb +40 -7
- data/lib/spontaneous/data_mapper/content_model.rb +1 -1
- data/lib/spontaneous/data_mapper/content_model/associations.rb +63 -12
- data/lib/spontaneous/data_mapper/content_model/timestamps.rb +9 -14
- data/lib/spontaneous/data_mapper/content_table.rb +4 -2
- data/lib/spontaneous/data_mapper/dataset.rb +31 -2
- data/lib/spontaneous/data_mapper/scope.rb +37 -20
- data/lib/spontaneous/errors.rb +6 -0
- data/lib/spontaneous/facet.rb +20 -10
- data/lib/spontaneous/field/base.rb +8 -1
- data/lib/spontaneous/field/file.rb +28 -3
- data/lib/spontaneous/field/image.rb +2 -0
- data/lib/spontaneous/field/update.rb +6 -0
- data/lib/spontaneous/field/webvideo/vimeo.rb +6 -1
- data/lib/spontaneous/field/webvideo/vine.rb +1 -1
- data/lib/spontaneous/field/webvideo/youtube.rb +1 -1
- data/lib/spontaneous/generators/site.rb +6 -4
- data/lib/spontaneous/generators/site/.gitignore +1 -0
- data/lib/spontaneous/generators/site/Gemfile.tt +3 -3
- data/lib/spontaneous/generators/site/config/{indexes.rb.tt → initializers/indexes.rb.tt} +0 -0
- data/lib/spontaneous/generators/site/config/initializers/publishing.rb.tt +78 -0
- data/lib/spontaneous/generators/site/{config/database.yml.tt → db/mysql2.yml.tt} +7 -6
- data/lib/spontaneous/generators/site/db/postgres.yml.tt +25 -0
- data/lib/spontaneous/generators/site/db/sqlite3.yml.tt +18 -0
- data/lib/spontaneous/generators/site/public/humans.txt.tt +14 -0
- data/lib/spontaneous/generators/site/templates/layouts/standard.html.cut.tt +51 -0
- data/lib/spontaneous/loader.rb +1 -1
- data/lib/spontaneous/logger.rb +1 -1
- data/lib/spontaneous/media/image/optimizer.rb +1 -1
- data/lib/spontaneous/media/image/processor.rb +11 -2
- data/lib/spontaneous/media/image/renderable.rb +2 -0
- data/lib/spontaneous/model.rb +3 -0
- data/lib/spontaneous/model/box/allowed_types.rb +17 -4
- data/lib/spontaneous/model/core.rb +36 -3
- data/lib/spontaneous/model/core/aliases.rb +5 -2
- data/lib/spontaneous/model/core/boxes.rb +6 -0
- data/lib/spontaneous/model/core/cascading_change.rb +38 -0
- data/lib/spontaneous/model/core/content_hash.rb +171 -0
- data/lib/spontaneous/model/core/entries.rb +0 -19
- data/lib/spontaneous/model/core/fields.rb +11 -0
- data/lib/spontaneous/model/core/modifications.rb +22 -21
- data/lib/spontaneous/model/core/render.rb +3 -0
- data/lib/spontaneous/model/core/serialisation.rb +18 -17
- data/lib/spontaneous/model/page.rb +35 -8
- data/lib/spontaneous/model/page/page_tree.rb +20 -8
- data/lib/spontaneous/model/page/paths.rb +79 -50
- data/lib/spontaneous/model/page/singleton.rb +71 -0
- data/lib/spontaneous/model/page/site_map.rb +2 -1
- data/lib/spontaneous/model/page/site_timestamps.rb +2 -2
- data/lib/spontaneous/model/piece.rb +10 -0
- data/lib/spontaneous/output/context.rb +13 -6
- data/lib/spontaneous/output/format.rb +30 -5
- data/lib/spontaneous/output/helpers/script_helper.rb +8 -0
- data/lib/spontaneous/output/helpers/stylesheet_helper.rb +7 -0
- data/lib/spontaneous/output/renderable.rb +16 -0
- data/lib/spontaneous/output/store.rb +1 -1
- data/lib/spontaneous/output/template/renderer.rb +2 -2
- data/lib/spontaneous/page_piece.rb +25 -1
- data/lib/spontaneous/prototypes/box_prototype.rb +13 -0
- data/lib/spontaneous/prototypes/field_prototype.rb +7 -4
- data/lib/spontaneous/publishing.rb +10 -5
- data/lib/spontaneous/publishing/immediate.rb +32 -349
- data/lib/spontaneous/publishing/pipeline.rb +43 -0
- data/lib/spontaneous/publishing/progress.rb +186 -0
- data/lib/spontaneous/publishing/publish.rb +107 -0
- data/lib/spontaneous/publishing/rerender.rb +17 -0
- data/lib/spontaneous/publishing/revision.rb +53 -18
- data/lib/spontaneous/publishing/simultaneous.rb +1 -1
- data/lib/spontaneous/publishing/steps.rb +154 -0
- data/lib/spontaneous/publishing/steps/activate_revision.rb +45 -0
- data/lib/spontaneous/publishing/steps/archive_old_revisions.rb +22 -0
- data/lib/spontaneous/publishing/steps/base_step.rb +49 -0
- data/lib/spontaneous/publishing/steps/copy_static_files.rb +74 -0
- data/lib/spontaneous/publishing/steps/create_revision_directory.rb +24 -0
- data/lib/spontaneous/publishing/steps/generate_rackup_file.rb +51 -0
- data/lib/spontaneous/publishing/steps/generate_search_indexes.rb +24 -0
- data/lib/spontaneous/publishing/steps/render_revision.rb +69 -0
- data/lib/spontaneous/publishing/steps/write_revision_file.rb +43 -0
- data/lib/spontaneous/rack/back.rb +3 -1
- data/lib/spontaneous/rack/back/alias.rb +9 -8
- data/lib/spontaneous/rack/front.rb +1 -1
- data/lib/spontaneous/rack/middleware.rb +7 -4
- data/lib/spontaneous/rack/middleware/transaction.rb +14 -0
- data/lib/spontaneous/rack/page_controller.rb +23 -8
- data/lib/spontaneous/revision.rb +5 -10
- data/lib/spontaneous/schema.rb +5 -0
- data/lib/spontaneous/server.rb +3 -1
- data/lib/spontaneous/site.rb +17 -10
- data/lib/spontaneous/site/publishing.rb +25 -3
- data/lib/spontaneous/site/state.rb +7 -3
- data/lib/spontaneous/tasks/database.rake +5 -10
- data/lib/spontaneous/utils/database/mysql_dumper.rb +5 -1
- data/lib/spontaneous/version.rb +1 -1
- data/spontaneous.gemspec +4 -3
- data/test/fixtures/example_application/config/initializers/initializer1.rb +1 -0
- data/test/fixtures/example_application/config/initializers/initializer2.rb +1 -0
- data/test/fixtures/example_application/config/initializers/publishing.rb +13 -0
- data/test/fixtures/search/config/{indexes.rb → initializers/indexes.rb} +0 -0
- data/test/fixtures/serialisation/root_hash.yaml.erb +10 -4
- data/test/functional/test_application.rb +10 -0
- data/test/functional/test_back.rb +23 -5
- data/test/functional/test_cli.rb +98 -34
- data/test/functional/test_front.rb +7 -3
- data/test/test_helper.rb +35 -28
- data/test/unit/test_alias.rb +20 -3
- data/test/unit/test_assets.rb +58 -30
- data/test/unit/test_changesets.rb +20 -12
- data/test/unit/test_content_hash.rb +496 -0
- data/test/unit/test_context.rb +28 -1
- data/test/unit/test_controllers.rb +96 -61
- data/test/unit/test_crypt.rb +1 -8
- data/test/unit/test_datamapper.rb +95 -19
- data/test/unit/test_features.rb +1 -4
- data/test/unit/test_fields.rb +61 -12
- data/test/unit/test_generators.rb +39 -2
- data/test/unit/test_images.rb +3 -1
- data/test/unit/test_modifications.rb +224 -219
- data/test/unit/test_output_store.rb +10 -0
- data/test/unit/{test_formats.rb → test_outputs.rb} +75 -6
- data/test/unit/test_page.rb +61 -15
- data/test/unit/test_plugins.rb +2 -42
- data/test/unit/test_publishing_pipeline.rb +1050 -0
- data/test/unit/test_render.rb +30 -0
- data/test/unit/test_revisions.rb +110 -2
- data/test/unit/test_schema.rb +4 -0
- data/test/unit/test_search.rb +1 -1
- data/test/unit/test_serialisation.rb +6 -1
- data/test/unit/test_singletons.rb +159 -0
- data/test/unit/test_site.rb +71 -44
- metadata +140 -86
- data/application/static/font/fontawesome-webfont-1c66a4738b40ef0f6b1abca0ba9a796d.ttf +0 -0
- data/test/unit/test_publishing.rb +0 -330
@@ -10,14 +10,14 @@ Spontaneous.ConflictedFieldDialogue = (function($, S) {
|
|
10
10
|
this.wrap = dom.div('#conflicted-fields-dialogue');
|
11
11
|
},
|
12
12
|
title: function() {
|
13
|
-
return
|
13
|
+
return 'Conflicted Fields';
|
14
14
|
},
|
15
15
|
width: function() {
|
16
16
|
return '90%';
|
17
17
|
},
|
18
18
|
buttons: function() {
|
19
19
|
var btns = {};
|
20
|
-
btns[
|
20
|
+
btns['Use'] = this.conflict_resolved.bind(this);
|
21
21
|
return btns;
|
22
22
|
},
|
23
23
|
|
@@ -41,7 +41,7 @@ Spontaneous.ConflictedFieldDialogue = (function($, S) {
|
|
41
41
|
}
|
42
42
|
},
|
43
43
|
home_created: function(data) {
|
44
|
-
window.location.href = S.Ajax.namespace
|
44
|
+
window.location.href = S.Ajax.namespace;
|
45
45
|
},
|
46
46
|
select_type: function(type) {
|
47
47
|
this.type = type;
|
@@ -59,7 +59,7 @@ Spontaneous.ConflictedFieldDialogue = (function($, S) {
|
|
59
59
|
var conflict = this.current_conflict(),
|
60
60
|
field = conflict.field,
|
61
61
|
instructions = dom.p('.instructions');
|
62
|
-
instructions.html("The field '"+field.label()+"' has been modified by another person. Please select which version you want to use.")
|
62
|
+
instructions.html("The field '"+field.label()+"' has been modified by another person. Please select which version you want to use.");
|
63
63
|
var view = field.conflict_view(this, conflict);
|
64
64
|
outer.append(instructions);
|
65
65
|
outer.append(view.panel());
|
@@ -83,7 +83,7 @@ Spontaneous.ConflictedFieldDialogue = (function($, S) {
|
|
83
83
|
},
|
84
84
|
cancel_button: function() {
|
85
85
|
return false;
|
86
|
-
}
|
86
|
+
}
|
87
87
|
});
|
88
88
|
return ConflictedFieldDialogue;
|
89
89
|
})(jQuery, Spontaneous);
|
data/application/js/content.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
// console.log('Loading Content...')
|
2
2
|
|
3
3
|
Spontaneous.Content = (function($, S) {
|
4
|
+
'use strict';
|
4
5
|
var dom = S.Dom;
|
5
6
|
|
6
7
|
var Content = new JS.Class({
|
@@ -25,7 +26,7 @@ Spontaneous.Content = (function($, S) {
|
|
25
26
|
return this.content.target;
|
26
27
|
},
|
27
28
|
developer_description: function() {
|
28
|
-
return this.type().type +
|
29
|
+
return this.type().type + '['+this.id()+']';
|
29
30
|
},
|
30
31
|
developer_edit_url: function() {
|
31
32
|
return this.type().edit_url();
|
@@ -51,9 +52,6 @@ Spontaneous.Content = (function($, S) {
|
|
51
52
|
$.each(this.entries(), function(i, e) { e.unload(); });
|
52
53
|
},
|
53
54
|
|
54
|
-
has_fields: function() {
|
55
|
-
return this.field_list().length > 0;
|
56
|
-
},
|
57
55
|
field_list: function() {
|
58
56
|
var type = this.type(), prototypes = type.field_prototypes, names = type.field_names;
|
59
57
|
var fields = this.fields(), list = [];
|
@@ -103,19 +101,19 @@ Spontaneous.Content = (function($, S) {
|
|
103
101
|
type_class = this.constantize(prototype.type);
|
104
102
|
if (!type_class) {
|
105
103
|
console.warn(
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
104
|
+
'Content#fields:',
|
105
|
+
'Field has invalid type', prototype.type,
|
106
|
+
'content_id:', this.content.id,
|
107
|
+
'type:', "'"+type.title+"'",
|
108
|
+
'field_name:', f.name
|
111
109
|
);
|
112
110
|
type_class = Spontaneous.Field.String;
|
113
111
|
}
|
114
|
-
var field = new type_class(this, f);
|
112
|
+
var field = new type_class(this, f); // jshint ignore:line
|
115
113
|
// field.watch('value', this.field_updated.bind(this, field));
|
116
114
|
fields[f.name] = field;
|
117
115
|
}
|
118
|
-
}
|
116
|
+
}
|
119
117
|
return fields;
|
120
118
|
}.cache(),
|
121
119
|
|
@@ -147,7 +145,7 @@ Spontaneous.Content = (function($, S) {
|
|
147
145
|
},
|
148
146
|
|
149
147
|
has_fields: function() {
|
150
|
-
return
|
148
|
+
return this.field_list().length > 0;
|
151
149
|
},
|
152
150
|
|
153
151
|
title: function() {
|
@@ -155,7 +153,15 @@ Spontaneous.Content = (function($, S) {
|
|
155
153
|
},
|
156
154
|
|
157
155
|
title_field: function() {
|
158
|
-
|
156
|
+
var self = this, title_field = self.fields()[self.type().title_field_name];
|
157
|
+
// if we're aliasing a page with a page then it's likely that the alias type
|
158
|
+
// won't have a title field (falling back to its target's value instead)
|
159
|
+
// so we need to fall back to the target's title field in that base
|
160
|
+
if (!title_field && self.type().is_alias()) {
|
161
|
+
var target = new Content(self.target());
|
162
|
+
title_field = target.title_field();
|
163
|
+
}
|
164
|
+
return title_field;
|
159
165
|
},
|
160
166
|
|
161
167
|
hidden: function() {
|
@@ -185,7 +191,7 @@ Spontaneous.Content = (function($, S) {
|
|
185
191
|
}.cache(),
|
186
192
|
|
187
193
|
has_boxes: function() {
|
188
|
-
return (this.boxes().length > 0)
|
194
|
+
return (this.boxes().length > 0);
|
189
195
|
},
|
190
196
|
|
191
197
|
wrap_entry: function(entry) {
|
@@ -193,7 +199,7 @@ Spontaneous.Content = (function($, S) {
|
|
193
199
|
if (entry.is_page) {
|
194
200
|
entry_class = Spontaneous.PageEntry;
|
195
201
|
}
|
196
|
-
return new entry_class(entry, this);
|
202
|
+
return new entry_class(entry, this); // jshint ignore:line
|
197
203
|
},
|
198
204
|
|
199
205
|
allowed_types: function() {
|
@@ -208,7 +214,7 @@ Spontaneous.Content = (function($, S) {
|
|
208
214
|
Spontaneous.Ajax.del(['/content', this.content.id].join('/'), {}, this.destroyed.bind(this));
|
209
215
|
},
|
210
216
|
toggle_visibility: function() {
|
211
|
-
Spontaneous.Ajax.patch(['/content', this.content.id,
|
217
|
+
Spontaneous.Ajax.patch(['/content', this.content.id, 'toggle'].join('/'), {}, this.visibility_toggled.bind(this));
|
212
218
|
},
|
213
219
|
visibility_toggled: function(result) {
|
214
220
|
this.set('hidden', result.hidden);
|
@@ -11,14 +11,45 @@ Spontaneous.ContentArea = (function($, S) {
|
|
11
11
|
mode: 'edit',
|
12
12
|
|
13
13
|
init: function() {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
var self = this;
|
15
|
+
self.wrap = dom.div('#content-outer');
|
16
|
+
self.metaWrap = dom.div('#content-meta').hide();
|
17
|
+
self.inner = dom.div('#content');
|
18
|
+
self.inner.append(dom.div('#content-loading'));
|
19
|
+
self.configureScrollBottomHandler(self.inner);
|
20
|
+
self.preview = S.Preview.init(self.inner);
|
21
|
+
self.editing = S.Editing.init(self.inner);
|
22
|
+
self.service = S.Services.init(self.inner);
|
23
|
+
self.wrap.append(self.metaWrap, self.inner);
|
24
|
+
return self.wrap;
|
25
|
+
},
|
26
|
+
configureScrollBottomHandler: function(inner) {
|
27
|
+
inner.scroll(function(contentArea, div) {
|
28
|
+
var count = 0;
|
29
|
+
return function(e) {
|
30
|
+
var st = div.scrollTop()
|
31
|
+
, ih = div.innerHeight()
|
32
|
+
, sh = div[0].scrollHeight
|
33
|
+
// don't wait until we're at the exact bottom, but trigger a little bit earlier
|
34
|
+
// this should ideally be context sensitive, so that the trigger for short containers
|
35
|
+
// loads a bit earlier. This would mean that the first load of additional content would
|
36
|
+
// happen more promptly than later ones. Currently it's the inverse of that.
|
37
|
+
, margin = 0.95
|
38
|
+
, bottom = ((st + ih) >= (sh * margin));
|
39
|
+
if (bottom) {
|
40
|
+
contentArea.set('scroll_bottom', (++count));
|
41
|
+
}
|
42
|
+
};
|
43
|
+
}(this, inner));
|
44
|
+
},
|
45
|
+
location_loading: function(destination) {
|
46
|
+
if (destination) {
|
47
|
+
this.wrap.addClass('loading');
|
48
|
+
this.current().showLoading();
|
49
|
+
} else {
|
50
|
+
this.wrap.removeClass('loading');
|
51
|
+
this.current().hideLoading();
|
52
|
+
}
|
22
53
|
},
|
23
54
|
|
24
55
|
location_changed: function(location) {
|
@@ -29,37 +60,35 @@ Spontaneous.ContentArea = (function($, S) {
|
|
29
60
|
this.current().display(S.Location.location());
|
30
61
|
},
|
31
62
|
current: function() {
|
32
|
-
this.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
} else if (this.mode === 'service') {
|
45
|
-
this.preview.hide();
|
46
|
-
this.editing.hide();
|
47
|
-
this.service.show();
|
48
|
-
return this.service;
|
63
|
+
var self = this, hide = [], active, editing = self.editing, service = self.service, preview = self.preview;
|
64
|
+
self.exitMeta();
|
65
|
+
|
66
|
+
if (self.mode === 'preview') {
|
67
|
+
hide = [editing, service];
|
68
|
+
active = preview;
|
69
|
+
} else if (self.mode === 'edit') {
|
70
|
+
hide = [preview, service];
|
71
|
+
active = editing;
|
72
|
+
} else if (self.mode === 'service') {
|
73
|
+
hide = [preview, editing];
|
74
|
+
active = service;
|
49
75
|
}
|
76
|
+
hide.forEach(function(el) { el.hide(); });
|
77
|
+
active.show();
|
78
|
+
return active;
|
50
79
|
},
|
51
80
|
goto_page: function(page) {
|
52
81
|
this.current().goto_page(page);
|
53
82
|
},
|
54
83
|
scroll_to_bottom: function(duration, delay) {
|
55
84
|
|
56
|
-
this.inner.delay(delay || 0).
|
85
|
+
this.inner.delay(delay || 0).velocity({ scrollTop:this.inner[0].scrollHeight }, (duration || 1000));
|
57
86
|
},
|
58
87
|
showService: function(service) {
|
59
88
|
if (!this.modeBeforeService) {
|
60
89
|
this.modeBeforeService = this.mode;
|
61
90
|
}
|
62
|
-
this.mode =
|
91
|
+
this.mode = 'service';
|
63
92
|
this.current().display(service.url);
|
64
93
|
},
|
65
94
|
hideService: function() {
|
@@ -71,24 +100,24 @@ Spontaneous.ContentArea = (function($, S) {
|
|
71
100
|
if (this.metaView === view) { return; }
|
72
101
|
this.metaView = view;
|
73
102
|
var outer = this.metaWrap.hide();
|
74
|
-
this.inner.
|
75
|
-
if (view && typeof view.show ===
|
103
|
+
this.inner.velocity({top: '100%'}, 300, function() {
|
104
|
+
if (view && typeof view.show === 'function') {
|
76
105
|
view.show(outer);
|
77
106
|
}
|
78
|
-
outer.fadeIn
|
107
|
+
outer.velocity('fadeIn', 300);
|
79
108
|
});
|
80
109
|
},
|
81
110
|
exitMeta: function() {
|
82
111
|
if (!this.metaView) { return; }
|
83
|
-
if (typeof this.metaView.detach ===
|
112
|
+
if (typeof this.metaView.detach === 'function') {
|
84
113
|
this.metaView.detach();
|
85
114
|
}
|
86
115
|
this.metaView = null;
|
87
116
|
var inner = this.inner, outer = this.metaWrap;
|
88
|
-
inner.
|
117
|
+
inner.velocity({top: '0%'}, 300, function() {
|
89
118
|
outer.empty().hide();
|
90
119
|
});
|
91
|
-
outer.fadeOut
|
120
|
+
outer.velocity('fadeOut', 300);
|
92
121
|
}
|
93
122
|
});
|
94
123
|
return ContentArea;
|
data/application/js/dialogue.js
CHANGED
@@ -28,16 +28,16 @@ Spontaneous.Dialogue = (function($, S) {
|
|
28
28
|
return ['button', (this.is_default ? 'default' : ''), this.label.toLowerCase().split(' ')[0]].join(' ');
|
29
29
|
},
|
30
30
|
disable: function() {
|
31
|
-
this.set_disabled(true)
|
31
|
+
this.set_disabled(true);
|
32
32
|
},
|
33
33
|
enable: function() {
|
34
|
-
this.set_disabled(false)
|
34
|
+
this.set_disabled(false);
|
35
35
|
},
|
36
36
|
set_disabled: function(state) {
|
37
37
|
this.disabled = state;
|
38
38
|
this.button.removeClass('disabled');
|
39
39
|
if (this.disabled) {
|
40
|
-
this.button.addClass('disabled')
|
40
|
+
this.button.addClass('disabled');
|
41
41
|
}
|
42
42
|
}
|
43
43
|
});
|
@@ -62,7 +62,7 @@ Spontaneous.Dialogue = (function($, S) {
|
|
62
62
|
return '50%';
|
63
63
|
},
|
64
64
|
title: function() {
|
65
|
-
return
|
65
|
+
return 'Dialogue';
|
66
66
|
},
|
67
67
|
class_name: function() {
|
68
68
|
return '';
|
@@ -103,14 +103,14 @@ Spontaneous.Dialogue = (function($, S) {
|
|
103
103
|
if (this._open || !instance) { return; }
|
104
104
|
this._instance = instance;
|
105
105
|
instance.manager = this;
|
106
|
-
$('body').css(
|
107
|
-
this.overlay().fadeIn
|
106
|
+
$('body').css('overflow', 'hidden');
|
107
|
+
this.overlay().velocity('fadeIn', {duration: 200});
|
108
108
|
var c = this.container(), a = this._actions, b;
|
109
109
|
var buttons = instance.buttons(), button_map = {};
|
110
110
|
a.empty().append(dom.div('.spacer'));
|
111
111
|
b = instance.cancel_button();
|
112
112
|
if (b) {
|
113
|
-
button_map
|
113
|
+
button_map.cancel = b;
|
114
114
|
button_map[instance.cancel_label().toLowerCase()] = b;
|
115
115
|
a.append(b.html());
|
116
116
|
$(document).bind('keydown.dialogue', function(event) {
|
@@ -139,7 +139,7 @@ Spontaneous.Dialogue = (function($, S) {
|
|
139
139
|
this.button_map = button_map;
|
140
140
|
this._body.empty().append(instance.body());
|
141
141
|
|
142
|
-
c.fadeIn
|
142
|
+
c.velocity('fadeIn', {duration: 200});
|
143
143
|
this._open = true;
|
144
144
|
},
|
145
145
|
|
@@ -148,20 +148,20 @@ Spontaneous.Dialogue = (function($, S) {
|
|
148
148
|
, dialogueHeight = (+contentsHeight) + this._actions.outerHeight() + this._title.outerHeight()
|
149
149
|
, el = this._frame;
|
150
150
|
dialogueHeight = Math.max(dialogueHeight, 100);
|
151
|
-
if (contentsHeight && dialogueHeight <
|
152
|
-
el.
|
151
|
+
if (contentsHeight && dialogueHeight < this._originalHeight) {
|
152
|
+
el.velocity({'height': dialogueHeight}, 400);
|
153
153
|
}
|
154
154
|
},
|
155
155
|
disable_button: function(button_name) {
|
156
|
-
var button = this.button_map[button_name.toLowerCase()]
|
156
|
+
var button = this.button_map[button_name.toLowerCase()];
|
157
157
|
button.disable();
|
158
158
|
},
|
159
159
|
close: function() {
|
160
160
|
if (!this._instance || !this._open) { return; }
|
161
161
|
this._instance.cleanup();
|
162
162
|
this.container().remove();
|
163
|
-
this.overlay().fadeOut
|
164
|
-
$('body').css(
|
163
|
+
this.overlay().velocity('fadeOut', 200, function() {
|
164
|
+
$('body').css('overflow', 'auto');
|
165
165
|
});
|
166
166
|
this._instance = this._container = this._open = false;
|
167
167
|
$(document).unbind('keydown.dialogue');
|
@@ -185,10 +185,10 @@ Spontaneous.Dialogue = (function($, S) {
|
|
185
185
|
outline.append(title);
|
186
186
|
outline.append(body);
|
187
187
|
outline.append(controls_wrap);
|
188
|
-
wrap.append(outline)
|
188
|
+
wrap.append(outline);
|
189
189
|
$('#content').append(wrap);
|
190
190
|
this._originalHeight = outline.outerHeight();
|
191
|
-
console.log('orig height', this._originalHeight)
|
191
|
+
console.log('orig height', this._originalHeight);
|
192
192
|
this._frame = outline;
|
193
193
|
this._actions = actions;
|
194
194
|
this._title = title;
|
@@ -200,7 +200,7 @@ Spontaneous.Dialogue = (function($, S) {
|
|
200
200
|
overlay: function() {
|
201
201
|
if (!this._overlay) {
|
202
202
|
var o = dom.div('#dialogue-overlay').css('z-index', this.z_index()).hide();
|
203
|
-
$('#content').append(o)
|
203
|
+
$('#content').append(o);
|
204
204
|
this._overlay = o;
|
205
205
|
}
|
206
206
|
return this._overlay;
|
data/application/js/dom.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
// console.log('Loading DOM...');
|
2
2
|
|
3
3
|
Spontaneous.Dom = (function($, S) {
|
4
|
-
var tags = 'div p iframe a span strong img select option label ul li dl dt dd table tr td h1 h2 h3 h4 header input button form textarea optgroup'.split(' ');
|
4
|
+
var tags = 'div p iframe a span strong i img select option label ul li dl dt dd table tr td h1 h2 h3 h4 header input button form textarea optgroup'.split(' ');
|
5
5
|
var Dom = {
|
6
6
|
body: function() {
|
7
7
|
return $(document.body);
|
@@ -13,19 +13,19 @@ Spontaneous.Dom = (function($, S) {
|
|
13
13
|
return dim + 'px';
|
14
14
|
},
|
15
15
|
cmd_key_label: function(text, key) {
|
16
|
-
var cmd = ((window.navigator.platform.indexOf(
|
16
|
+
var cmd = ((window.navigator.platform.indexOf('Mac') === 0) ? 'Cmd' : 'Ctrl');
|
17
17
|
// var alt = '<span class="key-combo">(' + cmd + "+"+key+')</span>';
|
18
|
-
return this.key_label(text, cmd
|
18
|
+
return this.key_label(text, cmd + '+' +key);
|
19
19
|
},
|
20
20
|
key_label: function(text, key) {
|
21
|
-
var alt =
|
22
|
-
return text +
|
21
|
+
var alt = '<span class="key-combo">('+key+')</span>';
|
22
|
+
return text + ' ' + alt;
|
23
23
|
},
|
24
24
|
parse_selector: function(selector) {
|
25
25
|
var p, id = '', classes = [], result = {};
|
26
26
|
selector = selector || '';
|
27
27
|
if (typeof selector === 'string') {
|
28
|
-
p = selector.split('.')
|
28
|
+
p = selector.split('.');
|
29
29
|
} else if ($.isArray(selector)) {
|
30
30
|
p = selector;
|
31
31
|
}
|
@@ -42,10 +42,10 @@ Spontaneous.Dom = (function($, S) {
|
|
42
42
|
}
|
43
43
|
}
|
44
44
|
if (id !== '') {
|
45
|
-
result
|
45
|
+
result.id = id;
|
46
46
|
}
|
47
47
|
if (classes.length > 0) {
|
48
|
-
result['class'] = classes.join(' ')
|
48
|
+
result['class'] = classes.join(' ');
|
49
49
|
}
|
50
50
|
return result;
|
51
51
|
},
|
@@ -56,7 +56,6 @@ Spontaneous.Dom = (function($, S) {
|
|
56
56
|
}
|
57
57
|
};
|
58
58
|
var generate = function(tag_name) {
|
59
|
-
var tag = '<'+tag_name+'/>';
|
60
59
|
return function(selector, params) {
|
61
60
|
if (typeof selector === 'object') {
|
62
61
|
if (!$.isArray(selector)) {
|
@@ -65,7 +64,7 @@ Spontaneous.Dom = (function($, S) {
|
|
65
64
|
}
|
66
65
|
}
|
67
66
|
var attrs = $.extend((params || {}), Dom.parse_selector(selector));
|
68
|
-
return $(
|
67
|
+
return $(document.createElement(tag_name)).attr(attrs);
|
69
68
|
};
|
70
69
|
};
|
71
70
|
for (var i = 0, ii = tags.length; i < ii; i++) {
|