pageflow-sitemap 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +25 -0
  3. data/.jshintrc +18 -0
  4. data/Gemfile +24 -0
  5. data/LICENSE.md +20 -0
  6. data/README.md +47 -0
  7. data/Rakefile +32 -0
  8. data/app/assets/images/pageflow/sitemap/.keep +0 -0
  9. data/app/assets/javascripts/pageflow/sitemap/.keep +0 -0
  10. data/app/assets/javascripts/pageflow/sitemap/editor/controllers/abstract_controller.js +68 -0
  11. data/app/assets/javascripts/pageflow/sitemap/editor/controllers/editor_mode_controller.js +301 -0
  12. data/app/assets/javascripts/pageflow/sitemap/editor/controllers/fragment_parser.js +31 -0
  13. data/app/assets/javascripts/pageflow/sitemap/editor/controllers/selection_mode_controller.js +37 -0
  14. data/app/assets/javascripts/pageflow/sitemap/editor/controllers/selection_navigator.js +43 -0
  15. data/app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js +43 -0
  16. data/app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/multi_drag.js +73 -0
  17. data/app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/scroll_and_zoom.js +286 -0
  18. data/app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/selection_rect.js +104 -0
  19. data/app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/tooltip_target.js +24 -0
  20. data/app/assets/javascripts/pageflow/sitemap/editor/d3/graph_view.js +277 -0
  21. data/app/assets/javascripts/pageflow/sitemap/editor/d3/layout/chapter_collision.js +33 -0
  22. data/app/assets/javascripts/pageflow/sitemap/editor/d3/layout/collision.js +116 -0
  23. data/app/assets/javascripts/pageflow/sitemap/editor/d3/layout/dragging_decorator.js +58 -0
  24. data/app/assets/javascripts/pageflow/sitemap/editor/d3/layout/grid.js +238 -0
  25. data/app/assets/javascripts/pageflow/sitemap/editor/d3/layout/link_dragging_decorator.js +42 -0
  26. data/app/assets/javascripts/pageflow/sitemap/editor/d3/layout.js +94 -0
  27. data/app/assets/javascripts/pageflow/sitemap/editor/d3/options.js +25 -0
  28. data/app/assets/javascripts/pageflow/sitemap/editor/d3/paths/follow_path.js +36 -0
  29. data/app/assets/javascripts/pageflow/sitemap/editor/d3/paths/linkpath.js +64 -0
  30. data/app/assets/javascripts/pageflow/sitemap/editor/d3/paths/successor_path.js +49 -0
  31. data/app/assets/javascripts/pageflow/sitemap/editor/d3/utils.js +33 -0
  32. data/app/assets/javascripts/pageflow/sitemap/editor/d3/view_model.js +202 -0
  33. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/add_button_view.js +28 -0
  34. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/chapter_placeholders_view.js +22 -0
  35. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/chapters_view.js +89 -0
  36. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/group_view.js +104 -0
  37. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/page_links_view.js +7 -0
  38. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/pages_view.js +112 -0
  39. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/selectable_links_view.js +104 -0
  40. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/storylines_view.js +86 -0
  41. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/successor_links_view.js +7 -0
  42. data/app/assets/javascripts/pageflow/sitemap/editor/d3/views/text_label_view.js +45 -0
  43. data/app/assets/javascripts/pageflow/sitemap/editor/d3.js +20 -0
  44. data/app/assets/javascripts/pageflow/sitemap/editor/feature.js +126 -0
  45. data/app/assets/javascripts/pageflow/sitemap/editor/models/selection.js +41 -0
  46. data/app/assets/javascripts/pageflow/sitemap/editor/templates/scroll_bar.jst.ejs +2 -0
  47. data/app/assets/javascripts/pageflow/sitemap/editor/templates/sitemap.jst.ejs +85 -0
  48. data/app/assets/javascripts/pageflow/sitemap/editor/views/scroll_bar_view.js +130 -0
  49. data/app/assets/javascripts/pageflow/sitemap/editor/views/scroll_pane_view.js +73 -0
  50. data/app/assets/javascripts/pageflow/sitemap/editor/views/sitemap_view.js +137 -0
  51. data/app/assets/javascripts/pageflow/sitemap/editor.js +14 -0
  52. data/app/assets/javascripts/pageflow/sitemap/feature.js +3 -0
  53. data/app/assets/javascripts/pageflow/sitemap/scroll_navigator.js +112 -0
  54. data/app/assets/javascripts/pageflow/sitemap.js +5 -0
  55. data/app/assets/stylesheets/pageflow/sitemap/.keep +0 -0
  56. data/app/assets/stylesheets/pageflow/sitemap/editor/add_button.scss +29 -0
  57. data/app/assets/stylesheets/pageflow/sitemap/editor/chapter_placeholders.scss +14 -0
  58. data/app/assets/stylesheets/pageflow/sitemap/editor/chapters.scss +62 -0
  59. data/app/assets/stylesheets/pageflow/sitemap/editor/page_links.scss +19 -0
  60. data/app/assets/stylesheets/pageflow/sitemap/editor/pages.scss +78 -0
  61. data/app/assets/stylesheets/pageflow/sitemap/editor/scroll_bar.css.scss +33 -0
  62. data/app/assets/stylesheets/pageflow/sitemap/editor/scroll_pane.scss +15 -0
  63. data/app/assets/stylesheets/pageflow/sitemap/editor/selectable_links.scss +88 -0
  64. data/app/assets/stylesheets/pageflow/sitemap/editor/selection_rect.scss +12 -0
  65. data/app/assets/stylesheets/pageflow/sitemap/editor/storylines.scss +59 -0
  66. data/app/assets/stylesheets/pageflow/sitemap/editor/successor_links.scss +42 -0
  67. data/app/assets/stylesheets/pageflow/sitemap/editor/text_label.scss +23 -0
  68. data/app/assets/stylesheets/pageflow/sitemap/editor/toolbar.css.scss +45 -0
  69. data/app/assets/stylesheets/pageflow/sitemap/editor.css.scss +96 -0
  70. data/config/locales/de.yml +16 -0
  71. data/config/locales/en.yml +48 -0
  72. data/config/locales/new/help_button.de.yml +7 -0
  73. data/config/locales/new/help_button.en.yml +7 -0
  74. data/config/locales/new/tooltips.de.yml +11 -0
  75. data/config/locales/new/tooltips.en.yml +11 -0
  76. data/config/routes.rb +7 -0
  77. data/config/spring.rb +1 -0
  78. data/exec/rails +12 -0
  79. data/exec/spring +18 -0
  80. data/exec/teaspoon +17 -0
  81. data/lib/pageflow/sitemap/engine.rb +10 -0
  82. data/lib/pageflow/sitemap/plugin.rb +11 -0
  83. data/lib/pageflow/sitemap/version.rb +5 -0
  84. data/lib/pageflow-sitemap.rb +9 -0
  85. data/pageflow-sitemap.gemspec +29 -0
  86. data/spec/d/r/.gitignore +16 -0
  87. data/spec/d/r/README.rdoc +28 -0
  88. data/spec/d/r/Rakefile +6 -0
  89. data/spec/d/r/app/admin/dashboard.rb +33 -0
  90. data/spec/d/r/app/assets/images/.keep +0 -0
  91. data/spec/d/r/app/assets/javascripts/active_admin.js.coffee +2 -0
  92. data/spec/d/r/app/assets/javascripts/application.js +16 -0
  93. data/spec/d/r/app/assets/javascripts/pageflow/application.js +1 -0
  94. data/spec/d/r/app/assets/javascripts/pageflow/editor.js +4 -0
  95. data/spec/d/r/app/assets/stylesheets/active_admin.css.scss +18 -0
  96. data/spec/d/r/app/assets/stylesheets/application.css +13 -0
  97. data/spec/d/r/app/assets/stylesheets/pageflow/application.css.scss +1 -0
  98. data/spec/d/r/app/assets/stylesheets/pageflow/editor.css.scss +1 -0
  99. data/spec/d/r/app/controllers/application_controller.rb +5 -0
  100. data/spec/d/r/app/controllers/concerns/.keep +0 -0
  101. data/spec/d/r/app/helpers/application_helper.rb +2 -0
  102. data/spec/d/r/app/mailers/.keep +0 -0
  103. data/spec/d/r/app/models/.keep +0 -0
  104. data/spec/d/r/app/models/ability.rb +12 -0
  105. data/spec/d/r/app/models/concerns/.keep +0 -0
  106. data/spec/d/r/app/models/user.rb +9 -0
  107. data/spec/d/r/app/views/layouts/application.html.erb +14 -0
  108. data/spec/d/r/bin/bundle +3 -0
  109. data/spec/d/r/bin/rails +4 -0
  110. data/spec/d/r/bin/rake +4 -0
  111. data/spec/d/r/config/application.rb +31 -0
  112. data/spec/d/r/config/boot.rb +4 -0
  113. data/spec/d/r/config/database.yml +39 -0
  114. data/spec/d/r/config/environment.rb +5 -0
  115. data/spec/d/r/config/environments/development.rb +29 -0
  116. data/spec/d/r/config/environments/production.rb +80 -0
  117. data/spec/d/r/config/environments/test.rb +37 -0
  118. data/spec/d/r/config/initializers/active_admin.rb +225 -0
  119. data/spec/d/r/config/initializers/backtrace_silencers.rb +7 -0
  120. data/spec/d/r/config/initializers/devise.rb +252 -0
  121. data/spec/d/r/config/initializers/devise_async.rb +6 -0
  122. data/spec/d/r/config/initializers/filter_parameter_logging.rb +4 -0
  123. data/spec/d/r/config/initializers/friendly_id.rb +88 -0
  124. data/spec/d/r/config/initializers/inflections.rb +16 -0
  125. data/spec/d/r/config/initializers/mime_types.rb +5 -0
  126. data/spec/d/r/config/initializers/pageflow.rb +76 -0
  127. data/spec/d/r/config/initializers/resque.rb +4 -0
  128. data/spec/d/r/config/initializers/resque_enqueue_after_commit_patch.rb +25 -0
  129. data/spec/d/r/config/initializers/resque_logger.rb +16 -0
  130. data/spec/d/r/config/initializers/resque_mailer.rb +4 -0
  131. data/spec/d/r/config/initializers/secret_token.rb +12 -0
  132. data/spec/d/r/config/initializers/session_store.rb +3 -0
  133. data/spec/d/r/config/initializers/wrap_parameters.rb +14 -0
  134. data/spec/d/r/config/locales/devise.en.yml +59 -0
  135. data/spec/d/r/config/locales/en.yml +23 -0
  136. data/spec/d/r/config/routes.rb +59 -0
  137. data/spec/d/r/config.ru +4 -0
  138. data/spec/d/r/db/migrate/00000000000000_create_test_hosted_file.rb +7 -0
  139. data/spec/d/r/db/migrate/00000000000001_create_test_revision_component.rb +10 -0
  140. data/spec/d/r/db/migrate/20150209101518_create_active_admin_comments.rb +19 -0
  141. data/spec/d/r/db/migrate/20150209101524_devise_create_users.rb +46 -0
  142. data/spec/d/r/db/migrate/20150209101530_create_friendly_id_slugs.rb +15 -0
  143. data/spec/d/r/db/migrate/20150209101540_setup_schema.pageflow.rb +208 -0
  144. data/spec/d/r/db/migrate/20150209101541_add_attributes_to_users.pageflow.rb +16 -0
  145. data/spec/d/r/db/migrate/20150209101542_create_themings.pageflow.rb +16 -0
  146. data/spec/d/r/db/migrate/20150209101543_create_themings_for_existing_accounts.pageflow.rb +27 -0
  147. data/spec/d/r/db/migrate/20150209101544_change_theme_references_to_theming_references.pageflow.rb +46 -0
  148. data/spec/d/r/db/migrate/20150209101545_remove_attributes_from_themes.pageflow.rb +11 -0
  149. data/spec/d/r/db/migrate/20150209101546_create_accounts_themes_join_table.pageflow.rb +9 -0
  150. data/spec/d/r/db/migrate/20150209101547_move_cname_from_account_to_theming.pageflow.rb +22 -0
  151. data/spec/d/r/db/migrate/20150209101548_drop_themes.pageflow.rb +15 -0
  152. data/spec/d/r/db/migrate/20150209101549_add_confirmed_by_to_encoded_files.pageflow.rb +7 -0
  153. data/spec/d/r/db/migrate/20150209101550_add_home_url_attributes_to_themings_and_revisions.pageflow.rb +10 -0
  154. data/spec/d/r/db/migrate/20150209101551_create_widgets.pageflow.rb +12 -0
  155. data/spec/d/r/db/migrate/20150209101552_add_emphasize_chapter_beginning_to_revisions.pageflow.rb +6 -0
  156. data/spec/d/r/db/migrate/20150209101553_add_emphasize_new_pages_to_revisions.pageflow.rb +6 -0
  157. data/spec/d/r/db/migrate/20150209101554_add_sharing_image_to_revisions.pageflow.rb +8 -0
  158. data/spec/d/r/db/schema.rb +316 -0
  159. data/spec/d/r/db/seeds.rb +30 -0
  160. data/spec/d/r/lib/assets/.keep +0 -0
  161. data/spec/d/r/lib/tasks/.keep +0 -0
  162. data/spec/d/r/lib/tasks/resque.rake +7 -0
  163. data/spec/d/r/public/404.html +58 -0
  164. data/spec/d/r/public/422.html +58 -0
  165. data/spec/d/r/public/500.html +57 -0
  166. data/spec/d/r/public/favicon.ico +0 -0
  167. data/spec/d/r/public/javascripts/translations.js +2 -0
  168. data/spec/d/r/public/robots.txt +5 -0
  169. data/spec/d/r/vendor/assets/javascripts/.keep +0 -0
  170. data/spec/d/r/vendor/assets/stylesheets/.keep +0 -0
  171. data/spec/javascripts/.jshintrc +26 -0
  172. data/spec/javascripts/pageflow/sitemap/editor/controllers/selection_navigator_spec.js +52 -0
  173. data/spec/javascripts/pageflow/sitemap/editor/d3/layout/collision_spec.js +99 -0
  174. data/spec/javascripts/pageflow/sitemap/editor/d3/layout/dragging_decorator_spec.js +114 -0
  175. data/spec/javascripts/pageflow/sitemap/editor/d3/layout/grid_spec.js +183 -0
  176. data/spec/javascripts/pageflow/sitemap/editor/d3/layout_spec.js +31 -0
  177. data/spec/javascripts/pageflow/sitemap/editor/d3/view_model_spec.js +56 -0
  178. data/spec/javascripts/pageflow/sitemap/editor/models/selection_spec.js +62 -0
  179. data/spec/javascripts/pageflow/sitemap/scroll_navigator_spec.js +5 -0
  180. data/spec/javascripts/spec_helper.js +13 -0
  181. data/spec/javascripts/support/factories.js +81 -0
  182. data/spec/teaspoon_env.rb +182 -0
  183. data/vendor/assets/javascripts/d3.v3.js +9215 -0
  184. metadata +379 -0
@@ -0,0 +1,137 @@
1
+ sitemap.SitemapView = Backbone.Marionette.ItemView.extend({
2
+ className: 'container sitemap',
3
+ template: 'pageflow/sitemap/editor/templates/sitemap',
4
+
5
+ ui: {
6
+ scrollBarX: '.scroll_bar_x',
7
+ scrollBarY: '.scroll_bar_y',
8
+ scaleSlider: '.scale_slider',
9
+ toolbarItems: '.toolbar .items',
10
+ closeButton: '.close.button',
11
+ header: 'h2'
12
+ },
13
+
14
+ events: {
15
+ 'click .close.button': function() {
16
+ this.trigger('closed');
17
+ this.close();
18
+ },
19
+
20
+ 'click .help_button': function() {
21
+ pageflow.app.trigger('toggle-help', 'pageflow.sitemap.help_entries.main');
22
+ return false;
23
+ },
24
+
25
+ 'click .toolbar .items': function(event) {
26
+ _(this.options.toolbarItems).each(function(item) {
27
+ if (item.name === $(event.target).data('name')) {
28
+ item.click();
29
+ }
30
+ });
31
+ },
32
+
33
+ 'requesttooltip': function(event, options) {
34
+ this.tooltip.show(I18n.t(options.translationKey), options.position);
35
+ },
36
+
37
+ 'resettooltip': function(event) {
38
+ this.tooltip.hide();
39
+ },
40
+
41
+ 'mousewheel': function(event) {
42
+ event.preventDefault();
43
+ }
44
+ },
45
+
46
+ initialize: function() {
47
+ this.listenTo(this, 'close', function() {
48
+ this.graphView.on('change.scaleSlider', null);
49
+ this.options.controller.dispose();
50
+
51
+ sitemap.SitemapView.lastViewport = this.graphView.getViewport();
52
+ });
53
+
54
+ this.listenTo(this.options.controller, 'showPage', function(page) {
55
+ this.close();
56
+ });
57
+
58
+ this.listenTo(this.options.controller, 'showStoryline', function(storyline) {
59
+ pageflow.editor.navigate('?storyline=' + storyline.id, {trigger: true});
60
+ this.close();
61
+ });
62
+ },
63
+
64
+ onRender: function() {
65
+ this.$el.addClass(this.options.controller.name);
66
+
67
+ this.appendSubview(this.tooltip = new pageflow.TooltipView());
68
+ this.graphView = new sitemap.GraphView(this.$el.find('svg')[0], this.options.controller, {
69
+ defaultViewport: sitemap.SitemapView.lastViewport
70
+ });
71
+
72
+
73
+ this.listenTo(pageflow.app, 'resize', this.graphView.resize);
74
+
75
+ this.setupHeader();
76
+ this.setupScrollBars();
77
+ this.setupScrollPane();
78
+ this.setupScaleSlider();
79
+ this.setupToolbar();
80
+ },
81
+
82
+ onShow: function() {
83
+ this.graphView.resize();
84
+ },
85
+
86
+ setupHeader: function() {
87
+ this.ui.closeButton.text(I18n.t('pageflow.sitemap.editor.templates.sitemap.' + (this.options.cancelButton ? 'cancel' : 'close')));
88
+ this.ui.header.text(this.options.headerText);
89
+ },
90
+
91
+ setupScrollBars: function() {
92
+ this.subview(new sitemap.ScrollBarView({
93
+ el: this.ui.scrollBarX,
94
+ graphView: this.graphView
95
+ }));
96
+
97
+ this.subview(new sitemap.ScrollBarView({
98
+ el: this.ui.scrollBarY,
99
+ graphView: this.graphView,
100
+ orientation: 'vertical'
101
+ }));
102
+ },
103
+
104
+ setupScrollPane: function() {
105
+ this.appendSubview(new sitemap.ScrollPaneView({
106
+ graphView: this.graphView
107
+ }));
108
+ },
109
+
110
+ setupScaleSlider: function() {
111
+ var view = this;
112
+
113
+ this.ui.scaleSlider.slider({
114
+ slide: function(event, ui) {
115
+ view.graphView.setScale(ui.value);
116
+ }
117
+ });
118
+
119
+ this.graphView.on('change.scaleSlider', function() {
120
+ view.ui.scaleSlider.slider('value', view.graphView.getScale());
121
+ });
122
+ },
123
+
124
+ setupToolbar: function() {
125
+ var view = this;
126
+
127
+ _(this.options.toolbarItems).each(function(item) {
128
+ var link = $('<a />');
129
+
130
+ link.text(I18n.t('pageflow.sitemap.editor.toolbar_items.' + item.name));
131
+ link.addClass(item.name);
132
+ link.data('name', item.name);
133
+
134
+ view.ui.toolbarItems.append(link);
135
+ });
136
+ }
137
+ });
@@ -0,0 +1,14 @@
1
+ //= require_self
2
+
3
+ //= require d3.v3.js
4
+ //
5
+ //= require_tree ./editor/models
6
+ //= require ./editor/controllers/abstract_controller.js
7
+ //= require_tree ./editor/controllers
8
+ //= require_tree ./editor/templates
9
+ //= require ./editor/d3.js
10
+ //= require_tree ./editor/views
11
+ //= require ./editor/feature.js
12
+
13
+ pageflow.sitemap = pageflow.sitemap || {};
14
+ window.sitemap = window.sitemap || pageflow.sitemap;
@@ -0,0 +1,3 @@
1
+ pageflow.features.register('slideshow', 'sitemap', function() {
2
+ // pageflow.slides.scrollNavigator = new pageflow.sitemap.ScrollNavigator();
3
+ });
@@ -0,0 +1,112 @@
1
+ pageflow.sitemap.ScrollNavigator = function() {
2
+ function goToConfiguredSuccessor(currentPage) {
3
+ var configuration = currentPage.page('getConfiguration');
4
+
5
+ if('scroll_successor_id' in configuration) {
6
+ return pageflow.slides.goToByPermaId(configuration.scroll_successor_id);
7
+ }
8
+
9
+ return false;
10
+ }
11
+
12
+ function hasConfiguredSuccessor(currentPage, pages) {
13
+ return !!configuredSuccessor(currentPage, pages).length;
14
+ }
15
+
16
+ function configuredSuccessor(currentPage, pages) {
17
+ var configuration = currentPage.page('getConfiguration');
18
+
19
+ if ('scroll_successor_id' in configuration) {
20
+ return pages.filter('#' + configuration.scroll_successor_id);
21
+ }
22
+
23
+ return $();
24
+ }
25
+
26
+ function goToPreviousPageInStoryline(currentPage) {
27
+ return goToPageInStoryline(currentPage, currentPage.prev('.page'), {position: 'bottom'});
28
+ }
29
+
30
+ function goToNextPageInStoryline(currentPage) {
31
+ return goToPageInStoryline(currentPage, currentPage.next('.page'));
32
+ }
33
+
34
+ function nextPageInStoryline(currentPage) {
35
+ var page = currentPage.next('.page');
36
+
37
+ if (sameStoryline(currentPage, page)) {
38
+ return page;
39
+ }
40
+
41
+ return $();
42
+ }
43
+
44
+ function goToPageInStoryline(currentPage, targetPage, options) {
45
+ if (sameStoryline(currentPage, targetPage)) {
46
+ pageflow.slides.goTo(targetPage, options);
47
+ return true;
48
+ }
49
+
50
+ return false;
51
+ }
52
+
53
+ function goToPreviouslyVisitedPage() {
54
+ return pageflow.history.back();
55
+ }
56
+
57
+ function sameStoryline(page1, page2) {
58
+ return pageflow.entryData.getStorylineIdByPagePermaId(page1.page('getPermaId')) ==
59
+ pageflow.entryData.getStorylineIdByPagePermaId(page2.page('getPermaId'));
60
+ }
61
+
62
+ this.getLandingPage = function(pages) {
63
+ var result = pages.first();
64
+
65
+ pages.each(function() {
66
+ var page = $(this);
67
+ var configuration = page.page('getConfiguration');
68
+
69
+ if (configuration.start_page) {
70
+ result = page;
71
+ }
72
+ });
73
+
74
+ return result;
75
+ };
76
+
77
+ this.back = function(currentPage) {
78
+ return goToPreviousPageInStoryline(currentPage);
79
+ };
80
+
81
+ this.next = function(currentPage) {
82
+ return goToNextPageInStoryline(currentPage) ||
83
+ goToConfiguredSuccessor(currentPage);
84
+ };
85
+
86
+ this.nextPageExists = function(currentPage, pages) {
87
+ return sameStoryline(currentPage, currentPage.next('.page')) ||
88
+ hasConfiguredSuccessor(currentPage, pages);
89
+ };
90
+
91
+ this.previousPageExists = function(currentPage, pages) {
92
+ return sameStoryline(currentPage, currentPage.prev('.page'));
93
+ };
94
+
95
+ this.getNextPage = function(currentPage, pages) {
96
+ return nextPageInStoryline(currentPage) ||
97
+ configuredSuccessor(currentPage, pages);
98
+ };
99
+
100
+ this.getTransitionDirection = function(previousPage, currentPage, options) {
101
+ var direction;
102
+
103
+ if (sameStoryline(previousPage, currentPage)) {
104
+ direction = (currentPage.index() > previousPage.index() ? 'forwards' : 'backwards');
105
+ }
106
+ else {
107
+ direction = options.back ? 'backwards' : 'forwards';
108
+ }
109
+
110
+ return direction;
111
+ };
112
+ };
@@ -0,0 +1,5 @@
1
+ //= require_self
2
+ //= require ./sitemap/scroll_navigator.js
3
+ //= require ./sitemap/feature.js
4
+
5
+ pageflow.sitemap = pageflow.sitemap || {};
File without changes
@@ -0,0 +1,29 @@
1
+ .add_button {
2
+
3
+ text {
4
+ -visibility: hidden;
5
+ opacity: 0;
6
+ @include transition(opacity 0.1s ease);
7
+ pointer-events: none;
8
+ font-family: 'entypo';
9
+ font-size: 20px;
10
+ fill: #000;
11
+ text-anchor: middle;
12
+ dominant-baseline: central;
13
+ }
14
+
15
+ rect {
16
+ cursor: pointer;
17
+ fill: transparent;
18
+ }
19
+
20
+ &.hover {
21
+ text {
22
+ opacity: 0.5;
23
+ }
24
+ }
25
+ }
26
+
27
+ &.selection_mode .add_button {
28
+ display: none;
29
+ }
@@ -0,0 +1,14 @@
1
+ .chapter_placeholder {
2
+ rect {
3
+ fill: rgba(0, 0, 0, 0.5);
4
+ }
5
+
6
+ text {
7
+ pointer-events: none;
8
+ font-family: 'entypo';
9
+ font-size: 20px;
10
+ fill: #000;
11
+ text-anchor: middle;
12
+ dominant-baseline: central;
13
+ }
14
+ }
@@ -0,0 +1,62 @@
1
+ .chapter {
2
+ .handle {
3
+ fill: #eee;
4
+ }
5
+
6
+ .border {
7
+ fill: #fff;
8
+ stroke: none;
9
+ }
10
+
11
+ .title_text {
12
+ color: #000;
13
+ font: $font;
14
+ font-size: 12px;
15
+ font-weight: bold;
16
+ pointer-events: none;
17
+ padding-top: 3px;
18
+ padding-left: 5px;
19
+ }
20
+
21
+ &.destroying {
22
+ opacity: 0.5;
23
+ }
24
+ }
25
+
26
+ &.editor_mode .chapter {
27
+ .handle {
28
+ cursor: pointer;
29
+ }
30
+
31
+ &.dragged,
32
+ &.hover {
33
+ .handle {
34
+ fill: $highlight-color;
35
+ }
36
+
37
+ .border {
38
+ fill: #f9f9f9;
39
+ }
40
+ }
41
+
42
+ &.selected {
43
+ .handle {
44
+ fill: #5AA5F9;
45
+ cursor: move;
46
+ }
47
+
48
+ .border {
49
+ fill: #D2E5FA;
50
+ }
51
+
52
+ .title_text {
53
+ color: #fff;
54
+ }
55
+ }
56
+
57
+ &.empty {
58
+ .add_page {
59
+ visibility: visible;
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,19 @@
1
+ .page_link {
2
+ .arrow {
3
+ stroke: $page-link-color;
4
+ }
5
+
6
+ &.placeholder {
7
+ .drag_target {
8
+ transform: translateX(-5px);
9
+ }
10
+ }
11
+ }
12
+
13
+ #page_link_triangle {
14
+ fill: $page-link-color;
15
+ }
16
+
17
+ #page_link_triangle_highlight {
18
+ fill: $highlight-color;
19
+ }
@@ -0,0 +1,78 @@
1
+ .page {
2
+ .bg {
3
+ cursor: pointer;
4
+ fill: #444;
5
+ stroke: #444;
6
+ stroke-width: $stroke-width;
7
+ font: $font;
8
+ }
9
+
10
+ .border {
11
+ fill: transparent;
12
+ strole: none;
13
+ pointer-events: none;
14
+ stroke-width: 4px;
15
+ }
16
+
17
+ .title {
18
+ fill: #000;
19
+ opacity: 0.5;
20
+ pointer-events: none;
21
+ }
22
+
23
+ .start_page_indicator {
24
+ display: none;
25
+ }
26
+
27
+ &.start_page .start_page_indicator {
28
+ display: block;
29
+ }
30
+
31
+ &.highlighted .border {
32
+ stroke: #5AA5F9;
33
+ }
34
+
35
+ &.disabled,
36
+ &.destroying {
37
+ opacity: 0.5;
38
+ }
39
+
40
+ .title_text {
41
+ color: #fff;
42
+ font: 13px sans-serif;
43
+ font-weight: bold;
44
+ pointer-events: none;
45
+ padding: 15px 5px;
46
+ }
47
+
48
+ image {
49
+ pointer-events: none;
50
+ }
51
+ }
52
+
53
+ &.editor_mode .page {
54
+ &.hover .border {
55
+ stroke: $highlight-color;
56
+ }
57
+
58
+ &.selected {
59
+ .border {
60
+ stroke: #5AA5F9;
61
+ }
62
+
63
+ .bg {
64
+ cursor: move;
65
+ }
66
+ }
67
+ }
68
+
69
+ &.selection_mode .page {
70
+ &.hover .border {
71
+ stroke: $selection-color;
72
+ }
73
+
74
+ &.highlighted,
75
+ &.disabled {
76
+ pointer-events: none;
77
+ }
78
+ }
@@ -0,0 +1,33 @@
1
+ .scroll_bar {
2
+ .ui-slider {
3
+ border: none;
4
+ position: absolute;
5
+ width: 100%;
6
+ height: 100%;
7
+ }
8
+
9
+ .ui-slider-handle {
10
+ background: #bbb;
11
+ border: solid 1px #888;
12
+ border-radius: 0;
13
+ cursor: move;
14
+
15
+ &:hover {
16
+ background: #aaa;
17
+ }
18
+ }
19
+
20
+ .ui-slider-horizontal .ui-slider-handle {
21
+ height: 11px;
22
+ top: 0;
23
+ }
24
+
25
+ .ui-slider-vertical .ui-slider-handle {
26
+ width: 11px;
27
+ left: 0;
28
+ }
29
+
30
+ .ui-handle-helper-parent {
31
+ position: relative;
32
+ }
33
+ }
@@ -0,0 +1,15 @@
1
+ .scroll_pane {
2
+ display: none;
3
+ z-index: 10001;
4
+ cursor: move;
5
+
6
+ position: absolute;
7
+ top: 35px;
8
+ left: 1px;
9
+ right: 15px;
10
+ bottom: 15px;
11
+
12
+ &.active {
13
+ display: block;
14
+ }
15
+ }
@@ -0,0 +1,88 @@
1
+ .selectable_link {
2
+ .arrow {
3
+ fill: none;
4
+ stroke-width: $stroke-width;
5
+ pointer-events: none;
6
+ }
7
+
8
+ &.placeholder {
9
+ .arrow {
10
+ display: none;
11
+ }
12
+ }
13
+
14
+ .selection_highlight {
15
+ fill: none;
16
+ stroke: transparent;
17
+ stroke-width: 4px;
18
+ pointer-events: none;
19
+ }
20
+
21
+ .selection_target {
22
+ fill: none;
23
+ stroke: transparent;
24
+ stroke-width: 10px;
25
+ pointer-events: stroke;
26
+ }
27
+
28
+ .drag_target {
29
+ display: none;
30
+ fill: none;
31
+ cursor: move;
32
+ pointer-events: all;
33
+ }
34
+
35
+ &.placeholder {
36
+ .drag_target {
37
+ display: block;
38
+ fill: rgba(0, 0, 0, 0.4);
39
+ }
40
+ }
41
+
42
+ .text_label {
43
+ opacity: 0;
44
+ @include transition(opacity 0.3s ease);
45
+ }
46
+
47
+ &.highlight {
48
+ .text_label {
49
+ opacity: 1;
50
+ }
51
+ }
52
+ }
53
+
54
+ &.editor_mode .selectable_link {
55
+ &.dragged {
56
+ .arrow {
57
+ display: block;
58
+ }
59
+ }
60
+
61
+ &.dragged,
62
+ &.highlight {
63
+ .arrow {
64
+ stroke: $highlight-color;
65
+ stroke-width: 2px;
66
+ }
67
+ }
68
+
69
+ &.dragged {
70
+ .drag_target {
71
+ fill: none;
72
+ }
73
+ }
74
+
75
+ &.selected .selection_highlight {
76
+ stroke: $selection-color;
77
+ }
78
+
79
+ &.dragged .selection_highlight {
80
+ stroke: transparent;
81
+ }
82
+ }
83
+
84
+ &.selection_mode .selectable_link {
85
+ .drag_target {
86
+ display: none;
87
+ }
88
+ }
@@ -0,0 +1,12 @@
1
+ rect.selection {
2
+ fill: none;
3
+ stroke: #aaa;
4
+ stroke-width: 2px;
5
+ shape-rendering: crispEdges;
6
+ cursor: default;
7
+ vector-effect: non-scaling-stroke;
8
+ }
9
+
10
+ &.selection_mode rect.selection {
11
+ display: none;
12
+ }
@@ -0,0 +1,59 @@
1
+ .storyline {
2
+ .handle {
3
+ fill: #ccc;
4
+ }
5
+
6
+ text {
7
+ fill: #444;
8
+ font: $font;
9
+ font-size: 12px;
10
+ font-weight: bold;
11
+ pointer-events: none;
12
+ padding-top: 3px;
13
+ padding-left: 5px;
14
+ }
15
+
16
+ .border {
17
+ fill: #ddd;
18
+ }
19
+
20
+ &.main {
21
+ > .handle {
22
+ fill: #444;
23
+ }
24
+
25
+ > text {
26
+ fill: #fff;
27
+ }
28
+ }
29
+ }
30
+
31
+ &.editor_mode .storyline {
32
+ &.hover {
33
+ .handle {
34
+ fill: $highlight-color;
35
+ }
36
+ }
37
+ }
38
+
39
+ &.editor_mode .storyline {
40
+ .handle {
41
+ cursor: pointer;
42
+ }
43
+ }
44
+
45
+ &.editor_mode .storyline.selected,
46
+ &.selection_mode .storyline.highlighted {
47
+ > .handle {
48
+ fill: #5AA5F9;
49
+ cursor: move;
50
+ }
51
+
52
+ > text {
53
+ fill: #fff;
54
+ }
55
+
56
+ > .border {
57
+ fill: #D2E5FA;
58
+ }
59
+ }