Skip to content

Commit

Permalink
v0.9.0
Browse files Browse the repository at this point in the history
See `CHANGELOG.md`.
  • Loading branch information
GochoMugo committed Feb 14, 2017
2 parents 8391097 + bc07938 commit 19a792b
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 51 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.sass-cache/
coverage/
node_modules/
9 changes: 0 additions & 9 deletions .openshift/action_hooks/pre_build

This file was deleted.

Empty file removed .openshift/markers/use_npm
Empty file.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).



## [0.9.0][0.9.0] - 2017-02-14

Added:

* Support settings

Changed:

* Dockerize application
* Drop OpenShift support code
* Update dependencies


## [0.8.0][0.8.0] - 2016-11-19

Added:
Expand Down Expand Up @@ -114,4 +127,5 @@ This is the very first version.
[0.6.0]:https://github.com/forfuturellc/mmtc-ke/releases/tag/v0.6.0
[0.7.0]:https://github.com/forfuturellc/mmtc-ke/releases/tag/v0.7.0
[0.8.0]:https://github.com/forfuturellc/mmtc-ke/releases/tag/v0.8.0
[Unreleased]: https://github.com/forfuturellc/mmtc-ke/compare/v0.8.0...develop
[0.9.0]:https://github.com/forfuturellc/mmtc-ke/releases/tag/v0.9.0
[Unreleased]: https://github.com/forfuturellc/mmtc-ke/compare/v0.9.0...develop
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:alpine

ARG NODE_ENV
WORKDIR /opt/app/
EXPOSE 8080
CMD ["npm", "start"]

ADD package.json /tmp/
RUN cd /tmp/ && npm install
RUN cp -a /tmp/node_modules/ /opt/app/

ADD . /opt/app/
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ function run(options, done) {

debug('starting server');
app.listen(options.port, options.host, function() {
logger.info('server listening');
debug('server started at http://%s:%s', options.host, options.port);
logger.info('server listening on http://%s:%s', options.host, options.port);
debug('server listening on http://%s:%s', options.host, options.port);
if (done) return done();
});
}
Expand Down
4 changes: 3 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"font-awesome": "^4.6.3",
"jquery": "^3.1.0",
"bootstrap": "^3.3.7",
"animate.css": "^3.5.2"
"animate.css": "^3.5.2",
"bootstrap-switch": "^3.3.2",
"store-js": "^1.3.20"
},
"resolutions": {
"jquery": "1.9.1 - 3"
Expand Down
8 changes: 4 additions & 4 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const config = {};

// server configuration
config.server = {};
config.server.port = process.env.OPENSHIFT_NODEJS_PORT || 8090;
config.server.ip = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1';
config.server.port = process.env.NODEJS_PORT || 8080;
config.server.ip = process.env.NODEJS_IP || '0.0.0.0';


// site configuration
Expand All @@ -23,11 +23,11 @@ config.site.title = 'Mobile Money Transaction Cost in Kenya';
config.site.title_short = 'mmtc | ke';
config.site.email = 'we@forfuture.co.ke';
config.site.description = 'An easy way to calculate cost of mobile money transcations in Kenya';
config.site.url = 'mmtc.forfuture.co.ke';
config.site.url = 'mmtc.forfuture.tech';
config.site.baseurl = '';
config.site.author = {};
config.site.author.name = 'Forfuture LLC';
config.site.author.url = 'http://forfuture.co.ke';
config.site.author.url = 'https://forfuture.tech';


// export the configurations
Expand Down
5 changes: 1 addition & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ This API is useful for developers who:

## Introduction:

The **Base URLs** for the API are `http://mmtc.forfuture.co.ke/api`
(Insecure but more permanent)
and `https://mmtcke-forfutureco.rhcloud.com/api`
(Secure but less permanent).
The **Base URL** for the API is `https://mmtc.forfuture.tech/api`.

API Characteristics:

Expand Down
57 changes: 29 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
{
"name": "mmtc-ke",
"version": "0.8.0",
"name": "mmtc",
"version": "0.9.0",
"description": "Calculate Mobile Money Transaction Cost",
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/forfuturellc/mmtc.git"
},
"author": {
"name": "GochoMugo",
"email": "mugo@forfuture.co.ke",
"url": "http://www.gmugo.in"
},
"engines": {
"node": ">=6"
},
"scripts": {
"build": "grunt build",
"postinstall": "HOME=${BOWER_HOME:-${HOME}} bower install",
"publish": "npm run build && docker build --tag forfuture/mmtc --build-arg \"NODE_ENV=production\" .",
"start": "forever app.js",
"start-dev": "DEBUG=mmtc-ke:* nodemon app.js",
"test": "grunt test",
"test-coverage": "istanbul cover _mocha --report lcovonly -- -R spec test/test.*.js"
},
"dependencies": {
"ajv": "^4.9.0",
"body-parser": "^1.15.2",
"bower": "^1.8.0",
"ajv": "^4.11.3",
"body-parser": "^1.16.1",
"common-errors": "^1.0.0",
"config": "^1.24.0",
"debug": "^2.3.2",
"express": "^4.14.0",
"config": "^1.25.1",
"debug": "^2.6.1",
"express": "^4.14.1",
"forever": "^0.15.3",
"lodash": "^4.17.0",
"lodash": "^4.17.4",
"nunjucks": "^3.0.0",
"showdown": "^1.5.0",
"winston": "^2.3.0"
},
"repository": {
"type": "git",
"url": "git://github.com/forfuturellc/mmtc-ke.git"
},
"author": {
"name": "GochoMugo",
"email": "mugo@forfuture.co.ke",
"url": "http://www.gmugo.in"
},
"engines": {
"node": ">=6"
"showdown": "^1.6.4",
"winston": "^2.3.1"
},
"devDependencies": {
"babel-preset-es2015": "^6.18.0",
"babel-preset-es2015": "^6.22.0",
"babelify": "^7.3.0",
"coveralls": "^2.11.15",
"bower": "^1.8.0",
"coveralls": "^2.11.16",
"elbow": "^1.0.0",
"grunt": "^1.0.1",
"grunt-browserify": "^5.0.0",
"grunt-cli": "^1.2.0",
"grunt-eslint": "^19.0.0",
"grunt-mocha-test": "^0.13.2",
"grunt-sass": "^1.2.1",
"grunt-sass": "^2.0.0",
"istanbul": "^0.4.5",
"load-grunt-tasks": "^3.5.2",
"mocha": "^3.1.2",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.2.0",
"nodemon": "^1.11.0",
"uglifyify": "^3.0.4"
Expand Down
1 change: 1 addition & 0 deletions web/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<link rel="stylesheet" href="{{ site.baseurl }}/static/bootstrap-themes/superhero.min.css">
<link rel="stylesheet" href="{{ site.baseurl }}/vendor/animate.css/animate.min.css">
<link rel="stylesheet" href="{{ site.baseurl }}/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="{{ site.baseurl }}/vendor/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css">

{% set defaultCssURL = '/css/main.css' %}
<link rel="stylesheet" href="{{ site.baseurl }}{{ cssURL or defaultCssURL }}">
Expand Down
43 changes: 43 additions & 0 deletions web/js/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* Functionality on the networks page.
*/
/* global store:false */


$(document).ready(function() {
Expand All @@ -15,6 +16,44 @@ $(document).ready(function() {
$notification.$textError = $notification.find('.text-error');
$notification.$textCost = $notification.find('.text-cost');
var $select = $('.select-class');
var settings = {};

if (!store.enabled) {
$('#alert-store').show();
}

$('#panel-settings input[type="checkbox"]').each(function() {
var $this = $(this);
var settingKey = $this.data('setting');
var storeSettingKey = 'settings.' + settingKey;
var defaultState = $this.is(':checked');
var updateState = function(state) {
settings[settingKey] = state;
};

updateState(defaultState);

if (store.enabled) {
var state = store.get(storeSettingKey);
if (typeof state === 'boolean') {
updateState(state);
}
}

$this.bootstrapSwitch({
size: 'mini',
onText: 'YES',
offText: 'NO',
state: settings[settingKey]
});

$this.on('switchChange.bootstrapSwitch', function(evt, state) {
if (store.enabled) {
store.set(storeSettingKey, state);
}
updateState(state);
});
});

$select.on('change', function() {
return tableActivate(this);
Expand All @@ -37,6 +76,10 @@ $(document).ready(function() {

// add a 'submit' handler that calculates the cost
$form.submit(function(evt) {
if (!settings.onclient) {
return true;
}

evt.preventDefault();
var parameterArray = $form.serializeArray();
var parameters = {};
Expand Down
28 changes: 26 additions & 2 deletions web/networks/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#}
{% extends '_layouts/default.html' %}
{% set cssURL = '/css/network.css' %}
{% set scripts = ['/js/engine.js', '/js/network.js'] %}
{% set scripts = [
'/vendor/bootstrap-switch/dist/js/bootstrap-switch.min.js',
'/js/engine.js',
'/js/network.js',
'/vendor/store-js/store.min.js'
] %}


{% block content %}
Expand Down Expand Up @@ -68,8 +73,10 @@ <h1>Calculate Cost of <span class="network-name">{{ network.name | capitalize }}
{% endfor %}

{% if network.ussd_codes %}
<li role="presentation" class="USSD Codes"><a href="#panel-ussd_codes" aria-controls="home" role="tab" data-toggle="tab">USSD Codes</a></li>
<li role="presentation"><a href="#panel-ussd_codes" aria-controls="home" role="tab" data-toggle="tab">USSD Codes</a></li>
{% endif %}

<li role="presentation" class="pull-right"><a href="#panel-settings" aria-controls="home" role="tab" data-toggle="tab">Settings</a></li>
</ul>

<!-- Tab panes -->
Expand All @@ -85,6 +92,23 @@ <h1>Calculate Cost of <span class="network-name">{{ network.name | capitalize }}
{% include "_includes/ussd_codes.html" %}
</div>

<div role="tabpanel" class="tab-pane" id="panel-settings">
<!-- Alert messages for settings -->
<div id="alert-store" class="alert alert-danger no-display" role="alert">
<small><strong>Sorry!</strong> Your settings will <strong>not</strong> be saved by your browser.</small>
</div>
<!-- The settings' switches -->
<div class="row">
<!-- setting: onclient -->
<div class="col-xs-2 col-xs-offset-1">
<input type="checkbox" data-setting="onclient" checked>
</div>
<div class="col-xs-8 col-xs-push-1">
<p>Calculate on my browser</p>
</div>
</div>
</div>

</div>

</div></div>
Expand Down

0 comments on commit 19a792b

Please sign in to comment.