Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

redesigned the tags list

  • Loading branch information...
commit 5dc2683e5b6101f9af6c4932b3947772c3c7dd8f 1 parent 2a7274a
Rawane ZOSSOU authored
5 app/assets/stylesheets/cargo_wiki/articles.css.sass
View
@@ -7,6 +7,11 @@
.article, #article-preview
h1.title
margin-top: 1em
+
+ .tags_list
+ text-align: right
+ font-size: 1em
+
.body
font-size: 1.2em
h1, h2, h3, h4, h5, h6
32 app/assets/stylesheets/cargo_wiki/tags.css.sass
View
@@ -5,29 +5,41 @@
@import cargo_wiki/mixins
.tags_list
- text-align: center
- font-size: 1.3em
+ font-size: 1.2em
- .css1, .css2, .css3, .css4
+ .tag
+link-colors($tag-color)
+border-radius(45px)
+ margin-bottom: 1em
display: inline-block
background-color: $tag-bg-color
color: $tag-color
- padding: 0.3em 0.5em 0em 0.5em
+ padding: 0.2em 0.5em 0.3em 0.5em
text-decoration: none
- font-family: saxMonoRegular
border: 1px solid darken($tag-bg-color, 5)
+ a
+ +link-colors($tag-color)
&: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)
+ color: lighten($tag-bg-color, 15)
+ width: 30px
+ text-align: center
- .css1
- font-size: 1.0em
.css2
- font-size: 1.2em
+ background-color: darken($tag-bg-color, 20)
+ color: lighten($tag-bg-color, 50)
.css3
- font-size: 1.4em
+ background-color: darken($tag-bg-color, 25)
+ color: lighten($tag-bg-color, 50)
.css4
- font-size: 1.6em
+ background-color: darken($tag-bg-color, 30)
+ color: lighten($tag-bg-color, 50)
2  app/controllers/cargo_wiki/tags_controller.rb
View
@@ -3,7 +3,7 @@ class TagsController < ApplicationController
respond_to :html, :json
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)
end
end
6 app/views/cargo_wiki/articles/_article.html.haml
View
@@ -1,4 +1,10 @@
.article
%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?
.body= find_and_preserve markdown(article.body)
2  app/views/cargo_wiki/versions/index.html.haml
View
@@ -22,5 +22,5 @@
%td= version.index
%td= link_to (version.next.try(:reify) || version.item).title, article_version_path(version.item, version)
%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
2  config/initializers/paper_trail.rb
View
@@ -2,7 +2,7 @@ class Version < ActiveRecord::Base
attr_accessible :commit_message
def created_by
- CargoWiki::User.find(self.whodunnit)
+ CargoWiki::User.where(:id => self.whodunnit).first
end
def article
Please sign in to comment.
Something went wrong with that request. Please try again.