···
1
1
+
.bordered-edges(@width: 1px, @top-color: #EEE, @right-color: #EEE, @bottom-color: #EEE, @left-color: #EEE) {
2
2
+
border-top: solid @width @top-color;
3
3
+
border-left: solid @width @left-color;
4
4
+
border-right: solid @width @right-color;
5
5
+
border-bottom: solid @width @bottom-color;
6
6
+
}
7
7
+
.bordered(@width: 1px; @color: #000){
8
8
+
.bordered-edges(@width, @color, @color, @color, @color)
9
9
+
}
10
10
+
11
11
+
12
12
+
.no-select(){
13
13
+
-webkit-touch-callout: none;
14
14
+
-webkit-user-select: none;
15
15
+
-khtml-user-select: none;
16
16
+
-moz-user-select: none;
17
17
+
-ms-user-select: none;
18
18
+
-o-user-select: none;
19
19
+
user-select: none;
20
20
+
cursor: default;
21
21
+
}
···
1
1
+
// Mixins for flex compatibility
2
2
+
3
3
+
// --------------------------------------------------
4
4
+
// Flexbox LESS mixins
5
5
+
// The spec: http://www.w3.org/TR/css3-flexbox
6
6
+
// --------------------------------------------------
7
7
+
8
8
+
// Flexbox display
9
9
+
// flex or inline-flex
10
10
+
.flex-display(@display: flex) {
11
11
+
display: ~"-webkit-@{display}";
12
12
+
display: ~"-moz-@{display}";
13
13
+
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
14
14
+
display: ~"-ms-@{display}"; // IE11
15
15
+
display: @display;
16
16
+
}
17
17
+
18
18
+
// The 'flex' shorthand
19
19
+
// - applies to: flex items
20
20
+
// <positive-number>, initial, auto, or none
21
21
+
.flex(@columns: initial) {
22
22
+
-webkit-flex: @columns;
23
23
+
-moz-flex: @columns;
24
24
+
-ms-flex: @columns;
25
25
+
flex: @columns;
26
26
+
}
27
27
+
28
28
+
// Flex Flow Direction
29
29
+
// - applies to: flex containers
30
30
+
// row | row-reverse | column | column-reverse
31
31
+
.flex-direction(@direction: row) {
32
32
+
-webkit-flex-direction: @direction;
33
33
+
-moz-flex-direction: @direction;
34
34
+
-ms-flex-direction: @direction;
35
35
+
flex-direction: @direction;
36
36
+
}
37
37
+
38
38
+
// Flex Line Wrapping
39
39
+
// - applies to: flex containers
40
40
+
// nowrap | wrap | wrap-reverse
41
41
+
.flex-wrap(@wrap: nowrap) {
42
42
+
-webkit-flex-wrap: @wrap;
43
43
+
-moz-flex-wrap: @wrap;
44
44
+
-ms-flex-wrap: @wrap;
45
45
+
flex-wrap: @wrap;
46
46
+
}
47
47
+
48
48
+
// Flex Direction and Wrap
49
49
+
// - applies to: flex containers
50
50
+
// <flex-direction> || <flex-wrap>
51
51
+
.flex-flow(@flow) {
52
52
+
-webkit-flex-flow: @flow;
53
53
+
-moz-flex-flow: @flow;
54
54
+
-ms-flex-flow: @flow;
55
55
+
flex-flow: @flow;
56
56
+
}
57
57
+
58
58
+
// Display Order
59
59
+
// - applies to: flex items
60
60
+
// <integer>
61
61
+
.flex-order(@order: 0) {
62
62
+
-webkit-order: @order;
63
63
+
-moz-order: @order;
64
64
+
-ms-order: @order;
65
65
+
order: @order;
66
66
+
}
67
67
+
68
68
+
// Flex grow factor
69
69
+
// - applies to: flex items
70
70
+
// <number>
71
71
+
.flex-grow(@grow: 0) {
72
72
+
-webkit-flex-grow: @grow;
73
73
+
-moz-flex-grow: @grow;
74
74
+
-ms-flex-grow: @grow;
75
75
+
flex-grow: @grow;
76
76
+
}
77
77
+
78
78
+
// Flex shr
79
79
+
// - applies to: flex itemsink factor
80
80
+
// <number>
81
81
+
.flex-shrink(@shrink: 1) {
82
82
+
-webkit-flex-shrink: @shrink;
83
83
+
-moz-flex-shrink: @shrink;
84
84
+
-ms-flex-shrink: @shrink;
85
85
+
flex-shrink: @shrink;
86
86
+
}
87
87
+
88
88
+
// Flex basis
89
89
+
// - the initial main size of the flex item
90
90
+
// - applies to: flex itemsnitial main size of the flex item
91
91
+
// <width>
92
92
+
.flex-basis(@width: auto) {
93
93
+
-webkit-flex-basis: @width;
94
94
+
-moz-flex-basis: @width;
95
95
+
-ms-flex-basis: @width;
96
96
+
flex-basis: @width;
97
97
+
}
98
98
+
99
99
+
// Axis Alignment
100
100
+
// - applies to: flex containers
101
101
+
// flex-start | flex-end | center | space-between | space-around
102
102
+
.justify-content(@justify: flex-start) {
103
103
+
-webkit-justify-content: @justify;
104
104
+
-moz-justify-content: @justify;
105
105
+
-ms-justify-content: @justify;
106
106
+
justify-content: @justify;
107
107
+
}
108
108
+
109
109
+
// Packing Flex Lines
110
110
+
// - applies to: multi-line flex containers
111
111
+
// flex-start | flex-end | center | space-between | space-around | stretch
112
112
+
.align-content(@align: stretch) {
113
113
+
-webkit-align-content: @align;
114
114
+
-moz-align-content: @align;
115
115
+
-ms-align-content: @align;
116
116
+
align-content: @align;
117
117
+
}
118
118
+
119
119
+
// Cross-axis Alignment
120
120
+
// - applies to: flex containers
121
121
+
// flex-start | flex-end | center | baseline | stretch
122
122
+
.align-items(@align: stretch) {
123
123
+
-webkit-align-items: @align;
124
124
+
-moz-align-items: @align;
125
125
+
-ms-align-items: @align;
126
126
+
align-items: @align;
127
127
+
}
128
128
+
129
129
+
// Cross-axis Alignment
130
130
+
// - applies to: flex items
131
131
+
// auto | flex-start | flex-end | center | baseline | stretch
132
132
+
.align-self(@align: auto) {
133
133
+
-webkit-align-self: @align;
134
134
+
-moz-align-self: @align;
135
135
+
-ms-align-self: @align;
136
136
+
align-self: @align;
137
137
+
}
···
8
8
<h3> ^^ Sign in to view & punch your times</h3>
9
9
{{/if}} -->
10
10
11
11
-
12
12
-
13
11
<button class="new-punch">Ahoy!</button>
14
12
{{#each days}}
15
13
{{> day}}
16
14
{{/each}}
17
17
-
<button class="nuke">The red button</button>
15
15
+
<button class="nuke">red button</button>
16
16
+
18
17
</div>
19
18
20
19
</body>
21
20
22
21
<template name="day">
23
22
<button class="day">
24
24
-
<span class="{{#if isOnTime}}onTime{{/if}}">
23
23
+
<span class="{{#if isOnTime }}onTime{{/if}}">
24
24
+
25
25
<span class="text">{{dd time}} </span>
26
26
+
<br>
26
27
<span class="text">{{hhss time}} </span>
27
28
</span>
28
29
</button>
···
1
1
Days = new Mongo.Collection("days");
2
2
-
// TODO: create Goal
2
2
+
3
3
goal = new Date();
4
4
goal.setHours(8, 30);
5
5
···
57
57
// METHODS
58
58
Meteor.methods({
59
59
addPunch: function () {
60
60
-
// var start = new Date();
61
61
-
// start.setHours(0,0,0);
62
62
-
// var end = new Date();
63
63
-
// end.setHours(23,59,59);
64
64
-
// var x = Days.find({time: {$gte: start, $lt: end}}).count();
60
60
+
var start = new Date();
61
61
+
start.setHours(0,0,0);
62
62
+
var end = new Date();
63
63
+
end.setHours(23,59,59);
64
64
+
var x = Days.find({time: {$gte: start, $lt: end}}).count();
65
65
//
66
66
-
// if (x == 0) {
66
66
+
if (x == 0) {
67
67
Days.insert({ time: new Date() });
68
68
-
// } else {
69
69
-
// console.log("You already have an entry on that date");
70
70
-
// }
68
68
+
} else {
69
69
+
console.log("You already have an entry on that date");
70
70
+
}
71
71
},
72
72
changeGoal: function (time) {
73
73
// TODO: update goal
···
79
79
},
80
80
isOnTime: function(time) {
81
81
// Make the dates match
82
82
-
83
83
-
84
84
-
85
85
-
return time < goal;
82
82
+
console.log(time < goal);
83
83
+
return (time < goal);
86
84
}
87
85
88
86
});
···
1
1
+
@import "flex";
2
2
+
@import "compatibility";
1
3
2
2
-
@1x: 5em;
4
4
+
@1x: 4em;
3
5
@half: @1x / 2;
4
4
-
@double: @1x * 2;
6
6
+
@quart: @1x / 4;
7
7
+
@gap: @1x / 16;
8
8
+
@2x: @1x * 2;
9
9
+
10
10
+
@dim: rgba(255,255,255,.3);
11
11
+
@clear: rgba(0,0,0,0);
12
12
+
13
13
+
.circled(@size:@1x) {
14
14
+
width: @size;
15
15
+
height: @size;
16
16
+
font-size: @size/2;
17
17
+
border-radius: @size/2;
5
18
6
6
-
.onTime {
7
7
-
color: rgb(0, 128, 255);
8
19
}
9
20
10
21
button {
11
11
-
width: @1x;
12
12
-
height: @1x;
13
13
-
font-size: @half;
14
14
-
border-radius: @half;
15
15
-
border-width: 0px;
16
16
-
background-color: white;
22
22
+
.circled();
23
23
+
margin: @gap;
17
24
}
18
25
19
19
-
.absolute {
20
20
-
background-attachment: fixed;
21
21
-
position: absolute;
22
22
-
top: 0;
23
23
-
bottom: 0;
24
24
-
left: 0;
25
25
-
right: 0;
26
26
-
padding: 0;
27
27
-
margin: 0;
26
26
+
.new-punch {
27
27
+
background-color: white;
28
28
+
&:active { color: rgb(0,128,255); }
29
29
+
.bordered;
28
30
}
29
31
30
30
-
.sunset {
31
31
-
background-image: linear-gradient(to bottom, #315481, #918e82 100%);
32
32
+
.day {
33
33
+
.bordered(2px, white);
34
34
+
background-color: @dim;
32
35
}
33
36
34
34
-
.sunrise {
35
35
-
background-image: linear-gradient(to bottom, #d0edf5, #e1e5f0 100%);
37
37
+
.nuke {
38
38
+
background-color: #aa0000;
39
39
+
color: white;
40
40
+
.bordered;
36
41
}
37
42
38
38
-
body {
39
39
-
font-family: sans-serif;
40
40
-
.sunset;
41
41
-
.absolute;
43
43
+
.onTime {
44
44
+
color: rgb(0, 128, 255);
45
45
+
.bordered(2px, white);
42
46
}
43
47
44
44
-
#login-buttons {
45
45
-
display: block;
48
48
+
.absolute {
49
49
+
background-attachment: fixed;
50
50
+
position: absolute;
51
51
+
top: 0px;
52
52
+
bottom: 0px;
53
53
+
left: 0px;
54
54
+
right: 0px;
55
55
+
padding: 0px;
56
56
+
margin: 0px;
46
57
}
47
58
48
48
-
h1 {
49
49
-
font-size: 1.5em;
50
50
-
margin: 0;
51
51
-
margin-bottom: 10px;
52
52
-
display: inline-block;
53
53
-
margin-right: 1em;
59
59
+
.gradient(@from, @to){
60
60
+
background-image: linear-gradient(to bottom, @from, @to 100%);
54
61
}
55
62
56
56
-
form {
57
57
-
margin-top: 10px;
58
58
-
margin-bottom: -10px;
59
59
-
position: relative;
60
60
-
}
63
63
+
.sunset { .gradient(#315481, #918e82) }
64
64
+
.evening { .gradient(#212188, #315481) }
65
65
+
.morning { .gradient(#d0edf5, #e1e5f0) }
61
66
62
62
-
.new-snack input {
63
63
-
box-sizing: border-box;
64
64
-
padding: 10px 0;
65
65
-
background: transparent;
66
66
-
border: none;
67
67
-
width: 100%;
68
68
-
padding-right: 80px;
69
69
-
font-size: 1em;
67
67
+
body {
68
68
+
.morning;
69
69
+
.absolute;
70
70
}
71
71
72
72
-
.new-snack input:focus{
73
73
-
outline: 0;
72
72
+
#login-buttons {
73
73
+
display: block;
74
74
}
75
75
76
76
.grid {
77
77
-
78
78
-
79
79
-
}
80
80
-
81
81
-
.nuke {
82
82
-
background-color: #ff0000;
77
77
+
.flex-display(inline-flex);
78
78
+
.flex-wrap(wrap);
83
79
}