mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 12:30:48 +00:00
Refactor some article views
Tweak colour brightnesses
This commit is contained in:
parent
6aa8903c11
commit
09026a2e4b
10 changed files with 33 additions and 29 deletions
|
@ -25,6 +25,11 @@ tr, td, th {
|
|||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/*
|
||||
Striped Tables
|
||||
*/
|
||||
|
||||
|
||||
table.striped > tbody {
|
||||
> tr {
|
||||
td:first-child,
|
||||
|
@ -39,7 +44,7 @@ table.striped > tbody {
|
|||
}
|
||||
|
||||
> tr:nth-child(2n) td {
|
||||
background-color: transparentize($light-blue, 0.8);
|
||||
background-color: transparentize($light-blue, 0.9);
|
||||
}
|
||||
|
||||
.actions {
|
||||
|
|
|
@ -47,10 +47,13 @@ body#tinymce {
|
|||
box-shadow: $content-shadow;
|
||||
background: white;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#main_nobody {
|
||||
@include span-columns(9 of 12);
|
||||
&.no-body {
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
|
|
|
@ -120,8 +120,9 @@ div#categories {
|
|||
@include span-columns(12);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: transparentize($light-gray, 0.5);
|
||||
background: transparentize($light-gray, 0.75);
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.2);
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 40px;
|
||||
|
|
|
@ -45,11 +45,13 @@ div.article {
|
|||
}
|
||||
|
||||
&.preview {
|
||||
@include span-columns(12);
|
||||
border-radius: $base-border-radius;
|
||||
background: white;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: $light-shadow;
|
||||
border: 0;
|
||||
|
||||
.content {
|
||||
margin-bottom: 10px;
|
||||
|
|
|
@ -8,7 +8,6 @@ class ArticlesController < ApplicationController
|
|||
def news_index
|
||||
@news = Article.with_comments.ordered.nodrafts.onlynews.limit(10)
|
||||
@categories = Category.ordered.domain(Category::DOMAIN_NEWS)
|
||||
@nobody = true
|
||||
end
|
||||
|
||||
def news_archive
|
||||
|
|
12
app/helpers/articles_helper.rb
Normal file
12
app/helpers/articles_helper.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
module ArticlesHelper
|
||||
def preview_text(article, full)
|
||||
if article.text_coding == Article::CODING_HTML
|
||||
content = article.text.html_safe
|
||||
else
|
||||
content = article.text_parsed.html_safe
|
||||
end
|
||||
|
||||
content = truncate(raw(strip_tags(content)), length: 200) if !full
|
||||
content
|
||||
end
|
||||
end
|
|
@ -13,12 +13,6 @@
|
|||
<%= namelink(article.user) %> on <%= longtime article.created_at %>
|
||||
</div>
|
||||
|
||||
<div class="comments">
|
||||
<%= link_to article do %>
|
||||
<%= icon 'comments' %> Comments (<%= article.comments.count %>)
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<% if article.can_update? cuser %>
|
||||
<%= link_to 'Edit', edit_article_path(article), class: 'button tiny' %>
|
||||
|
|
|
@ -2,21 +2,7 @@
|
|||
<h1><%= namelink article %></h1>
|
||||
|
||||
<div class="content">
|
||||
<% if article.text_coding == Article::CODING_HTML %>
|
||||
<%
|
||||
content = article.text.html_safe
|
||||
content = truncate(raw(strip_tags(article.text)), length: 200) if !expanded
|
||||
%>
|
||||
|
||||
<%= content %>
|
||||
<% else %>
|
||||
<%
|
||||
content = article.text_parsed.html_safe
|
||||
content = truncate(raw(strip_tags(article.text_parsed)), length: 200) if !expanded
|
||||
%>
|
||||
|
||||
<%= content %>
|
||||
<% end %>
|
||||
<%= preview_text(article, full) %>
|
||||
</div>
|
||||
|
||||
<div class="author">
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<% provide :main_class, 'no-body' %>
|
||||
|
||||
<div id="news">
|
||||
<% @news.each_with_index do |item, i| %>
|
||||
<%= render partial: 'preview', locals: { article: item, expanded: (true if i == 0) } %>
|
||||
<%= render partial: 'preview', locals: { article: item, full: (true if i == 0) } %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<%= render partial: "navigation" %>
|
||||
<div class="wrapper">
|
||||
<div id="content">
|
||||
<div id="<%= @nobody ? 'main_nobody' : 'main' %>">
|
||||
<div id="main" class="<%= yield :main_class %>">
|
||||
<%= render partial: "messages" %>
|
||||
<%= yield %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue