summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-23 20:19:06 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-23 20:19:06 +0200
commit0b22611a929fc317c6ad073d2ddf5f198ee836f3 (patch)
treeca3593e76af10dc6a81ed0412c6d0e6434f73331
parent94e24c1e1a53db60e6924b39ad308b6b2d2e8c2b (diff)
more boilerplate
-rw-r--r--js/build/app.js91
-rw-r--r--js/controller/ContentController.js11
-rw-r--r--js/controller/NavigationController.js7
-rw-r--r--js/directive/NewsAutoFocus.js17
-rw-r--r--js/tests/unit/controller/NavigationControllerSpec.js12
-rw-r--r--templates/main.php12
-rw-r--r--templates/part.addnew.php32
-rw-r--r--templates/part.content.php11
-rw-r--r--templates/part.feed.unread.php22
-rw-r--r--templates/part.settings.php2
10 files changed, 109 insertions, 108 deletions
diff --git a/js/build/app.js b/js/build/app.js
index 180bde700..fe71d10fb 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -199,13 +199,23 @@ var $__build_47_app__ = function () {
this.keepUnread = function (itemId) {
console.log(itemId);
};
+ this.isContentView = function () {
+ console.log('tbd');
+ };
+ this.orderBy = function () {
+ console.log('tbd');
+ };
+ this.getRelativeDate = function (timestamp) {
+ console.log(timestamp);
+ };
}
]);
app.controller('NavigationController', [
'FeedResource',
'FolderResource',
'ItemResource',
- function (FeedResource, FolderResource, ItemResource) {
+ 'SettingsResource',
+ function (FeedResource, FolderResource, ItemResource, SettingsResource) {
'use strict';
this.getFeeds = function () {
return FeedResource.getAll();
@@ -234,6 +244,9 @@ var $__build_47_app__ = function () {
ItemResource.markRead();
FeedResource.markRead();
};
+ this.isShowAll = function () {
+ return SettingsResource.get('showAll');
+ };
this.createFeed = function () {
console.log('TBD');
};
@@ -882,22 +895,6 @@ var $__build_47_app__ = function () {
}
});
}(window, document, jQuery));
- (function (window, document, $) {
- 'use strict';
- $(document).ready(function () {
- var buttons = $(':not([data-app-slide-toggle-area=""])');
- $(document).click(function (event) {
- buttons.each(function (index, button) {
- console.log(button);
- var area = $(button).data('app-slide-toggle-area');
- if (button === event.target) {
- console.log(area);
- event.stopPropagation();
- }
- });
- });
- });
- }(window, document, jQuery));
var call = Function.prototype.call.bind(Function.prototype.call);
var hasOwn = Object.prototype.hasOwnProperty;
window.items = function (obj) {
@@ -1161,6 +1158,12 @@ var $__build_47_app__ = function () {
writable: true
}), $__2;
};
+ app.directive('newsAutoFocus', function () {
+ 'use strict';
+ return function (scope, elem, attrs) {
+ $(attrs.newsAutofocus).focus();
+ };
+ });
app.directive('newsBindHtmlUnsafe', function () {
'use strict';
return function (scope, elem, attr) {
@@ -1276,60 +1279,6 @@ var $__build_47_app__ = function () {
};
}
]);
- app.directive('newsSlideUp', [
- '$rootScope',
- '$document',
- function ($rootScope, $document) {
- 'use strict';
- return function (scope, elem, attr) {
- var slideArea = elem;
- var cssClass = false;
- var options = scope.$eval(attr.newsSlideUp);
- if (options) {
- if (options.selector) {
- slideArea = $(options.selector);
- }
- if (options.cssClass) {
- cssClass = options.cssClass;
- }
- if (options.hideOnFocusLost) {
- $($document[0].body).click(function () {
- $rootScope.$broadcast('newsSlideUp');
- });
- $rootScope.$on('newsSlideUp', function (scope, params) {
- if (params !== slideArea && slideArea.is(':visible') && !slideArea.is(':animated')) {
- slideArea.slideUp();
- if (cssClass) {
- elem.removeClass(cssClass);
- }
- }
- });
- slideArea.click(function (event) {
- $rootScope.$broadcast('newsSlideUp', slideArea);
- event.stopPropagation();
- });
- elem.click(function (event) {
- $rootScope.$broadcast('newsSlideUp', slideArea);
- event.stopPropagation();
- });
- }
- }
- elem.click(function () {
- if (slideArea.is(':visible') && !slideArea.is(':animated')) {
- slideArea.slideUp();
- if (cssClass) {
- elem.removeClass(cssClass);
- }
- } else {
- slideArea.slideDown();
- if (cssClass) {
- elem.addClass(cssClass);
- }
- }
- });
- };
- }
- ]);
app.directive('newsTooltip', function () {
'use strict';
return function (scope, elem) {
diff --git a/js/controller/ContentController.js b/js/controller/ContentController.js
index 9edac534f..9258b3f11 100644
--- a/js/controller/ContentController.js
+++ b/js/controller/ContentController.js
@@ -37,4 +37,15 @@ function (Publisher, FeedResource, ItemResource, data) {
console.log(itemId);
};
+ this.isContentView = () => {
+ console.log('tbd');
+ };
+
+ this.orderBy = () => {
+ console.log('tbd');
+ };
+
+ this.getRelativeDate = (timestamp) => {
+ console.log(timestamp);
+ };
}); \ No newline at end of file
diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js
index 299d433da..08443191b 100644
--- a/js/controller/NavigationController.js
+++ b/js/controller/NavigationController.js
@@ -8,7 +8,7 @@
* @copyright Bernhard Posselt 2014
*/
app.controller('NavigationController',
-function (FeedResource, FolderResource, ItemResource) {
+function (FeedResource, FolderResource, ItemResource, SettingsResource) {
'use strict';
this.getFeeds = () => {
@@ -37,6 +37,10 @@ function (FeedResource, FolderResource, ItemResource) {
FeedResource.markRead();
};
+ this.isShowAll = () => {
+ return SettingsResource.get('showAll');
+ };
+
// TBD
this.createFeed = () => {
console.log('TBD');
@@ -74,4 +78,5 @@ function (FeedResource, FolderResource, ItemResource) {
console.log('TBD');
};
+
}); \ No newline at end of file
diff --git a/js/directive/NewsAutoFocus.js b/js/directive/NewsAutoFocus.js
new file mode 100644
index 000000000..a66f4453c
--- /dev/null
+++ b/js/directive/NewsAutoFocus.js
@@ -0,0 +1,17 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2014
+ */
+app.directive('newsAutoFocus', () => {
+ 'use strict';
+
+ return (scope, elem, attrs) => {
+ $(attrs.newsAutofocus).focus();
+ };
+
+}); \ No newline at end of file
diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js
index 4d4e4bb10..653dfea26 100644
--- a/js/tests/unit/controller/NavigationControllerSpec.js
+++ b/js/tests/unit/controller/NavigationControllerSpec.js
@@ -100,4 +100,16 @@ describe('NavigationController', () => {
expect(FeedResource.markRead).toHaveBeenCalled();
expect(ItemResource.markRead).toHaveBeenCalled();
}));
+
+
+ it('should mark all read', inject((SettingsResource, $controller) => {
+ let ctrl = $controller('NavigationController', {
+ SettingsResource: SettingsResource,
+ });
+
+ SettingsResource.set('showAll', true);
+
+ expect(ctrl.isShowAll()).toBe(true);
+
+ }));
}); \ No newline at end of file
diff --git a/templates/main.php b/templates/main.php
index ad0d0a6ed..ffbdb1a9a 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -22,11 +22,11 @@
<div id="global-loading" class="icon-loading" ng-show="App.loading.isLoading('global')"></div>
<!-- navigation -->
- <div id="app-navigation" ng-controller="NavigationController" ng-hide="App.loading.isLoading('global')">
+ <div id="app-navigation" ng-controller="NavigationController as Navigation" ng-hide="App.loading.isLoading('global')">
<ul class="with-icon" data-folder-id="0" news-droppable>
- <?php //print_unescaped($this->inc('part.addnew')) ?>
- <?php //print_unescaped($this->inc('part.feed.unread')) ?>
+ <?php print_unescaped($this->inc('part.addnew')) ?>
+ <?php print_unescaped($this->inc('part.feed.unread')) ?>
<?php //print_unescaped($this->inc('part.feed.starred')) ?>
<?php //print_unescaped($this->inc('part.listfeed', ['folderId' => '0'])) ?>
<?php //print_unescaped($this->inc('part.listfolder')) ?>
@@ -41,6 +41,10 @@
<!-- content -->
<script type="text/ng-template" id="content.html"><?php print_unescaped($this->inc('part.content')) ?></script>
- <div id="app-content" ng-class="{'icon-loading': App.loading.isLoading('content')}" ng-hide="App.loading.isLoading('global')" ng-view></div>
+ <div id="app-content"
+ ng-class="{'icon-loading': App.loading.isLoading('content')}"
+ ng-hide="App.loading.isLoading('global')"
+ ng-view
+ tabindex="-1"></div>
</div>
diff --git a/templates/part.addnew.php b/templates/part.addnew.php
index a6f525262..69ca47810 100644
--- a/templates/part.addnew.php
+++ b/templates/part.addnew.php
@@ -1,10 +1,6 @@
<li class="add-new">
<a class="list-title list-title-with-icon"
- oc-click-slide-toggle="{
- selector: '.add-new-popup',
- hideOnFocusLost: true,
- cssClass: 'opened'
- }"
+ data-apps-slide-toggle=".add-new-popup"
href="#"
oc-click-focus="{
selector: '.add-new-popup input[ng-model=feedUrl]'
@@ -12,7 +8,7 @@
>+ <span><?php p($l->t('Add Website'))?></span></a>
<div class="add-new-popup">
-
+
<fieldset class="personalblock">
<p class="error" ng-show="feedExistsError || folderExistsError">
<span ng-show="feedExistsError">
@@ -24,43 +20,43 @@
</p>
<form>
- <input type="text"
- ng-model="feedUrl"
- placeholder="<?php p($l->t('Address')); ?>"
+ <input type="text"
+ ng-model="feedUrl"
+ placeholder="<?php p($l->t('Address')); ?>"
name="adress"
autofocus>
- <button title="<?php p($l->t('Add')); ?>"
+ <button title="<?php p($l->t('Add')); ?>"
class="primary"
ng-disabled="!feedUrl.trim()"
ng-click="addFeed(feedUrl, folderId.id)"><?php p($l->t('Add')); ?></button>
</form>
<form>
- <select name="folder"
+ <select name="folder"
data-create="<?php p($l->t('New folder')); ?>"
- title="<?php p($l->t('Folder')); ?>"
+ title="<?php p($l->t('Folder')); ?>"
ng-model="folderId"
ng-options="folder.name for folder in folderBusinessLayer.getAll()"
ng-hide="addNewFolder">
<option value="" selected="selected"><?php p($l->t('Choose folder')); ?></option>
</select>
- <button title="<?php p($l->t('New folder')); ?>"
+ <button title="<?php p($l->t('New folder')); ?>"
ng-click="addNewFolder=true"
ng-hide="addNewFolder"
class="action-button new-button action"
oc-click-focus="{selector: 'input[name=\'foldername\']'}"></button>
- <input type="text"
- ng-model="folderName"
+ <input type="text"
+ ng-model="folderName"
ng-show="addNewFolder"
name="foldername"
- placeholder="<?php p($l->t('Folder name')); ?>"
+ placeholder="<?php p($l->t('Folder name')); ?>"
autofocus
class="folder-input"
ui-keyup="{13: 'addFolder(folderName)'}"/>
- <button title="<?php p($l->t('Back to folder selection')); ?>"
+ <button title="<?php p($l->t('Back to folder selection')); ?>"
ng-show="addNewFolder"
ng-click="addNewFolder=false"
class="action-button back-button action"></button>
- <button title="<?php p($l->t('Create folder')); ?>"
+ <button title="<?php p($l->t('Create folder')); ?>"
ng-show="addNewFolder"
ng-click="addFolder(folderName)"
ng-disabled="!folderName.trim()"
diff --git a/templates/part.content.php b/templates/part.content.php
index d3a59b08c..eaf8d925a 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -1,3 +1,12 @@
<div id="first-run" ng-if="App.isFirstRun()">
<h1><?php p($l->t('Welcome to the ownCloud News app!')) ?></h1>
-</div> \ No newline at end of file
+</div>
+
+<div news-auto-focus="#app-content" ng-if="!App.isFirstRun()">
+ <ul ng-if="isCompactView()">
+
+ </ul>
+ <ul ng-if="!isCompactView()">
+
+ </ul>
+</div>
diff --git a/templates/part.feed.unread.php b/templates/part.feed.unread.php
index 2fe2eda0c..049332002 100644
--- a/templates/part.feed.unread.php
+++ b/templates/part.feed.unread.php
@@ -1,28 +1,26 @@
<li ng-class="{
active: subscriptionsBusinessLayer.isActive(0),
unread: getTotalUnreadCount() > 0
- }"
+ }"
ng-show="subscriptionsBusinessLayer.isVisible(0)">
- <a class="rss-icon"
- href="#"
- ui-if="!feedBusinessLayer.isShowAll()"
- ng-click="subscriptionsBusinessLayer.load(0)"
- oc-click-focus="{selector: '#app-content'}">
+
+ <a class="rss-icon" href="#/items" ng-if="!Navigation.isShowAll()">
<?php p($l->t('Unread articles'))?>
</a>
- <a class="rss-icon"
- href="#"
- ui-if="feedBusinessLayer.isShowAll()"
- ng-click="subscriptionsBusinessLayer.load(0)"
- oc-click-focus="{selector: '#app-content'}">
+
+ <a class="rss-icon" href="#/items" ng-if="Navigation.isShowAll()">
<?php p($l->t('All articles'))?>
</a>
+
+ <div class="utils">
+
+ </div>
<span class="utils">
<span class="unread-counter"
ng-show="getTotalUnreadCount() > 0">
{{ unreadCountFormatter(getTotalUnreadCount()) }}
</span>
- <button class="svg action mark-read-icon"
+ <button class="svg action mark-read-icon"
ng-click="subscriptionsBusinessLayer.markRead()"
title="<?php p($l->t('Mark read')) ?>"
ng-show="getTotalUnreadCount() > 0"
diff --git a/templates/part.settings.php b/templates/part.settings.php
index 4ad4874f3..cfef921f9 100644
--- a/templates/part.settings.php
+++ b/templates/part.settings.php
@@ -1,7 +1,7 @@
<div id="app-settings-header">
<button name="app settings"
class="settings-button"
- data-apps-slide-up-area="#app-settings-content"></button>
+ data-apps-slide-toggle="#app-settings-content"></button>
</div>
<div id="app-settings-content">