Robert Marshall 8 年之前
父節點
當前提交
8d3529165b

+ 1 - 3
Model/DBObject.php

@@ -131,8 +131,6 @@ class DBObject implements ISavableObject {
 		}
 
 		if (count($this->_ids)!==0) {
-			#$sql="UPDATE `{$this->_table}` SET ".implode(", ", $fields)." WHERE `{$this->_keys}`=:soi5yh58y";
-			#$execData[':soi5yh58y']=$this->_ids;
 			$sql="UPDATE `{$this->_table}` SET ".implode(", ", $fields)." WHERE".$this->GetWhereClause();
 			$execData=array_merge($execData, $this->_ids);
 		} else {
@@ -148,7 +146,7 @@ class DBObject implements ISavableObject {
 		if (count($this->_ids)===0) { // If this is a new object we want to reload fromt he DB to make sure all fields are correct.
 			// In order to do so we need to find the value for the key we're using
 			$id=$PDO->lastInsertId();
-			if ($id!=0&&count($this->_keys)==0) {
+			if ($id!=0 && count($this->_keys)==0) {
 				$this->_keys=$this->_ids=array();
 				$key=$PDO->query("SHOW INDEX FROM `{$this->_table}` WHERE Key_name='PRIMARY'")->fetch()['Column_name'];
 				$this->_keys[]=$key;

+ 7 - 5
css/style-med.css

@@ -1,15 +1,17 @@
+body {
+  display: initial;
+}
 #menu {
+  left: 0;
+  position: fixed;
+  height: 100%;
   box-shadow: -10px 0px 5px 10px #212121;
   transition: all ease-in-out 0.4s;
 }
 #menu.ng-hide {
   left: -280px;
 }
-#main,
-#main-header {
-  padding-left: 0;
-}
-#menu-button {
+#main #main-header #menu-button {
   cursor: pointer;
   display: inline-block;
   max-height: 100%;

+ 2 - 5
css/style-small.css

@@ -2,13 +2,10 @@ dl {
   margin-top: 12px;
   margin-bottom: 12px;
 }
-#main {
-  padding-top: 48px;
-}
-#main-header .header span:not(:last-child) {
+#main #main-header .header span:not(:last-child) {
   display: none;
 }
-#main-header .header > * {
+#main #main-header .header > * {
   padding-left: 15px !important;
 }
 #nav-container {

+ 32 - 23
css/style.css

@@ -4,6 +4,10 @@
   outline: none;
   transition: background-color 0.2s ease;
 }
+html {
+  width: 100%;
+  height: 100%;
+}
 html,
 body,
 h1,
@@ -20,7 +24,9 @@ textarea {
 }
 body {
   width: 100%;
+  height: 100%;
   background: #fafafa;
+  display: flex;
 }
 a {
   color: #26a69a;
@@ -104,44 +110,47 @@ p:first-child {
 #menu {
   background: #fafafa;
   width: 280px;
-  left: 0;
-  position: fixed;
-  height: 100%;
+  flex: 0 0 auto;
+  display: flex;
+  flex-direction: column;
   box-shadow: -2px 0px 0px 0px #eeeeee inset;
   z-index: 400;
   overflow-x: hidden;
 }
-#menu .header {
-  z-index: 401;
-}
-#menu-button {
-  display: none;
-}
-#nav-container {
+#menu #nav-container {
   overflow: auto;
   width: 100%;
+  flex: 1 1 auto;
 }
-#nav-container dl {
+#menu #nav-container dl {
   margin: 5px 0 0 0;
 }
+#menu .header {
+  z-index: 401;
+  flex: 0 0 auto;
+  overflow: auto;
+}
 #main {
-  padding-left: 280px;
-  padding-top: 64px;
+  flex: 1 1 auto;
+  display: flex;
+  flex-direction: column;
+  overflow: hidden;
+  height: 100%;
 }
-#main > * {
-  padding-left: 20px !important;
+#main #main-header {
+  flex: 0 0 auto;
 }
-#main-header {
-  position: fixed;
-  padding-left: 280px;
-  left: 0;
-  right: 0;
-  z-index: 1;
+#main #main-header #menu-button {
+  display: none;
 }
-#main-header .header > * {
+#main #main-header .header > * {
   padding-left: 20px !important;
 }
-#content {
+#main #content {
+  flex: 1 1 auto;
+  overflow: auto;
+}
+#main #content #body {
   padding: 20px;
   margin-bottom: 60px;
 }

+ 17 - 11
less/style-med.less

@@ -1,7 +1,13 @@
 @import "colours.less";
 
+body{
+	display:initial;
+}
+
 #menu{
-	//display: none;
+	left:0;
+	position:fixed;
+	height:100%;
 	box-shadow:-10px 0px 5px 10px @Grey-900;
 	transition:all ease-in-out 0.4s;
 
@@ -10,19 +16,19 @@
 	}
 }
 
-#main, #main-header{
-	padding-left:0;
-}
-
-#menu-button{
-	cursor: pointer;
-	display: inline-block;
-	max-height: 100%;
+#main{
+	#main-header{
+		#menu-button{
+			cursor: pointer;
+			display: inline-block;
+			max-height: 100%;
+		}
+	}
 }
 
 #buttons{
 	left:0;
-	
+
 	button{
 		width:60px;
 		height:60px;
@@ -34,7 +40,7 @@
 }
 
 .row{
-	
+
 	>.col {
 		width:100%;
 		float:left;

+ 10 - 13
less/style-small.less

@@ -4,18 +4,15 @@ dl{
 }
 
 #main{
-	padding-top: 48px;
-}
-
-#main-header{
-	.header {
-		
-		span:not(:last-child){
-			display:none;
-		}
-
-		>*{
-			padding-left: 15px !important;
+	#main-header{
+		.header {
+			span:not(:last-child){
+				display:none;
+			}
+
+			>*{
+				padding-left: 15px !important;
+			}
 		}
 	}
 }
@@ -26,7 +23,7 @@ dl{
 
 .header{
 	height: 48px;
-	
+
 	> *{
 		line-height: 48px;
 		font-size:18px;

+ 45 - 33
less/style.less

@@ -9,6 +9,11 @@
 	transition: background-color 0.2s ease;
 }
 
+html{
+	width:100%;
+	height:100%;
+}
+
 html,body,h1,h2, button {
 	padding:0;
 	margin:0;
@@ -20,7 +25,9 @@ html, button, input, textarea{
 
 body{
 	width:100%;
+	height:100%;
 	background:@background;
+	display:flex;
 }
 
 a {
@@ -124,55 +131,60 @@ p:first-child{
 #menu{
 	background:@background;
 	width:280px;
-	left:0;
-	position:fixed;
-	height:100%;
+	flex: 0 0 auto;
+	display:flex;
+	flex-direction: column;
 	box-shadow: -2px 0px 0px 0px @control inset;
 	z-index: 400;
 	overflow-x: hidden;
 
+	#nav-container{
+		overflow: auto;
+		width:100%;
+		flex:1 1 auto;
+
+		dl {
+			margin: 5px 0 0 0;
+		}
+	}
+
 	.header{
 		z-index: 401;
+		flex: 0 0 auto;
+		overflow: auto;
 	}
 }
 
-#menu-button{
-	display:none;
-}
-
-#nav-container{
-	overflow: auto;
-	width:100%;
+#main{
+	flex: 1 1 auto;
+	display:flex;
+	flex-direction: column;
+	overflow:hidden;
+	height:100%;
 
-	dl {
-		margin: 5px 0 0 0;
-	}
-}
+	#main-header{
+		flex: 0 0 auto;
 
-#main{
-	padding-left:280px;
-	padding-top:64px;
+		#menu-button{
+			display:none;
+		}
 
-	>*{
-		padding-left:20px !important;
+		.header>*{
+			padding-left: 20px !important;
+		}
 	}
-}
 
-#main-header{
-	position: fixed;
-	padding-left: 280px;
-	left:0;
-	right:0;
-	z-index: 1;
+	#content{
+		flex: 1 1 auto;
+		overflow:auto;
+
+		#body{
+			padding:20px;
+			margin-bottom:60px;
 
-	.header>*{
-		padding-left: 20px !important;
+		}
 	}
-}
 
-#content{
-	padding:20px;
-	margin-bottom:60px;
 }
 
 #buttons{
@@ -249,7 +261,7 @@ p:first-child{
 	&.ng-hide{
 		opacity: 0;
 	}
-	
+
 	>img{
 		margin: auto;
 	}

+ 1 - 1
scripts/controllers/main.js

@@ -53,7 +53,7 @@ var app = angular.module("robware", ['ngAnimate'], function($httpProvider) {
 		function($rootScope, $q) {
 			return {
 				request: function(config) {
-					if (!config.dontShowSpinner)
+					if (config.showSpinner)
 						$rootScope.showSpinner();
 					return config;
 				},

+ 5 - 7
scripts/javascript.js

@@ -68,23 +68,21 @@ $(function() {
 
 	$("nav > dl > dt").click(function(e) {
 		var next = $(this).next();
-		if (!next.hasClass("sub-pages") || next.is(":visible")) {
+		if (!next.hasClass("sub-pages")) {
 			Navigate($(this).children("a").attr("href"));
 			return;
 		}
 		panels.slideUp();
 		goIndicators.hide();
 		expandIndicators.show();
+		if (next.is(":visible")) {
+			return;
+		}
 		next.slideDown();
 		$(this).children(".go").show();
 		$(this).children(".expand").hide();
 	});
 
-	$("nav > dl > dt").each(function() {
-		if ($(this).next().hasClass("sub-pages"))
-			$(this).attr("title", "Click once to expand, click again to go");
-	});
-
 	$("nav dd").click(function(e) {
 		Navigate($(this).children("a").attr("href"));
 	});
@@ -94,7 +92,7 @@ $(function() {
 		return false;
 	});
 
-	$("#content").css("margin-bottom", window.innerHeight - $("#buttons").offset().top);
+	$("#content").css("padding-bottom", window.innerHeight - $("#buttons").offset().top);
 
 	$("form[ajaxForm]").submit(function(e) {
 		e.preventDefault();

+ 3 - 3
scripts/services/statusService.js

@@ -40,20 +40,20 @@ app.service('statusService', function($http) {
 	}
 	
 	this.getProcesses = function() {
-		return $http.get('/status/getprocesses', {dontShowSpinner:true}).then(function(response) {
+		return $http.get('/status/getprocesses').then(function(response) {
 			parsedData = parseProcessData(response.data);
 			return {headers: parsedData[0], data: parsedData[1]};
 		});
 	};
 	
 	this.getSystemInfo=function(){
-		return $http.get('/status/getsysteminfo', {dontShowSpinner:true}).then(function(response){
+		return $http.get('/status/getsysteminfo').then(function(response){
 			return response.data;
 		});
 	};
 	
 	this.getUptime=function(){
-		return $http.get('/status/getuptime', {dontShowSpinner:true}).then(function(response){
+		return $http.get('/status/getuptime').then(function(response){
 			return response.data;
 		})
 	};

+ 6 - 3
scripts/services/weightService.js

@@ -3,7 +3,8 @@ app.service('weightService', function($http) {
 		return $http({
 			method:'post',
 			url:'/weight/add',
-			data:{weight:weight, fat:fat}
+			data:{weight:weight, fat:fat},
+			showSpinner:true
 		}).then(function(response){
 			return response.data;
 		});
@@ -12,7 +13,8 @@ app.service('weightService', function($http) {
 		return $http({
 			method:'post',
 			url:'/weight/delete',
-			data:{id:id}
+			data:{id:id},
+			showSpinner:true
 		}).then(function(response){
 			return response.data;
 		});
@@ -20,7 +22,8 @@ app.service('weightService', function($http) {
 	this.getReadings=function(){
 		return $http({
 			method:'post',
-			url:'/weight/getreadings'
+			url:'/weight/getreadings',
+			showSpinner:true
 		}).then(function(response){
 			return response.data;
 		});

+ 28 - 26
template.php

@@ -66,17 +66,6 @@ function FormatURI(URI $uri, $base=""){
 		</script>
 	</head>
 	<body ng-controller="main" ng-class="{scrollLock: (menuVisible && window.innerWidth < 1024) || spinnerVisible}">
-		<div id="main-header">
-			<div class="header">
-				<img src="/images/menu.svg" id="menu-button" ng-click="menuVisible=!menuVisible" /><?php // using php tags to remove HTML space but to keep source tidy
-				?><h2><?php // Shitty, I know, but eh...
-					?><span>{@Title}</span><?php
-					$__crumbs=Breadcrumbs::GetAll();
-					foreach ($__crumbs as $crumb)
-						echo '<span>',$crumb['text'],'</span>';
-				?></h2>
-			</div>
-		</div>
 		<div id="menu" ng-show="shouldShowMenu()">
 			<div class="header">
 				<img src="/images/logo.png" /><h1>Robware</h1>
@@ -117,24 +106,37 @@ function FormatURI(URI $uri, $base=""){
 			</div>
 		</div>
 		<div id="main">
-			<div id="buttons">
-				<table>
-					<tr>
-						<td>{@ButtonsLeft}</td>
-						<td>{@ButtonsRight}</td>
-					</tr>
-				</table>
+			<div id="main-header">
+				<div class="header">
+					<img src="/images/menu.svg" id="menu-button" ng-click="menuVisible=!menuVisible" /><?php // using php tags to remove HTML space but to keep source tidy
+					?><h2><?php // Shitty, I know, but eh...
+						?><span>{@Title}</span><?php
+						$__crumbs=Breadcrumbs::GetAll();
+						foreach ($__crumbs as $crumb)
+							echo '<span>',$crumb['text'],'</span>';
+					?></h2>
+				</div>
 			</div>
 			<div id="content">
-				<?php if (isset($errors) && count($errors)>0){
-					echo '<div class="errors">The following errors were encountered:<ul>';
-					foreach ($errors as $e)
-						echo '<li>',$e,'</li>';
-					echo '</ul>Please rectify them and try again.</div>';
-				} ?>
-				{@Body}
+				<div id="buttons">
+					<table>
+						<tr>
+							<td>{@ButtonsLeft}</td>
+							<td>{@ButtonsRight}</td>
+						</tr>
+					</table>
+				</div>
+				<div id="body">
+					<?php if (isset($errors) && count($errors)>0){
+						echo '<div class="errors">The following errors were encountered:<ul>';
+						foreach ($errors as $e)
+							echo '<li>',$e,'</li>';
+						echo '</ul>Please rectify them and try again.</div>';
+					} ?>
+					{@Body}
+				</div>
+				<div id="footer">{@Footer}</div>
 			</div>
-			<div id="footer">{@Footer}</div>
 		</div>
 		<div class="backdrop" ng-show="shouldShowMenu()" ng-click="menuVisible=false"></div>
 		<div id="spinner" class="backdrop" ng-show="spinnerVisible">