Skip to content

Commit

Permalink
add another directive for the centered rows
Browse files Browse the repository at this point in the history
minor refactorings
  • Loading branch information
Nasicus committed Apr 27, 2015
1 parent 96b1524 commit fdf5ab4
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 23 deletions.
10 changes: 10 additions & 0 deletions ClientApp/App/directives/row-center/row-center.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="row">
<div class="one-third column">
&nbsp;
</div>
<div class="one-third column {{additionalClass}}" data-ng-transclude>
</div>
<div class="one-third column">
&nbsp;
</div>
</div>
15 changes: 15 additions & 0 deletions ClientApp/App/directives/row-center/row-center.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function (app) {
"use strict";

app.directive('ncRowCenter', ["appConfig", function (appConfig) {
return {
restrict: 'A',
transclude: true,
scope: {
additionalClass: '@'
},
templateUrl: appConfig.directivesUrl + "row-center/row-center.html"
};
}]);

}(togglApp));
5 changes: 2 additions & 3 deletions ClientApp/App/directives/row-input/row-input.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
(function (app) {
"use strict";
app.directive('ngRowInput', ["appConfig", function (appConfig) {

app.directive('ncRowInput', ["appConfig", function (appConfig) {
return {
restrict: 'A',
require: '^ngModel',
scope: {
ngModel: '=',
title: '@',
Expand Down
37 changes: 17 additions & 20 deletions ClientApp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
<script type="text/javascript" src="ClientApp/App/services.js"> </script>
<script type="text/javascript" src="ClientApp/App/controllers.js"> </script>
<script type="text/javascript" src="ClientApp/App/directives/row-input/row-input.js"> </script>
<script type="text/javascript" src="ClientApp/App/directives/row-center/row-center.js"> </script>
</head>
<body>
<div class="container">
<h1>Toggl Overtime</h1>

<div data-ng-row-input data-title="API token" data-input-type="text" data-ng-model="apiToken"></div>
<div data-ng-row-input data-title="Start date" data-input-type="date" data-ng-model="startDate"></div>
<div data-ng-row-input data-title="End date" data-input-type="date" data-ng-model="endDate"></div>
<div data-ng-row-input data-title="Regular working hours per week" data-input-type="number" data-ng-model="regularWorkingHours"></div>
<div data-nc-row-input data-title="API token" data-input-type="text" data-ng-model="apiToken"></div>
<div data-nc-row-input data-title="Start date" data-input-type="date" data-ng-model="startDate"></div>
<div data-nc-row-input data-title="End date" data-input-type="date" data-ng-model="endDate"></div>
<div data-nc-row-input data-title="Regular working hours per week" data-input-type="number" data-ng-model="regularWorkingHours"></div>

<div class="row">
<div class="four columns">
Expand All @@ -35,27 +36,23 @@ <h1>Toggl Overtime</h1>
</div>

<div class="resultsDiv" data-ng-hide="!showLoadingImage">
<img src="ClientApp/Resources/Images/ajax-loader.gif" alt="Loading..." />
<div data-nc-row-center>
<img src="ClientApp/Resources/Images/ajax-loader.gif" alt="Loading..." />
</div>
</div>

<div class="resultsDiv errorDiv" data-ng-hide="!hasError">
<h2>Oh no ...an error occured :(</h2>
<b>{{errorStatus}}</b>: {{errorMessage}}
<div class="resultsDiv" data-ng-hide="!hasError">
<div data-nc-row-center data-additional-class="errorDiv">
<h2>Oh no - an error occured :(</h2>
<b>{{errorStatus}}</b>: {{errorMessage}}
</div>
</div>

<div data-ng-hide="!data" class="resultsDiv">
<div class="row">
<div class="one-third column">
&nbsp;
</div>
<div class="one-third column">
<h2>Summary</h2>
<b>Total Worktime:</b> {{formatSeconds(data.Worktime)}} <br />
<b>Total Overtime:</b> {{formatSeconds(data.Overtime)}}
</div>
<div class="one-third column">
&nbsp;
</div>
<div data-nc-row-center>
<h2>Summary</h2>
<b>Total Worktime:</b> {{formatSeconds(data.Worktime)}} <br />
<b>Total Overtime:</b> {{formatSeconds(data.Overtime)}}
</div>
<br />
<div data-ng-repeat="weeks in weeksInBlocks" class="row">
Expand Down
2 changes: 2 additions & 0 deletions Toggl.Overtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
<ItemGroup>
<Content Include="ClientApp\App\app.js" />
<Content Include="ClientApp\App\controllers.js" />
<Content Include="ClientApp\App\directives\row-center\row-center.html" />
<Content Include="ClientApp\App\directives\row-center\row-center.js" />
<Content Include="ClientApp\App\directives\row-input\row-input.html" />
<Content Include="ClientApp\App\directives\row-input\row-input.js" />
<Content Include="ClientApp\App\services.js" />
Expand Down

0 comments on commit fdf5ab4

Please sign in to comment.