Refactor some article views

Tweak colour brightnesses
This commit is contained in:
Luke Barratt 2014-05-02 09:27:18 +01:00
parent 6aa8903c11
commit 09026a2e4b
10 changed files with 33 additions and 29 deletions

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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

View 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

View file

@ -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' %>

View file

@ -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">

View file

@ -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>

View file

@ -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>