pageflow-linkmap-page 2.0.0 → 2.1.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
  SHA256:
3
- metadata.gz: 6ce17d17c0e4310badb5085357e5207eed1a85771ebe119b9ebe04171cb38c2e
4
- data.tar.gz: da776f95231282a5645ca3b67a3437ec26c8eb00ab7b537de7438344adffe5f5
3
+ metadata.gz: 9825b545e07dcf9337e0f9176ff4c4f56868450ca81e26c66806324b04e3f096
4
+ data.tar.gz: b576dda5149b50eef40d3cd15db7b32cb4f9e246b1b0378a4972436e23b5a1d7
5
5
  SHA512:
6
- metadata.gz: 222ed28a9b10e79cf16e3b1f306c4aa88612e12b923a5570724a3bfbee456ec475a8ec5f08f1a3ee24b757a41d1335ffeaad3a3c1e330e43a9e8120afe4c8d6e
7
- data.tar.gz: beca7d5fc98604075efc611f2eb98ca3b67549e89b11b4b350b402b170d1292af2bada093306f95895fbcf7e8eb0c3aa39fb735dbed9e36fe04b29e28466b75e
6
+ metadata.gz: 2f203df90096273faea3c8b16478b33f35662d94ffadcd3cb533674575b15fb2f1cf2100703c15176f76f07e984ea0b96a3de140f52e6a6e67d2983627548f5f
7
+ data.tar.gz: 7e51966d6484244aa35a1d659f32160d3f2cc069585248418b7a1a7446164936516f25bb7abbe922dcc4e8c07fe7cfd59a0812d55cec3fd31ce8a4d5a3b2f7fe
data/CHANGELOG.md CHANGED
@@ -1,39 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 2.0.0
3
+ ### Version 2.1.0
4
4
 
5
- 2018-12-10
5
+ 2019-01-23
6
6
 
7
- [Compare changes](https://github.com/codevise/pageflow-linkmap-page/compare/1-x-stable...v2.0.0)
7
+ [Compare changes](https://github.com/codevise/pageflow-linkmap-page/compare/2-0-stable...v2.1.0)
8
8
 
9
- ##### Breaking Changes
10
-
11
- - Requires Pageflow 13.
12
- ([#35](https://github.com/codevise/pageflow-linkmap-page/pull/35),
13
- [#38](https://github.com/codevise/pageflow-linkmap-page/pull/38))
14
-
15
- - Use server side processing for color maps and masked images.
16
- ([#42](https://github.com/codevise/pageflow-linkmap-page/pull/42))
17
-
18
- Remove the following line from your `config/routes.rb` file:
19
-
20
- mount Pageflow::LinkmapPage::Engine, at: '/linkmap_page'
21
-
22
- Run the following rake task to trigger server side processing of
23
- color maps and masked images:
24
-
25
- bin/rake pageflow_linkmap_page:migrate_to_masked_image_files
26
-
27
- Consider running this task on a separate machine to handle file
28
- processing before deploying the update.
29
-
30
- ##### Features
31
-
32
- - Paginated mobile navigation
33
- ([#43](https://github.com/codevise/pageflow-linkmap-page/pull/43))
34
- - Integrate with horizontal slideshow navigation
35
- ([#44](https://github.com/codevise/pageflow-linkmap-page/pull/44))
9
+ - Add compatibility to pageflow_linkmap_page 1.5
10
+ ([#48](https://github.com/codevise/pageflow-linkmap-page/pull/48))
36
11
 
37
12
  See
38
- [1-x-stable branch](https://github.com/codevise/pageflow-linkmap-page/blob/1-x-stable/CHANGELOG.md)
13
+ [2-0-stable branch](https://github.com/codevise/pageflow-linkmap-page/blob/2-0-stable/CHANGELOG.md)
39
14
  for previous changes.
@@ -85,7 +85,8 @@ pageflow.linkmapPage.Area = Backbone.Model.extend({
85
85
  unsetMask: function() {
86
86
  this.set({
87
87
  marker: 'no_marker',
88
- mask_perma_id: undefined
88
+ mask_perma_id: undefined,
89
+ color_map_component_id: undefined
89
90
  });
90
91
  this.trigger('change:dimensions');
91
92
  },
@@ -119,5 +120,18 @@ pageflow.linkmapPage.Area = Backbone.Model.extend({
119
120
 
120
121
  remove: function() {
121
122
  this.collection.remove(this);
123
+ },
124
+
125
+ get: function(attr) {
126
+ if (attr === 'color_map_component_id') {
127
+ var colorMapComponentId = this.attributes['color_map_component_id'];
128
+ if(colorMapComponentId === undefined) {
129
+ // also try legacy mask_perma_id as fallback
130
+ colorMapComponentId = this.attributes['mask_perma_id'];
131
+ }
132
+ return colorMapComponentId;
133
+ } else {
134
+ return this.attributes[attr];
135
+ }
122
136
  }
123
137
  });
@@ -77,7 +77,7 @@ pageflow.linkmapPage.EditAreaView = Backbone.Marionette.Layout.extend({
77
77
 
78
78
  configurationEditor.tab('appearance', function() {
79
79
  this.input('marker', pageflow.SelectInputView, {values: pageflow.linkmapPage.markerOptions});
80
- this.input('mask_perma_id', pageflow.linkmapPage.AreaMaskInputView, {
80
+ this.input('color_map_component_id', pageflow.linkmapPage.AreaMaskInputView, {
81
81
  visibleBinding: 'marker',
82
82
  visible: function(value) {
83
83
  return value !== 'dynamic_marker';
@@ -209,7 +209,7 @@ pageflow.linkmapPage.AreaItemEmbeddedView = Backbone.Marionette.ItemView.extend(
209
209
  var audioFileId = this.model.get('target_id');
210
210
  var colorMapComponent = this.getColorMapComponent();
211
211
 
212
- this.$el.attr('data-mask-perma-id', colorMapComponent ? colorMapComponent.permaId : null);
212
+ this.$el.attr('data-color-map-component-id', colorMapComponent ? colorMapComponent.permaId : null);
213
213
  this.$el.attr('data-audio-file', audioFileId ? audioFileId + '.' + this.cid : '');
214
214
  this.$el.attr('data-target-type', this.model.get('target_type'));
215
215
  this.$el.attr('data-target-id', this.model.get('target_id'));
@@ -271,7 +271,7 @@ pageflow.linkmapPage.AreaItemEmbeddedView = Backbone.Marionette.ItemView.extend(
271
271
 
272
272
  getColorMapComponent: function() {
273
273
  return this.options.colorMap.componentByPermaId(
274
- this.model.get('mask_perma_id')
274
+ this.model.get('color_map_component_id')
275
275
  );
276
276
  }
277
277
  });
@@ -147,7 +147,7 @@ pageflow.linkmapPage.AreaMasksPreviewEmbeddedView = Backbone.Marionette.ItemView
147
147
 
148
148
  colorMapComponentIsUsed: function(colorMapComponent) {
149
149
  return this.options.areas.any(function(area) {
150
- return colorMapComponent.permaId === area.get('mask_perma_id');
150
+ return colorMapComponent.permaId === area.get('color_map_component_id');
151
151
  }, this);
152
152
  },
153
153
 
@@ -28,7 +28,7 @@ pageflow.linkmapPage.AreaOutlineEmbeddedView = Backbone.Marionette.ItemView.exte
28
28
  var area = this.options.area;
29
29
  var canvas = this.ui.canvas[0];
30
30
 
31
- var colorMapComponent = this.options.colorMap.componentByPermaId(area.get('mask_perma_id'));
31
+ var colorMapComponent = this.options.colorMap.componentByPermaId(area.get('color_map_component_id'));
32
32
 
33
33
  if (colorMapComponent) {
34
34
  var attributes = colorMapComponent.areaAttributes();
@@ -73,7 +73,7 @@ pageflow.linkmapPage.AreaOutlineEmbeddedView = Backbone.Marionette.ItemView.exte
73
73
 
74
74
  drawArea: function(context, area) {
75
75
  var canvas = context.canvas;
76
- var colorMapComponent = this.options.colorMap.componentByPermaId(area.get('mask_perma_id'));
76
+ var colorMapComponent = this.options.colorMap.componentByPermaId(area.get('color_map_component_id'));
77
77
 
78
78
  if (colorMapComponent) {
79
79
  colorMapComponent.draw(context, canvas.width);
@@ -1,7 +1,7 @@
1
1
  $.fn.linkmapAreaSetMask = function(options) {
2
2
  this.each(function() {
3
3
  var area = $(this);
4
- var colorMapComponent = options.colorMap.componentByPermaId(area.attr('data-mask-perma-id'));
4
+ var colorMapComponent = options.colorMap.componentByPermaId(area.attr('data-color-map-component-id'));
5
5
 
6
6
  if (colorMapComponent) {
7
7
  area.data('mask', new pageflow.linkmapPage.Mask({
@@ -23,7 +23,7 @@ pageflow.linkmapPage.ColorMap = (function() {
23
23
 
24
24
  this.areaAttributes = function() {
25
25
  return {
26
- mask_perma_id: this.permaId,
26
+ color_map_component_id: this.permaId,
27
27
  top: attributes.top / colorMapHeight * 100.0,
28
28
  left: attributes.left / colorMapWidth * 100.0,
29
29
  height: attributes.height / colorMapHeight * 100.0,
@@ -32,14 +32,15 @@ module Pageflow
32
32
  end
33
33
 
34
34
  def linkmap_area_background_image_div(prefix, attributes, configuration, color_map_file)
35
+ color_map_component_id = attributes['color_map_component_id'] || attributes['mask_perma_id']
35
36
  if color_map_file &&
36
- attributes['mask_perma_id'].present? &&
37
- attributes['mask_perma_id'].split(':').first.to_i == color_map_file.id
37
+ color_map_component_id.present? &&
38
+ color_map_component_id.split(':').first.to_i == color_map_file.id
38
39
  background_image_div(configuration,
39
40
  "linkmap_masked_#{prefix}_image",
40
41
  class: "#{prefix}_image",
41
42
  file_type: 'pageflow_linkmap_page_masked_image_files',
42
- style_group: attributes['mask_perma_id'].split(':').last)
43
+ style_group: color_map_component_id.split(':').last)
43
44
  else
44
45
  background_image_div(configuration,
45
46
  "#{prefix}_image",
@@ -90,7 +91,8 @@ module Pageflow
90
91
  end
91
92
 
92
93
  def data_attributes
93
- mask_perma_id = background_type != 'hover_video' && attributes[:mask_perma_id]
94
+ color_map_component_id = background_type != 'hover_video' &&
95
+ (attributes[:color_map_component_id] || attributes[:mask_perma_id])
94
96
  audio_file_id = attributes[:target_id]
95
97
 
96
98
  {
@@ -98,7 +100,7 @@ module Pageflow
98
100
  target_id: attributes[:target_id],
99
101
  audio_file: audio_file_id.present? ? "#{audio_file_id}.area_#{index}" : nil,
100
102
  page_transition: attributes[:page_transition],
101
- mask_perma_id: mask_perma_id,
103
+ color_map_component_id: color_map_component_id,
102
104
  width: attributes[:width],
103
105
  height: attributes[:height]
104
106
  }.delete_if { |key, value| value.blank? }
@@ -2,11 +2,11 @@ de:
2
2
  activerecord:
3
3
  attributes:
4
4
  pageflow/linkmap_page/area:
5
+ color_map_component_id: Maske
5
6
  inverted: Invertieren
6
7
  link_description: 'Linkbeschreibung: Text'
7
8
  link_title: 'Linkbeschreibung: Titel'
8
9
  marker: Linkmarkierung
9
- mask_perma_id: Maske
10
10
  name: Bezeichnung
11
11
  page_transition: Seitenwechsel-Animation
12
12
  target_id: Ziel
@@ -331,11 +331,11 @@ de:
331
331
  areas: Bereiche
332
332
  inline_help:
333
333
  pageflow/linkmap_page/area:
334
+ color_map_component_id: Farbiger Bereich im Maskenbild, der die Form des Hotspots bestimmt.
335
+ color_map_component_id_disabled: Farbiger Bereich im Maskenbild, der die Form des Hotspots bestimmt. Nur verfügbar, wenn ein Masken-Bild im 'Dateien'-Tab der Hotspot-Seite festgelegt wurde und als Panorama-Typ nicht 'Hover Video' ausgewählt wurde.
334
336
  inverted: Dunkle Piktogramme für die Verwendung auf hellen Hintergründen anzeigen.
335
337
  link_title: Die Beschreibung wird in einem Overlay angezeigt, wenn sich der Cursor über dem Hotspot befindet.
336
338
  marker: Wähle die visuelle Darstellung des Hotspots.
337
- mask_perma_id: Farbiger Bereich im Maskenbild, der die Form des Hotspots bestimmt.
338
- mask_perma_id_disabled: Farbiger Bereich im Maskenbild, der die Form des Hotspots bestimmt. Nur verfügbar, wenn ein Masken-Bild im 'Dateien'-Tab der Hotspot-Seite festgelegt wurde und als Panorama-Typ nicht 'Hover Video' ausgewählt wurde.
339
339
  name: Gib hier eine Bezeichnung ein, um später bei in der Verweis-Übersicht direkt zu erkennen, um welchen Verweis es sich handelt. Die Bezeichnung ist für die Leser nicht sichtbar.
340
340
  page_transition: Wähle hier den Effekt, der beim Übergang zur Zielseite des Verweises benutzt werden soll.
341
341
  target_id: Objekt auf das der Hotspot verlinkt.
@@ -2,11 +2,11 @@ en:
2
2
  activerecord:
3
3
  attributes:
4
4
  pageflow/linkmap_page/area:
5
+ color_map_component_id: Mask
5
6
  inverted: Invert
6
7
  link_description: Link decription text
7
8
  link_title: Link description title
8
9
  marker: Link display
9
- mask_perma_id: Mask
10
10
  name: Label
11
11
  page_transition: Page transition
12
12
  target_id: Target
@@ -291,11 +291,11 @@ en:
291
291
  areas: Areas
292
292
  inline_help:
293
293
  pageflow/linkmap_page/area:
294
+ color_map_component_id: Colored area inside mask image which determines the shape of the hotspot.
295
+ color_map_component_id_disabled: Colored area inside mask image which determines the shape of the hotspot. Only available if a mask image has been selected on the hotspot page's 'Files' tab and the panorama type is not 'Hover video'.
294
296
  inverted: Display dark pictograms to improve visibility on light backgrounds.
295
297
  link_title: The description is displayed inside an overlay when the cursor hovers the hotspot.
296
298
  marker: 'Choose the hotspot''s visual appearance. '
297
- mask_perma_id: Colored area inside mask image which determines the shape of the hotspot.
298
- mask_perma_id_disabled: Colored area inside mask image which determines the shape of the hotspot. Only available if a mask image has been selected on the hotspot page's 'Files' tab and the panorama type is not 'Hover video'.
299
299
  name: Choose a label to recognize the link within the overview. This label is for your orientation only and will not be displayed to the reader.
300
300
  page_transition: Choose the animation, that will be used to transition to the link's target page.
301
301
  target_id: Object the hotspot links to.
@@ -41,7 +41,7 @@ module Pageflow
41
41
  end
42
42
 
43
43
  def with_color_map(&block)
44
- PaperclipTempfile.for(color_map_attachment, &block)
44
+ Pageflow::LinkmapPage::PaperclipTempfile.for(color_map_attachment, &block)
45
45
  end
46
46
 
47
47
  def color_map_attachment
@@ -163,7 +163,7 @@ module Pageflow
163
163
  end
164
164
 
165
165
  def with_progress(steps:)
166
- progress = Progress.new(steps: steps) do |percent|
166
+ progress = Pageflow::LinkmapPage::Progress.new(steps: steps) do |percent|
167
167
  if options[:progress_callback]
168
168
  attachment.instance.send(options[:progress_callback], percent)
169
169
  end
@@ -1,5 +1,5 @@
1
1
  module Pageflow
2
2
  module LinkmapPage
3
- VERSION = '2.0.0'.freeze
3
+ VERSION = '2.1.0'.freeze
4
4
  end
5
5
  end
@@ -41,7 +41,7 @@ module Pageflow
41
41
  color_map_file = color_map_file_for(color_map_image_file, revision)
42
42
  page.configuration['linkmap_color_map_file_id'] = color_map_file.id
43
43
 
44
- hover_image_file = Pageflow::ImageFile.find_by_id(page.configuration['hover_image_id'])
44
+ hover_image_file = ImageFile.find_by_id(page.configuration['hover_image_id'])
45
45
 
46
46
  if hover_image_file
47
47
  puts "-- Masked image file for hover image file #{hover_image_file.id}"
@@ -100,9 +100,9 @@ module Pageflow
100
100
  areas = page.configuration['linkmap_areas'] || []
101
101
 
102
102
  page.configuration['linkmap_areas'] = areas.map do |area_attributes|
103
- old_mask_perma_id = area_attributes['mask_perma_id']
103
+ mask_perma_id = area_attributes['mask_perma_id']
104
104
 
105
- if old_mask_perma_id && !area_attributes['old_mask_perma_id']
105
+ if mask_perma_id && !area_attributes['color_map_component_id']
106
106
  sprite_id = page.configuration.fetch('linkmap_masks').fetch('id')
107
107
  colors =
108
108
  page
@@ -112,11 +112,10 @@ module Pageflow
112
112
  .fetch('c')
113
113
  .map { |component| component['c'] }
114
114
 
115
- area_attributes.merge(old_mask_perma_id: old_mask_perma_id,
116
- mask_perma_id: convert_mask_perma_id(old_mask_perma_id,
117
- colors,
118
- color_map_file,
119
- sprite_id))
115
+ area_attributes.merge(color_map_component_id: convert_mask_perma_id(mask_perma_id,
116
+ colors,
117
+ color_map_file,
118
+ sprite_id))
120
119
  else
121
120
  area_attributes
122
121
  end
@@ -36,7 +36,7 @@ module Pageflow
36
36
  color_map_file = create(:color_map_file)
37
37
  masked_image_file = create(:masked_image_file)
38
38
  configuration = {
39
- 'linkmap_areas' => [{'mask_perma_id' => "#{color_map_file.id}:aaa"}],
39
+ 'linkmap_areas' => [{'color_map_component_id' => "#{color_map_file.id}:aaa"}],
40
40
  'hover_image_id' => 5,
41
41
  'linkmap_color_map_file_id' => color_map_file.id,
42
42
  'linkmap_masked_hover_image_id' => masked_image_file.id
@@ -62,13 +62,13 @@ module Pageflow
62
62
  expect(html).to have_selector('a div[class~="image_panorama_5"]')
63
63
  end
64
64
 
65
- it 'does not use masked hover image if area mask perma id references other image' do
65
+ it 'does not use masked hover image if area color map component id references other image' do
66
66
  entry = create(:entry)
67
67
  masked_image_file = create(:masked_image_file)
68
68
  color_map_file = create(:color_map_file)
69
69
  other_id = color_map_file.id + 1
70
70
  configuration = {
71
- 'linkmap_areas' => [{'mask_perma_id' => "#{other_id}:aaa"}],
71
+ 'linkmap_areas' => [{'color_map_component_id' => "#{other_id}:aaa"}],
72
72
  'hover_image_id' => 5,
73
73
  'linkmap_masked_hover_image_id' => masked_image_file.id
74
74
  }
@@ -92,7 +92,7 @@ module Pageflow
92
92
  color_map_file = create(:color_map_file)
93
93
  masked_image_file = create(:masked_image_file)
94
94
  configuration = {
95
- 'linkmap_areas' => [{'mask_perma_id' => "#{color_map_file.id}:aaa"}],
95
+ 'linkmap_areas' => [{'color_map_component_id' => "#{color_map_file.id}:aaa"}],
96
96
  'hover_image_id' => 5,
97
97
  'linkmap_color_map_file_id' => color_map_file.id,
98
98
  'linkmap_masked_visited_image_id' => masked_image_file.id
@@ -104,25 +104,51 @@ module Pageflow
104
104
  expect(html).to have_selector("a div[class~='#{image_class}']")
105
105
  end
106
106
 
107
- it 'sets data-mask-perma-id attribute if area has mask_perma_id' do
107
+ it 'sets data-color-map-component-id attribute if area has color_map_component_id' do
108
108
  entry = create(:entry)
109
- configuration = {'linkmap_areas' => [{'mask_perma_id' => '1:aaa'}]}
109
+ configuration = {'linkmap_areas' => [{'color_map_component_id' => '1:aaa'}]}
110
110
 
111
111
  html = helper.linkmap_areas_div(entry, configuration)
112
112
 
113
- expect(html).to have_selector('a[data-mask-perma-id="1:aaa"]')
113
+ expect(html).to have_selector('a[data-color-map-component-id="1:aaa"]')
114
114
  end
115
115
 
116
- it 'does not set data-mask-perma-id attribute if background type is hover_video' do
116
+ it 'uses color map component id if present, preceding mask perma id' do
117
117
  entry = create(:entry)
118
+ color_map_file_1 = create(:color_map_file)
119
+ color_map_file_2 = create(:color_map_file)
118
120
  configuration = {
119
- 'linkmap_areas' => [{'mask_perma_id' => '1:aaa'}],
121
+ 'linkmap_areas' => [{'color_map_component_id' => "#{color_map_file_2.id}:aaa",
122
+ 'mask_perma_id' => "#{color_map_file_1.id}:aaa"}]
123
+ }
124
+
125
+ html = helper.linkmap_areas_div(entry, configuration)
126
+
127
+ expect(html).to have_selector("a[data-color-map-component-id='#{color_map_file_2.id}:aaa']")
128
+ end
129
+
130
+ it 'uses mask perma id as fallback if present and color map component id is blank' do
131
+ entry = create(:entry)
132
+ color_map_file = create(:color_map_file)
133
+ configuration = {
134
+ 'linkmap_areas' => [{'mask_perma_id' => "#{color_map_file.id}:aaa"}]
135
+ }
136
+
137
+ html = helper.linkmap_areas_div(entry, configuration)
138
+
139
+ expect(html).to have_selector("a[data-color-map-component-id='#{color_map_file.id}:aaa']")
140
+ end
141
+
142
+ it 'does not set data-color-map-component-id attribute if background type is hover_video' do
143
+ entry = create(:entry)
144
+ configuration = {
145
+ 'linkmap_areas' => [{'color_map_component_id' => '1:aaa'}],
120
146
  'background_type' => 'hover_video'
121
147
  }
122
148
 
123
149
  html = helper.linkmap_areas_div(entry, configuration)
124
150
 
125
- expect(html).not_to have_selector('a[data-mask-perma-id]')
151
+ expect(html).not_to have_selector('a[data-color-map-component-id]')
126
152
  end
127
153
  end
128
154
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pageflow-linkmap-page
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.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: 2018-12-10 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pageflow
@@ -351,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
351
351
  version: '0'
352
352
  requirements: []
353
353
  rubyforge_project:
354
- rubygems_version: 2.7.5
354
+ rubygems_version: 2.7.8
355
355
  signing_key:
356
356
  specification_version: 4
357
357
  summary: Pageflow page type for a page that contains customizable link areas