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; vertical-align: middle;
} }
/*
Striped Tables
*/
table.striped > tbody { table.striped > tbody {
> tr { > tr {
td:first-child, td:first-child,
@ -39,7 +44,7 @@ table.striped > tbody {
} }
> tr:nth-child(2n) td { > tr:nth-child(2n) td {
background-color: transparentize($light-blue, 0.8); background-color: transparentize($light-blue, 0.9);
} }
.actions { .actions {

View file

@ -47,10 +47,13 @@ body#tinymce {
box-shadow: $content-shadow; box-shadow: $content-shadow;
background: white; background: white;
padding: 20px; padding: 20px;
}
#main_nobody { &.no-body {
@include span-columns(9 of 12); box-shadow: none;
border-radius: 0;
background: transparent;
padding: 0;
}
} }
#sidebar { #sidebar {

View file

@ -120,8 +120,9 @@ div#categories {
@include span-columns(12); @include span-columns(12);
padding: 20px; padding: 20px;
margin-bottom: 20px; margin-bottom: 20px;
background: transparentize($light-gray, 0.5); background: transparentize($light-gray, 0.75);
border-radius: 5px; border-radius: 5px;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.2);
&:last-child { &:last-child {
margin-bottom: 40px; margin-bottom: 40px;

View file

@ -45,11 +45,13 @@ div.article {
} }
&.preview { &.preview {
@include span-columns(12);
border-radius: $base-border-radius; border-radius: $base-border-radius;
background: white; background: white;
padding: 20px; padding: 20px;
margin-bottom: 20px; margin-bottom: 20px;
box-shadow: $light-shadow; box-shadow: $light-shadow;
border: 0;
.content { .content {
margin-bottom: 10px; margin-bottom: 10px;

View file

@ -8,7 +8,6 @@ class ArticlesController < ApplicationController
def news_index def news_index
@news = Article.with_comments.ordered.nodrafts.onlynews.limit(10) @news = Article.with_comments.ordered.nodrafts.onlynews.limit(10)
@categories = Category.ordered.domain(Category::DOMAIN_NEWS) @categories = Category.ordered.domain(Category::DOMAIN_NEWS)
@nobody = true
end end
def news_archive 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 %> <%= namelink(article.user) %> on <%= longtime article.created_at %>
</div> </div>
<div class="comments">
<%= link_to article do %>
<%= icon 'comments' %> Comments (<%= article.comments.count %>)
<% end %>
</div>
<div class="actions"> <div class="actions">
<% if article.can_update? cuser %> <% if article.can_update? cuser %>
<%= link_to 'Edit', edit_article_path(article), class: 'button tiny' %> <%= link_to 'Edit', edit_article_path(article), class: 'button tiny' %>

View file

@ -2,21 +2,7 @@
<h1><%= namelink article %></h1> <h1><%= namelink article %></h1>
<div class="content"> <div class="content">
<% if article.text_coding == Article::CODING_HTML %> <%= preview_text(article, full) %>
<%
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 %>
</div> </div>
<div class="author"> <div class="author">

View file

@ -1,6 +1,8 @@
<% provide :main_class, 'no-body' %>
<div id="news"> <div id="news">
<% @news.each_with_index do |item, i| %> <% @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 %> <% end %>
</div> </div>

View file

@ -16,7 +16,7 @@
<%= render partial: "navigation" %> <%= render partial: "navigation" %>
<div class="wrapper"> <div class="wrapper">
<div id="content"> <div id="content">
<div id="<%= @nobody ? 'main_nobody' : 'main' %>"> <div id="main" class="<%= yield :main_class %>">
<%= render partial: "messages" %> <%= render partial: "messages" %>
<%= yield %> <%= yield %>
</div> </div>