mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
rename feeds
This commit is contained in:
@@ -25,6 +25,7 @@ import com.commafeed.backend.model.FeedSubscription;
|
|||||||
import com.commafeed.frontend.model.Category;
|
import com.commafeed.frontend.model.Category;
|
||||||
import com.commafeed.frontend.model.Subscription;
|
import com.commafeed.frontend.model.Subscription;
|
||||||
import com.commafeed.frontend.model.SubscriptionRequest;
|
import com.commafeed.frontend.model.SubscriptionRequest;
|
||||||
|
import com.commafeed.frontend.rest.resources.EntriesREST.Type;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.sun.syndication.io.FeedException;
|
import com.sun.syndication.io.FeedException;
|
||||||
|
|
||||||
@@ -78,12 +79,29 @@ public class SubscriptionsREST extends AbstractREST {
|
|||||||
return Response.ok(Status.OK).build();
|
return Response.ok(Status.OK).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("rename")
|
||||||
|
public Response rename(@QueryParam("type") Type type,
|
||||||
|
@QueryParam("id") Long id, @QueryParam("name") String name) {
|
||||||
|
if (type == Type.feed) {
|
||||||
|
FeedSubscription subscription = feedSubscriptionService.findById(
|
||||||
|
getUser(), id);
|
||||||
|
subscription.setTitle(name);
|
||||||
|
feedSubscriptionService.update(subscription);
|
||||||
|
} else if (type == Type.category) {
|
||||||
|
FeedCategory category = feedCategoryService.findById(getUser(), id);
|
||||||
|
category.setName(name);
|
||||||
|
feedCategoryService.update(category);
|
||||||
|
}
|
||||||
|
return Response.ok(Status.OK).build();
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("collapse")
|
@Path("collapse")
|
||||||
public Response collapse(@QueryParam("id") String id,
|
public Response collapse(@QueryParam("id") String id,
|
||||||
@QueryParam("collapse") boolean collapse) {
|
@QueryParam("collapse") boolean collapse) {
|
||||||
Preconditions.checkNotNull(id);
|
Preconditions.checkNotNull(id);
|
||||||
if (!"all".equals(id)) {
|
if (EntriesREST.ALL.equals(id)) {
|
||||||
FeedCategory category = feedCategoryService.findById(getUser(),
|
FeedCategory category = feedCategoryService.findById(getUser(),
|
||||||
Long.valueOf(id));
|
Long.valueOf(id));
|
||||||
category.setCollapsed(collapse);
|
category.setCollapsed(collapse);
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
top: -4px;
|
top: -4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.main .dropdown-menu a {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.toolbar {
|
.toolbar {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="feed in node.feeds" ng-mouseenter="hovered=feed" ng-mouseleave="hovered=null" ng-class="{error: feed.message}">
|
<li ng-repeat="feed in node.feeds" ng-mouseenter="hovered=feed" ng-mouseleave="hovered=null" ng-class="{error: feed.message}">
|
||||||
<div class="dropdown pull-right">
|
<div class="dropdown pull-right">
|
||||||
<a dropdown-toggle class="pull-right feed-menu-icon"><i ng-show="hovered==feed" class="icon icon-chevron-down"></i> </a>
|
<a dropdown-toggle class="pull-right"><i ng-show="hovered==feed" class="icon icon-chevron-down"></i> </a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li>
|
<li>
|
||||||
<a ng-click="edit(feed)">Edit</a>
|
<a ng-click="rename(feed)">Rename</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a ng-click="unsubscribe(feed)">Unsubscribe</a>
|
<a ng-click="unsubscribe(feed)">Unsubscribe</a>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
var module = angular.module('commafeed.directives', []);
|
var module = angular.module('commafeed.directives', []);
|
||||||
|
|
||||||
app.directive('ngBlur', function() {
|
app.directive('ngBlur', function() {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict : 'A',
|
||||||
link: function(scope, elm, attrs) {
|
link : function(scope, elm, attrs) {
|
||||||
elm.bind('blur', function() {
|
elm.bind('blur', function() {
|
||||||
scope.$apply(attrs.ngBlur);
|
scope.$apply(attrs.ngBlur);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
module.directive('scrollTo', function() {
|
module.directive('scrollTo', function() {
|
||||||
@@ -58,7 +58,6 @@ module.directive('subscribe', function(SubscriptionService) {
|
|||||||
$scope.isOpen = false;
|
$scope.isOpen = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.urlChanged = function() {
|
$scope.urlChanged = function() {
|
||||||
if ($scope.sub.url && !$scope.sub.title) {
|
if ($scope.sub.url && !$scope.sub.title) {
|
||||||
$scope.sub.title = 'Loading...';
|
$scope.sub.title = 'Loading...';
|
||||||
@@ -90,12 +89,12 @@ module.directive('subscribe', function(SubscriptionService) {
|
|||||||
|
|
||||||
$scope.cat = {};
|
$scope.cat = {};
|
||||||
|
|
||||||
$scope.openCategory= function(){
|
$scope.openCategory = function() {
|
||||||
$scope.isOpenCategory = true;
|
$scope.isOpenCategory = true;
|
||||||
$scope.cat = {};
|
$scope.cat = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.closeCategory= function(){
|
$scope.closeCategory = function() {
|
||||||
$scope.isOpenCategory = false;
|
$scope.isOpenCategory = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -152,6 +151,18 @@ module.directive('category', function($compile) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.rename = function(feed) {
|
||||||
|
var name = window.prompt("Rename feed : ", feed.name);
|
||||||
|
if (name && name != feed.name) {
|
||||||
|
feed.name = name;
|
||||||
|
SubscriptionService.rename({
|
||||||
|
type : 'feed',
|
||||||
|
id : feed.id,
|
||||||
|
name : name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scope.toggleCategory = function(category) {
|
$scope.toggleCategory = function(category) {
|
||||||
SubscriptionService.collapse({
|
SubscriptionService.collapse({
|
||||||
id : category.id,
|
id : category.id,
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ module.factory('SubscriptionService', function($resource, $http) {
|
|||||||
_method : 'unsubscribe'
|
_method : 'unsubscribe'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
rename : {
|
||||||
|
method : 'GET',
|
||||||
|
params : {
|
||||||
|
_method : 'rename'
|
||||||
|
}
|
||||||
|
},
|
||||||
collapse : {
|
collapse : {
|
||||||
method : 'GET',
|
method : 'GET',
|
||||||
params : {
|
params : {
|
||||||
@@ -81,6 +87,7 @@ module.factory('SubscriptionService', function($resource, $http) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
s.fetch = res.fetch;
|
s.fetch = res.fetch;
|
||||||
|
s.rename = res.rename;
|
||||||
s.subscribe = function(sub, callback) {
|
s.subscribe = function(sub, callback) {
|
||||||
res.subscribe(sub, function(data) {
|
res.subscribe(sub, function(data) {
|
||||||
s.init();
|
s.init();
|
||||||
|
|||||||
Reference in New Issue
Block a user