From fac34d85c6834566370db394ee8c88a940ad2ef4 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Tue, 10 Jul 2007 21:09:08 +0000 Subject: [PATCH] ActionItem4: adding pending tags --- app/controllers/manage_tags_controller.rb | 8 +++++--- app/views/manage_tags/_form.rhtml | 1 + app/views/manage_tags/list.rhtml | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/manage_tags_controller.rb b/app/controllers/manage_tags_controller.rb index ba574c3..4a8f601 100644 --- a/app/controllers/manage_tags_controller.rb +++ b/app/controllers/manage_tags_controller.rb @@ -1,3 +1,4 @@ +require 'extended_tag' class ManageTagsController < ApplicationController def index list @@ -6,7 +7,8 @@ class ManageTagsController < ApplicationController def list @parent = Tag.find(params[:parent]) if params[:parent] - @tags = Tag.find_all_by_parent_id(params[:parent]) + @tags = Tag.find_all_by_parent_id(params[:parent]).select{|t|!t.pending?} + @pending_tags = Tag.find_all.select(&:pending?) end def new @@ -18,6 +20,7 @@ class ManageTagsController < ApplicationController @tag = Tag.new @tag.name = params[:tag][:name] @tag.parent = Tag.find(params[:parent_id].to_i) if params[:parent_id] != "0" + @tag.pending = params[:tag][:pending] if @tag.save flash[:notice] = _('Tag was successfully created.') redirect_to :action => 'list' @@ -28,8 +31,7 @@ class ManageTagsController < ApplicationController def edit @tag = Tag.find(params[:id]) - @parent_tags = Tag.find_all.select{|pt| !pt.ancestors.include?(@tag) and pt != @tag} - + @parent_tags = Tag.find_all - @tag.descendents - [@tag] end def update diff --git a/app/views/manage_tags/_form.rhtml b/app/views/manage_tags/_form.rhtml index f3d8b04..6a221d9 100644 --- a/app/views/manage_tags/_form.rhtml +++ b/app/views/manage_tags/_form.rhtml @@ -1,2 +1,3 @@ Name: <%= text_field 'tag', 'name' %>
Parent tag: <%= select_tag 'parent_id', [''] + @parent_tags.map {|pt|"'} %>
+Pending: <%= check_box 'tag', 'pending' %>
diff --git a/app/views/manage_tags/list.rhtml b/app/views/manage_tags/list.rhtml index be52c35..61e797e 100644 --- a/app/views/manage_tags/list.rhtml +++ b/app/views/manage_tags/list.rhtml @@ -4,5 +4,11 @@ <%= render :partial => 'a_tag', :collection => @tags %> + +

<%= _('Pending Tags') %>

+ + <%= link_to _('Up'), {:action => 'list', :parent => @parent.parent} if @parent %> <%= link_to _('New tag'), {:action => 'new'} %> -- libgit2 0.21.2