Bug 32164: Add link to MARC modification templates from batch record modification page
This patch adds a more visible link from the batch record modification
page in the event that there are no MARC modification templates defined.
The template checks that the user has permission.
The patch also modifies the same message on the MARC modification
templates page so that the interfaces are more unified, and tweaks the
operation of the "New action" button.
To test you should have no MARC modification templates defined.
- Apply the patch and go to Tools -> Batch record modification.
- If you're logged in as a user with permission you should see a message
dialog containing a button, "Create a new MARC modification template."
- Clicking it should take you to the MARC modification templates page,
where you'll see a similar message and a button, "Create a new
template." Clicking this button should trigger a modal form, just like
clicking the "New template" button in the toolbar should.
- Submit the form to create a new template. You should see message on
the following page that says "New action." Clicking the button should
display the entry form, and then clicking "Cancel" should hide the
form and redisplay the message.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit df8aca0252)
Signed-off-by: Jacob O'Mara <jacobomara901@gmail.com>
This commit is contained in:
parent
fc4d7c3d4d
commit
6ce18a8cdb
|
|
@ -269,8 +269,11 @@
|
|||
[% ELSIF view == 'errors' %]
|
||||
[% FOR error IN errors %]
|
||||
[% IF error == 'no_template_defined' %]
|
||||
<div class="dialog alert">
|
||||
No MARC modification template is defined. You have <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">to create</a> at least one template for using this tool.
|
||||
<div class="dialog message">
|
||||
<p>No MARC modification template is defined. You have to create at least one template in order to use this tool.</p>
|
||||
[% IF ( CAN_user_tools_marc_modification_templates ) %]
|
||||
<a class="btn btn-default" href="/cgi-bin/koha/tools/marc_modification_templates.pl"><i class="fa fa-plus"></i> Create a new MARC modification template</a>
|
||||
[% END %]
|
||||
</div>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
<div id="toolbar" class="btn-toolbar">
|
||||
<a href="#" data-toggle="modal" data-template_id="" data-target="#createTemplate" id="new_template" class="btn btn-default duplicate_template"><i class="fa fa-plus"></i> New template</a>
|
||||
[% IF ( template_id != '' ) %]
|
||||
<a href="#" id="new_action" class="btn btn-default"><i class="fa fa-plus"></i> New action</a>
|
||||
<a href="#" class="btn btn-default new_action"><i class="fa fa-plus"></i> New action</a>
|
||||
<a class="btn btn-default delete_template" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% template_id | html %]&op=delete_template"><i class="fa fa-fw fa-trash"></i> Delete template</a>
|
||||
[% END %]
|
||||
</div>
|
||||
|
|
@ -208,7 +208,10 @@
|
|||
</table>
|
||||
</div> <!-- /.page-section -->
|
||||
[% ELSE %]
|
||||
<div class="dialog message template_actions"><p>There are no defined actions for this template.</p></div>
|
||||
<div class="dialog message" id="no_defined_actions">
|
||||
<p>There are no defined actions for this template.</p>
|
||||
<p><a href="#" class="btn btn-default approve new_action"><i class="fa fa-plus" aria-hidden="true"></i> New action</a></p>
|
||||
</div>
|
||||
[% END # /IF ActionsLoop %]
|
||||
|
||||
<form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_action" >
|
||||
|
|
@ -307,7 +310,10 @@
|
|||
|
||||
[% ELSE %]
|
||||
<h1>MARC modification templates</h1>
|
||||
<div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div>
|
||||
<div class="dialog message">
|
||||
<p>There are no defined templates. Please create a template first.</p>
|
||||
<a href="#" data-toggle="modal" data-target="#createTemplate" class="btn btn-default"><i class="fa fa-plus" aria-hidden="true"></i> Create a new template</a>
|
||||
</div>
|
||||
[% END # /IF TemplatesLoop %]
|
||||
|
||||
<!-- Modal to create new template -->
|
||||
|
|
|
|||
|
|
@ -68,9 +68,10 @@ $(document).ready(function() {
|
|||
updateAllEvery();
|
||||
});
|
||||
|
||||
$("#new_action").on("click",function(e){
|
||||
$(".new_action").on("click",function(e){
|
||||
e.preventDefault();
|
||||
cancelEditAction();
|
||||
$("#no_defined_actions").hide();
|
||||
$("#add_action").show();
|
||||
$("#action").focus();
|
||||
});
|
||||
|
|
@ -350,6 +351,11 @@ function cancelEditAction() {
|
|||
|
||||
document.getElementById('modaction_legend').innerHTML = window.modaction_legend_innerhtml;
|
||||
document.getElementById('action_submit').value = window.action_submit_value;
|
||||
|
||||
if( $("#template_actions").length < 1 ){
|
||||
$("#no_defined_actions").show();
|
||||
}
|
||||
|
||||
$("#add_action").hide();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue