Fix jQuery error with adding multiple attachments to a single FollowUp. It work when adding files one at a time but gets a little funny when adding more than one input field at a time. Also, moved RSS Feeds link to user menu to be more accessible.

This commit is contained in:
Garret Wassermann 2016-09-12 22:37:48 -04:00
parent 00cdbcf43b
commit 76241b8661
4 changed files with 16 additions and 11 deletions

View File

@ -123,7 +123,6 @@
<div id='footer' class="row">
<div class="col-md-2">{% include "helpdesk/attribution.html" %}</div>
<div class="col-md-2"><a href='{% url 'helpdesk_rss_index' %}'><i class="fa fa-rss-square fa-fw"></i> {% trans "RSS Feeds" %}</a></div>
<div class="col-md-2"><s><a href='{% url 'helpdesk_api_help' %}'>{% trans "API" %}</a></s></div>
</div>
</div>

View File

@ -69,6 +69,7 @@
<ul class="dropdown-menu dropdown-user">
<li><a href="{% url 'helpdesk_user_settings' %}"><i class="fa fa-gear fa-fw"></i> {% trans "User Settings" %}</a>
</li>
<li><a href='{% url 'helpdesk_rss_index' %}'><i class="fa fa-rss-square fa-fw"></i> {% trans "RSS Feeds" %}</a></li>
{% if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password %}
<li><a href="{% url 'auth_password_change' %}"><i class="fa fa-user-secret fa-fw"></i> {% trans "Change password" %}</a></li>
{% endif %}

View File

@ -29,13 +29,13 @@ $(document).ready(function() {
$("[data-toggle=tooltip]").tooltip();
// for CSS customized file select/browse button
$(':file').on('fileselect', function(event, numFiles, label, browseButtonNum) {
$('.add_file_fields_wrap').on('fileselect', ':file', function(event, numFiles, label, browseButtonNum) {
$("#selectedfilename"+browseButtonNum).html(label);
});
var x = 0;
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var wrapper = $(".add_file_fields_wrap"); //Fields wrapper
var add_button = $(".add_file_field_button"); //Add button ID
$(add_button).click(function(e){ //on add input button click
x++;
@ -52,6 +52,12 @@ $(document).ready(function() {
});
/*$('.add_file_fields_wrap').on('change', ':file', function() {
var input = $(this),
numFiles = input.get(0).files ? input.get(0).files.length : 1,
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
input.trigger('fileselect', [numFiles, label, 0]);
});*/
$(document).on('change', '#file0', function() {
var input = $(this),
numFiles = input.get(0).files ? input.get(0).files.length : 1,
@ -210,13 +216,11 @@ $(document).on('change', '#file0', function() {
<dl>
<dt><label for='id_file'>{% trans "Attach a File" %}</label></dt>
<dd>
<div class="input_fields_wrap">
<div>
<button class="add_field_button btn btn-success btn-xs">{% trans "Add Another File" %}</button>
<div><label class='btn btn-primary btn-sm btn-file'>
<div class="add_file_fields_wrap">
<button class="add_file_field_button btn btn-success btn-xs">{% trans "Add Another File" %}</button>
<div><label class='btn btn-primary btn-sm btn-file'>
Browse... <input type="file" name='attachment' id='file0' style='display: none;'/>
</label><span>&nbsp;</span><span id='selectedfilename0'>{% trans 'No files selected.' %}</span></div>
</div>
</label><span>&nbsp;</span><span id='selectedfilename0'>{% trans 'No files selected.' %}</span></div>
</div>
</dd>
</dl>

View File

@ -215,10 +215,11 @@ $(document).ready(function() {
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
{% trans "Query Results" %} - {{ search_message|safe }}
{% trans "Query Results" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
{{ search_message|safe }}
<form method='post' action='{% url 'helpdesk_mass_update' %}' id="ticket_mass_update">
<table width="100%" class="table table-striped table-bordered table-hover" id="ticketTable" data-page-length='{{ default_tickets_per_page }}'>
<thead>