Update widgets.
This commit is contained in:
parent
84ac920327
commit
142126322e
|
@ -149,13 +149,14 @@ class GalleriesController < ApplicationController
|
|||
album_color_map = AlbumColor.where(:album_id.in=> albums.map{|v| v.id}).pluck(:album_id,:color,:album_card_background_color,:album_card_text_color).map{|v| [v[0],v[1..-1]]}.to_h
|
||||
galleries = albums.collect.with_index do |a,i|
|
||||
doc = Nokogiri::HTML(a.description.to_s)
|
||||
alt_text = doc.text.empty? ? 'gallery image' : doc.text
|
||||
alt_text = doc.text.empty? ? 'gallery image' : doc.text.strip
|
||||
colors = album_color_map[a.id]
|
||||
thumb_src = a.cover_path || "/assets/gallery/default.jpg"
|
||||
cover_image = AlbumImage.find(a.cover) rescue a.album_images.first
|
||||
image_description = a.description
|
||||
image_short_description = a.name
|
||||
{
|
||||
"link_text" => a.name,
|
||||
"album-name" => a.name,
|
||||
"album-description" => a.description,
|
||||
"alt_title" => alt_text,
|
||||
|
@ -187,8 +188,9 @@ class GalleriesController < ApplicationController
|
|||
images = AlbumImage.where({album_id:{"$in"=>album_ids}}).desc(:id).limit(counts *5).sample(counts)
|
||||
images = images.each_with_index.collect do |a,i|
|
||||
colors = album_color_map[a.album_id]
|
||||
alt_text = (a.description.nil? || a.description == "" ? "gallery image" : Nokogiri::HTML(a.description).text())
|
||||
alt_text = (a.description.blank? ? "gallery image" : Nokogiri::HTML(a.description).text().strip)
|
||||
{
|
||||
"link_text" => "",
|
||||
"link_to_show" => OrbitHelper.widget_more_url + "/" + a.album.to_param + "#" + a.id.to_s,
|
||||
"alt_title" => alt_text,
|
||||
"src" => a.file.url,
|
||||
|
|
|
@ -5,21 +5,25 @@
|
|||
<div class="cycle-slideshow widget-content"
|
||||
data-level="0"
|
||||
data-list="images"
|
||||
data-cycle-slides="> a"
|
||||
data-cycle-slides="> *"
|
||||
data-cycle-fx="carousel"
|
||||
data-cycle-timeout="3000"
|
||||
data-cycle-carousel-visible="3"
|
||||
data-cycle-pause-on-hover="true"
|
||||
data-cycle-log="false"
|
||||
data-cycle-carousel-fluid="true">
|
||||
<a class="widget-pic" href="{{link_to_show}}">
|
||||
<img
|
||||
srcset="
|
||||
{{thumb-large-src}} 1024w,
|
||||
{{thumb-src}} 768w"
|
||||
src="{{thumb-src}}"
|
||||
alt="{{alt_title}}"
|
||||
>
|
||||
</a>
|
||||
<div class="widget-pic" style="text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">
|
||||
<a href="{{link_to_show}}" title="{{album-name}}">
|
||||
<img
|
||||
srcset="
|
||||
{{thumb-large-src}} 1024w,
|
||||
{{thumb-src}} 768w"
|
||||
src="{{thumb-src}}"
|
||||
alt="{{alt_title}}"
|
||||
>
|
||||
</a>
|
||||
<div style="clear: both;"></div>
|
||||
<a href="{{link_to_show}}" title="{{album-name}}">{{link_text}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,14 +3,17 @@
|
|||
<span>{{widget-title}}</span>
|
||||
</h3>
|
||||
<div class="row widget-content" data-level="0" data-list="images">
|
||||
<a class="widget-pic col-xs-4" href="{{link_to_show}}">
|
||||
<img
|
||||
srcset="
|
||||
{{thumb-large-src}} 1024w,
|
||||
{{thumb-src}} 768w"
|
||||
src="{{thumb-src}}"
|
||||
alt="{{alt_title}}"
|
||||
>
|
||||
</a>
|
||||
<div class="col-md-4" style="text-align: center;">
|
||||
<a class="widget-pic" href="{{link_to_show}}" title="{{album-name}}">
|
||||
<img
|
||||
srcset="
|
||||
{{thumb-large-src}} 1024w,
|
||||
{{thumb-src}} 768w"
|
||||
src="{{thumb-src}}"
|
||||
alt="{{alt_title}}"
|
||||
>
|
||||
</a>
|
||||
<a href="{{link_to_show}}" title="{{album-name}}">{{link_text}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue