<% img_path = "computers/old/#{computer["name"].parameterize}" %>

<% 
uri = URI("#{PortfolioImage::ROOT_PATH}#{img_path}.png")
request = Net::HTTP.new(uri.host)
response = request.request_head(uri.path)
img = response.code.to_i == 200 ? "#{img_path}.png" : "#{img_path}.jpg" %>

<div id="<%= computer["name"].parameterize %>" class="row computer-summary">
  <div class="col col-sm-12">
    <h3 id="<%= computer["name"].parameterize %>"><%= computer["name"] %> <small><%= [computer["from"],computer["to"]].join(" – ") if computer["from"] && computer["to"]%></small></h3>
    <%= content_tag(:p, computer["description"]) if computer["description"] %>
  </div>
  <div class="col col-sm-4"><%= project_image(img, attribution: computer["attribution"]) %></div>
  <div class="col col-sm-8">
    <%= content_tag(:h4, computer["model"]) if computer["model"] %>
    <%= content_tag(:ul, safe_join(computer["specs"].map{|spec| content_tag(:li, spec)}), class: %w(list-unstyled computer-specs)) if computer["specs"] %>
  </div>
</div>
<% img_path = "computers/old/#{computer["name"].parameterize}" %>

<% 
begin
  uri = URI("#{PortfolioImage::ROOT_PATH}#{img_path}.png")
  request = Net::HTTP.new(uri.host)
  response = request.request_head(uri.path)
  img = response.code.to_i == 200 ? "#{img_path}.png" : "#{img_path}.jpg"
rescue SocketError
  img = "#"
end
%>

<div id="<%= computer["name"].parameterize %>" class="row computer-summary">
  <div class="col col-sm-12">
    <h3 id="<%= computer["name"].parameterize %>"><%= computer["name"] %> <small><%= [computer["from"],computer["to"]].join(" – ") if computer["from"] && computer["to"]%></small></h3>
    <%= content_tag(:p, computer["description"]) if computer["description"] %>
  </div>
  <div class="col col-sm-4"><%= project_image(img, attribution: computer["attribution"]) %></div>
  <div class="col col-sm-8">
    <%= content_tag(:h4, computer["model"]) if computer["model"] %>
    <%= content_tag(:ul, safe_join(computer["specs"].map{|spec| content_tag(:li, spec)}), class: %w(list-unstyled computer-specs)) if computer["specs"] %>
  </div>
</div>
Handle SocketError on _computer_summary partial when image not available
Handle SocketError on _computer_summary partial when image not available
