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,15 +20,23 @@ class Trace < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def tagstring
|
def tagstring
|
||||||
return tags.collect {|tt| tt.tag}.join(" ")
|
return tags.collect {|tt| tt.tag}.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
def tagstring=(s)
|
def tagstring=(s)
|
||||||
self.tags = s.split().collect {|tag|
|
if s.include?','
|
||||||
tt = Tracetag.new
|
self.tags = s.split(/\s*,\s*/).collect {|tag|
|
||||||
tt.tag = tag
|
tt = Tracetag.new
|
||||||
tt
|
tt.tag = tag
|
||||||
}
|
tt
|
||||||
|
}
|
||||||
|
else
|
||||||
|
self.tags = s.split().collect {|tag|
|
||||||
|
tt = Tracetag.new
|
||||||
|
tt.tag = tag
|
||||||
|
tt
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def large_picture= (data)
|
def large_picture= (data)
|
||||||
|
|
|
@ -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} %>
|
<%= 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? %>
|
<% if !trace.tags.empty? %>
|
||||||
<%= t'trace.trace.in' %>
|
<%= t'trace.trace.in' %>
|
||||||
<% trace.tags.each do |tag| %>
|
<% trace.tags.each_with_index do |tag, index| %>
|
||||||
<%= link_to_tag tag.tag %>
|
<%= link_to_tag tag.tag %><%=', ' if index+1 < trace.tags.count %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
<td><%= t'trace.view.tags' %></td>
|
<td><%= t'trace.view.tags' %></td>
|
||||||
<td>
|
<td>
|
||||||
<% unless @trace.tags.empty? %>
|
<% unless @trace.tags.empty? %>
|
||||||
<% @trace.tags.each do |tag| %>
|
<% @trace.tags.each_with_index do |tag, index| %>
|
||||||
<%= link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } %>
|
<%= link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } %><%=', ' if index+1 < @trace.tags.count %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<i><%= t'trace.view.none' %></i>
|
<i><%= t'trace.view.none' %></i>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue