Sha256: dd6d5e444f69e282c74f5e4fad5a7ad9642a218077f514e04920b8074d8ca0c1
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
module CortexReaver class TagController < Ramaze::Controller MODEL = Tag map '/tags' layout '/text_layout' template :edit, :form template :new, :form engine :Erubis helper :cache, :error, :auth, :form, :workflow, :navigation, :canonical, :crud cache :index, :ttl => 60 cache :show, :ttl => 60 on_save do |tag, request| tag.title = request[:title] tag.name = Tag.canonicalize request[:name], tag.id end def index(*ids) if ids.size > 0 raw_redirect Rs([:show] + ids), :status => 301 else # Index @title = "All Tags" @tags = Tag.order(:count).reverse render_template :list end end def show(*ids) # Find tags tags = [] bad_ids = [] ids.each do |id| if tag = Tag.get(id) tags << tag else bad_ids << id end end # Error message unless bad_ids.empty? flash[:error] = "No tags called #{h bad_ids.join(', ')}." end if tags.empty? # Index redirect :index else # Specific tags @tags = tags @title = "Tags: #{tags.join(', ')}" end end # Tags are only created through tagging. def new error_404 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cortex-reaver-0.0.4 | lib/cortex_reaver/controller/tag.rb |
cortex-reaver-0.0.5 | lib/cortex_reaver/controller/tag.rb |
cortex-reaver-0.0.6 | lib/cortex_reaver/controller/tag.rb |