#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

  • Clemens Kofler

    Clemens Kofler October 30th, 2009 @ 10:23 AM

    Hi Akzhan,

    sorry for getting back to you a bit late.

    I don't see a problem with the first proposal. If you can send a patch including a test, that would be awesome. As you say, we use Test::Unit, so please do use that instead of RSpec.

    As for the second proposal, I'd suggest that people just write their own tag cloud if they need it or use one of the gazillion plugins.

  • Marko Seppä

    Marko Seppä November 23rd, 2009 @ 11:38 AM

    • State changed from “new” to “open”
  • Julia Ann

    Julia Ann March 19th, 2021 @ 08:36 AM

    Golo Promo Code
    Golo team of doctors, researchers, pharmacists and formulators have spent over 9 years developing Release, an all-natural plant-based nutraceutical designed to balance hormones, increase metabolic efficiency, help combat Insulin Resistance and metabolic dysfunction.

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>