summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-07-13 17:10:31 +0100
committerPhil Hughes <me@iamphill.com>2017-07-13 17:10:31 +0100
commit8d6fae2c030ed3cfe5721e1d8a878c0693e90f97 (patch)
tree5bae01e38becbd86f52fcd64b96ba1ea836589e5
parent48b976e0973066ebf2f2ffd01b1bb4a7e9d4d040 (diff)
downloadgitlab-ce-user-inline-scripts.tar.gz
Removed user profile inline JavaScriptuser-inline-scripts
-rw-r--r--app/assets/javascripts/dispatcher.js3
-rw-r--r--app/assets/javascripts/user_tabs.js7
-rw-r--r--app/views/profiles/personal_access_tokens/index.html.haml7
-rw-r--r--app/views/users/calendar.html.haml7
-rw-r--r--app/views/users/show.html.haml9
5 files changed, 12 insertions, 21 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index ae19592ecbe..b903f0f983b 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -409,6 +409,9 @@ import PerformanceBar from './performance_bar';
break;
case 'users:show':
new UserCallout();
+ new gl.User({
+ action: document.querySelector('.js-user-profile').dataset.action,
+ });
break;
case 'admin:conversational_development_index:show':
new UserCallout();
diff --git a/app/assets/javascripts/user_tabs.js b/app/assets/javascripts/user_tabs.js
index f8e23c8624d..a5ff9b1526e 100644
--- a/app/assets/javascripts/user_tabs.js
+++ b/app/assets/javascripts/user_tabs.js
@@ -1,4 +1,5 @@
/* eslint-disable max-len, space-before-function-paren, no-underscore-dangle, consistent-return, comma-dangle, no-unused-vars, dot-notation, no-new, no-return-assign, camelcase, no-param-reassign, class-methods-use-this */
+/* global Calendar */
/*
UserTabs
@@ -147,7 +148,11 @@ export default class UserTabs {
return;
}
const $calendarWrap = this.$parentEl.find('.user-calendar');
- $calendarWrap.load($calendarWrap.data('href'));
+ $calendarWrap.load($calendarWrap.data('href'), () => {
+ const calendarEl = document.querySelector('.calendar');
+
+ return new Calendar(JSON.parse(calendarEl.dataset.dates), calendarEl.dataset.path);
+ });
new gl.Activities();
return this.loaded['activity'] = true;
}
diff --git a/app/views/profiles/personal_access_tokens/index.html.haml b/app/views/profiles/personal_access_tokens/index.html.haml
index cf750378e25..eabfdbf69e6 100644
--- a/app/views/profiles/personal_access_tokens/index.html.haml
+++ b/app/views/profiles/personal_access_tokens/index.html.haml
@@ -19,7 +19,7 @@
%h5.prepend-top-0
Your New Personal Access Token
.form-group
- = text_field_tag 'created-personal-access-token', flash[:personal_access_token], readonly: true, class: "form-control", 'aria-describedby' => "created-personal-access-token-help-block"
+ = text_field_tag 'created-personal-access-token', flash[:personal_access_token], readonly: true, class: "form-control js-select-on-focus", 'aria-describedby' => "created-personal-access-token-help-block"
= clipboard_button(text: flash[:personal_access_token], title: "Copy personal access token to clipboard", placement: "left")
%span#created-personal-access-token-help-block.help-block.text-danger Make sure you save it - you won't be able to access it again.
@@ -28,8 +28,3 @@
= render "shared/personal_access_tokens_form", path: profile_personal_access_tokens_path, impersonation: false, token: @personal_access_token, scopes: @scopes
= render "shared/personal_access_tokens_table", impersonation: false, active_tokens: @active_personal_access_tokens, inactive_tokens: @inactive_personal_access_tokens
-
-:javascript
- $("#created-personal-access-token").click(function() {
- this.select();
- });
diff --git a/app/views/users/calendar.html.haml b/app/views/users/calendar.html.haml
index 57b8845c55d..137664c2cef 100644
--- a/app/views/users/calendar.html.haml
+++ b/app/views/users/calendar.html.haml
@@ -1,9 +1,4 @@
-.clearfix.calendar
+.clearfix.calendar{ data: { dates: @activity_dates.to_json, path: user_calendar_activities_path } }
.js-contrib-calendar
.calendar-hint
Summary of issues, merge requests, push events, and comments
-:javascript
- new Calendar(
- #{@activity_dates.to_json},
- '#{user_calendar_activities_path}'
- );
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index f246bd7a586..699b33d70aa 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -9,7 +9,7 @@
= content_for :meta_tags do
= auto_discovery_link_tag(:atom, user_url(@user, format: :atom), title: "#{@user.name} activity")
-.user-profile
+.user-profile.js-user-profile{ data: { action: controller.action_name } }
.cover-block.user-cover-block.layout-nav
.cover-controls
- if @user == current_user
@@ -129,10 +129,3 @@
.loading-status
= spinner
-
-:javascript
- var userProfile;
-
- userProfile = new gl.User({
- action: "#{controller.action_name}"
- });