pageflow-chart 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cc1d7a83608fe48cb16cefb854b05e4f203d6145
4
- data.tar.gz: d2f8e9ee2f7f55133b32cc5f319a21eed791e215
2
+ SHA256:
3
+ metadata.gz: 468db56cbd4ad18e357d70438b2b0fef4f4dcf78ff3bce4b8a3b807db2823392
4
+ data.tar.gz: 5052ee6ccb0760023ec96bb39db2d54f0e62e1897ac976a61afa298680897670
5
5
  SHA512:
6
- metadata.gz: aedbaab6f9ca7e42272ff0188cf6cb7261d1ea4bcf7e6b12bdcc77a902626ba0974d7a8ea8fbc08596258b9b9bc72a585c9cbb3ca075683a8e61db9e040af1ea
7
- data.tar.gz: 96d7cd899d64010e611b4f01a82830c12e0f7974f274f630af1519c1f0198cada990ba09bce1acb0430bd13e9ce998842ce7ddd8d4c38aa030414f364628f92d
6
+ metadata.gz: c1ffd7a740081216f29f415f8b1945b1ef6ecccc5049e9711dd701c0bbe646fae153937248eb5051b5406be4730233fba09edcba622cc3a5577b9ca0938a3ddb
7
+ data.tar.gz: 08ece544c861bbb9c4b3dc0d0fa4cb2cb9fcff824feb96ffee9541a98fb63d2c45199a7fd677c6428164ad89b07f19ceed2981e25980ea7de8bdf3c47b68b91c
data/CHANGELOG.md CHANGED
@@ -1,28 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 1.0.1
3
+ ### Version 1.1.0
4
4
 
5
- 2017-08-17
5
+ 2017-11-08
6
6
 
7
- [Compare changes](https://github.com/codevise/pageflow-chart/compare/v1.0.0...v1.0.1)
7
+ [Compare changes](https://github.com/codevise/pageflow-chart/compare/1-0-stable...v1.1.0)
8
8
 
9
- - Try to minimize changes in script tag order
10
- ([#39](https://github.com/codevise/pageflow-chart/pull/39))
11
-
12
- ### Version 1.0.0
13
-
14
- 2017-08-11
15
-
16
- [Compare changes](https://github.com/codevise/pageflow-chart/compare/0-2-stable...v1.0.0)
17
-
18
- - Allow to use background video
19
- ([#29](https://github.com/codevise/pageflow-chart/pull/29),
20
- [#30](https://github.com/codevise/pageflow-chart/pull/30))
21
- - Drop the superfluous .css extension
22
- ([#34](https://github.com/codevise/pageflow-chart/pull/34))
23
- - Improve gemspec
24
- ([#38](https://github.com/codevise/pageflow-chart/pull/38))
9
+ - Require pageflow 12.1 for split layout handling and make split
10
+ layout compatible with adjustable title max-widths
11
+ ([#31](https://github.com/codevise/pageflow-chart/pull/31),
12
+ [#41](https://github.com/codevise/pageflow-chart/pull/41))
13
+ - Ignore Openuri::HttpError when downloading
14
+ ([#40](https://github.com/codevise/pageflow-chart/pull/40))
25
15
 
26
16
  See
27
- [0-2-stable branch](https://github.com/codevise/pageflow-chart/blob/0-2-stable/CHANGELOG.md)
17
+ [1-0-stable branch](https://github.com/codevise/pageflow-chart/blob/1-0-stable/CHANGELOG.md)
28
18
  for previous changes.
data/README.md CHANGED
@@ -52,15 +52,16 @@ Create a proxy (via Apache, Nginx, ...) from your domain to your configured
52
52
  `S3_HOST_ALIAS` to circumvent the same-domain policy. Configure this
53
53
  in your Pageflow Chart initializer `config/initializers/pageflow_chart.rb`.
54
54
 
55
- Example conf snippet for Nginx:
55
+ Example conf snippet for Nginx. Add this `location` block inside every `server` that's being used by Ruby/Rails.
56
56
 
57
57
  location /datawrapper/ {
58
58
  proxy_pass http://bucketname.s3-website-eu-west-1.amazonaws.com/;
59
59
  proxy_redirect http://bucketname.s3-website-eu-west-1.amazonaws.com/ $scheme://$host/datawrapper/;
60
60
  }
61
61
 
62
- This is needed so the charts can be servered from the same origin as
63
- the entry.
62
+ Normally you will do in two servers: the one that has `listen 80` in it
63
+ and the other one which has `listen 443' in it (for https). This is needed
64
+ so the charts can be servered from the same origin a the entry.
64
65
 
65
66
  ## Configuration
66
67
 
@@ -17,19 +17,19 @@ pageflow.react.registerPageTypeWithDefaultBackground('chart', {
17
17
  },
18
18
 
19
19
  resize: function(pageElement, configuration) {
20
- var iframeWrapper = pageElement.find('.iframeWrapper'),
21
- pageHeader = pageElement.find('.page_header'),
22
- scroller = pageElement.find('.scroller'),
23
- fullWidth = configuration.full_width,
24
- widescreened = pageElement.width() > 1430;
25
-
26
- if (fullWidth) {
27
- widescreened = false;
28
- }
20
+ var iframeWrapper = pageElement.find('.iframeWrapper');
21
+ var pageHeader = pageElement.find('.page_header');
22
+ var pageTitle = pageHeader.find('.title');
23
+ var scroller = pageElement.find('.scroller');
24
+ var fullWidth = configuration.full_width;
25
+
26
+ pageElement.toggleClass('page-with_split_layout', !fullWidth);
29
27
 
30
- iframeWrapper.toggleClass('widescreened', widescreened);
28
+ var splitLayout = this.wideEnoughForSplitLayout(pageElement) && !fullWidth;
31
29
 
32
- if (widescreened) {
30
+ iframeWrapper.toggleClass('widescreened', splitLayout);
31
+
32
+ if (splitLayout) {
33
33
  iframeWrapper.insertAfter(scroller);
34
34
  }
35
35
  else {
@@ -37,6 +37,21 @@ pageflow.react.registerPageTypeWithDefaultBackground('chart', {
37
37
  }
38
38
  },
39
39
 
40
+ wideEnoughForSplitLayout: function(pageElement) {
41
+ var pageTitle = pageElement.find('.page_header .title');
42
+
43
+ var pageTitleClientRect = pageTitle[0].getBoundingClientRect();
44
+ var pageClientRect = pageElement[0].getBoundingClientRect();
45
+
46
+ var spaceRightFromTitle = pageClientRect.right - pageTitleClientRect.right;
47
+ var spaceLeftFromTitle = pageTitleClientRect.left - pageClientRect.left;
48
+ var leftPositionedEmbedWidth = pageClientRect.width * 0.51;
49
+ var rightPositionedEmbedWidth = pageClientRect.width * 0.55;
50
+
51
+ return (spaceRightFromTitle >= rightPositionedEmbedWidth ||
52
+ spaceLeftFromTitle >= leftPositionedEmbedWidth);
53
+ },
54
+
40
55
  customizeLayout: function(pageElement, configuration) {
41
56
  var that = this;
42
57
  var iframe = pageElement.find('iframe');
data/chart.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.required_ruby_version = '~> 2.1'
20
20
 
21
- spec.add_runtime_dependency 'pageflow', '~> 12.x'
21
+ spec.add_runtime_dependency 'pageflow', '~> 12.1'
22
22
  spec.add_runtime_dependency 'nokogiri', '~> 1.0'
23
23
  spec.add_runtime_dependency 'paperclip', '~> 4.2'
24
24
  spec.add_runtime_dependency 'state_machine', '~> 1.2'
@@ -12,12 +12,11 @@ module Pageflow
12
12
 
13
13
  def load(url)
14
14
  file = open(make_absolute(url))
15
-
16
- begin
17
- yield(file)
18
- ensure
19
- file.close
20
- end
15
+ yield(file)
16
+ rescue OpenURI::HTTPError => exception
17
+ Rails.logger.error "Exception loading url #{url}: #{exception.message}"
18
+ ensure
19
+ file.close if file
21
20
  end
22
21
 
23
22
  def load_all(urls, options = {})
@@ -1,5 +1,5 @@
1
1
  module Pageflow
2
2
  module Chart
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
@@ -17,6 +17,19 @@ module Pageflow
17
17
  expect(result).to eq("aaa")
18
18
  end
19
19
 
20
+ it 'ignores HTTP response 404' do
21
+ downloader = Downloader.new
22
+ result = ''
23
+
24
+ stub_request(:get, "http://example.com/a").to_return(status: 404, body: 'aaa')
25
+
26
+ downloader.load('http://example.com/a') do |io|
27
+ result = io.read
28
+ end
29
+
30
+ expect(result).to eq("")
31
+ end
32
+
20
33
  it 'derives protocol from base_url' do
21
34
  downloader = Downloader.new(base_url: 'http://someother.com')
22
35
  result = ''
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-chart
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codevise Solutions Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
11
+ date: 2017-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pageflow
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 12.x
19
+ version: '12.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 12.x
26
+ version: '12.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -338,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  version: '0'
339
339
  requirements: []
340
340
  rubyforge_project:
341
- rubygems_version: 2.6.8
341
+ rubygems_version: 2.7.0
342
342
  signing_key:
343
343
  specification_version: 4
344
344
  summary: Pagetype for Embedded Datawrapper Charts