summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-08-29 16:55:32 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-08-29 16:55:32 +0200
commita17700800cf475587ab3d0eb6acee91a56b5b40a (patch)
treeb77e8b509dc3118fa1c01034f491188cdca4e272 /js
parent08ddaba792128f801f8dcab1f52e435ef7984bf1 (diff)
add folder drop down
Diffstat (limited to 'js')
-rw-r--r--js/build/app.js28
-rw-r--r--js/controller/NavigationController.js12
-rw-r--r--js/directive/AppNavigationEntryUtils.js4
-rw-r--r--js/gui/KeyboardShortcuts.js6
-rw-r--r--js/service/FeedResource.js9
-rw-r--r--js/tests/unit/controller/NavigationControllerSpec.js6
6 files changed, 37 insertions, 28 deletions
diff --git a/js/build/app.js b/js/build/app.js
index 47cf21bd3..deb23419b 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -382,15 +382,18 @@ var $__build_47_app__ = function () {
var currentId = parseInt($route.current.params.id, 10);
return $route.current && $route.current.$$route.type === FEED_TYPE.FEED && currentId === feedId;
};
+ this.folderNameExists = function (folderName) {
+ return FolderResource.get(folderName) !== undefined;
+ };
+ this.createFolder = function (folderName) {
+ console.log(folderName);
+ };
this.isAddingFolder = function () {
return true;
};
this.createFeed = function (feedUrl, folderId) {
console.log(feedUrl + folderId);
};
- this.createFolder = function (folderName) {
- console.log(folderName);
- };
this.cancelRenameFolder = function (folderId) {
console.log(folderId);
};
@@ -636,21 +639,14 @@ var $__build_47_app__ = function () {
var feed = {
url: url,
folderId: folderId,
- title: title
+ title: title,
+ faviconLink: '../css/loading.gif'
};
if (!this.get(url)) {
this.add(feed);
}
this.updateFolderCache();
- return this.http({
- method: 'POST',
- url: this.BASE_URL + '/feeds',
- data: {
- url: url,
- parentFolderId: folderId,
- title: title
- }
- });
+ console.log(feed);
},
undoDelete: function () {
if (this.deleted) {
@@ -1146,7 +1142,7 @@ var $__build_47_app__ = function () {
'use strict';
var scrollArea = $('#app-content');
var noInputFocused = function (element) {
- return !(element.is('input') && element.is('select') && element.is('textarea') && element.is('checkbox'));
+ return !(element.is('input') || element.is('select') || element.is('textarea') || element.is('checkbox'));
};
var noModifierKey = function (event) {
return !(event.shiftKey || event.altKey || event.ctrlKey || event.metaKey);
@@ -1554,11 +1550,11 @@ var $__build_47_app__ = function () {
var menu = elm.siblings('.app-navigation-entry-menu');
var button = $(elm).find('.app-navigation-entry-utils-menu-button button');
button.click(function () {
- menu.toggle();
+ menu.toggleClass('open');
});
scope.$on('documentClicked', function (scope, event) {
if (event.target !== button[0]) {
- menu.hide();
+ menu.removeClass('open');
}
});
}
diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js
index a848a4b39..d5e159de9 100644
--- a/js/controller/NavigationController.js
+++ b/js/controller/NavigationController.js
@@ -111,6 +111,14 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource,
currentId === feedId;
};
+ this.folderNameExists = (folderName) => {
+ return FolderResource.get(folderName) !== undefined;
+ };
+
+ this.createFolder = (folderName) => {
+ console.log(folderName);
+ };
+
// TBD
this.isAddingFolder = () => {
return true;
@@ -120,10 +128,6 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource,
console.log(feedUrl + folderId);
};
- this.createFolder = (folderName) => {
- console.log(folderName);
- };
-
this.cancelRenameFolder = (folderId) => {
console.log(folderId);
};
diff --git a/js/directive/AppNavigationEntryUtils.js b/js/directive/AppNavigationEntryUtils.js
index 2c7953bd2..146d0f22a 100644
--- a/js/directive/AppNavigationEntryUtils.js
+++ b/js/directive/AppNavigationEntryUtils.js
@@ -24,12 +24,12 @@ app.directive('appNavigationEntryUtils', () => {
.find('.app-navigation-entry-utils-menu-button button');
button.click(() => {
- menu.toggle();
+ menu.toggleClass('open');
});
scope.$on('documentClicked', (scope, event) => {
if (event.target !== button[0]) {
- menu.hide();
+ menu.removeClass('open');
}
});
}
diff --git a/js/gui/KeyboardShortcuts.js b/js/gui/KeyboardShortcuts.js
index 92e34c57c..b5f27e8a0 100644
--- a/js/gui/KeyboardShortcuts.js
+++ b/js/gui/KeyboardShortcuts.js
@@ -20,9 +20,9 @@
const noInputFocused = (element) => {
return !(
- element.is('input') &&
- element.is('select') &&
- element.is('textarea') &&
+ element.is('input') ||
+ element.is('select') ||
+ element.is('textarea') ||
element.is('checkbox')
);
};
diff --git a/js/service/FeedResource.js b/js/service/FeedResource.js
index 1bbb3cbd2..4466b502a 100644
--- a/js/service/FeedResource.js
+++ b/js/service/FeedResource.js
@@ -183,7 +183,8 @@ app.factory('FeedResource', (Resource, $http, BASE_URL) => {
let feed = {
url: url,
folderId: folderId,
- title: title
+ title: title,
+ faviconLink: '../css/loading.gif'
};
if (!this.get(url)) {
@@ -192,7 +193,9 @@ app.factory('FeedResource', (Resource, $http, BASE_URL) => {
this.updateFolderCache();
- return this.http({
+ console.log(feed);
+
+ /*return this.http({
method: 'POST',
url: `${this.BASE_URL}/feeds`,
data: {
@@ -200,7 +203,7 @@ app.factory('FeedResource', (Resource, $http, BASE_URL) => {
parentFolderId: folderId,
title: title
}
- });
+ });*/
}
diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js
index 1cfbb4012..8c646640f 100644
--- a/js/tests/unit/controller/NavigationControllerSpec.js
+++ b/js/tests/unit/controller/NavigationControllerSpec.js
@@ -280,4 +280,10 @@ describe('NavigationController', () => {
}));
+ it('should expose check if folder exists', inject((FolderResource) => {
+ expect(controller.folderNameExists('hi')).toBe(false);
+ FolderResource.add({name: 'hi'});
+ expect(controller.folderNameExists('hi')).toBe(true);
+ }));
+
});