#335 open

Customization of tag links

Reported by Akzhan | October 1st, 2009 @ 10:40 AM

We need customization of links to tags (to easy adopt themes for AdvaCMS).

So here is our proposal to update
- app/helpers/content_helper.rb

  def link_to_tag(*args)
    options = args.extract_options!
    tag = args.pop
    section = args.pop
    route_name = :"#{section.class.name.downcase}_tag_path"
    text = args.pop || tag.name
    link_to(text, send(route_name, :section_id => section.id, :tags => tag), options)

And second proposal is tag cloud cell (typical for social networks):

  • app/cells/tag_cloud_cell.rb
class TagCloudCell < BaseCell
  has_state :index
  helper    :content

  def index

  • app/cells/tag_cloud/index.html.erb
<% if @section and @section.tag_counts.present? %>
<div class="tags">
  <% @section.tag_counts.each do |tag|
    weight = tag.count / 10
    weight = 5 if weight > 5
    weight = 1 if weight < 1
    <%= link_to_tag @section, tag, :class => "s#{weight}" %>
  <% end %>
<% end %>

We use RSpec instead of test unit so I do not send test cases.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<p>Cutting edge cms, blog, wiki, forum ... plattform.</p>

<p>Find the code on <a href="http://github.com/svenfuchs/adva_cms/tree/master">GitHub: adva cms</a></p>

<p>Part of the business application framework <a href="http://www.advabest.org/">adva best</a>.</p>