diff --git a/Gemfile b/Gemfile index 8537a9e532..a9a5d99fa6 100644 --- a/Gemfile +++ b/Gemfile @@ -70,6 +70,7 @@ gem 'lemmatizer', '~> 0.2.2' gem 'mailman', require: false # To implement fontawesome v4.7.0 gem "font-awesome-rails" + gem "lazyload-rails" # To convert html to markdown gem 'reverse_markdown' diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 2a0bed10da..b36ea514b1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -16,6 +16,7 @@ // //= require jquery //= require jquery_ujs +//= require jquery-lazyload/jquery.lazyload.js //= require debounce/index.js //= require bootstrap/dist/js/bootstrap.bundle.min.js //= require bootstrap-3-typeahead/bootstrap3-typeahead.min.js @@ -60,4 +61,4 @@ //= require validation.js //= require submit_form_ajax.js //= require urlMapHash.js -//= require spam2.js \ No newline at end of file +//= require spam2.js diff --git a/app/views/dashboard/_node_default.html.erb b/app/views/dashboard/_node_default.html.erb index 72abf63bfa..ba40a1f4ff 100644 --- a/app/views/dashboard/_node_default.html.erb +++ b/app/views/dashboard/_node_default.html.erb @@ -4,9 +4,9 @@ <%= render partial: 'dashboard/node_moderate', locals: { node: node } %> <% if node.main_image %> - + <%= image_tag(node.main_image.path(:default), style:'width:100%;') %> <% elsif node.scraped_image %> - + <%= image_tag(node.scraped_image, style:'width:100%;') %> <% end %>

<%= node.title %> <% if node.status == 3 %>Draft<% end %>

@@ -17,3 +17,9 @@ + + diff --git a/app/views/dashboard/_node_question.html.erb b/app/views/dashboard/_node_question.html.erb index bd74034a8a..8e4fdee1d2 100644 --- a/app/views/dashboard/_node_question.html.erb +++ b/app/views/dashboard/_node_question.html.erb @@ -1,18 +1,18 @@
- +
<%= render partial: 'dashboard/node_moderate', locals: { node: node } %> - + <% if node.main_image %> - + <%= image_tag(node.main_image.path(:default), style:'width:100%;') %> <% elsif node.scraped_image %> - + <%= image_tag(node.scraped_image, style:'width:100%;') %> <% end %> - +

<%= node.title %>

<%= translation('dashboard._node_question.question') %> <%= render partial: "dashboard/node_meta", locals: { node: node } %>

@@ -20,3 +20,9 @@
+ + diff --git a/app/views/notes/_card.html.erb b/app/views/notes/_card.html.erb index dcc372735a..fc0c82fa63 100644 --- a/app/views/notes/_card.html.erb +++ b/app/views/notes/_card.html.erb @@ -1,8 +1,8 @@
<% if node.main_image %> - target="_blank"<% end %> href="<%= node.path %>"> + target="_blank"<% end %> href="<%= node.path %>"><%= image_tag(node.main_image.path(:default), style:'width:100%;') %> <% elsif node.scraped_image %> - + <%= image_tag(node.scraped_image, style:'width:100%;') %> <% else %> @@ -66,3 +66,9 @@
+ + diff --git a/app/views/notes/show.html.erb b/app/views/notes/show.html.erb index e6a519caf8..d9ffcc605d 100644 --- a/app/views/notes/show.html.erb +++ b/app/views/notes/show.html.erb @@ -14,8 +14,8 @@ <% if @node.main_image %> - - + <%= image_tag(@node.main_image.path(:large), class:"rounded d-none d-lg-inline", style:'max-height:600px;max-width:100%;') %> + <%= image_tag(@node.main_image.path(:large), class:"rounded d-lg-none", style:'width:100%;') %> <% end %> @@ -138,4 +138,7 @@ $("#collapse-button").click(function(){ $(this).remove(); }); + $(function(){ + $("img").lazyload(); + }); diff --git a/app/views/questions/show.html.erb b/app/views/questions/show.html.erb index 82009bbcb2..e28eaaa0dd 100644 --- a/app/views/questions/show.html.erb +++ b/app/views/questions/show.html.erb @@ -1,14 +1,16 @@ <%= javascript_include_tag('comment_expand') %> <%= javascript_include_tag('notes') %> <%= javascript_include_tag('textbox_expand') %> - + <%= javascript_include_tag('question') %>
<% if @node.main_image %> - - + <%= image_tag(@node.main_image.path(:large), class:"rounded d-none d-lg-inline", style:'max-height:600px;max-width:100%;') %> + <%= image_tag(@node.main_image.path(:large), class:"rounded d-lg-none", style:'width:100%;') %> <% end %> diff --git a/app/views/users/list.html.erb b/app/views/users/list.html.erb index fa1cf1a649..af90f91e86 100644 --- a/app/views/users/list.html.erb +++ b/app/views/users/list.html.erb @@ -33,7 +33,7 @@
- + <%= image_tag(user.profile_image, class:'rounded-circle img-fluid', id:'profile-photo') %>
@@ -169,7 +169,7 @@ h3, h2, h5 { padding-bottom: 5px; padding-left: 14px; } - + .sort-style{ color: #808080; } @@ -177,4 +177,9 @@ h3, h2, h5 { text-decoration: underline; } + <%= render partial: 'tag/location' %> diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index 7213f25947..2ce8096eb2 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -5,10 +5,10 @@ <%= render :partial => "map/leaflet" , locals: { lat: @map_lat, lon: @map_lon, zoom: @map_zoom, blurred: @map_blurred, topmap: true, user: @profile_user } %> <% elsif !current_user.nil? && current_user.id == @profile_user.id %>
- +

Learn about privacy

-
+
<% end %>
@@ -45,14 +45,14 @@
- <%if @content_approved or (!current_user.nil? && current_user.id == @profile_user.id)%> - + <%if @content_approved or (!current_user.nil? && current_user.id == @profile_user.id)%> + <%= image_tag(@profile_user.profile_image, class:'d-none d-lg-inline rounded-circle', id:'profile-photo', style:"width:50%;margin-bottom:10px;") %> <%end%>

@<%= @profile_user.name %> <%= @profile_user.new_contributor %>

- <%if @content_approved or (!current_user.nil? && current_user.id == @profile_user.id)%> - + <%if @content_approved or (!current_user.nil? && current_user.id == @profile_user.id)%> + <%= image_tag(@profile_user.profile_image(:medium), class:'rounded-circle', id:'profile-photo', style:"width:50%;margin-bottom:20px;") %> <%end%>

@<%= @profile_user.name %> <%= @profile_user.new_contributor %>

@@ -66,9 +66,9 @@ <% if @profile_user.status == 0 %> | <%= translation('users.profile.banned') %><% end %> - <%if @content_approved or (!current_user.nil? && current_user.id == @profile_user.id)%> + <%if @content_approved or (!current_user.nil? && current_user.id == @profile_user.id)%>

<%= raw auto_link(RDiscount.new(@profile_user.bio || '').to_html, :sanitize => false) %>

- <%end%> + <%end%>
Tags @@ -273,6 +273,9 @@