Skip to content

Commit

Permalink
redesigned the tags list
Browse files Browse the repository at this point in the history
  • Loading branch information
raw1z committed Feb 11, 2012
1 parent 2a7274a commit 5dc2683
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
5 changes: 5 additions & 0 deletions app/assets/stylesheets/cargo_wiki/articles.css.sass
Expand Up @@ -7,6 +7,11 @@
.article, #article-preview .article, #article-preview
h1.title h1.title
margin-top: 1em margin-top: 1em

.tags_list
text-align: right
font-size: 1em

.body .body
font-size: 1.2em font-size: 1.2em
h1, h2, h3, h4, h5, h6 h1, h2, h3, h4, h5, h6
Expand Down
32 changes: 22 additions & 10 deletions app/assets/stylesheets/cargo_wiki/tags.css.sass
Expand Up @@ -5,29 +5,41 @@
@import cargo_wiki/mixins @import cargo_wiki/mixins


.tags_list .tags_list
text-align: center font-size: 1.2em
font-size: 1.3em


.css1, .css2, .css3, .css4 .tag
+link-colors($tag-color) +link-colors($tag-color)
+border-radius(45px) +border-radius(45px)
margin-bottom: 1em
display: inline-block display: inline-block
background-color: $tag-bg-color background-color: $tag-bg-color
color: $tag-color color: $tag-color
padding: 0.3em 0.5em 0em 0.5em padding: 0.2em 0.5em 0.3em 0.5em
text-decoration: none text-decoration: none
font-family: saxMonoRegular
border: 1px solid darken($tag-bg-color, 5) border: 1px solid darken($tag-bg-color, 5)
a
+link-colors($tag-color)
&:hover &:hover
background-color: darken($tag-bg-color, 40)
color: lighten($tag-bg-color, 50)
.weight
+border-radius(45px)
display: inline-block
font-size: 0.8em
margin-left: 0.5em
background-color: darken($tag-bg-color, 10) background-color: darken($tag-bg-color, 10)
color: lighten($tag-bg-color, 15)
width: 30px
text-align: center


.css1
font-size: 1.0em
.css2 .css2
font-size: 1.2em background-color: darken($tag-bg-color, 20)
color: lighten($tag-bg-color, 50)


.css3 .css3
font-size: 1.4em background-color: darken($tag-bg-color, 25)
color: lighten($tag-bg-color, 50)


.css4 .css4
font-size: 1.6em background-color: darken($tag-bg-color, 30)
color: lighten($tag-bg-color, 50)
2 changes: 1 addition & 1 deletion app/controllers/cargo_wiki/tags_controller.rb
Expand Up @@ -3,7 +3,7 @@ class TagsController < ApplicationController
respond_to :html, :json respond_to :html, :json


def index def index
@tags = ActsAsTaggableOn::Tag.where("name like ?", "%#{params[:q]}%").order('name ASC') @tags = CargoWiki::Article.tag_counts_on(:tags).order("name ASC")
respond_with(@tags) respond_with(@tags)
end end
end end
Expand Down
6 changes: 6 additions & 0 deletions app/views/cargo_wiki/articles/_article.html.haml
@@ -1,4 +1,10 @@
.article .article
%h1.title= article.title %h1.title= article.title

- unless article.tags.empty?
.tags_list
- article.tags.each do |tag|
= link_to tag.name, tag_articles_path(tag), :class => "tag"

- unless article.body.blank? - unless article.body.blank?
.body= find_and_preserve markdown(article.body) .body= find_and_preserve markdown(article.body)
2 changes: 1 addition & 1 deletion app/views/cargo_wiki/versions/index.html.haml
Expand Up @@ -22,5 +22,5 @@
%td= version.index %td= version.index
%td= link_to (version.next.try(:reify) || version.item).title, article_version_path(version.item, version) %td= link_to (version.next.try(:reify) || version.item).title, article_version_path(version.item, version)
%td= version.commit_message %td= version.commit_message
%td= version.created_by.username %td= version.created_by.try(:username) || version.item.author.username
%td=l version.created_at, :format => :short %td=l version.created_at, :format => :short
2 changes: 1 addition & 1 deletion config/initializers/paper_trail.rb
Expand Up @@ -2,7 +2,7 @@ class Version < ActiveRecord::Base
attr_accessible :commit_message attr_accessible :commit_message


def created_by def created_by
CargoWiki::User.find(self.whodunnit) CargoWiki::User.where(:id => self.whodunnit).first
end end


def article def article
Expand Down

0 comments on commit 5dc2683

Please sign in to comment.