diff --git a/app/controllers/manage_tags_controller.rb b/app/controllers/manage_tags_controller.rb index 1a4aa29..c5794a4 100644 --- a/app/controllers/manage_tags_controller.rb +++ b/app/controllers/manage_tags_controller.rb @@ -10,12 +10,12 @@ class ManageTagsController < ApplicationController def list @parent = Tag.find(params[:parent]) if params[:parent] @tags = @parent ? @parent.children : Tag.roots - @pending_tags = Tag.find_pendings + @pending_tags = Tag.find_all_by_pending(true) end # Prompt for data to a new tag def new - @parent_tags = Tag.find(:all) + @parent_tags = Tag.find_all_by_pending(false) @tag = Tag.new end @@ -26,20 +26,20 @@ class ManageTagsController < ApplicationController flash[:notice] = _('Tag was successfully created.') redirect_to :action => 'list' else - @parent_tags = Tag.find(:all) + @parent_tags = Tag.find_all_by_pending(false) render :action => 'new' end end # Prompt for modifications on the attributes of a tag def edit - @tag = Tag.find_with_pendings(params[:id]) + @tag = Tag.find(params[:id]) @parent_tags = @tag.parent_candidates end # Do the modifications collected by edit def update - @tag = Tag.find_with_pendings(params[:id]) + @tag = Tag.find(params[:id]) if @tag.update_attributes(params[:tag]) flash[:notice] = _('Tag was successfully updated.') redirect_to :action => 'list' @@ -51,7 +51,7 @@ class ManageTagsController < ApplicationController # Destroy a tag and all its children def destroy - @tag = Tag.find_with_pendings(params[:id]) + @tag = Tag.find(params[:id]) if @tag.destroy flash[:notice] = _('Tag was successfuly destroyed') end @@ -60,7 +60,7 @@ class ManageTagsController < ApplicationController # Approve a pending tag so now ita can be used to tag things def approve - @tag = Tag.find_with_pendings(params[:id]) + @tag = Tag.find(params[:id]) if @tag.update_attribute(:pending, false) flash[:notice] = _('Tag was successfuly approved') redirect_to :action => 'list' @@ -69,6 +69,6 @@ class ManageTagsController < ApplicationController # Full-text search for tags that have the query terms def search - @tags_found = Tag.find_by_contents(params[:query]) + @tags_found = Tag.find_all_by_name_and_pending(params[:query], false) end end diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 3ea53e4..3ed3818 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -48,7 +48,7 @@
diff --git a/config/environment.rb b/config/environment.rb index dcef1fa..7e4bb50 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -53,7 +53,6 @@ end # Include your application configuration below require 'gettext/rails' -#require 'extended_tag' Tag.hierarchical = true Comatose.configure do |config| diff --git a/test/functional/manage_tags_controller_test.rb b/test/functional/manage_tags_controller_test.rb index 17cdb7b..cd2174d 100644 --- a/test/functional/manage_tags_controller_test.rb +++ b/test/functional/manage_tags_controller_test.rb @@ -103,13 +103,13 @@ class ManageTagsControllerTest < Test::Unit::TestCase post :approve, :id => pending_tag.id assert_response :redirect assert_redirected_to :action => 'list' - assert ( not Tag.find_with_pendings(pending_tag.id).pending? ) + assert ( not Tag.find(pending_tag.id).pending? ) end def test_search found_tag = Tag.create(:name => 'found_tag') lost_tag = Tag.create(:name => 'lost_tag') - post :search, :query => 'found*' + post :search, :query => 'found_tag' assert_not_nil assigns(:tags_found) assert assigns(:tags_found).include?(found_tag) assert (not assigns(:tags_found).include?(lost_tag)) -- libgit2 0.21.2