-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Several spec tests fixed for protonyms, returning to Material form, a…
…dding content injection via javascript. from mx approach.
- Loading branch information
Showing
12 changed files
with
90 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* On click of an element, this will insert a given string of HTML data into the DOM | ||
* according to a selector | ||
* | ||
* insert-content = CGI.escapeHTML( the HTML content you want to insert ) | ||
* insert-content-parent (optional) -- the value to pass into 'closest' to go up the tree | ||
* insert-content-target (optional) -- the value to pass to $(this).find( ) to go down the tree | ||
* | ||
* if you provide no content-parent or target, the content is appended to the clicked element. !! not quite true at present | ||
* | ||
* Remember that you can use CSS jquery selectors , like :not() and :first-child, :last-child, etc. etc. | ||
*/ | ||
|
||
(function ($) { | ||
$.fn.mx_insert_content = function() { | ||
if (!this.length) { return this; } | ||
return this.each(function() { | ||
var $this = $(this); | ||
var content = $("<div/>").html($this.data('insertContent')).text(); | ||
var parent = $this.data('insertContentParent'); // doesn't work when null | ||
var selector = $this.data('insertContentTarget'); // doesn't work when null | ||
|
||
$this.click(function(evt) { | ||
$this.closest(parent).find(selector).append($(content)); | ||
evt.preventDefault(); | ||
}); | ||
}); | ||
}; | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 11 additions & 22 deletions
33
app/views/tasks/accessions/quick/verbatim_material/_attribute_form.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,16 @@ | ||
<% @biocuration_groups.each_with_index do |bg, i| %> | ||
<div class='flexbox'> | ||
<div class='item item1'> | ||
Total: <%= number_field_tag("collection_objects[object#{i}][total]") %> | ||
</div> | ||
|
||
<div class="item item2"> | ||
<fieldset > | ||
<%= content_tag(:legend, bg.name) -%> | ||
<% bg.biocuration_classes.each do |bc| %> | ||
<%= content_tag(:label, bc.name) -%> <%= check_box_tag("collection_objects[object#{i}][biocuration_classes][#{bc.id}]" ) -%> | ||
<% end %> | ||
</fieldset> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% if @biocuration_groups.count == 0 -%> | ||
<div class='item item1'> | ||
Total: <%= number_field_tag("collection_objects[object1][total]") %> | ||
</div> | ||
<% end %> | ||
|
||
<div class="counts"> | ||
|
||
<% @biocuration_groups.each_with_index do |bg, i| %> | ||
<%= render 'attribute_row', locals: {i: i, bg: bg} %> | ||
|
||
<div id="blorf" >here </div> | ||
|
||
<%= link_to("foo", "#", | ||
'data-insert-content' => CGI.escapeHTML(render 'attribute_row'), | ||
'data-insert-content-target' => 'div#blorf', | ||
'data-insert-content-parent' =>".subform" ) -%> | ||
<% end %> | ||
</div> | ||
|
||
<% if @biocuration_groups.count == 0 -%> <div class='item item1'> Total: <%= number_field_tag("collection_objects[object1][total]") %> </div> <% end %> |
14 changes: 14 additions & 0 deletions
14
app/views/tasks/accessions/quick/verbatim_material/_attribute_row.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class='flexbox'> | ||
<div class='item item1'> | ||
Total: <%= number_field_tag("collection_objects[object#{i}][total]") %> | ||
</div> | ||
|
||
<div class="item item2"> | ||
<fieldset > | ||
<%= content_tag(:legend, bg.name) -%> | ||
<% bg.biocuration_classes.each do |bc| %> | ||
<%= content_tag(:label, bc.name) -%> <%= check_box_tag("collection_objects[object#{i}][biocuration_classes][#{bc.id}]" ) -%> | ||
<% end %> | ||
</fieldset> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters