Commit 6612138c84be61a8c0f229448c39e7593dbc4f27

Authored by MoisesMachado
1 parent 429ffa3d

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
app/controllers/manage_tags_controller.rb
... ... @@ -26,8 +26,9 @@ class ManageTagsController < ApplicationController
26 26 end
27 27  
28 28 def edit
29   - @parent_tags = Tag.find_all
30 29 @tag = Tag.find(params[:id])
  30 + @parent_tags = Tag.find_all.select{|pt| !pt.ancestors.include?(@tag) and pt != @tag}
  31 +
31 32 end
32 33  
33 34 def update
... ...
app/views/manage_tags/_a_tag.rhtml 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +<li>
  2 +<%= a_tag.name %>
  3 +<%= link_to _('Edit'), {:action => 'edit', :id => a_tag } %>
  4 +<%= link_to _('Destroy'), {:action => 'destroy', :id => a_tag} %>
  5 +<ul>
  6 + <%= render :partial => 'a_tag', :collection => a_tag.children %>
  7 +</ul>
  8 +</li>
... ...
app/views/manage_tags/_form.rhtml
1 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>
... ...
app/views/manage_tags/_list.rhtml
... ... @@ -1,8 +0,0 @@
1   -<li>
2   -<%= a_tag.name %>
3   -<ul>
4   -<% a_tag.children.each do |child|%>
5   -<%= render :partial =>'list', :locals => {:a_tag => child} %>
6   -<% end %>
7   -</ul>
8   -</li>