Skip to content

Commit

Permalink
feat(core): new module app.core
Browse files Browse the repository at this point in the history
Now there is a new module called app.core. It contains core information about the app like version.
  • Loading branch information
mpfeil committed Dec 7, 2017
1 parent d9a9ed1 commit 9012f7a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 4 deletions.
23 changes: 21 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = function (grunt) {

// Define the configuration for all the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
replace: {
control: {
options: {
Expand All @@ -44,6 +45,10 @@ module.exports = function (grunt) {
{
match: 'OPENSENSEMAP_MAPTILES_URL',
replacement: process.env.OPENSENSEMAP_MAPTILES_URL
},
{
match: 'VERSION',
replacement: '<%= pkg.version %>'
}
]
},
Expand Down Expand Up @@ -75,7 +80,20 @@ module.exports = function (grunt) {
]
},
files: [
{expand: true, flatten: true, src: ['.tmp/components/leaflet.directive.js',], dest: '.tmp/components'}
{expand: true, flatten: true, src: ['.tmp/components/leaflet.directive.js'], dest: '.tmp/components'}
]
},
version: {
options: {
patterns: [
{
match: 'VERSION',
replacement: '<%= pkg.version %>'
}
]
},
files: [
{expand: true, flatten: true, src: ['.tmp/scripts/constants.js'], dest: '.tmp/scripts'}
]
}
},
Expand Down Expand Up @@ -484,7 +502,7 @@ module.exports = function (grunt) {
expand: true,
cwd: '<%= yeoman.app %>/scripts',
dest: '.tmp/scripts',
src: ['app.js']
src: ['app.js', 'constants.js']
},
components: {
expand: true,
Expand Down Expand Up @@ -599,6 +617,7 @@ module.exports = function (grunt) {
'autoprefixer',
'replace:devapi',
'replace:devmaps',
'replace:version',
'languages',
'connect:livereload',
'watch'
Expand Down
2 changes: 2 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,15 @@

<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/constants.js"></script>
<script src="scripts/models/box.js"></script>
<script src="scripts/models/sensor.js"></script>
<script src="components/calendar.directive.js"></script>
<script src="components/leaflet.directive.js"></script>
<script src="components/leaflet.service.js"></script>
<script src="components/charts.directive.js"></script>
<script src="components/badge.directive.js"></script>
<script src="scripts/controllers/info.js"></script>
<script src="scripts/controllers/register.js"></script>
<script src="scripts/controllers/map.js"></script>
<script src="scripts/controllers/sidebar.js"></script>
Expand Down
5 changes: 4 additions & 1 deletion app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

angular
.module('openSenseMapApp', [
'app.core',
'app.models',
'app.services',
'ngResource',
Expand Down Expand Up @@ -369,7 +370,9 @@ angular
})
.state('info', {
url: '/info',
templateUrl: 'views/info.html'
templateUrl: 'views/info.html',
controller: 'InfoController',
controllerAs: 'info'
});
}])
.config(['$translateProvider', function ($translateProvider){
Expand Down
11 changes: 11 additions & 0 deletions app/scripts/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(function() {
'use strict';

angular.module('app.core', [

])
.constant('app', {
VERSION: '@@VERSION',
NAME: 'Zahngold Bernd'
});
})();
19 changes: 19 additions & 0 deletions app/scripts/controllers/info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(function() {
'use strict';

angular
.module('openSenseMapApp')
.controller('InfoController', InfoController);

InfoController.$inject = ['app'];
function InfoController(app) {
var vm = this;
vm.app = app;

activate();

////////////////

function activate() {}
}
})();
3 changes: 2 additions & 1 deletion app/views/info.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="row register">
<div class="col-lg-7 col-lg-offset-2">
<h3>Über openSenseMap</h3>
<p ng-bind-html="'INFO_ABOUT'|translate"></p>
<p ng-bind-html="'INFO_ABOUT'|translate"></p>
Version: <code style="color: #4EAF47;">{{info.app.VERSION}}-{{info.app.NAME}}</code>
<h4 ng-bind-html="'INFO_COPYRIGHT_NOTICES'|translate"></h4>
<p ng-bind-html="'INFO_MADE_BY'|translate"></p>
© <a href="http://sensebox.de" target="_blank">senseBox</a> 2014 - 2016<br/><br/>
Expand Down

0 comments on commit 9012f7a

Please sign in to comment.