lentil 0.6.0 → 0.7.1

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: d0071e0e9cac7e3e22897146471625cdc522ca8b
4
- data.tar.gz: d25b8819f50541f248855b0ac6584bad2ce256d7
3
+ metadata.gz: a11b089a6d4bc21efe829d74b7a25f32d5fe9ca8
4
+ data.tar.gz: 874ae943f1002737d9e86e4cce251c3f6947743e
5
5
  SHA512:
6
- metadata.gz: b6fd1f6e993cfa866b1448ba22e0a07a7f5750cc3a527d1a9a2b247c39fcdb324ae97fb177ad4cb4f7a91f0f61cdac0f81a2e12e5ee230920f1adabed2977358
7
- data.tar.gz: 878f9f2cbadd5fb71b9804c07d2235a90390c13c126086b6cecca2dd6cdbd09992c426e680280bd554485c7b8c62a403b006c757583056a9fb2fdbd1faaa0b89
6
+ metadata.gz: 999ac34b75ce666a04275af1122df4df9778893e41c5821adf1aa6b3399af3310c1b1e1bf072290a19ae96a6d855e4391d4c4fecb7369a8161038dfdbf0ccb87
7
+ data.tar.gz: 97fb8b1ef0881f6ba6de165f4d30f03c52b8248528fa53111c26aa1a6b44137331e83c0c1100a7b5139d602d647cf0b8ca11236e94102e36f5d38c833ae3fe3e
data/README.md CHANGED
@@ -169,7 +169,7 @@ div.header {
169
169
 
170
170
  ### Embeddable iframe view
171
171
 
172
- This is a simple responsive non-interactive image grid that is intended to be embedded as an iframe. You can find this at `http://YOUR_HOST/images/iframe`.
172
+ This is a simple responsive non-interactive image grid that is intended to be embedded as an iframe. You can find this at `http://YOUR_HOST/images/iframe`. Image sizes in the grid are determined using a range of possible image widths, with the smallest width defaulting to 64px and the largest width calculated as 1.5 times the smallest width. The smallest width may be configured by including an integer parameter to the iframe URL, for example: `http://YOUR_HOST/images/iframe?smallest_width=40`. Currently, values greater than 320 may result in loss of resolution.
173
173
 
174
174
  ### Large animated view
175
175
 
@@ -34,6 +34,9 @@ function addinfinitescroll() {
34
34
  },
35
35
  function () {
36
36
  addimageerrors();
37
+
38
+ addobjectfit();
39
+
37
40
  // on callback, if fancybox is open
38
41
  // then close it and reopen at the same spot
39
42
  // this fakes dynamic loading of new images
@@ -0,0 +1,9 @@
1
+ //= require polyfill.object-fit/polyfill.object-fit
2
+
3
+ function addobjectfit() {
4
+ objectFit.polyfill({
5
+ selector: '.square-media',
6
+ fittype: 'cover',
7
+ disableCrossDomain: 'true'
8
+ });
9
+ }
@@ -1,3 +1,5 @@
1
+ //= require lentil/addobjectfit
2
+
1
3
  (function () {
2
4
  var Iframe = {
3
5
  init: function () {
@@ -10,12 +12,14 @@
10
12
 
11
13
  // Remove images that error out
12
14
  images = document.getElementsByClassName('instagram-img');
13
- for (var i = 1; i < images.length; i++) {
15
+ for (var i = 0; i < images.length; i++) {
14
16
  images[i].addEventListener('error', function (e) {
15
17
  e.srcElement.parentNode.remove();
16
18
  }, false);
17
19
  }
18
20
 
21
+ addobjectfit();
22
+
19
23
  // Respond to viewport changes
20
24
  window.onresize = function (event) {
21
25
  self.buildFrame();
@@ -87,8 +91,8 @@
87
91
  height = window.innerHeight;
88
92
 
89
93
  // Acceptable image sizes
90
- smallestImage = 64;
91
- largestImage = 97;
94
+ smallestImage = lentil_smallest_width; // Global variable from view
95
+ largestImage = smallestImage * 1.5;
92
96
 
93
97
  mostColumns = Math.ceil(width/smallestImage);
94
98
  leastColumns = Math.ceil(width/largestImage);
@@ -101,7 +105,8 @@
101
105
  // Set width of images to build layout
102
106
  images = document.getElementsByClassName('iframe-tile');
103
107
  for (var i = 0; i < images.length; i++) {
104
- images[i].style.width = String(percent) + '%';
108
+ images[i].style.width = String(percent) + 'vw';
109
+ images[i].style.height = String(percent) + 'vw';
105
110
  }
106
111
 
107
112
  // Set height of wrapper div for overflow
@@ -1,8 +1,5 @@
1
1
  function addimageerrors() {
2
2
  $(".instagram-img, .battle-img, .fancybox-img, .fancybox-video").off("error").on("error", function () {
3
3
  $(this).parents("div.image-tile, li.image-animate-tile").remove();
4
- /*if ($("body.images_animate") || $("body.images_staff_picks_animate")) {
5
- addanimatedimages();
6
- }*/
7
4
  });
8
5
  }
@@ -9,6 +9,7 @@
9
9
  //= require lentil/imageerrors
10
10
  //= require lentil/addanimatedimages
11
11
  //= require touchswipe/jquery.touchSwipe
12
+ //= require lentil/addobjectfit
12
13
 
13
14
  // wrapped in anonymous function so FANCYBOX_SPINNER
14
15
  // is accessible by both addinfinitescroll and addfancybox
@@ -40,6 +41,7 @@
40
41
  $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
41
42
 
42
43
  addimageerrors();
44
+ addobjectfit();
43
45
 
44
46
  if (window.history.pushState) {
45
47
  addfancybox();
@@ -52,4 +54,4 @@
52
54
  }
53
55
 
54
56
  });
55
- })();
57
+ })();
@@ -5,4 +5,5 @@
5
5
  @import "chosen";
6
6
  @import "lentil/images";
7
7
  @import "lentil/image_animation";
8
- @import "lentil/thisorthat";
8
+ @import "lentil/thisorthat";
9
+ @import "polyfill.object-fit/polyfill.object-fit";
@@ -89,7 +89,7 @@ div.grid {
89
89
 
90
90
  div.images {
91
91
  display:inline;
92
- // word-spacing: normal;
92
+ // word-spacing: normal;
93
93
  }
94
94
 
95
95
  .wrapper {
@@ -100,10 +100,44 @@ div.images {
100
100
  margin-top: 65px;
101
101
  }
102
102
 
103
- .image-tile {
103
+ /*Force square tiles*/
104
+ .image-tile, .image-animate-tile, .battle-image-tile > div, .header {
104
105
  position: relative;
105
- padding: 2px 4px 2px 4px;
106
- margin: 0;
106
+ padding: 0px;
107
+ overflow: hidden;
108
+
109
+ &:before {
110
+ content: "";
111
+ padding-top: 100%;
112
+ display: block;
113
+ }
114
+
115
+ > *:first-child {
116
+ position: absolute;
117
+ top: 0;
118
+ left: 0;
119
+ width: 100%;
120
+ height: 100%;
121
+ margin: 2px 4px 2px 4px;
122
+ overflow: hidden;
123
+
124
+ .square-media {
125
+ width: 100%;
126
+ height: 100%;
127
+ object-fit: cover;
128
+ overflow: hidden;
129
+ }
130
+ }
131
+ }
132
+
133
+ .image-animate-tile > a {
134
+ margin: 0 !important;
135
+ padding: 0 !important;
136
+ }
137
+
138
+ .header > div {
139
+ padding: 0px 10px 10px 10px !important;
140
+ margin: 2px 0px 0px 4px;
107
141
  }
108
142
 
109
143
  .text-overlay {
@@ -275,21 +309,21 @@ a.leaderboard {
275
309
  }
276
310
 
277
311
  .desktop-leaderboard-wrapper .btn {
278
- margin-left: -5px;
279
- background-color: hsl(200, 100%, 29%) !important;
280
- background-repeat: repeat-x;
281
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#00a6f9", endColorstr="#006293");
282
- background-image: -khtml-gradient(linear, left top, left bottom, from(#00a6f9), to(#006293));
283
- background-image: -moz-linear-gradient(top, #00a6f9, #006293);
284
- background-image: -ms-linear-gradient(top, #00a6f9, #006293);
285
- background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #00a6f9), color-stop(100%, #006293));
286
- background-image: -webkit-linear-gradient(top, #00a6f9, #006293);
287
- background-image: -o-linear-gradient(top, #00a6f9, #006293);
288
- background-image: linear-gradient(#00a6f9, #006293);
289
- border-color: #006293 #006293 hsl(200, 100%, 24%);
290
- color: #fff !important;
291
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.33);
292
- -webkit-font-smoothing: antialiased;
312
+ margin-left: -5px;
313
+ background-color: hsl(200, 100%, 29%) !important;
314
+ background-repeat: repeat-x;
315
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#00a6f9", endColorstr="#006293");
316
+ background-image: -khtml-gradient(linear, left top, left bottom, from(#00a6f9), to(#006293));
317
+ background-image: -moz-linear-gradient(top, #00a6f9, #006293);
318
+ background-image: -ms-linear-gradient(top, #00a6f9, #006293);
319
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #00a6f9), color-stop(100%, #006293));
320
+ background-image: -webkit-linear-gradient(top, #00a6f9, #006293);
321
+ background-image: -o-linear-gradient(top, #00a6f9, #006293);
322
+ background-image: linear-gradient(#00a6f9, #006293);
323
+ border-color: #006293 #006293 hsl(200, 100%, 24%);
324
+ color: #fff !important;
325
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.33);
326
+ -webkit-font-smoothing: antialiased;
293
327
  }
294
328
 
295
329
  // Photographer Info
@@ -2,8 +2,7 @@
2
2
  // =============================================================================
3
3
 
4
4
  @include breakpoint(6, $label: 'phone'){
5
- .header { font-size: .68em; }
6
- .image-tile { width: fluid(3); font-size: .68em; }
5
+ .image-tile, div.header { width: fluid(3); font-size: .68em; }
7
6
  .solo-image { width: fluid(6); font-size: .68em; }
8
7
  .side-filler { width: fluid(0);}
9
8
 
@@ -15,7 +14,7 @@
15
14
  }
16
15
 
17
16
  @include breakpoint(9, $label: 'phone'){
18
- .image-tile { width: fluid(3); }
17
+ .image-tile, div.header { width: fluid(3); }
19
18
  .solo-image { width: fluid(9); }
20
19
  .side-filler { width: fluid(0);}
21
20
  .trunc-small {display: none;}
@@ -24,7 +23,7 @@
24
23
  }
25
24
 
26
25
  @include breakpoint(12, $label: 'tablet'){
27
- .image-tile { width: fluid(4); font-size: 1.45em; }
26
+ .image-tile, div.header { width: fluid(4); font-size: 1.45em; }
28
27
  .solo-image { width: fluid(12); font-size: 1.45em; }
29
28
  .side-filler { width: fluid(0); }
30
29
 
@@ -68,7 +67,7 @@
68
67
  }
69
68
 
70
69
  @include breakpoint(18, $label: 'desktop'){
71
- .image-tile { width: fluid(6); }
70
+ .image-tile, div.header { width: fluid(6); }
72
71
  .solo-image { width: fluid(14); }
73
72
  .side-filler { width: fluid(2); }
74
73
  .contribute { width: fluid(14); }
@@ -87,11 +86,11 @@
87
86
  div.header {
88
87
  font-size: 1.6em;
89
88
  display: inline-block;
90
- height: 292px;
91
- width: 291px;
92
- margin: 2px 5px 0 4px ;
93
- padding: 0 10px 10px 10px;
94
- background: gray;
89
+
90
+ > div {
91
+ padding: 0 10px 10px 10px;
92
+ background: gray;
93
+ }
95
94
  }
96
95
 
97
96
  div.header h1 a {
@@ -172,7 +171,7 @@
172
171
  }
173
172
 
174
173
  @include breakpoint(24, $label: 'desktop'){
175
- .image-tile { width: fluid(6); }
174
+ .image-tile, div.header { width: fluid(6); }
176
175
  .solo-image { width: fluid(14); }
177
176
  .side-filler { width: fluid(5); }
178
177
 
@@ -193,13 +192,14 @@
193
192
  }
194
193
 
195
194
  @include breakpoint(30, $label: 'desktop'){
196
- .image-tile { width: fluid(6); }
195
+ .image-tile, div.header { width: fluid(6); }
197
196
  .solo-image { width: fluid(14); }
198
197
  .side-filler { width: fluid(8); }
199
198
  .contribute { width: fluid(15); }
200
199
  .pointofview { width: fluid(9); }
201
200
  .termsofuse { width: fluid(15); }
202
201
 
202
+
203
203
  // Battle View
204
204
  .battle-image-wrap { width: fluid(14); }
205
205
  .battle-image-tile { width: 80%; }
@@ -208,7 +208,7 @@
208
208
 
209
209
  @include breakpoint(36, $label: 'eboard') {
210
210
 
211
- .image-tile { width: fluid(6); }
211
+ .image-tile, div.header { width: fluid(6); }
212
212
  .solo-image { width: fluid(16); }
213
213
  .side-filler { width: fluid(10); }
214
214
 
@@ -218,5 +218,5 @@
218
218
  }
219
219
 
220
220
  @include breakpoint(124, $label: 'microtile'){
221
- .image-tile { width: fluid(8); }
221
+ .image-tile, div.header { width: fluid(8); }
222
222
  }
@@ -2,14 +2,22 @@
2
2
 
3
3
  // Styles for iframe view
4
4
  body.lentil-images_iframe {
5
- background: none;
6
- line-height: 0;
7
- margin: 0;
5
+ background: none;
6
+ line-height: 0;
7
+ margin: 0;
8
8
  }
9
9
 
10
10
  .lentil-images_iframe {
11
11
  img {
12
12
  margin: 0;
13
+ max-width: none;
14
+ width: 100%;
15
+ height: 100%;
16
+ }
17
+
18
+ .square-media {
19
+ object-fit: cover;
20
+ overflow: hidden;
13
21
  }
14
22
 
15
23
  #iframe-wrapper {
@@ -23,4 +31,4 @@ body.lentil-images_iframe {
23
31
  margin: 0;
24
32
  padding: 0;
25
33
  }
26
- }
34
+ }
@@ -57,8 +57,13 @@ module Lentil
57
57
  render 'animate'
58
58
  end
59
59
 
60
+ def numeric_string?(str)
61
+ Float(str) != nil rescue false
62
+ end
63
+
60
64
  def iframe
61
65
  @images = Image.includes(:user).approved.recent.limit(125)
66
+ @smallest_width = numeric_string?(params['smallest_width']) ? params['smallest_width'] : 64
62
67
  render :action => "iframe", :layout => "lentil/iframe"
63
68
  end
64
69
  end
@@ -10,6 +10,12 @@
10
10
 
11
11
  <%= meta_description_tag %>
12
12
  <%= stylesheet_link_tag "lentil/iframe", :media => "all" %>
13
+
14
+ <!-- Define global to make @smallest_width instance variable accessible to JS -->
15
+ <script>
16
+ var lentil_smallest_width = <%= @smallest_width %>;
17
+ </script>
18
+
13
19
  <%= javascript_include_tag "lentil/iframe" %>
14
20
  <%= yield :javascript_includes %>
15
21
 
@@ -3,11 +3,11 @@
3
3
  <div id="image_<%= image.id %>" class="grid__cell image-tile">
4
4
  <% unless image.media_type == "video" %>
5
5
  <%= link_to url_for(image), 'data-fancybox-href' => image.jpeg, 'data-fancybox-group' => "image-tile-gallery", :class => :fancybox do %>
6
- <%= image_tag(image.jpeg, :class => "instagram-img " + image.id.to_s, :alt => image.description, :data => {:battles_count => image.battles_count, :win_pct => image.win_pct, :popularity => image.popular_score, :staff_like => image.staff_like, :like_votes_count => image.like_votes_count, :media_type => image.media_type}) %>
6
+ <%= image_tag(image.jpeg, :class => "square-media instagram-img " + image.id.to_s, :alt => image.description, :data => {:battles_count => image.battles_count, :win_pct => image.win_pct, :popularity => image.popular_score, :staff_like => image.staff_like, :like_votes_count => image.like_votes_count, :media_type => image.media_type}) %>
7
7
  <% end %>
8
8
  <% else %>
9
9
  <%= link_to url_for(image), 'data-fancybox-href' => image.video_url, 'data-fancybox-group' => "image-tile-gallery", :class => :fancybox do %>
10
- <%= video_tag(image.video_url, :autoplay => "true", :muted => "true", :loop => "true", :class => "instagram-img-" + image.id.to_s, :class => "instagram-img " + image.id.to_s, :height => "100%", :width => "100%", :poster => image.jpeg, :data => {:battles_count => image.battles_count, :win_pct => image.win_pct, :popularity => image.popular_score, :staff_like => image.staff_like, :like_votes_count => image.like_votes_count, :media_type => image.media_type}) %>
10
+ <%= video_tag(image.video_url, :autoplay => "true", :muted => "true", :loop => "true", :class => "square-media instagram-img " + image.id.to_s, :height => "100%", :width => "100%", :poster => image.jpeg, :data => {:battles_count => image.battles_count, :win_pct => image.win_pct, :popularity => image.popular_score, :staff_like => image.staff_like, :like_votes_count => image.like_votes_count, :media_type => image.media_type}) %>
11
11
  <% end %>
12
12
  <% end %>
13
13
 
@@ -10,9 +10,9 @@
10
10
  <li class="image-animate-tile">
11
11
  <a href="#">
12
12
  <% unless image.media_type == "video" %>
13
- <%= image_tag(image.jpeg, :class => "instagram-img") %>
13
+ <%= image_tag(image.jpeg, :class => "square-media instagram-img") %>
14
14
  <% else %>
15
- <%= video_tag(image.video_url, :autoplay => "true", :muted => "true", :loop => "true", :poster => image.jpeg, :class => "instagram-img " + image.id.to_s, :height => "100%", :width => "100%", :data => {:media_type => image.media_type}) %>
15
+ <%= video_tag(image.video_url, :autoplay => "true", :muted => "true", :loop => "true", :poster => image.jpeg, :class => "square-media instagram-img " + image.id.to_s, :height => "100%", :width => "100%", :data => {:media_type => image.media_type}) %>
16
16
  <% end %>
17
17
  </a>
18
18
  </li>
@@ -24,4 +24,4 @@
24
24
  <h1 class="url"><%= link_to main_app.root_url, main_app.root_url %></h2>
25
25
  </div>
26
26
  </div>
27
- </div>
27
+ </div>
@@ -2,7 +2,7 @@
2
2
  <div id="iframe-wrapper">
3
3
  <% @images.each do |image| %>
4
4
  <div class="iframe-tile">
5
- <%= image_tag(image.thumbnail_url, :class => "instagram-img " + image.id.to_s, :alt => image.description) %>
5
+ <%= image_tag(image.medium_url, :class => "square-media instagram-img " + image.id.to_s, :alt => image.description) %>
6
6
  </div>
7
7
  <% end -%>
8
8
  </div>
@@ -1,7 +1,7 @@
1
- <% content_for :feed_auto_discovery do %>
2
- <%# FIXME: Let's revisit this for whether it ought to be on each page and what the purpose is. %>
3
- <%= auto_discovery_link_tag(:rss, params.dup.merge({:format => :rss}) ) %>
4
- <%= auto_discovery_link_tag(:atom, params.dup.merge({:format => :atom}) ) %>
1
+ <% content_for :feed_auto_discovery do %>
2
+ <%# FIXME: Let's revisit this for whether it ought to be on each page and what the purpose is. %>
3
+ <%= auto_discovery_link_tag(:rss, params.dup.merge({:format => :rss}) ) %>
4
+ <%= auto_discovery_link_tag(:atom, params.dup.merge({:format => :atom}) ) %>
5
5
  <% end -%>
6
6
  <% title @title %>
7
7
  <%= render :partial => "/layouts/lentil/top_navigation" %>
@@ -27,23 +27,25 @@
27
27
  <section class="wrapper">
28
28
  <div class="grid">
29
29
  <div class="grid__cell header">
30
- <h1><%= link_to application_name, main_app.root_path %></h1>
31
- <ul class="header_nav">
32
- <li><%= nav_link t('lentil.nav.battle'), :thisorthat_battle %></li>
33
- <li><%= nav_link t('lentil.nav.about'), :pages_about %></li>
34
- </ul>
35
- <ul class="header_nav">
36
- <li><%= nav_link t('lentil.nav.recent'), main_app.root_path %></a></li>
30
+ <div>
31
+ <h1><%= link_to application_name, main_app.root_path %></h1>
32
+ <ul class="header_nav">
33
+ <li><%= nav_link t('lentil.nav.battle'), :thisorthat_battle %></li>
34
+ <li><%= nav_link t('lentil.nav.about'), :pages_about %></li>
35
+ </ul>
36
+ <ul class="header_nav">
37
+ <li><%= nav_link t('lentil.nav.recent'), main_app.root_path %></a></li>
37
38
  <li><%= nav_link t('lentil.nav.popular'), :images_popular %></li>
38
39
  <li><%= nav_link t('lentil.nav.staff_picks'), :images_staff_picks %></li>
39
40
  </ul>
40
41
  </div>
41
- <%= render :partial => "/lentil/images/image_tiles" %>
42
42
  </div>
43
+ <%= render :partial => "/lentil/images/image_tiles" %>
44
+ </div>
43
45
  <% if params[:controller] == "lentil/images" %>
44
46
  <div id="paging">
45
47
  <%= will_paginate @images %>
46
48
  </div>
47
49
  <% end -%>
48
50
  </section>
49
- <div id="spinner-overlay" style="display:none;"></div>
51
+ <div id="spinner-overlay" style="display:none;"></div>