1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-05-14 13:34:05 +02:00

add german feeds and allow to change the language

This commit is contained in:
Bernhard Posselt 2016-01-23 17:08:45 +01:00
parent 120a94582f
commit e3ae4ea0be
14 changed files with 341 additions and 185 deletions

View File

@ -26,7 +26,6 @@
#explore .grid-item { #explore .grid-item {
float: left; float: left;
width: 300px; width: 300px;
padding: 30px;
border-collapse: collapse; border-collapse: collapse;
border: 1px solid #ccc; border: 1px solid #ccc;
margin: 0 25px 25px 0; margin: 0 25px 25px 0;
@ -41,22 +40,31 @@
background-position: 0 center; background-position: 0 center;
} }
#explore h1 a {
word-wrap: break-word;
}
#explore h1 a:hover { #explore h1 a:hover {
text-decoration: underline; text-decoration: underline;
} }
#explore .category-wrapper {
text-align: center;
}
#explore .category { #explore .category {
display: inline-block;
font-weight: normal; font-weight: normal;
font-size: 10pt; font-size: 10pt;
color: #fff; color: #fff;
background-color: #1d2d44; background-color: #1d2d44;
padding: 5px; padding: 10px;
float: right;
border-radius: 3px;
font-weight: bold; font-weight: bold;
} }
#explore .grid-item-content {
padding: 30px;
}
#explore .explore-logo { #explore .explore-logo {
text-align: center; text-align: center;
margin-top: 25px; margin-top: 25px;
@ -75,6 +83,17 @@
padding-top: 25px; padding-top: 25px;
} }
#explore .explore-filter {
text-align: right;
padding: 30px;
}
#explore .explore-filter input,
#explore .explore-filter select {
margin-left: 10px;
display: inline-block;
}
#explore .explore-filter input { #explore .explore-filter input {
width: 200px; width: 200px;
} }

2
css/news.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,57 @@
{
"Technologie": [{
"title": "ComputerBase",
"favicon": "https:\/\/computerbase.de\/favicon.ico",
"url": "http:\/\/www.computerbase.de\/",
"feed": "http:\/\/www.computerbase.de\/rss\/news.xml",
"description": "Unabh\u00e4ngiges Tech-Magazin",
"votes": 100
}, {
"title": "Golem.de",
"favicon": "http:\/\/golem.de\/favicon.ico",
"url": "http:\/\/www.golem.de\/",
"feed": "http:\/\/golem.de.dynamic.feedsportal.com\/pf\/578068\/http:\/\/rss.golem.de\/rss.php?feed=RSS1.0",
"description": "IT-News fuer Profis",
"votes": 100,
"image": "http:\/\/www.golem.de\/staticrl\/images\/golem-rss.png"
}, {
"title": "derStandard.at \u203a Web",
"favicon": "https:\/\/derstandard.at\/img\/derstandard.at.ico",
"url": "http:\/\/derstandard.at\/Web",
"feed": "http:\/\/derstandard.at\/?page=rss&ressort=web",
"description": "Nachrichten in Echtzeit. derStandard.at: Permanent aktualisierte Nachrichten aus aller Welt vom Online-Newsroom der f\u00fchrenden Qualit\u00e4tszeitung \u00d6sterreichs. Plus die ganze Tageszeitung gratis im WWW. News in German, brought to you by the leading quality newspaper from Austria.",
"votes": 100
}, {
"title": "Pro-Linux News",
"favicon": "http:\/\/www.pro-linux.de\/favicon.ico",
"url": "http:\/\/www.pro-linux.de\/",
"feed": "http:\/\/www.pro-linux.de\/rss\/index1.xml",
"description": "Wir geben Ihrem Computer das Leben zur\u00fcck",
"votes": 100,
"image": "http:\/\/www.pro-linux.de\/images\/NB3\/base\/global\/pl-logo_i70.png"
}, {
"title": "heise online News",
"favicon": "https:\/\/www.heise.de\/favicon.ico",
"url": "http:\/\/www.heise.de\/newsticker\/",
"feed": "http:\/\/heise.de.feedsportal.com\/c\/35207\/f\/653901\/index.rss",
"description": "Nachrichten nicht nur aus der Welt der Computer",
"votes": 100
}],
"FOSS": [{
"title": "heise open news",
"favicon": "https:\/\/www.heise.de\/favicon.ico",
"url": "http:\/\/www.heise.de\/open\/news\/",
"feed": "http:\/\/heise.de.open.feedsportal.com\/c\/32509\/f\/480599\/index.rss",
"description": "Nachrichten zu Open Source",
"votes": 100
}
],
"Nachrichten": [{
"title": "derStandard.at",
"favicon": "https:\/\/derstandard.at\/img\/derstandard.at.ico",
"url": "http:\/\/derstandard.at\/",
"feed": "http:\/\/derstandard.at\/?page=rss&ressort=seite1",
"description": "Nachrichten in Echtzeit. derStandard.at: Permanent aktualisierte Nachrichten aus aller Welt vom Online-Newsroom der f\u00fchrenden Qualit\u00e4tszeitung \u00d6sterreichs. Plus die ganze Tageszeitung gratis im WWW. News in German, brought to you by the leading quality newspaper from Austria.",
"votes": 100
}]
}

View File

@ -1,145 +1,146 @@
{ {
"ownCloud": [ "ownCloud": [{
{ "title": "ownCloud Planet",
"title": "ownCloud Planet", "favicon": "https://owncloud.org/wp-content/themes/owncloudorgnew/assets/img/common/favicon.png",
"favicon": "https://owncloud.org/wp-content/themes/owncloudorgnew/assets/img/common/favicon.png", "url": "https://owncloud.org/news/",
"url": "https://owncloud.org/news/", "feed": "https://owncloud.org/feed/",
"feed": "https://owncloud.org/feed/", "description": "ownCloud Planet is a blog feed aggregator",
"description": "ownCloud Planet is a blog feed aggregator", "votes": 1000
"votes": 1000 }, {
}, "title": "News app releases",
{ "favicon": "https://owncloud.org/wp-content/themes/owncloudorgnew/assets/img/common/favicon.png",
"title": "News app releases", "url": "https://github.com/owncloud/news/releases",
"favicon": "https://owncloud.org/wp-content/themes/owncloudorgnew/assets/img/common/favicon.png", "feed": "https://github.com/owncloud/news/releases.atom",
"url": "https://github.com/owncloud/news/releases", "description": "ownCloud News app releases page. Get notified when a new release comes out",
"feed": "https://github.com/owncloud/news/releases.atom", "votes": 900
"description": "ownCloud News app releases page. Get notified when a new release comes out", }],
"votes": 900 "FOSS": [{
} "title": "Planet GNOME",
], "favicon": "http:\/\/planet.gnome.org\/img\/gnome-16.png",
"FOSS": [ "url": "http:\/\/planet.gnome.org\/",
{ "feed": "http:\/\/planet.gnome.org\/rss20.xml",
"title": "Planet GNOME", "description": "Planet GNOME - http:\/\/planet.gnome.org\/",
"favicon": "http:\/\/planet.gnome.org\/img\/gnome-16.png", "votes": 100
"url": "http:\/\/planet.gnome.org\/", }, {
"feed": "http:\/\/planet.gnome.org\/rss20.xml", "title": "Planet KDE",
"description": "Planet GNOME - http:\/\/planet.gnome.org\/", "favicon": "https:\/\/planetkde.org\/favicon.ico",
"votes": 100 "url": "http:\/\/planetKDE.org\/",
}, "feed": "http:\/\/planetKDE.org\/rss20.xml",
{ "description": "Planet KDE - http:\/\/planetKDE.org\/",
"title": "Planet KDE", "votes": 100
"favicon": "https:\/\/planetkde.org\/favicon.ico", }, {
"url": "http:\/\/planetKDE.org\/", "title": "Planet Mozilla",
"feed": "http:\/\/planetKDE.org\/rss20.xml", "favicon": "https:\/\/planet.mozilla.org\/img\/mozilla-16.png",
"description": "Planet KDE - http:\/\/planetKDE.org\/", "url": "http:\/\/planet.mozilla.org\/",
"votes": 100 "feed": "http:\/\/planet.mozilla.org\/atom.xml",
} "description": "Planet Mozilla - Mozilla Blogs",
], "votes": 100
"Tech": [ }
{
"title": "Slashdot", ],
"favicon": "https://slashdot.org/favicon.ico", "Tech": [{
"url": "https://slashdot.org", "title": "Slashdot",
"feed": "https://rss.slashdot.org/Slashdot/slashdot", "favicon": "https://slashdot.org/favicon.ico",
"description": "Slashdot: News for nerds, stuff that matters", "url": "https://slashdot.org",
"votes": 500 "feed": "https://rss.slashdot.org/Slashdot/slashdot",
} "description": "Slashdot: News for nerds, stuff that matters",
], "votes": 500
"UX": [ }],
{ "Gaming": [{
"title": "Mozilla UX blog", "title": "TotalBiscuit, The Cynical Brit",
"favicon": "https://blog.mozilla.org/ux/wp-content/themes/OneMozilla/img/favicon.ico", "favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico",
"url": "https://blog.mozilla.org/ux/", "url": "http:\/\/www.youtube.com\/channel\/UCy1Ms_5qBTawC-k7PVjHXKQ",
"feed": "https://blog.mozilla.org/ux/feed/", "feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCy1Ms_5qBTawC-k7PVjHXKQ",
"description": "Designing great products that make sense & bring joy", "description": "",
"votes": 500 "votes": 100
}, }, {
{ "title": "Force Gaming",
"title": "Little Big Details", "favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico",
"url": "http://littlebigdetails.com/", "url": "http:\/\/www.youtube.com\/channel\/UCGhs9S33RAeT5DEuKTO4Oew",
"feed": "http://littlebigdetails.com/rss", "feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCGhs9S33RAeT5DEuKTO4Oew",
"favicon": "http://33.media.tumblr.com/avatar_21babec3285d_128.png", "description": "",
"description": "UX eastereggs and goodies", "votes": 100
"votes": 1000 }
}, ],
{ "UX": [{
"title": "Ignore the code", "title": "Mozilla UX blog",
"favicon": "http://ignorethecode.net/blog_images/iphone.png", "favicon": "https://blog.mozilla.org/ux/wp-content/themes/OneMozilla/img/favicon.ico",
"url": "http://ignorethecode.net/blog/", "url": "https://blog.mozilla.org/ux/",
"feed": "http://feeds.feedburner.com/IgnoreTheCode", "feed": "https://blog.mozilla.org/ux/feed/",
"description": "A blog about usability", "description": "Designing great products that make sense & bring joy",
"votes": 500 "votes": 500
}, }, {
{ "title": "Little Big Details",
"title": "Elezea", "url": "http://littlebigdetails.com/",
"url": "http://www.elezea.com", "feed": "http://littlebigdetails.com/rss",
"feed": "http://feedpress.me/elezea", "favicon": "http://33.media.tumblr.com/avatar_21babec3285d_128.png",
"description": "Links and articles about technology, design, and sociology. Written by Rian van der Merwe.", "description": "UX eastereggs and goodies",
"votes": 500 "votes": 1000
} }, {
], "title": "Ignore the code",
"Music": [ "favicon": "http://ignorethecode.net/blog_images/iphone.png",
{ "url": "http://ignorethecode.net/blog/",
"title": "Pebber Brown", "feed": "http://feeds.feedburner.com/IgnoreTheCode",
"favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico", "description": "A blog about usability",
"url": "http:\/\/www.youtube.com\/channel\/UCbA-Tt8ELg8v0d7RdieeZyA", "votes": 500
"feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCbA-Tt8ELg8v0d7RdieeZyA", }, {
"description": "Videos about music theory and scales", "title": "Elezea",
"votes": 100 "url": "http://www.elezea.com",
} "feed": "http://feedpress.me/elezea",
], "description": "Links and articles about technology, design, and sociology. Written by Rian van der Merwe.",
"Science": [ "votes": 500
{ }],
"title": "Numberphile", "Music": [{
"favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico", "title": "Pebber Brown",
"url": "http:\/\/www.youtube.com\/channel\/UCoxcjq-8xIDTYp3uz647V5A", "favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico",
"feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCoxcjq-8xIDTYp3uz647V5A", "url": "http:\/\/www.youtube.com\/channel\/UCbA-Tt8ELg8v0d7RdieeZyA",
"description": "Awesome mathematics videos", "feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCbA-Tt8ELg8v0d7RdieeZyA",
"votes": 500 "description": "Videos about music theory and scales",
}, "votes": 100
{ }],
"title": "Periodic Videos", "Science": [{
"favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico", "title": "Numberphile",
"url": "http:\/\/www.youtube.com\/channel\/UCtESv1e7ntJaLJYKIO1FoYw", "favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico",
"feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCtESv1e7ntJaLJYKIO1FoYw", "url": "http:\/\/www.youtube.com\/channel\/UCoxcjq-8xIDTYp3uz647V5A",
"description": "Videos about elements and chemistry", "feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCoxcjq-8xIDTYp3uz647V5A",
"votes": 1000 "description": "Awesome mathematics videos",
} "votes": 500
], }, {
"Food": [ "title": "Periodic Videos",
{ "favicon": "https:\/\/s.ytimg.com\/yts\/img\/favicon-vflz7uhzw.ico",
"title": "Smitten Kitchen", "url": "http:\/\/www.youtube.com\/channel\/UCtESv1e7ntJaLJYKIO1FoYw",
"favicon": "http://smittenkitchen.com/uploads/favicon.ico", "feed": "http:\/\/www.youtube.com\/feeds\/videos.xml?channel_id=UCtESv1e7ntJaLJYKIO1FoYw",
"url": "http://smittenkitchen.com/", "description": "Videos about elements and chemistry",
"feed": "http://feeds.feedburner.com/smittenkitchen", "votes": 1000
"description": "A home cooking weblog from a tiny kitchen in New York City. The place to find all of your new favorite things to cook", }],
"votes": 500 "Food": [{
}, "title": "Smitten Kitchen",
{ "favicon": "http://smittenkitchen.com/uploads/favicon.ico",
"title": "Food in Jars", "url": "http://smittenkitchen.com/",
"favicon": "http://foodinjars.com.s164546.gridserver.com/arugulapesto/wp-content/uploads/2013/05/jar-favicon.png", "feed": "http://feeds.feedburner.com/smittenkitchen",
"url": "http://foodinjars.com/", "description": "A home cooking weblog from a tiny kitchen in New York City. The place to find all of your new favorite things to cook",
"feed": "http://feedpress.me/FIJ", "votes": 500
"description": "A blog dedicated to canning, preserving, and pantry staples made from scratch.", }, {
"votes": 500 "title": "Food in Jars",
} "favicon": "http://foodinjars.com.s164546.gridserver.com/arugulapesto/wp-content/uploads/2013/05/jar-favicon.png",
], "url": "http://foodinjars.com/",
"Comics": [ "feed": "http://feedpress.me/FIJ",
{ "description": "A blog dedicated to canning, preserving, and pantry staples made from scratch.",
"title": "Explosm.net", "votes": 500
"favicon": "http://explosm.net/favicons/favicon.ico", }],
"url": "http:\/\/www.explosm.net\/rss.php", "Comics": [{
"feed": "http:\/\/feeds.feedburner.com\/Explosm", "title": "Explosm.net",
"description": "Flash Animations, Daily Comics and more!", "favicon": "http://explosm.net/favicons/favicon.ico",
"votes": 100 "url": "http:\/\/www.explosm.net\/rss.php",
}, "feed": "http:\/\/feeds.feedburner.com\/Explosm",
{ "description": "Flash Animations, Daily Comics and more!",
"title": "The Oatmeal - Comics, Quizzes, & Stories", "votes": 100
"favicon": "http:\/\/theoatmeal.com\/favicon.ico", }, {
"url": "http:\/\/theoatmeal.com\/", "title": "The Oatmeal - Comics, Quizzes, & Stories",
"feed": "http:\/\/feeds.feedburner.com\/oatmealfeed", "favicon": "http:\/\/theoatmeal.com\/favicon.ico",
"description": "The oatmeal tastes better than stale skittles found under the couch cushions", "url": "http:\/\/theoatmeal.com\/",
"votes": 100 "feed": "http:\/\/feeds.feedburner.com\/oatmealfeed",
} "description": "The oatmeal tastes better than stale skittles found under the couch cushions",
] "votes": 100
}]
} }

View File

@ -137,16 +137,21 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
var getExploreResolve = function () { var getExploreResolve = function () {
return { return {
sites: /* @ngInject */ function ( sites: /* @ngInject */ function (
$http, $q, BASE_URL, Publisher, SettingsResource) { $http, $q, BASE_URL, $location, Publisher, SettingsResource) {
var deferred = $q.defer(); var deferred = $q.defer();
// always use the code from the url
var language = $location.search().lang;
if (!language) {
language = SettingsResource.get('language');
}
$http.get(BASE_URL + '/settings').then(function (data) { $http.get(BASE_URL + '/settings').then(function (data) {
Publisher.publishAll(data); Publisher.publishAll(data);
// get url and strip trailing slashes // get url and strip trailing slashes
var url = SettingsResource.get('exploreUrl') var url = SettingsResource.get('exploreUrl')
.replace(/\/+$/, ''); .replace(/\/+$/, '');
var language = SettingsResource.get('language');
var exploreUrl = url + '/feeds.' + language + '.json'; var exploreUrl = url + '/feeds.' + language + '.json';
var defaultExploreUrl = url + '/feeds.en.json'; var defaultExploreUrl = url + '/feeds.en.json';

View File

@ -134,17 +134,22 @@ app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvi
var getExploreResolve = function () { var getExploreResolve = function () {
return { return {
sites: /* @ngInject */ ["$http", "$q", "BASE_URL", "Publisher", "SettingsResource", function ( sites: /* @ngInject */ ["$http", "$q", "BASE_URL", "$location", "Publisher", "SettingsResource", function (
$http, $q, BASE_URL, Publisher, SettingsResource) { $http, $q, BASE_URL, $location, Publisher, SettingsResource) {
var deferred = $q.defer(); var deferred = $q.defer();
// always use the code from the url
var language = $location.search().lang;
if (!language) {
language = SettingsResource.get('language');
}
$http.get(BASE_URL + '/settings').then(function (data) { $http.get(BASE_URL + '/settings').then(function (data) {
Publisher.publishAll(data); Publisher.publishAll(data);
// get url and strip trailing slashes // get url and strip trailing slashes
var url = SettingsResource.get('exploreUrl') var url = SettingsResource.get('exploreUrl')
.replace(/\/+$/, ''); .replace(/\/+$/, '');
var language = SettingsResource.get('language');
var exploreUrl = url + '/feeds.' + language + '.json'; var exploreUrl = url + '/feeds.' + language + '.json';
var defaultExploreUrl = url + '/feeds.en.json'; var defaultExploreUrl = url + '/feeds.en.json';
@ -535,7 +540,8 @@ app.controller('ContentController',
}; };
}]); }]);
app.controller('ExploreController', ["sites", "$rootScope", "FeedResource", function (sites, $rootScope, FeedResource) { app.controller('ExploreController',
["sites", "$rootScope", "FeedResource", "SettingsResource", "$location", function (sites, $rootScope, FeedResource, SettingsResource, $location) {
'use strict'; 'use strict';
this.sites = sites; this.sites = sites;
@ -565,7 +571,25 @@ app.controller('ExploreController', ["sites", "$rootScope", "FeedResource", func
}).length > 0; }).length > 0;
}; };
this.getSupportedLanguageCodes = function () {
return SettingsResource.getSupportedLanguageCodes();
};
this.getCurrentLanguageCode = function () {
var language = $location.search().lang;
if (!language) {
language = SettingsResource.get('language');
}
return language;
};
this.showLanguage = function (languageCode) {
$location.url('/explore/?lang=' + languageCode);
};
this.selectedLanguageCode = this.getCurrentLanguageCode();
}]); }]);
app.controller('NavigationController', app.controller('NavigationController',
["$route", "FEED_TYPE", "FeedResource", "FolderResource", "ItemResource", "SettingsResource", "Publisher", "$rootScope", "$location", "$q", function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, ["$route", "FEED_TYPE", "FeedResource", "FolderResource", "ItemResource", "SettingsResource", "Publisher", "$rootScope", "$location", "$q", function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource,
SettingsResource, Publisher, $rootScope, $location, $q) { SettingsResource, Publisher, $rootScope, $location, $q) {
@ -584,6 +608,10 @@ app.controller('NavigationController',
return parseInt($route.current.params.id, 10); return parseInt($route.current.params.id, 10);
}; };
this.getLanguageCode = function () {
return SettingsResource.get('language');
};
this.getFeeds = function () { this.getFeeds = function () {
return FeedResource.getAll(); return FeedResource.getAll();
}; };
@ -2002,13 +2030,17 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
}; };
this.defaultLanguageCode = 'en'; this.defaultLanguageCode = 'en';
this.supportedLanguageCodes = [ this.supportedLanguageCodes = [
'ar-ma', 'ar', 'bg', 'ca', 'cs', 'cv', 'da', 'de', 'el', 'en-ca', 'ar-ma', 'ar', 'bg', 'ca', 'cs', 'cv', 'da', 'de', 'el', 'en', 'en-ca',
'en-gb', 'eo', 'es', 'et', 'eu', 'fi', 'fr-ca', 'fr', 'gl', 'he', 'hi', 'en-gb', 'eo', 'es', 'et', 'eu', 'fi', 'fr-ca', 'fr', 'gl', 'he', 'hi',
'hu', 'id', 'is', 'it', 'ja', 'ka', 'ko', 'lv', 'ms-my', 'nb', 'ne', 'hu', 'id', 'is', 'it', 'ja', 'ka', 'ko', 'lv', 'ms-my', 'nb', 'ne',
'nl', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'th', 'tr', 'nl', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'th', 'tr',
'tzm-la', 'tzm', 'uk', 'zh-cn', 'zh-tw' 'tzm-la', 'tzm', 'uk', 'zh-cn', 'zh-tw'
]; ];
this.getSupportedLanguageCodes = function () {
return this.supportedLanguageCodes;
};
this.receive = function (data) { this.receive = function (data) {
var self = this; var self = this;
Object.keys(data).forEach(function (key) { Object.keys(data).forEach(function (key) {
@ -2058,6 +2090,7 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
}; };
}]); }]);
/** /**
* This prefills the add feed section if an external link has ?subsribe_to * This prefills the add feed section if an external link has ?subsribe_to
* filled out * filled out

4
js/build/app.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,8 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com> * @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014 * @copyright Bernhard Posselt 2014
*/ */
app.controller('ExploreController', function (sites, $rootScope, FeedResource) { app.controller('ExploreController',
function (sites, $rootScope, FeedResource, SettingsResource, $location) {
'use strict'; 'use strict';
this.sites = sites; this.sites = sites;
@ -37,4 +38,21 @@ app.controller('ExploreController', function (sites, $rootScope, FeedResource) {
}).length > 0; }).length > 0;
}; };
}); this.getSupportedLanguageCodes = function () {
return SettingsResource.getSupportedLanguageCodes();
};
this.getCurrentLanguageCode = function () {
var language = $location.search().lang;
if (!language) {
language = SettingsResource.get('language');
}
return language;
};
this.showLanguage = function (languageCode) {
$location.url('/explore/?lang=' + languageCode);
};
this.selectedLanguageCode = this.getCurrentLanguageCode();
});

View File

@ -25,6 +25,10 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource,
return parseInt($route.current.params.id, 10); return parseInt($route.current.params.id, 10);
}; };
this.getLanguageCode = function () {
return SettingsResource.get('language');
};
this.getFeeds = function () { this.getFeeds = function () {
return FeedResource.getAll(); return FeedResource.getAll();
}; };

View File

@ -23,13 +23,17 @@ app.service('SettingsResource', function ($http, BASE_URL) {
}; };
this.defaultLanguageCode = 'en'; this.defaultLanguageCode = 'en';
this.supportedLanguageCodes = [ this.supportedLanguageCodes = [
'ar-ma', 'ar', 'bg', 'ca', 'cs', 'cv', 'da', 'de', 'el', 'en-ca', 'ar-ma', 'ar', 'bg', 'ca', 'cs', 'cv', 'da', 'de', 'el', 'en', 'en-ca',
'en-gb', 'eo', 'es', 'et', 'eu', 'fi', 'fr-ca', 'fr', 'gl', 'he', 'hi', 'en-gb', 'eo', 'es', 'et', 'eu', 'fi', 'fr-ca', 'fr', 'gl', 'he', 'hi',
'hu', 'id', 'is', 'it', 'ja', 'ka', 'ko', 'lv', 'ms-my', 'nb', 'ne', 'hu', 'id', 'is', 'it', 'ja', 'ka', 'ko', 'lv', 'ms-my', 'nb', 'ne',
'nl', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'th', 'tr', 'nl', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'th', 'tr',
'tzm-la', 'tzm', 'uk', 'zh-cn', 'zh-tw' 'tzm-la', 'tzm', 'uk', 'zh-cn', 'zh-tw'
]; ];
this.getSupportedLanguageCodes = function () {
return this.supportedLanguageCodes;
};
this.receive = function (data) { this.receive = function (data) {
var self = this; var self = this;
Object.keys(data).forEach(function (key) { Object.keys(data).forEach(function (key) {
@ -78,4 +82,4 @@ app.service('SettingsResource', function ($http, BASE_URL) {
return languageCode; return languageCode;
}; };
}); });

View File

@ -6,32 +6,47 @@
<input ng-model="Explore.filter" type="search" placeholder="<?php p(addslashes($l->t('filter'))) ?>" news-auto-focus> <input ng-model="Explore.filter" type="search" placeholder="<?php p(addslashes($l->t('filter'))) ?>" news-auto-focus>
</label> </label>
</div>--> </div>-->
<div class="explore-header"> <div class="explore-header">
<a href="https://github.com/owncloud/news/wiki/Explore-Feed-Section"><?php p($l->t('Got more awesome feeds? Share them with us!')) ?></a> <a href="https://github.com/owncloud/news/wiki/Explore-Feed-Section"><?php p($l->t('Got more awesome feeds? Share them with us!')) ?></a>
</div> </div>
<div class="explore-filter">
<label for="explorelanguagecode"><?php p($l->t('Language')) ?>: </label>
<select id="explorelanguagecode" name="explorelanguagecode"
ng-change="Explore.showLanguage(Explore.selectedLanguageCode)"
ng-options="language as language for language in Explore.getSupportedLanguageCodes()"
ng-model="Explore.selectedLanguageCode"></select>
</div>
<div class="grid"> <div class="grid">
<div ng-repeat="entry in Explore.feeds | filter:Explore.filter | orderBy:'-votes'" ng-show="!Explore.feedExists(entry.feed)" class="explore-feed grid-item" news-refresh-masonry> <div ng-repeat="entry in Explore.feeds | filter:Explore.filter | orderBy:'-votes'" ng-show="!Explore.feedExists(entry.feed)" class="explore-feed grid-item" news-refresh-masonry>
<span class="category">{{ entry.category }}</span> <div class="category-wrapper">
<h1 ng-show="entry.favicon" <div class="category">
ng-style="{ backgroundImage: 'url(' + entry.favicon + ')'}"> {{ entry.category }}
<a target="_blank" ng-href="{{ entry.url }}">{{ entry.title }}</a>
</h1>
<h1 ng-hide="entry.favicon" class="icon-rss">
{{ entry.title }}
</h1>
<div style="clear:both"></div>
<div class="explore-content">
<p>{{ entry.description }}</p>
<div class="explore-logo">
<img ng-src="{{ entry.image }}" ng-if="entry.image">
</div> </div>
</div> </div>
<div class="explore-subscribe"> <div class="grid-item-content">
<button ng-click="Explore.subscribeTo(entry.feed)"> <h1 ng-show="entry.favicon"
<?php p($l->t('Subscribe')) ?> ng-style="{ backgroundImage: 'url(' + entry.favicon + ')'}">
</button> <a target="_blank" ng-href="{{ entry.url }}">{{ entry.title }}</a>
</h1>
<h1 ng-hide="entry.favicon" class="icon-rss">
{{ entry.title }}
</h1>
<div style="clear:both"></div>
<div class="explore-content">
<p>{{ entry.description }}</p>
<div class="explore-logo">
<img ng-src="{{ entry.image }}" ng-if="entry.image">
</div>
</div>
<div class="explore-subscribe">
<button ng-click="Explore.subscribeTo(entry.feed)">
<?php p($l->t('Subscribe')) ?>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
<li ng-class="{active: Navigation.isExploreActive()}" class="explore-feed"> <li ng-class="{active: Navigation.isExploreActive()}" class="explore-feed">
<a class="icon-link" ng-href="#/explore/"> <a class="icon-link" ng-href="#/explore/?lang={{Navigation.getLanguageCode()}}">
<?php p($l->t('Explore')) ?> <?php p($l->t('Explore')) ?>
</a> </a>
</li> </li>