From 9a18655966524005da044bcb91aa6eda06a048e1 Mon Sep 17 00:00:00 2001 From: "David I. Samudio" Date: Mon, 17 Jul 2017 11:28:11 -0400 Subject: [PATCH 1/3] Initial template for Searcher actions --- src/pastebin/pastebin.html | 9 +++++++++ src/searcher/searcher-container.css | 0 src/searcher/searcher-container.html | 12 ++++++++++++ src/searcher/searcher-container.js | 10 ++++++++++ src/searcher/searcher.js | 4 ++++ 5 files changed, 35 insertions(+) create mode 100644 src/searcher/searcher-container.css create mode 100644 src/searcher/searcher-container.html create mode 100644 src/searcher/searcher-container.js diff --git a/src/pastebin/pastebin.html b/src/pastebin/pastebin.html index 12a5c274..1db89c4a 100644 --- a/src/pastebin/pastebin.html +++ b/src/pastebin/pastebin.html @@ -16,6 +16,7 @@ +
@@ -61,6 +62,11 @@ Debug +
@@ -71,6 +77,9 @@
+
+ +
diff --git a/src/searcher/searcher-container.css b/src/searcher/searcher-container.css new file mode 100644 index 00000000..e69de29b diff --git a/src/searcher/searcher-container.html b/src/searcher/searcher-container.html new file mode 100644 index 00000000..4fa095b4 --- /dev/null +++ b/src/searcher/searcher-container.html @@ -0,0 +1,12 @@ + diff --git a/src/searcher/searcher-container.js b/src/searcher/searcher-container.js new file mode 100644 index 00000000..a6352060 --- /dev/null +++ b/src/searcher/searcher-container.js @@ -0,0 +1,10 @@ +/** + * Created by DavidIgnacio on 7/17/2017. + */ +export class SearcherContainer{ + + attached(){ + + } + +} diff --git a/src/searcher/searcher.js b/src/searcher/searcher.js index 63ee9264..f2a60e77 100644 --- a/src/searcher/searcher.js +++ b/src/searcher/searcher.js @@ -3,9 +3,11 @@ */ import {customElement} from 'aurelia-framework'; import {draggable} from 'jquery-ui'; +import {SearcherContainer} from './searcher-container'; @customElement('pastebin') export class Searcher { + searcherContainer = null; searcherSelector = "#searcher"; isFirstSearch = true; searcherQueryDefaultHeight = 38; @@ -24,6 +26,7 @@ export class Searcher { constructor(eventAggregator, firebaseManager) { this.eventAggregator = eventAggregator; this.firebaseManager = firebaseManager; + this.searcherContainer = new SearcherContainer(); } // storing hashes in Firebase, hence normal strings cannot be indexes. null, undefined throw errors @@ -39,6 +42,7 @@ export class Searcher { }; attached() { + this.searcherContainer.attached(); this.metagsURLsFirebase = this.firebaseManager.makePastebinMetagsURLsFirebase(); this.globalMetagsURLsFirebase = this.firebaseManager.makeGlobalMetagsURLsFirebase(); From 85ebe5ad04e909d8b52ec523f82555c7e65a2ec9 Mon Sep 17 00:00:00 2001 From: "David I. Samudio" Date: Mon, 17 Jul 2017 11:57:57 -0400 Subject: [PATCH 2/3] Basic URL data shown in container --- src/searcher/searcher-container.html | 2 +- src/searcher/searcher-container.js | 9 ++++++++- src/searcher/searcher.js | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/searcher/searcher-container.html b/src/searcher/searcher-container.html index 4fa095b4..621b6fa6 100644 --- a/src/searcher/searcher-container.html +++ b/src/searcher/searcher-container.html @@ -4,7 +4,7 @@
-
    +
      diff --git a/src/searcher/searcher-container.js b/src/searcher/searcher-container.js index a6352060..c3402d92 100644 --- a/src/searcher/searcher-container.js +++ b/src/searcher/searcher-container.js @@ -3,8 +3,15 @@ */ export class SearcherContainer{ + constructor(firebaseManager){ + this.firebaseManager = firebaseManager; + } attached(){ - + let firebaseURLs = this.firebaseManager.makePastebinMetagsURLsFirebase(); + firebaseURLs.on("child_added", function(snapshot){ + let data = snapshot.val(); + $("#urlList").append(`
    • ${JSON.stringify(data)}/li>`); + }); } } diff --git a/src/searcher/searcher.js b/src/searcher/searcher.js index f2a60e77..c30aab13 100644 --- a/src/searcher/searcher.js +++ b/src/searcher/searcher.js @@ -26,7 +26,7 @@ export class Searcher { constructor(eventAggregator, firebaseManager) { this.eventAggregator = eventAggregator; this.firebaseManager = firebaseManager; - this.searcherContainer = new SearcherContainer(); + this.searcherContainer = new SearcherContainer(firebaseManager); } // storing hashes in Firebase, hence normal strings cannot be indexes. null, undefined throw errors From 9544029862c1a52d25bb4f8b4359a5f260ea8bb3 Mon Sep 17 00:00:00 2001 From: "David I. Samudio" Date: Mon, 17 Jul 2017 12:04:06 -0400 Subject: [PATCH 3/3] now showing global URLs rather than the current pastebin --- src/persistence/firebase-manager.js | 2 +- src/searcher/searcher-container.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/persistence/firebase-manager.js b/src/persistence/firebase-manager.js index f2170e93..1aaa902b 100644 --- a/src/persistence/firebase-manager.js +++ b/src/persistence/firebase-manager.js @@ -63,7 +63,7 @@ export class FirebaseManager { return new Firebase(`${this.baseURL}/${pastebinId}/metags/urls`); } - makeGlobalMetagsURLsFirebase(pastebinId = this.pastebinId) { + makeGlobalMetagsURLsFirebase() { return new Firebase(`${this.baseURL}/metags/urls`); } diff --git a/src/searcher/searcher-container.js b/src/searcher/searcher-container.js index c3402d92..af0f1d7c 100644 --- a/src/searcher/searcher-container.js +++ b/src/searcher/searcher-container.js @@ -7,10 +7,10 @@ export class SearcherContainer{ this.firebaseManager = firebaseManager; } attached(){ - let firebaseURLs = this.firebaseManager.makePastebinMetagsURLsFirebase(); + let firebaseURLs = this.firebaseManager.makeGlobalMetagsURLsFirebase(); firebaseURLs.on("child_added", function(snapshot){ let data = snapshot.val(); - $("#urlList").append(`
    • ${JSON.stringify(data)}/li>`); + $("#urlList").append(`
    • ${JSON.stringify(data)}
    • `); }); }