Introducing comma as tag separator (if present, otherwise it behaves as before), allowing spaces in tags. fixes #2032
This commit is contained in:
parent
c0b9420c7b
commit
ebbcf63f0d
3 changed files with 18 additions and 10 deletions
|
@ -20,16 +20,24 @@ class Trace < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def tagstring
|
||||
return tags.collect {|tt| tt.tag}.join(" ")
|
||||
return tags.collect {|tt| tt.tag}.join(", ")
|
||||
end
|
||||
|
||||
def tagstring=(s)
|
||||
if s.include?','
|
||||
self.tags = s.split(/\s*,\s*/).collect {|tag|
|
||||
tt = Tracetag.new
|
||||
tt.tag = tag
|
||||
tt
|
||||
}
|
||||
else
|
||||
self.tags = s.split().collect {|tag|
|
||||
tt = Tracetag.new
|
||||
tt.tag = tag
|
||||
tt
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def large_picture= (data)
|
||||
f = File.new(large_picture_name, "wb")
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
<%= t'trace.trace.by' %> <%=link_to h(trace.user.display_name), {:controller => 'user', :action => 'view', :display_name => trace.user.display_name} %>
|
||||
<% if !trace.tags.empty? %>
|
||||
<%= t'trace.trace.in' %>
|
||||
<% trace.tags.each do |tag| %>
|
||||
<%= link_to_tag tag.tag %>
|
||||
<% trace.tags.each_with_index do |tag, index| %>
|
||||
<%= link_to_tag tag.tag %><%=', ' if index+1 < trace.tags.count %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
<td><%= t'trace.view.tags' %></td>
|
||||
<td>
|
||||
<% unless @trace.tags.empty? %>
|
||||
<% @trace.tags.each do |tag| %>
|
||||
<%= link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } %>
|
||||
<% @trace.tags.each_with_index do |tag, index| %>
|
||||
<%= link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } %><%=', ' if index+1 < @trace.tags.count %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<i><%= t'trace.view.none' %></i>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue