Skip to content

Commit

Permalink
Fix blank url display
Browse files Browse the repository at this point in the history
  • Loading branch information
Esteban Arocha committed May 7, 2019
1 parent 700361c commit 315e3a7
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
3 changes: 3 additions & 0 deletions app/models/professor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class Professor < ApplicationRecord
before_save :validate_https

def validate_https
if self.resume == "" || self.resume == nil then
return
end
url_cpy_with_s = self.resume
url_cpy_with_out_s = self.resume
url_cpy_with_s = url_cpy_with_s[0...8]
Expand Down
6 changes: 5 additions & 1 deletion app/views/documents/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
<% @documents.each do |document| %>
<tr>
<td class="text-center"><%= document.description %></td>
<td class="text-center"><%= link_to nil, "http://#{document.url}"%></td>
<% unless document.url.blank?%>
<td class="text-center table-hidde"><%= link_to nil, "http://#{document.url}"%></td>
<% else %>
<td class="text-center table-hidde"></td>
<% end %>
<td class="text-center">
<%= link_to document do %>
<i class="btn fas fa-eye fa-sm text-primary" aria-hidden="true"></i>
Expand Down
4 changes: 3 additions & 1 deletion app/views/documents/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

<p class="text-center">
<strong>URL:</strong>
<%= link_to nil, "http://#{@document.url}"%>
<% unless @document.url.blank? %>
<%= link_to nil, "http://#{@document.url}"%>
<% end %>
</p>

<p class="text-center">
Expand Down
6 changes: 5 additions & 1 deletion app/views/links/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
<td class="text-center table-hidde"><%= link.start_date %></td>
<td class="text-center table-hidde"><%= link.end_date %></td>
<td class="text-center table-hidde"><%= link.link_type %></td>
<td class="text-center table-hidde"><%= link_to nil, "http://#{link.url}"%></td>
<% unless link.url.blank?%>
<td class="text-center table-hidde"><%= link_to nil, "http://#{link.url}"%></td>
<% else %>
<td class="text-center table-hidde"></td>
<% end %>
<td class="text-center">
<%= link_to link do %>
<i class="btn fas fa-eye fa-sm text-primary" aria-hidden="true"></i>
Expand Down
4 changes: 3 additions & 1 deletion app/views/links/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@

<p class="text-center">
<strong>URL:</strong>
<%= link_to nil, "http://#{@link.url}"%>
<% unless @link.url.blank? %>
<%= link_to nil, "http://#{@link.url}"%>
<% end %>
</p>

<p class="text-center">
Expand Down
6 changes: 5 additions & 1 deletion app/views/professors/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
<td class="text-center"><%= professor.name %> <%= professor.father_last_name %> <%= professor.mother_last_name %></td>
<td class="text-center table-hidde"><%= professor.email %></td>
<td class="text-center table-hidde"><%= professor.office %></td>
<td class="text-center table-hidde"><%= link_to nil, "http://#{professor.resume}"%></td>
<% unless professor.resume.blank?%>
<td class="text-center table-hidde"><%= link_to nil, "http://#{professor.resume}"%></td>
<% else %>
<td class="text-center table-hidde"></td>
<% end %>

<td class="text-center table-hidde"><%= professor.professor_type %></td>
<td class="text-center">
Expand Down
4 changes: 3 additions & 1 deletion app/views/professors/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

<p class="text-center">
<strong>CV:</strong>
<%= link_to nil, "http://#{@professor.resume}"%>
<% unless @professor.resume.blank?%>
<%= link_to nil, "http://#{@professor.resume}"%>
<% end %>
</p>

<p class="text-center">
Expand Down
4 changes: 3 additions & 1 deletion app/views/professors/show_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

<p class="text-center">
<strong>CV:</strong>
<%= @professor.resume %>
<% if @professor.resume != ""%>
<%= link_to nil, "http://#{@professor.resume}"%>
<% end %>
</p>

<p class="text-center">
Expand Down

0 comments on commit 315e3a7

Please sign in to comment.