mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
initial expanded view support (#62)
This commit is contained in:
@@ -22,6 +22,10 @@ public class UserSettings extends AbstractModel {
|
||||
asc, desc
|
||||
}
|
||||
|
||||
public enum ViewMode {
|
||||
title, expanded
|
||||
}
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
private User user;
|
||||
@@ -34,6 +38,10 @@ public class UserSettings extends AbstractModel {
|
||||
@Column(nullable = false)
|
||||
private ReadingOrder readingOrder;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private ViewMode viewMode;
|
||||
|
||||
private boolean showRead;
|
||||
|
||||
private boolean socialButtons;
|
||||
@@ -90,4 +98,12 @@ public class UserSettings extends AbstractModel {
|
||||
this.socialButtons = socialButtons;
|
||||
}
|
||||
|
||||
public ViewMode getViewMode() {
|
||||
return viewMode;
|
||||
}
|
||||
|
||||
public void setViewMode(ViewMode viewMode) {
|
||||
this.viewMode = viewMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ public class Settings implements Serializable {
|
||||
@ApiProperty(value = "user reads entries in ascending or descending order", allowableValues = "asc,desc", required = true)
|
||||
private String readingOrder;
|
||||
|
||||
@ApiProperty(value = "user viewing mode, either title-only or expande view", allowableValues = "title,expanded", required = true)
|
||||
private String viewMode;
|
||||
|
||||
@ApiProperty(value = "user wants category and feeds with no unread entries shown", required = true)
|
||||
private boolean showRead;
|
||||
|
||||
@@ -70,4 +73,12 @@ public class Settings implements Serializable {
|
||||
this.socialButtons = socialButtons;
|
||||
}
|
||||
|
||||
public String getViewMode() {
|
||||
return viewMode;
|
||||
}
|
||||
|
||||
public void setViewMode(String viewMode) {
|
||||
this.viewMode = viewMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.commafeed.backend.model.UserRole.Role;
|
||||
import com.commafeed.backend.model.UserSettings;
|
||||
import com.commafeed.backend.model.UserSettings.ReadingMode;
|
||||
import com.commafeed.backend.model.UserSettings.ReadingOrder;
|
||||
import com.commafeed.backend.model.UserSettings.ViewMode;
|
||||
import com.commafeed.frontend.model.Settings;
|
||||
import com.commafeed.frontend.model.UserModel;
|
||||
import com.commafeed.frontend.model.request.ProfileModificationRequest;
|
||||
@@ -39,12 +40,14 @@ public class UserREST extends AbstractResourceREST {
|
||||
if (settings != null) {
|
||||
s.setReadingMode(settings.getReadingMode().name());
|
||||
s.setReadingOrder(settings.getReadingOrder().name());
|
||||
s.setViewMode(settings.getViewMode().name());
|
||||
s.setShowRead(settings.isShowRead());
|
||||
s.setSocialButtons(settings.isSocialButtons());
|
||||
s.setCustomCss(settings.getCustomCss());
|
||||
} else {
|
||||
s.setReadingMode(ReadingMode.unread.name());
|
||||
s.setReadingOrder(ReadingOrder.desc.name());
|
||||
s.setViewMode(ViewMode.title.name());
|
||||
s.setShowRead(true);
|
||||
s.setSocialButtons(true);
|
||||
}
|
||||
@@ -65,6 +68,7 @@ public class UserREST extends AbstractResourceREST {
|
||||
s.setReadingMode(ReadingMode.valueOf(settings.getReadingMode()));
|
||||
s.setReadingOrder(ReadingOrder.valueOf(settings.getReadingOrder()));
|
||||
s.setShowRead(settings.isShowRead());
|
||||
s.setViewMode(ViewMode.valueOf(settings.getViewMode()));
|
||||
s.setCustomCss(settings.getCustomCss());
|
||||
userSettingsDAO.saveOrUpdate(s);
|
||||
return Response.ok(Status.OK).build();
|
||||
|
||||
@@ -269,6 +269,10 @@
|
||||
color: #555;
|
||||
}
|
||||
|
||||
#feed-accordion.expanded .entry {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* admin */
|
||||
.admin .users-table {
|
||||
height: 400px;
|
||||
|
||||
@@ -352,13 +352,13 @@ function($scope, $http, $state, $stateParams, $route, $location,
|
||||
|
||||
$scope.session = ProfileService.get();
|
||||
$scope.ServerService = ServerService.get();
|
||||
|
||||
$scope.settingsService = SettingsService;
|
||||
|
||||
$scope.loading = true;
|
||||
$scope.$watch(totalActiveAjaxRequests, function() {
|
||||
$scope.loading = (totalActiveAjaxRequests() !== 0);
|
||||
});
|
||||
|
||||
$scope.settingsService = SettingsService;
|
||||
|
||||
$scope.$watch('settingsService.settings.readingMode', function(
|
||||
newValue, oldValue) {
|
||||
if (newValue && oldValue && newValue != oldValue) {
|
||||
@@ -371,6 +371,12 @@ function($scope, $http, $state, $stateParams, $route, $location,
|
||||
SettingsService.save();
|
||||
}
|
||||
});
|
||||
$scope.$watch('settingsService.settings.viewMode', function(
|
||||
newValue, oldValue) {
|
||||
if (newValue && oldValue && newValue != oldValue) {
|
||||
SettingsService.save();
|
||||
}
|
||||
});
|
||||
$scope.refresh = function() {
|
||||
if($stateParams._type == 'feed'){
|
||||
FeedService.refresh({
|
||||
@@ -404,10 +410,9 @@ function($scope, $http, $state, $stateParams, $route, $location,
|
||||
|
||||
$scope.toggleOrder = function() {
|
||||
var settings = $scope.settingsService.settings;
|
||||
settings.readingOrder = settings.readingOrder == 'asc' ? 'desc'
|
||||
: 'asc';
|
||||
settings.readingOrder = settings.readingOrder == 'asc' ? 'desc' : 'asc';
|
||||
};
|
||||
|
||||
|
||||
$scope.toAdmin = function() {
|
||||
$location.path('admin');
|
||||
};
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
<i ng-class="{'icon-arrow-up' : settingsService.settings.readingOrder == 'asc', 'icon-arrow-down': settingsService.settings.readingOrder == 'desc'}"></i>
|
||||
</button>
|
||||
|
||||
<div class="btn-group" data-toggle="buttons-radio">
|
||||
<button type="button" class="btn" ng-model="settingsService.settings.viewMode" btn-radio="'title'"><i class="icon-list"></i></button>
|
||||
<button type="button" class="btn" ng-model="settingsService.settings.viewMode" btn-radio="'expanded'"><i class="icon-th-list"></i></button>
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn" ng-click="refresh()"><i class="icon-refresh"></i> Refresh</button>
|
||||
<button type="button" class="btn" ng-click="markAllAsRead()"><i class="icon-ok"></i> Mark all as read</button>
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
<h3><span>{{name}} </span><span ng-show="name && selectedType == 'category'"> »</span></h3>
|
||||
</div>
|
||||
|
||||
<div infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy || !settingsService.settings.readingMode" infinite-scroll-distance="1" id="feed-accordion">
|
||||
<div infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy || !settingsService.settings.readingMode" infinite-scroll-distance="1" id="feed-accordion"
|
||||
ng-class="{'expanded' : settingsService.settings.viewMode == 'expanded' }">
|
||||
<div ng-show="message && errorCount > 10">Error while loading this feed : {{message}}</div>
|
||||
<div ng-repeat="entry in entries" class="entry" scroll-to="isOpen && current == entry" scroll-to-offset="-58">
|
||||
<a href="{{entry.url}}" target="_blank" class="entry-heading" ng-click="noop($event)" ng-mouseup="entryClicked(entry, $event)"
|
||||
@@ -20,7 +21,7 @@
|
||||
<span class="entry-name" ng-class="{unread: entry.read == false, shrink: true}" ng-bind-html-unsafe="entry.title"></span>
|
||||
|
||||
</a>
|
||||
<div class="entry-body" ui-if="isOpen && current == entry">
|
||||
<div class="entry-body" ui-if="settingsService.settings.viewMode == 'expanded' || (isOpen && current == entry)">
|
||||
<div>
|
||||
<h4>
|
||||
<a href="{{entry.url}}" target="_blank" ng-bind-html-unsafe="entry.title"></a>
|
||||
|
||||
Reference in New Issue
Block a user