pageflow-outline-navigation-bar 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.jshintrc +13 -0
  4. data/.rubocop.yml +24 -0
  5. data/.rubocop_hound.yml +1065 -0
  6. data/.scss-lint.yml +145 -0
  7. data/CHANGELOG.md +7 -0
  8. data/Gemfile +4 -0
  9. data/README.md +42 -0
  10. data/Rakefile +10 -0
  11. data/app/assets/images/pageflow/outline_navigation_bar/indicator.png +0 -0
  12. data/app/assets/images/pageflow/outline_navigation_bar/volume_control_sprite.png +0 -0
  13. data/app/assets/javascript/pageflow/outline_navigation_bar.js +26 -0
  14. data/app/assets/javascript/pageflow/outline_navigation_bar/events.js +30 -0
  15. data/app/assets/javascript/pageflow/outline_navigation_bar/expander.js +34 -0
  16. data/app/assets/javascript/pageflow/outline_navigation_bar/fullscreen_button.js +24 -0
  17. data/app/assets/javascript/pageflow/outline_navigation_bar/hide_text_button.js +17 -0
  18. data/app/assets/javascript/pageflow/outline_navigation_bar/menu_item.js +41 -0
  19. data/app/assets/javascript/pageflow/outline_navigation_bar/navigator.js +35 -0
  20. data/app/assets/javascript/pageflow/outline_navigation_bar/panels.js +54 -0
  21. data/app/assets/javascript/pageflow/outline_navigation_bar/resizer.js +32 -0
  22. data/app/assets/javascript/pageflow/outline_navigation_bar/scroller.js +144 -0
  23. data/app/assets/javascript/pageflow/outline_navigation_bar/widget.js +227 -0
  24. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default.scss +87 -0
  25. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/credits_box.scss +28 -0
  26. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/cross_dependant_styles.css.scss +6 -0
  27. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/icons/icon_font.scss +177 -0
  28. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/icons/sprite.scss +140 -0
  29. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/menu_item.scss +107 -0
  30. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/menu_items.scss +33 -0
  31. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/mixins.scss +5 -0
  32. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/mobile_images.scss +54 -0
  33. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/mobile_panel.scss +61 -0
  34. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/mobile_sharing.scss +57 -0
  35. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/panel.scss +19 -0
  36. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/parent_page_button.scss +46 -0
  37. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/prevent_focus_rect_on_pointer_down.scss +4 -0
  38. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/scroller.scss +93 -0
  39. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/share_box.scss +20 -0
  40. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/toggle.scss +73 -0
  41. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/volume_box.scss +48 -0
  42. data/app/assets/stylesheets/pageflow/outline_navigation_bar/themes/default/widget_margin.scss +27 -0
  43. data/app/views/pageflow/outline_navigation_bar/_widget.html.erb +12 -0
  44. data/app/views/pageflow/outline_navigation_bar/widget/_buttons.html.erb +71 -0
  45. data/app/views/pageflow/outline_navigation_bar/widget/_chapter.html.erb +5 -0
  46. data/app/views/pageflow/outline_navigation_bar/widget/_home_button.html.erb +8 -0
  47. data/app/views/pageflow/outline_navigation_bar/widget/_link.html.erb +3 -0
  48. data/app/views/pageflow/outline_navigation_bar/widget/_mobile_panels.html.erb +28 -0
  49. data/app/views/pageflow/outline_navigation_bar/widget/_overview_button.html.erb +8 -0
  50. data/app/views/pageflow/outline_navigation_bar/widget/_scroller.html.erb +13 -0
  51. data/app/views/pageflow/outline_navigation_bar/widget/_toggles.html.erb +32 -0
  52. data/config/locales/de.yml +8 -0
  53. data/config/locales/en.yml +8 -0
  54. data/lib/pageflow-outline-navigation-bar.rb +17 -0
  55. data/lib/pageflow/outline_navigation_bar/engine.rb +9 -0
  56. data/lib/pageflow/outline_navigation_bar/expandable_widget_type.rb +17 -0
  57. data/lib/pageflow/outline_navigation_bar/fixed_widget_type.rb +17 -0
  58. data/lib/pageflow/outline_navigation_bar/plugin.rb +12 -0
  59. data/lib/pageflow/outline_navigation_bar/version.rb +5 -0
  60. data/lib/pageflow/outline_navigation_bar/widget_type.rb +14 -0
  61. data/pageflow-outline-navigation-bar.gemspec +26 -0
  62. metadata +160 -0
data/.scss-lint.yml ADDED
@@ -0,0 +1,145 @@
1
+ scss_files: "**/*.scss"
2
+ linters:
3
+ BangFormat:
4
+ enabled: true
5
+ space_before_bang: true
6
+ space_after_bang: false
7
+ BorderZero:
8
+ enabled: false
9
+ convention: zero
10
+ ColorKeyword:
11
+ enabled: true
12
+ severity: warning
13
+ ColorVariable:
14
+ enabled: true
15
+ Comment:
16
+ enabled: true
17
+ DebugStatement:
18
+ enabled: true
19
+ DeclarationOrder:
20
+ enabled: false
21
+ DuplicateProperty:
22
+ enabled: true
23
+ ElsePlacement:
24
+ enabled: true
25
+ style: same_line
26
+ EmptyLineBetweenBlocks:
27
+ enabled: true
28
+ ignore_single_line_blocks: true
29
+ EmptyRule:
30
+ enabled: true
31
+ FinalNewline:
32
+ enabled: true
33
+ present: true
34
+ HexLength:
35
+ enabled: false
36
+ style: short
37
+ HexNotation:
38
+ enabled: true
39
+ style: lowercase
40
+ HexValidation:
41
+ enabled: true
42
+ IdSelector:
43
+ enabled: true
44
+ ImportantRule:
45
+ enabled: true
46
+ ImportPath:
47
+ enabled: true
48
+ leading_underscore: false
49
+ filename_extension: false
50
+ Indentation:
51
+ enabled: true
52
+ allow_non_nested_indentation: false
53
+ character: space
54
+ width: 2
55
+ LeadingZero:
56
+ enabled: true
57
+ style: include_zero
58
+ MergeableSelector:
59
+ enabled: true
60
+ force_nesting: true
61
+ NameFormat:
62
+ enabled: true
63
+ allow_leading_underscore: true
64
+ convention: hyphenated_lowercase
65
+ NestingDepth:
66
+ enabled: true
67
+ max_depth: 4
68
+ severity: warning
69
+ PlaceholderInExtend:
70
+ enabled: false
71
+ PropertyCount:
72
+ enabled: true
73
+ include_nested: false
74
+ max_properties: 10
75
+ PropertySortOrder:
76
+ enabled: false
77
+ ignore_unspecified: false
78
+ severity: warning
79
+ separate_groups: false
80
+ PropertySpelling:
81
+ enabled: true
82
+ extra_properties: []
83
+ QualifyingElement:
84
+ enabled: false
85
+ allow_element_with_attribute: false
86
+ allow_element_with_class: false
87
+ allow_element_with_id: false
88
+ severity: warning
89
+ SelectorDepth:
90
+ enabled: true
91
+ max_depth: 3
92
+ severity: warning
93
+ SelectorFormat:
94
+ enabled: true
95
+ convention: snake_case
96
+ Shorthand:
97
+ enabled: false
98
+ severity: warning
99
+ SingleLinePerProperty:
100
+ enabled: true
101
+ allow_single_line_rule_sets: true
102
+ SingleLinePerSelector:
103
+ enabled: true
104
+ SpaceAfterComma:
105
+ enabled: true
106
+ SpaceAfterPropertyColon:
107
+ enabled: true
108
+ style: one_space
109
+ SpaceAfterPropertyName:
110
+ enabled: true
111
+ SpaceBeforeBrace:
112
+ enabled: true
113
+ style: space
114
+ allow_single_line_padding: false
115
+ SpaceBetweenParens:
116
+ enabled: true
117
+ spaces: 0
118
+ StringQuotes:
119
+ enabled: true
120
+ style: double_quotes
121
+ TrailingSemicolon:
122
+ enabled: true
123
+ TrailingZero:
124
+ enabled: false
125
+ UnnecessaryMantissa:
126
+ enabled: true
127
+ UnnecessaryParentReference:
128
+ enabled: true
129
+ UrlFormat:
130
+ enabled: true
131
+ UrlQuotes:
132
+ enabled: true
133
+ VariableForProperty:
134
+ enabled: false
135
+ properties: []
136
+ VendorPrefixes:
137
+ enabled: true
138
+ identifier_list: bourbon
139
+ include: []
140
+ exclude: []
141
+ ZeroUnit:
142
+ enabled: true
143
+ severity: warning
144
+ Compass::PropertyWithMixin:
145
+ enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # CHANGELOG
2
+
3
+ ### Version 0.1.0
4
+
5
+ 2016-09-09
6
+
7
+ Initial release.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in chart.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Pageflow Outline Navigation Bar
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/pageflow-outline-navigation-bar.svg)](http://badge.fury.io/rb/pageflow-outline-navigation-bar)
4
+
5
+ A navigation bar displaying chapter titles.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's `Gemfile`:
10
+
11
+ gem 'pageflow-outline-navigation-bar'
12
+
13
+ Register the plugin inside the configure block in `config/initializers/pageflow.rb`
14
+
15
+ Pageflow.configure do |config|
16
+ config.plugin(Pageflow::OutlineNavigationBar.plugin)
17
+ end
18
+
19
+ Include javascripts and stylesheets:
20
+
21
+ # app/assets/javascripts/pageflow/application.js
22
+ //= require pageflow/outline_navigation_bar
23
+
24
+ # app/assets/stylesheets/pageflow/themes/default.css.scss
25
+ @import "pageflow/outline_navigation_bar/themes/default";
26
+
27
+ Execute `bundle install` and restart the application server. Now the
28
+ widget type can be enabled in your feature settings.
29
+
30
+ ## Troubleshooting
31
+
32
+ If you run into problems while installing the page type, please also refer to the
33
+ [Troubleshooting](https://github.com/codevise/pageflow/wiki/Troubleshooting) wiki
34
+ page in the [Pageflow repository](https://github.com/codevise/pageflow). If that
35
+ doesn't help, consider
36
+ [filing an issue](https://github.com/codevise/pageflow-outline-navigation-bar/issues).
37
+
38
+ ## Contributing Locales
39
+
40
+ Edit the translations directly on the
41
+ [pageflow-outline-navigation-bar](http://www.localeapp.com/projects/public?search=tf/pageflow-outline-navigation-bar)
42
+ locale project.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ Bundler::GemHelper.install_tasks
8
+
9
+ require 'semmy'
10
+ Semmy::Tasks.install
@@ -0,0 +1,26 @@
1
+ //= require_self
2
+
3
+ //= require ./outline_navigation_bar/events
4
+ //= require ./outline_navigation_bar/expander
5
+ //= require ./outline_navigation_bar/hide_text_button
6
+ //= require ./outline_navigation_bar/resizer
7
+ //= require ./outline_navigation_bar/navigator
8
+ //= require ./outline_navigation_bar/scroller
9
+ //= require ./outline_navigation_bar/panels
10
+ //= require ./outline_navigation_bar/menu_item
11
+
12
+ //= require ./outline_navigation_bar/widget
13
+
14
+ pageflow.outlineNavigationBar = pageflow.outlineNavigationBar || {};
15
+
16
+ pageflow.widgetTypes.register('outline_navigation_bar_expandable', {
17
+ enhance: function(element) {
18
+ element.outlineNavigationBar();
19
+ }
20
+ });
21
+
22
+ pageflow.widgetTypes.register('outline_navigation_bar_fixed', {
23
+ enhance: function(element) {
24
+ element.outlineNavigationBar();
25
+ }
26
+ });
@@ -0,0 +1,30 @@
1
+ pageflow.outlineNavigationBar.events = {
2
+ pointerUp: 'touchend mouseup MSPointerUp pointerup',
3
+ pointerDown: 'touchstart mousedown MSPointerDown pointerdown',
4
+
5
+ onPointerDown: function(element, selectorOrHandler, handler) {
6
+ var selector = handler ? selectorOrHandler : null;
7
+ handler = handler || selectorOrHandler;
8
+
9
+ this._onPointerDown(handler, function(event, fn) {
10
+ element.on(event, selector, fn);
11
+ });
12
+ },
13
+
14
+ _onPointerDown: function(handler, on) {
15
+ on(this.pointerDown, function(event) {
16
+ event.preventDefault();
17
+ handler.call(this);
18
+ });
19
+
20
+ on('click', function(event) {
21
+ event.preventDefault();
22
+ });
23
+
24
+ on('keypress', function(event) {
25
+ if (event.which == 13) {
26
+ handler.call(this);
27
+ }
28
+ });
29
+ },
30
+ };
@@ -0,0 +1,34 @@
1
+ pageflow.outlineNavigationBar.Expander = pageflow.Object.extend({
2
+ initialize: function(options) {
3
+ this.options = options;
4
+ this.expandedBy = {};
5
+ },
6
+
7
+ expand: function(options) {
8
+ this.expandedBy[(options && options.by) || 'button'] = true;
9
+ clearTimeout(this.collapseTimeout);
10
+
11
+ if (!this.expanded && this.options.enabled()) {
12
+ this.expanded = true;
13
+ this.options.expand();
14
+ }
15
+ },
16
+
17
+ collapse: function(options) {
18
+ delete this.expandedBy[(options && options.by) || 'button'];
19
+ clearTimeout(this.collapseTimeout);
20
+
21
+ if (this.expanded && _.keys(this.expandedBy).length === 0) {
22
+ this.expanded = false;
23
+ this.options.collapse();
24
+ }
25
+ },
26
+
27
+ scheduleCollapse: function(options) {
28
+ var that = this;
29
+
30
+ this.collapseTimeout = setTimeout(function() {
31
+ that.collapse(options);
32
+ }, 200);
33
+ }
34
+ });
@@ -0,0 +1,24 @@
1
+ (function($) {
2
+ $.widget('pageflow.outlineNavigationBarFullscreenButton', {
3
+ _create: function() {
4
+ var element = this.element;
5
+
6
+ if ($.support.fullscreen) {
7
+ element.click(function() {
8
+ element.toggleClass('fs').updateTitle();
9
+
10
+ $('#outer_wrapper').fullScreen({
11
+ callback: function(isFullScreen) {
12
+ element
13
+ .toggleClass('active', !!isFullScreen)
14
+ .updateTitle();
15
+ }
16
+ });
17
+ });
18
+ }
19
+ else {
20
+ element.parent().hide();
21
+ }
22
+ }
23
+ });
24
+ }(jQuery));
@@ -0,0 +1,17 @@
1
+ (function($) {
2
+ var events = pageflow.outlineNavigationBar.events;
3
+
4
+ $.widget('pageflow.outlineNavigationBarHideTextButton', {
5
+ _create: function() {
6
+ var element = this.element;
7
+
8
+ element.click(function() {
9
+ pageflow.hideText.toggle();
10
+ });
11
+
12
+ pageflow.hideText.on('activate deactivate', function() {
13
+ element.toggleClass('active', pageflow.hideText.isActive()).updateTitle();
14
+ });
15
+ }
16
+ });
17
+ }(jQuery));
@@ -0,0 +1,41 @@
1
+ (function($) {
2
+ var events = pageflow.outlineNavigationBar.events;
3
+
4
+ $.widget('pageflow.outlineNavigationBarMenuItem', {
5
+ _create: function() {
6
+ this._setupPressedClass();
7
+ this._ensureOpenWhileFocusInMenuBox();
8
+ },
9
+
10
+ _setupPressedClass: function() {
11
+ var element = this.element;
12
+
13
+ element.on(events.pointerDown, '> a', function() {
14
+ var link = $(this);
15
+ link.addClass('pressed');
16
+
17
+ $('body').one(events.pointerUp, function() {
18
+ link.removeClass('pressed');
19
+ });
20
+ });
21
+ },
22
+
23
+ _ensureOpenWhileFocusInMenuBox: function() {
24
+ var element = this.element;
25
+
26
+ element.find('.menu_box a').on({
27
+ focus: function() {
28
+ element.addClass('focused');
29
+ },
30
+
31
+ blur: function() {
32
+ element.removeClass('focused');
33
+ }
34
+ });
35
+
36
+ element.on('mouseleave', function() {
37
+ element.blur();
38
+ });
39
+ }
40
+ });
41
+ }(jQuery));
@@ -0,0 +1,35 @@
1
+ (function($) {
2
+ var events = pageflow.outlineNavigationBar.events;
3
+
4
+ $.widget('pageflow.outlineNavigationBarNavigator', {
5
+ _create: function() {
6
+ var element = this.element;
7
+ var scroller = this.options.scroller;
8
+ var links = element.find('a');
9
+
10
+ element.on(events.pointerDown, 'a', function(event) {
11
+ event.preventDefault();
12
+ $(this).one(events.pointerUp, goToPage);
13
+ });
14
+
15
+ element.on('click', 'a', function(event) {
16
+ event.preventDefault();
17
+ });
18
+
19
+ element.on('keydown', 'a', function(event) {
20
+ if (event.which == 13) {
21
+ goToPage.call(this);
22
+ }
23
+ });
24
+
25
+ scroller.on('scroll', function() {
26
+ links.off(events.pointerUp, goToPage);
27
+ });
28
+
29
+ function goToPage() {
30
+ var id = $(this).data('link');
31
+ pageflow.slides.goToById(id);
32
+ }
33
+ }
34
+ });
35
+ }(jQuery));
@@ -0,0 +1,54 @@
1
+ (function($) {
2
+ var events = pageflow.outlineNavigationBar.events;
3
+
4
+ $.widget('pageflow.outlineNavigationBarPanels', {
5
+ _create: function() {
6
+ var links = this.options.toggles.find('a');
7
+ var expander = this.options.expander;
8
+ var widget = this;
9
+
10
+ events.onPointerDown(links, function() {
11
+ var link = $(this);
12
+ var panelName = link.data('panel');
13
+ var collapsed = false;
14
+
15
+ if (link.data('toggle') === 'expandable') {
16
+ if (link.hasClass('active')) {
17
+ expander.collapse();
18
+ collapsed = true;
19
+ }
20
+ else {
21
+ expander.expand();
22
+ }
23
+ }
24
+ else if (link.data('toggle')) {
25
+ if (link.hasClass('active')) {
26
+ panelName = link.data('toggle');
27
+ }
28
+ }
29
+
30
+ widget.update(panelName, collapsed);
31
+ });
32
+ },
33
+
34
+ reset: function() {
35
+ var defaultLink = this.options.toggles.find('a[data-toggle="expandable"]');
36
+ this.update(defaultLink.data('panel'), true);
37
+ },
38
+
39
+ update: function(panelName, collapsed) {
40
+ var links = this.options.toggles.find('a');
41
+ var panels = this.options.panels;
42
+
43
+ links.each(function() {
44
+ var link = $(this);
45
+ link.toggleClass('active', link.data('panel') === panelName && !collapsed);
46
+ });
47
+
48
+ panels.each(function() {
49
+ var panel = $(this);
50
+ panel.toggleClass('active', panel.hasClass(panelName));
51
+ });
52
+ }
53
+ });
54
+ }(jQuery));