Fix folders exports, add error message

SCI-5351
This commit is contained in:
Urban Rotnik 2021-01-19 09:47:08 +01:00
parent dbdfe4177d
commit ddbc22b274
4 changed files with 6 additions and 5 deletions

View file

@ -180,8 +180,8 @@
// Show the modal
exportProjectsModal.modal('show');
},
error: function() {
// TODO
error: function(data) {
HelperModule.flashAlertMsg(data.responseJSON.flash, 'danger');
}
});
});

View file

@ -65,6 +65,8 @@ class TeamsController < ApplicationController
status: 'error'
}
end
else
render json: { flash: I18n.t('projects.export_projects.zero_projects_flash') }, status: :unprocessable_entity
end
end

View file

@ -87,9 +87,7 @@ class ProjectFolder < ApplicationRecord
end
def inner_projects
project_folders.map do |inner_folder|
projects + inner_folder.inner_projects
end.flatten
Project.where(project_folder: ProjectFolder.inner_folders(team, self) + [self])
end
private

View file

@ -460,6 +460,7 @@ en:
modal_text_p3_html: "Please note that the number of exports is limited to %{limit} requests per day. After you confirm this export you will have %{num} left."
modal_submit: "Export"
success_flash: "Export request received. Your export request is being processed."
zero_projects_flash: "You have to select at least one project"
activity:
visibility_hidden: "Project members only"
visibility_visible: "All team members"