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 | 37 | |
| 38 | 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 | 44 | session[:notice] = _('Triple(s) succesfully updated.') | ... | ... |
plugins/virtuoso/views/virtuoso_plugin_admin/triple_management.html.erb
| ... | ... | @@ -16,25 +16,29 @@ |
| 16 | 16 | |
| 17 | 17 | <ul id="triples-list"> |
| 18 | 18 | |
| 19 | + <% triple_counter = 1 %> | |
| 20 | + | |
| 19 | 21 | <% @triples.each { |triple| %> |
| 20 | 22 | |
| 21 | 23 | <li> |
| 22 | 24 | <ul class="triple"> |
| 23 | 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 | 28 | </li> |
| 27 | 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 | 32 | </li> |
| 31 | 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 | 36 | </li> |
| 35 | 37 | </ul> |
| 36 | 38 | </li> |
| 37 | 39 | |
| 40 | + <% triple_counter += 1 %> | |
| 41 | + | |
| 38 | 42 | <% } %> |
| 39 | 43 | |
| 40 | 44 | </ul> | ... | ... |