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
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-08-08 18:15:16 +0300
committerFilipa Lacerda <filipa@gitlab.com>2017-08-08 18:15:16 +0300
commit23334ac0a151a60ada07b643f703dd0a75223094 (patch)
treec4e5271de7a5d4842b83179eb7899f9da479b39e /app/assets/javascripts/repo/components/repo_sidebar.vue
parent15441f0ef564e87f2ffb672452b0fb9d7bd1d44e (diff)
parent6a6a1e5b9e0a82735f786ffedeacc7cbc33ed7cd (diff)
Merge branch 'master' into issue-discussions-refactor
* master: (481 commits) Make sure that we have author and committer disable file upload button while uploading Fix bar chart does not display label at hour 0 Fixed activity not loading on project homepage Expose noteable_iid in Note Fix fly-out width when it has long items Add a test to show that threshold 40 would corrupt Add changelog entry Raise encoding confidence threshold to 50 Fix the /projects/:id/repository/commits endpoint to handle dots in the ref name when the project full path contains a `/` Fix the /projects/:id/repository/tags endpoint to handle dots in the tag name when the project full path contains a `/` Add Italian translations of Pipeline Schedules Restrict InlineJavaScript for haml_lint to dev and test environment Incorporate Gitaly's CommitService.FindCommit RPC Move `deltas` and `diff_from_parents` logic to Gitlab::Git::Commit fix repo_edit_button_spec.js fix test failures in repo_preview_spec.js fix repo_loading_file_spec tests Refactor Gitlab::Git::Commit to include a repository use 100vh instead of flip flopping between the two - works on all suported browsers ...
Diffstat (limited to 'app/assets/javascripts/repo/components/repo_sidebar.vue')
-rw-r--r--app/assets/javascripts/repo/components/repo_sidebar.vue104
1 files changed, 104 insertions, 0 deletions
diff --git a/app/assets/javascripts/repo/components/repo_sidebar.vue b/app/assets/javascripts/repo/components/repo_sidebar.vue
new file mode 100644
index 00000000000..d6d832efc49
--- /dev/null
+++ b/app/assets/javascripts/repo/components/repo_sidebar.vue
@@ -0,0 +1,104 @@
+<script>
+import Service from '../services/repo_service';
+import Helper from '../helpers/repo_helper';
+import Store from '../stores/repo_store';
+import RepoPreviousDirectory from './repo_prev_directory.vue';
+import RepoFileOptions from './repo_file_options.vue';
+import RepoFile from './repo_file.vue';
+import RepoLoadingFile from './repo_loading_file.vue';
+import RepoMixin from '../mixins/repo_mixin';
+
+const RepoSidebar = {
+ mixins: [RepoMixin],
+ components: {
+ 'repo-file-options': RepoFileOptions,
+ 'repo-previous-directory': RepoPreviousDirectory,
+ 'repo-file': RepoFile,
+ 'repo-loading-file': RepoLoadingFile,
+ },
+
+ created() {
+ this.addPopEventListener();
+ },
+
+ data: () => Store,
+
+ methods: {
+ addPopEventListener() {
+ window.addEventListener('popstate', () => {
+ if (location.href.indexOf('#') > -1) return;
+ this.linkClicked({
+ url: location.href,
+ });
+ });
+ },
+
+ linkClicked(clickedFile) {
+ let url = '';
+ let file = clickedFile;
+ if (typeof file === 'object') {
+ file.loading = true;
+ if (file.type === 'tree' && file.opened) {
+ file = Store.removeChildFilesOfTree(file);
+ file.loading = false;
+ } else {
+ url = file.url;
+ Service.url = url;
+ // I need to refactor this to do the `then` here.
+ // Not a callback. For now this is good enough.
+ // it works.
+ Helper.getContent(file, () => {
+ file.loading = false;
+ Helper.scrollTabsRight();
+ });
+ }
+ } else if (typeof file === 'string') {
+ // go back
+ url = file;
+ Service.url = url;
+ Helper.getContent(null, () => Helper.scrollTabsRight());
+ }
+ },
+ },
+};
+
+export default RepoSidebar;
+</script>
+
+<template>
+<div id="sidebar" :class="{'sidebar-mini' : isMini}" v-cloak>
+ <table class="table">
+ <thead v-if="!isMini">
+ <tr>
+ <th class="name">Name</th>
+ <th class="hidden-sm hidden-xs last-commit">Last Commit</th>
+ <th class="hidden-xs last-update">Last Update</th>
+ </tr>
+ </thead>
+ <tbody>
+ <repo-file-options
+ :is-mini="isMini"
+ :project-name="projectName"/>
+ <repo-previous-directory
+ v-if="isRoot"
+ :prev-url="prevURL"
+ @linkclicked="linkClicked(prevURL)"/>
+ <repo-loading-file
+ v-for="n in 5"
+ :key="n"
+ :loading="loading"
+ :has-files="!!files.length"
+ :is-mini="isMini"/>
+ <repo-file
+ v-for="file in files"
+ :key="file.id"
+ :file="file"
+ :is-mini="isMini"
+ @linkclicked="linkClicked(file)"
+ :is-tree="isTree"
+ :has-files="!!files.length"
+ :active-file="activeFile"/>
+ </tbody>
+ </table>
+</div>
+</template>