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
|
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|
|
galleries = albums.collect.with_index do |a,i|
|
||||||
doc = Nokogiri::HTML(a.description.to_s)
|
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]
|
colors = album_color_map[a.id]
|
||||||
thumb_src = a.cover_path || "/assets/gallery/default.jpg"
|
thumb_src = a.cover_path || "/assets/gallery/default.jpg"
|
||||||
cover_image = AlbumImage.find(a.cover) rescue a.album_images.first
|
cover_image = AlbumImage.find(a.cover) rescue a.album_images.first
|
||||||
image_description = a.description
|
image_description = a.description
|
||||||
image_short_description = a.name
|
image_short_description = a.name
|
||||||
{
|
{
|
||||||
|
"link_text" => a.name,
|
||||||
"album-name" => a.name,
|
"album-name" => a.name,
|
||||||
"album-description" => a.description,
|
"album-description" => a.description,
|
||||||
"alt_title" => alt_text,
|
"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 = AlbumImage.where({album_id:{"$in"=>album_ids}}).desc(:id).limit(counts *5).sample(counts)
|
||||||
images = images.each_with_index.collect do |a,i|
|
images = images.each_with_index.collect do |a,i|
|
||||||
colors = album_color_map[a.album_id]
|
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,
|
"link_to_show" => OrbitHelper.widget_more_url + "/" + a.album.to_param + "#" + a.id.to_s,
|
||||||
"alt_title" => alt_text,
|
"alt_title" => alt_text,
|
||||||
"src" => a.file.url,
|
"src" => a.file.url,
|
||||||
|
|
|
@ -5,21 +5,25 @@
|
||||||
<div class="cycle-slideshow widget-content"
|
<div class="cycle-slideshow widget-content"
|
||||||
data-level="0"
|
data-level="0"
|
||||||
data-list="images"
|
data-list="images"
|
||||||
data-cycle-slides="> a"
|
data-cycle-slides="> *"
|
||||||
data-cycle-fx="carousel"
|
data-cycle-fx="carousel"
|
||||||
data-cycle-timeout="3000"
|
data-cycle-timeout="3000"
|
||||||
data-cycle-carousel-visible="3"
|
data-cycle-carousel-visible="3"
|
||||||
data-cycle-pause-on-hover="true"
|
data-cycle-pause-on-hover="true"
|
||||||
data-cycle-log="false"
|
data-cycle-log="false"
|
||||||
data-cycle-carousel-fluid="true">
|
data-cycle-carousel-fluid="true">
|
||||||
<a class="widget-pic" href="{{link_to_show}}">
|
<div class="widget-pic" style="text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">
|
||||||
<img
|
<a href="{{link_to_show}}" title="{{album-name}}">
|
||||||
srcset="
|
<img
|
||||||
{{thumb-large-src}} 1024w,
|
srcset="
|
||||||
{{thumb-src}} 768w"
|
{{thumb-large-src}} 1024w,
|
||||||
src="{{thumb-src}}"
|
{{thumb-src}} 768w"
|
||||||
alt="{{alt_title}}"
|
src="{{thumb-src}}"
|
||||||
>
|
alt="{{alt_title}}"
|
||||||
</a>
|
>
|
||||||
|
</a>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
<a href="{{link_to_show}}" title="{{album-name}}">{{link_text}}</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,14 +3,17 @@
|
||||||
<span>{{widget-title}}</span>
|
<span>{{widget-title}}</span>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="row widget-content" data-level="0" data-list="images">
|
<div class="row widget-content" data-level="0" data-list="images">
|
||||||
<a class="widget-pic col-xs-4" href="{{link_to_show}}">
|
<div class="col-md-4" style="text-align: center;">
|
||||||
<img
|
<a class="widget-pic" href="{{link_to_show}}" title="{{album-name}}">
|
||||||
srcset="
|
<img
|
||||||
{{thumb-large-src}} 1024w,
|
srcset="
|
||||||
{{thumb-src}} 768w"
|
{{thumb-large-src}} 1024w,
|
||||||
src="{{thumb-src}}"
|
{{thumb-src}} 768w"
|
||||||
alt="{{alt_title}}"
|
src="{{thumb-src}}"
|
||||||
>
|
alt="{{alt_title}}"
|
||||||
</a>
|
>
|
||||||
|
</a>
|
||||||
|
<a href="{{link_to_show}}" title="{{album-name}}">{{link_text}}</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue