Commit 6612138c84be61a8c0f229448c39e7593dbc4f27
1 parent
429ffa3d
Exists in
master
and in
29 other branches
ActionItem4: _list.rhtml pratial removed and _a_tag.rhtml added in its place.
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@52 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
11 additions
and
10 deletions
Show diff stats
app/controllers/manage_tags_controller.rb
@@ -26,8 +26,9 @@ class ManageTagsController < ApplicationController | @@ -26,8 +26,9 @@ class ManageTagsController < ApplicationController | ||
26 | end | 26 | end |
27 | 27 | ||
28 | def edit | 28 | def edit |
29 | - @parent_tags = Tag.find_all | ||
30 | @tag = Tag.find(params[:id]) | 29 | @tag = Tag.find(params[:id]) |
30 | + @parent_tags = Tag.find_all.select{|pt| !pt.ancestors.include?(@tag) and pt != @tag} | ||
31 | + | ||
31 | end | 32 | end |
32 | 33 | ||
33 | def update | 34 | def update |
app/views/manage_tags/_form.rhtml
1 | Name: <%= text_field 'tag', 'name' %> <br> | 1 | Name: <%= text_field 'tag', 'name' %> <br> |
2 | -Parent tag: <%= select_tag 'parent_id', ['<option value="0"></option>'] + @parent_tags.select{|pt| !pt.ancestors.include?(@tag) and pt != @tag}.map {|n|"<option value=\"#{n.id}\" #{'selected="selected"' if @tag.parent == n} >" + n.name + '</option>'} %> <br> | 2 | +Parent tag: <%= select_tag 'parent_id', ['<option value="0"></option>'] + @parent_tags.map {|pt|"<option value=\"#{pt.id}\" #{'selected="selected"' if @tag.parent == pt} >" + pt.name + '</option>'} %> <br> |