Refactors documents partials and reorganices css

This commit is contained in:
decabeza
2018-02-26 18:37:30 +01:00
parent c2e9096ce1
commit 5c0a10699a
6 changed files with 68 additions and 93 deletions

View File

@@ -89,6 +89,10 @@ a {
&.warning:hover { &.warning:hover {
color: #000; color: #000;
} }
&.medium {
font-size: $small-font-size;
}
} }
.button.hollow { .button.hollow {
@@ -2310,61 +2314,48 @@ table {
// 20. Documents // 20. Documents
// ------------- // -------------
.documents-list { .documents {
table { h2 {
border: 0; font-size: rem-calc(24);
span {
color: #4f4f4f;
font-weight: normal;
}
} }
td { ul li {
padding-top: $line-height / 2;
&:not(:first-child) {
border-top: 1px solid $highlight;
}
}
.document-link {
background: $highlight-soft;
border: 2px solid $highlight;
border-radius: rem-calc(5);
display: block;
margin: $line-height / 2 0;
padding: 0 $line-height / 2;
position: relative; position: relative;
@include breakpoint(small) {
float: left;
width: 100%;
}
@include breakpoint(medium) {
float: none;
}
a { a {
width: 100%; word-wrap: break-word;
} }
&:first-child { .icon-document {
padding-left: $line-height * 1.5;
@include breakpoint(small) {
width: 100%;
}
@include breakpoint(medium) {
width: 70%;
}
@include breakpoint(large) {
width: 80%;
}
}
&:first-child::before {
color: #007bb7; color: #007bb7;
content: 'G'; display: inline-block;
font-family: "icons" !important;
font-size: rem-calc(24); font-size: rem-calc(24);
left: rem-calc(6); line-height: $line-height;
position: absolute; vertical-align: middle;
top: 0; }
@include breakpoint(small) {
padding-top: rem-calc(12);
}
@include breakpoint(medium) {
padding-top: rem-calc(22);
}
p {
margin-bottom: 0;
} }
} }
} }

View File

@@ -457,7 +457,6 @@
line-height: rem-calc(30); line-height: rem-calc(30);
} }
.document-link,
.video-link { .video-link {
background: $highlight-soft; background: $highlight-soft;
border: 1px solid $highlight; border: 1px solid $highlight;
@@ -470,21 +469,14 @@
word-wrap: break-word; word-wrap: break-word;
} }
[class^="icon-"] { .icon-video {
color: #cc181e;
display: inline-block; display: inline-block;
font-size: rem-calc(24); font-size: rem-calc(24);
line-height: $line-height; line-height: $line-height;
vertical-align: middle; vertical-align: middle;
} }
.icon-document {
color: #007bb7;
}
.icon-video {
color: #cc181e;
}
p { p {
margin-bottom: 0; margin-bottom: 0;
} }

View File

@@ -1,24 +1,20 @@
<table> <li id="<%= dom_id(document)%>">
<tbody> <%= link_to t("documents.buttons.download_document"),
<tr id="<%= dom_id(document)%>"> document.attachment.url, target: "_blank",
<td class="document-link"> rel: "nofollow", class: "button hollow medium float-right" %>
<%= document.title %>
</td> <strong><%= document.title %></strong>
<td class="text-center"> <br>
<%= link_to t('documents.buttons.download_document'), <small>
document.attachment.url, <%= document.humanized_content_type %>&nbsp;|&nbsp;
target: "_blank", <%= number_to_human_size(document.attachment_file_size, precision: 2) %>
rel: "nofollow", </small>
class: 'button hollow' %>
</td> <% if can?(:destroy, document) %>
<td class="text-center"> <br>
<% if can?(:destroy, document) %> <%= link_to t("documents.buttons.destroy_document"),
<%= link_to t('documents.buttons.destroy_document'), document_path(document, from: request.url), method: :delete,
document_path(document, from: request.url), method: :delete, data: { confirm: t("documents.actions.destroy.confirm") },
data: { confirm: t('documents.actions.destroy.confirm') }, class: "delete" %>
class: 'button hollow alert' %> <% end %>
<% end %> </li>
</td>
</tr>
</tbody>
</table>

View File

@@ -1,11 +1,9 @@
<div class="row <% 'documents-list' if documents.any? %>"> <div class="documents">
<div class="small-12 column"> <h2><%= t("documents.title") %>&nbsp;<span>(<%= documents.count %>)</span></h2>
<% if documents.any? %>
<% if documents.any? %>
<ul class="no-bullet document-link">
<%= render partial: "documents/document", collection: documents %> <%= render partial: "documents/document", collection: documents %>
<% else %> </ul>
<div class="callout primary text-center"> <% end %>
<%= t('documents.no_documents') %>
</div>
<% end %>
</div>
</div> </div>

View File

@@ -1,7 +1,6 @@
en: en:
documents: documents:
tab: Documents title: Documents
no_documents: Don't have uploaded documents
max_documents_allowed_reached_html: You have reached the maximum number of documents allowed! <strong>You have to delete one before you can upload another.</strong> max_documents_allowed_reached_html: You have reached the maximum number of documents allowed! <strong>You have to delete one before you can upload another.</strong>
form: form:
title: Documents title: Documents
@@ -17,7 +16,7 @@ en:
confirm: Are you sure you want to delete the document? This action cannot be undone! confirm: Are you sure you want to delete the document? This action cannot be undone!
buttons: buttons:
download_document: Download file download_document: Download file
destroy_document: Destroy destroy_document: Destroy document
errors: errors:
messages: messages:
in_between: must be in between %{min} and %{max} in_between: must be in between %{min} and %{max}

View File

@@ -1,7 +1,6 @@
es: es:
documents: documents:
tab: Documentos title: Documentos
no_documents: No hay documentos subidos
max_documents_allowed_reached_html: '¡Has alcanzado el número máximo de documentos permitidos! <strong>Tienes que eliminar uno antes de poder subir otro.</strong>' max_documents_allowed_reached_html: '¡Has alcanzado el número máximo de documentos permitidos! <strong>Tienes que eliminar uno antes de poder subir otro.</strong>'
form: form:
title: Documentos title: Documentos
@@ -17,7 +16,7 @@ es:
confirm: '¿Está seguro de que desea eliminar el documento? Esta acción no se puede deshacer!' confirm: '¿Está seguro de que desea eliminar el documento? Esta acción no se puede deshacer!'
buttons: buttons:
download_document: Descargar archivo download_document: Descargar archivo
destroy_document: Eliminar destroy_document: Eliminar documento
errors: errors:
messages: messages:
in_between: debe estar entre %{min} y %{max} in_between: debe estar entre %{min} y %{max}