fix error
This commit is contained in:
parent
800ab40c94
commit
188793747b
|
@ -22,11 +22,13 @@ class WebResourcesController < ApplicationController
|
|||
end
|
||||
desc = link.image_description
|
||||
desc = (desc.blank? ? "web resource image" : desc)
|
||||
display_image = link.image.thumb.url.blank? 'style="display: none;"' : ''
|
||||
{
|
||||
"title" => link.title,
|
||||
"title_text" => text,
|
||||
"img_src" => link.image.thumb.url || "/assets/announcement-default.jpg",
|
||||
"img_description" => desc,
|
||||
"display_image" => display_image,
|
||||
"context" => nl2br(link.context.to_s),
|
||||
"statuses" => statuses,
|
||||
"category" => link.category.title,
|
||||
|
@ -52,24 +54,30 @@ class WebResourcesController < ApplicationController
|
|||
"status-class" => "status-#{status['classname']}"
|
||||
}
|
||||
end
|
||||
if link.link_open == "new_window"
|
||||
target = "_blank"
|
||||
elsif link.link_open == "local"
|
||||
target = "_self"
|
||||
end
|
||||
doc = Nokogiri::HTML(link.title.to_s)
|
||||
text = doc.css("body")[0].text rescue ""
|
||||
if text.blank? && doc.css("img").count != 0
|
||||
text = doc.css("img").map{|img| img.attr("alt") rescue ""}.select{|t| t.present?}.first
|
||||
end
|
||||
{
|
||||
"title" => link.title,
|
||||
"title_text" => text,
|
||||
"context" => nl2br(link.context.to_s),
|
||||
"statuses" => statuses,
|
||||
"link_to_show" => link.url,
|
||||
"target" => target
|
||||
}
|
||||
if link.link_open == "new_window"
|
||||
target = "_blank"
|
||||
elsif link.link_open == "local"
|
||||
target = "_self"
|
||||
end
|
||||
doc = Nokogiri::HTML(link.title.to_s)
|
||||
text = doc.css("body")[0].text rescue ""
|
||||
if text.blank? && doc.css("img").count != 0
|
||||
text = doc.css("img").map{|img| img.attr("alt") rescue ""}.select{|t| t.present?}.first
|
||||
end
|
||||
desc = link.image_description
|
||||
desc = (desc.blank? ? "web resource image" : desc)
|
||||
display_image = link.image.thumb.url.blank? 'style="display: none;"' : ''
|
||||
{
|
||||
"title" => link.title,
|
||||
"title_text" => text,
|
||||
"img_src" => link.image.thumb.url || "/assets/announcement-default.jpg",
|
||||
"img_description" => desc,
|
||||
"display_image" => display_image,
|
||||
"context" => nl2br(link.context.to_s),
|
||||
"statuses" => statuses,
|
||||
"link_to_show" => link.url,
|
||||
"target" => target
|
||||
}
|
||||
end
|
||||
{
|
||||
"web_link" => web_link,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</h3>
|
||||
<ul class="list-unstyled" data-level="0" data-list="web_link">
|
||||
<li class="widget-content">
|
||||
<div class="link-img-wrap">
|
||||
<div class="link-img-wrap" {{display_image}}>
|
||||
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
|
||||
</div>
|
||||
<a class="widget-content-title" href="{{link_to_show}}" target="_blank" title="{{title_text}}">{{title}}</a>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</h3>
|
||||
<ul class="list-unstyled" data-level="0" data-list="web_link">
|
||||
<li class="widget-content widget-content-horizontal">
|
||||
<div class="link-img-wrap">
|
||||
<div class="link-img-wrap" {{display_image}}>
|
||||
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
|
||||
</div>
|
||||
<a class="widget-content-title" href="{{link_to_show}}" target="_blank" title="{{title_text}}">{{title}}</a>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<ul class="list-unstyled" data-list="web_link" data-level="0">
|
||||
<li class="index-content">
|
||||
<a class="index-content-title" href="{{link_to_show}}" target="_blank" title="{{title_text}}">
|
||||
<div class="link-img-wrap">
|
||||
<div class="link-img-wrap" {{display_image}}>
|
||||
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
|
||||
</div>
|
||||
<h4>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<ul class="list-unstyled" data-list="web_link" data-level="0">
|
||||
<li class="index-content col-md-4 col-sm-4">
|
||||
<a class="index-content-title" href="{{link_to_show}}" target="_blank" title="{{title_text}}">
|
||||
<div class="link-img-wrap">
|
||||
<div class="link-img-wrap" {{display_image}}>
|
||||
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
|
||||
</div>
|
||||
<h4>
|
||||
|
|
Loading…
Reference in New Issue