Sha256: f19ada7990d7af2cfdd762db6f1b184d5cb522ed3193644feab99593769d78fb

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

<%# Form UI behavior code and details;
Code:
  app/assets/javascripts/sufia/relationships
CSS:
  [data-behavior="remove-relationship"] : Button to remove its parent TR from the table
  [data-behavior="add-relationship"] : Button to clone its parent TR and inject a new row into the table
  .message.has-warning : Used to display UI errors related to input values and server errors
HTML Properties:
  table:
    [data-behavior="child-relationships"] : allows the javascript to be initialized
    data-param-key : the parameter key value for this model type
%>
<div class="form-group multi_value optional managed">
  <%= link_to "Attach New Work", polymorphic_path([main_app, :new, :curation_concerns, :parent, curation_concern.model_name.singular], parent_id: curation_concern.id), target: "_blank", class: 'btn btn-primary' %>

  <table class="table table-striped related-files" data-behavior="child-relationships" data-param-key="<%= f.object.model_name.param_key %>">
    <thead>
    <tr>
      <th>Child Work</th>
      <th>Actions</th>
    </tr>
    </thead>
    <tbody>

    <%= f.fields_for :work_members do |row| %>
        <tr>
          <td>
            <%= link_to row.object.title.first, [main_app, row.object] %>
          </td>
          <td>
            <a class="btn btn-danger" data-behavior="remove-relationship" data-index="<%= row.index %>">Remove</a>
          </td>
        </tr>
    <% end %>
    <tr>
      <td>
        <%= render "find_work_widget", f: f,
                                       name: 'child_work',
                                       id: f.object.model.id %>
        <div class="message has-warning hidden"></div>
      </td>
      <td>
        <a class="btn btn-primary" data-behavior="add-relationship">Add</a>
      </td>
    </tr>
    </tbody>
  </table>
</div>

<script type="text/x-tmpl" id="tmpl-child-work">
<tr>
  <td>{%= o.title %}</td>
  <td><button class="btn btn-danger" data-behavior="remove-relationship">Remove</button></td>
</tr>
</script>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sufia-7.4.1 app/views/curation_concerns/base/_form_child_work_relationships.html.erb
sufia-7.4.0 app/views/curation_concerns/base/_form_child_work_relationships.html.erb
sufia-7.3.1 app/views/curation_concerns/base/_form_child_work_relationships.html.erb
sufia-7.3.0 app/views/curation_concerns/base/_form_child_work_relationships.html.erb