Skip to content

Commit 9d5e3c5

Browse files
committed
made the motion a model [issue #2]
1 parent b75a788 commit 9d5e3c5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div id="fullscreen-container">
1212
<div class="container">
1313

14-
<div id="motion"></div>
14+
<div id="motion">{{ main.motion }}</div>
1515

1616
<div ng-class="{ negative: main.timer.now <= 0 }" id="timer">
1717
<span id="minutes" class="digits">{{ main.timer.now | minutes }}</span><span class="unit">m</span><span id="seconds" class="digits">{{ main.timer.now | seconds }}</span><span class="unit">s</span>
@@ -56,7 +56,7 @@ <h4 class="modal-title">Settings</h4>
5656
<div class="form-group">
5757
<label for="motion-input" class="col-sm-2 control-label">Motion</label>
5858
<div class="col-sm-10">
59-
<input type="text" class="form-control" id="motion-input" placeholder="Motion">
59+
<input ng-model="main.motion" ng-change="main.centre()" type="text" class="form-control" id="motion-input" placeholder="Motion">
6060
</div>
6161
</div>
6262

script.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ app.controller('MainController', ['$interval', function($interval){
5050
}
5151

5252
this.timer = new this.Timer(5 * 60 * 1000, [4 * 60 * 1000, 1 * 60 * 1000, 0, -15 * 1000]);
53+
54+
this.centre = function(){
55+
centre();
56+
}
5357
}]);
5458

5559
app.filter('minutes', function(){
@@ -130,7 +134,6 @@ app.controller('ButtonsController', function(){
130134

131135
app.controller("SettingsController", function(){
132136
this.set = function(main){
133-
$('#motion').text($('#motion-input').val());
134137
centre();
135138
var duration = Math.floor(parseInt($('#timer-minutes-input').val(), 10) * 60 + parseInt($('#timer-seconds-input').val() ,10)) * 1000;
136139
var protectedLength = Math.floor(parseInt($('#protected-minutes-input').val(), 10) * 60 + parseInt($('#protected-seconds-input').val() ,10)) * 1000;
@@ -202,6 +205,7 @@ app.controller("DebatersController", function(){
202205

203206
function centre(){
204207
var margin = ($(window).height() - $('.progress').outerHeight())/2 + $('.container').offset().top - $('.progress').offset().top;
208+
console.log(margin, $('.container').offset().top);
205209
if(margin < 0) margin = 0;
206210
$('.container').css('margin-top', margin);
207211
$('#minutes').css('padding-left', $('.unit:last').outerWidth() + 20);

0 commit comments

Comments
 (0)