renames organization in assets

This commit is contained in:
zmagod 2017-01-25 12:12:27 +01:00
parent 72e13beee3
commit 8c035a1981
9 changed files with 90 additions and 90 deletions

View file

@ -85,7 +85,7 @@
teamSwitch teamSwitch
.find('.dropdown-menu .change-team') .find('.dropdown-menu .change-team')
.on('click', function(){ .on('click', function(){
$('#user_current_organization_id') $('#user_current_team_id')
.val($(this).attr('data-id')); .val($(this).attr('data-id'));
teamSwitch teamSwitch

View file

@ -124,21 +124,21 @@
// Clear input fields // Clear input fields
newProjectModalForm.clearFormFields(); newProjectModalForm.clearFormFields();
var orgSelect = newProjectModalForm.find('select#project_organization_id'); var teamSelect = newProjectModalForm.find('select#project_team_id');
orgSelect.val(0); teamSelect.val(0);
orgSelect.selectpicker('refresh'); teamSelect.selectpicker('refresh');
var orgHidden = newProjectModalForm.find('input#project_visibility_hidden'); var teamHidden = newProjectModalForm.find('input#project_visibility_hidden');
var orgVisible = newProjectModalForm.find('input#project_visibility_visible'); var teamVisible = newProjectModalForm.find('input#project_visibility_visible');
orgHidden.prop("checked", true); teamHidden.prop("checked", true);
orgHidden.attr("checked", "checked"); teamHidden.attr("checked", "checked");
orgHidden.parent().addClass("active"); teamHidden.parent().addClass("active");
orgVisible.prop("checked", false); teamVisible.prop("checked", false);
orgVisible.parent().removeClass("active"); teamVisible.parent().removeClass("active");
}) })
.on("show.bs.modal", function() { .on("show.bs.modal", function() {
var orgSelect = newProjectModalForm.find('select#project_organization_id'); var teamSelect = newProjectModalForm.find('select#project_team_id');
orgSelect.selectpicker('refresh'); teamSelect.selectpicker('refresh');
}); });
newProjectModalForm newProjectModalForm

View file

@ -100,19 +100,19 @@ function initProtocolsTable() {
animateSpinner(this); animateSpinner(this);
}, },
stateSaveCallback: function (settings, data) { 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( localStorage.setItem(
"datatables_protocols_state/" + "datatables_protocols_state/" +
protocolsTableEl.data("organization-id") + protocolsTableEl.data("team-id") +
"/" + repositoryType, "/" + repositoryType,
JSON.stringify(data) JSON.stringify(data)
); );
}, },
stateLoadCallback: function (settings) { stateLoadCallback: function (settings) {
// Load the table state for the current organization // Load the table state for the current team
var state = localStorage.getItem( var state = localStorage.getItem(
"datatables_protocols_state/" + "datatables_protocols_state/" +
protocolsTableEl.data("organization-id") + protocolsTableEl.data("team-id") +
"/" + repositoryType "/" + repositoryType
); );
if (state !== null) { if (state !== null) {
@ -675,12 +675,12 @@ function initImport() {
fileInput.on("change", function(ev) { fileInput.on("change", function(ev) {
var importUrl = fileInput.attr("data-import-url"); 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"); var type = fileInput.attr("data-type");
importProtocolFromFile( importProtocolFromFile(
ev.target.files[0], ev.target.files[0],
importUrl, importUrl,
{ organization_id: organizationId, type: type }, { team_id: teamId, type: type },
false, false,
function(datas) { function(datas) {
var nrSuccessful = 0; var nrSuccessful = 0;

View file

@ -116,12 +116,12 @@ function dataTableInit() {
// Send an Ajax request to the server to get the data. Note that // 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 // this is a synchronous request since the data is expected back from the
// function // function
var org = $('#samples').attr('data-organization-id'); var team = $('#samples').attr('data-team-id');
var user = $('#samples').attr('data-user-id'); var user = $('#samples').attr('data-user-id');
$.ajax({ $.ajax({
url: '/state_load/' + org + '/' + user, url: '/state_load/' + team + '/' + user,
data: {org: org}, data: {team: team},
async: false, async: false,
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
@ -133,7 +133,7 @@ function dataTableInit() {
}, },
stateSaveCallback: function(settings, data) { stateSaveCallback: function(settings, data) {
// Send an Ajax request to the server with the state object // 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'); var user = $('#samples').attr('data-user-id');
// Save correct data // Save correct data
if (loadFirstTime == true) { if (loadFirstTime == true) {
@ -141,8 +141,8 @@ function dataTableInit() {
} }
$.ajax({ $.ajax({
url: '/state_save/' + org + '/' + user, url: '/state_save/' + team + '/' + user,
data: {org: org, state: data}, data: {team: team, state: data},
dataType: 'json', dataType: 'json',
type: 'POST' type: 'POST'
}); });

View file

@ -187,7 +187,7 @@ function filesSizeValidator(ev, fileInputs, fileTypeEnum) {
/* /*
* Overriden in billing module for checking whether enough * Overriden in billing module for checking whether enough
* organization space is free. * team space is free.
*/ */
function enoughSpaceValidator(ev, fileInputs) { function enoughSpaceValidator(ev, fileInputs) {
return true; return true;

View file

@ -12,11 +12,11 @@
modal.find('[data-role=invite-with-role-div]'); modal.find('[data-role=invite-with-role-div]');
var inviteWithRoleBtn = var inviteWithRoleBtn =
modal.find('[data-role=invite-with-role-btn]'); modal.find('[data-role=invite-with-role-btn]');
var orgSelectorCheckbox = var teamSelectorCheckbox =
modal.find('[data-role=org-selector-checkbox]'); modal.find('[data-role=team-selector-checkbox]');
var orgSelectorDropdown = var teamSelectorDropdown =
modal.find('[data-role=org-selector-dropdown]'); modal.find('[data-role=team-selector-dropdown]');
var orgSelectorDropdown2 = $(); var teamSelectorDropdown2 = $();
var tagsInput = modal.find('[data-role=tags-input]'); var tagsInput = modal.find('[data-role=tags-input]');
// Set max tags // Set max tags
@ -28,8 +28,8 @@
.on('show.bs.modal', function() { .on('show.bs.modal', function() {
// This cannot be scoped outside this function // This cannot be scoped outside this function
// because it is generated via JS // because it is generated via JS
orgSelectorDropdown2 = teamSelectorDropdown2 =
orgSelectorDropdown teamSelectorDropdown
.next('.btn-group.bootstrap-select.form-control') .next('.btn-group.bootstrap-select.form-control')
.find('button.dropdown-toggle, li'); .find('button.dropdown-toggle, li');
@ -39,14 +39,14 @@
// Show/hide buttons & other elements // Show/hide buttons & other elements
switch (type) { switch (type) {
case 'invite_to_org_with_role': case 'invite_to_team_with_role':
case 'invite': case 'invite':
case 'invite_with_org_selector': case 'invite_with_team_selector':
case 'invite_with_org_selector_and_role': case 'invite_with_team_selector_and_role':
inviteBtn.show(); inviteBtn.show();
inviteWithRoleDiv.hide(); inviteWithRoleDiv.hide();
break; break;
case 'invite_to_org': case 'invite_to_team':
inviteBtn.hide(); inviteBtn.hide();
inviteWithRoleDiv.show(); inviteWithRoleDiv.show();
break; break;
@ -56,21 +56,21 @@
// Checkbox toggle event // Checkbox toggle event
if ( if (
type === 'invite_with_org_selector' || type === 'invite_with_team_selector' ||
type === 'invite_with_org_selector_and_role' type === 'invite_with_team_selector_and_role'
) { ) {
orgSelectorCheckbox.on('change', function() { teamSelectorCheckbox.on('change', function() {
if ($(this).is(':checked')) { if ($(this).is(':checked')) {
orgSelectorDropdown.removeAttr('disabled'); teamSelectorDropdown.removeAttr('disabled');
orgSelectorDropdown2.removeClass('disabled'); teamSelectorDropdown2.removeClass('disabled');
if (type === 'invite_with_org_selector') { if (type === 'invite_with_team_selector') {
inviteBtn.hide(); inviteBtn.hide();
inviteWithRoleDiv.show(); inviteWithRoleDiv.show();
} }
} else { } else {
orgSelectorDropdown.attr('disabled', 'disabled'); teamSelectorDropdown.attr('disabled', 'disabled');
orgSelectorDropdown2.addClass('disabled'); teamSelectorDropdown2.addClass('disabled');
if (type === 'invite_with_org_selector') { if (type === 'invite_with_team_selector') {
inviteBtn.show(); inviteBtn.show();
inviteWithRoleDiv.hide(); inviteWithRoleDiv.hide();
} }
@ -99,26 +99,26 @@
emails: tagsInput.val() emails: tagsInput.val()
}; };
switch (type) { switch (type) {
case 'invite_to_org': case 'invite_to_team':
data.organizationId = modal.attr('data-organization-id'); data.teamId = modal.attr('data-team-id');
data.role = $(this).attr('data-organization-role'); data.role = $(this).attr('data-team-role');
break; break;
case 'invite_to_org_with_role': case 'invite_to_team_with_role':
data.organizationId = modal.attr('data-organization-id'); data.teamId = modal.attr('data-team-id');
data.role = modal.attr('data-organization-role'); data.role = modal.attr('data-team-role');
break; break;
case 'invite': case 'invite':
break; break;
case 'invite_with_org_selector': case 'invite_with_team_selector':
if (orgSelectorCheckbox.is(':checked')) { if (teamSelectorCheckbox.is(':checked')) {
data.organizationId = orgSelectorDropdown.val(); data.teamId = teamSelectorDropdown.val();
data.role = $(this).attr('data-organization-role'); data.role = $(this).attr('data-team-role');
} }
break; break;
case 'invite_with_org_selector_and_role': case 'invite_with_team_selector_and_role':
if (orgSelectorCheckbox.is(':checked')) { if (teamSelectorCheckbox.is(':checked')) {
data.organizationId = orgSelectorDropdown.val(); data.teamId = teamSelectorDropdown.val();
data.role = modal.attr('data-organization-role'); data.role = modal.attr('data-team-role');
} }
break; break;
default: default:
@ -155,14 +155,14 @@
.on('hide.bs.modal', function() { .on('hide.bs.modal', function() {
// 'Reset' modal state // 'Reset' modal state
tagsInput.tagsinput('removeAll'); tagsInput.tagsinput('removeAll');
orgSelectorCheckbox.prop('checked', false); teamSelectorCheckbox.prop('checked', false);
inviteBtn.attr('disabled', 'disabled'); inviteBtn.attr('disabled', 'disabled');
inviteWithRoleBtn.attr('disabled', 'disabled'); inviteWithRoleBtn.attr('disabled', 'disabled');
orgSelectorDropdown2.addClass('disabled'); teamSelectorDropdown2.addClass('disabled');
animateSpinner(modalDialog, false); animateSpinner(modalDialog, false);
// Unbind event listeners // Unbind event listeners
orgSelectorCheckbox.off('change'); teamSelectorCheckbox.off('change');
tagsInput.off('itemAdded itemRemoved'); tagsInput.off('itemAdded itemRemoved');
modal.find('[data-action=invite]').off('click'); modal.find('[data-action=invite]').off('click');

View file

@ -2,7 +2,7 @@ var usersDatatable = null;
// Initialize edit name modal window // Initialize edit name modal window
function initEditName() { function initEditName() {
var editNameModal = $("#organization-name-modal"); var editNameModal = $("#team-name-modal");
var editNameModalBody = editNameModal.find(".modal-body"); var editNameModalBody = editNameModal.find(".modal-body");
var editNameModalSubmitBtn = editNameModal.find("[data-action='submit']"); var editNameModalSubmitBtn = editNameModal.find("[data-action='submit']");
$(".name-link") $(".name-link")
@ -21,7 +21,7 @@ function initEditName() {
// Display errors if needed // Display errors if needed
editNameModalBody editNameModalBody
.find("form") .find("form")
.renderFormErrors("organization", data2.responseJSON); .renderFormErrors("team", data2.responseJSON);
}); });
// Show modal // Show modal
@ -44,7 +44,7 @@ function initEditName() {
// Initialize edit description modal window // Initialize edit description modal window
function initEditDescription() { function initEditDescription() {
var editDescriptionModal = $("#organization-description-modal"); var editDescriptionModal = $("#team-description-modal");
var editDescriptionModalBody = editDescriptionModal.find(".modal-body"); var editDescriptionModalBody = editDescriptionModal.find(".modal-body");
var editDescriptionModalSubmitBtn = editDescriptionModal.find("[data-action='submit']"); var editDescriptionModalSubmitBtn = editDescriptionModal.find("[data-action='submit']");
$(".description-link") $(".description-link")
@ -66,7 +66,7 @@ function initEditDescription() {
// Display errors if needed // Display errors if needed
editDescriptionModalBody editDescriptionModalBody
.find("form") .find("form")
.renderFormErrors("organization", data2.responseJSON); .renderFormErrors("team", data2.responseJSON);
}); });
// Show modal // Show modal
@ -170,10 +170,10 @@ function initRemoveUsers() {
$(document) $(document)
.on( .on(
"ajax:success", "ajax:success",
"[data-action='destroy-user-organization']", "[data-action='destroy-user-team']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// Populate the modal heading & body // 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 modalHeading = modal.find(".modal-header").find(".modal-title");
var modalBody = modal.find(".modal-body"); var modalBody = modal.find(".modal-body");
modalHeading.text(data.heading); modalHeading.text(data.heading);
@ -185,20 +185,20 @@ function initRemoveUsers() {
) )
.on( .on(
"ajax:error", "ajax:error",
"[data-action='destroy-user-organization']", "[data-action='destroy-user-team']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// TODO // TODO
} }
); );
// Also, bind the click action on the modal // Also, bind the click action on the modal
$("#destroy-user-organization-modal") $("#destroy-user-team-modal")
.on("click", "[data-action='submit']", function() { .on("click", "[data-action='submit']", function() {
var btn = $(this); var btn = $(this);
var form = btn var form = btn
.closest(".modal") .closest(".modal")
.find(".modal-body") .find(".modal-body")
.find("form[data-id='destroy-user-organization-form']"); .find("form[data-id='destroy-user-team-form']");
// Simply submit the form! // Simply submit the form!
form.submit(); form.submit();
@ -208,10 +208,10 @@ function initRemoveUsers() {
$(document) $(document)
.on( .on(
"ajax:success", "ajax:success",
"[data-id='destroy-user-organization-form']", "[data-id='destroy-user-team-form']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// Hide modal & clear its contents // 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 modalHeading = modal.find(".modal-header").find(".modal-title");
var modalBody = modal.find(".modal-body"); var modalBody = modal.find(".modal-body");
modalHeading.text(""); modalHeading.text("");
@ -226,7 +226,7 @@ function initRemoveUsers() {
) )
.on( .on(
"ajax:error", "ajax:error",
"[data-id='destroy-user-organization-form']", "[data-id='destroy-user-team-form']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// TODO // TODO
} }
@ -234,7 +234,7 @@ function initRemoveUsers() {
} }
function initReloadPageAfterInviteUsers() { function initReloadPageAfterInviteUsers() {
$('[data-id=org-invite-users-modal]') $('[data-id=team-invite-users-modal]')
.on('hidden.bs.modal', function() { .on('hidden.bs.modal', function() {
if (!_.isUndefined($(this).attr('data-invited'))) { if (!_.isUndefined($(this).attr('data-invited'))) {
// Reload page // Reload page

View file

@ -1,12 +1,12 @@
function initLeaveOrganizations() { function initLeaveOrganizations() {
// Bind the "leave organization" buttons in organizations table // Bind the "leave team" buttons in teams table
$(document) $(document)
.on( .on(
"ajax:success", "ajax:success",
"[data-action='leave-user-organization']", "[data-action='leave-user-team']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// Populate the modal heading & body // 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 modalHeading = modal.find(".modal-header").find(".modal-title");
var modalBody = modal.find(".modal-body"); var modalBody = modal.find(".modal-body");
modalHeading.text(data.heading); modalHeading.text(data.heading);
@ -18,20 +18,20 @@ function initLeaveOrganizations() {
) )
.on( .on(
"ajax:error", "ajax:error",
"[data-action='destroy-user-organization']", "[data-action='destroy-user-team']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// TODO // TODO
} }
); );
// Also, bind the click action on the modal // Also, bind the click action on the modal
$("#modal-leave-user-organization") $("#modal-leave-user-team")
.on("click", "[data-action='submit']", function() { .on("click", "[data-action='submit']", function() {
var btn = $(this); var btn = $(this);
var form = btn var form = btn
.closest(".modal") .closest(".modal")
.find(".modal-body") .find(".modal-body")
.find("form[data-id='leave-user-organization-form']"); .find("form[data-id='leave-user-team-form']");
// Simply submit the form! // Simply submit the form!
form.submit(); form.submit();
@ -41,7 +41,7 @@ function initLeaveOrganizations() {
$(document) $(document)
.on( .on(
"ajax:success", "ajax:success",
"[data-id='leave-user-organization-form']", "[data-id='leave-user-team-form']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// Simply reload the page // Simply reload the page
location.reload(); location.reload();
@ -49,11 +49,11 @@ function initLeaveOrganizations() {
) )
.on( .on(
"ajax:error", "ajax:error",
"[data-id='destroy-user-organization-form']", "[data-id='destroy-user-team-form']",
function (e, data, status, xhr) { function (e, data, status, xhr) {
// TODO // TODO
} }
); );
} }
initLeaveOrganizations(); initLeaveOrganizations();

View file

@ -641,7 +641,7 @@ a[data-toggle="tooltip"] {
margin-bottom: 50px; margin-bottom: 50px;
} }
.breadcrumb-organizations { .breadcrumb-teams {
background-color: $color-concrete; background-color: $color-concrete;
margin-bottom: 15px; margin-bottom: 15px;
} }
@ -733,7 +733,7 @@ a[data-toggle="tooltip"] {
} }
/** Users datatable */ /** Users datatable */
.panel-organization-users .panel-body { .panel-team-users .panel-body {
padding-bottom: 0; padding-bottom: 0;
} }
@ -749,8 +749,8 @@ a[data-toggle="tooltip"] {
float: right; float: right;
} }
.dropdown-organizations-user { .dropdown-teams-user {
.dropdown-menu li.user-organization-role { .dropdown-menu li.user-team-role {
& > :first-child { & > :first-child {
padding-left: 10px; padding-left: 10px;
} }
@ -1559,7 +1559,7 @@ html.turbolinks-progress-bar::before {
padding-right: 10px; padding-right: 10px;
} }
.org-selector .heading { .team-selector .heading {
margin-top: 15px; margin-top: 15px;
margin-bottom: 5px; margin-bottom: 5px;