Commit e26c17d1d6a86f15f925b93a53ab094ca5b90239

Authored by Victor Costa
1 parent 88636e00

virtuoso: fix template content

plugins/virtuoso/lib/virtuoso_plugin/triples_template.rb
... ... @@ -25,8 +25,9 @@ class VirtuosoPlugin::TriplesTemplate < Article
25 25 end
26 26  
27 27 def template_content
28   - plugin.virtuoso_client.query(query).map do |r|
29   - template % r
  28 + result = plugin.virtuoso_client.query(query)
  29 + result.map do |r|
  30 + template.gsub(/%\{.*\}/) {|s| r["#{s.delete('%|{|}')}"]}
30 31 end.join
31 32 end
32 33  
... ...
plugins/virtuoso/views/cms/virtuoso_plugin/_triples_template.html.erb
... ... @@ -6,5 +6,5 @@
6 6 <%= labelled_form_field(_('SPARQL Query'), text_area(:article, :query, :style => 'width: 98%; height: 120px;')) %>
7 7 <%= labelled_form_field(_('Template'), text_area(:article, :template, :style => 'width: 98%; height: 200px;', :class => 'mceEditor')) %>
8 8  
9   -<%= render :partial => 'general_fields' %>
10 9 <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %>
  10 +<%= render :partial => 'general_fields' %>
... ...