mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-29 03:01:58 +08:00
Disable/enable export proejct button
Fix filesystem saving
This commit is contained in:
parent
ed16e8d479
commit
d50f56e319
3 changed files with 26 additions and 8 deletions
|
@ -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();
|
||||
|
|
|
@ -7,11 +7,14 @@ require 'csv'
|
|||
class TeamZipExport < ZipExport
|
||||
include StringUtility
|
||||
|
||||
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
|
||||
|
||||
def generate_exportable_zip(user, data, type, options = {})
|
||||
@user = user
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue