Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2017-07-11 00:53:04 +0300
committerFatih Acet <acetfatih@gmail.com>2017-07-21 22:35:25 +0300
commitd45a8e006a4718b30a2669f7b888447e8b6dcb4f (patch)
tree9b8f61c6344bd5089aae2c72118ee922a791419b /app
parent08d597c7ce779608a689a85b63387a1f9da3e898 (diff)
IssueNotesRefactor: Make scroll into note an action.
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/notes/components/issue_notes.vue6
-rw-r--r--app/assets/javascripts/notes/stores/issue_notes_store.js7
2 files changed, 8 insertions, 5 deletions
diff --git a/app/assets/javascripts/notes/components/issue_notes.vue b/app/assets/javascripts/notes/components/issue_notes.vue
index c9904e5e0ec..4bf04867dc0 100644
--- a/app/assets/javascripts/notes/components/issue_notes.vue
+++ b/app/assets/javascripts/notes/components/issue_notes.vue
@@ -94,12 +94,8 @@ export default {
const $el = $(`#${hash}`);
if (hash && $el) {
- const isInViewport = gl.utils.isInViewport($el[0]);
this.$store.commit('setTargetNoteHash', hash);
-
- if (!isInViewport) {
- gl.utils.scrollToElement($el);
- }
+ this.$store.dispatch('scrollToNoteIfNeeded', $el);
}
},
},
diff --git a/app/assets/javascripts/notes/stores/issue_notes_store.js b/app/assets/javascripts/notes/stores/issue_notes_store.js
index bc71d106294..3e6b883bd4b 100644
--- a/app/assets/javascripts/notes/stores/issue_notes_store.js
+++ b/app/assets/javascripts/notes/stores/issue_notes_store.js
@@ -214,6 +214,13 @@ const actions = {
}
});
},
+ scrollToNoteIfNeeded(context, el) {
+ const isInViewport = gl.utils.isInViewport(el[0]);
+
+ if (!isInViewport) {
+ gl.utils.scrollToElement(el);
+ }
+ },
};
export default {