Skip to content

Commit

Permalink
Merge branch 'develop' into devel-activeadmin-2.0
Browse files Browse the repository at this point in the history
* develop:
  #516 Initial "-" implementation
  Fix #1125 and other translations
  • Loading branch information
xhero committed Jul 14, 2021
2 parents 10d8203 + c506864 commit 78c1f7e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 15 deletions.
46 changes: 39 additions & 7 deletions app/assets/javascripts/marc_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,25 +532,29 @@ function marc_editor_incipit(clef, keysig, timesig, incipit, target, width) {
render_music(pae, 'pae', target, width);
}

// This is the last non-ujs function remaining
// it is called when ckicking the "+" button
// These two are the last non-ujs function remaining
// This one is called when ckicking the "+" button
// near a repeatable field. It makes a copy
// of it
function marc_editor_add_subfield(id) {

grid = id.parents("tr");
var grid = id.parents("tr");
//ul = grid.siblings(".repeating_subfield");
ul = $(".repeating_subfield", grid);
var ul = $(".repeating_subfield", grid);

li_all = $("li", ul);
var li_all = $("li", ul);

li_original = $(li_all[li_all.length - 1]);
var li_original = $(li_all[li_all.length - 1]);

new_li = li_original.clone();
var new_li = li_original.clone();
$(".serialize_marc", new_li).each(function() {
$(this).val("");
});

$(".add-button", new_li).each(function() {
$(this).hide();
});

// This is a special case for the light-weight "t" tag
// in 031, as it is a select_subfield which normally is
// never repeatable, but in this case, since it does not
Expand All @@ -569,6 +573,34 @@ function marc_editor_add_subfield(id) {

}

// This one removes the item
function marc_editor_remove_subfield(id) {

var element = id.parents("li");

var button = $(".add-button", element);
if (button.is(":visible")) {
var grid = id.parents("tr");
var ul = $(".repeating_subfield", grid);

if ($(ul).children().length == 1) {
$(".serialize_marc", element).each(function() {
$(this).val("");
});
} else {
element.remove();

var next = $(ul).children()[0]

var add_button = $(".add-button", next);
add_button.show();

}
} else {
element.remove();
}
}

// Hardcoded for marc_editor_panel
function marc_editor_get_model() {
return $("#marc_editor_panel").data("editor-model");
Expand Down
12 changes: 12 additions & 0 deletions app/views/editor/_subfield_li.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<li>
<table>
<tr>
<td width="40px" style="text-align: center; vertical-align: middle;">
<%if @item.marc.config.multiples_allowed?(tag_name, subfield) %>
<%= safe_link_to_function_stub "<div class=\"add_subfield_button abutton_condensed ui-state-default abutton-icon-solo ui-corner-all remove-button\"><span class=\"ui-icon ui-icon-minus\"></span>_</div>".html_safe, "marc_editor_remove_subfield($(this))", :title => "Add another instance of this subfield" %>
<%= safe_link_to_function_stub "<div class=\"add_subfield_button abutton_condensed ui-state-default abutton-icon-solo ui-corner-all add-button\"><span class=\"ui-icon ui-icon-plus\"></span>_</div>".html_safe, "marc_editor_add_subfield($(this))", :title => "Add another instance of this subfield" %>
<%end%>
</td>
<td>
<%= render :partial => (field_settings.has_key?('editor_partial') ? "options/#{field_settings['editor_partial']}" : "editor/subfield"),
:locals => { :marc_tag => marc_tag,
:tag_name => tag_name,
:marc_subfield => marc_subfield,
:subfield => subfield,
:params => field_settings } %>
</td>
</tr>
</table>
</li>
6 changes: 1 addition & 5 deletions app/views/editor/_tag.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<table class="tag_grid" cellpadding="0" cellspacing="0">
<tr><th width="25%"></th><th width="25%"></th><th width="25%"></th><th width="25%"></th></tr>
<tr><th width="20%"></th><th width="25%"></th><th width="25%"></th><th width="25%"></th></tr>
<%- @editor_profile.each_subfield_for(tag_name) do |subfield, field_settings|

field_label = ""
field_leader = ""
field_settings = Hash.new if !field_settings
if @item.marc.config.multiples_allowed?(tag_name, subfield)
extra_leader = safe_link_to_function_stub "<div class=\"add_subfield_button abutton_condensed ui-state-default abutton-icon-solo ui-corner-all\"><span class=\"ui-icon ui-icon-plus\"></span>_</div>".html_safe, "marc_editor_add_subfield($(this))", :title => "Add another instance of this subfield"
end

if @editor_profile.has_sub_label?(tag_name, subfield)
sub_label = @editor_profile.get_sub_label(tag_name, subfield, true)
Expand All @@ -20,7 +17,6 @@
<td>
<div class="grid_cell_header">
<%= field_label.html_safe %>
<%= extra_leader -%>
</div>
</td>
<td colspan="3">
Expand Down
2 changes: 1 addition & 1 deletion config/locales/marc_records/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ de:
note_fields: Bemerkungen
note_on_performance: Bemerkungen zu den Aufführungen
now_in: Heute in
number: Anzahl
number: Nummer
number_page: Nummer/Seitenzahl
number_part_section: Anzahl Teile oder Abschnitte eines Werks
number_volume_part: Nummer des Bandes oder Teils
Expand Down
2 changes: 1 addition & 1 deletion config/locales/marc_records/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -838,5 +838,5 @@ es:
P60195: "Publicado en"
P60242: "Arreglo de"
P60274: "Arreglo como"
P60194: "Insertar en"
P60194: "Inserción en"
P60183: "Insertar"
2 changes: 1 addition & 1 deletion config/locales/marc_records/pl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ pl:
translator: Tłumacz
transparency: Przezrocze
type: Rodzaj
type_designer: Typograf
type_designer: Projektant kroju pisma
type_institution: Rodzaj instytucji
type_name_variant: Typ alternatywnej nazwy osoby
type_of_jurisdiction: Rodzaj jurysdykcji
Expand Down

0 comments on commit 78c1f7e

Please sign in to comment.