Commit e26c17d1d6a86f15f925b93a53ab094ca5b90239
1 parent
88636e00
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
virtuoso: fix template content
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
plugins/virtuoso/lib/virtuoso_plugin/triples_template.rb
| @@ -25,8 +25,9 @@ class VirtuosoPlugin::TriplesTemplate < Article | @@ -25,8 +25,9 @@ class VirtuosoPlugin::TriplesTemplate < Article | ||
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | def template_content | 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 | end.join | 31 | end.join |
| 31 | end | 32 | end |
| 32 | 33 |
plugins/virtuoso/views/cms/virtuoso_plugin/_triples_template.html.erb
| @@ -6,5 +6,5 @@ | @@ -6,5 +6,5 @@ | ||
| 6 | <%= labelled_form_field(_('SPARQL Query'), text_area(:article, :query, :style => 'width: 98%; height: 120px;')) %> | 6 | <%= labelled_form_field(_('SPARQL Query'), text_area(:article, :query, :style => 'width: 98%; height: 120px;')) %> |
| 7 | <%= labelled_form_field(_('Template'), text_area(:article, :template, :style => 'width: 98%; height: 200px;', :class => 'mceEditor')) %> | 7 | <%= labelled_form_field(_('Template'), text_area(:article, :template, :style => 'width: 98%; height: 200px;', :class => 'mceEditor')) %> |
| 8 | 8 | ||
| 9 | -<%= render :partial => 'general_fields' %> | ||
| 10 | <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> | 9 | <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> |
| 10 | +<%= render :partial => 'general_fields' %> |