pageflow-timeline-page 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 994702dcbaaf89d67d961e7979925807849c40f8
4
- data.tar.gz: 7da5bfb08e81052571929656bd2a4e6e1b56b4db
3
+ metadata.gz: 2848f2a0f987663b262d60a8fc663c82a903fd38
4
+ data.tar.gz: 12377cf7fd34b7ec25842ec1c64cc5d40fcf8f47
5
5
  SHA512:
6
- metadata.gz: 73daa8bc375381fb3cb1551b0367c0c78628906322171d069c8ae9750ad9169df01b5bf2fad04a2ca377564fac7b362a3b605c7cf253721e3bc5ac025ec97ca7
7
- data.tar.gz: 9bf524ca7c9418a2f68f2d504e1a47982a69efb4441416f248450c9de2a56587920433ca28189eccf5b3b934aef38b172dbe788953d78f0721dbae445a44f97a
6
+ metadata.gz: 512ee499dd9f374f1a34e6e2d64ce58f2d4bc32dd5759190d2d46ee0b3fe4a4db132af8c7878b12a9f6ac68ad7ba4c2e076b80bf95a67fc85973ee7894986a5e
7
+ data.tar.gz: d84deb9445349946b5283e1b38c6a5bb47fd185272df4496d3da3cf97c483137e2dac2eac885313c4ae04f26e6b2795b860522201972cecf1fc7b929385c1a38
data/CHANGELOG.md CHANGED
@@ -1,7 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 0.1.0
3
+ ### Version 1.0.0
4
4
 
5
- 2016-06-09
5
+ 2017-08-11
6
6
 
7
- - Initial release.
7
+ [Compare changes](https://github.com/codevise/pageflow-timeline-page/compare/0-1-stable...v1.0.0)
8
+
9
+ - Rewrite dragging/measuring logic
10
+ ([#8](https://github.com/codevise/pageflow-timeline-page/pull/8))
11
+ - Require pageflow 12
12
+ ([#7](https://github.com/codevise/pageflow-timeline-page/pull/7))
13
+ - Allow to use background video
14
+ ([#5](https://github.com/codevise/pageflow-timeline-page/pull/5))
15
+
16
+ See
17
+ [0-1-stable branch](https://github.com/codevise/pageflow-timeline-page/blob/0-1-stable/CHANGELOG.md)
18
+ for previous changes.
data/Gemfile CHANGED
@@ -2,9 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in chart.gemspec
4
4
  gemspec
5
-
6
- # Rails 4 compat
7
- gem 'activeadmin', :git => 'https://github.com/codevise/active_admin.git', :branch => 'rails4'
8
- gem 'ransack'
9
- gem 'inherited_resources', '1.4.1'
10
- gem 'formtastic', '2.3.0.rc2'
data/README.md CHANGED
@@ -29,10 +29,10 @@ Include javascripts and stylesheets:
29
29
  # app/assets/javascripts/pageflow/editor.js
30
30
  //= require pageflow/timeline_page/editor
31
31
 
32
- # app/assets/stylesheets/pageflow/application.css.scss
32
+ # app/assets/stylesheets/pageflow/application.scss
33
33
  @import "pageflow/timeline_page";
34
34
 
35
- # app/assets/stylesheets/pageflow/themes/default.css.scss
35
+ # app/assets/stylesheets/pageflow/themes/default.scss
36
36
  @import "pageflow/timeline_page/themes/default";
37
37
 
38
38
  Execute `bundle install` and restart the application server.
@@ -1,17 +1,18 @@
1
1
  (function() {
2
+ const {registerPageType, connectInPage, combine} = pageflow.react;
3
+ const {pageAttributes} = pageflow.react.selectors;
4
+
2
5
  class Page extends React.Component {
3
6
  render() {
4
7
  var {PageWrapper,
5
- PageBackground, PageBackgroundImage, PageShadow,
8
+ MediaPageBackground,
6
9
  PageContent, PageHeader, PageText} = pageflow.react.components;
10
+
7
11
  var {Timeline} = pageflow.timelinePage;
8
12
 
9
13
  return (
10
14
  <PageWrapper>
11
- <PageBackground>
12
- <PageBackgroundImage page={this.props.page} />
13
- <PageShadow page={this.props.page} />
14
- </PageBackground>
15
+ <MediaPageBackground page={this.props.page} />
15
16
 
16
17
  <PageContent>
17
18
  <PageHeader page={this.props.page} />
@@ -24,5 +25,13 @@
24
25
  }
25
26
  };
26
27
 
27
- pageflow.timelinePage.Page = pageflow.react.createPage(Page);
28
+ registerPageType('timeline_page', {
29
+ component: connectInPage(combine({
30
+ page: pageAttributes()
31
+ }))(Page),
32
+
33
+ reduxModules: [
34
+ pageflow.react.mediaPageBackgroundReduxModule
35
+ ]
36
+ });
28
37
  }());
@@ -1,5 +1,5 @@
1
1
  (function() {
2
- class Timeline extends React.Component {
2
+ pageflow.timelinePage.Timeline = class extends React.Component {
3
3
  render() {
4
4
  return (
5
5
  <ul className="timeline">
@@ -22,6 +22,4 @@
22
22
  return this.props.pageLinks || [];
23
23
  }
24
24
  };
25
-
26
- pageflow.timelinePage.Timeline = pageflow.react.createContainer(Timeline);
27
25
  }());
@@ -1,12 +1,12 @@
1
-
2
1
  (function() {
3
- var resolve = pageflow.react.resolve;
2
+ const {connect, combine} = pageflow.react;
3
+ const {pageAttributes, prop} = pageflow.react.selectors;
4
4
 
5
5
  class TimelineItem extends React.Component {
6
6
  render() {
7
7
  var {PageLink, LazyLoadedPageThumbnail} = pageflow.react.components;
8
8
  var {TimelineItemSpacer} = pageflow.timelinePage;
9
- var targetPage = this.props.pageLink.targetPage;
9
+ var targetPage = this.props.targetPage;
10
10
 
11
11
  return (
12
12
  <li className={this.className()}>
@@ -57,17 +57,11 @@
57
57
 
58
58
  caption() {
59
59
  return this.props.pageLink.title ||
60
- (this.props.pageLink.targetPage && this.props.pageLink.targetPage.title);
60
+ (this.props.targetPage && this.props.targetPage.title);
61
61
  }
62
62
  };
63
63
 
64
- pageflow.timelinePage.TimelineItem = pageflow.react.createContainer(TimelineItem, {
65
- fragments: {
66
- pageLink: {
67
- targetPage: resolve('page', {
68
- property: 'targetPageId'
69
- })
70
- }
71
- }
72
- });
64
+ pageflow.timelinePage.TimelineItem = connect(combine({
65
+ targetPage: pageAttributes({id: prop('pageLink.targetPageId')})
66
+ }))(TimelineItem);
73
67
  }());
@@ -1,23 +1,26 @@
1
1
  (function() {
2
- var mutate = pageflow.react.mutate;
2
+ const {connectInPage, combine} = pageflow.react;
3
+ const {editorOnly} = pageflow.react.components;
4
+ const {updatePageLink} = pageflow.react.actions;
3
5
 
4
6
  class TimelineItemEditorMenu extends React.Component {
5
7
  constructor(props) {
6
8
  super(props);
7
- this.state = {};
9
+ this.state = {
10
+ top: 0
11
+ };
8
12
  }
9
13
 
10
14
  render() {
11
15
  var {Draggable} = pageflow.react.components;
12
16
 
13
- var start = {x: 0, y: this.props.top || 0};
17
+ var position = {x: 0, y: this.state.top};
14
18
  var bounds = {left: 0, right: 0, top: 0, bottom: 1000};
15
19
 
16
20
  return (
17
- <Draggable start={start}
21
+ <Draggable position={position}
18
22
  grid={[5, 5]}
19
23
  bounds={bounds}
20
- moveOnStartChange={this.state.topChanged}
21
24
  handle=".timeline_item_editor_menu-handle"
22
25
  onStart={this._handleDragStart.bind(this)}
23
26
  onDrag={this._handleDrag.bind(this)}
@@ -41,21 +44,24 @@
41
44
  }
42
45
 
43
46
  componentWillReceiveProps(nextProps) {
44
- this.setState({
45
- topChanged: (nextProps.top !== this.props.top)
46
- });
47
+ if (nextProps.top !== this.props.top) {
48
+ this.setState({
49
+ top: nextProps.top
50
+ });
51
+ }
47
52
  }
48
53
 
49
54
  _handleDragStart() {
50
55
  this.context.pageScroller.disable();
51
56
  }
52
57
 
53
- _handleDrag(event, ui) {
54
- this.props.onDrag(ui.position.top);
58
+ _handleDrag(event, dragEvent) {
59
+ this.setState({top: dragEvent.y});
60
+ this.props.onDrag(dragEvent.y);
55
61
  }
56
62
 
57
- _handleDragStop(event, ui) {
58
- this.props.onDragStop(ui.position.top);
63
+ _handleDragStop(event, dragEvent) {
64
+ this.props.onDragStop(dragEvent.y);
59
65
  this.context.pageScroller.enable();
60
66
  }
61
67
 
@@ -68,20 +74,18 @@
68
74
  var currentSizeIndex = sizes.indexOf(this.props.pageLink.timelineItemSize);
69
75
  var newSize = sizes[(currentSizeIndex + 1) % sizes.length];
70
76
 
71
- mutate('updatePageLink', {
72
- id: this.props.pageLink.id,
73
- attributes: {
74
- timeline_item_size: newSize
75
- }
77
+ this.props.updatePageLink({
78
+ linkId: this.props.pageLink.id,
79
+ name: 'timelineItemSize',
80
+ value: newSize
76
81
  });
77
82
  }
78
83
 
79
84
  _handleTogglePositionClick() {
80
- mutate('updatePageLink', {
81
- id: this.props.pageLink.id,
82
- attributes: {
83
- timeline_item_position: this.props.pageLink.timelineItemPosition === 'right' ? 'left' : 'right'
84
- }
85
+ this.props.updatePageLink({
86
+ linkId: this.props.pageLink.id,
87
+ name: 'timelineItemPosition',
88
+ value: this.props.pageLink.timelineItemPosition === 'right' ? 'left' : 'right'
85
89
  });
86
90
  }
87
91
  };
@@ -90,7 +94,7 @@
90
94
  pageScroller: React.PropTypes.object
91
95
  }
92
96
 
93
- pageflow.timelinePage.TimelineItemEditorMenu = pageflow.react.createContainer(TimelineItemEditorMenu, {
94
- editorOnly: true
95
- });
97
+ pageflow.timelinePage.TimelineItemEditorMenu = editorOnly(connectInPage(null, {
98
+ updatePageLink
99
+ })(TimelineItemEditorMenu));
96
100
  }());
@@ -1,5 +1,6 @@
1
1
  (function() {
2
- var mutate = pageflow.react.mutate;
2
+ const {connectInPage} = pageflow.react;
3
+ const {updatePageLink} = pageflow.react.actions;
3
4
 
4
5
  class TimelineItemSpacer extends React.Component {
5
6
  constructor(props) {
@@ -8,27 +9,24 @@
8
9
  }
9
10
 
10
11
  render() {
11
- var {TimelineItemEditorMenu} = pageflow.timelinePage;
12
+ const {TimelineItemEditorMenu} = pageflow.timelinePage;
13
+ const {Measure} = pageflow.react.components;
12
14
 
13
15
  return (
14
- <div className={this._className()}>
15
- <div className="timeline_item_spacer-inner" style={this._style()} />
16
- <TimelineItemEditorMenu pageLink={this.props.pageLink}
17
- top={this._menuTop()}
18
- onDrag={this._handleDrag.bind(this)}
19
- onDragStop={this._handleDragStop.bind(this)}/>
20
- </div>
16
+ <Measure whitelist={['width']}>
17
+ { ({width}) =>
18
+ <div className={this._className()}>
19
+ <div className="timeline_item_spacer-inner" style={this._style()} />
20
+ <TimelineItemEditorMenu pageLink={this.props.pageLink}
21
+ top={this._menuTop(width)}
22
+ onDrag={this._handleDrag.bind(this)}
23
+ onDragStop={top => this._handleDragStop(top, width)}/>
24
+ </div>
25
+ }
26
+ </Measure>
21
27
  );
22
28
  }
23
29
 
24
- pageDidActivate() {
25
- this._measure();
26
- }
27
-
28
- pageDidResize() {
29
- this._measure();
30
- }
31
-
32
30
  _className() {
33
31
  return [
34
32
  'timeline_item_spacer',
@@ -49,12 +47,8 @@
49
47
  }
50
48
  }
51
49
 
52
- _menuTop() {
53
- if (this.state.width) {
54
- return this.state.width * (this.props.pageLink.top || 0) / 100;
55
- }
56
-
57
- return 0;
50
+ _menuTop(width) {
51
+ return width * (this.props.pageLink.top || 0) / 100;
58
52
  }
59
53
 
60
54
  _isDragging() {
@@ -68,27 +62,20 @@
68
62
  });
69
63
  }
70
64
 
71
- _handleDragStop(top) {
65
+ _handleDragStop(top, width) {
72
66
  this.setState({
73
67
  dragging: false
74
68
  });
75
69
 
76
- var width = ReactDOM.findDOMNode(this).offsetWidth;
77
-
78
- mutate('updatePageLink', {
79
- id: this.props.pageLink.id,
80
- attributes: {
81
- top: top / width * 100
82
- }
83
- });
84
- }
85
-
86
- _measure() {
87
- this.setState({
88
- width: ReactDOM.findDOMNode(this).offsetWidth
70
+ this.props.updatePageLink({
71
+ linkId: this.props.pageLink.id,
72
+ name: 'top',
73
+ value: top / width * 100
89
74
  });
90
75
  }
91
76
  }
92
77
 
93
- pageflow.timelinePage.TimelineItemSpacer = pageflow.react.createPageComponent(TimelineItemSpacer);
78
+ pageflow.timelinePage.TimelineItemSpacer = connectInPage(null, {
79
+ updatePageLink
80
+ })(TimelineItemSpacer);
94
81
  }());
@@ -9,9 +9,7 @@ pageflow.editor.pageTypes.register('timeline_page', {
9
9
  });
10
10
 
11
11
  this.tab('files', function() {
12
- this.input('background_image_id', pageflow.FileInputView, {
13
- collection: 'image_files'
14
- });
12
+ this.group('background');
15
13
  this.input('thumbnail_image_id', pageflow.FileInputView, {
16
14
  collection: 'image_files',
17
15
  positioning: false
@@ -1,9 +1,4 @@
1
- //= require react
2
- //= require pageflow/react
3
-
4
1
  //= require_self
5
-
6
2
  //= require ./timeline_page/components
7
- //= require ./timeline_page/page_type
8
3
 
9
4
  pageflow.timelinePage = pageflow.timelinePage || {};
@@ -4,16 +4,16 @@ de:
4
4
  help_entries:
5
5
  page_type:
6
6
  menu_item: Collage
7
- text: ! '# Collage
8
-
7
+ text: |-
8
+ # Collage
9
9
 
10
10
  Stelle eine Liste von Links mit dem Aussehen einer Collage zusammen. Dieser Seitentyp ist am besten geeignet, um chronologisch geordnete Inhalte aufzubereiten.
11
11
 
12
-
13
12
  Jeder Eintrag verweist auf eine andere Seite des Beitrags, auf der der Leser vertiefende Informationen finden kann.
14
13
 
14
+ Für den Hintergrund kann ein Bild oder Video verwendet werden.
15
15
 
16
- Typische Anwendungsbeispiele: Liste historischer Ereignisse, Interview Reihe, Darstellung eines mehrschrittigen Prozesses.'
16
+ Typische Anwendungsbeispiele: Liste historischer Ereignisse, Interview Reihe, Darstellung eines mehrschrittigen Prozesses.
17
17
  page_attributes:
18
18
  timeline_layout:
19
19
  inline_help: Wähle hier die Ausrichtung der Verweis-Bilder für die gesamte Seite.
@@ -4,16 +4,16 @@ en:
4
4
  help_entries:
5
5
  page_type:
6
6
  menu_item: Collage
7
- text: ! '# Collage
8
-
7
+ text: |-
8
+ # Collage
9
9
 
10
10
  Build a Collage like list of links to other pages. This page type works best to visualize chronological content.
11
11
 
12
-
13
12
  Each item links to a page inside the Pageflow allowing the user to further explore details of a topic.
14
13
 
14
+ You can use an image or video for the background.
15
15
 
16
- Examples of application: List of historical events, series of interviews, depicting a multi step processes.'
16
+ Examples of application: List of historical events, series of interviews, depicting a multi step processes.
17
17
  page_attributes:
18
18
  timeline_layout:
19
19
  inline_help: Choose the alignment of images for the collage page.
@@ -1,5 +1,5 @@
1
1
  module Pageflow
2
2
  module TimelinePage
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '1.0.0'.freeze
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ module Pageflow
7
7
  end
8
8
 
9
9
  def self.page_type
10
- Pageflow::React.create_page_type('timeline_page', 'pageflow.timelinePage.Page')
10
+ Pageflow::React.create_page_type('timeline_page')
11
11
  end
12
12
  end
13
13
  end
@@ -12,15 +12,16 @@ Gem::Specification.new do |spec|
12
12
  spec.license = 'MIT'
13
13
 
14
14
  spec.files = `git ls-files`.split($/)
15
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
16
  spec.require_paths = ['lib']
18
17
 
19
- spec.add_dependency 'pageflow', '~> 0.10'
18
+ spec.required_ruby_version = '~> 2.1'
20
19
 
21
- # Using translations from rails locales in javascript code.
22
- spec.add_dependency 'i18n-js'
20
+ spec.add_dependency 'pageflow', ['>= 12.0.0.rc6', '< 13']
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.0'
23
+ spec.add_development_dependency 'rake', '~> 12.0'
23
24
 
24
25
  # Semantic versioning rake tasks
25
- spec.add_development_dependency 'semmy', '~> 0.2'
26
+ spec.add_development_dependency 'semmy', '~> 1.0'
26
27
  end
metadata CHANGED
@@ -1,57 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-timeline-page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codevise Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-09 00:00:00.000000000 Z
11
+ date: 2017-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pageflow
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 12.0.0.rc6
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '0.10'
22
+ version: '13'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 12.0.0.rc6
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '13'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
23
36
  requirements:
24
37
  - - "~>"
25
38
  - !ruby/object:Gem::Version
26
- version: '0.10'
39
+ version: '1.0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
27
47
  - !ruby/object:Gem::Dependency
28
- name: i18n-js
48
+ name: rake
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
- - - ">="
51
+ - - "~>"
32
52
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
53
+ version: '12.0'
54
+ type: :development
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
- - - ">="
58
+ - - "~>"
39
59
  - !ruby/object:Gem::Version
40
- version: '0'
60
+ version: '12.0'
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: semmy
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
65
  - - "~>"
46
66
  - !ruby/object:Gem::Version
47
- version: '0.2'
67
+ version: '1.0'
48
68
  type: :development
49
69
  prerelease: false
50
70
  version_requirements: !ruby/object:Gem::Requirement
51
71
  requirements:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
- version: '0.2'
74
+ version: '1.0'
55
75
  description:
56
76
  email:
57
77
  - info@codevise.de
@@ -80,7 +100,6 @@ files:
80
100
  - app/assets/javascripts/pageflow/timeline_page/editor.js
81
101
  - app/assets/javascripts/pageflow/timeline_page/editor/models/page_link.js
82
102
  - app/assets/javascripts/pageflow/timeline_page/editor/views/edit_page_link_view.js
83
- - app/assets/javascripts/pageflow/timeline_page/page_type.js
84
103
  - app/assets/stylesheets/pageflow/timeline_page.scss
85
104
  - app/assets/stylesheets/pageflow/timeline_page/themes/default.scss
86
105
  - app/assets/stylesheets/pageflow/timeline_page/timeline.scss
@@ -104,9 +123,9 @@ require_paths:
104
123
  - lib
105
124
  required_ruby_version: !ruby/object:Gem::Requirement
106
125
  requirements:
107
- - - ">="
126
+ - - "~>"
108
127
  - !ruby/object:Gem::Version
109
- version: '0'
128
+ version: '2.1'
110
129
  required_rubygems_version: !ruby/object:Gem::Requirement
111
130
  requirements:
112
131
  - - ">="
@@ -114,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
133
  version: '0'
115
134
  requirements: []
116
135
  rubyforge_project:
117
- rubygems_version: 2.2.5
136
+ rubygems_version: 2.6.8
118
137
  signing_key:
119
138
  specification_version: 4
120
139
  summary: Pageflow page type for links ordered as timeline.
@@ -1,2 +0,0 @@
1
- pageflow.pageType.register('timeline_page',
2
- pageflow.react.createPageType(pageflow.timelinePage.Page));