Converted JS modules into exported modules
This commit is contained in:
parent
1fbda39c8d
commit
adb8483331
|
|
@ -4,7 +4,7 @@
|
|||
import Cookies from 'js-cookie';
|
||||
import { localTimeAgo } from './lib/utils/datetime_utility';
|
||||
|
||||
class Activities {
|
||||
export default class Activities {
|
||||
constructor() {
|
||||
Pager.init(20, true, false, data => data, this.updateTooltips);
|
||||
|
||||
|
|
@ -34,6 +34,3 @@ class Activities {
|
|||
$sender.closest('li').toggleClass('active');
|
||||
}
|
||||
}
|
||||
|
||||
window.gl = window.gl || {};
|
||||
window.gl.Activities = Activities;
|
||||
|
|
|
|||
|
|
@ -1,63 +1,59 @@
|
|||
/* eslint-disable func-names, space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-arrow-callback, camelcase, quotes, comma-dangle, max-len */
|
||||
import { refreshCurrentPage } from './lib/utils/url_utility';
|
||||
|
||||
window.Admin = (function() {
|
||||
function Admin() {
|
||||
var modal, showBlacklistType;
|
||||
$('input#user_force_random_password').on('change', function(elem) {
|
||||
var elems;
|
||||
elems = $('#user_password, #user_password_confirmation');
|
||||
if ($(this).attr('checked')) {
|
||||
return elems.val('').attr('disabled', true);
|
||||
} else {
|
||||
return elems.removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
$('body').on('click', '.js-toggle-colors-link', function(e) {
|
||||
e.preventDefault();
|
||||
return $('.js-toggle-colors-container').toggle();
|
||||
});
|
||||
$('.log-tabs a').click(function(e) {
|
||||
e.preventDefault();
|
||||
return $(this).tab('show');
|
||||
});
|
||||
$('.log-bottom').click(function(e) {
|
||||
var visible_log;
|
||||
e.preventDefault();
|
||||
visible_log = $(".file-content:visible");
|
||||
return visible_log.animate({
|
||||
scrollTop: visible_log.find('ol').height()
|
||||
}, "fast");
|
||||
});
|
||||
modal = $('.change-owner-holder');
|
||||
$('.change-owner-link').bind("click", function(e) {
|
||||
e.preventDefault();
|
||||
$(this).hide();
|
||||
return modal.show();
|
||||
});
|
||||
$('.change-owner-cancel-link').bind("click", function(e) {
|
||||
e.preventDefault();
|
||||
modal.hide();
|
||||
return $('.change-owner-link').show();
|
||||
});
|
||||
$('li.project_member').bind('ajax:success', function() {
|
||||
return refreshCurrentPage();
|
||||
});
|
||||
$('li.group_member').bind('ajax:success', function() {
|
||||
return refreshCurrentPage();
|
||||
});
|
||||
showBlacklistType = function() {
|
||||
if ($("input[name='blacklist_type']:checked").val() === 'file') {
|
||||
$('.blacklist-file').show();
|
||||
return $('.blacklist-raw').hide();
|
||||
} else {
|
||||
$('.blacklist-file').hide();
|
||||
return $('.blacklist-raw').show();
|
||||
}
|
||||
};
|
||||
$("input[name='blacklist_type']").click(showBlacklistType);
|
||||
showBlacklistType();
|
||||
function showBlacklistType() {
|
||||
if ($('input[name="blacklist_type"]:checked').val() === 'file') {
|
||||
$('.blacklist-file').show();
|
||||
$('.blacklist-raw').hide();
|
||||
} else {
|
||||
$('.blacklist-file').hide();
|
||||
$('.blacklist-raw').show();
|
||||
}
|
||||
}
|
||||
|
||||
return Admin;
|
||||
})();
|
||||
export default function adminInit() {
|
||||
const modal = $('.change-owner-holder');
|
||||
|
||||
$('input#user_force_random_password').on('change', function randomPasswordClick() {
|
||||
const $elems = $('#user_password, #user_password_confirmation');
|
||||
if ($(this).attr('checked')) {
|
||||
$elems.val('').attr('disabled', true);
|
||||
} else {
|
||||
$elems.removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.js-toggle-colors-link', (e) => {
|
||||
e.preventDefault();
|
||||
$('.js-toggle-colors-container').toggle();
|
||||
});
|
||||
|
||||
$('.log-tabs a').on('click', function logTabsClick(e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
});
|
||||
|
||||
$('.log-bottom').on('click', (e) => {
|
||||
e.preventDefault();
|
||||
const $visibleLog = $('.file-content:visible');
|
||||
$visibleLog.animate({
|
||||
scrollTop: $visibleLog.find('ol').height(),
|
||||
}, 'fast');
|
||||
});
|
||||
|
||||
$('.change-owner-link').on('click', function changeOwnerLinkClick(e) {
|
||||
e.preventDefault();
|
||||
$(this).hide();
|
||||
modal.show();
|
||||
});
|
||||
|
||||
$('.change-owner-cancel-link').on('click', (e) => {
|
||||
e.preventDefault();
|
||||
modal.hide();
|
||||
$('.change-owner-link').show();
|
||||
});
|
||||
|
||||
$('li.project_member, li.group_member').on('ajax:success', refreshCurrentPage);
|
||||
|
||||
$("input[name='blacklist_type']").on('click', showBlacklistType);
|
||||
showBlacklistType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
/* eslint-disable func-names, space-before-function-paren, wrap-iife, quotes, prefer-arrow-callback, no-var, one-var, one-var-declaration-per-line, no-else-return, max-len */
|
||||
|
||||
window.Aside = (function() {
|
||||
function Aside() {
|
||||
$(document).off("click", "a.show-aside");
|
||||
$(document).on("click", 'a.show-aside', function(e) {
|
||||
var btn, icon;
|
||||
e.preventDefault();
|
||||
btn = $(e.currentTarget);
|
||||
icon = btn.find('i');
|
||||
if (icon.hasClass('fa-angle-left')) {
|
||||
btn.parent().find('section').hide();
|
||||
btn.parent().find('aside').fadeIn();
|
||||
return icon.removeClass('fa-angle-left').addClass('fa-angle-right');
|
||||
} else {
|
||||
btn.parent().find('aside').hide();
|
||||
btn.parent().find('section').fadeIn();
|
||||
return icon.removeClass('fa-angle-right').addClass('fa-angle-left');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Aside;
|
||||
})();
|
||||
|
|
@ -16,7 +16,7 @@ import BuildArtifacts from './build_artifacts';
|
|||
import CILintEditor from './ci_lint_editor';
|
||||
import groupsSelect from './groups_select';
|
||||
import Search from './search';
|
||||
/* global Admin */
|
||||
import initAdmin from './admin';
|
||||
import NamespaceSelect from './namespace_select';
|
||||
import NewCommitForm from './new_commit_form';
|
||||
import Project from './project';
|
||||
|
|
@ -92,6 +92,7 @@ import Diff from './diff';
|
|||
import ProjectLabelSubscription from './project_label_subscription';
|
||||
import ProjectVariables from './project_variables';
|
||||
import SearchAutocomplete from './search_autocomplete';
|
||||
import Activities from './activities';
|
||||
|
||||
(function() {
|
||||
var Dispatcher;
|
||||
|
|
@ -334,7 +335,7 @@ import SearchAutocomplete from './search_autocomplete';
|
|||
shortcut_handler = new ShortcutsIssuable(true);
|
||||
break;
|
||||
case 'dashboard:activity':
|
||||
new gl.Activities();
|
||||
new Activities();
|
||||
break;
|
||||
case 'projects:commit:show':
|
||||
new Diff();
|
||||
|
|
@ -355,7 +356,7 @@ import SearchAutocomplete from './search_autocomplete';
|
|||
$('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath);
|
||||
break;
|
||||
case 'projects:activity':
|
||||
new gl.Activities();
|
||||
new Activities();
|
||||
shortcut_handler = new ShortcutsNavigation();
|
||||
break;
|
||||
case 'projects:commits:show':
|
||||
|
|
@ -373,7 +374,7 @@ import SearchAutocomplete from './search_autocomplete';
|
|||
|
||||
if ($('#tree-slider').length) new TreeView();
|
||||
if ($('.blob-viewer').length) new BlobViewer();
|
||||
if ($('.project-show-activity').length) new gl.Activities();
|
||||
if ($('.project-show-activity').length) new Activities();
|
||||
$('#tree-slider').waitForImages(function() {
|
||||
ajaxGet(document.querySelector('.js-tree-content').dataset.logsPath);
|
||||
});
|
||||
|
|
@ -407,7 +408,7 @@ import SearchAutocomplete from './search_autocomplete';
|
|||
});
|
||||
break;
|
||||
case 'groups:activity':
|
||||
new gl.Activities();
|
||||
new Activities();
|
||||
break;
|
||||
case 'groups:show':
|
||||
const newGroupChildWrapper = document.querySelector('.js-new-project-subgroup');
|
||||
|
|
@ -584,7 +585,7 @@ import SearchAutocomplete from './search_autocomplete';
|
|||
// needed in rspec
|
||||
gl.u2fAuthenticate = u2fAuthenticate;
|
||||
case 'admin':
|
||||
new Admin();
|
||||
initAdmin();
|
||||
switch (path[1]) {
|
||||
case 'broadcast_messages':
|
||||
initBroadcastMessagesForm();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
/* eslint-disable func-names, space-before-function-paren, no-var, quotes, consistent-return, prefer-arrow-callback, comma-dangle, object-shorthand, no-new, max-len, no-multi-spaces, import/newline-after-import, import/first */
|
||||
/* global ConfirmDangerModal */
|
||||
/* global Aside */
|
||||
|
||||
import jQuery from 'jquery';
|
||||
import _ from 'underscore';
|
||||
|
|
@ -37,7 +36,6 @@ import './behaviors/';
|
|||
// everything else
|
||||
import './activities';
|
||||
import './admin';
|
||||
import './aside';
|
||||
import loadAwardsHandler from './awards_handler';
|
||||
import bp from './breakpoints';
|
||||
import './confirm_danger_modal';
|
||||
|
|
@ -273,7 +271,6 @@ $(function () {
|
|||
return fitSidebarForSize();
|
||||
});
|
||||
loadAwardsHandler();
|
||||
new Aside();
|
||||
|
||||
renderTimeago();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import Activities from '../activities';
|
||||
import ActivityCalendar from './activity_calendar';
|
||||
import { localTimeAgo } from '../lib/utils/datetime_utility';
|
||||
|
||||
|
|
@ -170,7 +171,7 @@ export default class UserTabs {
|
|||
});
|
||||
|
||||
// eslint-disable-next-line no-new
|
||||
new gl.Activities();
|
||||
new Activities();
|
||||
this.loaded.activity = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,21 +111,4 @@
|
|||
aside:not(.right-sidebar) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.show-aside {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
.show-aside {
|
||||
display: none;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 30%;
|
||||
padding: 5px 15px;
|
||||
background: $show-aside-bg;
|
||||
font-size: 20px;
|
||||
color: $show-aside-color;
|
||||
z-index: 100;
|
||||
box-shadow: 0 1px 2px $show-aside-shadow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,9 +245,6 @@ $btn-sm-side-margin: 7px;
|
|||
$btn-xs-side-margin: 5px;
|
||||
$issue-status-expired: $orange-500;
|
||||
$issuable-sidebar-color: $gl-text-color-secondary;
|
||||
$show-aside-bg: #eee;
|
||||
$show-aside-color: #777;
|
||||
$show-aside-shadow: #ddd;
|
||||
$group-path-color: #999;
|
||||
$namespace-kind-color: #aaa;
|
||||
$panel-heading-link-color: #777;
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
= link_to '#aside', class: 'show-aside' do
|
||||
%i.fa.fa-angle-left
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import 'vendor/jquery.endless-scroll';
|
||||
import '~/pager';
|
||||
import '~/activities';
|
||||
import Activities from '~/activities';
|
||||
|
||||
(() => {
|
||||
window.gon || (window.gon = {});
|
||||
|
|
@ -35,7 +35,7 @@ import '~/activities';
|
|||
describe('Activities', () => {
|
||||
beforeEach(() => {
|
||||
loadFixtures(fixtureTemplate);
|
||||
new gl.Activities();
|
||||
new Activities();
|
||||
});
|
||||
|
||||
for (let i = 0; i < filters.length; i += 1) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue