intranet-pictures 1.0.1 → 1.0.6

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: 42beab994981aa7bc689ea5ad6f5dd7adad424b46c9f13b33ecc55ad89199b5d
4
- data.tar.gz: f4a3214ca9a29331c28f2080c2c8265ed8ba8ba31eb2565b5206704b8bb53552
3
+ metadata.gz: 628a14d0155be72d18ea879e45225bfa736d3e8ff85f737245595c7faba201bb
4
+ data.tar.gz: d9156887f2265f2dcfc622aab9ff63a87ff4b57eecd3b894b6bab8b21479250e
5
5
  SHA512:
6
- metadata.gz: fa46c519503498af50e612ce4bc14040134a939732753e0eaa98144b37d88485fcbb40f176b42e0c154a82275cca18c9cb2fcb8ce3ad9a0366c855495d5b5d3c
7
- data.tar.gz: 98effc28029acce7b7932299e9371d40092977309774bddaf77b101923ae5c9df176eb9ed4fcca8cf1a0ccdc6036fb3e0c5604fc45bfa580ee7095685bf0487b
6
+ metadata.gz: 98cba0984d30e6ad3c6086bee626376e8775624628ecc5ebac979b96e2ddb6026c6ef88a96e9f0471b16608d2b2eb6070fec3833e7f14646c2a1f78c086b69e2
7
+ data.tar.gz: 8af2829b1308cbdbf28bacfbb81cd89c0ad8d5216c9084eccd8ca3b9b75b489d34925a58a07f36a4055c1f210b47a6c04b87732a57e8b7b7078956a527fa75ef
@@ -182,15 +182,17 @@ module Intranet
182
182
  def select_groups(type, selector)
183
183
  return @json.fetch('groups').fetch(type) if selector.empty? # optimization
184
184
 
185
- groups_id = @json.fetch('pictures').map do |p|
186
- p.fetch(type) if picture_match?(p, selector)
187
- end.uniq.compact
185
+ groups_id = select_pictures_having(type, selector).map { |p| p.fetch(type) }.uniq.compact
188
186
  @json.fetch('groups').fetch(type).select { |g| groups_id.include?(g.fetch('id')) }
189
187
  end
190
188
 
191
189
  def select_pictures(selector)
192
190
  @json.fetch('pictures').select { |p| picture_match?(p, selector) }
193
191
  end
192
+
193
+ def select_pictures_having(group_type, selector)
194
+ @json.fetch('pictures').select { |p| p.key?(group_type) && picture_match?(p, selector) }
195
+ end
194
196
  end
195
197
  end
196
198
  end
@@ -222,7 +222,7 @@ module Intranet
222
222
  group_type = path.split('/')[2].to_s
223
223
  pic = @provider.group_thumbnail(group_type, selector(query))
224
224
  if pic.nil?
225
- pic = ['image/jpeg', File.read(File.join(resources_dir, 'www', 'group_thumbnail.jpg'))]
225
+ pic = ['image/svg+xml', File.read(File.join(resources_dir, 'www', 'group_thumbnail.svg'))]
226
226
  end
227
227
  pic
228
228
  end
@@ -8,7 +8,7 @@ module Intranet
8
8
  NAME = 'intranet-pictures'
9
9
 
10
10
  # The version of the gem, according to semantic versionning.
11
- VERSION = '1.0.1'
11
+ VERSION = '1.0.6'
12
12
 
13
13
  # The URL of the gem homepage.
14
14
  HOMEPAGE_URL = 'https://rubygems.org/gems/intranet-pictures'
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="860" height="380">
3
+ <rect width="860" height="380" style="fill:rgb(226,226,226)" />
4
+ <rect x="308" y="96" width="211" height="154" rx="2" ry="2" style="fill:rgb(226,226,226);stroke-width:13.5;stroke:rgb(245,245,245)" />
5
+ <rect x="323" y="111" width="211" height="154" style="fill:rgb(226,226,226)" />
6
+ <rect x="344" y="132" width="211" height="154" rx="2" ry="2" style="fill:rgb(226,226,226);stroke-width:13.5;stroke:rgb(245,245,245)" />
7
+ <circle cx="401" cy="185" r="18" fill="rgb(245,245,245)" />
8
+ <path d="M 368 257 Q 374 223 435 231 L 469 178 L 496 219 L 511 199 L 531 257 Z" fill="rgb(245,245,245)" />
9
+ </svg>
@@ -273,11 +273,11 @@ a.pswp__share--download:hover {
273
273
 
274
274
  .pswp__caption__center {
275
275
  text-align: center; /* patch intranet */
276
- max-width: 600px; /* patch intranet */
276
+ /*max-width: 420px;*/ /* patch intranet */
277
277
  margin: 0 auto;
278
278
  font-size: 100%; /* patch intranet */
279
- padding: 10px;
280
- line-height: 20px;
279
+ padding: 0.625em; /* patch intranet */
280
+ /*line-height: 20px;*/ /* patch intranet */
281
281
  font-weight: bold; /* patch intranet */
282
282
  color: #CCC; }
283
283
 
@@ -8,9 +8,6 @@
8
8
  p.see_more {
9
9
  text-align: right;
10
10
  }
11
- p.see_more a {
12
- color: #748ea3;
13
- }
14
11
 
15
12
  /******************************* Picture groups *******************************/
16
13
 
@@ -18,7 +15,7 @@ ul.groups {
18
15
  display: grid;
19
16
  grid-template-columns: repeat(4, 1fr);
20
17
  grid-auto-flow: dense;
21
- gap: 30px;
18
+ gap: 1.875em;
22
19
  padding: 0px;
23
20
  margin: 1em 15px 0px; /* top sides bottom */
24
21
  }
@@ -28,7 +25,6 @@ ul.groups.wide {
28
25
  ul.groups li {
29
26
  display: block;
30
27
  width: 100%;
31
- max-width: 270px;
32
28
  margin: 0px;
33
29
  background: #ffffff;
34
30
  text-align: center;
@@ -38,8 +34,8 @@ ul.groups li {
38
34
  border-radius: 3px;
39
35
  justify-self: center;
40
36
  }
41
- ul.groups.wide li {
42
- max-width: 570px;
37
+ ul.groups a {
38
+ color: black;
43
39
  }
44
40
 
45
41
  /* Small screens only */
@@ -57,11 +53,12 @@ ul.groups li figure {
57
53
  }
58
54
  ul.groups li figure div {
59
55
  height: 0px;
60
- padding-bottom: 74.075%; /* 200:270 ratio */
56
+ padding-bottom: 75%; /* 300:400 ratio */
61
57
  background: no-repeat center;
58
+ background-size: cover;
62
59
  }
63
60
  ul.groups.wide li figure div {
64
- padding-bottom: 43.860%; /* 250:570 ratio */
61
+ padding-bottom: 44.186%; /* 380:860 ratio */
65
62
  }
66
63
  ul.groups li figcaption {
67
64
  display: block;
@@ -73,7 +70,7 @@ ul.groups li figcaption {
73
70
  ul.groups li em {
74
71
  display: inline-block;
75
72
  margin-top: 0.5em;
76
- font-size: 90%;
73
+ font-size: 0.9em;
77
74
  }
78
75
 
79
76
  ul.groups li:hover, ul.groups li:focus {
@@ -30,7 +30,7 @@ RSpec.describe Intranet::Pictures::JsonDbProvider do
30
30
  end
31
31
 
32
32
  it 'should return the available group types' do
33
- expect(@provider.group_types).to eql(%w[group1 group2])
33
+ expect(@provider.group_types).to eql(%w[group1 group2 group3])
34
34
  end
35
35
  end
36
36
 
@@ -54,6 +54,12 @@ RSpec.describe Intranet::Pictures::JsonDbProvider do
54
54
  { 'id' => 'group2_title3', 'title' => 'Group 2, Title 3', 'value' => 'aabb' }
55
55
  ]
56
56
  )
57
+ expect(@provider.list_groups('group3')).to eql(
58
+ [
59
+ { 'id' => 'group3_title1', 'title' => 'Group 3, Title 1' },
60
+ { 'id' => 'group3_title2', 'title' => 'Group 3, Title 2' }
61
+ ]
62
+ )
57
63
  end
58
64
 
59
65
  it 'should return only the groups matching the given +selector+' do
@@ -87,7 +93,14 @@ RSpec.describe Intranet::Pictures::JsonDbProvider do
87
93
  ]
88
94
  )
89
95
 
90
- selector = { 'group3' => 'foo_bar_boz' } # referencing undefined fields
96
+ selector = { 'value' => true }
97
+ expect(@provider.list_groups('group3', selector)).to eql(
98
+ [
99
+ { 'id' => 'group3_title2', 'title' => 'Group 3, Title 2' }
100
+ ]
101
+ )
102
+
103
+ selector = { 'group4' => 'foo_bar_boz' } # referencing undefined fields
91
104
  expect(@provider.list_groups('group2', selector)).to eql([])
92
105
  end
93
106
  end
@@ -132,10 +145,10 @@ RSpec.describe Intranet::Pictures::JsonDbProvider do
132
145
  it 'should return the list of pictures without the uri key' do
133
146
  expect(@provider.list_pictures).to eql(
134
147
  [
135
- { 'datetime' => '2019:07:22 09:41:31', 'group1' => 'group1_title1', 'group2' => 'group2_title2' },
148
+ { 'datetime' => '2019:07:22 09:41:31', 'group1' => 'group1_title1', 'group2' => 'group2_title2', 'group3' => 'group3_title1' },
136
149
  { 'datetime' => '2020:06:19 07:51:05', 'value' => false, 'group1' => 'group1_title2', 'group2' => 'group2_title2' },
137
150
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' },
138
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' },
151
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' },
139
152
  { 'datetime' => '2019:07:22 09:45:17', 'group1' => 'group1_title1', 'group2' => 'group2_title3' }
140
153
  ]
141
154
  )
@@ -147,7 +160,7 @@ RSpec.describe Intranet::Pictures::JsonDbProvider do
147
160
  [
148
161
  { 'datetime' => '2020:06:19 07:51:05', 'value' => false, 'group1' => 'group1_title2', 'group2' => 'group2_title2' },
149
162
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' },
150
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' }
163
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' }
151
164
  ]
152
165
  )
153
166
  end
@@ -159,14 +172,14 @@ RSpec.describe Intranet::Pictures::JsonDbProvider do
159
172
  [
160
173
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' },
161
174
  { 'datetime' => '2020:06:19 07:51:05', 'value' => false, 'group1' => 'group1_title2', 'group2' => 'group2_title2' },
162
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' }
175
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' }
163
176
  ]
164
177
  )
165
178
 
166
179
  expect(@provider.list_pictures(selector, 'datetime', false)).to eql(
167
180
  [
168
181
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' },
169
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' },
182
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' },
170
183
  { 'datetime' => '2020:06:19 07:51:05', 'value' => false, 'group1' => 'group1_title2', 'group2' => 'group2_title2' }
171
184
  ]
172
185
  )
@@ -71,25 +71,25 @@ RSpec.describe Intranet::Pictures::Responder do
71
71
  describe '#generate_page' do
72
72
  def photoswipe_markup # rubocop:disable Metrics/MethodLength
73
73
  "<div aria-hidden class='pswp' role='dialog' tabindex='-1'>\n" \
74
- "<div class='pswp__bg'></div>\n" \
75
- "<div class='pswp__scroll-wrap'>\n" \
76
- "<div class='pswp__container'>\n" \
77
- "<div class='pswp__item'></div>\n" \
78
- "<div class='pswp__item'></div>\n" \
79
- "<div class='pswp__item'></div>\n" \
80
- "</div>\n" \
81
- "<div class='pswp__ui pswp__ui--hidden'>\n" \
82
- "<div class='pswp__top-bar'>\n" \
83
- "<div class='pswp__counter'></div>\n" \
84
- "<button class='pswp__button pswp__button--close' title='#{I18n.t('pictures.viewer.close')} (Esc)'></button>\n" \
85
- "<button class='pswp__button pswp__button--fs' title='#{I18n.t('pictures.viewer.fullscreen')}'></button>\n" \
86
- "<button class='pswp__button pswp__button--zoom' title='#{I18n.t('pictures.viewer.zoom')}'></button>\n" \
87
- "<div class='pswp__preloader'>\n<div class='pswp__preloader__icn'>\n<div class='pswp__preloader__cut'>\n<div class='pswp__preloader__donut'></div>\n</div>\n</div>\n</div>\n</div>\n" \
88
- "<div class='pswp__share-modal pswp__share-modal--hidden pswp__single-tap'>\n<div class='pswp__share-tooltip'></div>\n</div>\n" \
89
- "<button class='pswp__button pswp__button--arrow--left' title='#{I18n.t('pictures.viewer.previous')}'></button>\n" \
90
- "<button class='pswp__button pswp__button--arrow--right' title='#{I18n.t('pictures.viewer.next')}'></button>\n" \
91
- "<div class='pswp__caption'>\n<div class='pswp__caption__center'></div>\n</div>\n" \
92
- "</div>\n</div>\n</div>\n\n"
74
+ "<div class='pswp__bg'></div>\n" \
75
+ "<div class='pswp__scroll-wrap'>\n" \
76
+ "<div class='pswp__container'>\n" \
77
+ "<div class='pswp__item'></div>\n" \
78
+ "<div class='pswp__item'></div>\n" \
79
+ "<div class='pswp__item'></div>\n" \
80
+ "</div>\n" \
81
+ "<div class='pswp__ui pswp__ui--hidden'>\n" \
82
+ "<div class='pswp__top-bar'>\n" \
83
+ "<div class='pswp__counter'></div>\n" \
84
+ "<button class='pswp__button pswp__button--close' title='#{I18n.t('pictures.viewer.close')} (Esc)'></button>\n" \
85
+ "<button class='pswp__button pswp__button--fs' title='#{I18n.t('pictures.viewer.fullscreen')}'></button>\n" \
86
+ "<button class='pswp__button pswp__button--zoom' title='#{I18n.t('pictures.viewer.zoom')}'></button>\n" \
87
+ "<div class='pswp__preloader'>\n<div class='pswp__preloader__icn'>\n<div class='pswp__preloader__cut'>\n<div class='pswp__preloader__donut'></div>\n</div>\n</div>\n</div>\n</div>\n" \
88
+ "<div class='pswp__share-modal pswp__share-modal--hidden pswp__single-tap'>\n<div class='pswp__share-tooltip'></div>\n</div>\n" \
89
+ "<button class='pswp__button pswp__button--arrow--left' title='#{I18n.t('pictures.viewer.previous')}'></button>\n" \
90
+ "<button class='pswp__button pswp__button--arrow--right' title='#{I18n.t('pictures.viewer.next')}'></button>\n" \
91
+ "<div class='pswp__caption'>\n<div class='pswp__caption__center'></div>\n</div>\n" \
92
+ "</div>\n</div>\n</div>\n\n"
93
93
  end
94
94
 
95
95
  context 'when asked for \'/index.html\'' do
@@ -404,9 +404,9 @@ RSpec.describe Intranet::Pictures::Responder do
404
404
  query = { 'group2' => 'group2_title2' }
405
405
  code, mime, content = @responder.generate_page('/api/group/group2', query)
406
406
  expect(code).to eql(200)
407
- expect(mime).to eql('image/jpeg')
407
+ expect(mime).to eql('image/svg+xml')
408
408
  expect(content).to eql(
409
- File.read(File.join(__dir__, '../../../lib/intranet/resources/www/group_thumbnail.jpg'))
409
+ File.read(File.join(__dir__, '../../../lib/intranet/resources/www/group_thumbnail.svg'))
410
410
  )
411
411
 
412
412
  # Existing group with non-existant thumbnail
@@ -426,10 +426,10 @@ RSpec.describe Intranet::Pictures::Responder do
426
426
  expect(mime).to eql('application/json')
427
427
  expect(content).to eql(
428
428
  [
429
- { 'datetime' => '2019:07:22 09:41:31', 'group1' => 'group1_title1', 'group2' => 'group2_title2' },
429
+ { 'datetime' => '2019:07:22 09:41:31', 'group1' => 'group1_title1', 'group2' => 'group2_title2', 'group3' => 'group3_title1' },
430
430
  { 'datetime' => '2020:06:19 07:51:05', 'value' => false, 'group1' => 'group1_title2', 'group2' => 'group2_title2' },
431
431
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' },
432
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' },
432
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' },
433
433
  { 'datetime' => '2019:07:22 09:45:17', 'group1' => 'group1_title1', 'group2' => 'group2_title3' }
434
434
  ].to_json
435
435
  )
@@ -442,7 +442,7 @@ RSpec.describe Intranet::Pictures::Responder do
442
442
  expect(content).to eql(
443
443
  [
444
444
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' },
445
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' }
445
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' }
446
446
  ].to_json
447
447
  )
448
448
 
@@ -453,7 +453,7 @@ RSpec.describe Intranet::Pictures::Responder do
453
453
  expect(mime).to eql('application/json')
454
454
  expect(content).to eql(
455
455
  [
456
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' },
456
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' },
457
457
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' }
458
458
  ].to_json
459
459
  )
@@ -464,7 +464,7 @@ RSpec.describe Intranet::Pictures::Responder do
464
464
  expect(mime).to eql('application/json')
465
465
  expect(content).to eql(
466
466
  [
467
- { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3' },
467
+ { 'datetime' => '2020:06:20 06:09:54', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title3', 'group3' => 'group3_title2' },
468
468
  { 'datetime' => '2020:06:20 18:14:09', 'value' => true, 'group1' => 'group1_title2', 'group2' => 'group2_title1' }
469
469
  ].to_json
470
470
  )
@@ -32,6 +32,16 @@
32
32
  "title": "Group 2, Title 3",
33
33
  "value": "aabb"
34
34
  }
35
+ ],
36
+ "group3": [
37
+ {
38
+ "id": "group3_title1",
39
+ "title": "Group 3, Title 1"
40
+ },
41
+ {
42
+ "id": "group3_title2",
43
+ "title": "Group 3, Title 2"
44
+ }
35
45
  ]
36
46
  },
37
47
  "pictures": [
@@ -39,7 +49,8 @@
39
49
  "uri": "white.jpg",
40
50
  "datetime": "2019:07:22 09:41:31",
41
51
  "group1": "group1_title1",
42
- "group2": "group2_title2"
52
+ "group2": "group2_title2",
53
+ "group3": "group3_title1"
43
54
  },
44
55
  {
45
56
  "uri": "./alpha.png",
@@ -60,7 +71,8 @@
60
71
  "datetime": "2020:06:20 06:09:54",
61
72
  "value": true,
62
73
  "group1": "group1_title2",
63
- "group2": "group2_title3"
74
+ "group2": "group2_title3",
75
+ "group3": "group3_title2"
64
76
  },
65
77
  {
66
78
  "datetime": "2019:07:22 09:45:17",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intranet-pictures
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ebling Mis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
11
+ date: 2021-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: intranet-core
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '2.0'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 2.2.0
22
+ version: 2.4.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '2.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 2.2.0
32
+ version: 2.4.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: mimemagic
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,7 @@ files:
128
128
  - lib/intranet/resources/haml/pictures_photoswipe.haml
129
129
  - lib/intranet/resources/locales/en.yml
130
130
  - lib/intranet/resources/locales/fr.yml
131
- - lib/intranet/resources/www/group_thumbnail.jpg
131
+ - lib/intranet/resources/www/group_thumbnail.svg
132
132
  - lib/intranet/resources/www/jpictures.js
133
133
  - lib/intranet/resources/www/photoswipe/LICENSE
134
134
  - lib/intranet/resources/www/photoswipe/default-skin/default-skin.css
@@ -167,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.7.6.2
170
+ rubygems_version: 3.2.5
172
171
  signing_key:
173
172
  specification_version: 4
174
173
  summary: Pictures gallery module for the intranet.