check js and css

This commit is contained in:
Athou
2013-03-31 11:30:52 +02:00
parent b4ebfa4b74
commit b41280812b
7 changed files with 206 additions and 170 deletions

27
pom.xml
View File

@@ -49,6 +49,33 @@
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>1.6.3</version>
<executions>
<execution>
<id>js</id>
<phase>test</phase>
<goals>
<goal>jshint</goal>
</goals>
<configuration>
<options>indent,devel,noarg,quotmark</options>
</configuration>
</execution>
<execution>
<id>css</id>
<phase>test</phase>
<goals>
<goal>csslint</goal>
</goals>
<configuration>
<options>box-model,display-property-grouping,duplicate-properties,adjoining-classes,compatible-vendor-prefixes,vendor-prefix</options>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns="http://www.isdc.ro/wro">
<group name="core">
<css>/css/*.css</css>
<js>/js/*.js</js>
</group>
</groups>

View File

@@ -11,7 +11,6 @@
z-index: 10;
position: fixed;
background-color: #FFF;
width: 100%;
}
.entryList {
@@ -85,11 +84,10 @@
#feed-accordion .entry-heading {
height: 20px;
padding: 6px 0px;
display: block;
color: black;
cursor: pointer;
padding: 6px 0px;
margin: 6px 0px;
}
#feed-accordion .entry-heading .feed-name {

View File

@@ -22,36 +22,37 @@ module.controller('CategoryTreeCtrl', function($scope, $stateParams, $location,
var unreadCount = function(category) {
var count = 0;
var i;
if (category.children) {
for ( var i = 0; i < category.children.length; i++) {
for (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++) {
for (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 + ")";
label = label + ' (' + count + ')';
}
return label;
}
};
$scope.formatFeedName = function(feed) {
var label = feed.name;
if (feed.unread > 0) {
label = label + " (" + feed.unread + ")";
label = label + ' (' + feed.unread + ')';
}
return label;
}
};
$scope.feedClicked = function(id) {
if ($scope.selectedType == 'feed' && id == $scope.selectedId) {
@@ -76,13 +77,14 @@ module.controller('CategoryTreeCtrl', function($scope, $stateParams, $location,
};
var mark = function(node, entry) {
var i;
if (node.children) {
for ( var i = 0; i < node.children.length; i++) {
for (i = 0; i < node.children.length; i++) {
mark(node.children[i], entry);
}
}
if (node.feeds) {
for ( var i = 0; i < node.feeds.length; i++) {
for (i = 0; i < node.feeds.length; i++) {
var feed = node.feeds[i];
if (feed.id == entry.feedId) {
var c = entry.read ? -1 : 1;
@@ -93,7 +95,7 @@ module.controller('CategoryTreeCtrl', function($scope, $stateParams, $location,
};
$scope.$on('mark', function(event, args) {
mark($scope.SubscriptionService.subscriptions, args.entry)
mark($scope.SubscriptionService.subscriptions, args.entry);
});
});
@@ -126,10 +128,10 @@ module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
$scope.busy = true;
var limit = $scope.limit;
if ($scope.entries.length == 0) {
if ($scope.entries.length === 0) {
$window = angular.element($window);
limit = $window.height() / 33;
limit = parseInt(limit) + 5;
limit = parseInt(limit, 10) + 5;
}
EntryService.get({
type : $scope.selectedType,
@@ -141,12 +143,11 @@ module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
for ( var i = 0; i < data.entries.length; i++) {
$scope.entries.push(data.entries[i]);
}
;
$scope.name = data.name;
$scope.busy = false;
$scope.hasMore = data.entries.length == limit
$scope.hasMore = data.entries.length == limit;
});
}
};
$scope.mark = function(entry, read) {
if (entry.read != read) {
@@ -175,7 +176,7 @@ module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
event.preventDefault();
event.stopPropagation();
}
}
};
var openNextEntry = function(event) {
var entry = null;
@@ -222,23 +223,23 @@ module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
Mousetrap.bind('space', function(e) {
$scope.$apply(function() {
openNextEntry(e);
})
});
});
Mousetrap.bind('j', function(e) {
$scope.$apply(function() {
openNextEntry(e);
})
});
});
Mousetrap.bind('shift+space', function(e) {
$scope.$apply(function() {
openPreviousEntry(e);
})
});
});
Mousetrap.bind('k', function(e) {
$scope.$apply(function() {
openPreviousEntry(e);
})
});
});
$scope.$on('reload', function(event, args) {
@@ -291,15 +292,15 @@ module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
$scope.cancel = function(){
$state.transitionTo('admin.userlist');
}
};
$scope.save = function() {
$scope.alerts.splice(0, $scope.alerts.length);
AdminUsersService.save($scope.user, function() {
$state.transitionTo('admin.userlist');
}, alertFunction);
};
$scope.delete = function() {
AdminUsersService.delete({id: $scope.user.id}, function() {
$scope.remove = function() {
AdminUsersService.remove({id: $scope.user.id}, function() {
$state.transitionTo('admin.userlist');
},alertFunction);
};

View File

@@ -123,10 +123,11 @@ module.directive('category', function($compile) {
templateUrl : 'directives/category.html',
link : function(scope, element) {
var ul = element.find('ul');
ul.prepend('<category ng-repeat="child in node.children" node="child" feed-click="feedClick({id:id})" \
category-click="categoryClick({id:id})" selected-type="selectedType" selected-id="selectedId" \
format-category-name="formatCategoryName({category:category})" format-feed-name="formatFeedName({feed:feed})">\
</category>');
var html = '<category ng-repeat="child in node.children" node="child" feed-click="feedClick({id:id})" ';
html = html + 'category-click="categoryClick({id:id})" selected-type="selectedType" selected-id="selectedId" ';
html = html + 'format-category-name="formatCategoryName({category:category})" format-feed-name="formatFeedName({feed:feed})"> ';
html = html + '</category>';
ul.prepend(html);
$compile(ul.contents())(scope);
},
controller : function($scope, $dialog, SubscriptionService) {
@@ -178,7 +179,7 @@ module.directive('toolbar', function($stateParams, $route, $location,
$scope.loading = true;
$scope.$watch(totalActiveAjaxRequests, function() {
$scope.loading = !(totalActiveAjaxRequests() === 0);
$scope.loading = (totalActiveAjaxRequests() !== 0);
});
$scope.settingsService = SettingsService;
@@ -189,7 +190,7 @@ module.directive('toolbar', function($stateParams, $route, $location,
EntryService.mark({
type : $stateParams._type,
id : $stateParams._id,
read : true,
read : true
}, function() {
SubscriptionService.init(function() {
$scope.$emit('emitReload');
@@ -211,7 +212,7 @@ module.directive('toolbar', function($stateParams, $route, $location,
module.directive('spinner', function() {
return {
scope : {
shown : '=',
shown : '='
},
restrict : 'A',
link : function($scope, element) {
@@ -242,5 +243,5 @@ module.directive('spinner', function() {
}
});
}
}
};
});

View File

@@ -9,10 +9,13 @@ module.factory('SubscriptionService', function($resource, $http) {
var flatten = function(category, parentName, array) {
if (!array)
array = [];
var name = category.name;
if (parentName) {
name += (' (in ' + parentName + ')');
}
array.push({
id : category.id,
name : category.name
+ (parentName ? (' (in ' + parentName + ')') : '')
name : name
});
if (category.children) {
for ( var i = 0; i < category.children.length; i++) {
@@ -20,7 +23,7 @@ module.factory('SubscriptionService', function($resource, $http) {
}
}
return array;
}
};
var actions = {
fetch : {
method : 'GET',
@@ -104,7 +107,7 @@ module.factory('SubscriptionService', function($resource, $http) {
}
}
}
};
s.unsubscribe = function(id) {
removeSubscription(s.subscriptions, id);
res.unsubscribe({
@@ -123,8 +126,7 @@ module.factory('SubscriptionService', function($resource, $http) {
return s;
});
module.factory('EntryService',
function($resource, $http) {
module.factory('EntryService', function($resource, $http) {
var actions = {
get : {
method : 'GET',
@@ -144,7 +146,7 @@ module.factory('EntryService',
});
module.factory('SettingsService', function($resource) {
var s = {}
var s = {};
s.settings = {};
$resource('rest/settings/get').get(function(data) {
s.settings = data;
@@ -176,7 +178,7 @@ module.factory('AdminUsersService', function($resource) {
_method : 'save'
}
},
delete : {
remove : {
method : 'GET',
params : {
_method : 'delete'

View File

@@ -39,7 +39,7 @@
<div class="control-group">
<div class="controls">
<button type="button" class="btn" ng-click="cancel()">Cancel</button>
<button type="button" class="btn btn-danger" ng-click="delete()">Delete</button>
<button type="button" class="btn btn-danger" ng-click="remove()">Delete</button>
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>