Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
* master:
  Update CHANGELOG
  Remove 593 from validation until the field is refactored
  Added surinam iso-country-code
  Added some country ISO codes to people
  Ignore index files
  #1145 add group for coded instrumentation
  Fix #1145, show 598
  Fix #1147, implement background Verovio rendering also for MEI files
  Add spinner for incipit loading
  Also add the verovio worker
  Make uglifies happy with es6
  Remove the notification diff, will exist only as the controller.
  Implement async verovio rendering
  • Loading branch information
xhero committed Oct 6, 2021
2 parents e1d0b80 + 39b045a commit 96f7afc
Show file tree
Hide file tree
Showing 21 changed files with 172 additions and 474 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ config/solr.yml
development.log
/solr/default/data
/solr/pids
solr/muscat
/solr/development/data
solr/production/data
solr/second
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Muscat Changelog
================

v 7.1.3
* #1118, make sure 588 does not appear where it should not
* Implement async verovio rendering
* Remove the notification diff, will exist only as the controller.
* Make uglifies happy with es6
* Add spinner for incipit loading
* Fix #1147, implement background Verovio rendering also for MEI files
* Fix #1145, show 598
* #1145 add group for coded instrumentation
* Ignore index files
* Added some country ISO codes to people
* Added surinam iso-country-code
* Remove 593 from validation until the field is refactored

v 7.1.2
* Update to rails 5.2.6
* Fix #1120, move 595 so it is displayed
Expand Down
34 changes: 33 additions & 1 deletion app/assets/javascripts/marc_editor_validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,39 @@ function marc_validate_presence(value, element) {
// tag is empty: i.e. 650 needs *always* to be there.
function marc_validate_mandatory(value, element) {
var validate_level = $(element).data("validate-level");


/*
* This disabled block of code is used to validate
* mandatory fields only one. Is part of a bigger
* task to make mandatory fields work with groups
*/
/*
var tag = $(element).data("tag");
var subfield = $(element).data("subfield");
t = $(".validate_" + tag + "_" + subfield);
found = false;
t.each(function() {
var elem = $(this);
console.log(elem.val());
var placeholders = $(elem).parents(".tag_placeholders");
if (placeholders.length == 0) {
if (elem.val() != "") {
//console.log(elem.val());
found = true;
}
}
if (found)
return false;
});
if (found)
return true;
*/

if (value == "") {
if (validate_level == "warning") {
marc_validate_add_warnings(element);
Expand Down
55 changes: 22 additions & 33 deletions app/assets/javascripts/verovio_preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,45 @@
// it will queue all the calls so all the incipits
// are rendered when verovio is loaded and ready

var vrvToolkit = null;

var deferred_render_data = []
var verovio_loading = false;
var verovio_loaded = false;

var worker = new Worker('/javascripts/verovio_worker.js');
worker.onmessage = function(event) {
let messageType = event.data[0];

if (messageType == "loaded") {
finalize_verovio();
} else if (messageType == "renderMusic-ok" || messageType == "renderMEI-ok") {
let target = event.data[1];
let svg = event.data[2];

$("#" + target).html(svg);
}
};

function finalize_verovio () {
verovio_loading = false
vrvToolkit = new verovio.toolkit();
verovio_loaded = true;

for (var i = 0; i < deferred_render_data.length; i++) {
data = deferred_render_data[i];
render_music(data.music, data.format, data.target, data.width);
}
}

function load_verovio() {
if (verovio_loading == true) {
return;
}

verovio_loading = true;

var element = document.createElement("script");
element.src = "/javascripts/verovio-toolkit.js";
document.body.appendChild(element);

element.onreadystagechange = finalize_verovio;
element.onload = finalize_verovio;

}

// This is the helper function to call to render
// an incipit into a target div. It will do the preloading
// in the background
function render_music(music, format, target, width) {
var width = typeof width !== 'undefined' ? width : 720;

if (vrvToolkit == null) {
if (verovio_loaded == false) {
deferred_render_data.push({
music: music,
format: format,
target: target,
width: width});

load_verovio();
return;
}

Expand All @@ -62,27 +56,22 @@ function render_music(music, format, target, width) {
scale: 40,
adjustPageHeight: 1
};

vrvToolkit.setOptions( options );
vrvToolkit.loadData(music);
var svg = vrvToolkit.renderToSVG(1, {});
$(target).html(svg);

this.worker.postMessage(["renderMusic", $(target).attr("id"), {options: options, music: music}])

} else {
// We need our own instance
vrvToolkitMei = new verovio.toolkit();

var options = {
inputFrom: 'mei',
pageWidth: width / 0.4,
spacingStaff: 1,
scale: 40,
adjustPageHeight: 1
};

vrvToolkitMei.setOptions( options );
/* Load the file using HTTP GET */
$.get(music, function( data ) {
var svg = vrvToolkitMei.renderData(data, {});
$(target).html(svg);
worker.postMessage(["renderMEI", $(target).attr("id"), {options: options, music: data}])
}, 'text');
}

Expand Down
11 changes: 0 additions & 11 deletions app/jobs/modification_digest_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def perform(*args)
# get the last modified sources

results = {}
total_results = 0

[Source, Work, Institution].each do |model|
model.where(("updated_at" + "> ?"), @days.days.ago).order("updated_at DESC").each do |s|
Expand All @@ -26,17 +25,7 @@ def perform(*args)
results[model.to_s.downcase] = {} if !results[model.to_s.downcase]
results[model.to_s.downcase][match] = [] if !results[model.to_s.downcase][match]

# We display only the first 100 versions
if !s.versions.empty? && total_results < 100
version = s.versions.last
item = version.reify #item_type.singularize.classify.constantize.new
item.marc.load_from_array( VersionChecker.get_diff_with_next( version.id ) )
editor_profile = EditorConfiguration.get_show_layout item
s = item
end

results[model.to_s.downcase][match] << s
total_results += 1
end

end
Expand Down
11 changes: 0 additions & 11 deletions app/views/layouts/mailer.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<style>
ins {
text-decoration: none;
background-color: #d4fcbc;
}
del {
text-decoration: none;
background-color: #fbb6c2;
color: #555;
}
</style>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion app/views/marc_show/_show_incipit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<td>
<a onclick="javascript:show_hide_pae('<%=random_string%>');">PAE Code</a>
<span id="<%= random_string %>" style="display:none">&nbsp;<%= label.html_safe %></span>
<div id="<%= image_render_div %>" />
<div id="<%= image_render_div %>"><img src="/images/spinner_small.gif" />&nbsp;Engraving incipit...</div>
</td>
<tr>
<%-
Expand Down
39 changes: 0 additions & 39 deletions app/views/modification_notification/_diff_record.html.erb

This file was deleted.

4 changes: 0 additions & 4 deletions app/views/modification_notification/notify.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
<a href="https://muscat.rism.info/admin/works/<%=item.id%>"><%=item.id%></a>, <%=item.title%> [created: <%=item.created_at%>, modified: <%=item.updated_at%>]
<%end%>
</p>
<%if @total_results < 100 %>
<%= render partial: "diff_record", locals: { :item => item } %>
</div>
<%end %>

<% count += 1 %>
<% end %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/options/_subfield_pae.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%
tag_params = @editor_profile.options_config[tag_name]["tag_params"]
random_string = SecureRandom.hex
%>
<table width="100%">
<tr>
Expand All @@ -12,6 +13,6 @@
</tr>
</table>
<table class="marc_editor_pae_info" style="display: none;" cellpadding="0" cellspacing="0"><tr>
<td width="100%"><div class="pae_incipit_target">Loading...&nbsp;</div></td>
<td width="100%"><div class="pae_incipit_target" id="<%=random_string%>"><img src="/images/spinner_small.gif" />&nbsp;Engraving incipit...&nbsp;</div></td>
<td width="16"><div style="visibility:hidden;"><img src="/images/spinner_small.gif" /></div></td>
</tr></table>
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
- "XA-DE"
- "XA-DE-BY"
- "XA-DE-SN"
- "XC-GH"
- "XA-GR"
- "XC-GN"
- "XA-VA"
Expand All @@ -130,6 +131,7 @@
- "XA-IT"
- "XB-JP"
- "XB-KR"
- "XA-LI"
- "XA-LV"
- "XA-LT"
- "XA-LU"
Expand All @@ -140,6 +142,7 @@
- "XA-ME"
- "XA-NL"
- "XE-NZ"
- "XD-NI"
- "XA-NO"
- "XD-PE"
- "XD-PY"
Expand All @@ -156,9 +159,11 @@
- "XA-SE"
- "XA-CH"
- "XA-CH-VD"
- "XD-SR"
- "XB-SY"
- "XD-TT"
- "XB-TR"
- "XC-UG"
- "XA-UA"
- "XA-GB"
- "XD-US"
Expand Down
10 changes: 10 additions & 0 deletions config/editor_profiles/default/configurations/PersonLabels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ XA-IT:
label: places.italy
XA-IT-32:
label: places.italy_trentino_alto_adige
XA-LI:
label: places.liechtenstein
XA-LT:
label: places.lithuania
XA-LU:
Expand Down Expand Up @@ -253,6 +255,8 @@ XC-DZ:
label: places.algeria
XC-EG:
label: places.egypt
XC-GH:
label: places.ghana
XC-GN:
label: places.guinea
XC-ZA:
Expand All @@ -275,18 +279,24 @@ XD-HN:
label: places.honduras
XD-MX:
label: places.mexico
XD-NI:
label: places.nicaragua
XD-PE:
label: places.peru
XD-PR:
label: places.puerto_rico
XD-PY:
label: places.paraguay
XD-SR:
label: places.surinam
XD-TT:
label: places.trinidad_tobego
XD-US:
label: places.usa
XD-UY:
label: places.uruguay
XC-UG:
label: places.uganda
XD-VE:
label: places.venezuela
XE-AU:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,8 @@ show_distribution:
label: records.distribution
show_information:
label: records.further_information
show_instrumentation:
label: records.coded_instrumentation
show_library:
label: records.library_information
show_links:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ group_order:
- show_summary
- show_library
- show_content
- show_instrumentation
- show_distribution
- show_material
- show_information
Expand Down Expand Up @@ -47,6 +48,10 @@ groups:
all_tag_templates:
"031": marc_show/show_incipit

show_instrumentation:
all_tags:
- "598"

show_distribution:
all_tags:
- "594"
Expand Down
Loading

0 comments on commit 96f7afc

Please sign in to comment.