refactors shared part of debate & proposal views

This commit is contained in:
kikito
2015-10-21 14:47:17 +02:00
parent 6c5d1faa90
commit d4bbf0d26e
5 changed files with 31 additions and 50 deletions

View File

@@ -21,31 +21,7 @@
<% end %>
<div class="debate-info">
<%= avatar_image(@debate.author, seed: @debate.author_id, size: 32, class: 'author-photo') %>
<% if @debate.author.hidden? || @debate.author.erased? %>
<i class="icon-deleted author-deleted"></i>
<span class="author">
<%= t("debates.show.author_deleted") %>
</span>
<% else %>
<span class="author">
<%= @debate.author.name %>
</span>
<% if @debate.author.official? %>
&nbsp;&bull;&nbsp;
<span class="label round level-<%= @debate.author.official_level %>">
<%= @debate.author.official_position %>
</span>
<% end %>
<% end %>
<% if @debate.author.verified_organization? %>
&nbsp;&bull;&nbsp;
<span class="label round is-association">
<%= t("shared.collective") %>
</span>
<% end %>
<%= render '/shared/author_info', resource: @debate %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l @debate.created_at.to_date %>

View File

@@ -27,31 +27,7 @@
<% end %>
<div class="proposal-info">
<%= avatar_image(@proposal.author, seed: @proposal.author_id, size: 32, class: 'author-photo') %>
<% if @proposal.author.hidden? || @proposal.author.erased? %>
<i class="icon-deleted author-deleted"></i>
<span class="author">
<%= t("proposals.show.author_deleted") %>
</span>
<% else %>
<span class="author">
<%= @proposal.author.name %>
</span>
<% if @proposal.author.official? %>
&nbsp;&bull;&nbsp;
<span class="label round level-<%= @proposal.author.official_level %>">
<%= @proposal.author.official_position %>
</span>
<% end %>
<% end %>
<% if @proposal.author.verified_organization? %>
&nbsp;&bull;&nbsp;
<span class="label round is-association">
<%= t("shared.collective") %>
</span>
<% end %>
<%= render '/shared/author_info', resource: @proposal %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l @proposal.created_at.to_date %>

View File

@@ -0,0 +1,25 @@
<%= avatar_image(resource.author, seed: resource.author_id, size: 32, class: 'author-photo') %>
<% if resource.author.hidden? || resource.author.erased? %>
<i class="icon-deleted author-deleted"></i>
<span class="author">
<%= t("shared.author_info.author_deleted") %>
</span>
<% else %>
<span class="author">
<%= resource.author.name %>
</span>
<% if resource.author.official? %>
&nbsp;&bull;&nbsp;
<span class="label round level-<%= resource.author.official_level %>">
<%= resource.author.official_position %>
</span>
<% end %>
<% end %>
<% if resource.author.verified_organization? %>
&nbsp;&bull;&nbsp;
<span class="label round is-association">
<%= t("shared.collective") %>
</span>
<% end %>

View File

@@ -310,6 +310,8 @@ en:
debate: "secret code did not match with the image"
proposal: "secret code did not match with the image"
shared:
author_info:
author_deleted: Deleted user
tags_cloud:
tags: Trend
print:

View File

@@ -310,6 +310,8 @@ es:
debate: "el código secreto no coincide con la imagen"
proposal: "el código secreto no coincide con la imagen"
shared:
author_info:
author_deleted: Usuario eliminado
tags_cloud:
tags: Tendencias
print: