-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We've struggled a bit to get this to load (#804, #886); but I don't see any downside to just adding the class up-front. This fixes the issue lecally for me reliabily, and doesn't seem to degrade other behavior at all. See #785, #804, #866, #873, #874, & #876.
- Loading branch information
Tom Johnson
committed
Feb 6, 2018
1 parent
d0e688b
commit d6085cb
Showing
2 changed files
with
134 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Blacklight.onLoad(function() { | ||
$('#fileupload').bind('fileuploadadd', function (e, data) { | ||
$('.template-upload').addClass('in'); | ||
$('.template-upload').addClass('in') | ||
}); | ||
}); |
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,133 @@ | ||
<!-- The template to display files available for upload --> | ||
<% fade_class_if_not_test = Rails.env.test? ? '' : 'fade' %> | ||
<script id="template-upload" type="text/x-tmpl"> | ||
{% for (var i=0, file; file=o.files[i]; i++) { %} | ||
<tr class="template-upload <%= fade_class_if_not_test %> in"> | ||
<td> | ||
<span class="preview"></span> | ||
</td> | ||
<td> | ||
<p class="name">{%=file.name%}</p> | ||
<strong class="error text-danger"></strong> | ||
</td> | ||
<td> | ||
<p class="size">Processing...</p> | ||
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div> | ||
</td> | ||
<td> | ||
{% if (!i && !o.options.autoUpload) { %} | ||
<button class="btn btn-primary start" disabled> | ||
<i class="glyphicon glyphicon-upload"></i> | ||
<span>Start</span> | ||
</button> | ||
{% } %} | ||
{% if (!i) { %} | ||
<button class="btn btn-warning cancel"> | ||
<i class="glyphicon glyphicon-ban-circle"></i> | ||
<span>Cancel</span> | ||
</button> | ||
{% } %} | ||
</td> | ||
</tr> | ||
{% } %} | ||
</script> | ||
|
||
<!-- function used by the following template --> | ||
<script type="text/javascript"> | ||
function setAllResourceTypes(resourceTypeId) { | ||
var firstResourceType = $("#resource_type_" + resourceTypeId.toString())[0]; | ||
var selected_options = []; | ||
for (var i = 0; i < firstResourceType.length; i++) { | ||
if (firstResourceType.options[i].selected) { | ||
selected_options.push(firstResourceType.options[i].value); | ||
} | ||
} | ||
$(".resource_type_dropdown").each(function(index, element) { | ||
for(var i=0; i< this.length; i++) { | ||
this.options[i].selected = | ||
$.inArray(this.options[i].value, selected_options) > -1 ? true : false; | ||
} | ||
}); | ||
} | ||
</script> | ||
|
||
<!-- The template to display files available for download --> | ||
<script id="batch-template-download" type="text/x-tmpl"> | ||
{% for (var i=0, file; file=o.files[i]; i++) { %} | ||
<tr class="template-download <%= fade_class_if_not_test %>"> | ||
<td> | ||
<div class="row"> | ||
<div class="col-sm-6 name"> | ||
<span>{%=file.name%}</span> | ||
<input type="hidden" name="uploaded_files[]" value="{%=file.id%}"> | ||
</div> | ||
<div class="col-sm-6"> | ||
{% if (file.error) { %} | ||
<div><span class="label label-danger">Error</span> {%=file.error%}</div> | ||
{% } %} | ||
<span class="size">{%=o.formatFileSize(file.size)%}</span> | ||
<button class="btn btn-danger delete pull-right" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}> | ||
<i class="glyphicon glyphicon-trash"></i> | ||
<span>Delete</span> | ||
</button> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-sm-12 form-horizontal"> | ||
<div class="form-group"> | ||
<label for="title_{%=file.id%}" class="col-sm-5 control-label">Display label</label> | ||
<div class="col-sm-7"> | ||
<input type="text" class="form-control" name="title[{%=file.id%}]" id="title_{%=file.id%}" value="{%=file.name%}"> | ||
</div> | ||
<label for="resource_type_{%=file.id%}" class="col-sm-5 control-label">Resource Type</label> | ||
<div class="col-sm-7"> | ||
<select class="form-control resource_type_dropdown" multiple="multiple" size="6" name="resource_type[{%=file.id%}][]" id="resource_type_{%=file.id%}" value="{%=file.name%}"> | ||
<%= options_for_select(Hyrax::ResourceTypesService.select_options) %> | ||
</select> | ||
<button class="btn pull-right resource_type_button" onClick="setAllResourceTypes({%= file.id %}); return false;">Set all to this Resource Type</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</td> | ||
</tr> | ||
{% } %} | ||
</script> | ||
|
||
<!-- Simpler display of files available for download. Originally from hyrax/base/_form_files --> | ||
<!-- TODO: further consolidate with template-download above --> | ||
<script id="template-download" type="text/x-tmpl"> | ||
{% for (var i=0, file; file=o.files[i]; i++) { %} | ||
<tr class="template-download <%= fade_class_if_not_test %>"> | ||
<td> | ||
<span class="preview"> | ||
{% if (file.thumbnailUrl) { %} | ||
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a> | ||
{% } %} | ||
</span> | ||
</td> | ||
<td> | ||
<p class="name"> | ||
{% if (file.url) { %} | ||
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a> | ||
{% } else { %} | ||
<span>{%=file.name%}</span> | ||
{% } %} | ||
<input type="hidden" name="uploaded_files[]" value="{%=file.id%}"> | ||
</p> | ||
{% if (file.error) { %} | ||
<div><span class="label label-danger">Error</span> {%=file.error%}</div> | ||
{% } %} | ||
</td> | ||
<td> | ||
<span class="size">{%=o.formatFileSize(file.size)%}</span> | ||
</td> | ||
<td> | ||
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}> | ||
<i class="glyphicon glyphicon-trash"></i> | ||
<span>Delete</span> | ||
</button> | ||
</td> | ||
</tr> | ||
{% } %} | ||
</script> |