forked from Archives/Athou_commafeed
use backend to populate data
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,7 +1,8 @@
|
|||||||
#log files
|
#runtime files
|
||||||
commafeed.log
|
commafeed.log
|
||||||
derby.log
|
derby.log
|
||||||
data
|
data/
|
||||||
|
java_pid*
|
||||||
|
|
||||||
# Maven build directory
|
# Maven build directory
|
||||||
target
|
target
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.commafeed.backend.dao;
|
||||||
|
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
|
||||||
|
import com.commafeed.model.FeedEntryStatus;
|
||||||
|
|
||||||
|
@Stateless
|
||||||
|
public class FeedEntryStatusService extends GenericDAO<FeedEntryStatus, Long> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import com.commafeed.frontend.components.auth.LoginPage;
|
import com.commafeed.frontend.components.auth.LoginPage;
|
||||||
import com.commafeed.frontend.components.auth.LogoutPage;
|
import com.commafeed.frontend.components.auth.LogoutPage;
|
||||||
import com.commafeed.frontend.pages.home.HomePage;
|
import com.commafeed.frontend.pages.home.HomePage;
|
||||||
|
import com.commafeed.frontend.rest.FeedEntriesREST;
|
||||||
import com.commafeed.frontend.rest.FeedSubscriptionsREST;
|
import com.commafeed.frontend.rest.FeedSubscriptionsREST;
|
||||||
import com.commafeed.frontend.utils.exception.DisplayExceptionPage;
|
import com.commafeed.frontend.utils.exception.DisplayExceptionPage;
|
||||||
|
|
||||||
@@ -43,8 +44,11 @@ public class CommaFeedApplication extends AuthenticatedWebApplication {
|
|||||||
mountPage("login", LoginPage.class);
|
mountPage("login", LoginPage.class);
|
||||||
mountPage("logout", LogoutPage.class);
|
mountPage("logout", LogoutPage.class);
|
||||||
mountPage("error", DisplayExceptionPage.class);
|
mountPage("error", DisplayExceptionPage.class);
|
||||||
|
|
||||||
mountPage("subscriptions", FeedSubscriptionsREST.class);
|
mountPage("subscriptions", FeedSubscriptionsREST.class);
|
||||||
|
mountPage(String.format("entries/${%s}/${%s}/${%s}",
|
||||||
|
FeedEntriesREST.PARAM_TYPE, FeedEntriesREST.PARAM_ID,
|
||||||
|
FeedEntriesREST.PARAM_READTYPE), FeedEntriesREST.class);
|
||||||
|
|
||||||
setupInjection();
|
setupInjection();
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
|
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
|
||||||
<script src="vendor/angular/angular.min.js"></script>
|
<script src="vendor/angular/angular.min.js"></script>
|
||||||
<script src="vendor/angular/angular-resource.min.js"></script>
|
<script src="vendor/angular/angular-resource.min.js"></script>
|
||||||
|
<script src="vendor/angular/angular-sanitize.min.js"></script>
|
||||||
<script src="vendor/angular-ui/angular-ui.min.js"></script>
|
<script src="vendor/angular-ui/angular-ui.min.js"></script>
|
||||||
<script src="vendor/angular-ui-bootstrap/ui-bootstrap-tpls-0.2.0.min.js"></script>
|
<script src="vendor/angular-ui-bootstrap/ui-bootstrap-tpls-0.2.0.min.js"></script>
|
||||||
<script src="js/main.js"></script>
|
<script src="js/main.js"></script>
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.commafeed.frontend.rest;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||||
|
|
||||||
|
import com.commafeed.backend.dao.FeedEntryService;
|
||||||
|
import com.commafeed.backend.dao.FeedEntryStatusService;
|
||||||
|
import com.commafeed.backend.dao.FeedSubscriptionService;
|
||||||
|
import com.commafeed.frontend.rest.model.Entries;
|
||||||
|
import com.commafeed.frontend.rest.model.Entry;
|
||||||
|
import com.commafeed.frontend.utils.ModelFactory.MF;
|
||||||
|
import com.commafeed.model.FeedEntry;
|
||||||
|
import com.commafeed.model.FeedEntryStatus;
|
||||||
|
import com.commafeed.model.FeedSubscription;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
public class FeedEntriesREST extends JSONPage {
|
||||||
|
|
||||||
|
public static final String PARAM_TYPE = "type";
|
||||||
|
public static final String PARAM_ID = "id";
|
||||||
|
public static final String PARAM_READTYPE = "readtype";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FeedEntryService feedEntryService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FeedEntryStatusService feedEntryStatusService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
FeedSubscriptionService feedSubscriptionService;
|
||||||
|
|
||||||
|
public FeedEntriesREST(PageParameters pageParameters) {
|
||||||
|
super(pageParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object getObject(PageParameters parameters) {
|
||||||
|
|
||||||
|
String type = parameters.get(PARAM_TYPE).toString();
|
||||||
|
String id = parameters.get(PARAM_ID).toString();
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
String readType = parameters.get(PARAM_READTYPE).toString();
|
||||||
|
|
||||||
|
Entries entries = new Entries();
|
||||||
|
if ("feed".equals(type)) {
|
||||||
|
FeedSubscription subscription = feedSubscriptionService
|
||||||
|
.findById(Long.valueOf(id));
|
||||||
|
List<FeedEntry> feedEntries = feedEntryService.getUnreadEntries(
|
||||||
|
subscription.getFeed(), getUser());
|
||||||
|
|
||||||
|
entries.setName(subscription.getTitle());
|
||||||
|
for (FeedEntry feedEntry : feedEntries) {
|
||||||
|
|
||||||
|
List<FeedEntryStatus> feedEntryStatus = feedEntryStatusService.findByField(MF.i(MF.p(FeedEntryStatus.class).getEntry()), feedEntry);
|
||||||
|
|
||||||
|
Entry entry = buildEntry(feedEntry);
|
||||||
|
entry.setFeedName(subscription.getTitle());
|
||||||
|
entry.setFeedId(String.valueOf(subscription.getId()));
|
||||||
|
entry.setRead(feedEntryStatus.isEmpty() ? false : Iterables.getFirst(feedEntryStatus, null).isRead());
|
||||||
|
entry.setStarred(feedEntryStatus.isEmpty() ? false : Iterables.getFirst(feedEntryStatus, null).isStarred());
|
||||||
|
entries.getEntries().add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entry buildEntry(FeedEntry feedEntry) {
|
||||||
|
Entry entry = new Entry();
|
||||||
|
entry.setId(feedEntry.getGuid());
|
||||||
|
entry.setTitle(feedEntry.getTitle());
|
||||||
|
entry.setContent(feedEntry.getContent());
|
||||||
|
entry.setDate(DateFormat.getDateInstance(DateFormat.SHORT, getLocale())
|
||||||
|
.format(feedEntry.getUpdated()));
|
||||||
|
entry.setUrl(feedEntry.getUrl());
|
||||||
|
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,15 +5,13 @@ import java.util.List;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.apache.commons.lang.ObjectUtils;
|
import org.apache.commons.lang.ObjectUtils;
|
||||||
|
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||||
|
|
||||||
import com.commafeed.backend.dao.FeedCategoryService;
|
import com.commafeed.backend.dao.FeedCategoryService;
|
||||||
import com.commafeed.backend.dao.FeedEntryService;
|
import com.commafeed.backend.dao.FeedEntryService;
|
||||||
import com.commafeed.backend.dao.FeedSubscriptionService;
|
import com.commafeed.backend.dao.FeedSubscriptionService;
|
||||||
import com.commafeed.frontend.CommaFeedSession;
|
|
||||||
import com.commafeed.frontend.pages.JSONPage;
|
|
||||||
import com.commafeed.model.FeedCategory;
|
import com.commafeed.model.FeedCategory;
|
||||||
import com.commafeed.model.FeedSubscription;
|
import com.commafeed.model.FeedSubscription;
|
||||||
import com.commafeed.model.User;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@@ -28,19 +26,23 @@ public class FeedSubscriptionsREST extends JSONPage {
|
|||||||
@Inject
|
@Inject
|
||||||
FeedEntryService feedEntryService;
|
FeedEntryService feedEntryService;
|
||||||
|
|
||||||
|
public FeedSubscriptionsREST(PageParameters pageParameters) {
|
||||||
|
super(pageParameters);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object getObject() {
|
protected Object getObject(PageParameters parameters) {
|
||||||
User user = CommaFeedSession.get().getUser();
|
List<FeedCategory> categories = feedCategoryService.findAll(getUser());
|
||||||
List<FeedCategory> categories = feedCategoryService.findAll(user);
|
|
||||||
Category root = new Category();
|
Category root = new Category();
|
||||||
addChildren(categories, root);
|
addChildren(categories, root);
|
||||||
for (FeedSubscription subscription : feedSubscriptionService
|
for (FeedSubscription subscription : feedSubscriptionService
|
||||||
.findWithoutCategories(user)) {
|
.findWithoutCategories(getUser())) {
|
||||||
Subscription sub = new Subscription();
|
Subscription sub = new Subscription();
|
||||||
sub.setId(subscription.getId());
|
sub.setId(subscription.getId());
|
||||||
sub.setName(subscription.getTitle());
|
sub.setName(subscription.getTitle());
|
||||||
int size = feedEntryService.getUnreadEntries(
|
int size = feedEntryService.getUnreadEntries(
|
||||||
subscription.getFeed(), user).size();
|
subscription.getFeed(), getUser()).size();
|
||||||
sub.setUnread(size);
|
sub.setUnread(size);
|
||||||
root.getFeeds().add(sub);
|
root.getFeeds().add(sub);
|
||||||
}
|
}
|
||||||
@@ -62,8 +64,7 @@ public class FeedSubscriptionsREST extends JSONPage {
|
|||||||
sub.setId(subscription.getId());
|
sub.setId(subscription.getId());
|
||||||
sub.setName(subscription.getTitle());
|
sub.setName(subscription.getTitle());
|
||||||
int size = feedEntryService.getUnreadEntries(
|
int size = feedEntryService.getUnreadEntries(
|
||||||
subscription.getFeed(),
|
subscription.getFeed(), getUser()).size();
|
||||||
CommaFeedSession.get().getUser()).size();
|
|
||||||
sub.setUnread(size);
|
sub.setUnread(size);
|
||||||
child.getFeeds().add(sub);
|
child.getFeeds().add(sub);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
package com.commafeed.frontend.pages;
|
package com.commafeed.frontend.rest;
|
||||||
|
|
||||||
import org.apache.wicket.markup.html.WebPage;
|
import org.apache.wicket.markup.html.WebPage;
|
||||||
import org.apache.wicket.request.handler.TextRequestHandler;
|
import org.apache.wicket.request.handler.TextRequestHandler;
|
||||||
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
import org.apache.wicket.request.mapper.parameter.PageParameters;
|
||||||
|
|
||||||
|
import com.commafeed.frontend.CommaFeedSession;
|
||||||
|
import com.commafeed.model.User;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public abstract class JSONPage extends WebPage {
|
public abstract class JSONPage extends WebPage {
|
||||||
|
|
||||||
public JSONPage() {
|
|
||||||
this(new PageParameters());
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSONPage(PageParameters pageParameters) {
|
public JSONPage(PageParameters pageParameters) {
|
||||||
getRequestCycle().scheduleRequestHandlerAfterCurrent(
|
getRequestCycle().scheduleRequestHandlerAfterCurrent(
|
||||||
new TextRequestHandler("application/json", "UTF-8", new Gson()
|
new TextRequestHandler("application/json", "UTF-8", new Gson()
|
||||||
.toJson(getObject())));
|
.toJson(getObject(pageParameters))));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Object getObject();
|
protected abstract Object getObject(PageParameters parameters);
|
||||||
|
|
||||||
|
protected User getUser() {
|
||||||
|
return CommaFeedSession.get().getUser();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,11 @@ package com.commafeed.frontend.rest.model;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
public class Entries {
|
public class Entries {
|
||||||
private String name;
|
private String name;
|
||||||
private List<Entry> entries;
|
private List<Entry> entries = Lists.newArrayList();
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns:wicket="http://wicket.apache.org">
|
|
||||||
<head>
|
|
||||||
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link href="vendor/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
|
|
||||||
<link href="vendor/angular-ui/angular-ui.min.css" rel="stylesheet">
|
|
||||||
<link href="vendor/csstreeview/css3-treeview.css" rel="stylesheet">
|
|
||||||
<link href="css/app.css" rel="stylesheet">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div ng-app="commafeed">
|
|
||||||
<ng:view></ng:view>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="vendor/jquery/jquery-1.9.1.min.js"></script>
|
|
||||||
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
<script src="vendor/angular/angular.min.js"></script>
|
|
||||||
<script src="vendor/angular/angular-resource.min.js"></script>
|
|
||||||
<script src="vendor/angular-ui/angular-ui.min.js"></script>
|
|
||||||
<script src="vendor/angular-ui-bootstrap/ui-bootstrap-tpls-0.2.0.min.js"></script>
|
|
||||||
<script src="js/main.js"></script>
|
|
||||||
<script src="js/controllers.js"></script>
|
|
||||||
<script src="js/directives.js"></script>
|
|
||||||
<script src="js/services.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -6,86 +6,92 @@ module.run(function($rootScope) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.controller('CategoryTreeCtrl',
|
module.controller('CategoryTreeCtrl', function($scope, $routeParams, $location,
|
||||||
function($scope, $routeParams, $location, CategoryService) {
|
CategoryService) {
|
||||||
|
|
||||||
$scope.selectedType = $routeParams._type;
|
|
||||||
$scope.selectedId = $routeParams._id;
|
|
||||||
|
|
||||||
$scope.root = CategoryService.get();
|
|
||||||
|
|
||||||
var unreadCount = function(category) {
|
|
||||||
var count = 0;
|
|
||||||
if (category.children) {
|
|
||||||
for ( var i = 0; i < category.children.length; i++) {
|
|
||||||
count = count + unreadCount(category.children[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (category.feeds) {
|
|
||||||
for ( var i = 0; i < category.feeds.length; i++) {
|
|
||||||
var feed = category.feeds[i];
|
|
||||||
count = count + feed.unread;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.formatCategoryName = function(category) {
|
|
||||||
var count = unreadCount(category);
|
|
||||||
var label = category.name;
|
|
||||||
if (count > 0) {
|
|
||||||
label = label + " (" + count + ")";
|
|
||||||
}
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.formatFeedName = function(feed) {
|
|
||||||
var label = feed.name;
|
|
||||||
if (feed.unread > 0) {
|
|
||||||
label = label + " (" + feed.unread + ")";
|
|
||||||
}
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.feedClicked = function(id) {
|
|
||||||
$location.path('/feeds/view/feed/' + id);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.categoryClicked = function(id) {
|
|
||||||
$location.path('/feeds/view/category/' + id);
|
|
||||||
};
|
|
||||||
|
|
||||||
var markAsRead = function(children, entry, read) {
|
|
||||||
for ( var i = 0; i < children.length; i++) {
|
|
||||||
var child = children[i];
|
|
||||||
if (child.children) {
|
|
||||||
markAsRead(child.children, entry, read);
|
|
||||||
}
|
|
||||||
if (child.feeds) {
|
|
||||||
for ( var j = 0; j < child.feeds.length; j++) {
|
|
||||||
var feed = child.feeds[j];
|
|
||||||
console.log(entry.feedId)
|
|
||||||
if (feed.id == entry.feedId) {
|
|
||||||
var c = read ? -1 : 1;
|
|
||||||
console.log(c)
|
|
||||||
feed.unread = feed.unread + c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.$on('markAsRead', function(event, args) {
|
|
||||||
markAsRead($scope.root.children, args.entry, args.read)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
module.controller('FeedListCtrl', function($scope, $routeParams, $http) {
|
|
||||||
|
|
||||||
$scope.selectedType = $routeParams._type;
|
$scope.selectedType = $routeParams._type;
|
||||||
$scope.selectedId = $routeParams._id;
|
$scope.selectedId = $routeParams._id;
|
||||||
|
|
||||||
$scope.entryList = {
|
$scope.root = CategoryService.get();
|
||||||
|
|
||||||
|
var unreadCount = function(category) {
|
||||||
|
var count = 0;
|
||||||
|
if (category.children) {
|
||||||
|
for ( var i = 0; i < category.children.length; i++) {
|
||||||
|
count = count + unreadCount(category.children[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (category.feeds) {
|
||||||
|
for ( var i = 0; i < category.feeds.length; i++) {
|
||||||
|
var feed = category.feeds[i];
|
||||||
|
count = count + feed.unread;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.formatCategoryName = function(category) {
|
||||||
|
var count = unreadCount(category);
|
||||||
|
var label = category.name;
|
||||||
|
if (count > 0) {
|
||||||
|
label = label + " (" + count + ")";
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.formatFeedName = function(feed) {
|
||||||
|
var label = feed.name;
|
||||||
|
if (feed.unread > 0) {
|
||||||
|
label = label + " (" + feed.unread + ")";
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.feedClicked = function(id) {
|
||||||
|
$location.path('/feeds/view/feed/' + id);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.categoryClicked = function(id) {
|
||||||
|
$location.path('/feeds/view/category/' + id);
|
||||||
|
};
|
||||||
|
|
||||||
|
var markAsRead = function(children, entry, read) {
|
||||||
|
for ( var i = 0; i < children.length; i++) {
|
||||||
|
var child = children[i];
|
||||||
|
if (child.children) {
|
||||||
|
markAsRead(child.children, entry, read);
|
||||||
|
}
|
||||||
|
if (child.feeds) {
|
||||||
|
for ( var j = 0; j < child.feeds.length; j++) {
|
||||||
|
var feed = child.feeds[j];
|
||||||
|
if (feed.id == entry.feedId) {
|
||||||
|
var c = read ? -1 : 1;
|
||||||
|
feed.unread = feed.unread + c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$on('markAsRead', function(event, args) {
|
||||||
|
console.log(args.entry)
|
||||||
|
markAsRead($scope.root.children, args.entry, args.read)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
module.controller('FeedListCtrl', function($scope, $routeParams, $http,
|
||||||
|
EntryService) {
|
||||||
|
|
||||||
|
$scope.selectedType = $routeParams._type;
|
||||||
|
$scope.selectedId = $routeParams._id;
|
||||||
|
|
||||||
|
$scope.entryList = EntryService.getUnread({
|
||||||
|
_type : $scope.selectedType,
|
||||||
|
_id : $scope.selectedId,
|
||||||
|
_readtype : 'unread'
|
||||||
|
})
|
||||||
|
|
||||||
|
$scope.entryList2 = {
|
||||||
name : 'aaa',
|
name : 'aaa',
|
||||||
entries : [ {
|
entries : [ {
|
||||||
id : '1',
|
id : '1',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
var app = angular
|
var app = angular
|
||||||
.module('commafeed', [ 'ui', 'ui.bootstrap', 'commafeed.directives',
|
.module('commafeed', [ 'ui', 'ui.bootstrap', 'commafeed.directives',
|
||||||
'commafeed.controllers', 'commafeed.services' ]);
|
'commafeed.controllers', 'commafeed.services', 'ngSanitize' ]);
|
||||||
|
|
||||||
app.config([ '$routeProvider', function($routeProvider) {
|
app.config([ '$routeProvider', function($routeProvider) {
|
||||||
$routeProvider.when('/feeds/view/:_type/:_id', {
|
$routeProvider.when('/feeds/view/:_type/:_id', {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ var module = angular.module('commafeed.services', [ 'ngResource' ]);
|
|||||||
|
|
||||||
module.factory('CategoryService', [ '$resource', '$http',
|
module.factory('CategoryService', [ '$resource', '$http',
|
||||||
function($resource, $http) {
|
function($resource, $http) {
|
||||||
|
|
||||||
var actions = {
|
var actions = {
|
||||||
'get' : {
|
'get' : {
|
||||||
method : 'GET'
|
method : 'GET'
|
||||||
@@ -10,4 +9,20 @@ module.factory('CategoryService', [ '$resource', '$http',
|
|||||||
}
|
}
|
||||||
res = $resource('subscriptions', {}, actions);
|
res = $resource('subscriptions', {}, actions);
|
||||||
return res
|
return res
|
||||||
|
} ]);
|
||||||
|
|
||||||
|
module.factory('EntryService', [ '$resource', '$http',
|
||||||
|
function($resource, $http) {
|
||||||
|
var actions = {
|
||||||
|
'getUnread' : {
|
||||||
|
method : 'GET',
|
||||||
|
params : {
|
||||||
|
_type : 'category',
|
||||||
|
_id : '1',
|
||||||
|
_readtype : 'unread',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res = $resource('entries/:_type/:_id/:_readtype', {}, actions);
|
||||||
|
return res
|
||||||
} ]);
|
} ]);
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="{{'feed-body' + $index}}" class="accordion-body collapse">
|
<div id="{{'feed-body' + $index}}" class="accordion-body collapse">
|
||||||
<div class="accordion-inner">{{entry.content}}</div>
|
<div class="accordion-inner" ng-bind-html="entry.content"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
13
src/main/webapp/vendor/angular/angular-sanitize.min.js
vendored
Normal file
13
src/main/webapp/vendor/angular/angular-sanitize.min.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
AngularJS v1.0.5
|
||||||
|
(c) 2010-2012 Google, Inc. http://angularjs.org
|
||||||
|
License: MIT
|
||||||
|
*/
|
||||||
|
(function(I,g){'use strict';function i(a){var d={},a=a.split(","),b;for(b=0;b<a.length;b++)d[a[b]]=!0;return d}function z(a,d){function b(a,b,c,h){b=g.lowercase(b);if(m[b])for(;f.last()&&n[f.last()];)e("",f.last());o[b]&&f.last()==b&&e("",b);(h=p[b]||!!h)||f.push(b);var j={};c.replace(A,function(a,b,d,e,c){j[b]=k(d||e||c||"")});d.start&&d.start(b,j,h)}function e(a,b){var e=0,c;if(b=g.lowercase(b))for(e=f.length-1;e>=0;e--)if(f[e]==b)break;if(e>=0){for(c=f.length-1;c>=e;c--)d.end&&d.end(f[c]);f.length=
|
||||||
|
e}}var c,h,f=[],j=a;for(f.last=function(){return f[f.length-1]};a;){h=!0;if(!f.last()||!q[f.last()]){if(a.indexOf("<\!--")===0)c=a.indexOf("--\>"),c>=0&&(d.comment&&d.comment(a.substring(4,c)),a=a.substring(c+3),h=!1);else if(B.test(a)){if(c=a.match(r))a=a.substring(c[0].length),c[0].replace(r,e),h=!1}else if(C.test(a)&&(c=a.match(s)))a=a.substring(c[0].length),c[0].replace(s,b),h=!1;h&&(c=a.indexOf("<"),h=c<0?a:a.substring(0,c),a=c<0?"":a.substring(c),d.chars&&d.chars(k(h)))}else a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+
|
||||||
|
f.last()+"[^>]*>","i"),function(b,a){a=a.replace(D,"$1").replace(E,"$1");d.chars&&d.chars(k(a));return""}),e("",f.last());if(a==j)throw"Parse Error: "+a;j=a}e()}function k(a){l.innerHTML=a.replace(/</g,"<");return l.innerText||l.textContent||""}function t(a){return a.replace(/&/g,"&").replace(F,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")}function u(a){var d=!1,b=g.bind(a,a.push);return{start:function(a,c,h){a=g.lowercase(a);!d&&q[a]&&(d=a);!d&&v[a]==
|
||||||
|
!0&&(b("<"),b(a),g.forEach(c,function(a,c){var e=g.lowercase(c);if(G[e]==!0&&(w[e]!==!0||a.match(H)))b(" "),b(c),b('="'),b(t(a)),b('"')}),b(h?"/>":">"))},end:function(a){a=g.lowercase(a);!d&&v[a]==!0&&(b("</"),b(a),b(">"));a==d&&(d=!1)},chars:function(a){d||b(t(a))}}}var s=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,r=/^<\s*\/\s*([\w:-]+)[^>]*>/,A=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,C=/^</,B=/^<\s*\//,D=/<\!--(.*?)--\>/g,
|
||||||
|
E=/<!\[CDATA\[(.*?)]]\>/g,H=/^((ftp|https?):\/\/|mailto:|#)/,F=/([^\#-~| |!])/g,p=i("area,br,col,hr,img,wbr"),x=i("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),y=i("rp,rt"),o=g.extend({},y,x),m=g.extend({},x,i("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),n=g.extend({},y,i("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),
|
||||||
|
q=i("script,style"),v=g.extend({},p,m,n,o),w=i("background,cite,href,longdesc,src,usemap"),G=g.extend({},w,i("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,span,start,summary,target,title,type,valign,value,vspace,width")),l=document.createElement("pre");g.module("ngSanitize",[]).value("$sanitize",function(a){var d=[];
|
||||||
|
z(a,u(d));return d.join("")});g.module("ngSanitize").directive("ngBindHtml",["$sanitize",function(a){return function(d,b,e){b.addClass("ng-binding").data("$binding",e.ngBindHtml);d.$watch(e.ngBindHtml,function(c){c=a(c);b.html(c||"")})}}]);g.module("ngSanitize").filter("linky",function(){var a=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/,d=/^mailto:/;return function(b){if(!b)return b;for(var e=b,c=[],h=u(c),f,g;b=e.match(a);)f=b[0],b[2]==b[3]&&(f="mailto:"+f),g=b.index,
|
||||||
|
h.chars(e.substr(0,g)),h.start("a",{href:f}),h.chars(b[0].replace(d,"")),h.end("a"),e=e.substring(g+b[0].length);h.chars(e);return c.join("")}})})(window,window.angular);
|
||||||
Reference in New Issue
Block a user