initial mobile design (#54)

This commit is contained in:
Athou
2013-05-26 13:34:31 +02:00
parent d4b284eb80
commit c6a8c288ce
15 changed files with 156 additions and 72 deletions

View File

@@ -28,8 +28,8 @@ module.run(['$rootScope', function($rootScope) {
});
}]);
module.controller('SubscribeCtrl', ['$scope', 'FeedService', 'CategoryService',
function($scope, FeedService, CategoryService) {
module.controller('SubscribeCtrl', ['$scope', 'FeedService', 'CategoryService', 'MobileService',
function($scope, FeedService, CategoryService, MobileService) {
$scope.opts = {
backdropFade : true,
@@ -41,6 +41,7 @@ function($scope, FeedService, CategoryService) {
$scope.sub = {};
$scope.CategoryService = CategoryService;
$scope.MobileService = MobileService;
$scope.open = function() {
$scope.sub = {
@@ -436,9 +437,9 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
}]);
module.controller('ToolbarCtrl', ['$scope', '$http', '$state', '$stateParams',
'$route', '$location', 'SettingsService', 'EntryService', 'ProfileService', 'AnalyticsService', 'ServerService', 'FeedService',
'$route', '$location', 'SettingsService', 'EntryService', 'ProfileService', 'AnalyticsService', 'ServerService', 'FeedService', 'MobileService',
function($scope, $http, $state, $stateParams, $route, $location,
SettingsService, EntryService, ProfileService, AnalyticsService, ServerService, FeedService) {
SettingsService, EntryService, ProfileService, AnalyticsService, ServerService, FeedService, MobileService) {
function totalActiveAjaxRequests() {
return ($http.pendingRequests.length + $.active);
@@ -447,6 +448,7 @@ function($scope, $http, $state, $stateParams, $route, $location,
$scope.session = ProfileService.get();
$scope.ServerService = ServerService.get();
$scope.settingsService = SettingsService;
$scope.MobileService = MobileService;
$scope.loading = true;
$scope.$watch(totalActiveAjaxRequests, function() {

View File

@@ -231,8 +231,9 @@ module.directive('category', [ function() {
'FeedService',
'CategoryService',
'SettingsService',
'MobileService',
function($scope, $state, $dialog, FeedService, CategoryService,
SettingsService) {
SettingsService, MobileService) {
$scope.settingsService = SettingsService;
$scope.getClass = function(level) {
@@ -265,6 +266,7 @@ module.directive('category', [ function() {
};
$scope.feedClicked = function(id) {
MobileService.toggleLeftMenu();
if ($scope.selectedType == 'feed'
&& id == $scope.selectedId) {
$scope.$emit('emitReload');
@@ -277,6 +279,7 @@ module.directive('category', [ function() {
};
$scope.categoryClicked = function(id) {
MobileService.toggleLeftMenu();
if ($scope.selectedType == 'category'
&& id == $scope.selectedId) {
$scope.$emit('emitReload');

View File

@@ -12,6 +12,17 @@ module.service('AnalyticsService', [ '$state', function($state) {
};
} ]);
module.service('MobileService', [ '$state', function($state) {
this.toggleLeftMenu = function() {
$('body').toggleClass('left-menu-active');
}
this.toggleRightMenu = function() {
$('body').toggleClass('right-menu-active');
}
var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
this.mobile = width < 979;
}]);
module.factory('ProfileService', ['$resource', function($resource) {
var res = $resource('rest/user/profile/');