Skip to content

Commit

Permalink
Making Ref Attributes Editable - Form updates
Browse files Browse the repository at this point in the history
  - Moved reference attr display from relationship tab to primary tab
  - added delete buttons for each attribute
    - located on left based on user feedback
  - added replace value fields
  - added new attribute key/value entry

Currently non-functional.

Bumps #431
  • Loading branch information
lomky committed May 3, 2017
1 parent cebe173 commit de0212e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 9 deletions.
50 changes: 50 additions & 0 deletions lib/Tuba/files/templates/reference/update_form.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,53 @@
</div>
%= end

%= hidden_field 'delete_pub_attr';
%= form_for obj_uri_for($object,'update_attr') => class => 'form-horizontal' => method => 'POST' => begin
<div class="well">
<p><strong>Note:</strong> Reference Attributes should not be updated to reflect new information. They are intended to be correct as of the time of the reference. Updating should only be done if there is incorrect data.</p>
<table class='table table-responsive table-condensed table-bordered densetable'>
<caption>Attributes</caption>
<tr>
<th>Delete</th>
<th>Key</th>
<th>Current Value</th>
<th>Replace Value</th>
</tr>
% for my $k (sort keys %{ $reference->attrs }) {
<tr>
<td><%= tag 'button' => class => 'btn btn-danger squeezevert' => tabindex => "-1", onClick => qq[{this.form.elements["delete_pub_attr"].value = '].$k.qq['; this.form.submit(); }] => begin %>delete<%= end %></td>
<td><%= $k %></td>
<td><%= $reference->attrs->{$k} %></td>
<td><%= text_field 'attribute_'.$k, class => "form-control input-small squeezevert" %></td>
</tr>
% }
</table>
<h4>New Attribute</h4>
<div class='form-group row'>
<div class='col-lg-1 col-md-1 col-sm-1 control-label'>
%= label_for 'new_attr_key', class => 'required' => begin
Key
%= end
</div>
<div class='col-lg-2 col-md-2 col-sm-2'>
<%= text_field 'new_attr_key', class => "form-control input-small squeezevert" %>
</div>
<div class='col-lg-1 col-md-1 col-sm-1 control-label'>
%= label_for 'new_attr_value', class => 'required' => begin
Value
%= end
</div>
<div class='col-lg-4 col-md-4 col-sm-4'>
<%= text_field 'new_attr_value', class => "form-control input-small squeezevert" %>
</div>
</div> <!--- End new attr div --->

<div class="row">
<div class="col-lg-3 col-lg-offset-2 col-md-3 col-md-offset-2 col-sm-4 col-sm-offset-2">
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>

%= end

9 changes: 0 additions & 9 deletions lib/Tuba/files/templates/reference/update_rel_form.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,5 @@

%= end
<br />
<table class='table table-responsive table-striped table-bordered squeeze'>
<caption>Attributes</caption>
% for my $k (sort keys %{ $reference->attrs }) {
<tr>
<td><%= $k %></td>
<td><%= $reference->attrs->{$k} %></td>
</tr>
% }
</table>
</div>

0 comments on commit de0212e

Please sign in to comment.