Commit eac230ce authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Removed queries from vue implementor constructors

parent 358c7359
...@@ -11,15 +11,26 @@ import Store from './repo_store'; ...@@ -11,15 +11,26 @@ import Store from './repo_store';
import Helper from './repo_helper'; import Helper from './repo_helper';
$(() => { $(() => {
const url = document.getElementById('ide').dataset.url; const ide = document.getElementById('ide');
const tabs = document.getElementById('tabs');
const sidebar = document.getElementById('sidebar');
const fileButtons = document.getElementById('repo-file-buttons');
const editButton = document.getElementById('editable-mode');
const commitSection = document.getElementById('commit-area');
const binaryViewer = document.getElementById('binary-viewer');
const url = ide.dataset.url;
Store.service = Service; Store.service = Service;
Store.service.url = url; Store.service.url = url;
Store.tabs = new Tabs();
Store.sidebar = new Sidebar(url); Store.tabs = new Tabs(tabs);
Store.editor = new Editor(); Store.sidebar = new Sidebar(sidebar);
Store.buttons = new FileButtons(); Store.editor = new Editor(ide);
Store.editButton = new EditButton(); Store.buttons = new FileButtons(fileButtons);
Store.commitSection = new CommitSection(); Store.editButton = new EditButton(editButton);
Store.binaryViewer = new BinaryViewer(); Store.commitSection = new CommitSection(commitSection);
Store.binaryViewer = new BinaryViewer(binaryViewer);
Helper.getContent(); Helper.getContent();
}); });
...@@ -3,13 +3,13 @@ import Store from './repo_store'; ...@@ -3,13 +3,13 @@ import Store from './repo_store';
import RepoHelper from './repo_helper'; import RepoHelper from './repo_helper';
export default class RepoBinaryViewer { export default class RepoBinaryViewer {
constructor() { constructor(el) {
this.initVue(); this.initVue(el);
} }
initVue() { initVue(el) {
this.vue = new Vue({ this.vue = new Vue({
el: '#binary-viewer', el,
data: () => Store, data: () => Store,
......
...@@ -2,14 +2,13 @@ import Vue from 'vue'; ...@@ -2,14 +2,13 @@ import Vue from 'vue';
import Store from './repo_store'; import Store from './repo_store';
export default class RepoCommitSection { export default class RepoCommitSection {
constructor() { constructor(el) {
this.initVue(); this.initVue(el);
this.el = document.getElementById('commit-area');
} }
initVue() { initVue(el) {
this.vue = new Vue({ this.vue = new Vue({
el: '#commit-area', el,
data: () => Store, data: () => Store,
computed: { computed: {
......
...@@ -2,14 +2,13 @@ import Vue from 'vue'; ...@@ -2,14 +2,13 @@ import Vue from 'vue';
import Store from './repo_store'; import Store from './repo_store';
export default class RepoEditButton { export default class RepoEditButton {
constructor() { constructor(el) {
this.initVue(); this.initVue(el);
this.el = document.getElementById('editable-mode');
} }
initVue() { initVue(el) {
this.vue = new Vue({ this.vue = new Vue({
el: '#editable-mode', el,
data: () => Store, data: () => Store,
computed: { computed: {
buttonLabel() { buttonLabel() {
......
...@@ -5,9 +5,9 @@ import Helper from './repo_helper'; ...@@ -5,9 +5,9 @@ import Helper from './repo_helper';
import monacoLoader from './monaco_loader'; import monacoLoader from './monaco_loader';
export default class RepoEditor { export default class RepoEditor {
constructor() { constructor(el) {
this.initMonaco(); this.initMonaco();
this.el = document.getElementById('ide'); this.el = el;
} }
addMonacoEvents() { addMonacoEvents() {
...@@ -38,13 +38,12 @@ export default class RepoEditor { ...@@ -38,13 +38,12 @@ export default class RepoEditor {
initVue() { initVue() {
const self = this; const self = this;
const monacoEditor = this.monacoEditor;
this.vue = new Vue({ this.vue = new Vue({
data: () => Store, data: () => Store,
created() { created() {
this.showHide(); this.showHide();
if (this.blobRaw !== '') { if (this.blobRaw !== '') {
monacoEditor.setModel( self.monacoEditor.setModel(
monaco.editor.createModel( monaco.editor.createModel(
this.blobRaw, this.blobRaw,
'plain', 'plain',
......
...@@ -4,15 +4,13 @@ import Helper from './repo_helper'; ...@@ -4,15 +4,13 @@ import Helper from './repo_helper';
import RepoMiniMixin from './repo_mini_mixin'; import RepoMiniMixin from './repo_mini_mixin';
export default class RepoFileButtons { export default class RepoFileButtons {
constructor(url) { constructor(el) {
this.url = url; this.initVue(el);
this.initVue();
this.el = document.getElementById('repo-file-buttons');
} }
initVue() { initVue(el) {
this.vue = new Vue({ this.vue = new Vue({
el: '#repo-file-buttons', el,
data: () => Store, data: () => Store,
mixins: [RepoMiniMixin], mixins: [RepoMiniMixin],
template: ` template: `
......
...@@ -9,15 +9,13 @@ import RepoLoadingFile from './repo_loading_file'; ...@@ -9,15 +9,13 @@ import RepoLoadingFile from './repo_loading_file';
import RepoMiniMixin from './repo_mini_mixin'; import RepoMiniMixin from './repo_mini_mixin';
export default class RepoSidebar { export default class RepoSidebar {
constructor(url) { constructor(el) {
this.url = url; this.initVue(el);
this.initVue();
this.el = document.getElementById('ide');
} }
initVue() { initVue(el) {
this.vue = new Vue({ this.vue = new Vue({
el: '#sidebar', el,
mixins: [RepoMiniMixin], mixins: [RepoMiniMixin],
components: { components: {
'repo-file-options': RepoFileOptions, 'repo-file-options': RepoFileOptions,
......
...@@ -4,14 +4,14 @@ import RepoTab from './repo_tab'; ...@@ -4,14 +4,14 @@ import RepoTab from './repo_tab';
import RepoMiniMixin from './repo_mini_mixin'; import RepoMiniMixin from './repo_mini_mixin';
export default class RepoTabs { export default class RepoTabs {
constructor() { constructor(el) {
RepoTabs.styleTabsForWindows(); RepoTabs.styleTabsForWindows();
this.initVue(); this.initVue(el);
} }
initVue() { initVue(el) {
this.vue = new Vue({ this.vue = new Vue({
el: '#tabs', el,
mixins: [RepoMiniMixin], mixins: [RepoMiniMixin],
components: { components: {
'repo-tab': RepoTab, 'repo-tab': RepoTab,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment