mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
renames organization in assets
This commit is contained in:
parent
72e13beee3
commit
8c035a1981
9 changed files with 90 additions and 90 deletions
|
@ -85,7 +85,7 @@
|
|||
teamSwitch
|
||||
.find('.dropdown-menu .change-team')
|
||||
.on('click', function(){
|
||||
$('#user_current_organization_id')
|
||||
$('#user_current_team_id')
|
||||
.val($(this).attr('data-id'));
|
||||
|
||||
teamSwitch
|
||||
|
|
|
@ -124,21 +124,21 @@
|
|||
|
||||
// Clear input fields
|
||||
newProjectModalForm.clearFormFields();
|
||||
var orgSelect = newProjectModalForm.find('select#project_organization_id');
|
||||
orgSelect.val(0);
|
||||
orgSelect.selectpicker('refresh');
|
||||
var teamSelect = newProjectModalForm.find('select#project_team_id');
|
||||
teamSelect.val(0);
|
||||
teamSelect.selectpicker('refresh');
|
||||
|
||||
var orgHidden = newProjectModalForm.find('input#project_visibility_hidden');
|
||||
var orgVisible = newProjectModalForm.find('input#project_visibility_visible');
|
||||
orgHidden.prop("checked", true);
|
||||
orgHidden.attr("checked", "checked");
|
||||
orgHidden.parent().addClass("active");
|
||||
orgVisible.prop("checked", false);
|
||||
orgVisible.parent().removeClass("active");
|
||||
var teamHidden = newProjectModalForm.find('input#project_visibility_hidden');
|
||||
var teamVisible = newProjectModalForm.find('input#project_visibility_visible');
|
||||
teamHidden.prop("checked", true);
|
||||
teamHidden.attr("checked", "checked");
|
||||
teamHidden.parent().addClass("active");
|
||||
teamVisible.prop("checked", false);
|
||||
teamVisible.parent().removeClass("active");
|
||||
})
|
||||
.on("show.bs.modal", function() {
|
||||
var orgSelect = newProjectModalForm.find('select#project_organization_id');
|
||||
orgSelect.selectpicker('refresh');
|
||||
var teamSelect = newProjectModalForm.find('select#project_team_id');
|
||||
teamSelect.selectpicker('refresh');
|
||||
});
|
||||
|
||||
newProjectModalForm
|
||||
|
|
|
@ -100,19 +100,19 @@ function initProtocolsTable() {
|
|||
animateSpinner(this);
|
||||
},
|
||||
stateSaveCallback: function (settings, data) {
|
||||
// Set a cookie with the table state using the organization id
|
||||
// Set a cookie with the table state using the team id
|
||||
localStorage.setItem(
|
||||
"datatables_protocols_state/" +
|
||||
protocolsTableEl.data("organization-id") +
|
||||
protocolsTableEl.data("team-id") +
|
||||
"/" + repositoryType,
|
||||
JSON.stringify(data)
|
||||
);
|
||||
},
|
||||
stateLoadCallback: function (settings) {
|
||||
// Load the table state for the current organization
|
||||
// Load the table state for the current team
|
||||
var state = localStorage.getItem(
|
||||
"datatables_protocols_state/" +
|
||||
protocolsTableEl.data("organization-id") +
|
||||
protocolsTableEl.data("team-id") +
|
||||
"/" + repositoryType
|
||||
);
|
||||
if (state !== null) {
|
||||
|
@ -675,12 +675,12 @@ function initImport() {
|
|||
|
||||
fileInput.on("change", function(ev) {
|
||||
var importUrl = fileInput.attr("data-import-url");
|
||||
var organizationId = fileInput.attr("data-organization-id");
|
||||
var teamId = fileInput.attr("data-team-id");
|
||||
var type = fileInput.attr("data-type");
|
||||
importProtocolFromFile(
|
||||
ev.target.files[0],
|
||||
importUrl,
|
||||
{ organization_id: organizationId, type: type },
|
||||
{ team_id: teamId, type: type },
|
||||
false,
|
||||
function(datas) {
|
||||
var nrSuccessful = 0;
|
||||
|
|
|
@ -116,12 +116,12 @@ function dataTableInit() {
|
|||
// Send an Ajax request to the server to get the data. Note that
|
||||
// this is a synchronous request since the data is expected back from the
|
||||
// function
|
||||
var org = $('#samples').attr('data-organization-id');
|
||||
var team = $('#samples').attr('data-team-id');
|
||||
var user = $('#samples').attr('data-user-id');
|
||||
|
||||
$.ajax({
|
||||
url: '/state_load/' + org + '/' + user,
|
||||
data: {org: org},
|
||||
url: '/state_load/' + team + '/' + user,
|
||||
data: {team: team},
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
|
@ -133,7 +133,7 @@ function dataTableInit() {
|
|||
},
|
||||
stateSaveCallback: function(settings, data) {
|
||||
// Send an Ajax request to the server with the state object
|
||||
var org = $('#samples').attr('data-organization-id');
|
||||
var team = $('#samples').attr('data-team-id');
|
||||
var user = $('#samples').attr('data-user-id');
|
||||
// Save correct data
|
||||
if (loadFirstTime == true) {
|
||||
|
@ -141,8 +141,8 @@ function dataTableInit() {
|
|||
}
|
||||
|
||||
$.ajax({
|
||||
url: '/state_save/' + org + '/' + user,
|
||||
data: {org: org, state: data},
|
||||
url: '/state_save/' + team + '/' + user,
|
||||
data: {team: team, state: data},
|
||||
dataType: 'json',
|
||||
type: 'POST'
|
||||
});
|
||||
|
|
|
@ -187,7 +187,7 @@ function filesSizeValidator(ev, fileInputs, fileTypeEnum) {
|
|||
|
||||
/*
|
||||
* Overriden in billing module for checking whether enough
|
||||
* organization space is free.
|
||||
* team space is free.
|
||||
*/
|
||||
function enoughSpaceValidator(ev, fileInputs) {
|
||||
return true;
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
modal.find('[data-role=invite-with-role-div]');
|
||||
var inviteWithRoleBtn =
|
||||
modal.find('[data-role=invite-with-role-btn]');
|
||||
var orgSelectorCheckbox =
|
||||
modal.find('[data-role=org-selector-checkbox]');
|
||||
var orgSelectorDropdown =
|
||||
modal.find('[data-role=org-selector-dropdown]');
|
||||
var orgSelectorDropdown2 = $();
|
||||
var teamSelectorCheckbox =
|
||||
modal.find('[data-role=team-selector-checkbox]');
|
||||
var teamSelectorDropdown =
|
||||
modal.find('[data-role=team-selector-dropdown]');
|
||||
var teamSelectorDropdown2 = $();
|
||||
var tagsInput = modal.find('[data-role=tags-input]');
|
||||
|
||||
// Set max tags
|
||||
|
@ -28,8 +28,8 @@
|
|||
.on('show.bs.modal', function() {
|
||||
// This cannot be scoped outside this function
|
||||
// because it is generated via JS
|
||||
orgSelectorDropdown2 =
|
||||
orgSelectorDropdown
|
||||
teamSelectorDropdown2 =
|
||||
teamSelectorDropdown
|
||||
.next('.btn-group.bootstrap-select.form-control')
|
||||
.find('button.dropdown-toggle, li');
|
||||
|
||||
|
@ -39,14 +39,14 @@
|
|||
|
||||
// Show/hide buttons & other elements
|
||||
switch (type) {
|
||||
case 'invite_to_org_with_role':
|
||||
case 'invite_to_team_with_role':
|
||||
case 'invite':
|
||||
case 'invite_with_org_selector':
|
||||
case 'invite_with_org_selector_and_role':
|
||||
case 'invite_with_team_selector':
|
||||
case 'invite_with_team_selector_and_role':
|
||||
inviteBtn.show();
|
||||
inviteWithRoleDiv.hide();
|
||||
break;
|
||||
case 'invite_to_org':
|
||||
case 'invite_to_team':
|
||||
inviteBtn.hide();
|
||||
inviteWithRoleDiv.show();
|
||||
break;
|
||||
|
@ -56,21 +56,21 @@
|
|||
|
||||
// Checkbox toggle event
|
||||
if (
|
||||
type === 'invite_with_org_selector' ||
|
||||
type === 'invite_with_org_selector_and_role'
|
||||
type === 'invite_with_team_selector' ||
|
||||
type === 'invite_with_team_selector_and_role'
|
||||
) {
|
||||
orgSelectorCheckbox.on('change', function() {
|
||||
teamSelectorCheckbox.on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
orgSelectorDropdown.removeAttr('disabled');
|
||||
orgSelectorDropdown2.removeClass('disabled');
|
||||
if (type === 'invite_with_org_selector') {
|
||||
teamSelectorDropdown.removeAttr('disabled');
|
||||
teamSelectorDropdown2.removeClass('disabled');
|
||||
if (type === 'invite_with_team_selector') {
|
||||
inviteBtn.hide();
|
||||
inviteWithRoleDiv.show();
|
||||
}
|
||||
} else {
|
||||
orgSelectorDropdown.attr('disabled', 'disabled');
|
||||
orgSelectorDropdown2.addClass('disabled');
|
||||
if (type === 'invite_with_org_selector') {
|
||||
teamSelectorDropdown.attr('disabled', 'disabled');
|
||||
teamSelectorDropdown2.addClass('disabled');
|
||||
if (type === 'invite_with_team_selector') {
|
||||
inviteBtn.show();
|
||||
inviteWithRoleDiv.hide();
|
||||
}
|
||||
|
@ -99,26 +99,26 @@
|
|||
emails: tagsInput.val()
|
||||
};
|
||||
switch (type) {
|
||||
case 'invite_to_org':
|
||||
data.organizationId = modal.attr('data-organization-id');
|
||||
data.role = $(this).attr('data-organization-role');
|
||||
case 'invite_to_team':
|
||||
data.teamId = modal.attr('data-team-id');
|
||||
data.role = $(this).attr('data-team-role');
|
||||
break;
|
||||
case 'invite_to_org_with_role':
|
||||
data.organizationId = modal.attr('data-organization-id');
|
||||
data.role = modal.attr('data-organization-role');
|
||||
case 'invite_to_team_with_role':
|
||||
data.teamId = modal.attr('data-team-id');
|
||||
data.role = modal.attr('data-team-role');
|
||||
break;
|
||||
case 'invite':
|
||||
break;
|
||||
case 'invite_with_org_selector':
|
||||
if (orgSelectorCheckbox.is(':checked')) {
|
||||
data.organizationId = orgSelectorDropdown.val();
|
||||
data.role = $(this).attr('data-organization-role');
|
||||
case 'invite_with_team_selector':
|
||||
if (teamSelectorCheckbox.is(':checked')) {
|
||||
data.teamId = teamSelectorDropdown.val();
|
||||
data.role = $(this).attr('data-team-role');
|
||||
}
|
||||
break;
|
||||
case 'invite_with_org_selector_and_role':
|
||||
if (orgSelectorCheckbox.is(':checked')) {
|
||||
data.organizationId = orgSelectorDropdown.val();
|
||||
data.role = modal.attr('data-organization-role');
|
||||
case 'invite_with_team_selector_and_role':
|
||||
if (teamSelectorCheckbox.is(':checked')) {
|
||||
data.teamId = teamSelectorDropdown.val();
|
||||
data.role = modal.attr('data-team-role');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -155,14 +155,14 @@
|
|||
.on('hide.bs.modal', function() {
|
||||
// 'Reset' modal state
|
||||
tagsInput.tagsinput('removeAll');
|
||||
orgSelectorCheckbox.prop('checked', false);
|
||||
teamSelectorCheckbox.prop('checked', false);
|
||||
inviteBtn.attr('disabled', 'disabled');
|
||||
inviteWithRoleBtn.attr('disabled', 'disabled');
|
||||
orgSelectorDropdown2.addClass('disabled');
|
||||
teamSelectorDropdown2.addClass('disabled');
|
||||
animateSpinner(modalDialog, false);
|
||||
|
||||
// Unbind event listeners
|
||||
orgSelectorCheckbox.off('change');
|
||||
teamSelectorCheckbox.off('change');
|
||||
tagsInput.off('itemAdded itemRemoved');
|
||||
modal.find('[data-action=invite]').off('click');
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ var usersDatatable = null;
|
|||
|
||||
// Initialize edit name modal window
|
||||
function initEditName() {
|
||||
var editNameModal = $("#organization-name-modal");
|
||||
var editNameModal = $("#team-name-modal");
|
||||
var editNameModalBody = editNameModal.find(".modal-body");
|
||||
var editNameModalSubmitBtn = editNameModal.find("[data-action='submit']");
|
||||
$(".name-link")
|
||||
|
@ -21,7 +21,7 @@ function initEditName() {
|
|||
// Display errors if needed
|
||||
editNameModalBody
|
||||
.find("form")
|
||||
.renderFormErrors("organization", data2.responseJSON);
|
||||
.renderFormErrors("team", data2.responseJSON);
|
||||
});
|
||||
|
||||
// Show modal
|
||||
|
@ -44,7 +44,7 @@ function initEditName() {
|
|||
|
||||
// Initialize edit description modal window
|
||||
function initEditDescription() {
|
||||
var editDescriptionModal = $("#organization-description-modal");
|
||||
var editDescriptionModal = $("#team-description-modal");
|
||||
var editDescriptionModalBody = editDescriptionModal.find(".modal-body");
|
||||
var editDescriptionModalSubmitBtn = editDescriptionModal.find("[data-action='submit']");
|
||||
$(".description-link")
|
||||
|
@ -66,7 +66,7 @@ function initEditDescription() {
|
|||
// Display errors if needed
|
||||
editDescriptionModalBody
|
||||
.find("form")
|
||||
.renderFormErrors("organization", data2.responseJSON);
|
||||
.renderFormErrors("team", data2.responseJSON);
|
||||
});
|
||||
|
||||
// Show modal
|
||||
|
@ -170,10 +170,10 @@ function initRemoveUsers() {
|
|||
$(document)
|
||||
.on(
|
||||
"ajax:success",
|
||||
"[data-action='destroy-user-organization']",
|
||||
"[data-action='destroy-user-team']",
|
||||
function (e, data, status, xhr) {
|
||||
// Populate the modal heading & body
|
||||
var modal = $("#destroy-user-organization-modal");
|
||||
var modal = $("#destroy-user-team-modal");
|
||||
var modalHeading = modal.find(".modal-header").find(".modal-title");
|
||||
var modalBody = modal.find(".modal-body");
|
||||
modalHeading.text(data.heading);
|
||||
|
@ -185,20 +185,20 @@ function initRemoveUsers() {
|
|||
)
|
||||
.on(
|
||||
"ajax:error",
|
||||
"[data-action='destroy-user-organization']",
|
||||
"[data-action='destroy-user-team']",
|
||||
function (e, data, status, xhr) {
|
||||
// TODO
|
||||
}
|
||||
);
|
||||
|
||||
// Also, bind the click action on the modal
|
||||
$("#destroy-user-organization-modal")
|
||||
$("#destroy-user-team-modal")
|
||||
.on("click", "[data-action='submit']", function() {
|
||||
var btn = $(this);
|
||||
var form = btn
|
||||
.closest(".modal")
|
||||
.find(".modal-body")
|
||||
.find("form[data-id='destroy-user-organization-form']");
|
||||
.find("form[data-id='destroy-user-team-form']");
|
||||
|
||||
// Simply submit the form!
|
||||
form.submit();
|
||||
|
@ -208,10 +208,10 @@ function initRemoveUsers() {
|
|||
$(document)
|
||||
.on(
|
||||
"ajax:success",
|
||||
"[data-id='destroy-user-organization-form']",
|
||||
"[data-id='destroy-user-team-form']",
|
||||
function (e, data, status, xhr) {
|
||||
// Hide modal & clear its contents
|
||||
var modal = $("#destroy-user-organization-modal");
|
||||
var modal = $("#destroy-user-team-modal");
|
||||
var modalHeading = modal.find(".modal-header").find(".modal-title");
|
||||
var modalBody = modal.find(".modal-body");
|
||||
modalHeading.text("");
|
||||
|
@ -226,7 +226,7 @@ function initRemoveUsers() {
|
|||
)
|
||||
.on(
|
||||
"ajax:error",
|
||||
"[data-id='destroy-user-organization-form']",
|
||||
"[data-id='destroy-user-team-form']",
|
||||
function (e, data, status, xhr) {
|
||||
// TODO
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ function initRemoveUsers() {
|
|||
}
|
||||
|
||||
function initReloadPageAfterInviteUsers() {
|
||||
$('[data-id=org-invite-users-modal]')
|
||||
$('[data-id=team-invite-users-modal]')
|
||||
.on('hidden.bs.modal', function() {
|
||||
if (!_.isUndefined($(this).attr('data-invited'))) {
|
||||
// Reload page
|
|
@ -1,12 +1,12 @@
|
|||
function initLeaveOrganizations() {
|
||||
// Bind the "leave organization" buttons in organizations table
|
||||
// Bind the "leave team" buttons in teams table
|
||||
$(document)
|
||||
.on(
|
||||
"ajax:success",
|
||||
"[data-action='leave-user-organization']",
|
||||
"[data-action='leave-user-team']",
|
||||
function (e, data, status, xhr) {
|
||||
// Populate the modal heading & body
|
||||
var modal = $("#modal-leave-user-organization");
|
||||
var modal = $("#modal-leave-user-team");
|
||||
var modalHeading = modal.find(".modal-header").find(".modal-title");
|
||||
var modalBody = modal.find(".modal-body");
|
||||
modalHeading.text(data.heading);
|
||||
|
@ -18,20 +18,20 @@ function initLeaveOrganizations() {
|
|||
)
|
||||
.on(
|
||||
"ajax:error",
|
||||
"[data-action='destroy-user-organization']",
|
||||
"[data-action='destroy-user-team']",
|
||||
function (e, data, status, xhr) {
|
||||
// TODO
|
||||
}
|
||||
);
|
||||
|
||||
// Also, bind the click action on the modal
|
||||
$("#modal-leave-user-organization")
|
||||
$("#modal-leave-user-team")
|
||||
.on("click", "[data-action='submit']", function() {
|
||||
var btn = $(this);
|
||||
var form = btn
|
||||
.closest(".modal")
|
||||
.find(".modal-body")
|
||||
.find("form[data-id='leave-user-organization-form']");
|
||||
.find("form[data-id='leave-user-team-form']");
|
||||
|
||||
// Simply submit the form!
|
||||
form.submit();
|
||||
|
@ -41,7 +41,7 @@ function initLeaveOrganizations() {
|
|||
$(document)
|
||||
.on(
|
||||
"ajax:success",
|
||||
"[data-id='leave-user-organization-form']",
|
||||
"[data-id='leave-user-team-form']",
|
||||
function (e, data, status, xhr) {
|
||||
// Simply reload the page
|
||||
location.reload();
|
||||
|
@ -49,11 +49,11 @@ function initLeaveOrganizations() {
|
|||
)
|
||||
.on(
|
||||
"ajax:error",
|
||||
"[data-id='destroy-user-organization-form']",
|
||||
"[data-id='destroy-user-team-form']",
|
||||
function (e, data, status, xhr) {
|
||||
// TODO
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
initLeaveOrganizations();
|
||||
initLeaveOrganizations();
|
|
@ -641,7 +641,7 @@ a[data-toggle="tooltip"] {
|
|||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.breadcrumb-organizations {
|
||||
.breadcrumb-teams {
|
||||
background-color: $color-concrete;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ a[data-toggle="tooltip"] {
|
|||
}
|
||||
|
||||
/** Users datatable */
|
||||
.panel-organization-users .panel-body {
|
||||
.panel-team-users .panel-body {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
|
@ -749,8 +749,8 @@ a[data-toggle="tooltip"] {
|
|||
float: right;
|
||||
}
|
||||
|
||||
.dropdown-organizations-user {
|
||||
.dropdown-menu li.user-organization-role {
|
||||
.dropdown-teams-user {
|
||||
.dropdown-menu li.user-team-role {
|
||||
& > :first-child {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
@ -1559,7 +1559,7 @@ html.turbolinks-progress-bar::before {
|
|||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.org-selector .heading {
|
||||
.team-selector .heading {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 5px;
|
||||
|
||||
|
|
Loading…
Reference in a new issue