summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appinfo/info.xml2
-rw-r--r--controller/pagecontroller.php12
-rw-r--r--templates/index.php (renamed from templates/main.php)37
-rw-r--r--templates/part.content.compact.php0
-rw-r--r--templates/part.content.expand.php58
-rw-r--r--templates/part.content.php66
-rw-r--r--templates/part.items.php84
-rw-r--r--templates/part.navigation.addfeed.php (renamed from templates/part.addfeed.php)0
-rw-r--r--templates/part.navigation.addfolder.php (renamed from templates/part.addfolder.php)0
-rw-r--r--templates/part.navigation.feed.php (renamed from templates/part.listfeed.php)0
-rw-r--r--templates/part.navigation.folder.php (renamed from templates/part.listfolder.php)2
-rw-r--r--templates/part.navigation.starredfeed.php (renamed from templates/part.feed.starred.php)0
-rw-r--r--templates/part.navigation.unreadfeed.php (renamed from templates/part.feed.unread.php)0
-rw-r--r--templates/part.undo.php7
-rw-r--r--tests/unit/controller/PageControllerTest.php12
15 files changed, 95 insertions, 185 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 8d27eed3a..3d8132c0b 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -6,5 +6,5 @@
<licence>AGPL</licence>
<author>Alessandro Cosentino, Bernhard Posselt, Jan-Christoph Borchardt. Powered by SimplePie (Ryan Parman, Geoffrey Sneddon, Ryan McCue and contributors).</author>
<version>2.002</version>
- <require>6</require>
+ <require>7.80</require>
</info>
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php
index 3fa9f88b8..27377eab4 100644
--- a/controller/pagecontroller.php
+++ b/controller/pagecontroller.php
@@ -26,10 +26,10 @@ class PageController extends Controller {
private $l10n;
private $userId;
- public function __construct($appName,
- IRequest $request,
+ public function __construct($appName,
+ IRequest $request,
IConfig $settings,
- IL10N $l10n,
+ IL10N $l10n,
$userId){
parent::__construct($appName, $request);
$this->settings = $settings;
@@ -43,7 +43,7 @@ class PageController extends Controller {
* @NoCSRFRequired
*/
public function index() {
- return new TemplateResponse($this->appName, 'main');
+ return new TemplateResponse($this->appName, 'index');
}
@@ -74,9 +74,9 @@ class PageController extends Controller {
*/
public function updateSettings($showAll, $compact, $preventReadOnScroll, $oldestFirst) {
$settings = ['showAll', 'compact', 'preventReadOnScroll', 'oldestFirst'];
-
+
foreach ($settings as $setting) {
- $this->settings->setUserValue($this->userId, $this->appName,
+ $this->settings->setUserValue($this->userId, $this->appName,
$setting, ${$setting});
}
}
diff --git a/templates/main.php b/templates/index.php
index f1ee191a4..0413227b0 100644
--- a/templates/main.php
+++ b/templates/index.php
@@ -1,16 +1,16 @@
<?php
-\OCP\Util::addScript('news', 'vendor/traceur-runtime/traceur-runtime.min');
-\OCP\Util::addScript('news', 'vendor/angular/angular.min');
-\OCP\Util::addScript('news', 'vendor/angular-route/angular-route.min');
-\OCP\Util::addScript('news', 'vendor/angular-sanitize/angular-sanitize.min');
-\OCP\Util::addScript('news', 'vendor/angular-animate/angular-animate.min');
-\OCP\Util::addScript('news', 'vendor/momentjs/min/moment-with-locales.min');
-\OCP\Util::addScript('news', 'build/app.min');
-
-\OCP\Util::addStyle('news', 'app');
-\OCP\Util::addStyle('news', 'navigation');
-\OCP\Util::addStyle('news', 'content');
-\OCP\Util::addStyle('news', 'settings');
+script('news', 'vendor/traceur-runtime/traceur-runtime.min');
+script('news', 'vendor/angular/angular.min');
+script('news', 'vendor/angular-route/angular-route.min');
+script('news', 'vendor/angular-sanitize/angular-sanitize.min');
+script('news', 'vendor/angular-animate/angular-animate.min');
+script('news', 'vendor/momentjs/min/moment-with-locales.min');
+script('news', 'build/app.min');
+
+style('news', 'app');
+style('news', 'navigation');
+style('news', 'content');
+style('news', 'settings');
?>
@@ -23,12 +23,12 @@
<news-title-unread-count unread-count="{{ Navigation.getUnreadCount() }}"></news-title-unread-count>
<ul class="with-icon" data-folder-id="0" news-droppable>
- <?php print_unescaped($this->inc('part.addfeed')) ?>
- <?php print_unescaped($this->inc('part.addfolder')) ?>
- <?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')) ?>
+ <?php print_unescaped($this->inc('part.navigation.addfeed')) ?>
+ <?php print_unescaped($this->inc('part.navigation.addfolder')) ?>
+ <?php print_unescaped($this->inc('part.navigation.unreadfeed')) ?>
+ <?php print_unescaped($this->inc('part.navigation.starredfeed')) ?>
+ <?php print_unescaped($this->inc('part.navigation.feed', ['folderId' => '0'])) ?>
+ <?php print_unescaped($this->inc('part.navigation.folder')) ?>
</ul>
<!-- settings -->
@@ -50,6 +50,7 @@
ng-hide="App.loading.isLoading('global')"
ng-view
tabindex="-1"
+ news-auto-focus
news-scroll
news-scroll-enabled-auto-page="Content.autoPagingEnabled()"
news-scroll-enabled-mark-read="Content.markReadEnabled()"
diff --git a/templates/part.content.compact.php b/templates/part.content.compact.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/templates/part.content.compact.php
diff --git a/templates/part.content.expand.php b/templates/part.content.expand.php
new file mode 100644
index 000000000..15209dca7
--- /dev/null
+++ b/templates/part.content.expand.php
@@ -0,0 +1,58 @@
+<li class="item"
+ ng-repeat="item in Content.getItems() | orderBy:[Content.orderBy()] track by item.id"
+ ng-click="Content.markRead(item.id)"
+ ng-class="{read: !item.unread}"
+ data-id="{{ item.id }}">
+
+ <h2 class="date">
+ <span class="timeago" title="{{ item.pubDate*1000|date:'dd-MM-yyyy' }}">
+ {{ Content.getRelativeDate(item.pubDate) }}
+ </span>
+ </h2>
+
+ <button class="star svg"
+ ng-click="Content.toggleStar(item.id)"
+ ng-class="{
+ 'starred': item.starred
+ }"></button>
+
+ <h1 class="title">
+ <a target="_blank" ng-href="{{ item.url }}">
+ {{ item.title }}
+ </a>
+ </h1>
+
+ <h2 class="author">
+ <span>
+ <?php p($l->t('from')) ?>
+ <a ng-href="#/items/feeds/{{ item.feedId }}"
+ class="from_feed">{{ Content.getFeed(item.feedId).title }}</a>
+ </span>
+ <span ng-show="item.author">
+ <?php p($l->t('by')) ?>
+ {{ item.author }}
+ </span>
+ </h2>
+
+ <div class="enclosure" ng-if="item.enclosureLink">
+ <news-audio type="{{ item.enclosureType }}"
+ ng-src="{{ item.enclosureLink|trustUrl }}">
+ <?php p($l->t('Download')) ?>
+ </news-audio>
+ </div>
+
+
+ <div class="body" news-bind-html-unsafe="item.body"></div>
+
+ <div class="bottom-utils">
+ <ul>
+ <li ng-click="Content.toggleKeepUnread(item.id)">
+ <label for="keep-unread">
+ <input type="checkbox" name="keep-unread" ng-checked="item.keepUnread"/>
+ <?php p($l->t('Keep unread')); ?>
+ </label>
+ </li>
+ </ul>
+ </div>
+</li>
+
diff --git a/templates/part.content.php b/templates/part.content.php
index 5b1bcd246..251a01772 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -2,70 +2,12 @@
<h1><?php p($l->t('Welcome to the ownCloud News app!')) ?></h1>
</div>
-<div news-auto-focus="#app-content" ng-if="!App.isFirstRun()">
- <!-- compact view -->
- <ul ng-if="Content.isCompactView()" class="compact">
-
+<div ng-if="!App.isFirstRun()">
+ <ul ng-if="Content.isCompactView()">
+ <?php print_unescaped($this->inc('part.content.compact')); ?>
</ul>
- <!-- full view -->
<ul ng-if="!Content.isCompactView()">
- <li class="item"
- ng-repeat="item in Content.getItems() | orderBy:[Content.orderBy()] track by item.id"
- ng-click="Content.markRead(item.id)"
- ng-class="{read: !item.unread}"
- data-id="{{ item.id }}">
-
- <h2 class="date">
- <span class="timeago" title="{{ item.pubDate*1000|date:'dd-MM-yyyy' }}">
- {{ Content.getRelativeDate(item.pubDate) }}
- </span>
- </h2>
-
- <button class="star svg"
- ng-click="Content.toggleStar(item.id)"
- ng-class="{
- 'starred': item.starred
- }"></button>
-
- <h1 class="title">
- <a target="_blank" ng-href="{{ item.url }}">
- {{ item.title }}
- </a>
- </h1>
-
- <h2 class="author">
- <span>
- <?php p($l->t('from')) ?>
- <a ng-href="#/items/feeds/{{ item.feedId }}"
- class="from_feed">{{ Content.getFeed(item.feedId).title }}</a>
- </span>
- <span ng-show="item.author">
- <?php p($l->t('by')) ?>
- {{ item.author }}
- </span>
- </h2>
-
- <div class="enclosure" ng-if="item.enclosureLink">
- <news-audio type="{{ item.enclosureType }}"
- ng-src="{{ item.enclosureLink|trustUrl }}">
- <?php p($l->t('Download')) ?>
- </news-audio>
- </div>
-
-
- <div class="body" news-bind-html-unsafe="item.body"></div>
-
- <div class="bottom-utils">
- <ul>
- <li ng-click="Content.toggleKeepUnread(item.id)">
- <label for="keep-unread">
- <input type="checkbox" name="keep-unread" ng-checked="item.keepUnread"/>
- <?php p($l->t('Keep unread')); ?>
- </label>
- </li>
- </ul>
- </div>
- </li>
+ <?php print_unescaped($this->inc('part.content.expand')); ?>
</ul>
</div>
diff --git a/templates/part.items.php b/templates/part.items.php
deleted file mode 100644
index dfb2a71a2..000000000
--- a/templates/part.items.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<ul>
- <li class="feed_item"
-
- ng-repeat="item in itemBusinessLayer.getAll() | orderBy:['-id'] "
- ng-class="{ read: item.isRead(), compact: isCompactView(), open: item.active}"
- data-id="{{ item.id }}"
- ng-click="itemBusinessLayer.setRead(item.id)">
-
- <div class="item_heading">
- <button ng-class="{ important: item.isStarred() }"
- ng-click="itemBusinessLayer.toggleStarred(item.id)"
- class="star"
- >
- </button>
- <a class="external"
- target="_blank"
- ng-href="{{ item.url }}"
- title="<?php p($l->t('read on website')) ?>">
- </a>
- <span class="timeago" title="{{item.pubDate*1000|date:'dd-MM-yyyy'}}">
- {{ getRelativeDate(item.pubDate) }}
- </span>
- <h1>
- <a ng-click="item.active = !item.active" href="#">{{ item.title }}</a>
- </h1>
- </div>
-
- <h2 class="item_date">
- <span class="timeago" title="{{item.pubDate*1000|date:'dd-MM-yyyy'}}">
- {{ getRelativeDate(item.pubDate) }}
- </span>
- </h2>
-
- <div class="item_utils">
- <ul class="primary_item_utils">
- <li>
- <button
- title="<?php p($l->t('star')) ?>"
- ng-class="{ important: item.isStarred() }"
- ng-click="itemBusinessLayer.toggleStarred(item.id)"
- class="star"></button>
- </li>
- </ul>
- </div>
-
- <h1 class="item_title">
- <a target="_blank" ng-href="{{ item.url }}">
- {{ item.title }}
- </a>
- </h1>
-
- <h2 class="item_author">
- <span ng-show="itemBusinessLayer.noFeedActive() && feedBusinessLayer.getFeedLink(item.feedId)">
- <?php p($l->t('from')) ?>
- <a target="_blank" ng-href="{{ feedBusinessLayer.getFeedLink(item.feedId) }}"
- class="from_feed">{{ itemBusinessLayer.getFeedTitle(item.id) }}</a>
- </span>
- <span ng-if="item.author">
- <?php p($l->t('by')) ?>
- {{ item.author }}
- </span>
- </h2>
-
- <div class="enclosure" ng-if="item.enclosureLink">
- <news-audio type="{{ item.enclosureType }}" ng-src="{{ item.enclosureLink|trustUrl }}"><?php
- p($l->t('Download'))
- ?></news-audio>
- </div>
-
- <div class="body" news-bind-html-unsafe="item.body">
- </div>
-
- <div class="bottom-utils">
- <ul ng-show="item.keepUnread">
- <li ng-click="Content.toggleKeepUnread(item.id)">
- <label for="keep-unread">
- <input type="checkbox" name="keep-unread" ng-checked="item.keepUnread"/>
- <?php p($l->t('Keep unread')); ?>
- </label>
- </li>
- </ul>
- </div>
- </li>
-</ul>
diff --git a/templates/part.addfeed.php b/templates/part.navigation.addfeed.php
index 0dfe32cc0..0dfe32cc0 100644
--- a/templates/part.addfeed.php
+++ b/templates/part.navigation.addfeed.php
diff --git a/templates/part.addfolder.php b/templates/part.navigation.addfolder.php
index aa7e4a229..aa7e4a229 100644
--- a/templates/part.addfolder.php
+++ b/templates/part.navigation.addfolder.php
diff --git a/templates/part.listfeed.php b/templates/part.navigation.feed.php
index ae4442fe5..ae4442fe5 100644
--- a/templates/part.listfeed.php
+++ b/templates/part.navigation.feed.php
diff --git a/templates/part.listfolder.php b/templates/part.navigation.folder.php
index 8f97dfa9d..2895ed94a 100644
--- a/templates/part.listfolder.php
+++ b/templates/part.navigation.folder.php
@@ -74,7 +74,7 @@
-->
</span>
<ul>
- <?php print_unescaped($this->inc('part.listfeed', ['folderId' => 'folder.id'])); ?>
+ <?php print_unescaped($this->inc('part.navigation.feed', ['folderId' => 'folder.id'])); ?>
</ul>
<div class="message" ng-show="folder.error">{{ folder.error }}</div>
diff --git a/templates/part.feed.starred.php b/templates/part.navigation.starredfeed.php
index fb185ee67..fb185ee67 100644
--- a/templates/part.feed.starred.php
+++ b/templates/part.navigation.starredfeed.php
diff --git a/templates/part.feed.unread.php b/templates/part.navigation.unreadfeed.php
index 979824d1c..979824d1c 100644
--- a/templates/part.feed.unread.php
+++ b/templates/part.navigation.unreadfeed.php
diff --git a/templates/part.undo.php b/templates/part.undo.php
deleted file mode 100644
index 15f4b0cea..000000000
--- a/templates/part.undo.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<div id="undo-container">
- <div undo-notification id="undo">
- <a href="#"><?php p($l->t('Undo deletion of %s', '{{ getCaption() }}')); ?></a>
- </div>
-</div>
-<news-translate key="appName"><?php p($l->t('News')); ?></news-translate>
-
diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php
index c86e8cfba..d27049f95 100644
--- a/tests/unit/controller/PageControllerTest.php
+++ b/tests/unit/controller/PageControllerTest.php
@@ -41,14 +41,14 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase {
'\OCP\IRequest')
->disableOriginalConstructor()
->getMock();
- $this->controller = new PageController($this->appName, $this->request,
+ $this->controller = new PageController($this->appName, $this->request,
$this->settings, $this->l10n, $this->user);
}
public function testIndex(){
$response = $this->controller->index();
- $this->assertEquals('main', $response->getTemplateName());
+ $this->assertEquals('index', $response->getTemplateName());
}
@@ -101,25 +101,25 @@ class PageControllerTest extends \PHPUnit_Framework_TestCase {
->method('setUserValue')
->with($this->equalTo($this->user),
$this->equalTo($this->appName),
- $this->equalTo('showAll'),
+ $this->equalTo('showAll'),
$this->equalTo(true));
$this->settings->expects($this->at(1))
->method('setUserValue')
->with($this->equalTo($this->user),
$this->equalTo($this->appName),
- $this->equalTo('compact'),
+ $this->equalTo('compact'),
$this->equalTo(true));
$this->settings->expects($this->at(2))
->method('setUserValue')
->with($this->equalTo($this->user),
$this->equalTo($this->appName),
- $this->equalTo('preventReadOnScroll'),
+ $this->equalTo('preventReadOnScroll'),
$this->equalTo(false));
$this->settings->expects($this->at(3))
->method('setUserValue')
->with($this->equalTo($this->user),
$this->equalTo($this->appName),
- $this->equalTo('oldestFirst'),
+ $this->equalTo('oldestFirst'),
$this->equalTo(true));
$this->controller->updateSettings(true, true, false, true);