diff --git a/app/controllers/manage_tags_controller.rb b/app/controllers/manage_tags_controller.rb
new file mode 100644
index 0000000..97e9e55
--- /dev/null
+++ b/app/controllers/manage_tags_controller.rb
@@ -0,0 +1,27 @@
+class ManageTagsController < ApplicationController
+ def index
+ list
+ render :action => 'list'
+ end
+
+ def list
+ @tags = Tag.find_all
+ end
+
+ def new
+ @tags = Tag.find_all
+ @tag = Tag.new
+ end
+
+ def create
+ @tag = Tag.new
+ @tag.name = params[:tag][:name]
+ @tag.parent = Tag.find(params[:parent_id].to_i) if params[:parent_id] != "0"
+ if @tag.save
+ flash[:notice] = _('Tag was successfully created.')
+ redirect_to :action => 'list'
+ else
+ render :action => 'new'
+ end
+ end
+end
diff --git a/app/views/manage_tags/_form.rhtml b/app/views/manage_tags/_form.rhtml
new file mode 100644
index 0000000..2f9931a
--- /dev/null
+++ b/app/views/manage_tags/_form.rhtml
@@ -0,0 +1,3 @@
+
+Name: <%= text_field 'tag', 'name' %>
+Parent tag: <%= select_tag 'parent_id', [''] + @tags.map {|n|"'} %>
diff --git a/app/views/manage_tags/_list.rhtml b/app/views/manage_tags/_list.rhtml
new file mode 100644
index 0000000..b4e7622
--- /dev/null
+++ b/app/views/manage_tags/_list.rhtml
@@ -0,0 +1,8 @@
+
+<%= a_tag.name %>
+
+<% a_tag.children.each do |child|%>
+<%= render :partial =>'list', :locals => {:a_tag => child} %>
+<% end %>
+
+
diff --git a/app/views/manage_tags/list.rhtml b/app/views/manage_tags/list.rhtml
new file mode 100644
index 0000000..4ab2e35
--- /dev/null
+++ b/app/views/manage_tags/list.rhtml
@@ -0,0 +1,9 @@
+ <%= _("Listing tags") %>
+
+
+ <% @tags.select{|t| !t.parent }.each do |a_tag| %>
+ <%= render :partial => 'list', :locals => {:a_tag => a_tag} %>
+ <% end %>
+
+
+<%= link_to _('New tag'), {:action => 'new'} %>
diff --git a/app/views/manage_tags/new.rhtml b/app/views/manage_tags/new.rhtml
new file mode 100644
index 0000000..9ab7dbf
--- /dev/null
+++ b/app/views/manage_tags/new.rhtml
@@ -0,0 +1,6 @@
+ <%= _('New tag') %>
+
+<%= start_form_tag :action =>'create' %>
+ <%= render :partial => 'form' %>
+ <%= submit_tag 'Create' %>
+<%= end_form_tag %>
diff --git a/db/migrate/007_acts_as_taggable_migration.rb b/db/migrate/007_acts_as_taggable_migration.rb
new file mode 100644
index 0000000..bc18355
--- /dev/null
+++ b/db/migrate/007_acts_as_taggable_migration.rb
@@ -0,0 +1,27 @@
+class ActsAsTaggableMigration < ActiveRecord::Migration
+ def self.up
+ create_table :tags do |t|
+ t.column :name, :string
+ t.column :parent_id, :integer
+ end
+
+ create_table :taggings do |t|
+ t.column :tag_id, :integer
+ t.column :taggable_id, :integer
+
+ # You should make sure that the column created is
+ # long enough to store the required class names.
+ t.column :taggable_type, :string
+
+ t.column :created_at, :datetime
+ end
+
+ add_index :taggings, :tag_id
+ add_index :taggings, [:taggable_id, :taggable_type]
+ end
+
+ def self.down
+ drop_table :taggings
+ drop_table :tags
+ end
+end
--
libgit2 0.21.2