From 8c035a19814382d2449f6cabb4b71ca8650fac50 Mon Sep 17 00:00:00 2001 From: zmagod Date: Wed, 25 Jan 2017 12:12:27 +0100 Subject: [PATCH] renames organization in assets --- app/assets/javascripts/navigation.js | 2 +- app/assets/javascripts/projects/index.js.erb | 24 +++--- app/assets/javascripts/protocols/index.js | 12 +-- .../samples/sample_datatable.js.erb | 12 +-- .../sitewide/form_validators.js.erb | 2 +- .../sitewide/invite_users_modal.js.erb | 74 +++++++++---------- .../settings/{organization.js => team.js} | 26 +++---- .../settings/{organizations.js => teams.js} | 18 ++--- app/assets/stylesheets/themes/scinote.scss | 10 +-- 9 files changed, 90 insertions(+), 90 deletions(-) rename app/assets/javascripts/users/settings/{organization.js => team.js} (89%) rename app/assets/javascripts/users/settings/{organizations.js => teams.js} (70%) diff --git a/app/assets/javascripts/navigation.js b/app/assets/javascripts/navigation.js index 499251ed5..bce30d4ad 100644 --- a/app/assets/javascripts/navigation.js +++ b/app/assets/javascripts/navigation.js @@ -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 diff --git a/app/assets/javascripts/projects/index.js.erb b/app/assets/javascripts/projects/index.js.erb index 581dcc392..8ea03a4ef 100644 --- a/app/assets/javascripts/projects/index.js.erb +++ b/app/assets/javascripts/projects/index.js.erb @@ -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 diff --git a/app/assets/javascripts/protocols/index.js b/app/assets/javascripts/protocols/index.js index 28426d199..8fa42f7d2 100644 --- a/app/assets/javascripts/protocols/index.js +++ b/app/assets/javascripts/protocols/index.js @@ -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; diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index 9ef88e1cd..4458ae93d 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -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' }); diff --git a/app/assets/javascripts/sitewide/form_validators.js.erb b/app/assets/javascripts/sitewide/form_validators.js.erb index 8b82985a4..d42011ff4 100644 --- a/app/assets/javascripts/sitewide/form_validators.js.erb +++ b/app/assets/javascripts/sitewide/form_validators.js.erb @@ -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; diff --git a/app/assets/javascripts/sitewide/invite_users_modal.js.erb b/app/assets/javascripts/sitewide/invite_users_modal.js.erb index 80e4907e8..b957e4620 100644 --- a/app/assets/javascripts/sitewide/invite_users_modal.js.erb +++ b/app/assets/javascripts/sitewide/invite_users_modal.js.erb @@ -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'); diff --git a/app/assets/javascripts/users/settings/organization.js b/app/assets/javascripts/users/settings/team.js similarity index 89% rename from app/assets/javascripts/users/settings/organization.js rename to app/assets/javascripts/users/settings/team.js index cc60e706f..0e2b39b52 100644 --- a/app/assets/javascripts/users/settings/organization.js +++ b/app/assets/javascripts/users/settings/team.js @@ -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 diff --git a/app/assets/javascripts/users/settings/organizations.js b/app/assets/javascripts/users/settings/teams.js similarity index 70% rename from app/assets/javascripts/users/settings/organizations.js rename to app/assets/javascripts/users/settings/teams.js index 573e7b626..597acffe2 100644 --- a/app/assets/javascripts/users/settings/organizations.js +++ b/app/assets/javascripts/users/settings/teams.js @@ -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(); \ No newline at end of file +initLeaveOrganizations(); diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 89a2eae33..27313997c 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -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;