From 0ae088b1001b9f64771b5b6dd921f72603179d9e Mon Sep 17 00:00:00 2001 From: Athou Date: Mon, 1 Apr 2013 14:30:40 +0200 Subject: [PATCH] rename feeds --- .../rest/resources/SubscriptionsREST.java | 20 ++++++++- src/main/webapp/css/app.css | 4 ++ src/main/webapp/directives/category.html | 4 +- src/main/webapp/js/directives.js | 45 ++++++++++++------- src/main/webapp/js/services.js | 7 +++ 5 files changed, 60 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/commafeed/frontend/rest/resources/SubscriptionsREST.java b/src/main/java/com/commafeed/frontend/rest/resources/SubscriptionsREST.java index f3fafe8b..78dd098f 100644 --- a/src/main/java/com/commafeed/frontend/rest/resources/SubscriptionsREST.java +++ b/src/main/java/com/commafeed/frontend/rest/resources/SubscriptionsREST.java @@ -25,6 +25,7 @@ import com.commafeed.backend.model.FeedSubscription; import com.commafeed.frontend.model.Category; import com.commafeed.frontend.model.Subscription; import com.commafeed.frontend.model.SubscriptionRequest; +import com.commafeed.frontend.rest.resources.EntriesREST.Type; import com.google.common.base.Preconditions; import com.sun.syndication.io.FeedException; @@ -78,12 +79,29 @@ public class SubscriptionsREST extends AbstractREST { 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 @Path("collapse") public Response collapse(@QueryParam("id") String id, @QueryParam("collapse") boolean collapse) { Preconditions.checkNotNull(id); - if (!"all".equals(id)) { + if (EntriesREST.ALL.equals(id)) { FeedCategory category = feedCategoryService.findById(getUser(), Long.valueOf(id)); category.setCollapsed(collapse); diff --git a/src/main/webapp/css/app.css b/src/main/webapp/css/app.css index 1f0c4fed..cc365e96 100644 --- a/src/main/webapp/css/app.css +++ b/src/main/webapp/css/app.css @@ -4,6 +4,10 @@ top: -4px; } +.main .dropdown-menu a { + cursor: pointer; +} + .toolbar { padding-top: 10px; padding-bottom: 10px; diff --git a/src/main/webapp/directives/category.html b/src/main/webapp/directives/category.html index 2399f84c..81ce6754 100644 --- a/src/main/webapp/directives/category.html +++ b/src/main/webapp/directives/category.html @@ -5,10 +5,10 @@