Skip to content

Commit

Permalink
Version 1 (#16)
Browse files Browse the repository at this point in the history
* Created app core (#1)

* Gulp : styles-injection now doesn't fail if there ar no css files

* Remove unneeded dependencies

* Remove dummy project files

* Added basic folder structure

* Added root component

* Adding design plans for mobile UI.

* Updated readme

* Update design plans with proper icon design.

* Upload the final design specificaton for the mobile version.

* Initial Test

* Added controllerAs

* Create app header

* Develop header component

* Feature/create header component (#12)

* Create app header

* Develop header component

Resolve #3

* Create canvas component

* Add files via upload

Add icons

* Add files via upload

Update rotate and grayscale icons

* Fix errors according to gulp lint

* Added travis config

* Corrected invalid

* Even more dumb mistake corrections

* Corrected travis config, hopefully for the last time

* Added feature-button

* Add checkmark and cancel buttons

* Update feature-button.constants.js

* Add accept/deny component (#15)

#6 resolved

* Added feature buttons

* Added travis test

* Added ripple effect
  • Loading branch information
nagygergo authored Oct 18, 2016
1 parent 2c67387 commit 89badeb
Show file tree
Hide file tree
Showing 57 changed files with 715 additions and 47 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: node_js
node_js:
- '4.4'
before_script:
- 'export CHROME_BIN=chromium-browser'
- 'export DISPLAY=:99.0'
- sh -e /etc/init.d/xvfb start
- 'npm install -g bower karma gulp eslint'
- 'npm install'
- 'bower install'
script:
- 'gulp test'
80 changes: 74 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,74 @@
# Angular github pages skeleton
### Todo
* Add testing framework
* Add Travis integration
* Add sample data
* Add minified build option
# PixelFactory
## Prequisites
To be able to build and run the project, the following need to be installed:
* Node ^4.2.0
* Npm ^3.5.0
* Gulp ^3.9.0 `npm install -g gulp`

Also you need to run the following commands in the root directory for the dependecies to pull:
```sh
npm install && bower install
```
---
## Buid system

The build system has the following top-level scripts. Lower level scripts are also reachable, but it is unadvised to use them since they can't do many things on their own.

#### Build

```sh
gulp build
```
Builds the app to the `build` directory. Also runs eslint to check code style.

#### Serve

```sh
gulp serve
```
Builds the app to the `build` directory, then serves it on `localhost:8080`. It reloads if any file is modified. Also runs eslint to check code style.

#### Test
**NOT WORKING YET**

```sh
gulp test
```
Runs linting and unit tests once. Should be used mostly by Travis.
*This starts multiple browsers.*

#### TDD
**NOT WORKING YET**


Not really TDD, but no better idea for name

```sh
gulp tdd
```
Runs linting and unit tests every time code is modified.*This starts multiple browsers.*

#### Github pages
```sh
gulp deploy
```
Builds and depolys the currently checked out branch to github pages.

---
## Git flow

For every task a new branch should be created from the `dev` branch. If task is completed you should make a pull request to the `dev` branch. resolved,

* Feature tasks should be made on branches with `feature/` prefix.
* Bugfix branches should be made on branches with `fix/` prefix.

There is no strict naming policy for the pull request names.
In the description of the pull request you should include at least following: `resolve #1` where the number is a reference to the number of the task.

Pushing to `gh-pages` is not permitted, that is basicly the production branch of the app. Only stable and well tested versions can be pushed there. (In the future it might be done by travis)

The `master` branch should be kept for only versioning of the app. Pushing is permitted for keeping versions, and it should always be pulled form the `dev` branch.

## Coding style

Coding style should comply to the [John Papas Angular styleguilde](https://github.com/johnpapa/angular-styleguide). The ESLint plugin should enforce these rules. You can check it by running `gulp eslint`, or any of the build commands. Also most IDE-s have an ESLint parsing plugin. If you need template snippets in the styleguide you can find for most IDE-s.
35 changes: 35 additions & 0 deletions app/acceptdeny/acceptdeny.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(function() {
'use strict';

angular
.module('app.acceptdeny')
.component('pfAcceptdeny', PfAcceptdeny());

/* @ngInject */
function PfAcceptdeny() {
var component = {
templateUrl: 'app/acceptdeny/acceptdeny.html',
controller: AcceptdenyCtrl,
controllerAs: 'vm'
};

return component;
}

AcceptdenyCtrl.$inject = ['$log'];

/* @ngInject */
function AcceptdenyCtrl($log) {
var vm = this;

vm.onClickAccept = onClickAccept;
vm.onClickDeny = onClickDeny;

function onClickAccept() {
$log.debug('Accept icon clicked');
}
function onClickDeny() {
$log.debug('Deny icon clicked');
}
}
})();
5 changes: 5 additions & 0 deletions app/acceptdeny/acceptdeny.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="acceptdeny">
<div class="accept_deny_container">
<div class="accept_container"><img ng-click="vm.onClickAccept()" id="accept_img" ng-src="images/checkmark.png" ng-hide=""></div>
<div class="deny_container"><img ng-click="vm.onClickDeny()" id="deny_img" ng-src="images/cancel.png" ng-hide=""></div>
</div>
8 changes: 8 additions & 0 deletions app/acceptdeny/acceptdeny.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function() {
'use strict';

angular
.module('app.acceptdeny', [
'app.core'
]);
})();
3 changes: 3 additions & 0 deletions app/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function() {
'use strict';
})();
4 changes: 4 additions & 0 deletions app/app.constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(function() {
'use strict';

})();
4 changes: 0 additions & 4 deletions app/app.js

This file was deleted.

11 changes: 11 additions & 0 deletions app/app.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(function() {
'use strict';

angular
.module('app', [
'app.core',
'app.root',
'app.header',
'app.acceptdeny',
'app.feature-list']);
})();
71 changes: 71 additions & 0 deletions app/canvas/canvas.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
(function() {
'use strict';

angular
.module('app.canvas')
.component('pfCanvas', PfCanvas());

/* @ngInject */
function PfCanvas() {
var component = {
templateUrl: 'app/canvas/canvas.html',
controller: CanvasCtrl,
controllerAs: 'vm'
};

return component;
}

CanvasCtrl.$inject = ['$log', '$window', '$document'];

/* @ngInject */
function CanvasCtrl($log, $window, $document) {
var vm = this;
var canvas = $window.document.getElementById('pfCanvas');

var ctx = canvas.getContext('2d');

var src = 'images/mario.png';

var parent = $window.document.getElementById('canvas');

var angleInDegrees=0;

initialize();

function initialize() {
$window.addEventListener('resize', resizeCanvas, false);
resizeCanvas();
}

function redraw() {
openPicture(src);
}

function resizeCanvas() {
canvas.width = parent.offsetWidth;
canvas.height = parent.offsetHeight;
redraw();
}

function openPicture(src) {
clearCanvas();
var img=new Image();
img.crossOrigin="anonymous";
img.onload=start;
img.src=src;
function start(){
var ratio=calculateProportionalAspectRatio(img.width,img.height,canvas.width,canvas.height);
ctx.drawImage(img,(canvas.width - img.width*ratio)/2, (canvas.height - img.height*ratio)/2
,img.width*ratio,img.height*ratio);
}
function calculateProportionalAspectRatio(srcWidth, srcHeight, maxWidth, maxHeight) {
return(Math.min(maxWidth / srcWidth, maxHeight / srcHeight));
}
}

function clearCanvas() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
}
})();
3 changes: 3 additions & 0 deletions app/canvas/canvas.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="canvas">
<canvas id='pfCanvas'></canvas>
</div>
8 changes: 8 additions & 0 deletions app/canvas/canvas.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function() {
'use strict';

angular
.module('app.canvas', [
'app.core'
]);
})();
8 changes: 8 additions & 0 deletions app/core/core.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function() {
'use strict';

angular
.module('app.core', [
'whimsicalRipple'
]);
})();
43 changes: 43 additions & 0 deletions app/feature-button/feature-button.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
(function() {
'use strict';

angular
.module('app.feature-button')
.component('featureButton', featureButton());

/* @ngInject */
function featureButton() {
var component = {
templateUrl: 'app/feature-button/feature-button.html',
controller: FeatureButtonCtrl,
controllerAs: 'vm',
bindings: {
type: '@'
}
};

return component;
}

FeatureButtonCtrl.$inject = ['$log', 'BUTTONCONFIG'];

/* @ngInject */
function FeatureButtonCtrl($log, BUTTONCONFIG) {
var vm = this;
vm.imageURL = null;
activate();

vm.onClick = onClick;

function activate() {
if(vm.type && BUTTONCONFIG[vm.type]) {
vm.imageURL = BUTTONCONFIG[vm.type].imgURL;
}
}

function onClick() {

$log.debug('Button clicked');
}
}
})();
30 changes: 30 additions & 0 deletions app/feature-button/feature-button.constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(function () {
'use strict';
angular.module('app.feature-button')
.constant('BUTTONCONFIG', {
'rotate-left' : {
imgURL: 'images/rotate_left.png'
},
'rotate-right' : {
imgURL: 'images/rotate_right.png'
},
'rotate-180' : {
imgURL: 'images/rotate_180.png'
},
'flip-horizontal' : {
imgURL: 'images/flip-horizontal.png'
},
'flip-vertical' : {
imgURL: 'images/flip-vertical.png'
},
'grayscale' : {
imgURL: 'images/grayscale.png'
},
'cancel' : {
imgURL: 'images/cancel.png'
},
'checkmark' : {
imgURL: 'images/checkmark.png'
}
});
})();
5 changes: 5 additions & 0 deletions app/feature-button/feature-button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="feature-button" ng-click="vm.onClick()">
<div class="image-container ripple ripple-light" ng-click="vm.onClick()">
<img data-ng-src="{{vm.imageURL}}"/>
</div>
</div>
8 changes: 8 additions & 0 deletions app/feature-button/feature-button.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function() {
'use strict';

angular
.module('app.feature-button', [
'app.core'
]);
})();
24 changes: 24 additions & 0 deletions app/feature-list/feature-list.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function() {
'use strict';

angular
.module('app.feature-list')
.component('pfFeatureList', FeatureList());

/* @ngInject */
function FeatureList() {
var component = {
templateUrl: 'app/feature-list/feature-list.html',
controller: FeatureListCtrl,
};

return component;
}

FeatureListCtrl.$inject = [];

/* @ngInject */
function FeatureListCtrl() {

}
})();
8 changes: 8 additions & 0 deletions app/feature-list/feature-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div id="feature-list">
<feature-button type="rotate-left"></feature-button>
<feature-button type="rotate-right"></feature-button>
<feature-button type="rotate-180"></feature-button>
<feature-button type="flip-horizontal"></feature-button>
<feature-button type="flip-vertical"></feature-button>
<feature-button type="grayscale"></feature-button>
</div>
8 changes: 8 additions & 0 deletions app/feature-list/feature-list.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function() {
'use strict';

angular
.module('app.feature-list', [
'app.core'
]);
})();
Loading

0 comments on commit 89badeb

Please sign in to comment.