Commit 4afbcb28 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'ee-specific-inline-code-removal' into 'master'

Removed EE specific inline JS

See merge request !2592
parents c3358140 80b39e38
...@@ -82,6 +82,8 @@ import initIssuableSidebar from './init_issuable_sidebar'; ...@@ -82,6 +82,8 @@ import initIssuableSidebar from './init_issuable_sidebar';
// EE-only // EE-only
import ApproversSelect from './approvers_select'; import ApproversSelect from './approvers_select';
import AuditLogs from './audit_logs'; import AuditLogs from './audit_logs';
import initGeoInfoModal from './init_geo_info_modal';
import initGroupAnalytics from './init_group_analytics';
(function() { (function() {
var Dispatcher; var Dispatcher;
...@@ -119,6 +121,19 @@ import AuditLogs from './audit_logs'; ...@@ -119,6 +121,19 @@ import AuditLogs from './audit_logs';
}); });
}); });
function initBlobEE() {
const dataEl = document.getElementById('js-file-lock');
if (dataEl) {
const {
toggle_path,
path,
} = JSON.parse(dataEl.innerHTML);
PathLocks.init(toggle_path, path);
}
}
function initBlob() { function initBlob() {
new LineHighlighter(); new LineHighlighter();
...@@ -144,6 +159,8 @@ import AuditLogs from './audit_logs'; ...@@ -144,6 +159,8 @@ import AuditLogs from './audit_logs';
actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'), actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'),
}) })
.init(); .init();
initBlobEE();
} }
const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search'); const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search');
...@@ -347,9 +364,6 @@ import AuditLogs from './audit_logs'; ...@@ -347,9 +364,6 @@ import AuditLogs from './audit_logs';
shortcut_handler = new ShortcutsNavigation(); shortcut_handler = new ShortcutsNavigation();
GpgBadges.fetch(); GpgBadges.fetch();
break; break;
case 'projects:edit':
new UsersSelect();
break;
case 'projects:imports:show': case 'projects:imports:show':
new ProjectImport(); new ProjectImport();
break; break;
...@@ -362,8 +376,11 @@ import AuditLogs from './audit_logs'; ...@@ -362,8 +376,11 @@ import AuditLogs from './audit_logs';
if ($('.blob-viewer').length) { if ($('.blob-viewer').length) {
new BlobViewer(); new BlobViewer();
} }
initGeoInfoModal();
break; break;
case 'projects:edit': case 'projects:edit':
new UsersSelect();
new GroupsSelect();
setupProjectEdit(); setupProjectEdit();
break; break;
case 'projects:pipelines:new': case 'projects:pipelines:new':
...@@ -536,6 +553,23 @@ import AuditLogs from './audit_logs'; ...@@ -536,6 +553,23 @@ import AuditLogs from './audit_logs';
case 'admin:impersonation_tokens:index': case 'admin:impersonation_tokens:index':
new gl.DueDateSelectors(); new gl.DueDateSelectors();
break; break;
case 'admin:licenses:new':
const $licenseFile = $('.license-file');
const $licenseKey = $('.license-key');
const showLicenseType = () => {
const $checkedFile = $('input[name="license_type"]:checked').val() === 'file';
$licenseFile.toggle($checkedFile);
$licenseKey.toggle(!$checkedFile);
};
$('input[name="license_type"]').on('change', showLicenseType);
showLicenseType();
break;
case 'groups:analytics:show':
initGroupAnalytics();
break;
} }
switch (path.first()) { switch (path.first()) {
case 'sessions': case 'sessions':
......
export default () => {
const $modal = $('#modal-geo-info');
if (!$modal.length) return;
$modal
.appendTo('body')
.modal({
modal: true,
show: false,
})
.on('show.bs.modal', (e) => {
const {
cloneUrlPrimary,
cloneUrlSecondary,
} = $(e.currentTarget).data();
$('#geo-info-1').text(
`git clone ${(cloneUrlSecondary || '<clone url for secondary repository>')}`,
);
$('#geo-info-2').text(
`git remote set-url --push origin ${(cloneUrlPrimary || '<clone url for primary repository>')}`,
);
});
};
/* global Chart */
export default () => {
const dataEl = document.getElementById('js-analytics-data');
const data = JSON.parse(dataEl.innerHTML);
const labels = data.labels;
const outputElIds = ['push', 'issues_closed', 'merge_requests_created'];
outputElIds.forEach((id) => {
const el = document.getElementById(id);
const ctx = el.getContext('2d');
const chart = new Chart(ctx);
chart.Bar(
{
labels,
datasets: [{
fillColor: 'rgba(220,220,220,0.5)',
strokeColor: 'rgba(220,220,220,1)',
barStrokeWidth: 1,
barValueSpacing: 1,
barDatasetSpacing: 1,
data: data[id].data,
}],
},
{
scaleOverlay: true,
responsive: true,
maintainAspectRatio: false,
},
);
});
$('#event-stats').tablesorter();
};
...@@ -38,21 +38,3 @@ ...@@ -38,21 +38,3 @@
.form-actions .form-actions
= f.submit 'Upload license', class: 'btn btn-primary' = f.submit 'Upload license', class: 'btn btn-primary'
:javascript
function showLicenseType() {
if ($("input[name='license_type']:checked").val() == "file")
{
$(".license-file").show();
$(".license-key").hide();
}
else
{
$(".license-file").hide();
$(".license-key").show();
}
}
$("input[name='license_type']").click(showLicenseType);
showLicenseType();
...@@ -121,24 +121,10 @@ ...@@ -121,24 +121,10 @@
%td= @stats[:total_events][index] %td= @stats[:total_events][index]
%script#js-analytics-data{ type: "application/json" }
- [:push, :issues_closed, :merge_requests_created].each do |scope| - data = {}
:javascript - data[:labels] = @users.map(&:name)
var data = { - [:push, :issues_closed, :merge_requests_created].each do |scope|
labels : #{@users.map(&:name).to_json}, - data[scope] = {}
datasets : [ - data[scope][:data] = @stats[scope]
{ = data.to_json.html_safe
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
barStrokeWidth: 1,
barValueSpacing: 1,
barDatasetSpacing: 1,
data : #{@stats[scope].to_json}
}
]
}
var ctx = $("##{scope}").get(0).getContext("2d");
new Chart(ctx).Bar(data,{"scaleOverlay": true, responsive: true, maintainAspectRatio: false});
:javascript
$("#event-stats").tablesorter();
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
= render 'projects/fork_suggestion' = render 'projects/fork_suggestion'
- if @project.feature_available?(:file_locks) - if @project.feature_available?(:file_locks)
:javascript %script#js-file-lock{ type: "application/json" }
PathLocks.init( - data = {}
'#{toggle_project_path_locks_path(@project)}', - data[:path] = @path
'#{@path}' - data[:toggle_path] = toggle_project_path_locks_path(@project)
); = data.to_json.html_safe
...@@ -49,6 +49,3 @@ ...@@ -49,6 +49,3 @@
Description parsed with #{link_to "GitLab Flavored Markdown", help_page_path('user/markdown'), target: '_blank'}. Description parsed with #{link_to "GitLab Flavored Markdown", help_page_path('user/markdown'), target: '_blank'}.
= render 'projects/ee/merge_request_approvals_settings', project: project, form: form = render 'projects/ee/merge_request_approvals_settings', project: project, form: form
:javascript
new GroupsSelect();
...@@ -27,19 +27,3 @@ ...@@ -27,19 +27,3 @@
%p %p
%strong= 'Done.' %strong= 'Done.'
You can now commit and push code as you normally do, but with increased speed. You can now commit and push code as you normally do, but with increased speed.
:javascript
$('#modal-geo-info')
.appendTo('body')
.modal({ modal: true, show: false })
.on('show.bs.modal', function() {
var data = $(this).data();
$('#geo-info-1').text(
'git clone ' +
(data.cloneUrlSecondary || '<clone url for secondary repository>')
);
$('#geo-info-2').text(
'git remote set-url --push origin ' +
(data.cloneUrlPrimary || '<clone url for primary repository>')
);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment