Commit 241f00de authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Using lodash in profiles component

parent 54cd52b6
<script> <script>
import _ from 'underscore'; import { escape as esc } from 'lodash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue'; import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -43,10 +43,10 @@ You are going to change the username %{currentUsernameBold} to %{newUsernameBold ...@@ -43,10 +43,10 @@ You are going to change the username %{currentUsernameBold} to %{newUsernameBold
Profile and projects will be redirected to the %{newUsername} namespace but this redirect will expire once the %{currentUsername} namespace is registered by another user or group. Profile and projects will be redirected to the %{newUsername} namespace but this redirect will expire once the %{currentUsername} namespace is registered by another user or group.
Please update your Git repository remotes as soon as possible.`), Please update your Git repository remotes as soon as possible.`),
{ {
currentUsernameBold: `<strong>${_.escape(this.username)}</strong>`, currentUsernameBold: `<strong>${esc(this.username)}</strong>`,
newUsernameBold: `<strong>${_.escape(this.newUsername)}</strong>`, newUsernameBold: `<strong>${esc(this.newUsername)}</strong>`,
currentUsername: _.escape(this.username), currentUsername: esc(this.username),
newUsername: _.escape(this.newUsername), newUsername: esc(this.newUsername),
}, },
false, false,
); );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import $ from 'jquery'; import $ from 'jquery';
import 'cropper'; import 'cropper';
import _ from 'underscore'; import { isString } from 'lodash';
(() => { (() => {
// Matches everything but the file name // Matches everything but the file name
...@@ -29,7 +29,7 @@ import _ from 'underscore'; ...@@ -29,7 +29,7 @@ import _ from 'underscore';
this.onModalShow = this.onModalShow.bind(this); this.onModalShow = this.onModalShow.bind(this);
this.onPickImageClick = this.onPickImageClick.bind(this); this.onPickImageClick = this.onPickImageClick.bind(this);
this.fileInput = $(input); this.fileInput = $(input);
this.modalCropImg = _.isString(this.modalCropImg) ? $(this.modalCropImg) : this.modalCropImg; this.modalCropImg = isString(this.modalCropImg) ? $(this.modalCropImg) : this.modalCropImg;
this.fileInput this.fileInput
.attr('name', `${this.fileInput.attr('name')}-trigger`) .attr('name', `${this.fileInput.attr('name')}-trigger`)
.attr('id', `${this.fileInput.attr('id')}-trigger`); .attr('id', `${this.fileInput.attr('id')}-trigger`);
...@@ -47,9 +47,9 @@ import _ from 'underscore'; ...@@ -47,9 +47,9 @@ import _ from 'underscore';
this.filename = this.getElement(filename); this.filename = this.getElement(filename);
this.previewImage = this.getElement(previewImage); this.previewImage = this.getElement(previewImage);
this.pickImageEl = this.getElement(pickImageEl); this.pickImageEl = this.getElement(pickImageEl);
this.modalCrop = _.isString(modalCrop) ? $(modalCrop) : modalCrop; this.modalCrop = isString(modalCrop) ? $(modalCrop) : modalCrop;
this.uploadImageBtn = _.isString(uploadImageBtn) ? $(uploadImageBtn) : uploadImageBtn; this.uploadImageBtn = isString(uploadImageBtn) ? $(uploadImageBtn) : uploadImageBtn;
this.modalCropImg = _.isString(modalCropImg) ? $(modalCropImg) : modalCropImg; this.modalCropImg = isString(modalCropImg) ? $(modalCropImg) : modalCropImg;
this.cropActionsBtn = this.modalCrop.find('[data-method]'); this.cropActionsBtn = this.modalCrop.find('[data-method]');
this.bindEvents(); this.bindEvents();
} }
......
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