Commit a3f0f5620129b63853fd55d1ca6924af24ea5c36
1 parent
ebabc712
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
virtuoso: fix issue submitting multiple triples to update
Showing
2 changed files
with
12 additions
and
10 deletions
Show diff stats
plugins/virtuoso/controllers/virtuoso_plugin_admin_controller.rb
| @@ -37,10 +37,8 @@ class VirtuosoPluginAdminController < AdminController | @@ -37,10 +37,8 @@ class VirtuosoPluginAdminController < AdminController | ||
| 37 | 37 | ||
| 38 | triples_management = VirtuosoPlugin::TriplesManagement.new(environment) | 38 | triples_management = VirtuosoPlugin::TriplesManagement.new(environment) |
| 39 | 39 | ||
| 40 | - triples.each { |triple| | ||
| 41 | - from_triple = triple[:from] | ||
| 42 | - to_triple = triple[:to] | ||
| 43 | - triples_management.update_triple(graph_uri, from_triple, to_triple) | 40 | + triples.each { |triple_key, triple_content| |
| 41 | + triples_management.update_triple(graph_uri, triple_content[:from], triple_content[:to]) | ||
| 44 | } | 42 | } |
| 45 | 43 | ||
| 46 | session[:notice] = _('Triple(s) succesfully updated.') | 44 | session[:notice] = _('Triple(s) succesfully updated.') |
plugins/virtuoso/views/virtuoso_plugin_admin/triple_management.html.erb
| @@ -16,25 +16,29 @@ | @@ -16,25 +16,29 @@ | ||
| 16 | 16 | ||
| 17 | <ul id="triples-list"> | 17 | <ul id="triples-list"> |
| 18 | 18 | ||
| 19 | + <% triple_counter = 1 %> | ||
| 20 | + | ||
| 19 | <% @triples.each { |triple| %> | 21 | <% @triples.each { |triple| %> |
| 20 | 22 | ||
| 21 | <li> | 23 | <li> |
| 22 | <ul class="triple"> | 24 | <ul class="triple"> |
| 23 | <li> | 25 | <li> |
| 24 | - <%= hidden_field_tag('triples[][from[subject]]', triple[:s].to_s) %> | ||
| 25 | - <%= labelled_form_field(_('Subject:'), text_field_tag('triples[][to[subject]]', triple[:s].to_s) ) %> | 26 | + <%= hidden_field_tag("triples[triple#{triple_counter}[from][subject]]", triple[:s].to_s) %> |
| 27 | + <%= labelled_form_field(_('Subject:'), text_field_tag("triples[triple#{triple_counter}[to][subject]]", triple[:s].to_s) ) %> | ||
| 26 | </li> | 28 | </li> |
| 27 | <li> | 29 | <li> |
| 28 | - <%= hidden_field_tag('triples[][from[predicate]]', triple[:p].to_s) %> | ||
| 29 | - <%= labelled_form_field(_('Predicate:'), text_field_tag('triples[][to[predicate]]', triple[:p].to_s) ) %> | 30 | + <%= hidden_field_tag("triples[triple#{triple_counter}[from][predicate]]", triple[:p].to_s) %> |
| 31 | + <%= labelled_form_field(_('Predicate:'), text_field_tag("triples[triple#{triple_counter}[to][predicate]]", triple[:p].to_s) ) %> | ||
| 30 | </li> | 32 | </li> |
| 31 | <li> | 33 | <li> |
| 32 | - <%= hidden_field_tag('triples[][from[object]]', triple[:o].to_s) %> | ||
| 33 | - <%= labelled_form_field(_('Object:'), text_field_tag('triples[][to[object]]', triple[:o].to_s) ) %> | 34 | + <%= hidden_field_tag("triples[triple#{triple_counter}[from][object]]", triple[:o].to_s) %> |
| 35 | + <%= labelled_form_field(_('Object:'), text_field_tag("triples[triple#{triple_counter}[to][object]]", triple[:o].to_s) ) %> | ||
| 34 | </li> | 36 | </li> |
| 35 | </ul> | 37 | </ul> |
| 36 | </li> | 38 | </li> |
| 37 | 39 | ||
| 40 | + <% triple_counter += 1 %> | ||
| 41 | + | ||
| 38 | <% } %> | 42 | <% } %> |
| 39 | 43 | ||
| 40 | </ul> | 44 | </ul> |