sibu 0.8.0 → 0.9.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
2
  SHA1:
3
- metadata.gz: d1e386778852e44a0751ec065d259a3d02423e04
4
- data.tar.gz: 63734db5d138f1a863428a8990c8abc901c6dbce
3
+ metadata.gz: 581dc6f007ee79baca625913bb3d2435cd4d6670
4
+ data.tar.gz: de20141f770bb6ff3143b4bc7e0610f108d8c6d1
5
5
  SHA512:
6
- metadata.gz: e82342f402b119115ed0fa6e76c2c1ba819847022ccb0ab45e890d8ddcc171b792b95287b99004b4b2c02122f152e1210f85677dff984e922beb4144b8c5a8cc
7
- data.tar.gz: 168e70cca77e87181e289a5e624bfe60eadca752d35d95c80f31b66b4d68af3ba89409822fe1caadf1182e7af1ac3f767491051b27de47fada7ae950a08af645
6
+ metadata.gz: 98dd538ee917b5e7a8aebc3c41c61b0698952b8a79d4f824032c2faab88f87497991bb37738e6be959cc1a6de0644974de52c1fc9662061ace4f971365ef8967
7
+ data.tar.gz: 7c025d653c4d53144abda8dafb419075941b216318dc19f0ab63aa7cb8c40916dc566c0b2e7c6f1948188d574aafdf61d0d453913e72895987dbb4599de6fd6e
@@ -113,6 +113,7 @@ function initQuillEditor(container) {
113
113
  function initCustomCenter() {
114
114
  var wrapper = $(".sibu_center > img"), centerPos = $(".sibu_center > #sibu_center_pos");
115
115
  displayCurrentCenter(wrapper[0], centerPos);
116
+ $(".sibu_center > #sibu_center_desc").show();
116
117
  wrapper.click(function(e) {
117
118
  var rect = e.target.getBoundingClientRect();
118
119
  var x = e.clientX - rect.left;
@@ -58,6 +58,10 @@ $sibu-color3 : #333 !default;
58
58
  &.selected {
59
59
  background-color: $sibu-color3;
60
60
  }
61
+
62
+ &:hover {
63
+ cursor: pointer;
64
+ }
61
65
  }
62
66
 
63
67
  .sibu_form {
@@ -163,35 +167,6 @@ $sibu-color3 : #333 !default;
163
167
  width: 70%;
164
168
  max-height: calc(100vh - 300px);
165
169
  overflow: auto;
166
-
167
- .sibu_image {
168
- position: relative;
169
- span {
170
- position: absolute;
171
- z-index: -1;
172
- line-height: 1;
173
- width: 100%;
174
- text-align: center;
175
- top: 30px;
176
-
177
- & + .selected {
178
- background-color: transparentize($sibu-color3, 0.5);
179
- }
180
- }
181
- }
182
-
183
- img {
184
- padding: 5px;
185
- border: 1px solid $sibu-color3;
186
-
187
- &.selected {
188
- background-color: $sibu-color3;
189
- }
190
-
191
- &:hover {
192
- cursor: pointer;
193
- }
194
- }
195
170
  }
196
171
 
197
172
  .sibu_selected_image {
@@ -219,6 +194,12 @@ $sibu-color3 : #333 !default;
219
194
  color: white;
220
195
  text-shadow: 0 2px grey;
221
196
  }
197
+
198
+ #sibu_center_desc {
199
+ font-size: 10px;
200
+ line-height: 1.2;
201
+ margin-top: 5px;
202
+ }
222
203
  }
223
204
  }
224
205
 
@@ -258,34 +239,14 @@ $sibu-color3 : #333 !default;
258
239
  max-height: 60vh;
259
240
  overflow-y: scroll;
260
241
 
261
- > div {
262
- > * {
263
- padding: 2rem;
264
- border-bottom: 2px solid $sibu-color1;
265
- &:hover {
266
- cursor: pointer;
267
- outline: dashed $sibu-color2 4px;
268
- outline-offset: -5px;
269
- }
270
-
271
- &.selected {
272
- outline: solid $sibu-color2 5px;
273
- outline-offset: -5px;
274
- }
275
-
276
- > * {
277
- margin-top: 0 !important;
278
- margin-bottom: 0 !important;
279
- }
280
- }
281
- }
282
-
283
242
  .tabs__list {
284
243
  margin: 0;
285
244
  padding: 0;
245
+ display: table;
246
+ width: 100%;
286
247
  }
287
248
  .tabs__item {
288
- display: inline-block;
249
+ display: table-cell;
289
250
  > a {
290
251
  text-decoration: none;
291
252
  }
@@ -317,8 +278,33 @@ $sibu-color3 : #333 !default;
317
278
  }
318
279
 
319
280
  .tabs__content {
320
- padding: 3rem 2rem;
281
+ padding: 2rem 0;
321
282
  background-color: white;
283
+ max-height: calc(100% - 40px);
284
+ overflow-y: scroll;
285
+
286
+ > * {
287
+ padding: 4px 0;
288
+ margin: 0 1rem 2rem 1rem;
289
+ min-height: auto;
290
+ box-shadow: 0 0 5px #cdcdcd;
291
+
292
+ &:hover {
293
+ cursor: pointer;
294
+ outline: dashed $sibu-color2 4px;
295
+ outline-offset: -5px;
296
+ }
297
+
298
+ &.selected {
299
+ outline: solid $sibu-color1 5px;
300
+ outline-offset: -5px;
301
+ }
302
+
303
+ > * {
304
+ margin-top: 0 !important;
305
+ margin-bottom: 0 !important;
306
+ }
307
+ }
322
308
  }
323
309
 
324
310
  [aria-hidden="true"].tabs__content {
@@ -12,7 +12,7 @@ module Sibu
12
12
  end
13
13
 
14
14
  def site_images
15
- ([Sibu::Image.empty] + Sibu::Image.for_user(sibu_user)).uniq
15
+ Sibu::Image.for_user(sibu_user).uniq
16
16
  end
17
17
 
18
18
  def available_links
@@ -3,7 +3,8 @@ module Sibu
3
3
  include ActiveSupport::Concern
4
4
 
5
5
  def for_user(usr)
6
- Rails.application.config.sibu[:multi_user] ? where(user_id: [nil, usr.id]) : all
6
+ entities = (Rails.application.config.sibu[:multi_user] ? where(user_id: [nil, usr.id]) : all)
7
+ entities.order(updated_at: :desc)
7
8
  end
8
9
  end
9
10
  end
@@ -6,14 +6,5 @@ module Sibu
6
6
  store :metadata, accessors: [:alt, :reference, :credits], coder: JSON
7
7
 
8
8
  validates_presence_of :file_data
9
-
10
- def self.empty
11
- empty_img = where("metadata ILIKE '%default_empty_image%'").first
12
- if empty_img.nil?
13
- empty_img = new(reference: 'default_empty_image', file: File.new('app/assets/images/empty.png'))
14
- empty_img.save
15
- end
16
- empty_img
17
- end
18
9
  end
19
10
  end
@@ -1,4 +1,4 @@
1
- <div class="sibu_view">
1
+ <div id="documents" class="sibu_view">
2
2
  <div class="actions">
3
3
  <%= link_to 'Télécharger un document', new_document_path %> <%= link_to 'Retour', :back %>
4
4
  </div>
@@ -1,13 +1,31 @@
1
- <div class="sibu_view">
1
+ <div id="images" class="sibu_view">
2
2
  <div class="actions">
3
3
  <%= link_to 'Télécharger une image', new_image_path %> <%= link_to 'Retour', :back %>
4
4
  </div>
5
5
  <h2>Images téléchargées</h2>
6
- <div class="sibu_images">
6
+ <table class="sibu_images">
7
+ <thead>
8
+ <tr>
9
+ <th>Aperçu</th>
10
+ <th>Descriptif</th>
11
+ <th>Crédits</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
7
15
  <% @images.each do |image| %>
8
- <%= link_to image_tag(image.file_url(:small)), edit_image_path(image.id), class: 'sibu_image', id: "sibu_image_#{image.id}", remote: true %>
16
+ <tr>
17
+ <td><%= link_to image_tag(image.file_url(:small)), edit_image_path(image.id), class: 'sibu_image', id: "sibu_image_#{image.id}", remote: true %></td>
18
+ <td><%= image.alt %></td>
19
+ <td><%= image.credits %></td>
20
+ </tr>
9
21
  <% end %>
10
- </div>
22
+ <% if @images.empty? %>
23
+ <tr>
24
+ <td colspan="3">Aucune image téléchargée pour le moment.</td>
25
+ </tr>
26
+ <% end %>
27
+ </tbody>
28
+ </table>
11
29
  <div class="sibu_edit_image">Sélectionnez une image pour voir ses informations.</div>
12
30
  </div>
13
31
 
@@ -7,13 +7,29 @@
7
7
  <div class="sibu_select_images sibu_field">
8
8
  <p>Sélectionnez ou <%= link_to 'téléchargez', new_image_path(page_id: @page.id, section_id: @section_id, entity_type: @entity_type,
9
9
  element_id: @element_id, img_id: @element["id"], size: @size) %> une image</p>
10
- <% site_images.each_with_index do |image, i| %>
11
- <div class="sibu_image" data-img-id="<%= image.id %>">
12
- <% if i == 0 %><span>Aucune image</span><% end %>
13
- <%= image_tag image.file_url(:small), class: (@element["src"] == image.file_url(@size) ? 'selected' : ''),
14
- data: {src: image.file_url(@size), alt: image.alt} %>
15
- </div>
16
- <% end %>
10
+ <table class="sibu_images">
11
+ <thead>
12
+ <tr>
13
+ <th>Aperçu</th>
14
+ <th>Descriptif</th>
15
+ <th>Crédits</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% site_images.each do |image| %>
20
+ <tr>
21
+ <td>
22
+ <span class="sibu_image" data-img-id="<%= image.id %>">
23
+ <%= image_tag image.file_url(:small), class: (@element["src"] == image.file_url(@size) ? 'selected' : ''),
24
+ data: {src: image.file_url(@size), alt: image.alt} %>
25
+ </span>
26
+ </td>
27
+ <td><%= image.alt %></td>
28
+ <td><%= image.credits %></td>
29
+ </tr>
30
+ <% end %>
31
+ </tbody>
32
+ </table>
17
33
  </div>
18
34
  <div class="sibu_selected_image">
19
35
  <% if @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
@@ -26,6 +42,7 @@
26
42
  <div class="sibu_center">
27
43
  <%= image_tag(@element["src"]) unless @element["src"] == DEFAULT_IMG || @element["src"].blank? %>
28
44
  <div id="sibu_center_pos" style="display: none;">✕</div>
45
+ <div id="sibu_center_desc" style="display: none;"><em>Cliquez sur l'image pour la recentrer sur un point donné (à utiliser lorsque l'image est tronquée car la zone d'affichage est trop petite).</em></div>
29
46
  </div>
30
47
  <div class="sibu_field" style="display: <%= (@element["src"] == DEFAULT_IMG || @element["src"].blank?) ? 'none' : 'block' %>">
31
48
  <%= label_tag 'element[alt]', 'Légende / texte alternatif' %>
@@ -38,15 +38,19 @@ editPanel.slideDown("fast", function() {
38
38
  "text-align": wrapper.css("text-align")
39
39
  });
40
40
  <% when 'media' %>
41
- var images = editPanel.find(".sibu_image img");
42
- var customCenter = $("#custom_center"), customCtr;
41
+ var images = editPanel.find(".sibu_image");
42
+ var customCenter = $("#custom_center");
43
43
  images.click(function() {
44
44
  if(!$(this).hasClass('selected')) {
45
45
  images.removeClass('selected');
46
46
  $(this).addClass('selected');
47
- $("#element_src").val($(this).data("src"));
48
- $("#element_alt").val($(this).data("alt"));
49
- editPanel.find(".sibu_center").html('<img src="' + $("#element_src").val() + '"/><div id="sibu_center_pos" style="display: none;">✕</div>');
47
+ var imgElt = $(this).find("img");
48
+ $("#element_src").val(imgElt.data("src"));
49
+ $("#element_alt").val(imgElt.data("alt"));
50
+ editPanel.find(".sibu_center").html(
51
+ '<img src="' + $("#element_src").val() + '"/>' +
52
+ '<div id="sibu_center_pos" style="display: none;">✕</div>' +
53
+ '<div id="sibu_center_desc" style="display: none;"><em>Cliquez sur l\'image pour la recentrer sur un point donné (à utiliser lorsque l\'image est tronquée car la zone d\'affichage est trop petite)</em></div>');
50
54
  editPanel.find(".sibu_selected_image > p:first-child").hide();
51
55
  editPanel.find(".sibu_selected_image").find(".sibu_custom_center").show();
52
56
  editPanel.find(".sibu_selected_image").find(".sibu_field").show();
@@ -69,6 +73,7 @@ editPanel.slideDown("fast", function() {
69
73
  $("#element_class").val("");
70
74
  $(".sibu_center").attr("style", "");
71
75
  $(".sibu_center > #sibu_center_pos").hide();
76
+ $(".sibu_center > #sibu_center_desc").hide();
72
77
  }
73
78
  });
74
79
  <% when 'link' %>
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.8.0'
2
+ VERSION = '0.9.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Baptiste Vilain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.1.6
19
+ version: '5.0'
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: 5.1.6
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pg
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.2'
33
+ version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.2'
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: shrine
43
43
  requirement: !ruby/object:Gem::Requirement