-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from graphefruit/integerFix
Integer Fix + Last coffee default
- Loading branch information
Showing
19 changed files
with
394 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/classes/settings/settingsDefaultLastCoffeeParameter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/**Interfacdes**/ | ||
|
||
import {IDefaultLastCoffeeParameters} from "../../interfaces/settings/iDefaultLastCoffeeParameters"; | ||
|
||
export class DefaultLastCoffeeParameters implements IDefaultLastCoffeeParameters { | ||
public brew_time: boolean; | ||
public grind_size: boolean; | ||
public grind_weight: boolean; | ||
public method_of_preparation: boolean; | ||
public brew_quantity: boolean; | ||
public bean_type: boolean; | ||
public brew_temperature:boolean; | ||
public note: boolean; | ||
public coffee_type:boolean; | ||
public coffee_concentration:boolean; | ||
public coffee_first_drip_time:boolean; | ||
public coffee_blooming_time:boolean; | ||
public rating:boolean; | ||
|
||
constructor() { | ||
this.bean_type = true; | ||
this.brew_time = true; | ||
this.grind_size = true; | ||
this.grind_weight = true; | ||
this.method_of_preparation = true; | ||
this.brew_quantity = true; | ||
this.bean_type = true; | ||
this.brew_temperature = true; | ||
this.note = false; | ||
this.coffee_type = true; | ||
this.coffee_concentration = true; | ||
this.coffee_first_drip_time = true; | ||
this.coffee_blooming_time = true; | ||
this.rating = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/**Core**/ | ||
import {Directive} from '@angular/core'; | ||
import {NgModel} from '@angular/forms'; | ||
|
||
@Directive({ | ||
selector: '[ngModel][prevent-characters]', | ||
providers: [NgModel], | ||
host: { | ||
'(keydown)': 'onKeyDown($event)', | ||
"(ionBlur)": 'blur()' | ||
} | ||
}) | ||
export class PreventCharacterDirective { | ||
|
||
|
||
//@Output() ngModelChange:EventEmitter<any> = new EventEmitter(); | ||
|
||
constructor(private model: NgModel) { | ||
|
||
} | ||
|
||
|
||
onKeyDown($event) { | ||
let pressedKeyCode: number = $event.keyCode; | ||
|
||
if ($event.shiftKey == false && $event.ctrlKey == false && (pressedKeyCode >= 48 && pressedKeyCode <= 57) || (pressedKeyCode >= 96 && pressedKeyCode <= 105)) { | ||
// 0-9 only | ||
//Its okay | ||
} | ||
else if (pressedKeyCode == 8) { | ||
//Delete backspace ok | ||
} | ||
else if (pressedKeyCode == 190 || pressedKeyCode == 188) { | ||
//Comma, Point support | ||
} | ||
else { | ||
//Everything else we block | ||
$event.preventDefault(); | ||
$event.stopPropagation(); | ||
} | ||
|
||
} | ||
|
||
blur(){ | ||
|
||
let val: any = this.model.control.value; | ||
val = val + ""; | ||
console.log(val); | ||
if (val == "") { | ||
val = "0"; | ||
} | ||
if (val.indexOf(',')) { | ||
val = val.replace(/,/g, '.'); | ||
} | ||
|
||
//Emit worked aswell but I don't know what its doing in depth | ||
//this.ngModelChange.emit(parseFloat(val)); | ||
|
||
this.model.control.setValue(parseFloat(val)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/**Interfaces**/ | ||
|
||
|
||
export interface IDefaultLastCoffeeParameters { | ||
//Properties | ||
brew_time: boolean, | ||
grind_size: boolean, | ||
grind_weight: boolean, | ||
method_of_preparation: boolean, | ||
brew_quantity: boolean, | ||
bean_type: boolean, | ||
brew_temperature:boolean, | ||
note: boolean, | ||
coffee_type:boolean, | ||
coffee_concentration:boolean, | ||
coffee_first_drip_time:boolean, | ||
coffee_blooming_time:boolean, | ||
rating:boolean; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.