summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/api.js16
-rw-r--r--app/assets/javascripts/dispatcher.js20
-rw-r--r--app/assets/javascripts/helpers/scroll_helper.js31
-rw-r--r--app/assets/javascripts/locale/bg/app.js1
-rw-r--r--app/assets/javascripts/locale/de/app.js1
-rw-r--r--app/assets/javascripts/locale/en/app.js1
-rw-r--r--app/assets/javascripts/locale/es/app.js1
-rw-r--r--app/assets/javascripts/locale/fr/app.js1
-rw-r--r--app/assets/javascripts/locale/pt_BR/app.js1
-rw-r--r--app/assets/javascripts/locale/zh_HK/app.js1
-rw-r--r--app/assets/javascripts/locale/zh_TW/app.js1
-rw-r--r--app/assets/javascripts/repo/index.js58
-rw-r--r--app/assets/javascripts/repo/monaco_loader.js13
-rw-r--r--app/assets/javascripts/repo/repo_binary_viewer.vue58
-rw-r--r--app/assets/javascripts/repo/repo_commit_section.vue118
-rw-r--r--app/assets/javascripts/repo/repo_edit_button.js29
-rw-r--r--app/assets/javascripts/repo/repo_editor.js122
-rw-r--r--app/assets/javascripts/repo/repo_file.vue58
-rw-r--r--app/assets/javascripts/repo/repo_file_buttons.vue54
-rw-r--r--app/assets/javascripts/repo/repo_file_options.vue39
-rw-r--r--app/assets/javascripts/repo/repo_helper.js276
-rw-r--r--app/assets/javascripts/repo/repo_loading_file.vue51
-rw-r--r--app/assets/javascripts/repo/repo_mini_mixin.js11
-rw-r--r--app/assets/javascripts/repo/repo_prev_directory.vue26
-rw-r--r--app/assets/javascripts/repo/repo_service.js67
-rw-r--r--app/assets/javascripts/repo/repo_sidebar.vue106
-rw-r--r--app/assets/javascripts/repo/repo_store.js205
-rw-r--r--app/assets/javascripts/repo/repo_tab.vue45
-rw-r--r--app/assets/javascripts/repo/repo_tabs.vue38
-rw-r--r--app/assets/javascripts/test_utils/index.js2
-rw-r--r--app/assets/javascripts/tree.js64
-rw-r--r--app/assets/stylesheets/framework/layout.scss7
-rw-r--r--app/assets/stylesheets/framework/mixins.scss7
-rw-r--r--app/assets/stylesheets/framework/variables.scss8
-rw-r--r--app/assets/stylesheets/pages/repo.scss354
-rw-r--r--app/assets/stylesheets/pages/tree.scss2
-rw-r--r--app/controllers/concerns/renders_blob.rb22
-rw-r--r--app/controllers/projects/blob_controller.rb8
-rw-r--r--app/controllers/projects/tree_controller.rb17
-rw-r--r--app/helpers/diff_helper.rb8
-rw-r--r--app/helpers/icons_helper.rb1
-rw-r--r--app/helpers/submodule_helper.rb4
-rw-r--r--app/helpers/tree_helper.rb8
-rw-r--r--app/serializers/blob_entity.rb17
-rw-r--r--app/serializers/submodule_entity.rb23
-rw-r--r--app/serializers/tree_entity.rb17
-rw-r--r--app/serializers/tree_root_entity.rb8
-rw-r--r--app/serializers/tree_serializer.rb3
-rw-r--r--app/views/projects/_files.html.haml11
-rw-r--r--app/views/projects/blob/_blob.html.haml3
-rw-r--r--app/views/projects/blob/_viewer.html.haml1
-rw-r--r--app/views/projects/blob/show.html.haml4
-rw-r--r--app/views/projects/show.html.haml4
-rw-r--r--app/views/projects/tree/_tree_content.html.haml25
-rw-r--r--app/views/projects/tree/_tree_header.html.haml77
-rw-r--r--app/views/projects/tree/show.html.haml5
-rw-r--r--config/webpack.config.js34
-rw-r--r--package.json4
-rw-r--r--spec/controllers/projects/blob_controller_spec.rb20
-rw-r--r--spec/javascripts/blob/viewer/index_spec.js4
-rw-r--r--spec/javascripts/fixtures/snippet.rb (renamed from spec/javascripts/fixtures/blob.rb)12
-rw-r--r--spec/javascripts/helpers/scroll_helper_spec.js59
-rw-r--r--spec/javascripts/repo/monaco_loader_spec.js8
-rw-r--r--spec/javascripts/repo/repo_binary_viewer_spec.js52
-rw-r--r--spec/javascripts/repo/repo_commit_section_spec.js129
-rw-r--r--spec/javascripts/repo/repo_editor_spec.js26
-rw-r--r--spec/javascripts/repo/repo_file_buttons_spec.js94
-rw-r--r--spec/javascripts/repo/repo_file_options_spec.js35
-rw-r--r--spec/javascripts/repo/repo_file_spec.js103
-rw-r--r--spec/javascripts/repo/repo_loading_file_spec.js79
-rw-r--r--spec/javascripts/repo/repo_prev_directory_spec.js29
-rw-r--r--spec/javascripts/repo/repo_service_spec.js121
-rw-r--r--spec/javascripts/repo/repo_sidebar_spec.js61
-rw-r--r--spec/javascripts/repo/repo_tab_spec.js67
-rw-r--r--spec/javascripts/repo/repo_tabs_spec.js49
-rw-r--r--yarn.lock167
76 files changed, 3051 insertions, 261 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js
index 56fa0d71a9a..76b724e1bcb 100644
--- a/app/assets/javascripts/api.js
+++ b/app/assets/javascripts/api.js
@@ -13,6 +13,7 @@ const Api = {
dockerfilePath: '/api/:version/templates/dockerfiles/:key',
issuableTemplatePath: '/:namespace_path/:project_path/templates/:type/:key',
usersPath: '/api/:version/users.json',
+ commitPath: '/api/:version/projects/:id/repository/commits',
group(groupId, callback) {
const url = Api.buildUrl(Api.groupPath)
@@ -95,6 +96,21 @@ const Api = {
.done(projects => callback(projects));
},
+ commitMultiple(id, data, callback) {
+ // see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
+ const url = Api.buildUrl(Api.commitPath)
+ .replace(':id', id);
+ return $.ajax({
+ url,
+ type: 'POST',
+ contentType: 'application/json; charset=utf-8',
+ data: JSON.stringify(data),
+ dataType: 'json',
+ })
+ .done(commitData => callback(commitData))
+ .fail(message => callback(message.responseJSON));
+ },
+
// Return text for a specific license
licenseText(key, data, callback) {
const url = Api.buildUrl(Api.licensePath)
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index 9d706b5ba59..e625bf24a98 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -54,13 +54,13 @@ import ShortcutsBlob from './shortcuts_blob';
import SigninTabsMemoizer from './signin_tabs_memoizer';
import Star from './star';
import Todos from './todos';
-import TreeView from './tree';
import UsagePing from './usage_ping';
import UsernameValidator from './username_validator';
import VersionCheckImage from './version_check_image';
import Wikis from './wikis';
import ZenMode from './zen_mode';
import initSettingsPanels from './settings_panels';
+import ScrollHelper from './helpers/scroll_helper';
import initExperimentalFlags from './experimental_flags';
import OAuthRememberMe from './oauth_remember_me';
import PerformanceBar from './performance_bar';
@@ -89,6 +89,9 @@ import GpgBadges from './gpg_badges';
if (!page) {
return false;
}
+
+ ScrollHelper.setScrollWidth();
+
path = page.split(':');
shortcut_handler = null;
@@ -320,12 +323,6 @@ import GpgBadges from './gpg_badges';
case 'projects:show':
shortcut_handler = new ShortcutsNavigation();
new NotificationsForm();
- if ($('#tree-slider').length) {
- new TreeView();
- }
- if ($('.blob-viewer').length) {
- new BlobViewer();
- }
break;
case 'projects:edit':
setupProjectEdit();
@@ -379,18 +376,9 @@ import GpgBadges from './gpg_badges';
case 'admin:groups:edit':
new GroupAvatar();
break;
- case 'projects:tree:show':
- shortcut_handler = new ShortcutsNavigation();
- new TreeView();
- new BlobViewer();
- break;
case 'projects:find_file:show':
shortcut_handler = true;
break;
- case 'projects:blob:show':
- new BlobViewer();
- initBlob();
- break;
case 'projects:blame:show':
initBlob();
break;
diff --git a/app/assets/javascripts/helpers/scroll_helper.js b/app/assets/javascripts/helpers/scroll_helper.js
new file mode 100644
index 00000000000..e921f9e2e0f
--- /dev/null
+++ b/app/assets/javascripts/helpers/scroll_helper.js
@@ -0,0 +1,31 @@
+import $ from 'jquery';
+
+const ScrollHelper = {
+ getScrollWidth() {
+ const $rulerContainer = $('<div>').css({
+ visibility: 'hidden',
+ width: 100,
+ overflow: 'scroll',
+ });
+
+ const $ruler = $('<div>').css({
+ width: 100,
+ });
+
+ $ruler.appendTo($rulerContainer);
+
+ $rulerContainer.appendTo('body');
+
+ const scrollWidth = $ruler.get(0).offsetWidth;
+
+ $rulerContainer.remove();
+
+ return 100 - scrollWidth;
+ },
+
+ setScrollWidth() {
+ $('body').attr('data-scroll-width', ScrollHelper.getScrollWidth());
+ },
+};
+
+export default ScrollHelper;
diff --git a/app/assets/javascripts/locale/bg/app.js b/app/assets/javascripts/locale/bg/app.js
new file mode 100644
index 00000000000..1991d5b1407
--- /dev/null
+++ b/app/assets/javascripts/locale/bg/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['bg'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","POT-Creation-Date":"2017-05-04 19:24-0500","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","PO-Revision-Date":"2017-06-05 09:40-0400","Last-Translator":"Lyubomir Vasilev <lyubomirv@abv.bg>","Language-Team":"Bulgarian","Language":"bg","X-Generator":"Zanata 3.9.6","Plural-Forms":"nplurals=2; plural=(n != 1)","lang":"bg","domain":"app","plural_forms":"nplurals=2; plural=(n != 1)"},"ByAuthor|by":["от"],"Commit":["Подаване","Подавания"],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":["Анализът на циклите дава общ поглед върху това колко време е нужно на една идея да се превърне в завършена функционалност в проекта."],"CycleAnalyticsStage|Code":["Програмиране"],"CycleAnalyticsStage|Issue":["Проблем"],"CycleAnalyticsStage|Plan":["Планиране"],"CycleAnalyticsStage|Production":["Издаване"],"CycleAnalyticsStage|Review":["Преглед и одобрение"],"CycleAnalyticsStage|Staging":["Подготовка за издаване"],"CycleAnalyticsStage|Test":["Тестване"],"Deploy":["Внедряване","Внедрявания"],"FirstPushedBy|First":["Първо"],"FirstPushedBy|pushed by":["изпращане на промени от"],"From issue creation until deploy to production":["От създаването на проблема до внедряването в крайната версия"],"From merge request merge until deploy to production":["От прилагането на заявката за сливане до внедряването в крайната версия"],"Introducing Cycle Analytics":["Представяме Ви анализът на циклите"],"Last %d day":["Последния %d ден","Последните %d дни"],"Limited to showing %d event at most":["Ограничено до показване на последното %d събитие","Ограничено до показване на последните %d събития"],"Median":["Медиана"],"New Issue":["Нов проблем","Нови проблема"],"Not available":["Не е налично"],"Not enough data":["Няма достатъчно данни"],"OpenedNDaysAgo|Opened":["Отворен"],"Pipeline Health":["Състояние"],"ProjectLifecycle|Stage":["Етап"],"Read more":["Прочетете повече"],"Related Commits":["Свързани подавания"],"Related Deployed Jobs":["Свързани задачи за внедряване"],"Related Issues":["Свързани проблеми"],"Related Jobs":["Свързани задачи"],"Related Merge Requests":["Свързани заявки за сливане"],"Related Merged Requests":["Свързани приложени заявки за сливане"],"Showing %d event":["Показване на %d събитие","Показване на %d събития"],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":["Етапът на програмиране показва времето от първото подаване до създаването на заявката за сливане. Данните ще бъдат добавени тук автоматично след като бъде създадена първата заявка за сливане."],"The collection of events added to the data gathered for that stage.":["Съвкупността от събития добавени към данните събрани за този етап."],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":["Етапът на проблемите показва колко е времето от създаването на проблем до определянето на целеви етап на проекта за него, или до добавянето му в списък на дъската за проблеми. Започнете да добавяте проблеми, за да видите данните за този етап."],"The phase of the development lifecycle.":["Етапът от цикъла на разработка"],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":["Етапът на планиране показва колко е времето от преходната стъпка до изпращането на първото подаване. Това време ще бъде добавено автоматично след като изпратите първото си подаване."],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":["Етапът на издаване показва общото време, което е нужно от създаването на проблем до внедряването на кода в крайната версия."],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":["Етапът на преглед и одобрение показва времето от създаването на заявката за сливане до прилагането ѝ. Данните ще бъдат добавени автоматично след като приложите първата си заявка за сливане."],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":["Етапът на подготовка за издаване показва времето между прилагането на заявката за сливане и внедряването на кода в средата на работещата крайна версия. Данните ще бъдат добавени автоматично след като направите първото си внедряване в крайната версия."],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":["Етапът на тестване показва времето, което е нужно на „Gitlab CI“ да изпълни всички задачи за свързаната заявка за сливане. Данните ще бъдат добавени автоматично след като приключи изпълнените на първата Ви такава задача."],"The time taken by each data entry gathered by that stage.":["Времето, което отнема всеки запис от данни за съответния етап."],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":["Стойността, която се намира в средата на последователността от наблюдавани данни. Например: медианата на 3, 5 и 9 е 5, а медианата на 3, 5, 7 и 8 е (5+7)/2 = 6."],"Time before an issue gets scheduled":["Време преди един проблем да бъде планиран за работа"],"Time before an issue starts implementation":["Време преди работата по проблем да започне"],"Time between merge request creation and merge/close":["Време между създаване на заявка за сливане и прилагането/отхвърлянето ѝ"],"Time until first merge request":["Време преди първата заявка за сливане"],"Time|hr":["час","часа"],"Time|min":["мин","мин"],"Time|s":["сек"],"Total Time":["Общо време"],"Total test time for all commits/merges":["Общо време за тестване на всички подавания/сливания"],"Want to see the data? Please ask an administrator for access.":["Искате ли да видите данните? Помолете администратор за достъп."],"We don't have enough data to show this stage.":["Няма достатъчно данни за този етап."],"You have reached your project limit":[""],"You need permission.":["Нуждаете се от разрешение."],"day":["ден","дни"]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/locale/de/app.js b/app/assets/javascripts/locale/de/app.js
new file mode 100644
index 00000000000..820b1db1879
--- /dev/null
+++ b/app/assets/javascripts/locale/de/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['de'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-05-09 13:44+0200","Language-Team":"German","Language":"de","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","Last-Translator":"","X-Generator":"Poedit 2.0.1","lang":"de","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"Are you sure you want to delete this pipeline schedule?":[""],"ByAuthor|by":["Von"],"Cancel":[""],"Commit":["Commit","Commits"],"Cron Timezone":[""],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":["Cycle Analytics liefern einen Überblick darüber, wie viel Zeit in Ihrem Projekt von einer Idee bis zum Produktivdeployment vergeht."],"CycleAnalyticsStage|Code":["Code"],"CycleAnalyticsStage|Issue":["Issue"],"CycleAnalyticsStage|Plan":["Planung"],"CycleAnalyticsStage|Production":["Produktiv"],"CycleAnalyticsStage|Review":["Review"],"CycleAnalyticsStage|Staging":["Staging"],"CycleAnalyticsStage|Test":["Test"],"Delete":[""],"Deploy":["Deployment","Deployments"],"Description":[""],"Edit":[""],"Edit Pipeline Schedule %{id}":[""],"Failed to change the owner":[""],"Failed to remove the pipeline schedule":[""],"Filter":[""],"FirstPushedBy|First":["Erster"],"FirstPushedBy|pushed by":["gepusht von"],"From issue creation until deploy to production":["Vom Anlegen des Issues bis zum Produktivdeployment"],"From merge request merge until deploy to production":["Vom Merge Request bis zum Produktivdeployment"],"Interval Pattern":[""],"Introducing Cycle Analytics":["Was sind Cycle Analytics?"],"Last %d day":["Letzter %d Tag","Letzten %d Tage"],"Last Pipeline":[""],"Limited to showing %d event at most":["Eingeschränkt auf maximal %d Ereignis","Eingeschränkt auf maximal %d Ereignisse"],"Median":["Median"],"New Issue":["Neues Issue","Neue Issues"],"New Pipeline Schedule":[""],"No schedules":[""],"Not available":["Nicht verfügbar"],"Not enough data":["Nicht genügend Daten"],"OpenedNDaysAgo|Opened":["Erstellt"],"Owner":[""],"Pipeline Health":["Pipeline Kennzahlen"],"Pipeline Schedule":[""],"Pipeline Schedules":[""],"PipelineSchedules|Activated":[""],"PipelineSchedules|Active":[""],"PipelineSchedules|All":[""],"PipelineSchedules|Inactive":[""],"PipelineSchedules|Next Run":[""],"PipelineSchedules|None":[""],"PipelineSchedules|Provide a short description for this pipeline":[""],"PipelineSchedules|Take ownership":[""],"PipelineSchedules|Target":[""],"ProjectLifecycle|Stage":["Phase"],"Read more":["Mehr"],"Related Commits":["Zugehörige Commits"],"Related Deployed Jobs":["Zugehörige Deploymentjobs"],"Related Issues":["Zugehörige Issues"],"Related Jobs":["Zugehörige Jobs"],"Related Merge Requests":["Zugehörige Merge Requests"],"Related Merged Requests":["Zugehörige abgeschlossene Merge Requests"],"Save pipeline schedule":[""],"Schedule a new pipeline":[""],"Select a timezone":[""],"Select target branch":[""],"Showing %d event":["Zeige %d Ereignis","Zeige %d Ereignisse"],"Target Branch":[""],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":["Die Code-Phase stellt die Zeit vom ersten Commit bis zum Erstellen eines Merge Requests dar. Sobald Sie Ihren ersten Merge Request anlegen, werden dessen Daten automatisch ergänzt."],"The collection of events added to the data gathered for that stage.":["Ereignisse, die für diese Phase ausgewertet wurden."],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":["Die Issue-Phase stellt die Zeit vom Anlegen eines Issues bis zum Zuweisen eines Meilensteins oder Hinzufügen zum Issue Board dar. Erstellen Sie einen Issue, damit dessen Daten hier erscheinen."],"The phase of the development lifecycle.":["Die Phase im Entwicklungsprozess."],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":["Die Planungsphase stellt die Zeit von der vorherigen Phase bis zum Pushen des ersten Commits dar. Sobald Sie den ersten Commit pushen, werden dessen Daten hier erscheinen."],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":["Die Produktiv-Phase stellt die Gesamtzeit vom Anlegen eines Issues bis zum Deployment auf dem Produktivsystem dar. Sobald Sie den vollständigen Entwicklungszyklus von einer Idee bis zum Produktivdeployment durchlaufen haben, erscheinen die zugehörigen Daten hier."],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":["Die Review-Phase stellt die Zeit vom Anlegen eines Merge Requests bis zum Mergen dar. Sobald Sie Ihren ersten Merge Request abschließen, werden dessen Daten hier automatisch angezeigt."],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":["Die Staging-Phase stellt die Zeit zwischen Mergen eines Merge Requests und dem Produktivdeployment dar. Sobald Sie das erste Produktivdeployment durchgeführt haben, werden dessen Daten hier automatisch angezeigt."],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":["Die Test-Phase stellt die Zeit dar, die GitLab CI benötigt um die Pipelines von Merge Requests abzuarbeiten. Sobald die erste Pipeline abgeschlossen ist, werden deren Daten hier automatisch angezeigt."],"The time taken by each data entry gathered by that stage.":["Zeit die für das jeweilige Ereignis in der Phase ermittelt wurde."],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":["Der mittlere aller erfassten Werte. Zum Beispiel ist für 3, 5, 9 der Median 5. Bei 3, 5, 7, 8 ist der Median (5+7)/2 = 6."],"Time before an issue gets scheduled":["Zeit bis ein Issue geplant wird"],"Time before an issue starts implementation":["Zeit bis die Implementierung für ein Issue beginnt"],"Time between merge request creation and merge/close":["Zeit zwischen Anlegen und Mergen/Schließen eines Merge Requests"],"Time until first merge request":["Zeit bis zum ersten Merge Request"],"Time|hr":["h","h"],"Time|min":["min","min"],"Time|s":["s"],"Total Time":["Gesamtzeit"],"Total test time for all commits/merges":["Gesamte Testlaufzeit für alle Commits/Merges"],"Want to see the data? Please ask an administrator for access.":["Um diese Daten einsehen zu können, wenden Sie sich bitte an Ihren Administrator."],"We don't have enough data to show this stage.":["Es liegen nicht genügend Daten vor, um diese Phase anzuzeigen."],"You have reached your project limit":[""],"You need permission.":["Sie benötigen Zugriffsrechte."],"day":["Tag","Tage"]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/locale/en/app.js b/app/assets/javascripts/locale/en/app.js
new file mode 100644
index 00000000000..490e8e8cd3f
--- /dev/null
+++ b/app/assets/javascripts/locale/en/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['en'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-04-12 22:36-0500","Last-Translator":"FULL NAME <EMAIL@ADDRESS>","Language-Team":"English","Language":"en","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","lang":"en","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"%{commit_author_link} committed %{commit_timeago}":[""],"About auto deploy":[""],"Active":[""],"Activity":[""],"Add Changelog":[""],"Add Contribution guide":[""],"Add License":[""],"Add an SSH key to your profile to pull or push via SSH.":[""],"Add new directory":[""],"Archived project! Repository is read-only":[""],"Are you sure you want to delete this pipeline schedule?":[""],"Attach a file by drag &amp; drop or %{upload_link}":[""],"Branch":["",""],"Branch <strong>%{branch_name}</strong> was created. To set up auto deploy, choose a GitLab CI Yaml template and commit your changes. %{link_to_autodeploy_doc}":[""],"Branches":[""],"Browse files":[""],"ByAuthor|by":[""],"CI configuration":[""],"Cancel":[""],"ChangeTypeActionLabel|Pick into branch":[""],"ChangeTypeActionLabel|Revert in branch":[""],"ChangeTypeAction|Cherry-pick":[""],"ChangeTypeAction|Revert":[""],"Changelog":[""],"Charts":[""],"Cherry-pick this commit":[""],"Cherry-pick this merge request":[""],"CiStatusLabel|canceled":[""],"CiStatusLabel|created":[""],"CiStatusLabel|failed":[""],"CiStatusLabel|manual action":[""],"CiStatusLabel|passed":[""],"CiStatusLabel|passed with warnings":[""],"CiStatusLabel|pending":[""],"CiStatusLabel|skipped":[""],"CiStatusLabel|waiting for manual action":[""],"CiStatusText|blocked":[""],"CiStatusText|canceled":[""],"CiStatusText|created":[""],"CiStatusText|failed":[""],"CiStatusText|manual":[""],"CiStatusText|passed":[""],"CiStatusText|pending":[""],"CiStatusText|skipped":[""],"CiStatus|running":[""],"Commit":["",""],"Commit message":[""],"CommitBoxTitle|Commit":[""],"CommitMessage|Add %{file_name}":[""],"Commits":[""],"Commits|History":[""],"Committed by":[""],"Compare":[""],"Contribution guide":[""],"Contributors":[""],"Copy URL to clipboard":[""],"Copy commit SHA to clipboard":[""],"Create New Directory":[""],"Create directory":[""],"Create empty bare repository":[""],"Create merge request":[""],"Create new...":[""],"CreateNewFork|Fork":[""],"CreateTag|Tag":[""],"Cron Timezone":[""],"Cron syntax":[""],"Custom notification events":[""],"Custom notification levels are the same as participating levels. With custom notification levels you will also receive notifications for select events. To find out more, check out %{notification_link}.":[""],"Cycle Analytics":[""],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":[""],"CycleAnalyticsStage|Code":[""],"CycleAnalyticsStage|Issue":[""],"CycleAnalyticsStage|Plan":[""],"CycleAnalyticsStage|Production":[""],"CycleAnalyticsStage|Review":[""],"CycleAnalyticsStage|Staging":[""],"CycleAnalyticsStage|Test":[""],"Define a custom pattern with cron syntax":[""],"Delete":[""],"Deploy":["",""],"Description":[""],"Directory name":[""],"Don't show again":[""],"Download":[""],"Download tar":[""],"Download tar.bz2":[""],"Download tar.gz":[""],"Download zip":[""],"DownloadArtifacts|Download":[""],"DownloadCommit|Email Patches":[""],"DownloadCommit|Plain Diff":[""],"DownloadSource|Download":[""],"Edit":[""],"Edit Pipeline Schedule %{id}":[""],"Every day (at 4:00am)":[""],"Every month (on the 1st at 4:00am)":[""],"Every week (Sundays at 4:00am)":[""],"Failed to change the owner":[""],"Failed to remove the pipeline schedule":[""],"Files":[""],"Find by path":[""],"Find file":[""],"FirstPushedBy|First":[""],"FirstPushedBy|pushed by":[""],"Fork":["",""],"ForkedFromProjectPath|Forked from":[""],"From issue creation until deploy to production":[""],"From merge request merge until deploy to production":[""],"Go to your fork":[""],"GoToYourFork|Fork":[""],"Home":[""],"Housekeeping successfully started":[""],"Import repository":[""],"Interval Pattern":[""],"Introducing Cycle Analytics":[""],"LFSStatus|Disabled":[""],"LFSStatus|Enabled":[""],"Last %d day":["",""],"Last Pipeline":[""],"Last Update":[""],"Last commit":[""],"Learn more in the":[""],"Learn more in the|pipeline schedules documentation":[""],"Leave group":[""],"Leave project":[""],"Limited to showing %d event at most":["",""],"Median":[""],"MissingSSHKeyWarningLink|add an SSH key":[""],"New Issue":["",""],"New Pipeline Schedule":[""],"New branch":[""],"New directory":[""],"New file":[""],"New issue":[""],"New merge request":[""],"New schedule":[""],"New snippet":[""],"New tag":[""],"No repository":[""],"No schedules":[""],"Not available":[""],"Not enough data":[""],"Notification events":[""],"NotificationEvent|Close issue":[""],"NotificationEvent|Close merge request":[""],"NotificationEvent|Failed pipeline":[""],"NotificationEvent|Merge merge request":[""],"NotificationEvent|New issue":[""],"NotificationEvent|New merge request":[""],"NotificationEvent|New note":[""],"NotificationEvent|Reassign issue":[""],"NotificationEvent|Reassign merge request":[""],"NotificationEvent|Reopen issue":[""],"NotificationEvent|Successful pipeline":[""],"NotificationLevel|Custom":[""],"NotificationLevel|Disabled":[""],"NotificationLevel|Global":[""],"NotificationLevel|On mention":[""],"NotificationLevel|Participate":[""],"NotificationLevel|Watch":[""],"OfSearchInADropdown|Filter":[""],"OpenedNDaysAgo|Opened":[""],"Options":[""],"Owner":[""],"Pipeline":[""],"Pipeline Health":[""],"Pipeline Schedule":[""],"Pipeline Schedules":[""],"PipelineSchedules|Activated":[""],"PipelineSchedules|Active":[""],"PipelineSchedules|All":[""],"PipelineSchedules|Inactive":[""],"PipelineSchedules|Next Run":[""],"PipelineSchedules|None":[""],"PipelineSchedules|Provide a short description for this pipeline":[""],"PipelineSchedules|Take ownership":[""],"PipelineSchedules|Target":[""],"PipelineSheduleIntervalPattern|Custom":[""],"Pipeline|with stage":[""],"Pipeline|with stages":[""],"Project '%{project_name}' queued for deletion.":[""],"Project '%{project_name}' was successfully created.":[""],"Project '%{project_name}' was successfully updated.":[""],"Project '%{project_name}' will be deleted.":[""],"Project access must be granted explicitly to each user.":[""],"Project export could not be deleted.":[""],"Project export has been deleted.":[""],"Project export link has expired. Please generate a new export from your project settings.":[""],"Project export started. A download link will be sent by email.":[""],"Project home":[""],"ProjectFeature|Disabled":[""],"ProjectFeature|Everyone with access":[""],"ProjectFeature|Only team members":[""],"ProjectFileTree|Name":[""],"ProjectLastActivity|Never":[""],"ProjectLifecycle|Stage":[""],"ProjectNetworkGraph|Graph":[""],"Read more":[""],"Readme":[""],"RefSwitcher|Branches":[""],"RefSwitcher|Tags":[""],"Related Commits":[""],"Related Deployed Jobs":[""],"Related Issues":[""],"Related Jobs":[""],"Related Merge Requests":[""],"Related Merged Requests":[""],"Remind later":[""],"Remove project":[""],"Request Access":[""],"Revert this commit":[""],"Revert this merge request":[""],"Save pipeline schedule":[""],"Schedule a new pipeline":[""],"Scheduling Pipelines":[""],"Search branches and tags":[""],"Select Archive Format":[""],"Select a timezone":[""],"Select target branch":[""],"Set a password on your account to pull or push via %{protocol}":[""],"Set up CI":[""],"Set up Koding":[""],"Set up auto deploy":[""],"SetPasswordToCloneLink|set a password":[""],"Showing %d event":["",""],"Source code":[""],"StarProject|Star":[""],"Start a %{new_merge_request} with these changes":[""],"Start a <strong>new merge request</strong> with these changes":[""],"Switch branch/tag":[""],"Tag":["",""],"Tags":[""],"Target Branch":[""],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":[""],"The collection of events added to the data gathered for that stage.":[""],"The fork relationship has been removed.":[""],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":[""],"The phase of the development lifecycle.":[""],"The pipelines schedule runs pipelines in the future, repeatedly, for specific branches or tags. Those scheduled pipelines will inherit limited project access based on their associated user.":[""],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":[""],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":[""],"The project can be accessed by any logged in user.":[""],"The project can be accessed without any authentication.":[""],"The repository for this project does not exist.":[""],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":[""],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":[""],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":[""],"The time taken by each data entry gathered by that stage.":[""],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":[""],"This means you can not push code until you create an empty repository or import existing one.":[""],"Time before an issue gets scheduled":[""],"Time before an issue starts implementation":[""],"Time between merge request creation and merge/close":[""],"Time until first merge request":[""],"Timeago|%s days ago":[""],"Timeago|%s days remaining":[""],"Timeago|%s hours remaining":[""],"Timeago|%s minutes ago":[""],"Timeago|%s minutes remaining":[""],"Timeago|%s months ago":[""],"Timeago|%s months remaining":[""],"Timeago|%s seconds remaining":[""],"Timeago|%s weeks ago":[""],"Timeago|%s weeks remaining":[""],"Timeago|%s years ago":[""],"Timeago|%s years remaining":[""],"Timeago|1 day remaining":[""],"Timeago|1 hour remaining":[""],"Timeago|1 minute remaining":[""],"Timeago|1 month remaining":[""],"Timeago|1 week remaining":[""],"Timeago|1 year remaining":[""],"Timeago|Past due":[""],"Timeago|a day ago":[""],"Timeago|a month ago":[""],"Timeago|a week ago":[""],"Timeago|a while":[""],"Timeago|a year ago":[""],"Timeago|about %s hours ago":[""],"Timeago|about a minute ago":[""],"Timeago|about an hour ago":[""],"Timeago|in %s days":[""],"Timeago|in %s hours":[""],"Timeago|in %s minutes":[""],"Timeago|in %s months":[""],"Timeago|in %s seconds":[""],"Timeago|in %s weeks":[""],"Timeago|in %s years":[""],"Timeago|in 1 day":[""],"Timeago|in 1 hour":[""],"Timeago|in 1 minute":[""],"Timeago|in 1 month":[""],"Timeago|in 1 week":[""],"Timeago|in 1 year":[""],"Timeago|less than a minute ago":[""],"Time|hr":["",""],"Time|min":["",""],"Time|s":[""],"Total Time":[""],"Total test time for all commits/merges":[""],"Unstar":[""],"Upload New File":[""],"Upload file":[""],"Use your global notification setting":[""],"VisibilityLevel|Internal":[""],"VisibilityLevel|Private":[""],"VisibilityLevel|Public":[""],"Want to see the data? Please ask an administrator for access.":[""],"We don't have enough data to show this stage.":[""],"Withdraw Access Request":[""],"You are going to remove %{project_name_with_namespace}.\\nRemoved project CANNOT be restored!\\nAre you ABSOLUTELY sure?":[""],"You are going to remove the fork relationship to source project %{forked_from_project}. Are you ABSOLUTELY sure?":[""],"You are going to transfer %{project_name_with_namespace} to another owner. Are you ABSOLUTELY sure?":[""],"You can only add files when you are on a branch":[""],"You have reached your project limit":[""],"You must sign in to star a project":[""],"You need permission.":[""],"You will not get any notifications via email":[""],"You will only receive notifications for the events you choose":[""],"You will only receive notifications for threads you have participated in":[""],"You will receive notifications for any activity":[""],"You will receive notifications only for comments in which you were @mentioned":[""],"You won't be able to pull or push project code via %{protocol} until you %{set_password_link} on your account":[""],"You won't be able to pull or push project code via SSH until you %{add_ssh_key_link} to your profile":[""],"Your name":[""],"day":["",""],"new merge request":[""],"notification emails":[""],"parent":["",""]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/locale/es/app.js b/app/assets/javascripts/locale/es/app.js
new file mode 100644
index 00000000000..727db6d217e
--- /dev/null
+++ b/app/assets/javascripts/locale/es/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['es'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-06-19 15:22-0500","Language-Team":"Spanish","Language":"es","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Plural-Forms":"nplurals=2; plural=n != 1;","Last-Translator":"Bob Van Landuyt <bob@gitlab.com>","X-Generator":"Poedit 2.0.2","lang":"es","domain":"app","plural_forms":"nplurals=2; plural=n != 1;"},"%{commit_author_link} committed %{commit_timeago}":["%{commit_author_link} cambió %{commit_timeago}"],"About auto deploy":["Acerca del auto despliegue"],"Active":["Activo"],"Activity":["Actividad"],"Add Changelog":["Agregar Changelog"],"Add Contribution guide":["Agregar guía de contribución"],"Add License":["Agregar Licencia"],"Add an SSH key to your profile to pull or push via SSH.":["Agregar una clave SSH a tu perfil para actualizar o enviar a través de SSH."],"Add new directory":["Agregar nuevo directorio"],"Archived project! Repository is read-only":["¡Proyecto archivado! El repositorio es de solo lectura"],"Are you sure you want to delete this pipeline schedule?":["¿Estás seguro que deseas eliminar esta programación del pipeline?"],"Attach a file by drag &amp; drop or %{upload_link}":["Adjunte un archivo arrastrando &amp; soltando o %{upload_link}"],"Branch":["Rama","Ramas"],"Branch <strong>%{branch_name}</strong> was created. To set up auto deploy, choose a GitLab CI Yaml template and commit your changes. %{link_to_autodeploy_doc}":["La rama <strong>%{branch_name}</strong> fue creada. Para configurar el auto despliegue, escoge una plantilla Yaml para GitLab CI y envía tus cambios. %{link_to_autodeploy_doc}"],"BranchSwitcherPlaceholder|Search branches":["Buscar ramas"],"BranchSwitcherTitle|Switch branch":["Cambiar rama"],"Branches":["Ramas"],"Browse files":["Examinar los archivos"],"ByAuthor|by":["por"],"CI configuration":["Configuración de CI"],"Cancel":["Cancelar"],"ChangeTypeActionLabel|Pick into branch":["Escoger en la rama"],"ChangeTypeActionLabel|Revert in branch":["Revertir en la rama"],"ChangeTypeAction|Cherry-pick":["Cherry-pick"],"ChangeTypeAction|Revert":["Revertir"],"Changelog":["Changelog"],"Charts":["Gráficos"],"Cherry-pick this commit":["Escoger este cambio"],"Cherry-pick this merge request":["Escoger esta solicitud de fusión"],"CiStatusLabel|canceled":["cancelado"],"CiStatusLabel|created":["creado"],"CiStatusLabel|failed":["fallido"],"CiStatusLabel|manual action":["acción manual"],"CiStatusLabel|passed":["pasó"],"CiStatusLabel|passed with warnings":["pasó con advertencias"],"CiStatusLabel|pending":["pendiente"],"CiStatusLabel|skipped":["omitido"],"CiStatusLabel|waiting for manual action":["esperando acción manual"],"CiStatusText|blocked":["bloqueado"],"CiStatusText|canceled":["cancelado"],"CiStatusText|created":["creado"],"CiStatusText|failed":["fallado"],"CiStatusText|manual":["manual"],"CiStatusText|passed":["pasó"],"CiStatusText|pending":["pendiente"],"CiStatusText|skipped":["omitido"],"CiStatus|running":["en ejecución"],"Commit":["Cambio","Cambios"],"Commit message":["Mensaje del cambio"],"CommitBoxTitle|Commit":["Cambio"],"CommitMessage|Add %{file_name}":["Agregar %{file_name}"],"Commits":["Cambios"],"Commits|History":["Historial"],"Committed by":["Enviado por"],"Compare":["Comparar"],"Contribution guide":["Guía de contribución"],"Contributors":["Contribuidores"],"Copy URL to clipboard":["Copiar URL al portapapeles"],"Copy commit SHA to clipboard":["Copiar SHA del cambio al portapapeles"],"Create New Directory":["Crear Nuevo Directorio"],"Create directory":["Crear directorio"],"Create empty bare repository":["Crear repositorio vacío"],"Create merge request":["Crear solicitud de fusión"],"Create new...":["Crear nuevo..."],"CreateNewFork|Fork":["Bifurcar"],"CreateTag|Tag":["Etiqueta"],"Cron Timezone":["Zona horaria del Cron"],"Cron syntax":["Sintaxis de Cron"],"Custom notification events":["Eventos de notificaciones personalizadas"],"Custom notification levels are the same as participating levels. With custom notification levels you will also receive notifications for select events. To find out more, check out %{notification_link}.":["Los niveles de notificación personalizados son los mismos que los niveles participantes. Con los niveles de notificación personalizados, también recibirá notificaciones para eventos seleccionados. Para obtener más información, consulte %{notification_link}."],"Cycle Analytics":["Cycle Analytics"],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":["Cycle Analytics ofrece una visión general de cuánto tiempo tarda en pasar de idea a producción en su proyecto."],"CycleAnalyticsStage|Code":["Código"],"CycleAnalyticsStage|Issue":["Incidencia"],"CycleAnalyticsStage|Plan":["Planificación"],"CycleAnalyticsStage|Production":["Producción"],"CycleAnalyticsStage|Review":["Revisión"],"CycleAnalyticsStage|Staging":["Puesta en escena"],"CycleAnalyticsStage|Test":["Pruebas"],"Define a custom pattern with cron syntax":["Definir un patrón personalizado con la sintaxis de cron"],"Delete":["Eliminar"],"Deploy":["Despliegue","Despliegues"],"Description":["Descripción"],"Directory name":["Nombre del directorio"],"Don't show again":["No mostrar de nuevo"],"Download":["Descargar"],"Download tar":["Descargar tar"],"Download tar.bz2":["Descargar tar.bz2"],"Download tar.gz":["Descargar tar.gz"],"Download zip":["Descargar zip"],"DownloadArtifacts|Download":["Descargar"],"DownloadCommit|Email Patches":["Parches por correo electrónico"],"DownloadCommit|Plain Diff":["Diferencias en texto plano"],"DownloadSource|Download":["Descargar"],"Edit":["Editar"],"Edit Pipeline Schedule %{id}":["Editar Programación del Pipeline %{id}"],"Every day (at 4:00am)":["Todos los días (a las 4:00 am)"],"Every month (on the 1st at 4:00am)":["Todos los meses (el día 1 a las 4:00 am)"],"Every week (Sundays at 4:00am)":["Todas las semanas (domingos a las 4:00 am)"],"Failed to change the owner":["Error al cambiar el propietario"],"Failed to remove the pipeline schedule":["Error al eliminar la programación del pipeline"],"Files":["Archivos"],"Find by path":["Buscar por ruta"],"Find file":["Buscar archivo"],"FirstPushedBy|First":["Primer"],"FirstPushedBy|pushed by":["enviado por"],"Fork":["Bifurcación","Bifurcaciones"],"ForkedFromProjectPath|Forked from":["Bifurcado de"],"From issue creation until deploy to production":["Desde la creación de la incidencia hasta el despliegue a producción"],"From merge request merge until deploy to production":["Desde la integración de la solicitud de fusión hasta el despliegue a producción"],"Go to your fork":["Ir a tu bifurcación"],"GoToYourFork|Fork":["Bifurcación"],"Home":["Inicio"],"Housekeeping successfully started":["Servicio de limpieza iniciado con éxito"],"Import repository":["Importar repositorio"],"Interval Pattern":["Patrón de intervalo"],"Introducing Cycle Analytics":["Introducción a Cycle Analytics"],"LFSStatus|Disabled":["Deshabilitado"],"LFSStatus|Enabled":["Habilitado"],"Last %d day":["Último %d día","Últimos %d días"],"Last Pipeline":["Último Pipeline"],"Last Update":["Última actualización"],"Last commit":["Último cambio"],"Learn more in the":["Más información en la"],"Learn more in the|pipeline schedules documentation":["documentación sobre la programación de pipelines"],"Leave group":["Abandonar grupo"],"Leave project":["Abandonar proyecto"],"Limited to showing %d event at most":["Limitado a mostrar máximo %d evento","Limitado a mostrar máximo %d eventos"],"Median":["Mediana"],"MissingSSHKeyWarningLink|add an SSH key":["agregar una clave SSH"],"New Issue":["Nueva incidencia","Nuevas incidencias"],"New Pipeline Schedule":["Nueva Programación del Pipeline"],"New branch":["Nueva rama"],"New directory":["Nuevo directorio"],"New file":["Nuevo archivo"],"New issue":["Nueva incidencia"],"New merge request":["Nueva solicitud de fusión"],"New schedule":["Nueva programación"],"New snippet":["Nuevo fragmento de código"],"New tag":["Nueva etiqueta"],"No repository":["No hay repositorio"],"No schedules":["No hay programaciones"],"Not available":["No disponible"],"Not enough data":["No hay suficientes datos"],"Notification events":["Eventos de notificación"],"NotificationEvent|Close issue":["Cerrar incidencia"],"NotificationEvent|Close merge request":["Cerrar solicitud de fusión"],"NotificationEvent|Failed pipeline":["Pipeline fallido"],"NotificationEvent|Merge merge request":["Integrar solicitud de fusión"],"NotificationEvent|New issue":["Nueva incidencia"],"NotificationEvent|New merge request":["Nueva solicitud de fusión"],"NotificationEvent|New note":["Nueva nota"],"NotificationEvent|Reassign issue":["Reasignar incidencia"],"NotificationEvent|Reassign merge request":["Reasignar solicitud de fusión"],"NotificationEvent|Reopen issue":["Reabrir incidencia"],"NotificationEvent|Successful pipeline":["Pipeline exitoso"],"NotificationLevel|Custom":["Personalizado"],"NotificationLevel|Disabled":["Deshabilitado"],"NotificationLevel|Global":["Global"],"NotificationLevel|On mention":["Cuando me mencionan"],"NotificationLevel|Participate":["Participación"],"NotificationLevel|Watch":["Vigilancia"],"OfSearchInADropdown|Filter":["Filtrar"],"OpenedNDaysAgo|Opened":["Abierto"],"Options":["Opciones"],"Owner":["Propietario"],"Pipeline":["Pipeline"],"Pipeline Health":["Estado del Pipeline"],"Pipeline Schedule":["Programación del Pipeline"],"Pipeline Schedules":["Programaciones de los Pipelines"],"PipelineSchedules|Activated":["Activado"],"PipelineSchedules|Active":["Activos"],"PipelineSchedules|All":["Todos"],"PipelineSchedules|Inactive":["Inactivos"],"PipelineSchedules|Next Run":["Próxima Ejecución"],"PipelineSchedules|None":["Ninguno"],"PipelineSchedules|Provide a short description for this pipeline":["Proporcione una breve descripción para este pipeline"],"PipelineSchedules|Take ownership":["Tomar posesión"],"PipelineSchedules|Target":["Destino"],"PipelineSheduleIntervalPattern|Custom":["Personalizado"],"Pipeline|with stage":["con etapa"],"Pipeline|with stages":["con etapas"],"Project '%{project_name}' queued for deletion.":["Proyecto ‘%{project_name}’ en cola para eliminación."],"Project '%{project_name}' was successfully created.":["Proyecto ‘%{project_name}’ fue creado satisfactoriamente."],"Project '%{project_name}' was successfully updated.":["Proyecto ‘%{project_name}’ fue actualizado satisfactoriamente."],"Project '%{project_name}' will be deleted.":["Proyecto ‘%{project_name}’ será eliminado."],"Project access must be granted explicitly to each user.":["El acceso al proyecto debe concederse explícitamente a cada usuario."],"Project export could not be deleted.":["No se pudo eliminar la exportación del proyecto."],"Project export has been deleted.":["La exportación del proyecto ha sido eliminada."],"Project export link has expired. Please generate a new export from your project settings.":["El enlace de exportación del proyecto ha caducado. Por favor, genera una nueva exportación desde la configuración del proyecto."],"Project export started. A download link will be sent by email.":["Se inició la exportación del proyecto. Se enviará un enlace de descarga por correo electrónico."],"Project home":["Inicio del proyecto"],"ProjectFeature|Disabled":["Deshabilitada"],"ProjectFeature|Everyone with access":["Todos con acceso"],"ProjectFeature|Only team members":["Solo miembros del equipo"],"ProjectFileTree|Name":["Nombre"],"ProjectLastActivity|Never":["Nunca"],"ProjectLifecycle|Stage":["Etapa"],"ProjectNetworkGraph|Graph":["Historial gráfico"],"Read more":["Leer más"],"Readme":["Léeme"],"RefSwitcher|Branches":["Ramas"],"RefSwitcher|Tags":["Etiquetas"],"Related Commits":["Cambios Relacionados"],"Related Deployed Jobs":["Trabajos Desplegados Relacionados"],"Related Issues":["Incidencias Relacionadas"],"Related Jobs":["Trabajos Relacionados"],"Related Merge Requests":["Solicitudes de fusión Relacionadas"],"Related Merged Requests":["Solicitudes de fusión Relacionadas"],"Remind later":["Recordar después"],"Remove project":["Eliminar proyecto"],"Request Access":["Solicitar acceso"],"Revert this commit":["Revertir este cambio"],"Revert this merge request":["Revertir esta solicitud de fusión"],"Save pipeline schedule":["Guardar programación del pipeline"],"Schedule a new pipeline":["Programar un nuevo pipeline"],"Scheduling Pipelines":["Programación de Pipelines"],"Search branches and tags":["Buscar ramas y etiquetas"],"Select Archive Format":["Seleccionar formato de archivo"],"Select a timezone":["Selecciona una zona horaria"],"Select target branch":["Selecciona una rama de destino"],"Set a password on your account to pull or push via %{protocol}":["Establezca una contraseña en su cuenta para actualizar o enviar a través de %{protocol}"],"Set up CI":["Configurar CI"],"Set up Koding":["Configurar Koding"],"Set up auto deploy":["Configurar auto despliegue"],"SetPasswordToCloneLink|set a password":["establecer una contraseña"],"Showing %d event":["Mostrando %d evento","Mostrando %d eventos"],"Source code":["Código fuente"],"StarProject|Star":["Destacar"],"Start a %{new_merge_request} with these changes":["Iniciar una %{new_merge_request} con estos cambios"],"Switch branch/tag":["Cambiar rama/etiqueta"],"Tag":["Etiqueta","Etiquetas"],"Tags":["Etiquetas"],"Target Branch":["Rama de destino"],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":["La etapa de desarrollo muestra el tiempo desde el primer cambio hasta la creación de la solicitud de fusión. Los datos serán automáticamente incorporados aquí una vez creada tu primera solicitud de fusión."],"The collection of events added to the data gathered for that stage.":["La colección de eventos agregados a los datos recopilados para esa etapa."],"The fork relationship has been removed.":["La relación con la bifurcación se ha eliminado."],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":["La etapa de incidencia muestra el tiempo que toma desde la creación de un tema hasta asignar el tema a un hito, o añadir el tema a una lista en el panel de temas. Empieza a crear temas para ver los datos de esta etapa."],"The phase of the development lifecycle.":["La etapa del ciclo de vida de desarrollo."],"The pipelines schedule runs pipelines in the future, repeatedly, for specific branches or tags. Those scheduled pipelines will inherit limited project access based on their associated user.":["La programación de pipelines ejecuta pipelines en el futuro, repetidamente, para ramas o etiquetas específicas. Los pipelines programados heredarán acceso limitado al proyecto basado en su usuario asociado."],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":["La etapa de planificación muestra el tiempo desde el paso anterior hasta el envío de tu primera confirmación. Este tiempo se añadirá automáticamente una vez que usted envíe el primer cambio."],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":["La etapa de producción muestra el tiempo total que tarda entre la creación de una incidencia y el despliegue del código a producción. Los datos se añadirán automáticamente una vez haya finalizado por completo el ciclo de idea a producción."],"The project can be accessed by any logged in user.":["El proyecto puede ser accedido por cualquier usuario conectado."],"The project can be accessed without any authentication.":["El proyecto puede accederse sin ninguna autenticación."],"The repository for this project does not exist.":["El repositorio para este proyecto no existe."],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":["La etapa de revisión muestra el tiempo desde la creación de la solicitud de fusión hasta que los cambios se fusionaron. Los datos se añadirán automáticamente después de fusionar su primera solicitud de fusión."],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":["La etapa de puesta en escena muestra el tiempo entre la fusión y el despliegue de código en el entorno de producción. Los datos se añadirán automáticamente una vez que se despliega a producción por primera vez."],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":["La etapa de pruebas muestra el tiempo que GitLab CI toma para ejecutar cada pipeline para la solicitud de fusión relacionada. Los datos se añadirán automáticamente luego de que el primer pipeline termine de ejecutarse."],"The time taken by each data entry gathered by that stage.":["El tiempo utilizado por cada entrada de datos obtenido por esa etapa."],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":["El valor en el punto medio de una serie de valores observados. Por ejemplo, entre 3, 5, 9, la mediana es 5. Entre 3, 5, 7, 8, la mediana es (5 + 7) / 2 = 6."],"This means you can not push code until you create an empty repository or import existing one.":["Esto significa que no puede enviar código hasta que cree un repositorio vacío o importe uno existente."],"Time before an issue gets scheduled":["Tiempo antes de que una incidencia sea programada"],"Time before an issue starts implementation":["Tiempo antes de que empieze la implementación de una incidencia"],"Time between merge request creation and merge/close":["Tiempo entre la creación de la solicitud de fusión y la integración o cierre de ésta"],"Time until first merge request":["Tiempo hasta la primera solicitud de fusión"],"Timeago|%s days ago":["hace %s días"],"Timeago|%s days remaining":["%s días restantes"],"Timeago|%s hours remaining":["%s horas restantes"],"Timeago|%s minutes ago":["hace %s minutos"],"Timeago|%s minutes remaining":["%s minutos restantes"],"Timeago|%s months ago":["hace %s meses"],"Timeago|%s months remaining":["%s meses restantes"],"Timeago|%s seconds remaining":["%s segundos restantes"],"Timeago|%s weeks ago":["hace %s semanas"],"Timeago|%s weeks remaining":["%s semanas restantes"],"Timeago|%s years ago":["hace %s años"],"Timeago|%s years remaining":["%s años restantes"],"Timeago|1 day remaining":["1 día restante"],"Timeago|1 hour remaining":["1 hora restante"],"Timeago|1 minute remaining":["1 minuto restante"],"Timeago|1 month remaining":["1 mes restante"],"Timeago|1 week remaining":["1 semana restante"],"Timeago|1 year remaining":["1 año restante"],"Timeago|Past due":["Atrasado"],"Timeago|a day ago":["hace un día"],"Timeago|a month ago":["hace un mes"],"Timeago|a week ago":["hace una semana"],"Timeago|a while":["hace un momento"],"Timeago|a year ago":["hace un año"],"Timeago|about %s hours ago":["hace alrededor de %s horas"],"Timeago|about a minute ago":["hace alrededor de 1 minuto"],"Timeago|about an hour ago":["hace alrededor de 1 hora"],"Timeago|in %s days":["en %s días"],"Timeago|in %s hours":["en %s horas"],"Timeago|in %s minutes":["en %s minutos"],"Timeago|in %s months":["en %s meses"],"Timeago|in %s seconds":["en %s segundos"],"Timeago|in %s weeks":["en %s semanas"],"Timeago|in %s years":["en %s años"],"Timeago|in 1 day":["en 1 día"],"Timeago|in 1 hour":["en 1 hora"],"Timeago|in 1 minute":["en 1 minuto"],"Timeago|in 1 month":["en 1 mes"],"Timeago|in 1 week":["en 1 semana"],"Timeago|in 1 year":["en 1 año"],"Timeago|less than a minute ago":["hace menos de 1 minuto"],"Time|hr":["hr","hrs"],"Time|min":["min","mins"],"Time|s":["s"],"Total Time":["Tiempo Total"],"Total test time for all commits/merges":["Tiempo total de pruebas para todos los cambios o integraciones"],"Unstar":["No Destacar"],"Upload New File":["Subir nuevo archivo"],"Upload file":["Subir archivo"],"UploadLink|click to upload":["Hacer clic para subir"],"Use your global notification setting":["Utiliza tu configuración de notificación global"],"VisibilityLevel|Internal":["Interno"],"VisibilityLevel|Private":["Privado"],"VisibilityLevel|Public":["Público"],"Want to see the data? Please ask an administrator for access.":["¿Quieres ver los datos? Por favor pide acceso al administrador."],"We don't have enough data to show this stage.":["No hay suficientes datos para mostrar en esta etapa."],"Withdraw Access Request":["Retirar Solicitud de Acceso"],"You are going to remove %{project_name_with_namespace}.\\nRemoved project CANNOT be restored!\\nAre you ABSOLUTELY sure?":["Va a eliminar %{project_name_with_namespace}.\\n¡El proyecto eliminado NO puede ser restaurado!\\n¿Estás TOTALMENTE seguro?"],"You are going to remove the fork relationship to source project %{forked_from_project}. Are you ABSOLUTELY sure?":["Vas a eliminar el enlace de la bifurcación con el proyecto original %{forked_from_project}. ¿Estás TOTALMENTE seguro?"],"You are going to transfer %{project_name_with_namespace} to another owner. Are you ABSOLUTELY sure?":["Vas a transferir %{project_name_with_namespace} a otro propietario. ¿Estás TOTALMENTE seguro?"],"You can only add files when you are on a branch":["Solo puedes agregar archivos cuando estás en una rama"],"You must sign in to star a project":["Debes iniciar sesión para destacar un proyecto"],"You have reached your project limit":[""],"You need permission.":["Necesitas permisos."],"You will not get any notifications via email":["No recibirás ninguna notificación por correo electrónico"],"You will only receive notifications for the events you choose":["Solo recibirás notificaciones de los eventos que elijas"],"You will only receive notifications for threads you have participated in":["Solo recibirás notificaciones de los temas en los que has participado"],"You will receive notifications for any activity":["Recibirás notificaciones por cualquier actividad"],"You will receive notifications only for comments in which you were @mentioned":["Recibirás notificaciones solo para los comentarios en los que se te mencionó"],"You won't be able to pull or push project code via %{protocol} until you %{set_password_link} on your account":["No podrás actualizar o enviar código al proyecto a través de %{protocol} hasta que %{set_password_link} en tu cuenta"],"You won't be able to pull or push project code via SSH until you %{add_ssh_key_link} to your profile":["No podrás actualizar o enviar código al proyecto a través de SSH hasta que %{add_ssh_key_link} en su perfil"],"Your name":["Tu nombre"],"day":["día","días"],"new merge request":["nueva solicitud de fusión"],"notification emails":["correos electrónicos de notificación"],"parent":["padre","padres"]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/locale/fr/app.js b/app/assets/javascripts/locale/fr/app.js
new file mode 100644
index 00000000000..392fcf06416
--- /dev/null
+++ b/app/assets/javascripts/locale/fr/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['fr'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","PO-Revision-Date":"2017-06-14 04:21-0400","Last-Translator":"Dremor <egeorget@opmbx.org>","Language-Team":"French (https://www.transifex.com/gitlab-fr/teams/75145/fr/)","Language":"fr","Plural-Forms":"nplurals=2; plural=(n > 1);","X-Generator":"Zanata 3.9.6","lang":"fr","domain":"app","plural_forms":"nplurals=2; plural=(n > 1);"},"ByAuthor|by":["par"],"Commit":["Validation","Validations"],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":["L’analyseur de cycle permet d’avoir une vue d’ensemble du temps nécessaire pour aller d’une idée à sa mise en production pour votre projet."],"CycleAnalyticsStage|Code":["Code"],"CycleAnalyticsStage|Issue":["Incident"],"CycleAnalyticsStage|Plan":["Planification"],"CycleAnalyticsStage|Production":["Production"],"CycleAnalyticsStage|Review":["Examen"],"CycleAnalyticsStage|Staging":["Pré-production"],"CycleAnalyticsStage|Test":["Test"],"Deploy":["Déploiement","Déploiements"],"FirstPushedBy|First":["En premier"],"FirstPushedBy|pushed by":["poussé par"],"From issue creation until deploy to production":["Depuis la création de l'incident jusqu'au déploiement en production"],"From merge request merge until deploy to production":["Depuis la fusion de la demande de fusion jusqu'au déploiement en production"],"Introducing Cycle Analytics":["Introduction à l'analyseur de cycle"],"Last %d day":["Le dernier %d jour","Les derniers %d jours"],"Limited to showing %d event at most":["Limiter l'affichage au plus à %d évènement","Limiter l'affichage au plus à %d évènements"],"Median":["Médian"],"New Issue":["Nouvel incident","Nouveaux incidents"],"Not available":["Indisponible"],"Not enough data":["Données insuffisantes"],"OpenedNDaysAgo|Opened":["Ouvert"],"Pipeline Health":["Santé du Pipeline"],"ProjectLifecycle|Stage":["Étape"],"Read more":["Lire plus"],"Related Commits":["Validations liés"],"Related Deployed Jobs":["Tâches de déploiement liés"],"Related Issues":["Incidents liés"],"Related Jobs":["Tâches liées"],"Related Merge Requests":["Demandes de fusion liées"],"Related Merged Requests":["Demandes fusionnées liées"],"Showing %d event":["Affichage de %d évènement","Affichage de %d évènements"],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":["L’étape de développement montre le temps entre la première validation et la création de la demande de fusion. Les données seront automatiquement ajoutées ici une fois que vous aurez créé votre première demande de fusion."],"The collection of events added to the data gathered for that stage.":["L’ensemble d’évènements ajoutés aux données récupérées pour cette étape."],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":["L'étape des incidents montre le temps nécessaire entre la création d'un incident et son assignation à un jalon, ou son ajout à une liste d'un tableau d'incident. Débutez à créer des incidents pour voir des données pour cette étape."],"The phase of the development lifecycle.":["Les étapes du cycle de développement."],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":["L’étape de planification montre le temps entre l’étape précédente et l’envoi de votre première validation. Ce temps sera automatiquement ajouté quand vous pousserez votre première validation."],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":["L’étape de mise en production montre le temps nécessaire entre la création d’un incident et le déploiement du code en production. Les données seront automatiquement ajoutées une fois que vous aurez complété le cycle complet, depuis l’idée jusqu’à la mise en production."],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":["L’étape d’évaluation montre le temps entre la création de la demande de fusion et la fusion effective de celle-ci. Ces données seront automatiquement ajoutées après que vous ayez fusionné votre première demande de fusion."],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":["L’étape de pré-production indique le temps entre la fusion de la RF et le déploiement du code dans l’environnent de production. Les données seront automatiquement ajoutées une fois que vous déploierez en production pour la première fois."],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":["L’étape de test montre le temps que le CI de GitLab met pour exécuter chaque pipeline liés à la demande de fusion. Les données seront automatiquement ajoutées après que votre premier pipeline s’achèvera."],"The time taken by each data entry gathered by that stage.":["Le temps pris par chaque entrée récoltée durant cette étape."],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":["La valeur située au point médian d’une série de valeur observée. C.à.d., entre 3, 5, 9, le médian est 5. Entre 3, 5, 7, 8, le médian est (5+7)/2 = 6."],"Time before an issue gets scheduled":["Temps avant qu’un incident ne soit planifié"],"Time before an issue starts implementation":["Temps avant que résolution ne débute"],"Time between merge request creation and merge/close":["Temps entre la création d'une demande de fusion et sa fusion/clôture"],"Time until first merge request":["Temps jusqu’à la première demande de fusion"],"Time|hr":["hr","hrs"],"Time|min":["min","mins"],"Time|s":["s"],"Total Time":["Temps total"],"Total test time for all commits/merges":["Temps total de test pour toutes les validations/fusions"],"Want to see the data? Please ask an administrator for access.":["Vous voulez voir les données ? Merci de contacter un administrateur pour en obtenir l’accès."],"We don't have enough data to show this stage.":["Nous n'avons pas suffisamment de données pour afficher cette étape."],"You need permission.":["Vous avez besoin d’une autorisation."],"day":["jour","jours"]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/locale/pt_BR/app.js b/app/assets/javascripts/locale/pt_BR/app.js
new file mode 100644
index 00000000000..b9791b7a74b
--- /dev/null
+++ b/app/assets/javascripts/locale/pt_BR/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['pt_BR'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","POT-Creation-Date":"2017-05-04 19:24-0500","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","PO-Revision-Date":"2017-06-05 03:29-0400","Last-Translator":"Alexandre Alencar <alexandre.alencar@gmail.com>","Language-Team":"Portuguese (Brazil)","Language":"pt-BR","X-Generator":"Zanata 3.9.6","Plural-Forms":"nplurals=2; plural=(n != 1)","lang":"pt_BR","domain":"app","plural_forms":"nplurals=2; plural=(n != 1)"},"ByAuthor|by":["por"],"Commit":["Commit","Commits"],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":["A Análise de Ciclo fornece uma visão geral de quanto tempo uma ideia demora para ir para produção em seu projeto."],"CycleAnalyticsStage|Code":["Código"],"CycleAnalyticsStage|Issue":["Tarefa"],"CycleAnalyticsStage|Plan":["Plano"],"CycleAnalyticsStage|Production":["Produção"],"CycleAnalyticsStage|Review":["Revisão"],"CycleAnalyticsStage|Staging":["Homologação"],"CycleAnalyticsStage|Test":["Teste"],"Deploy":["Implantação","Implantações"],"FirstPushedBy|First":["Primeiro"],"FirstPushedBy|pushed by":["publicado por"],"From issue creation until deploy to production":["Da criação de tarefas até a implantação para a produção"],"From merge request merge until deploy to production":["Da incorporação do merge request até a implantação em produção"],"Introducing Cycle Analytics":["Apresentando a Análise de Ciclo"],"Last %d day":["Último %d dia","Últimos %d dias"],"Limited to showing %d event at most":["Limitado a mostrar %d evento no máximo","Limitado a mostrar %d eventos no máximo"],"Median":["Mediana"],"New Issue":["Nova Tarefa","Novas Tarefas"],"Not available":["Não disponível"],"Not enough data":["Dados insuficientes"],"OpenedNDaysAgo|Opened":["Aberto"],"Pipeline Health":["Saúde da Pipeline"],"ProjectLifecycle|Stage":["Etapa"],"Read more":["Ler mais"],"Related Commits":["Commits Relacionados"],"Related Deployed Jobs":["Jobs Relacionados Incorporados"],"Related Issues":["Tarefas Relacionadas"],"Related Jobs":["Jobs Relacionados"],"Related Merge Requests":["Merge Requests Relacionados"],"Related Merged Requests":["Merge Requests Relacionados"],"Showing %d event":["Mostrando %d evento","Mostrando %d eventos"],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":["O estágio de codificação mostra o tempo desde o primeiro commit até a criação do merge request. \\nOs dados serão automaticamente adicionados aqui uma vez que você tenha criado seu primeiro merge request."],"The collection of events added to the data gathered for that stage.":["A coleção de eventos adicionados aos dados coletados para esse estágio."],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":["O estágio em questão mostra o tempo que leva desde a criação de uma tarefa até a sua assinatura para um milestone, ou a sua adição para a lista no seu Painel de Tarefas. Comece a criar tarefas para ver dados para esta etapa."],"The phase of the development lifecycle.":["A fase do ciclo de vida do desenvolvimento."],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":["A fase de planejamento mostra o tempo do passo anterior até empurrar o seu primeiro commit. Este tempo será adicionado automaticamente assim que você realizar seu primeiro commit."],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":["O estágio de produção mostra o tempo total que leva entre criar uma tarefa e implantar o código na produção. Os dados serão adicionados automaticamente até que você complete todo o ciclo de produção."],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":["A etapa de revisão mostra o tempo de criação de um merge request até que o merge seja feito. Os dados serão automaticamente adicionados depois que você fizer seu primeiro merge request."],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":["O estágio de estágio mostra o tempo entre a fusão do MR e o código de implantação para o ambiente de produção. Os dados serão automaticamente adicionados depois de implantar na produção pela primeira vez."],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":["A fase de teste mostra o tempo que o GitLab CI leva para executar cada pipeline para o merge request relacionado. Os dados serão automaticamente adicionados após a conclusão do primeiro pipeline."],"The time taken by each data entry gathered by that stage.":["O tempo necessário para cada entrada de dados reunida por essa etapa."],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":["O valor situado no ponto médio de uma série de valores observados. Ex., entre 3, 5, 9, a mediana é 5. Entre 3, 5, 7, 8, a mediana é (5 + 7) / 2 = 6."],"Time before an issue gets scheduled":["Tempo até que uma tarefa seja planejada"],"Time before an issue starts implementation":["Tempo até que uma tarefa comece a ser implementada"],"Time between merge request creation and merge/close":["Tempo entre a criação do merge request e o merge/fechamento"],"Time until first merge request":["Tempo até o primeiro merge request"],"Time|hr":["h","hs"],"Time|min":["min","mins"],"Time|s":["s"],"Total Time":["Tempo Total"],"Total test time for all commits/merges":["Tempo de teste total para todos os commits/merges"],"Want to see the data? Please ask an administrator for access.":["Precisa visualizar os dados? Solicite acesso ao administrador."],"We don't have enough data to show this stage.":["Não temos dados suficientes para mostrar esta fase."],"You have reached your project limit":[""],"You need permission.":["Você precisa de permissão."],"day":["dia","dias"]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/locale/zh_HK/app.js b/app/assets/javascripts/locale/zh_HK/app.js
new file mode 100644
index 00000000000..bb0798bfb62
--- /dev/null
+++ b/app/assets/javascripts/locale/zh_HK/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['zh_HK'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-05-04 19:24-0500","Last-Translator":"HuangTao <htve@outlook.com>, 2017","Language-Team":"Chinese (Hong Kong) (https://www.transifex.com/gitlab-zh/teams/75177/zh_HK/)","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Language":"zh_HK","Plural-Forms":"nplurals=1; plural=0;","lang":"zh_HK","domain":"app","plural_forms":"nplurals=1; plural=0;"},"Are you sure you want to delete this pipeline schedule?":[""],"ByAuthor|by":["作者:"],"Cancel":[""],"Commit":["提交"],"Cron Timezone":[""],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":["週期分析概述了項目從想法到產品實現的各階段所需的時間。"],"CycleAnalyticsStage|Code":["編碼"],"CycleAnalyticsStage|Issue":["議題"],"CycleAnalyticsStage|Plan":["計劃"],"CycleAnalyticsStage|Production":["生產"],"CycleAnalyticsStage|Review":["評審"],"CycleAnalyticsStage|Staging":["預發布"],"CycleAnalyticsStage|Test":["測試"],"Delete":[""],"Deploy":["部署"],"Description":[""],"Edit":[""],"Edit Pipeline Schedule %{id}":[""],"Failed to change the owner":[""],"Failed to remove the pipeline schedule":[""],"Filter":[""],"FirstPushedBy|First":["首次推送"],"FirstPushedBy|pushed by":["推送者:"],"From issue creation until deploy to production":["從創建議題到部署到生產環境"],"From merge request merge until deploy to production":["從合併請求的合併到部署至生產環境"],"Interval Pattern":[""],"Introducing Cycle Analytics":["週期分析簡介"],"Last %d day":["最後 %d 天"],"Last Pipeline":[""],"Limited to showing %d event at most":["最多顯示 %d 個事件"],"Median":["中位數"],"New Issue":["新議題"],"New Pipeline Schedule":[""],"No schedules":[""],"Not available":["不可用"],"Not enough data":["數據不足"],"OpenedNDaysAgo|Opened":["開始於"],"Owner":[""],"Pipeline Health":["流水線健康指標"],"Pipeline Schedule":[""],"Pipeline Schedules":[""],"PipelineSchedules|Activated":[""],"PipelineSchedules|Active":[""],"PipelineSchedules|All":[""],"PipelineSchedules|Inactive":[""],"PipelineSchedules|Next Run":[""],"PipelineSchedules|None":[""],"PipelineSchedules|Provide a short description for this pipeline":[""],"PipelineSchedules|Take ownership":[""],"PipelineSchedules|Target":[""],"ProjectLifecycle|Stage":["項目生命週期"],"Read more":["了解更多"],"Related Commits":["相關的提交"],"Related Deployed Jobs":["相關的部署作業"],"Related Issues":["相關的議題"],"Related Jobs":["相關的作業"],"Related Merge Requests":["相關的合併請求"],"Related Merged Requests":["相關已合併的合並請求"],"Save pipeline schedule":[""],"Schedule a new pipeline":[""],"Select a timezone":[""],"Select target branch":[""],"Showing %d event":["顯示 %d 個事件"],"Target Branch":[""],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":["編碼階段概述了從第一次提交到創建合併請求的時間。創建第壹個合並請求後,數據將自動添加到此處。"],"The collection of events added to the data gathered for that stage.":["與該階段相關的事件。"],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":["議題階段概述了從創建議題到將議題設置裏程碑或將議題添加到議題看板的時間。創建一個議題後,數據將自動添加到此處。"],"The phase of the development lifecycle.":["項目生命週期中的各個階段。"],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":["計劃階段概述了從議題添加到日程後到推送首次提交的時間。當首次推送提交後,數據將自動添加到此處。"],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":["生產階段概述了從創建議題到將代碼部署到生產環境的時間。當完成完整的想法到部署生產,數據將自動添加到此處。"],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":["評審階段概述了從創建合並請求到合併的時間。當創建第壹個合並請求後,數據將自動添加到此處。"],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":["預發布階段概述了合並請求的合併到部署代碼到生產環境的總時間。當首次部署到生產環境後,數據將自動添加到此處。"],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":["測試階段概述了GitLab CI為相關合併請求運行每個流水線所需的時間。當第壹個流水線運行完成後,數據將自動添加到此處。"],"The time taken by each data entry gathered by that stage.":["該階段每條數據所花的時間"],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":["中位數是一個數列中最中間的值。例如在 3、5、9 之間,中位數是 5。在 3、5、7、8 之間,中位數是 (5 + 7)/ 2 = 6。"],"Time before an issue gets scheduled":["議題被列入日程表的時間"],"Time before an issue starts implementation":["開始進行編碼前的時間"],"Time between merge request creation and merge/close":["從創建合併請求到被合並或關閉的時間"],"Time until first merge request":["創建第壹個合併請求之前的時間"],"Time|hr":["小時"],"Time|min":["分鐘"],"Time|s":["秒"],"Total Time":["總時間"],"Total test time for all commits/merges":["所有提交和合併的總測試時間"],"Want to see the data? Please ask an administrator for access.":["權限不足。如需查看相關數據,請向管理員申請權限。"],"We don't have enough data to show this stage.":["該階段的數據不足,無法顯示。"],"You have reached your project limit":[""],"You need permission.":["您需要相關的權限。"],"day":["天"]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/locale/zh_TW/app.js b/app/assets/javascripts/locale/zh_TW/app.js
new file mode 100644
index 00000000000..b65e0cd1c92
--- /dev/null
+++ b/app/assets/javascripts/locale/zh_TW/app.js
@@ -0,0 +1 @@
+var locales = locales || {}; locales['zh_TW'] = {"domain":"app","locale_data":{"app":{"":{"Project-Id-Version":"gitlab 1.0.0","Report-Msgid-Bugs-To":"","PO-Revision-Date":"2017-05-04 19:24-0500","Last-Translator":"HuangTao <htve@outlook.com>, 2017","Language-Team":"Chinese (Taiwan) (https://www.transifex.com/gitlab-zh/teams/75177/zh_TW/)","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Language":"zh_TW","Plural-Forms":"nplurals=1; plural=0;","lang":"zh_TW","domain":"app","plural_forms":"nplurals=1; plural=0;"},"Are you sure you want to delete this pipeline schedule?":[""],"ByAuthor|by":["作者:"],"Cancel":[""],"Commit":["送交"],"Cron Timezone":[""],"Cycle Analytics gives an overview of how much time it takes to go from idea to production in your project.":["週期分析概述了你的專案從想法到產品實現,各階段所需的時間。"],"CycleAnalyticsStage|Code":["程式開發"],"CycleAnalyticsStage|Issue":["議題"],"CycleAnalyticsStage|Plan":["計劃"],"CycleAnalyticsStage|Production":["上線"],"CycleAnalyticsStage|Review":["複閱"],"CycleAnalyticsStage|Staging":["預備"],"CycleAnalyticsStage|Test":["測試"],"Delete":[""],"Deploy":["部署"],"Description":[""],"Edit":[""],"Edit Pipeline Schedule %{id}":[""],"Failed to change the owner":[""],"Failed to remove the pipeline schedule":[""],"Filter":[""],"FirstPushedBy|First":["首次推送"],"FirstPushedBy|pushed by":["推送者:"],"From issue creation until deploy to production":["從議題建立至線上部署"],"From merge request merge until deploy to production":["從請求被合併後至線上部署"],"Interval Pattern":[""],"Introducing Cycle Analytics":["週期分析簡介"],"Last %d day":["最後 %d 天"],"Last Pipeline":[""],"Limited to showing %d event at most":["最多顯示 %d 個事件"],"Median":["中位數"],"New Issue":["新議題"],"New Pipeline Schedule":[""],"No schedules":[""],"Not available":["無法使用"],"Not enough data":["資料不足"],"OpenedNDaysAgo|Opened":["開始於"],"Owner":[""],"Pipeline Health":["流水線健康指標"],"Pipeline Schedule":[""],"Pipeline Schedules":[""],"PipelineSchedules|Activated":[""],"PipelineSchedules|Active":[""],"PipelineSchedules|All":[""],"PipelineSchedules|Inactive":[""],"PipelineSchedules|Next Run":[""],"PipelineSchedules|None":[""],"PipelineSchedules|Provide a short description for this pipeline":[""],"PipelineSchedules|Take ownership":[""],"PipelineSchedules|Target":[""],"ProjectLifecycle|Stage":["專案生命週期"],"Read more":["了解更多"],"Related Commits":["相關的送交"],"Related Deployed Jobs":["相關的部署作業"],"Related Issues":["相關的議題"],"Related Jobs":["相關的作業"],"Related Merge Requests":["相關的合併請求"],"Related Merged Requests":["相關已合併的請求"],"Save pipeline schedule":[""],"Schedule a new pipeline":[""],"Select a timezone":[""],"Select target branch":[""],"Showing %d event":["顯示 %d 個事件"],"Target Branch":[""],"The coding stage shows the time from the first commit to creating the merge request. The data will automatically be added here once you create your first merge request.":["程式開發階段顯示從第一次送交到建立合併請求的時間。建立第一個合併請求後,資料將自動填入。"],"The collection of events added to the data gathered for that stage.":["與該階段相關的事件。"],"The issue stage shows the time it takes from creating an issue to assigning the issue to a milestone, or add the issue to a list on your Issue Board. Begin creating issues to see data for this stage.":["議題階段顯示從議題建立到設置里程碑、或將該議題加至議題看板的時間。建立第一個議題後,資料將自動填入。"],"The phase of the development lifecycle.":["專案開發生命週期的各個階段。"],"The planning stage shows the time from the previous step to pushing your first commit. This time will be added automatically once you push your first commit.":["計劃階段所顯示的是議題被排程後至第一個送交被推送的時間。一旦完成(或執行)首次的推送,資料將自動填入。"],"The production stage shows the total time it takes between creating an issue and deploying the code to production. The data will be automatically added once you have completed the full idea to production cycle.":["上線階段顯示從建立一個議題到部署程式至線上的總時間。當完成從想法到產品實現的循環後,資料將自動填入。"],"The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request.":["複閱階段顯示從合併請求建立後至被合併的時間。當建立第一個合併請求後,資料將自動填入。"],"The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time.":["預備階段顯示從合併請求被合併後至部署上線的時間。當第一次部署上線後,資料將自動填入。"],"The testing stage shows the time GitLab CI takes to run every pipeline for the related merge request. The data will automatically be added after your first pipeline finishes running.":["測試階段顯示相關合併請求的流水線所花的時間。當第一個流水線運作完畢後,資料將自動填入。"],"The time taken by each data entry gathered by that stage.":["每筆該階段相關資料所花的時間。"],"The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.":["中位數是一個數列中最中間的值。例如在 3、5、9 之間,中位數是 5。在 3、5、7、8 之間,中位數是 (5 + 7)/ 2 = 6。"],"Time before an issue gets scheduled":["議題等待排程的時間"],"Time before an issue starts implementation":["議題等待開始實作的時間"],"Time between merge request creation and merge/close":["合併請求被合併或是關閉的時間"],"Time until first merge request":["第一個合併請求被建立前的時間"],"Time|hr":["小時"],"Time|min":["分鐘"],"Time|s":["秒"],"Total Time":["總時間"],"Total test time for all commits/merges":["所有送交和合併的總測試時間"],"Want to see the data? Please ask an administrator for access.":["權限不足。如需查看相關資料,請向管理員申請權限。"],"We don't have enough data to show this stage.":["因該階段的資料不足而無法顯示相關資訊"],"You have reached your project limit":[""],"You need permission.":["您需要相關的權限。"],"day":["天"]}}}; \ No newline at end of file
diff --git a/app/assets/javascripts/repo/index.js b/app/assets/javascripts/repo/index.js
new file mode 100644
index 00000000000..1a16b153183
--- /dev/null
+++ b/app/assets/javascripts/repo/index.js
@@ -0,0 +1,58 @@
+/* global monaco */
+import $ from 'jquery';
+import Vue from 'vue';
+import RepoSidebar from './repo_sidebar.vue';
+import EditButton from './repo_edit_button';
+import Service from './repo_service';
+import Store from './repo_store';
+import RepoCommitSection from './repo_commit_section.vue';
+import RepoTabs from './repo_tabs.vue';
+import RepoFileButtons from './repo_file_buttons.vue';
+import RepoBinaryViewer from './repo_binary_viewer.vue';
+import { repoEditorLoader } from './repo_editor';
+import RepoMiniMixin from './repo_mini_mixin';
+
+function initRepo() {
+ const repo = document.getElementById('repo');
+
+ Store.service = Service;
+ Store.service.url = repo.dataset.url;
+ Store.service.refsUrl = repo.dataset.refsUrl;
+ Store.projectId = repo.dataset.projectId;
+ Store.projectName = repo.dataset.projectName;
+ Store.projectUrl = repo.dataset.projectUrl;
+ Store.currentBranch = $('button.dropdown-menu-toggle').attr('data-ref');
+ Store.checkIsCommitable();
+
+ this.vm = new Vue({
+ el: repo,
+ data: () => Store,
+ template: `
+ <div class="tree-content-holder">
+ <repo-sidebar/><div class="panel-right" :class="{'edit-mode': editMode}">
+ <repo-tabs/>
+ <repo-file-buttons/>
+ <repo-editor/>
+ <repo-binary-viewer/>
+ </div>
+ <repo-commit-section/>
+ </div>
+ `,
+ mixins: [RepoMiniMixin],
+ components: {
+ 'repo-sidebar': RepoSidebar,
+ 'repo-tabs': RepoTabs,
+ 'repo-file-buttons': RepoFileButtons,
+ 'repo-binary-viewer': RepoBinaryViewer,
+ 'repo-editor': repoEditorLoader,
+ 'repo-commit-section': RepoCommitSection,
+ },
+ });
+
+ const editButton = document.getElementById('editable-mode');
+ Store.editButton = new EditButton(editButton);
+}
+
+$(initRepo);
+
+export default initRepo;
diff --git a/app/assets/javascripts/repo/monaco_loader.js b/app/assets/javascripts/repo/monaco_loader.js
new file mode 100644
index 00000000000..ad1370a7730
--- /dev/null
+++ b/app/assets/javascripts/repo/monaco_loader.js
@@ -0,0 +1,13 @@
+/* eslint-disable no-underscore-dangle, camelcase */
+/* global __webpack_public_path__ */
+
+import monacoContext from 'monaco-editor/dev/vs/loader';
+
+monacoContext.require.config({
+ paths: {
+ vs: `${__webpack_public_path__}monaco-editor/vs`,
+ },
+});
+
+window.__monaco_context__ = monacoContext;
+export default monacoContext.require;
diff --git a/app/assets/javascripts/repo/repo_binary_viewer.vue b/app/assets/javascripts/repo/repo_binary_viewer.vue
new file mode 100644
index 00000000000..cb4ae0fd6b0
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_binary_viewer.vue
@@ -0,0 +1,58 @@
+<script>
+import Store from './repo_store';
+import RepoHelper from './repo_helper';
+
+const RepoBinaryViewer = {
+ data: () => Store,
+
+ computed: {
+ pngBlobWithDataURI() {
+ return `data:image/png;base64,${this.blobRaw}`;
+ },
+ },
+
+ methods: {
+ errored() {
+ Store.binaryLoaded = false;
+ },
+
+ loaded() {
+ Store.binaryLoaded = true;
+ },
+
+ isMarkdown() {
+ return this.activeFile.extension === 'md';
+ },
+ },
+
+ watch: {
+ blobRaw() {
+ if (this.isMarkdown()) {
+ this.binaryTypes.markdown = true;
+ this.activeFile.raw = false;
+ // counts as binaryish so we use the binary viewer in this case.
+ this.binary = true;
+ return;
+ }
+ if (!this.binary) return;
+ switch (this.binaryMimeType) {
+ case 'image/png':
+ this.binaryTypes.png = true;
+ break;
+ default:
+ RepoHelper.loadingError();
+ break;
+ }
+ },
+ },
+};
+
+export default RepoBinaryViewer;
+</script>
+
+<template>
+<div id="binary-viewer" v-if="binary && !activeFile.raw">
+ <img v-show="binaryTypes.png && binaryLoaded" @error="errored" @load="loaded" :src="pngBlobWithDataURI" :alt="activeFile.name"/>
+ <div v-if="binaryTypes.markdown" v-html="activeFile.html"></div>
+</div>
+</template>
diff --git a/app/assets/javascripts/repo/repo_commit_section.vue b/app/assets/javascripts/repo/repo_commit_section.vue
new file mode 100644
index 00000000000..27f1723230e
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_commit_section.vue
@@ -0,0 +1,118 @@
+<script>
+/* global Flash */
+import Store from './repo_store';
+import Api from '../api';
+
+const RepoCommitSection = {
+ data: () => Store,
+
+ methods: {
+ makeCommit() {
+ // see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
+ const branch = $('button.dropdown-menu-toggle').attr('data-ref');
+ const commitMessage = this.commitMessage;
+ const actions = this.changedFiles.map((f) => {
+ const filePath = f.url.split(branch)[1];
+ return {
+ action: 'update',
+ file_path: filePath,
+ content: f.newContent,
+ };
+ });
+ const payload = {
+ branch,
+ commit_message: commitMessage,
+ actions,
+ };
+ Store.submitCommitsLoading = true;
+ Api.commitMultiple(Store.projectId, payload, (data) => {
+ Store.submitCommitsLoading = false;
+ Flash(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice');
+ this.changedFiles = [];
+ this.openedFiles = [];
+ this.commitMessage = '';
+ this.editMode = false;
+ $('html, body').animate({ scrollTop: 0 }, 'fast');
+ });
+ },
+ },
+
+ computed: {
+ changedFiles() {
+ const changedFileList = this.openedFiles
+ .filter(file => file.changed);
+ return changedFileList;
+ },
+ },
+};
+
+export default RepoCommitSection;
+</script>
+
+<template>
+<div id="commit-area" v-if="isCommitable && changedFiles.length" >
+ <form class="form-horizontal">
+ <fieldset>
+ <div class="form-group">
+ <label class="col-md-4 control-label staged-files">Staged files ({{changedFiles.length}})</label>
+ <div class="col-md-4">
+ <ul class="list-unstyled changed-files">
+ <li v-for="file in changedFiles" :key="file.id">
+ <span class="help-block">{{file.url}}</span>
+ </li>
+ </ul>
+ </div>
+ </div>
+ <!-- Textarea
+ -->
+ <div class="form-group">
+ <label class="col-md-4 control-label" for="commit-message">Commit message</label>
+ <div class="col-md-4">
+ <textarea class="form-control" id="commit-message" name="commit-message" v-model="commitMessage"></textarea>
+ </div>
+ </div>
+ <!-- Button Drop Down
+ -->
+ <div class="form-group">
+ <label class="col-md-4 control-label" for="target-branch">Target branch</label>
+ <div class="col-md-4">
+ <div class="input-group">
+ <div class="input-group-btn branch-dropdown">
+ <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">
+ Action
+ <i class="fa fa-caret-down"></i>
+ </button>
+ <ul class="dropdown-menu pull-right">
+ <li>
+ <a href="#">Target branch</a>
+ </li>
+ <li>
+ <a href="#">Create my own branch</a>
+ </li>
+ </ul>
+ </div>
+ <input class="form-control" id="target-branch" name="target-branch" placeholder="placeholder" type="text"></input>
+ </div>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-md-4 control-label" for="checkboxes"></label>
+ <div class="col-md-4">
+ <div class="checkbox new-merge-request">
+ <label for="checkboxes-0">
+ <input id="checkboxes-0" name="checkboxes" type="checkbox" value="1"></input>
+ Start a new merge request with these changes
+ </label>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-offset-4 col-md-4">
+ <button type="submit" :disabled="!commitMessage || submitCommitsLoading" class="btn btn-success submit-commit" @click.prevent="makeCommit">
+ <i class="fa fa-spinner fa-spin" v-if="submitCommitsLoading"></i>
+ <span class="commit-summary">Commit {{changedFiles.length}} Files</span>
+ </button>
+ </div>
+ </fieldset>
+ </form>
+</div>
+</template>
diff --git a/app/assets/javascripts/repo/repo_edit_button.js b/app/assets/javascripts/repo/repo_edit_button.js
new file mode 100644
index 00000000000..e01dcc58802
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_edit_button.js
@@ -0,0 +1,29 @@
+import Vue from 'vue';
+import Store from './repo_store';
+
+export default class RepoEditButton {
+ constructor(el) {
+ this.initVue(el);
+ }
+
+ initVue(el) {
+ this.vue = new Vue({
+ el,
+ data: () => Store,
+ computed: {
+ buttonLabel() {
+ return this.editMode ? 'Read-only mode' : 'Edit mode';
+ },
+
+ buttonIcon() {
+ return this.editMode ? [] : ['fa', 'fa-pencil'];
+ },
+ },
+ methods: {
+ editClicked() {
+ this.editMode = !this.editMode;
+ },
+ },
+ });
+ }
+}
diff --git a/app/assets/javascripts/repo/repo_editor.js b/app/assets/javascripts/repo/repo_editor.js
new file mode 100644
index 00000000000..0dee33b141f
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_editor.js
@@ -0,0 +1,122 @@
+/* global monaco */
+import Store from './repo_store';
+import Helper from './repo_helper';
+import monacoLoader from './monaco_loader';
+
+const RepoEditor = {
+ data: () => Store,
+
+ template: '<div id="ide"></div>',
+
+ mounted() {
+ const monacoInstance = this.monaco.editor.create(this.$el, {
+ model: null,
+ readOnly: true,
+ contextmenu: false,
+ });
+
+ Store.monacoInstance = monacoInstance;
+
+ this.addMonacoEvents();
+
+ Helper.getContent().then(() => {
+ this.showHide();
+
+ if (this.blobRaw === '') return;
+
+ const newModel = this.monaco.editor.createModel(this.blobRaw, 'plaintext');
+
+ this.monacoInstance.setModel(newModel);
+ }).catch(Helper.loadingError);
+ },
+
+ methods: {
+ showHide() {
+ if (!this.openedFiles.length || (this.binary && !this.activeFile.raw)) {
+ this.$el.style.display = 'none';
+ } else {
+ this.$el.style.display = 'inline-block';
+ }
+ },
+
+ addMonacoEvents() {
+ this.monacoInstance.onMouseUp(this.onMonacoEditorMouseUp);
+ this.monacoInstance.onKeyUp(this.onMonacoEditorKeysPressed.bind(this));
+ },
+
+ onMonacoEditorKeysPressed() {
+ Store.setActiveFileContents(this.monacoInstance.getValue());
+ },
+
+ onMonacoEditorMouseUp(e) {
+ if (e.target.element.className === 'line-numbers') {
+ location.hash = `L${e.target.position.lineNumber}`;
+ Store.activeLine = e.target.position.lineNumber;
+ }
+ },
+ },
+
+ watch: {
+ activeLine() {
+ this.monacoInstance.setPosition({
+ lineNumber: this.activeLine,
+ column: 1,
+ });
+ },
+
+ editMode() {
+ const readOnly = !this.editMode;
+
+ Store.readOnly = readOnly;
+
+ this.monacoInstance.updateOptions({
+ readOnly,
+ });
+ },
+
+ activeFileLabel() {
+ this.showHide();
+ },
+
+ isTree() {
+ this.showHide();
+ },
+
+ openedFiles() {
+ this.showHide();
+ },
+
+ binary() {
+ this.showHide();
+ },
+
+ blobRaw() {
+ this.showHide();
+
+ if (this.isTree) return;
+
+ this.monacoInstance.setModel(null);
+
+ const languages = this.monaco.languages.getLanguages();
+ const languageID = Helper.getLanguageIDForFile(this.activeFile, languages);
+ const newModel = this.monaco.editor.createModel(this.blobRaw, languageID);
+
+ this.monacoInstance.setModel(newModel);
+ },
+ },
+};
+
+function repoEditorLoader() {
+ return new Promise((resolve) => {
+ monacoLoader(['vs/editor/editor.main'], () => {
+ Store.monaco = monaco;
+
+ resolve(RepoEditor);
+ });
+ });
+}
+
+export {
+ RepoEditor as default,
+ repoEditorLoader,
+};
diff --git a/app/assets/javascripts/repo/repo_file.vue b/app/assets/javascripts/repo/repo_file.vue
new file mode 100644
index 00000000000..0a21538b521
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_file.vue
@@ -0,0 +1,58 @@
+<script>
+import TimeAgoMixin from '../vue_shared/mixins/timeago';
+
+const RepoFile = {
+ mixins: [TimeAgoMixin],
+ props: {
+ file: {
+ type: Object,
+ required: true,
+ },
+ isMini: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ loading: {
+ type: Object,
+ required: false,
+ default() { return { tree: false }; },
+ },
+ hasFiles: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ activeFile: {
+ type: Object,
+ required: true,
+ },
+ },
+
+ methods: {
+ linkClicked(file) {
+ this.$emit('linkclicked', file);
+ },
+ },
+};
+
+export default RepoFile;
+</script>
+
+<template>
+<tr class="file" v-if="!loading.tree || hasFiles" :class="{'active': activeFile.url === file.url}">
+ <td @click.prevent="linkClicked(file)">
+ <i class="fa" v-if="!file.loading" :class="file.icon" :style="{'margin-left': file.level * 10 + 'px'}"></i>
+ <i class="fa fa-spinner fa-spin" v-if="file.loading" :style="{'margin-left': file.level * 10 + 'px'}"></i>
+ <a :href="file.url" class="repo-file-name" :title="file.url">{{file.name}}</a>
+ </td>
+
+ <td v-if="!isMini" class="hidden-sm hidden-xs">
+ <div class="commit-message">{{file.lastCommitMessage}}</div>
+ </td>
+
+ <td v-if="!isMini" class="hidden-xs">
+ <span class="commit-update">{{timeFormated(file.lastCommitUpdate)}}</span>
+ </td>
+</tr>
+</template>
diff --git a/app/assets/javascripts/repo/repo_file_buttons.vue b/app/assets/javascripts/repo/repo_file_buttons.vue
new file mode 100644
index 00000000000..c10bffdbac6
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_file_buttons.vue
@@ -0,0 +1,54 @@
+<script>
+import Store from './repo_store';
+import Helper from './repo_helper';
+import RepoMiniMixin from './repo_mini_mixin';
+
+const RepoFileButtons = {
+ data: () => Store,
+
+ mixins: [RepoMiniMixin],
+
+ computed: {
+ editableBorder() {
+ return this.editMode ? '1px solid rgb(31, 120, 209)' : '1px solid rgb(240,240,240)';
+ },
+
+ canPreview() {
+ return this.activeFile.extension === 'md';
+ },
+
+ rawFileURL() {
+ return Helper.getRawURLFromBlobURL(this.activeFile.url);
+ },
+
+ blameFileURL() {
+ return Helper.getBlameURLFromBlobURL(this.activeFile.url);
+ },
+
+ historyFileURL() {
+ return Helper.getHistoryURLFromBlobURL(this.activeFile.url);
+ },
+ },
+
+ methods: {
+ rawPreviewToggle: Store.toggleRawPreview,
+ },
+};
+
+export default RepoFileButtons;
+</script>
+
+<template>
+<div id="repo-file-buttons" v-if="isMini" :style="{'border-bottom': editableBorder}">
+ <a :href="rawFileURL" target="_blank" class="btn btn-default raw">Raw</a>
+
+ <div class="btn-group" role="group" aria-label="File actions">
+ <a :href="blameFileURL" class="btn btn-default blame">Blame</a>
+ <a :href="historyFileURL" class="btn btn-default history">History</a>
+ <a href="#" class="btn btn-default permalink">Permalink</a>
+ <a href="#" class="btn btn-default lock">Lock</a>
+ </div>
+
+ <a href="#" v-if="canPreview" @click.prevent="rawPreviewToggle" class="btn btn-default preview">{{activeFileLabel}}</a>
+</div>
+</template>
diff --git a/app/assets/javascripts/repo/repo_file_options.vue b/app/assets/javascripts/repo/repo_file_options.vue
new file mode 100644
index 00000000000..322f4c23dd8
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_file_options.vue
@@ -0,0 +1,39 @@
+<script>
+const RepoFileOptions = {
+ props: {
+ isMini: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ projectName: {
+ type: String,
+ required: true,
+ },
+ },
+};
+
+export default RepoFileOptions;
+</script>
+
+<template>
+<tr v-if="isMini" class="repo-file-options">
+ <td>
+ <span class="title">{{projectName}}</span>
+
+ <ul>
+ <li>
+ <a href="#" title="New File">
+ <i class="fa fa-file-o"></i>
+ </a>
+ </li>
+
+ <li>
+ <a href="#" title="New Folder">
+ <i class="fa fa-folder-o"></i>
+ </a>
+ </li>
+ </ul>
+ </td>
+ </tr>
+</template>
diff --git a/app/assets/javascripts/repo/repo_helper.js b/app/assets/javascripts/repo/repo_helper.js
new file mode 100644
index 00000000000..ff83caa58a1
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_helper.js
@@ -0,0 +1,276 @@
+/* global Flash */
+import Service from './repo_service';
+import Store from './repo_store';
+import '../flash';
+
+const RepoHelper = {
+ getDefaultActiveFile() {
+ return {
+ active: true,
+ binary: false,
+ extension: '',
+ html: '',
+ mime_type: '',
+ name: 'loading...',
+ plain: '',
+ size: 0,
+ url: '',
+ raw: false,
+ newContent: '',
+ changed: false,
+ loading: false,
+ };
+ },
+
+ key: '',
+
+ isTree(data) {
+ return Object.hasOwnProperty.call(data, 'blobs');
+ },
+
+ Time: window.performance
+ && window.performance.now
+ ? window.performance
+ : Date,
+
+ getLanguageIDForFile(file, langs) {
+ const ext = file.name.split('.').pop();
+ const foundLang = RepoHelper.findLanguage(ext, langs);
+
+ return foundLang ? foundLang.id : 'plaintext';
+ },
+
+ findLanguage(ext, langs) {
+ return langs.find(lang => lang.extensions && lang.extensions.indexOf(`.${ext}`) > -1);
+ },
+
+ setDirectoryOpen(tree) {
+ const file = tree;
+ if (!file) return undefined;
+
+ file.opened = true;
+ file.icon = 'fa-folder-open';
+ return file;
+ },
+
+ getRawURLFromBlobURL(url) {
+ return url.replace('blob', 'raw');
+ },
+
+ getBlameURLFromBlobURL(url) {
+ return url.replace('blob', 'blame');
+ },
+
+ getHistoryURLFromBlobURL(url) {
+ return url.replace('blob', 'commits');
+ },
+
+ setBinaryDataAsBase64(url, file) {
+ Service.getBase64Content(url)
+ .then((response) => {
+ Store.blobRaw = response;
+ file.base64 = response; // eslint-disable-line no-param-reassign
+ })
+ .catch(RepoHelper.loadingError);
+ },
+
+ toggleFakeTab(loading, file) {
+ if (loading) return Store.addPlaceholderFile();
+ return Store.removeFromOpenedFiles(file);
+ },
+
+ setLoading(loading, file) {
+ if (Service.url.indexOf('blob') > -1) {
+ Store.loading.blob = loading;
+ return RepoHelper.toggleFakeTab(loading, file);
+ }
+
+ if (Service.url.indexOf('tree') > -1) Store.loading.tree = loading;
+
+ return undefined;
+ },
+
+ getNewMergedList(inDirectory, currentList, newList) {
+ const newListSorted = newList.sort(this.compareFilesCaseInsensitive);
+ if (!inDirectory) return newListSorted;
+ const indexOfFile = currentList.findIndex(file => file.url === inDirectory.url);
+ if (!indexOfFile) return newListSorted;
+ return RepoHelper.mergeNewListToOldList(newListSorted, currentList, inDirectory, indexOfFile);
+ },
+
+ mergeNewListToOldList(newList, oldList, inDirectory, indexOfFile) {
+ newList.reverse().forEach((newFile) => {
+ const fileIndex = indexOfFile + 1;
+ const file = newFile;
+ file.level = inDirectory.level + 1;
+ oldList.splice(fileIndex, 0, file);
+ });
+
+ return oldList;
+ },
+
+ compareFilesCaseInsensitive(a, b) {
+ const aName = a.name.toLowerCase();
+ const bName = b.name.toLowerCase();
+ if (a.level > 0) return 0;
+ if (aName < bName) { return -1; }
+ if (aName > bName) { return 1; }
+ return 0;
+ },
+
+ isRoot(url) {
+ // the url we are requesting -> split by the project URL. Grab the right side.
+ const isRoot = !!url.split(Store.projectUrl)[1]
+ // remove the first "/"
+ .slice(1)
+ // split this by "/"
+ .split('/')
+ // remove the first two items of the array... usually /tree/master.
+ .slice(2)
+ // we want to know the length of the array.
+ // If greater than 0 not root.
+ .length;
+ return isRoot;
+ },
+
+ getContent(treeOrFile, cb) {
+ let file = treeOrFile;
+ // const loadingData = RepoHelper.setLoading(true);
+ return Service.getContent()
+ .then((response) => {
+ const data = response.data;
+ // RepoHelper.setLoading(false, loadingData);
+ if (cb) cb();
+ Store.isTree = RepoHelper.isTree(data);
+ if (!Store.isTree) {
+ if (!file) file = data;
+ Store.binary = data.binary;
+
+ if (data.binary) {
+ Store.binaryMimeType = data.mime_type;
+ // file might be undefined
+ const rawUrl = RepoHelper.getRawURLFromBlobURL(file.url || Service.url);
+ RepoHelper.setBinaryDataAsBase64(rawUrl, data);
+ data.binary = true;
+ } else {
+ Store.blobRaw = data.plain;
+ data.binary = false;
+ }
+
+ if (!file.url) file.url = location.pathname;
+
+ data.url = file.url;
+ data.newContent = '';
+
+ Store.addToOpenedFiles(data);
+ Store.setActiveFiles(data);
+
+ // if the file tree is empty
+ if (Store.files.length === 0) {
+ const parentURL = Service.blobURLtoParentTree(Service.url);
+ Service.url = parentURL;
+ RepoHelper.getContent();
+ }
+ } else {
+ // it's a tree
+ if (!file) Store.isRoot = RepoHelper.isRoot(Service.url);
+ file = RepoHelper.setDirectoryOpen(file);
+ const newDirectory = RepoHelper.dataToListOfFiles(data);
+ Store.addFilesToDirectory(file, Store.files, newDirectory);
+ Store.prevURL = Service.blobURLtoParentTree(Service.url);
+ }
+ })
+ .catch(() => {
+ // RepoHelper.setLoading(false, loadingData);
+ RepoHelper.loadingError();
+ });
+ },
+
+ toFA(icon) {
+ return `fa-${icon}`;
+ },
+
+ serializeBlob(blob) {
+ const simpleBlob = RepoHelper.serializeRepoEntity('blob', blob);
+ simpleBlob.lastCommitMessage = blob.last_commit.message;
+ simpleBlob.lastCommitUpdate = blob.last_commit.committed_date;
+ simpleBlob.loading = false;
+
+ return simpleBlob;
+ },
+
+ serializeTree(tree) {
+ return RepoHelper.serializeRepoEntity('tree', tree);
+ },
+
+ serializeSubmodule(submodule) {
+ return RepoHelper.serializeRepoEntity('submodule', submodule);
+ },
+
+ serializeRepoEntity(type, entity) {
+ const { url, name, icon } = entity;
+
+ return {
+ type,
+ name,
+ url,
+ icon: RepoHelper.toFA(icon),
+ level: 0,
+ loading: false,
+ };
+ },
+
+ scrollTabsRight() {
+ // wait for the transition. 0.1 seconds.
+ setTimeout(() => {
+ const tabs = document.getElementById('tabs');
+ if (!tabs) return;
+ tabs.scrollLeft = 12000;
+ }, 200);
+ },
+
+ dataToListOfFiles(data) {
+ const a = [];
+
+ // push in blobs
+ data.blobs.forEach((blob) => {
+ a.push(RepoHelper.serializeBlob(blob));
+ });
+
+ data.trees.forEach((tree) => {
+ a.push(RepoHelper.serializeTree(tree));
+ });
+
+ data.submodules.forEach((submodule) => {
+ a.push(RepoHelper.serializeSubmodule(submodule));
+ });
+
+ return a;
+ },
+
+ genKey() {
+ return RepoHelper.Time.now().toFixed(3);
+ },
+
+ getStateKey() {
+ return RepoHelper.key;
+ },
+
+ setStateKey(key) {
+ RepoHelper.key = key;
+ },
+
+ toURL(url) {
+ const history = window.history;
+
+ RepoHelper.key = RepoHelper.genKey();
+
+ history.pushState({ key: RepoHelper.key }, '', url);
+ },
+
+ loadingError() {
+ Flash('Unable to load the file at this time.');
+ },
+};
+
+export default RepoHelper;
diff --git a/app/assets/javascripts/repo/repo_loading_file.vue b/app/assets/javascripts/repo/repo_loading_file.vue
new file mode 100644
index 00000000000..c2d38ee50dc
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_loading_file.vue
@@ -0,0 +1,51 @@
+<script>
+const RepoLoadingFile = {
+ props: {
+ loading: {
+ type: Object,
+ required: false,
+ default: {},
+ },
+ hasFiles: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ isMini: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ },
+
+ methods: {
+ lineOfCode(n) {
+ return `line-of-code-${n}`;
+ },
+ },
+};
+
+export default RepoLoadingFile;
+</script>
+
+<template>
+<tr v-if="loading.tree && !hasFiles" class="loading-file">
+ <td>
+ <div class="animation-container animation-container-small">
+ <div v-for="n in 6" :class="lineOfCode(n)"></div>
+ </div>
+ </td>
+
+ <td v-if="!isMini" class="hidden-sm hidden-xs">
+ <div class="animation-container">
+ <div v-for="n in 6" :class="lineOfCode(n)"></div>
+ </div>
+ </td>
+
+ <td v-if="!isMini" class="hidden-xs">
+ <div class="animation-container animation-container-small">
+ <div v-for="n in 6" :class="lineOfCode(n)"></div>
+ </div>
+ </td>
+</tr>
+</template>
diff --git a/app/assets/javascripts/repo/repo_mini_mixin.js b/app/assets/javascripts/repo/repo_mini_mixin.js
new file mode 100644
index 00000000000..e33956b6d15
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_mini_mixin.js
@@ -0,0 +1,11 @@
+import Store from './repo_store';
+
+const RepoMiniMixin = {
+ computed: {
+ isMini() {
+ return !!Store.openedFiles.length;
+ },
+ },
+};
+
+export default RepoMiniMixin;
diff --git a/app/assets/javascripts/repo/repo_prev_directory.vue b/app/assets/javascripts/repo/repo_prev_directory.vue
new file mode 100644
index 00000000000..6a0d684052f
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_prev_directory.vue
@@ -0,0 +1,26 @@
+<script>
+const RepoPreviousDirectory = {
+ props: {
+ prevUrl: {
+ type: String,
+ required: true,
+ },
+ },
+
+ methods: {
+ linkClicked(file) {
+ this.$emit('linkclicked', file);
+ },
+ },
+};
+
+export default RepoPreviousDirectory;
+</script>
+
+<template>
+<tr class="prev-directory">
+ <td colspan="3">
+ <a :href="prevUrl" @click.prevent="linkClicked(prevUrl)">..</a>
+ </td>
+</tr>
+</template>
diff --git a/app/assets/javascripts/repo/repo_service.js b/app/assets/javascripts/repo/repo_service.js
new file mode 100644
index 00000000000..b16640ab4f0
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_service.js
@@ -0,0 +1,67 @@
+import axios from 'axios';
+import Store from './repo_store';
+
+const RepoService = {
+ url: '',
+ options: {
+ params: {
+ format: 'json',
+ },
+ },
+ richExtensionRegExp: /md/,
+
+ checkCurrentBranchIsCommitable() {
+ const url = Store.service.refsUrl;
+ return axios.get(url, { params: {
+ ref: Store.currentBranch,
+ search: Store.currentBranch,
+ } });
+ },
+
+ buildParams(url = this.url) {
+ // shallow clone object without reference
+ const params = Object.assign({}, this.options.params);
+
+ if (this.urlIsRichBlob(url)) params.viewer = 'rich';
+
+ return params;
+ },
+
+ urlIsRichBlob(url = this.url) {
+ const extension = url.split('.').pop();
+
+ return this.richExtensionRegExp.test(extension);
+ },
+
+ getContent(url = this.url) {
+ const params = this.buildParams(url);
+
+ return axios.get(url, {
+ params,
+ });
+ },
+
+ getBase64Content(url = this.url) {
+ const request = axios.get(url, {
+ responseType: 'arraybuffer',
+ });
+
+ return request.then(response => this.bufferToBase64(response.data));
+ },
+
+ bufferToBase64(data) {
+ return new Buffer(data, 'binary').toString('base64');
+ },
+
+ blobURLtoParentTree(url) {
+ const urlArray = url.split('/');
+ urlArray.pop();
+ const blobIndex = urlArray.indexOf('blob');
+
+ if (blobIndex > -1) urlArray[blobIndex] = 'tree';
+
+ return urlArray.join('/');
+ },
+};
+
+export default RepoService;
diff --git a/app/assets/javascripts/repo/repo_sidebar.vue b/app/assets/javascripts/repo/repo_sidebar.vue
new file mode 100644
index 00000000000..04a59043a9e
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_sidebar.vue
@@ -0,0 +1,106 @@
+<script>
+import Service from './repo_service';
+import Helper from './repo_helper';
+import Store from './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 RepoMiniMixin from './repo_mini_mixin';
+
+const RepoSidebar = {
+ mixins: [RepoMiniMixin],
+ 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>
diff --git a/app/assets/javascripts/repo/repo_store.js b/app/assets/javascripts/repo/repo_store.js
new file mode 100644
index 00000000000..0a468988950
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_store.js
@@ -0,0 +1,205 @@
+/* global Flash */
+import RepoHelper from './repo_helper';
+
+const RepoStore = {
+ ideEl: {},
+ monaco: {},
+ monacoInstance: {},
+ service: '',
+ editor: '',
+ sidebar: '',
+ editButton: '',
+ editMode: false,
+ isTree: false,
+ isRoot: false,
+ prevURL: '',
+ projectId: '',
+ projectName: '',
+ projectUrl: '',
+ trees: [],
+ blobs: [],
+ submodules: [],
+ blobRaw: '',
+ blobRendered: '',
+ openedFiles: [],
+ tabSize: 100,
+ defaultTabSize: 100,
+ minTabSize: 30,
+ tabsOverflow: 41,
+ submitCommitsLoading: false,
+ binaryLoaded: false,
+ activeFile: RepoHelper.getDefaultActiveFile(),
+ activeFileIndex: 0,
+ activeLine: 0,
+ activeFileLabel: 'Raw',
+ files: [],
+ isCommitable: false,
+ binary: false,
+ currentBranch: '',
+ commitMessage: '',
+ binaryMimeType: '',
+ // scroll bar space for windows
+ scrollWidth: 0,
+ binaryTypes: {
+ png: false,
+ markdown: false,
+ },
+ loading: {
+ tree: false,
+ blob: false,
+ },
+ readOnly: true,
+
+ // mutations
+ checkIsCommitable() {
+ RepoStore.service.checkCurrentBranchIsCommitable()
+ .then((data) => {
+ // you shouldn't be able to make commits on commits or tags.
+ const { Branches, Commits, Tags } = data.data;
+ if (Branches && Branches.length) RepoStore.isCommitable = true;
+ if (Commits && Commits.length) RepoStore.isCommitable = false;
+ if (Tags && Tags.length) RepoStore.isCommitable = false;
+ }).catch(() => Flash('Failed to check if branch can be committed to.'));
+ },
+
+ addFilesToDirectory(inDirectory, currentList, newList) {
+ RepoStore.files = RepoHelper.getNewMergedList(inDirectory, currentList, newList);
+ },
+
+ toggleRawPreview() {
+ RepoStore.activeFile.raw = !RepoStore.activeFile.raw;
+ RepoStore.activeFileLabel = RepoStore.activeFile.raw ? 'Display rendered file' : 'Display source';
+ },
+
+ setActiveFiles(file) {
+ if (RepoStore.isActiveFile(file)) return;
+ RepoStore.openedFiles = RepoStore.openedFiles
+ .map((openedFile, i) => RepoStore.setFileActivity(file, openedFile, i));
+
+ RepoStore.setActiveToRaw();
+
+ if (file.binary) {
+ RepoStore.blobRaw = file.base64;
+ } else {
+ RepoStore.blobRaw = file.plain;
+ }
+
+ if (!file.loading) RepoHelper.toURL(file.url);
+ RepoStore.binary = file.binary;
+ },
+
+ setFileActivity(file, openedFile, i) {
+ const activeFile = openedFile;
+ activeFile.active = file.url === activeFile.url;
+
+ if (activeFile.active) RepoStore.setActiveFile(activeFile, i);
+
+ return activeFile;
+ },
+
+ setActiveFile(activeFile, i) {
+ RepoStore.activeFile = Object.assign({}, RepoStore.activeFile, activeFile);
+ RepoStore.activeFileIndex = i;
+ },
+
+ setActiveToRaw() {
+ RepoStore.activeFile.raw = false;
+ // can't get vue to listen to raw for some reason so RepoStore for now.
+ RepoStore.activeFileLabel = 'Display source';
+ },
+
+ removeChildFilesOfTree(tree) {
+ let foundTree = false;
+ const treeToClose = tree;
+ let wereDone = false;
+ RepoStore.files = RepoStore.files.filter((file) => {
+ const isItTheTreeWeWant = file.url === treeToClose.url;
+ // if it's the next tree
+ if (foundTree && file.type === 'tree' && !isItTheTreeWeWant && file.level === treeToClose.level) {
+ wereDone = true;
+ return true;
+ }
+ if (wereDone) return true;
+
+ if (isItTheTreeWeWant) foundTree = true;
+
+ if (foundTree) return file.level <= treeToClose.level;
+ return true;
+ });
+
+ treeToClose.opened = false;
+ treeToClose.icon = 'fa-folder';
+ return treeToClose;
+ },
+
+ removeFromOpenedFiles(file) {
+ if (file.type === 'tree') return;
+ let foundIndex;
+ RepoStore.openedFiles = RepoStore.openedFiles.filter((openedFile, i) => {
+ if (openedFile.url === file.url) foundIndex = i;
+ return openedFile.url !== file.url;
+ });
+
+ // now activate the right tab based on what you closed.
+ if (RepoStore.openedFiles.length === 0) {
+ RepoStore.activeFile = {};
+ return;
+ }
+
+ if (RepoStore.openedFiles.length === 1 || foundIndex === 0) {
+ RepoStore.setActiveFiles(RepoStore.openedFiles[0]);
+ return;
+ }
+
+ if (foundIndex) {
+ if (foundIndex > 0) {
+ RepoStore.setActiveFiles(RepoStore.openedFiles[foundIndex - 1]);
+ }
+ }
+ },
+
+ addPlaceholderFile() {
+ const randomURL = RepoHelper.Time.now();
+ const newFakeFile = {
+ active: false,
+ binary: true,
+ type: 'blob',
+ loading: true,
+ mime_type: 'loading',
+ name: 'loading',
+ url: randomURL,
+ fake: true,
+ };
+
+ RepoStore.openedFiles.push(newFakeFile);
+
+ return newFakeFile;
+ },
+
+ addToOpenedFiles(file) {
+ const openFile = file;
+
+ const openedFilesAlreadyExists = RepoStore.openedFiles
+ .some(openedFile => openedFile.url === openFile.url);
+
+ if (openedFilesAlreadyExists) return;
+
+ openFile.changed = false;
+ RepoStore.openedFiles.push(openFile);
+ },
+
+ setActiveFileContents(contents) {
+ if (!RepoStore.editMode) return;
+
+ RepoStore.activeFile.newContent = contents;
+ RepoStore.activeFile.changed = RepoStore.activeFile.plain !== RepoStore.activeFile.newContent;
+ RepoStore.openedFiles[RepoStore.activeFileIndex].changed = RepoStore.activeFile.changed;
+ },
+
+ // getters
+
+ isActiveFile(file) {
+ return file && file.url === RepoStore.activeFile.url;
+ },
+};
+export default RepoStore;
diff --git a/app/assets/javascripts/repo/repo_tab.vue b/app/assets/javascripts/repo/repo_tab.vue
new file mode 100644
index 00000000000..b2c4af719e5
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_tab.vue
@@ -0,0 +1,45 @@
+<script>
+import RepoStore from './repo_store';
+
+const RepoTab = {
+ props: {
+ tab: {
+ type: Object,
+ required: true,
+ },
+ },
+
+ computed: {
+ changedClass() {
+ const tabChangedObj = {
+ 'fa-times': !this.tab.changed,
+ 'fa-circle': this.tab.changed,
+ };
+ return tabChangedObj;
+ },
+ },
+
+ methods: {
+ tabClicked: RepoStore.setActiveFiles,
+
+ xClicked(file) {
+ if (file.changed) return;
+ RepoStore.removeFromOpenedFiles(file);
+ },
+ },
+};
+
+export default RepoTab;
+</script>
+
+<template>
+<li>
+ <a href="#" class="close" @click.prevent="xClicked(tab)" v-if="!tab.loading">
+ <i class="fa" :class="changedClass"></i>
+ </a>
+
+ <a href="#" class="repo-tab" v-if="!tab.loading" :title="tab.url" @click.prevent="tabClicked(tab)">{{tab.name}}</a>
+
+ <i v-if="tab.loading" class="fa fa-spinner fa-spin"></i>
+</li>
+</template>
diff --git a/app/assets/javascripts/repo/repo_tabs.vue b/app/assets/javascripts/repo/repo_tabs.vue
new file mode 100644
index 00000000000..81abe40da03
--- /dev/null
+++ b/app/assets/javascripts/repo/repo_tabs.vue
@@ -0,0 +1,38 @@
+<script>
+import Vue from 'vue';
+import Store from './repo_store';
+import RepoTab from './repo_tab.vue';
+import RepoMiniMixin from './repo_mini_mixin';
+
+const RepoTabs = {
+ mixins: [RepoMiniMixin],
+
+ components: {
+ 'repo-tab': RepoTab,
+ },
+
+ data: () => Store,
+
+ methods: {
+ isOverflow() {
+ return this.$el.scrollWidth > this.$el.offsetWidth;
+ },
+ },
+
+ watch: {
+ openedFiles() {
+ Vue.nextTick(() => {
+ this.tabsOverflow = this.isOverflow();
+ });
+ },
+ },
+};
+
+export default RepoTabs;
+</script>
+
+<template>
+<ul id="tabs" v-if="isMini" v-cloak :class="{'overflown': tabsOverflow}">
+ <repo-tab v-for="tab in openedFiles" :key="tab.id" :tab="tab" :class="{'active' : tab.active}"/>
+</ul>
+</template>
diff --git a/app/assets/javascripts/test_utils/index.js b/app/assets/javascripts/test_utils/index.js
index ef401abce2d..8875590f0f2 100644
--- a/app/assets/javascripts/test_utils/index.js
+++ b/app/assets/javascripts/test_utils/index.js
@@ -1,3 +1,5 @@
+import 'core-js/es6/map';
+import 'core-js/es6/set';
import simulateDrag from './simulate_drag';
// Export to global space for rspec to use
diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js
deleted file mode 100644
index 7777ed1c3dc..00000000000
--- a/app/assets/javascripts/tree.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, quotes, consistent-return, no-var, one-var, one-var-declaration-per-line, no-else-return, prefer-arrow-callback, class-methods-use-this */
-
-export default class TreeView {
- constructor() {
- this.initKeyNav();
- // Code browser tree slider
- // Make the entire tree-item row clickable, but not if clicking another link (like a commit message)
- $(".tree-content-holder .tree-item").on('click', function(e) {
- var $clickedEl, path;
- $clickedEl = $(e.target);
- path = $('.tree-item-file-name a', this).attr('href');
- if (!$clickedEl.is('a') && !$clickedEl.is('.str-truncated')) {
- if (e.metaKey || e.which === 2) {
- e.preventDefault();
- return window.open(path, '_blank');
- } else {
- return gl.utils.visitUrl(path);
- }
- }
- });
- // Show the "Loading commit data" for only the first element
- $('span.log_loading:first').removeClass('hide');
- }
-
- initKeyNav() {
- var li, liSelected;
- li = $("tr.tree-item");
- liSelected = null;
- return $('body').keydown(function(e) {
- var next, path;
- if ($("input:focus").length > 0 && (e.which === 38 || e.which === 40)) {
- return false;
- }
- if (e.which === 40) {
- if (liSelected) {
- next = liSelected.next();
- if (next.length > 0) {
- liSelected.removeClass("selected");
- liSelected = next.addClass("selected");
- }
- } else {
- liSelected = li.eq(0).addClass("selected");
- }
- return $(liSelected).focus();
- } else if (e.which === 38) {
- if (liSelected) {
- next = liSelected.prev();
- if (next.length > 0) {
- liSelected.removeClass("selected");
- liSelected = next.addClass("selected");
- }
- } else {
- liSelected = li.last().addClass("selected");
- }
- return $(liSelected).focus();
- } else if (e.which === 13) {
- path = $('.tree-item.selected .tree-item-file-name a').attr('href');
- if (path) {
- return gl.utils.visitUrl(path);
- }
- }
- });
- }
-}
diff --git a/app/assets/stylesheets/framework/layout.scss b/app/assets/stylesheets/framework/layout.scss
index 4a9d41b4fda..70c830382df 100644
--- a/app/assets/stylesheets/framework/layout.scss
+++ b/app/assets/stylesheets/framework/layout.scss
@@ -120,3 +120,10 @@ of the body element here, we negate cascading side effects but allow momentum sc
.page-with-sidebar {
-webkit-overflow-scrolling: auto;
}
+
+.truncate {
+ width: 250px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
diff --git a/app/assets/stylesheets/framework/mixins.scss b/app/assets/stylesheets/framework/mixins.scss
index 6f91d11b369..261642f4174 100644
--- a/app/assets/stylesheets/framework/mixins.scss
+++ b/app/assets/stylesheets/framework/mixins.scss
@@ -119,6 +119,13 @@
}
}
+@mixin truncate($width: 250px) {
+ width: $width;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
/*
* Mixin for status badges, as used for pipelines and commit signatures
*/
diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss
index cf0a1ad57d0..80d634487ff 100644
--- a/app/assets/stylesheets/framework/variables.scss
+++ b/app/assets/stylesheets/framework/variables.scss
@@ -88,6 +88,7 @@ $indigo-950: #1a1a40;
$black: #000;
$black-transparent: rgba(0, 0, 0, 0.3);
+$almost-black: #242424;
$border-white-light: darken($white-light, $darken-border-factor);
$border-white-normal: darken($white-normal, $darken-border-factor);
@@ -613,6 +614,13 @@ $color-average-score: $orange-400;
$color-low-score: $red-400;
/*
+Repo editor
+*/
+$repo-editor-grey: #f6f7f9;
+$repo-editor-grey-darker: #e9ebee;
+$repo-editor-linear-gradient: linear-gradient(to right, $repo-editor-grey 0%, $repo-editor-grey-darker, 20%, $repo-editor-grey 40%, $repo-editor-grey 100%);
+
+/*
Performance Bar
*/
$perf-bar-text: #999;
diff --git a/app/assets/stylesheets/pages/repo.scss b/app/assets/stylesheets/pages/repo.scss
new file mode 100644
index 00000000000..dd48ef297da
--- /dev/null
+++ b/app/assets/stylesheets/pages/repo.scss
@@ -0,0 +1,354 @@
+[v-cloak] {
+ display: none;
+}
+
+.fade-enter-active,
+.fade-leave-active {
+ transition: opacity .5s;
+}
+
+.fade-enter,
+.fade-leave-to /* .fade-leave-active in <2.1.8 */ {
+ opacity: 0;
+}
+
+.commit-message {
+ @include truncate(250px);
+}
+
+.tree-content-holder {
+ border: 1px solid $border-color;
+ border-radius: $border-radius-default;
+ color: $almost-black;
+
+ header {
+ background: $gray-light;
+ padding: 10px 15px;
+ }
+
+ .panel-right {
+ display: inline-block;
+ width: 80%;
+
+ .monaco-editor.vs {
+ .line-numbers {
+ cursor: pointer;
+
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+
+ .cursor {
+ display: none !important;
+ }
+ }
+
+ &.edit-mode {
+ .monaco-editor.vs {
+ .cursor {
+ background: $black;
+ border-color: $black;
+ display: block !important;
+ }
+ }
+ }
+
+ #tabs {
+ height: 61px;
+ border-bottom: 1px solid $white-normal;
+ padding-left: 0;
+ margin-bottom: 0;
+ display: inline-block;
+ white-space: nowrap;
+ width: 100%;
+ overflow-y: hidden;
+ overflow-x: auto;
+
+ &.overflown {
+ height: 61px;
+
+ li {
+ padding: 20px 18px;
+ }
+ }
+
+ li {
+ animation: swipeRightAppear ease-in 0.1s;
+ animation-iteration-count: 1;
+ transform-origin: 0% 50%;
+ list-style-type: none;
+ background: $gray-normal;
+ display: inline-block;
+ padding: 20px 18px;
+ border-right: 1px solid $border-color;
+ white-space: nowrap;
+
+ &.active {
+ background: $white-light;
+ }
+
+ a {
+ color: $black;
+ display: inline-block;
+ width: 100px;
+ text-align: center;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ vertical-align: middle;
+
+ &.close {
+ width: auto;
+ font-size: 15px;
+ opacity: 1;
+ }
+ }
+
+ i.fa.fa-times,
+ i.fa.fa-circle {
+ float: right;
+ margin-top: 3px;
+ margin-left: 15px;
+ color: $gray-darkest;
+ }
+
+ i.fa.fa-circle {
+ color: $brand-success;
+ }
+ }
+ }
+
+ #ide {
+ height: 75vh;
+ }
+
+ #repo-file-buttons {
+ background: $gray-light;
+ border-bottom: 1px solid $white-normal;
+ padding: 10px 5px;
+ position: relative;
+ border-top: 1px solid $white-normal;
+ margin-top: -5px;
+ }
+
+ #binary-viewer {
+ height: 70vh;
+ overflow: auto;
+ margin-top: 5px;
+ margin-left: 10px;
+
+ .blob-viewer {
+ padding-top: 20px;
+ padding-left: 20px;
+ }
+ }
+ }
+
+ #commit-area {
+ background: $gray-light;
+ padding: 20px;
+ }
+
+ #view-toggler {
+ height: 41px;
+ position: relative;
+ display: block;
+ border-bottom: 1px solid $white-normal;
+ background: $white-light;
+ margin-top: -5px;
+ }
+
+ #binary-viewer {
+ img {
+ max-width: 100%;
+ }
+ }
+
+ #sidebar {
+
+ &.sidebar-mini {
+ display: inline-block;
+ vertical-align: top;
+ width: 20%;
+ border-right: 1px solid $white-normal;
+ height: 100vh;
+ overflow: auto;
+ }
+
+ tr {
+ animation: fadein 0.5s;
+ cursor: pointer;
+
+ &.repo-file-options td {
+ padding: 0;
+ border-top: none;
+ background: $gray-light;
+ width: 190px;
+ display: inline-block;
+
+ &:hover {
+ .title {
+ width: 105px;
+ }
+
+ ul {
+ display: inline-block;
+ }
+
+ }
+
+ .title {
+ display: inline-block;
+ font-size: 10px;
+ text-transform: uppercase;
+ font-weight: bold;
+ color: $gray-darkest;
+ width: 185px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ vertical-align: middle;
+ padding: 2px 16px;
+ }
+
+ ul {
+ display: none;
+ float: right;
+ margin: 0 10px 0 0;
+ padding: 1px 0;
+
+ li {
+ display: inline-block;
+ padding: 0 2px;
+ border-bottom: none;
+ }
+ }
+ }
+
+ .fa {
+ margin-right: 5px;
+ }
+
+ td {
+ white-space: nowrap;
+ }
+ }
+
+ a {
+ color: $almost-black;
+ display: inline-block;
+ vertical-align: middle;
+ }
+
+ ul {
+ list-style-type: none;
+ padding: 0;
+
+ li {
+ border-bottom: 1px solid $border-gray-normal;
+ padding: 10px 20px;
+
+ a {
+ color: $almost-black;
+ }
+
+ .fa {
+ font-size: $code_font_size;
+ margin-right: 5px;
+ }
+ }
+ }
+ }
+
+}
+
+.animation-container {
+ background: $repo-editor-grey;
+ height: 40px;
+ overflow: hidden;
+ position: relative;
+
+ &.animation-container-small {
+ height: 12px;
+ }
+
+ &::before {
+ animation-duration: 1s;
+ animation-fill-mode: forwards;
+ animation-iteration-count: infinite;
+ animation-name: blockTextShine;
+ animation-timing-function: linear;
+ background-image: $repo-editor-linear-gradient;
+ background-repeat: no-repeat;
+ background-size: 800px 45px;
+ content: ' ';
+ display: block;
+ height: 100%;
+ position: relative;
+ }
+
+ div {
+ background: $white-light;
+ height: 6px;
+ left: 0;
+ position: absolute;
+ right: 0;
+ }
+
+ .line-of-code-1 {
+ left: 0;
+ top: 8px;
+ }
+
+ .line-of-code-2 {
+ left: 150px;
+ top: 0;
+ height: 10px;
+ }
+
+ .line-of-code-3 {
+ left: 0;
+ top: 23px;
+ }
+
+ .line-of-code-4 {
+ left: 0;
+ top: 38px;
+ }
+
+ .line-of-code-5 {
+ left: 200px;
+ top: 28px;
+ height: 10px;
+ }
+
+ .line-of-code-6 {
+ top: 14px;
+ left: 230px;
+ height: 10px;
+ }
+}
+
+@keyframes blockTextShine {
+ 0% {
+ transform: translateX(-468px);
+ }
+
+ 100% {
+ transform: translateX(468px);
+ }
+}
+
+@keyframes swipeRightAppear {
+ 0% {
+ transform: scaleX(0.00);
+ }
+
+ 45% {
+ transform: scaleX(0.26);
+ }
+
+ 100% {
+ transform: scaleX(1.00);
+ }
+}
diff --git a/app/assets/stylesheets/pages/tree.scss b/app/assets/stylesheets/pages/tree.scss
index dc88cf3e699..40052dcd882 100644
--- a/app/assets/stylesheets/pages/tree.scss
+++ b/app/assets/stylesheets/pages/tree.scss
@@ -86,7 +86,7 @@
}
.add-to-tree {
- vertical-align: top;
+ vertical-align: middle;
padding: 6px 10px;
}
diff --git a/app/controllers/concerns/renders_blob.rb b/app/controllers/concerns/renders_blob.rb
index 54dcd7c61ce..1440fff1527 100644
--- a/app/controllers/concerns/renders_blob.rb
+++ b/app/controllers/concerns/renders_blob.rb
@@ -11,11 +11,27 @@ module RendersBlob
else
blob.simple_viewer
end
+
return render_404 unless viewer
- render json: {
- html: view_to_html_string("projects/blob/_viewer", viewer: viewer, load_async: false)
- }
+ if blob.binary?
+ render json: {
+ binary: true,
+ mime_type: blob.mime_type,
+ name: blob.name,
+ extension: blob.extension,
+ size: blob.size
+ }
+ else
+ render json: {
+ html: view_to_html_string("projects/blob/_viewer", viewer: viewer, load_async: false),
+ plain: blob.data,
+ name: blob.name,
+ extension: blob.extension,
+ size: blob.size,
+ mime_type: blob.mime_type
+ }
+ end
end
def conditionally_expand_blob(blob)
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index 49ea2945675..4346ef8de02 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -37,12 +37,10 @@ class Projects::BlobController < Projects::ApplicationController
respond_to do |format|
format.html do
- environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit }
- @environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last
+ assign_ref_vars
+ @last_commit = @repository.last_commit_for_path(@commit.id, tree.path) || @commit
- @last_commit = @repository.last_commit_for_path(@commit.id, @blob.path)
-
- render 'show'
+ render 'projects/tree/show'
end
format.json do
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index 30181ac3bdf..1fc276b8c03 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -24,12 +24,19 @@ class Projects::TreeController < Projects::ApplicationController
end
end
- @last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit
-
respond_to do |format|
- format.html
- # Disable cache so browser history works
- format.js { no_cache_headers }
+ format.html do
+ @last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit
+ end
+
+ format.js do
+ # Disable cache so browser history works
+ no_cache_headers
+ end
+
+ format.json do
+ render json: TreeSerializer.new(project: @project, repository: @repository, ref: @ref).represent(@tree)
+ end
end
end
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index 926502bf239..ed4704aa838 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -88,15 +88,15 @@ module DiffHelper
end
def submodule_link(blob, ref, repository = @repository)
- tree, commit = submodule_links(blob, ref, repository)
- commit_id = if commit.nil?
+ project_url, tree_url = submodule_links(blob, ref, repository)
+ commit_id = if tree_url.nil?
Commit.truncate_sha(blob.id)
else
- link_to Commit.truncate_sha(blob.id), commit
+ link_to Commit.truncate_sha(blob.id), tree_url
end
[
- content_tag(:span, link_to(truncate(blob.name, length: 40), tree)),
+ content_tag(:span, link_to(truncate(blob.name, length: 40), project_url)),
'@',
content_tag(:span, commit_id, class: 'commit-sha')
].join(' ').html_safe
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb
index f29faeca22d..9a404832423 100644
--- a/app/helpers/icons_helper.rb
+++ b/app/helpers/icons_helper.rb
@@ -1,4 +1,5 @@
module IconsHelper
+ extend self
include FontAwesome::Rails::IconHelper
# Creates an icon tag given icon name(s) and possible icon modifiers.
diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb
index b24039fb349..88f7702db1e 100644
--- a/app/helpers/submodule_helper.rb
+++ b/app/helpers/submodule_helper.rb
@@ -1,5 +1,5 @@
module SubmoduleHelper
- include Gitlab::ShellAdapter
+ extend self
VALID_SUBMODULE_PROTOCOLS = %w[http https git ssh].freeze
@@ -59,7 +59,7 @@ module SubmoduleHelper
return true if url_no_dotgit == [Gitlab.config.gitlab.url, '/', namespace, '/',
project].join('')
url_with_dotgit = url_no_dotgit + '.git'
- url_with_dotgit == gitlab_shell.url_to_repo([namespace, '/', project].join(''))
+ url_with_dotgit == Gitlab::Shell.new.url_to_repo([namespace, '/', project].join(''))
end
def relative_self_url?(url)
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index e0d3e9b88f3..bc2b3c97fe7 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -12,6 +12,14 @@ module TreeHelper
tree.html_safe
end
+ def repo_url(project)
+ if controller_name == 'projects'
+ readme_path(project)
+ else
+ request.original_url
+ end
+ end
+
# Return an image icon depending on the file type and mode
#
# type - String type of the tree item; either 'folder' or 'file'
diff --git a/app/serializers/blob_entity.rb b/app/serializers/blob_entity.rb
new file mode 100644
index 00000000000..56f173e5a27
--- /dev/null
+++ b/app/serializers/blob_entity.rb
@@ -0,0 +1,17 @@
+class BlobEntity < Grape::Entity
+ include RequestAwareEntity
+
+ expose :id, :path, :name, :mode
+
+ expose :last_commit do |blob|
+ request.project.repository.last_commit_for_path(blob.commit_id, blob.path)
+ end
+
+ expose :icon do |blob|
+ IconsHelper.file_type_icon_class('file', blob.mode, blob.name)
+ end
+
+ expose :url do |blob|
+ project_blob_path(request.project, File.join(request.ref, blob.path))
+ end
+end
diff --git a/app/serializers/submodule_entity.rb b/app/serializers/submodule_entity.rb
new file mode 100644
index 00000000000..9a7eb5e7880
--- /dev/null
+++ b/app/serializers/submodule_entity.rb
@@ -0,0 +1,23 @@
+class SubmoduleEntity < Grape::Entity
+ include RequestAwareEntity
+
+ expose :id, :path, :name, :mode
+
+ expose :icon do |blob|
+ 'archive'
+ end
+
+ expose :project_url do |blob|
+ submodule_links(blob, request).first
+ end
+
+ expose :tree_url do |blob|
+ submodule_links(blob, request).last
+ end
+
+ private
+
+ def submodule_links(blob, request)
+ @submodule_links ||= SubmoduleHelper.submodule_links(blob, request.ref, request.repository)
+ end
+end
diff --git a/app/serializers/tree_entity.rb b/app/serializers/tree_entity.rb
new file mode 100644
index 00000000000..555e5cf83bd
--- /dev/null
+++ b/app/serializers/tree_entity.rb
@@ -0,0 +1,17 @@
+class TreeEntity < Grape::Entity
+ include RequestAwareEntity
+
+ expose :id, :path, :name, :mode
+
+ expose :last_commit do |tree|
+ request.project.repository.last_commit_for_path(tree.commit_id, tree.path)
+ end
+
+ expose :icon do |tree|
+ IconsHelper.file_type_icon_class('folder', tree.mode, tree.name)
+ end
+
+ expose :url do |tree|
+ project_tree_path(request.project, File.join(request.ref, tree.path))
+ end
+end
diff --git a/app/serializers/tree_root_entity.rb b/app/serializers/tree_root_entity.rb
new file mode 100644
index 00000000000..23b65aa4a4c
--- /dev/null
+++ b/app/serializers/tree_root_entity.rb
@@ -0,0 +1,8 @@
+# TODO: Inherit from TreeEntity, when `Tree` implements `id` and `name` like `Gitlab::Git::Tree`.
+class TreeRootEntity < Grape::Entity
+ expose :path
+
+ expose :trees, using: TreeEntity
+ expose :blobs, using: BlobEntity
+ expose :submodules, using: SubmoduleEntity
+end
diff --git a/app/serializers/tree_serializer.rb b/app/serializers/tree_serializer.rb
new file mode 100644
index 00000000000..713ade23bc9
--- /dev/null
+++ b/app/serializers/tree_serializer.rb
@@ -0,0 +1,3 @@
+class TreeSerializer < BaseSerializer
+ entity TreeRootEntity
+end
diff --git a/app/views/projects/_files.html.haml b/app/views/projects/_files.html.haml
index 426085b3e1c..7b399d31ba7 100644
--- a/app/views/projects/_files.html.haml
+++ b/app/views/projects/_files.html.haml
@@ -3,12 +3,5 @@
- project = local_assigns.fetch(:project) { @project }
#tree-holder.tree-holder.clearfix
.nav-block
- = render 'projects/tree/tree_header', tree: @tree
-
- - if commit
- .info-well.hidden-xs.project-last-commit.append-bottom-default
- .well-segment
- %ul.blob-commit-info
- = render 'projects/commits/commit', commit: commit, ref: ref, project: project
-
- = render 'projects/tree/tree_content', tree: @tree
+ = render 'projects/tree/tree_header'
+ = render 'projects/tree/tree_content'
diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml
index 8bd336269ff..ea72270a82c 100644
--- a/app/views/projects/blob/_blob.html.haml
+++ b/app/views/projects/blob/_blob.html.haml
@@ -8,6 +8,3 @@
= render "projects/blob/auxiliary_viewer", blob: blob
#blob-content-holder.blob-content-holder
- %article.file-holder
- = render "projects/blob/header", blob: blob
- = render 'projects/blob/content', blob: blob
diff --git a/app/views/projects/blob/_viewer.html.haml b/app/views/projects/blob/_viewer.html.haml
index 013f1c267c8..cc85e5de40f 100644
--- a/app/views/projects/blob/_viewer.html.haml
+++ b/app/views/projects/blob/_viewer.html.haml
@@ -17,3 +17,4 @@
- viewer = BlobViewer::Download.new(viewer.blob) if viewer.binary_detected_after_load?
= render viewer.partial_path, viewer: viewer
+
diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml
index 7dd834e84b5..7428bb5d3ac 100644
--- a/app/views/projects/blob/show.html.haml
+++ b/app/views/projects/blob/show.html.haml
@@ -5,7 +5,9 @@
= render "projects/commits/head"
- content_for :page_specific_javascripts do
- = page_specific_javascript_bundle_tag('blob')
+ = webpack_bundle_tag 'blob'
+ = webpack_bundle_tag 'common_vue'
+ = webpack_bundle_tag 'repo'
= render 'projects/last_push'
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index a9b39cedb1d..18ef1c93c3c 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -5,6 +5,10 @@
= content_for :meta_tags do
= auto_discovery_link_tag(:atom, project_path(@project, rss_url_options), title: "#{@project.name} activity")
+- content_for :page_specific_javascripts do
+ = webpack_bundle_tag 'common_vue'
+ = webpack_bundle_tag 'repo'
+
= render partial: 'flash_messages', locals: { project: @project }
= render "projects/head"
diff --git a/app/views/projects/tree/_tree_content.html.haml b/app/views/projects/tree/_tree_content.html.haml
index 6560bd5ab3f..005696470fc 100644
--- a/app/views/projects/tree/_tree_content.html.haml
+++ b/app/views/projects/tree/_tree_content.html.haml
@@ -1,27 +1,4 @@
-.tree-content-holder
- .table-holder
- %table.table#tree-slider{ class: "table_#{@hex_path} tree-table" }
- %thead
- %tr
- %th= s_('ProjectFileTree|Name')
- %th.hidden-xs
- .pull-left= _('Last commit')
- %th.text-right= _('Last Update')
- - if @path.present?
- %tr.tree-item
- %td.tree-item-file-name
- = link_to "..", project_tree_path(@project, up_dir_path), class: 'prepend-left-10'
- %td
- %td.hidden-xs
-
- = render_tree(tree)
-
- - if tree.readme
- = render "projects/tree/readme", readme: tree.readme
-
-- if can_edit_tree?
- = render 'projects/blob/upload', title: _('Upload New File'), placeholder: _('Upload New File'), button_title: _('Upload file'), form_path: project_create_blob_path(@project, @id), method: :post
- = render 'projects/blob/new_dir'
+#repo{ data: { url: repo_url(@project), 'project-name' => @project.name, refs_url: refs_namespace_project_path(@project.namespace, @project, format: "json"), project_url: namespace_project_path(@project.namespace, @project), project_id: @project.id } }
:javascript
// Load last commit log for each file in tree
diff --git a/app/views/projects/tree/_tree_header.html.haml b/app/views/projects/tree/_tree_header.html.haml
index 858418ff8df..e28e88921b6 100644
--- a/app/views/projects/tree/_tree_header.html.haml
+++ b/app/views/projects/tree/_tree_header.html.haml
@@ -2,80 +2,11 @@
.tree-ref-holder
= render 'shared/ref_switcher', destination: 'tree', path: @path
- %ul.breadcrumb.repo-breadcrumb
- %li
- = link_to project_tree_path(@project, @ref) do
- = @project.path
- - path_breadcrumbs do |title, path|
- %li
- = link_to truncate(title, length: 40), project_tree_path(@project, tree_join(@ref, path))
-
- - if current_user
- %li
- - if !on_top_of_branch?
- %span.btn.add-to-tree.disabled.has-tooltip{ title: _("You can only add files when you are on a branch"), data: { container: 'body' } }
- = icon('plus')
- - else
- %span.dropdown
- %a.dropdown-toggle.btn.add-to-tree{ href: '#', "data-toggle" => "dropdown", "data-target" => ".add-to-tree-dropdown" }
- = icon('plus')
- .add-to-tree-dropdown
- %ul.dropdown-menu
- - if can_edit_tree?
- %li
- = link_to project_new_blob_path(@project, @id) do
- = icon('pencil fw')
- #{ _('New file') }
- %li
- = link_to '#modal-upload-blob', { 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal' } do
- = icon('file fw')
- #{ _('Upload file') }
- %li
- = link_to '#modal-create-new-dir', { 'data-target' => '#modal-create-new-dir', 'data-toggle' => 'modal' } do
- = icon('folder fw')
- #{ _('New directory') }
- - elsif can?(current_user, :fork_project, @project)
- %li
- - continue_params = { to: project_new_blob_path(@project, @id),
- notice: edit_in_new_fork_notice,
- notice_now: edit_in_new_fork_notice_now }
- - fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id,
- continue: continue_params)
- = link_to fork_path, method: :post do
- = icon('pencil fw')
- #{ _('New file') }
- %li
- - continue_params = { to: request.fullpath,
- notice: edit_in_new_fork_notice + " Try to upload a file again.",
- notice_now: edit_in_new_fork_notice_now }
- - fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id,
- continue: continue_params)
- = link_to fork_path, method: :post do
- = icon('file fw')
- #{ _('Upload file') }
- %li
- - continue_params = { to: request.fullpath,
- notice: edit_in_new_fork_notice + " Try to create a new directory again.",
- notice_now: edit_in_new_fork_notice_now }
- - fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id,
- continue: continue_params)
- = link_to fork_path, method: :post do
- = icon('folder fw')
- #{ _('New directory') }
-
- %li.divider
- %li
- = link_to new_project_branch_path(@project) do
- = icon('code-fork fw')
- #{ _('New branch') }
- %li
- = link_to new_project_tag_path(@project) do
- = icon('tags fw')
- #{ _('New tag') }
-
.tree-controls
- = render 'projects/find_file_link'
+ %a.btn.btn-default#editable-mode{ "href"=>"#", "@click.prevent" => "editClicked", "v-cloak" => 1, "v-if" => "isCommitable" }
+ %i{ ":class" => "buttonIcon" }
+ %span {{buttonLabel}}
- = link_to s_('Commits|History'), project_commits_path(@project, @id), class: 'btn'
+ = render 'projects/find_file_link'
= render 'projects/buttons/download', project: @project, ref: @ref
diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml
index c8587245f88..7b173a869a5 100644
--- a/app/views/projects/tree/show.html.haml
+++ b/app/views/projects/tree/show.html.haml
@@ -5,6 +5,11 @@
- page_title @path.presence || _("Files"), @ref
= content_for :meta_tags do
= auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, rss_url_options), title: "#{@project.name}:#{@ref} commits")
+
+- content_for :page_specific_javascripts do
+ = webpack_bundle_tag 'common_vue'
+ = webpack_bundle_tag 'repo'
+
= render "projects/commits/head"
%div{ class: [container_class, ("limit-container-width" unless fluid_layout)] }
diff --git a/config/webpack.config.js b/config/webpack.config.js
index 41d3ed12b14..9e6fd8aebe6 100644
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
@@ -4,6 +4,7 @@ var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var StatsPlugin = require('stats-webpack-plugin');
+var CopyWebpackPlugin = require('copy-webpack-plugin');
var CompressionPlugin = require('compression-webpack-plugin');
var NameAllModulesPlugin = require('name-all-modules-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
@@ -59,6 +60,7 @@ var config = {
prometheus_metrics: './prometheus_metrics',
protected_branches: './protected_branches',
protected_tags: './protected_tags',
+ repo: './repo/index.js',
sidebar: './sidebar/sidebar_bundle.js',
schedule_form: './pipeline_schedules/pipeline_schedule_form_bundle.js',
schedules_index: './pipeline_schedules/pipeline_schedules_index_bundle.js',
@@ -110,7 +112,16 @@ var config = {
test: /locale\/\w+\/(.*)\.js$/,
loader: 'exports-loader?locales',
},
- ]
+ {
+ test: /monaco-editor\/\w+\/vs\/loader\.js$/,
+ use: [
+ { loader: 'exports-loader', options: 'l.global' },
+ { loader: 'imports-loader', options: 'l=>{},this=>l,AMDLoader=>this,module=>undefined' },
+ ],
+ }
+ ],
+
+ noParse: [/monaco-editor\/\w+\/vs\//],
},
plugins: [
@@ -169,6 +180,7 @@ var config = {
'pdf_viewer',
'pipelines',
'pipelines_details',
+ 'repo',
'schedule_form',
'schedules_index',
'sidebar',
@@ -192,6 +204,26 @@ var config = {
new webpack.optimize.CommonsChunkPlugin({
names: ['main', 'locale', 'common', 'webpack_runtime'],
}),
+
+ // copy pre-compiled vendor libraries verbatim
+ new CopyWebpackPlugin([
+ {
+ from: path.join(ROOT_PATH, `node_modules/monaco-editor/${IS_PRODUCTION ? 'min' : 'dev'}/vs`),
+ to: 'monaco-editor/vs',
+ transform: function(content, path) {
+ if (/\.js$/.test(path) && !/worker/i.test(path)) {
+ return (
+ '(function(){\n' +
+ 'var define = this.define, require = this.require;\n' +
+ 'window.define = define; window.require = require;\n' +
+ content +
+ '\n}.call(window.__monaco_context__ || (window.__monaco_context__ = {})));'
+ );
+ }
+ return content;
+ }
+ }
+ ]),
],
resolve: {
diff --git a/package.json b/package.json
index fd944531a6a..d1f2b356423 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"webpack-prod": "NODE_ENV=production webpack --config config/webpack.config.js"
},
"dependencies": {
+ "axios": "^0.16.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.2.1",
"babel-loader": "^6.2.10",
@@ -20,6 +21,7 @@
"babel-preset-stage-2": "^6.22.0",
"bootstrap-sass": "^3.3.6",
"compression-webpack-plugin": "^0.3.2",
+ "copy-webpack-plugin": "^4.0.1",
"core-js": "^2.4.1",
"css-loader": "^0.28.0",
"d3": "^3.5.11",
@@ -30,6 +32,7 @@
"eslint-plugin-html": "^2.0.1",
"exports-loader": "^0.6.4",
"file-loader": "^0.11.1",
+ "imports-loader": "^0.7.1",
"jed": "^1.1.1",
"jquery": "^2.2.1",
"jquery-ujs": "^1.2.1",
@@ -37,6 +40,7 @@
"jszip": "^3.1.3",
"jszip-utils": "^0.0.2",
"marked": "^0.3.6",
+ "monaco-editor": "0.8.3",
"mousetrap": "^1.4.6",
"name-all-modules-plugin": "^1.0.1",
"pdfjs-dist": "^1.8.252",
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb
index 02bbc48dc59..a90ad60e6a8 100644
--- a/spec/controllers/projects/blob_controller_spec.rb
+++ b/spec/controllers/projects/blob_controller_spec.rb
@@ -35,6 +35,26 @@ describe Projects::BlobController do
end
end
+ context 'with file path and JSON format' do
+ context "valid branch, valid file" do
+ let(:id) { 'master/README.md' }
+
+ before do
+ get(:show,
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id,
+ format: :json)
+ end
+
+ it do
+ expect(response).to be_ok
+ expect(json_response).to have_key 'html'
+ expect(json_response).to have_key 'plain'
+ end
+ end
+ end
+
context 'with tree path' do
before do
get(:show,
diff --git a/spec/javascripts/blob/viewer/index_spec.js b/spec/javascripts/blob/viewer/index_spec.js
index af04e7c1e72..cfa6650d85f 100644
--- a/spec/javascripts/blob/viewer/index_spec.js
+++ b/spec/javascripts/blob/viewer/index_spec.js
@@ -3,10 +3,10 @@ import BlobViewer from '~/blob/viewer/index';
describe('Blob viewer', () => {
let blob;
- preloadFixtures('blob/show.html.raw');
+ preloadFixtures('snippets/show.html.raw');
beforeEach(() => {
- loadFixtures('blob/show.html.raw');
+ loadFixtures('snippets/show.html.raw');
$('#modal-upload-blob').remove();
blob = new BlobViewer();
diff --git a/spec/javascripts/fixtures/blob.rb b/spec/javascripts/fixtures/snippet.rb
index 16490ad5039..cc825c82190 100644
--- a/spec/javascripts/fixtures/blob.rb
+++ b/spec/javascripts/fixtures/snippet.rb
@@ -1,27 +1,25 @@
require 'spec_helper'
-describe Projects::BlobController, '(JavaScript fixtures)', type: :controller do
+describe SnippetsController, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') }
+ let(:snippet) { create(:personal_snippet, title: 'snippet.md', content: '# snippet', file_name: 'snippet.md', author: admin) }
render_views
before(:all) do
- clean_frontend_fixtures('blob/')
+ clean_frontend_fixtures('snippets/')
end
before(:each) do
sign_in(admin)
end
- it 'blob/show.html.raw' do |example|
- get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: 'add-ipython-files/files/ipython/basic.ipynb')
+ it 'snippets/show.html.raw' do |example|
+ get(:show, id: snippet.to_param)
expect(response).to be_success
store_frontend_fixture(response, example.description)
diff --git a/spec/javascripts/helpers/scroll_helper_spec.js b/spec/javascripts/helpers/scroll_helper_spec.js
new file mode 100644
index 00000000000..16daaad68a7
--- /dev/null
+++ b/spec/javascripts/helpers/scroll_helper_spec.js
@@ -0,0 +1,59 @@
+import $ from 'jquery';
+import ScrollHelper from '~/helpers/scroll_helper';
+
+describe('ScrollHelper', () => {
+ const width = 10;
+
+ describe('getScrollWidth', () => {
+ const parent = jasmine.createSpyObj('parent', ['css', 'appendTo', 'remove']);
+ const child = jasmine.createSpyObj('child', ['css', 'appendTo', 'get']);
+ let scrollWidth;
+
+ beforeEach(() => {
+ spyOn($.fn, 'init').and.returnValues(parent, child);
+ spyOn(jasmine.Fixtures.prototype, 'cleanUp'); // disable jasmine-jquery cleanup, we dont want it but its imported in test_bundle :(
+
+ parent.css.and.returnValue(parent);
+ child.css.and.returnValue(child);
+ child.get.and.returnValue({
+ offsetWidth: width,
+ });
+
+ scrollWidth = ScrollHelper.getScrollWidth();
+ });
+
+ it('inserts 2 nested hidden scrollable divs, calls parents outerWidth, removes parent and returns the width', () => {
+ const initArgs = $.fn.init.calls.allArgs();
+
+ expect(initArgs[0][0]).toEqual('<div>');
+ expect(initArgs[1][0]).toEqual('<div>');
+ expect(parent.css).toHaveBeenCalledWith({
+ visibility: 'hidden',
+ width: 100,
+ overflow: 'scroll',
+ });
+ expect(child.css).toHaveBeenCalledWith({
+ width: 100,
+ });
+ expect(child.appendTo).toHaveBeenCalledWith(parent);
+ expect(parent.appendTo).toHaveBeenCalledWith('body');
+ expect(child.get).toHaveBeenCalledWith(0);
+ expect(parent.remove).toHaveBeenCalled();
+ expect(scrollWidth).toEqual(100 - width);
+ });
+ });
+
+ describe('setScrollWidth', () => {
+ it('calls getScrollWidth and sets data-scroll-width', () => {
+ spyOn($.fn, 'find').and.callThrough();
+ spyOn($.fn, 'attr');
+ spyOn(ScrollHelper, 'getScrollWidth').and.returnValue(width);
+
+ ScrollHelper.setScrollWidth();
+
+ expect($.fn.find).toHaveBeenCalledWith('body');
+ expect($.fn.attr).toHaveBeenCalledWith('data-scroll-width', width);
+ expect(ScrollHelper.getScrollWidth).toHaveBeenCalled();
+ });
+ });
+});
diff --git a/spec/javascripts/repo/monaco_loader_spec.js b/spec/javascripts/repo/monaco_loader_spec.js
new file mode 100644
index 00000000000..4e9ce7fc7fe
--- /dev/null
+++ b/spec/javascripts/repo/monaco_loader_spec.js
@@ -0,0 +1,8 @@
+describe('MonacoLoader', () => {
+ it('sets __monaco_context__', () => {
+ const monacoContext = require('monaco-editor/dev/vs/loader'); // eslint-disable-line global-require
+
+ expect(window.__monaco_context__) // eslint-disable-line no-underscore-dangle
+ .toBe(monacoContext);
+ });
+});
diff --git a/spec/javascripts/repo/repo_binary_viewer_spec.js b/spec/javascripts/repo/repo_binary_viewer_spec.js
new file mode 100644
index 00000000000..612d87e0298
--- /dev/null
+++ b/spec/javascripts/repo/repo_binary_viewer_spec.js
@@ -0,0 +1,52 @@
+import Vue from 'vue';
+import Store from '~/repo/repo_store';
+import repoBinaryViewer from '~/repo/repo_binary_viewer.vue';
+
+describe('RepoBinaryViewer', () => {
+ function createComponent() {
+ const RepoBinaryViewer = Vue.extend(repoBinaryViewer);
+
+ return new RepoBinaryViewer().$mount();
+ }
+
+ it('renders an img if its png', () => {
+ const binaryTypes = {
+ png: true,
+ };
+ const activeFile = {
+ name: 'name',
+ };
+ const uri = 'uri';
+ Store.binary = true;
+ Store.binaryTypes = binaryTypes;
+ Store.activeFile = activeFile;
+ Store.pngBlobWithDataURI = uri;
+ const vm = createComponent();
+ const img = vm.$el.querySelector(':scope > img');
+
+ expect(img.src).toMatch(`/${uri}`);
+ expect(img.alt).toEqual(activeFile.name);
+ });
+
+ it('renders an div with content if its markdown', () => {
+ const binaryTypes = {
+ markdown: true,
+ };
+ const activeFile = {
+ html: 'markdown',
+ };
+ Store.binary = true;
+ Store.binaryTypes = binaryTypes;
+ Store.activeFile = activeFile;
+ const vm = createComponent();
+
+ expect(vm.$el.querySelector(':scope > div').innerHTML).toEqual(activeFile.html);
+ });
+
+ it('does not render if no binary', () => {
+ Store.binary = false;
+ const vm = createComponent();
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+});
diff --git a/spec/javascripts/repo/repo_commit_section_spec.js b/spec/javascripts/repo/repo_commit_section_spec.js
new file mode 100644
index 00000000000..919314ac065
--- /dev/null
+++ b/spec/javascripts/repo/repo_commit_section_spec.js
@@ -0,0 +1,129 @@
+import Vue from 'vue';
+import repoCommitSection from '~/repo/repo_commit_section.vue';
+import RepoStore from '~/repo/repo_store';
+import Api from '~/api';
+
+describe('RepoCommitSection', () => {
+ const openedFiles = [{
+ id: 0,
+ changed: true,
+ url: 'url0',
+ newContent: 'a',
+ }, {
+ id: 1,
+ changed: true,
+ url: 'url1',
+ newContent: 'b',
+ }, {
+ id: 2,
+ changed: false,
+ }];
+
+ function createComponent() {
+ const RepoCommitSection = Vue.extend(repoCommitSection);
+
+ return new RepoCommitSection().$mount();
+ }
+
+ it('renders a commit section', () => {
+ RepoStore.isCommitable = true;
+ RepoStore.openedFiles = openedFiles;
+
+ const vm = createComponent();
+ const changedFiles = [...vm.$el.querySelectorAll('.changed-files > li')];
+ const branchDropdownItems = [...vm.$el.querySelectorAll('.branch-dropdown .dropdown-menu > li')];
+ const commitMessage = vm.$el.querySelector('#commit-message');
+ const targetBranch = vm.$el.querySelector('#target-branch');
+ const newMergeRequest = vm.$el.querySelector('.new-merge-request');
+ const newMergeRequestCheckbox = newMergeRequest.querySelector('input');
+ const submitCommit = vm.$el.querySelector('.submit-commit');
+
+ expect(vm.$el.querySelector(':scope > form')).toBeTruthy();
+ expect(vm.$el.querySelector('.staged-files').textContent).toEqual('Staged files (2)');
+ expect(changedFiles.length).toEqual(2);
+
+ changedFiles.forEach((changedFile, i) => {
+ expect(changedFile.textContent).toEqual(openedFiles[i].url);
+ });
+
+ expect(commitMessage.tagName).toEqual('TEXTAREA');
+ expect(commitMessage.name).toEqual('commit-message');
+ expect(branchDropdownItems[0].textContent).toEqual('Target branch');
+ expect(branchDropdownItems[1].textContent).toEqual('Create my own branch');
+ expect(targetBranch.tagName).toEqual('INPUT');
+ expect(targetBranch.name).toEqual('target-branch');
+ expect(targetBranch.type).toEqual('text');
+ expect(newMergeRequest.textContent).toMatch('Start a new merge request with these changes');
+ expect(newMergeRequestCheckbox.type).toEqual('checkbox');
+ expect(newMergeRequestCheckbox.id).toEqual('checkboxes-0');
+ expect(newMergeRequestCheckbox.name).toEqual('checkboxes');
+ expect(newMergeRequestCheckbox.value).toEqual('1');
+ expect(newMergeRequestCheckbox.checked).toBeFalsy();
+ expect(submitCommit.type).toEqual('submit');
+ expect(submitCommit.disabled).toBeTruthy();
+ expect(vm.$el.querySelector('.commit-summary').textContent).toEqual('Commit 2 Files');
+ });
+
+ it('does not render if not isCommitable', () => {
+ RepoStore.isCommitable = false;
+ RepoStore.openedFiles = [{
+ id: 0,
+ changed: true,
+ }];
+
+ const vm = createComponent();
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+
+ it('does not render if no changedFiles', () => {
+ RepoStore.isCommitable = true;
+ RepoStore.openedFiles = [];
+
+ const vm = createComponent();
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+
+ it('shows commit submit and summary if commitMessage and spinner if submitCommitsLoading', (done) => {
+ const projectId = 'projectId';
+ const commitMessage = 'commitMessage';
+ RepoStore.isCommitable = true;
+ RepoStore.openedFiles = openedFiles;
+ RepoStore.projectId = projectId;
+
+ const vm = createComponent();
+ const commitMessageEl = vm.$el.querySelector('#commit-message');
+ const submitCommit = vm.$el.querySelector('.submit-commit');
+
+ vm.commitMessage = commitMessage;
+
+ Vue.nextTick(() => {
+ expect(commitMessageEl.value).toBe(commitMessage);
+ expect(submitCommit.disabled).toBeFalsy();
+
+ spyOn(vm, 'makeCommit').and.callThrough();
+ spyOn(Api, 'commitMultiple');
+
+ submitCommit.click();
+
+ Vue.nextTick(() => {
+ expect(vm.makeCommit).toHaveBeenCalled();
+ expect(submitCommit.querySelector('.fa-spinner.fa-spin')).toBeTruthy();
+
+ const args = Api.commitMultiple.calls.allArgs()[0];
+ const { commit_message, actions } = args[1];
+
+ expect(args[0]).toBe(projectId);
+ expect(commit_message).toBe(commitMessage);
+ expect(actions.length).toEqual(2);
+ expect(actions[0].action).toEqual('update');
+ expect(actions[1].action).toEqual('update');
+ expect(actions[0].content).toEqual('a');
+ expect(actions[1].content).toEqual('b');
+
+ done();
+ });
+ });
+ });
+});
diff --git a/spec/javascripts/repo/repo_editor_spec.js b/spec/javascripts/repo/repo_editor_spec.js
new file mode 100644
index 00000000000..d95bae8fea3
--- /dev/null
+++ b/spec/javascripts/repo/repo_editor_spec.js
@@ -0,0 +1,26 @@
+import Vue from 'vue';
+import repoEditor from '~/repo/repo_editor';
+import RepoStore from '~/repo/repo_store';
+
+describe('RepoEditor', () => {
+ function createComponent() {
+ const RepoEditor = Vue.extend(repoEditor);
+
+ return new RepoEditor().$mount();
+ }
+
+ it('renders an ide container', () => {
+ const monacoInstance = jasmine.createSpyObj('monacoInstance', ['onMouseUp', 'onKeyUp', 'setModel', 'updateOptions']);
+ const monaco = {
+ editor: jasmine.createSpyObj('editor', ['create']),
+ };
+ RepoStore.monaco = monaco;
+
+ monaco.editor.create.and.returnValue(monacoInstance);
+ spyOn(repoEditor.watch, 'blobRaw');
+
+ const vm = createComponent();
+
+ expect(vm.$el.id).toEqual('ide');
+ });
+});
diff --git a/spec/javascripts/repo/repo_file_buttons_spec.js b/spec/javascripts/repo/repo_file_buttons_spec.js
new file mode 100644
index 00000000000..882a8bf3f87
--- /dev/null
+++ b/spec/javascripts/repo/repo_file_buttons_spec.js
@@ -0,0 +1,94 @@
+import Vue from 'vue';
+import repoFileButtons from '~/repo/repo_file_buttons.vue';
+import RepoStore from '~/repo/repo_store';
+
+describe('RepoFileButtons', () => {
+ function createComponent() {
+ const RepoFileButtons = Vue.extend(repoFileButtons);
+
+ return new RepoFileButtons().$mount();
+ }
+
+ it('renders Raw, Blame, History, Permalink, Lock and Preview toggle', () => {
+ const activeFile = {
+ extension: 'md',
+ url: 'url',
+ };
+ const activeFileLabel = 'activeFileLabel';
+ RepoStore.openedFiles = new Array(1);
+ RepoStore.activeFile = activeFile;
+ RepoStore.activeFileLabel = activeFileLabel;
+ RepoStore.editMode = true;
+
+ const vm = createComponent();
+ const raw = vm.$el.querySelector('.raw');
+ const blame = vm.$el.querySelector('.blame');
+ const history = vm.$el.querySelector('.history');
+
+ expect(vm.$el.id).toEqual('repo-file-buttons');
+ expect(vm.$el.style.borderBottom).toEqual('1px solid rgb(31, 120, 209)');
+ expect(raw.href).toMatch(`/${activeFile.url}`);
+ expect(raw.textContent).toEqual('Raw');
+ expect(blame.href).toMatch(`/${activeFile.url}`);
+ expect(blame.textContent).toEqual('Blame');
+ expect(history.href).toMatch(`/${activeFile.url}`);
+ expect(history.textContent).toEqual('History');
+ expect(vm.$el.querySelector('.permalink').textContent).toEqual('Permalink');
+ expect(vm.$el.querySelector('.lock').textContent).toEqual('Lock');
+ expect(vm.$el.querySelector('.preview').textContent).toEqual(activeFileLabel);
+ });
+
+ it('renders a white border if not editMode', () => {
+ const activeFile = {
+ extension: 'md',
+ url: 'url',
+ };
+ RepoStore.openedFiles = new Array(1);
+ RepoStore.activeFile = activeFile;
+ RepoStore.editMode = false;
+
+ const vm = createComponent();
+
+ expect(vm.$el.style.borderBottom).toEqual('1px solid rgb(240, 240, 240)');
+ });
+
+ it('triggers rawPreviewToggle on preview click', () => {
+ const activeFile = {
+ extension: 'md',
+ url: 'url',
+ };
+ RepoStore.openedFiles = new Array(1);
+ RepoStore.activeFile = activeFile;
+ RepoStore.editMode = true;
+
+ const vm = createComponent();
+ const preview = vm.$el.querySelector('.preview');
+
+ spyOn(vm, 'rawPreviewToggle');
+
+ preview.click();
+
+ expect(vm.rawPreviewToggle).toHaveBeenCalled();
+ });
+
+ it('does not render preview toggle if not canPreview', () => {
+ const activeFile = {
+ extension: 'abcd',
+ url: 'url',
+ };
+ RepoStore.openedFiles = new Array(1);
+ RepoStore.activeFile = activeFile;
+
+ const vm = createComponent();
+
+ expect(vm.$el.querySelector('.preview')).toBeFalsy();
+ });
+
+ it('does not render if not isMini', () => {
+ RepoStore.openedFiles = [];
+
+ const vm = createComponent();
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+});
diff --git a/spec/javascripts/repo/repo_file_options_spec.js b/spec/javascripts/repo/repo_file_options_spec.js
new file mode 100644
index 00000000000..cb840851620
--- /dev/null
+++ b/spec/javascripts/repo/repo_file_options_spec.js
@@ -0,0 +1,35 @@
+import Vue from 'vue';
+import repoFileOptions from '~/repo/repo_file_options.vue';
+
+describe('RepoFileOptions', () => {
+ const projectName = 'projectName';
+
+ function createComponent(propsData) {
+ const RepoFileOptions = Vue.extend(repoFileOptions);
+
+ return new RepoFileOptions({
+ propsData,
+ }).$mount();
+ }
+
+ it('renders the title and new file/folder buttons if isMini is true', () => {
+ const vm = createComponent({
+ isMini: true,
+ projectName,
+ });
+
+ expect(vm.$el.classList.contains('repo-file-options')).toBeTruthy();
+ expect(vm.$el.querySelector('.title').textContent).toEqual(projectName);
+ expect(vm.$el.querySelector('a[title="New File"]')).toBeTruthy();
+ expect(vm.$el.querySelector('a[title="New Folder"]')).toBeTruthy();
+ });
+
+ it('does not render if isMini is false', () => {
+ const vm = createComponent({
+ isMini: false,
+ projectName,
+ });
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+});
diff --git a/spec/javascripts/repo/repo_file_spec.js b/spec/javascripts/repo/repo_file_spec.js
new file mode 100644
index 00000000000..dad13c3fe2d
--- /dev/null
+++ b/spec/javascripts/repo/repo_file_spec.js
@@ -0,0 +1,103 @@
+import Vue from 'vue';
+import repoFile from '~/repo/repo_file.vue';
+
+describe('RepoFile', () => {
+ const updated = 'updated';
+ const file = {
+ icon: 'icon',
+ url: 'url',
+ name: 'name',
+ lastCommitMessage: 'message',
+ lastCommitUpdate: Date.now(),
+ level: 10,
+ };
+ const activeFile = {
+ url: 'url',
+ };
+
+ function createComponent(propsData) {
+ const RepoFile = Vue.extend(repoFile);
+
+ return new RepoFile({
+ propsData,
+ }).$mount();
+ }
+
+ beforeEach(() => {
+ spyOn(repoFile.mixins[0].methods, 'timeFormated').and.returnValue(updated);
+ });
+
+ it('renders link, icon, name and last commit details', () => {
+ const vm = createComponent({
+ file,
+ activeFile,
+ });
+ const name = vm.$el.querySelector('.repo-file-name');
+
+ expect(vm.$el.classList.contains('active')).toBeTruthy();
+ expect(vm.$el.querySelector(`.${file.icon}`).style.marginLeft).toEqual('100px');
+ expect(name.title).toEqual(file.url);
+ expect(name.href).toMatch(`/${file.url}`);
+ expect(name.textContent).toEqual(file.name);
+ expect(vm.$el.querySelector('.commit-message').textContent).toBe(file.lastCommitMessage);
+ expect(vm.$el.querySelector('.commit-update').textContent).toBe(updated);
+ });
+
+ it('does render if hasFiles is true and is loading tree', () => {
+ const vm = createComponent({
+ file,
+ activeFile,
+ loading: {
+ tree: true,
+ },
+ hasFiles: true,
+ });
+
+ expect(vm.$el.innerHTML).toBeTruthy();
+ });
+
+ it('does not render if loading tree', () => {
+ const vm = createComponent({
+ file,
+ activeFile,
+ loading: {
+ tree: true,
+ },
+ });
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+
+ it('does not render commit message and datetime if mini', () => {
+ const vm = createComponent({
+ file,
+ activeFile,
+ isMini: true,
+ });
+
+ expect(vm.$el.querySelector('.commit-message')).toBeFalsy();
+ expect(vm.$el.querySelector('.commit-update')).toBeFalsy();
+ });
+
+ it('does not set active class if file is active file', () => {
+ const vm = createComponent({
+ file,
+ activeFile: {},
+ });
+
+ expect(vm.$el.classList.contains('active')).toBeFalsy();
+ });
+
+ it('fires linkClicked when the link is clicked', () => {
+ const vm = createComponent({
+ file,
+ activeFile,
+ });
+
+ spyOn(vm, 'linkClicked');
+
+ vm.$el.querySelector('.repo-file-name').click();
+
+ expect(vm.linkClicked).toHaveBeenCalledWith(file);
+ });
+});
diff --git a/spec/javascripts/repo/repo_loading_file_spec.js b/spec/javascripts/repo/repo_loading_file_spec.js
new file mode 100644
index 00000000000..190b9024e55
--- /dev/null
+++ b/spec/javascripts/repo/repo_loading_file_spec.js
@@ -0,0 +1,79 @@
+import Vue from 'vue';
+import repoLoadingFile from '~/repo/repo_loading_file.vue';
+
+describe('RepoLoadingFile', () => {
+ function createComponent(propsData) {
+ const RepoLoadingFile = Vue.extend(repoLoadingFile);
+
+ return new RepoLoadingFile({
+ propsData,
+ }).$mount();
+ }
+
+ function assertLines(lines) {
+ lines.forEach((line, n) => {
+ const index = n + 1;
+ expect(line.classList.contains(`line-of-code-${index}`)).toBeTruthy();
+ });
+ }
+
+ function assertColumns(columns) {
+ columns.forEach((column) => {
+ const container = column.querySelector('.animation-container');
+ const lines = [...container.querySelectorAll(':scope > div')];
+
+ expect(container).toBeTruthy();
+ expect(lines.length).toEqual(6);
+ assertLines(lines);
+ });
+ }
+
+ it('renders 3 columns of animated LoC', () => {
+ const vm = createComponent({
+ loading: {
+ tree: true,
+ },
+ hasFiles: false,
+ });
+ const columns = [...vm.$el.querySelectorAll('td')];
+
+ expect(columns.length).toEqual(3);
+ assertColumns(columns);
+ });
+
+ it('renders 1 column of animated LoC if isMini', () => {
+ const vm = createComponent({
+ loading: {
+ tree: true,
+ },
+ hasFiles: false,
+ isMini: true,
+ });
+ const columns = [...vm.$el.querySelectorAll('td')];
+
+ expect(columns.length).toEqual(1);
+ assertColumns(columns);
+ });
+
+ it('does not render if tree is not loading', () => {
+ const vm = createComponent({
+ loading: {
+ tree: false,
+ },
+ hasFiles: false,
+ });
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+
+ it('does not render if hasFiles is true', () => {
+ const vm = createComponent({
+ loading: {
+ tree: true,
+ },
+ hasFiles: true,
+ });
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+});
diff --git a/spec/javascripts/repo/repo_prev_directory_spec.js b/spec/javascripts/repo/repo_prev_directory_spec.js
new file mode 100644
index 00000000000..7a8487c102b
--- /dev/null
+++ b/spec/javascripts/repo/repo_prev_directory_spec.js
@@ -0,0 +1,29 @@
+import Vue from 'vue';
+import repoPrevDirectory from '~/repo/repo_prev_directory.vue';
+
+describe('RepoPrevDirectory', () => {
+ function createComponent(propsData) {
+ const RepoPrevDirectory = Vue.extend(repoPrevDirectory);
+
+ return new RepoPrevDirectory({
+ propsData,
+ }).$mount();
+ }
+
+ it('renders a prev dir link', () => {
+ const prevUrl = 'prevUrl';
+ const vm = createComponent({
+ prevUrl,
+ });
+ const link = vm.$el.querySelector('a');
+
+ spyOn(vm, 'linkClicked');
+
+ expect(link.href).toMatch(`/${prevUrl}`);
+ expect(link.textContent).toEqual('..');
+
+ link.click();
+
+ expect(vm.linkClicked).toHaveBeenCalledWith(prevUrl);
+ });
+});
diff --git a/spec/javascripts/repo/repo_service_spec.js b/spec/javascripts/repo/repo_service_spec.js
new file mode 100644
index 00000000000..fde00056b5c
--- /dev/null
+++ b/spec/javascripts/repo/repo_service_spec.js
@@ -0,0 +1,121 @@
+import axios from 'axios';
+import RepoService from '~/repo/repo_service';
+
+describe('RepoService', () => {
+ it('has default json format param', () => {
+ expect(RepoService.options.params.format).toBe('json');
+ });
+
+ describe('buildParams', () => {
+ let newParams;
+ const url = 'url';
+
+ beforeEach(() => {
+ newParams = {};
+
+ spyOn(Object, 'assign').and.returnValue(newParams);
+ });
+
+ it('clones params', () => {
+ const params = RepoService.buildParams(url);
+
+ expect(Object.assign).toHaveBeenCalledWith({}, RepoService.options.params);
+
+ expect(params).toBe(newParams);
+ });
+
+ it('sets and returns viewer params to richif urlIsRichBlob is true', () => {
+ spyOn(RepoService, 'urlIsRichBlob').and.returnValue(true);
+
+ const params = RepoService.buildParams(url);
+
+ expect(params.viewer).toEqual('rich');
+ });
+
+ it('returns params urlIsRichBlob is false', () => {
+ spyOn(RepoService, 'urlIsRichBlob').and.returnValue(false);
+
+ const params = RepoService.buildParams(url);
+
+ expect(params.viewer).toBeUndefined();
+ });
+
+ it('calls urlIsRichBlob with the objects url prop if no url arg is provided', () => {
+ spyOn(RepoService, 'urlIsRichBlob');
+ RepoService.url = url;
+
+ RepoService.buildParams();
+
+ expect(RepoService.urlIsRichBlob).toHaveBeenCalledWith(url);
+ });
+ });
+
+ describe('urlIsRichBlob', () => {
+ it('returns true for md extension', () => {
+ const isRichBlob = RepoService.urlIsRichBlob('url.md');
+
+ expect(isRichBlob).toBeTruthy();
+ });
+
+ it('returns false for js extension', () => {
+ const isRichBlob = RepoService.urlIsRichBlob('url.js');
+
+ expect(isRichBlob).toBeFalsy();
+ });
+ });
+
+ describe('getContent', () => {
+ const params = {};
+ const url = 'url';
+ const requestPromise = Promise.resolve();
+
+ beforeEach(() => {
+ spyOn(RepoService, 'buildParams').and.returnValue(params);
+ spyOn(axios, 'get').and.returnValue(requestPromise);
+ });
+
+ it('calls buildParams and axios.get', () => {
+ const request = RepoService.getContent(url);
+
+ expect(RepoService.buildParams).toHaveBeenCalledWith(url);
+ expect(axios.get).toHaveBeenCalledWith(url, {
+ params,
+ });
+ expect(request).toBe(requestPromise);
+ });
+
+ it('uses object url prop if no url arg is provided', () => {
+ RepoService.url = url;
+
+ RepoService.getContent();
+
+ expect(axios.get).toHaveBeenCalledWith(url, {
+ params,
+ });
+ });
+ });
+
+ describe('getBase64Content', () => {
+ const url = 'url';
+ const response = { data: 'data' };
+
+ beforeEach(() => {
+ spyOn(RepoService, 'bufferToBase64');
+ spyOn(axios, 'get').and.returnValue(Promise.resolve(response));
+ });
+
+ it('calls axios.get and bufferToBase64 on completion', (done) => {
+ const request = RepoService.getBase64Content(url);
+
+ expect(axios.get).toHaveBeenCalledWith(url, {
+ responseType: 'arraybuffer',
+ });
+ expect(request).toEqual(jasmine.any(Promise));
+
+ request.then(() => {
+ expect(RepoService.bufferToBase64).toHaveBeenCalledWith(response.data);
+ done();
+ }).catch(done.fail);
+ });
+ });
+});
diff --git a/spec/javascripts/repo/repo_sidebar_spec.js b/spec/javascripts/repo/repo_sidebar_spec.js
new file mode 100644
index 00000000000..07b3b403976
--- /dev/null
+++ b/spec/javascripts/repo/repo_sidebar_spec.js
@@ -0,0 +1,61 @@
+import Vue from 'vue';
+import RepoStore from '~/repo/repo_store';
+import repoSidebar from '~/repo/repo_sidebar.vue';
+
+describe('RepoSidebar', () => {
+ function createComponent() {
+ const RepoSidebar = Vue.extend(repoSidebar);
+
+ return new RepoSidebar().$mount();
+ }
+
+ it('renders a sidebar', () => {
+ RepoStore.files = [{
+ id: 0,
+ }];
+ const vm = createComponent();
+ const thead = vm.$el.querySelector('thead');
+ const tbody = vm.$el.querySelector('tbody');
+
+ expect(vm.$el.id).toEqual('sidebar');
+ expect(vm.$el.classList.contains('sidebar-mini')).toBeFalsy();
+ expect(thead.querySelector('.name').textContent).toEqual('Name');
+ expect(thead.querySelector('.last-commit').textContent).toEqual('Last Commit');
+ expect(thead.querySelector('.last-update').textContent).toEqual('Last Update');
+ expect(tbody.querySelector('.repo-file-options')).toBeFalsy();
+ expect(tbody.querySelector('.prev-directory')).toBeFalsy();
+ expect(tbody.querySelector('.loading-file')).toBeFalsy();
+ expect(tbody.querySelector('.file')).toBeTruthy();
+ });
+
+ it('does not render a thead, renders repo-file-options and sets sidebar-mini class if isMini', () => {
+ RepoStore.openedFiles = [{
+ id: 0,
+ }];
+ const vm = createComponent();
+
+ expect(vm.$el.classList.contains('sidebar-mini')).toBeTruthy();
+ expect(vm.$el.querySelector('thead')).toBeFalsy();
+ expect(vm.$el.querySelector('tbody .repo-file-options')).toBeTruthy();
+ });
+
+ it('renders 5 loading files if tree is loading and not hasFiles', () => {
+ RepoStore.loading = {
+ tree: true,
+ };
+ RepoStore.files = [];
+ const vm = createComponent();
+
+ expect(vm.$el.querySelectorAll('tbody .loading-file').length).toEqual(5);
+ });
+
+ it('renders a prev directory if isRoot', () => {
+ RepoStore.files = [{
+ id: 0,
+ }];
+ RepoStore.isRoot = true;
+ const vm = createComponent();
+
+ expect(vm.$el.querySelector('tbody .prev-directory')).toBeTruthy();
+ });
+});
diff --git a/spec/javascripts/repo/repo_tab_spec.js b/spec/javascripts/repo/repo_tab_spec.js
new file mode 100644
index 00000000000..97ad412e620
--- /dev/null
+++ b/spec/javascripts/repo/repo_tab_spec.js
@@ -0,0 +1,67 @@
+import Vue from 'vue';
+import repoTab from '~/repo/repo_tab.vue';
+
+describe('RepoTab', () => {
+ function createComponent(propsData) {
+ const RepoTab = Vue.extend(repoTab);
+
+ return new RepoTab({
+ propsData,
+ }).$mount();
+ }
+
+ it('renders a close link and a name link', () => {
+ const tab = {
+ loading: false,
+ url: 'url',
+ name: 'name',
+ };
+ const vm = createComponent({
+ tab,
+ });
+ const close = vm.$el.querySelector('.close');
+ const name = vm.$el.querySelector(`a[title="${tab.url}"]`);
+
+ spyOn(vm, 'xClicked');
+ spyOn(vm, 'tabClicked');
+
+ expect(close.querySelector('.fa-times')).toBeTruthy();
+ expect(name.textContent).toEqual(tab.name);
+
+ close.click();
+ name.click();
+
+ expect(vm.xClicked).toHaveBeenCalledWith(tab);
+ expect(vm.tabClicked).toHaveBeenCalledWith(tab);
+ });
+
+ it('renders a spinner if tab is loading', () => {
+ const tab = {
+ loading: true,
+ url: 'url',
+ };
+ const vm = createComponent({
+ tab,
+ });
+ const close = vm.$el.querySelector('.close');
+ const name = vm.$el.querySelector(`a[title="${tab.url}"]`);
+
+ expect(close).toBeFalsy();
+ expect(name).toBeFalsy();
+ expect(vm.$el.querySelector('.fa.fa-spinner.fa-spin')).toBeTruthy();
+ });
+
+ it('renders an fa-circle icon if tab is changed', () => {
+ const tab = {
+ loading: false,
+ url: 'url',
+ name: 'name',
+ changed: true,
+ };
+ const vm = createComponent({
+ tab,
+ });
+
+ expect(vm.$el.querySelector('.close .fa-circle')).toBeTruthy();
+ });
+});
diff --git a/spec/javascripts/repo/repo_tabs_spec.js b/spec/javascripts/repo/repo_tabs_spec.js
new file mode 100644
index 00000000000..6bf4f0f4498
--- /dev/null
+++ b/spec/javascripts/repo/repo_tabs_spec.js
@@ -0,0 +1,49 @@
+import Vue from 'vue';
+import RepoStore from '~/repo/repo_store';
+import repoTabs from '~/repo/repo_tabs.vue';
+
+describe('RepoTabs', () => {
+ const openedFiles = [{
+ id: 0,
+ active: true,
+ }, {
+ id: 1,
+ }];
+
+ function createComponent() {
+ const RepoTabs = Vue.extend(repoTabs);
+
+ return new RepoTabs().$mount();
+ }
+
+ it('renders a list of tabs', () => {
+ RepoStore.openedFiles = openedFiles;
+ RepoStore.tabsOverflow = true;
+
+ const vm = createComponent();
+ const tabs = [...vm.$el.querySelectorAll(':scope > li')];
+
+ expect(vm.$el.id).toEqual('tabs');
+ expect(vm.$el.classList.contains('overflown')).toBeTruthy();
+ expect(tabs.length).toEqual(2);
+ expect(tabs[0].classList.contains('active')).toBeTruthy();
+ expect(tabs[1].classList.contains('active')).toBeFalsy();
+ });
+
+ it('does not render a tabs list if not isMini', () => {
+ RepoStore.openedFiles = [];
+
+ const vm = createComponent();
+
+ expect(vm.$el.innerHTML).toBeFalsy();
+ });
+
+ it('does not apply overflown class if not tabsOverflow', () => {
+ RepoStore.openedFiles = openedFiles;
+ RepoStore.tabsOverflow = false;
+
+ const vm = createComponent();
+
+ expect(vm.$el.classList.contains('overflown')).toBeFalsy();
+ });
+});
diff --git a/yarn.lock b/yarn.lock
index 98da6a984d1..81d1a3a20dc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -233,6 +233,13 @@ aws4@^1.2.1:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
+axios@^0.16.2:
+ version "0.16.2"
+ resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d"
+ dependencies:
+ follow-redirects "^1.2.3"
+ is-buffer "^1.1.5"
+
babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4"
@@ -887,6 +894,10 @@ block-stream@*:
dependencies:
inherits "~2.0.0"
+bluebird@^2.10.2:
+ version "2.11.0"
+ resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"
+
bluebird@^3.0.5, bluebird@^3.1.1, bluebird@^3.3.0:
version "3.4.7"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3"
@@ -1363,6 +1374,19 @@ cookie@0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
+copy-webpack-plugin@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.0.1.tgz#9728e383b94316050d0c7463958f2b85c0aa8200"
+ dependencies:
+ bluebird "^2.10.2"
+ fs-extra "^0.26.4"
+ glob "^6.0.4"
+ is-glob "^3.1.0"
+ loader-utils "^0.2.15"
+ lodash "^4.3.0"
+ minimatch "^3.0.0"
+ node-dir "^0.1.10"
+
core-js@^2.2.0, core-js@^2.4.0, core-js@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e"
@@ -1523,7 +1547,13 @@ d3@^3.5.11:
version "3.5.11"
resolved "https://registry.yarnpkg.com/d3/-/d3-3.5.11.tgz#d130750eed0554db70e8432102f920a12407b69c"
-d@^0.1.1, d@~0.1.1:
+d@1:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f"
+ dependencies:
+ es5-ext "^0.10.9"
+
+d@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309"
dependencies:
@@ -1561,7 +1591,7 @@ debug@2.6.7:
dependencies:
ms "2.0.0"
-debug@^2.1.0, debug@^2.1.1, debug@^2.2.0:
+debug@^2.1.0, debug@^2.1.1, debug@^2.2.0, debug@^2.4.5:
version "2.6.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b"
dependencies:
@@ -1865,52 +1895,52 @@ error-ex@^1.2.0:
dependencies:
is-arrayish "^0.2.1"
-es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@~0.10.11, es5-ext@~0.10.2, es5-ext@~0.10.7:
- version "0.10.12"
- resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.12.tgz#aa84641d4db76b62abba5e45fd805ecbab140047"
+es5-ext@^0.10.14, es5-ext@^0.10.8, es5-ext@^0.10.9, es5-ext@~0.10.14, es5-ext@~0.10.2:
+ version "0.10.24"
+ resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.24.tgz#a55877c9924bc0c8d9bd3c2cbe17495ac1709b14"
dependencies:
es6-iterator "2"
es6-symbol "~3.1"
-es6-iterator@2:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac"
+es6-iterator@2, es6-iterator@~2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512"
dependencies:
- d "^0.1.1"
- es5-ext "^0.10.7"
- es6-symbol "3"
+ d "1"
+ es5-ext "^0.10.14"
+ es6-symbol "^3.1"
es6-map@^0.1.3:
- version "0.1.4"
- resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.4.tgz#a34b147be224773a4d7da8072794cefa3632b897"
+ version "0.1.5"
+ resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0"
dependencies:
- d "~0.1.1"
- es5-ext "~0.10.11"
- es6-iterator "2"
- es6-set "~0.1.3"
- es6-symbol "~3.1.0"
- event-emitter "~0.3.4"
+ d "1"
+ es5-ext "~0.10.14"
+ es6-iterator "~2.0.1"
+ es6-set "~0.1.5"
+ es6-symbol "~3.1.1"
+ event-emitter "~0.3.5"
es6-promise@^3.0.2, es6-promise@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.0.2.tgz#010d5858423a5f118979665f46486a95c6ee2bb6"
-es6-set@~0.1.3:
- version "0.1.4"
- resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.4.tgz#9516b6761c2964b92ff479456233a247dc707ce8"
+es6-set@~0.1.5:
+ version "0.1.5"
+ resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1"
dependencies:
- d "~0.1.1"
- es5-ext "~0.10.11"
- es6-iterator "2"
- es6-symbol "3"
- event-emitter "~0.3.4"
+ d "1"
+ es5-ext "~0.10.14"
+ es6-iterator "~2.0.1"
+ es6-symbol "3.1.1"
+ event-emitter "~0.3.5"
-es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0:
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa"
+es6-symbol@3, es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@~3.1, es6-symbol@~3.1.1:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
dependencies:
- d "~0.1.1"
- es5-ext "~0.10.11"
+ d "1"
+ es5-ext "~0.10.14"
es6-weak-map@^2.0.1:
version "2.0.1"
@@ -2106,12 +2136,12 @@ eve-raphael@0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/eve-raphael/-/eve-raphael-0.5.0.tgz#17c754b792beef3fa6684d79cf5a47c63c4cda30"
-event-emitter@~0.3.4:
- version "0.3.4"
- resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5"
+event-emitter@~0.3.5:
+ version "0.3.5"
+ resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39"
dependencies:
- d "~0.1.1"
- es5-ext "~0.10.7"
+ d "1"
+ es5-ext "~0.10.14"
event-stream@~3.3.0:
version "3.3.4"
@@ -2355,6 +2385,12 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
+follow-redirects@^1.2.3:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.2.3.tgz#01abaeca85e3609837d9fcda3167a7e42fdaca21"
+ dependencies:
+ debug "^2.4.5"
+
for-in@^0.1.5:
version "0.1.6"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8"
@@ -2395,6 +2431,16 @@ fs-access@^1.0.0:
dependencies:
null-check "^1.0.0"
+fs-extra@^0.26.4:
+ version "0.26.7"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.26.7.tgz#9ae1fdd94897798edab76d0918cf42d0c3184fa9"
+ dependencies:
+ graceful-fs "^4.1.2"
+ jsonfile "^2.1.0"
+ klaw "^1.0.0"
+ path-is-absolute "^1.0.0"
+ rimraf "^2.2.8"
+
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -2488,6 +2534,16 @@ glob@^5.0.15:
once "^1.3.0"
path-is-absolute "^1.0.0"
+glob@^6.0.4:
+ version "6.0.4"
+ resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22"
+ dependencies:
+ inflight "^1.0.4"
+ inherits "2"
+ minimatch "2 || 3"
+ once "^1.3.0"
+ path-is-absolute "^1.0.0"
+
glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
@@ -2770,6 +2826,13 @@ immediate@~3.0.5:
version "3.0.6"
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
+imports-loader@^0.7.1:
+ version "0.7.1"
+ resolved "https://registry.yarnpkg.com/imports-loader/-/imports-loader-0.7.1.tgz#f204b5f34702a32c1db7d48d89d5e867a0441253"
+ dependencies:
+ loader-utils "^1.0.2"
+ source-map "^0.5.6"
+
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
@@ -2862,9 +2925,9 @@ is-binary-path@^1.0.0:
dependencies:
binary-extensions "^1.0.0"
-is-buffer@^1.0.2:
- version "1.1.4"
- resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b"
+is-buffer@^1.0.2, is-buffer@^1.1.5:
+ version "1.1.5"
+ resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc"
is-builtin-module@^1.0.0:
version "1.0.0"
@@ -3246,6 +3309,12 @@ json5@^0.5.0, json5@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
+jsonfile@^2.1.0:
+ version "2.4.0"
+ resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
+ optionalDependencies:
+ graceful-fs "^4.1.6"
+
jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
@@ -3353,6 +3422,12 @@ kind-of@^3.0.2:
dependencies:
is-buffer "^1.0.2"
+klaw@^1.0.0:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439"
+ optionalDependencies:
+ graceful-fs "^4.1.9"
+
latest-version@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-1.0.1.tgz#72cfc46e3e8d1be651e1ebb54ea9f6ea96f374bb"
@@ -3396,7 +3471,7 @@ loader-runner@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"
-loader-utils@^0.2.11, loader-utils@^0.2.16, loader-utils@^0.2.5:
+loader-utils@^0.2.11, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.5:
version "0.2.16"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d"
dependencies:
@@ -3723,6 +3798,10 @@ moment@2.x:
version "2.17.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.17.1.tgz#fed9506063f36b10f066c8b59a144d7faebe1d82"
+monaco-editor@0.8.3:
+ version "0.8.3"
+ resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.8.3.tgz#523bdf2d1524db2c2dfc3cae0a7b6edc48d6dea6"
+
mousetrap@^1.4.6:
version "1.4.6"
resolved "https://registry.yarnpkg.com/mousetrap/-/mousetrap-1.4.6.tgz#eaca72e22e56d5b769b7555873b688c3332e390a"
@@ -3765,6 +3844,12 @@ nested-error-stacks@^1.0.0:
dependencies:
inherits "~2.0.1"
+node-dir@^0.1.10:
+ version "0.1.17"
+ resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5"
+ dependencies:
+ minimatch "^3.0.2"
+
node-ensure@^0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/node-ensure/-/node-ensure-0.0.0.tgz#ecae764150de99861ec5c810fd5d096b183932a7"