Disable/enable export proejct button

Fix filesystem saving
This commit is contained in:
Jure Grabnar 2018-10-15 21:40:59 +02:00
parent 38dc07353e
commit afbe70a2e2
3 changed files with 26 additions and 8 deletions

View file

@ -30,6 +30,7 @@
var exportProjectsModal = null;
var exportProjectsModalHeader = null;
var exportProjectsModalBody = null;
var exportProjectsBtn = null;
var projectsViewMode = 'cards';
var projectsViewFilter = $('.projects-view-filter.active').data('filter');
@ -218,11 +219,10 @@
* Initialize the JS for export projects modal to work.
*/
function initExportProjectsModal() {
var $exportProjectsBtn = $('#export-projects-button');
$exportProjectsBtn.click(function() {
exportProjectsBtn.click(function() {
// Load HTML to refresh users list
$.ajax({
url: $exportProjectsBtn.data('export-projects-url'),
url: exportProjectsBtn.data('export-projects-url'),
type: 'POST',
dataType: 'json',
data: {
@ -339,6 +339,8 @@
exportProjectsModal = $('#export-projects-modal');
exportProjectsModalHeader = exportProjectsModal.find('.modal-title');
exportProjectsModalBody = exportProjectsModal.find('.modal-body');
exportProjectsBtn = $('#export-projects-button');
exportProjectsBtn.addClass('disabled');
updateSelectedCards();
initNewProjectModal();
@ -361,10 +363,14 @@
if (this.checked && index === -1) {
$(this).closest('.panel-project').addClass('selected');
selectedProjects.push(projectId);
exportProjectsBtn.removeClass('disabled');
// Otherwise, if checkbox is not checked and ID is in list of selected IDs
} else if (!this.checked && index !== -1) {
$(this).closest('.panel-project').removeClass('selected');
selectedProjects.splice(index, 1);
if (selectedProjects.length == 0)
exportProjectsBtn.addClass('disabled');
}
});
@ -530,9 +536,13 @@
// If checkbox is checked and row ID is not in list of selected project IDs
if (this.checked && index === -1) {
selectedProjects.push(rowId);
exportProjectsBtn.removeClass('disabled');
// Otherwise, if checkbox is not checked and ID is in list of selected IDs
} else if (!this.checked && index !== -1) {
selectedProjects.splice(index, 1);
if (selectedProjects.length == 0)
exportProjectsBtn.addClass('disabled');
}
updateDataTableSelectAllCtrl();

View file

@ -3,11 +3,14 @@ require 'fileutils'
require 'csv'
class TeamZipExport < ZipExport
has_attached_file :zip_file,
path: '/zip_exports/:attachment/:id_partition/' \
':hash/:style/:filename'
validates_attachment :zip_file,
content_type: { content_type: 'application/zip' }
# Override path only for S3
if ENV['PAPERCLIP_STORAGE'] == 's3'
has_attached_file :zip_file,
path: '/zip_exports/:attachment/:id_partition/' \
':hash/:style/:filename'
validates_attachment :zip_file,
content_type: { content_type: 'application/zip' }
end
# Length of allowed name size
MAX_NAME_SIZE = 20

View file

@ -37,6 +37,7 @@ describe User, type: :model do
it { should have_db_column :invited_by_type }
it { should have_db_column :invitations_count }
it { should have_db_column :settings }
it { should have_db_column :variables }
it { should have_db_column :current_team_id }
it { should have_db_column :authentication_token }
end
@ -179,6 +180,10 @@ describe User, type: :model do
it { is_expected.to respond_to(:system_message_email_notification) }
end
describe 'user variables' do
it { is_expected.to respond_to(:export_vars) }
end
describe '#last_activities' do
let!(:user) { create :user }
let!(:project) { create :project }