Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix banner, orderBy and update ncg content #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7,395 changes: 7,395 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "ng serve --port 3003",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
Expand All @@ -29,6 +29,7 @@
"firebase": "^4.2.0",
"hammerjs": "^2.0.8",
"ng2-page-scroll": "^4.0.0-beta.6",
"ngx-order-pipe": "^1.0.2",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
Expand Down
6 changes: 4 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import { Ng2PageScrollModule } from 'ng2-page-scroll';

import { AngularFireModule } from 'angularfire2';
import { AppComponent } from './app.component';
import { OrderBy } from './pipes/order-by.pipe';
import { OrderByPipe } from './pipes/order-by.pipe';
import { OrderModule } from 'ngx-order-pipe';

import { FeatureRequestRatingsComponent } from './feature-request-ratings/feature-request-ratings.component';

import { NavbarComponent } from './navbar/navbar.component';
Expand Down Expand Up @@ -53,7 +55,7 @@ export const firebaseConfig = {
@NgModule({
declarations: [
AppComponent,
OrderBy,
OrderByPipe,
FeatureRequestRatingsComponent,
NavbarComponent,
// TestComponent,
Expand Down
4 changes: 2 additions & 2 deletions src/app/banner/banner.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<div fxLayout="column" fxLayoutAlign="space-around center" class="inner-content">
<div class="title">
<span>NinjaCodeGen</span>
<span class="sub-title">Angular code generator.. to kick ass!</span>
<span class="sub-title">Angular CRUD code generator.. to kick ass!</span>
</div>
<div class="banner-video">
<img [src]="banners[0].imgUrl">
</div>
<div>
<a class="banner-demo-button" href="http://ncg-beta.azurewebsites.net/" md-button target="_blank">Try our beta!</a>
<a class="banner-demo-button" href="http://app.ninjacodegen.com/" md-button target="_blank">Try our Beta!</a>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
<td>Votes</td>
<td>Rate</td>
</thead>
<tr *ngFor="let featureRequest of featureRequests | async | orderBy: ['-avgRating', '-name']" [@itemAnim]>
<tr *ngFor="let featureRequest of featureRequests | async | orderBy: ['-avgRating', 'name']" [@itemAnim]>
<!-- <tr *ngFor="let featureRequest of featureRequests | async | orderBy: 'calculatedOrder' : true" [@itemAnim]> -->
<td>
<!--<button (click)="updateFeatureRequest(featureRequest)" md-mini-fab="" [disabled]="loggedInState?.uid != featureRequest.creatorUid"><md-icon>check</md-icon></button>-->
</td>
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/features.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class FeaturesComponent implements OnInit {
this.features =
[
{
name: 'Angular Code Generator',
name: 'Angular CRUD Code Generator',
desc: 'Download full source code for apps based on your schema in seconds. For enterprise teams, create your own template-sets and push directly to your local machine/environment for quick development.',
url: 'http://ncg-test-ncg-ng-md.azurewebsites.net',
imgUrl: 'https://cdn-images-1.medium.com/max/800/1*Zl0lsY09eO5y-mnYO18gUg.png',
Expand Down
10 changes: 4 additions & 6 deletions src/app/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@
<a href="#ratings" pageScroll md-button [pageScrollEasing]="myEasing">Vote!</a>
<a href="#newsletter" pageScroll md-button [pageScrollEasing]="myEasing">Sign Up!</a>
<a href="https://medium.com/ninjacodegen" md-button target="_blank">Blog</a>
<a href="http://ncg-beta.azurewebsites.net/" md-button target="_blank">Try the Beta!</a>
<a href="http://app.ninjacodegen.com" md-button target="_blank">Try the Beta!</a>
<a href="http://facebook.com/ninjaCodeGen/" md-icon-button target="_blank">
<md-icon class="fa fa-facebook"></md-icon>
</a>
<a href="http://twitter.com/ninjaCodeGen/" md-icon-button target="_blank">
<md-icon class="fa fa-twitter"></md-icon>
</a>
<a href="https://www.youtube.com/watch?v=oItyreaBOpk" md-icon-button target="_blank">
<md-icon class="fa fa-youtube-play"></md-icon>
</a>

<!--<a pageScroll md-button href="#ratings" [pageScrollEasing]="myEasing">Feature Rating</a>-->
<!--<a pageScroll md-button href="#ratings" [pageScrollEasing]="myEasing">Feature Rating</a>
<a pageScroll md-button href="#test-app" [pageScrollEasing]="myEasing">Test</a>-->
<!--<a md-button href="#ratings">Feature 1</a>
<a md-button href="#ratings">Feature 2</a>-->
<span fxFlex></span>
<div class="nav-login">
<span *ngIf="auth.loggedInState" class="display-name">{{ auth.loggedInState.displayName }}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AuthService } from './../shared';
templateUrl: './navbar.component.html'
})
export class NavbarComponent {
public navIsOvered = false;

public myEasing: EasingLogic = {
ease: (t: number, b: number, c: number, d: number): number => {
// easeInOutExpo easing
Expand Down
149 changes: 72 additions & 77 deletions src/app/pipes/order-by.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,116 +8,111 @@
import {Pipe, PipeTransform} from '@angular/core';

@Pipe({ name: 'orderBy', pure: false })
export class OrderBy implements PipeTransform {
export class OrderByPipe implements PipeTransform {

value:string[] =[];

static _orderByComparator(a: any, b: any): number {

try { // HACK cuz error when delete entire textbox of number and it compares
if(a === null || typeof a === 'undefined') a = 0;
if(b === null || typeof b === 'undefined') b = 0;

if ((isNaN(parseFloat(a)) || !isFinite(a)) || (isNaN(parseFloat(b)) || !isFinite(b))) {
//Isn't a number so lowercase the string to properly compare
if (a.toLowerCase() < b.toLowerCase()) return -1;
if (a.toLowerCase() > b.toLowerCase()) return 1;
} else {
}
else{
//Parse strings as numbers to compare properly
if (parseFloat(a) < parseFloat(b)) return -1;
if (parseFloat(a) > parseFloat(b)) return 1;
}
} catch(e) {
return 1;
}

return 0; //equal each other
}

/* filter property by string 'parent.child.item.orderKey' */
static _getDeepValue(obj: any, propertyPath: string) {
transform(input:any, config:string = '+'): any {

let pathList = propertyPath.split('??');
//invalid input given
if(!input) return input;

if (pathList.length > 0) {
let index = 0,
flag = false,
result = '';
//make a copy of the input's reference
this.value = [...input];
let value = this.value;

while (!flag) {
result = getDeepvalueByPath(obj, pathList[index]);
if(!Array.isArray(value)) return value;

if (result !== undefined) {
flag = true;
} else {
index++;
if(!Array.isArray(config) || (Array.isArray(config) && config.length == 1)){
let propertyToCheck:string = !Array.isArray(config) ? config : config[0];
let desc = propertyToCheck.substr(0, 1) == '-';

if (pathList.length === index) {
flag = true;
}
}
//Basic array
if(!propertyToCheck || propertyToCheck == '-' || propertyToCheck == '+'){
return !desc ? value.sort() : value.sort().reverse();
}

return result;
} else {
return getDeepvalueByPath(obj, propertyPath);
else {
let property:string = propertyToCheck.substr(0, 1) == '+' || propertyToCheck.substr(0, 1) == '-'
? propertyToCheck.substr(1)
: propertyToCheck;

return value.sort(function(a:any,b:any){
let aValue = a[property];
let bValue = b[property];

let propertySplit = property.split('.');

if(typeof aValue === 'undefined' && typeof bValue === 'undefined' && propertySplit.length > 1){
aValue = a;
bValue = b;
for(let j = 0; j < propertySplit.length; j++) {
aValue = aValue[propertySplit[j]];
bValue = bValue[propertySplit[j]];
}

function getDeepvalueByPath(obj, path) {
path = path.split('.');

if (path.length > 0) {
for (let i = 0; i < path.length; i++) {
if (obj[path[i]] !== undefined) {
obj = obj[path[i]];
} else {
obj = undefined;
break;
}
};

return obj;
} else {
return obj[path];
}
return !desc
? OrderByPipe._orderByComparator(aValue, bValue)
: -OrderByPipe._orderByComparator(aValue, bValue);
});
}
}

transform(input: any, [config = '+']): any {
if (!Array.isArray(input)) return input;

if (!Array.isArray(config) || (Array.isArray(config) && config.length === 1)) {
var propertyToCheck: string = !Array.isArray(config) ? config : config[0];
var desc = propertyToCheck.substr(0, 1) === '-';

//Basic array
if (!propertyToCheck || propertyToCheck === '-' || propertyToCheck === '+') {
return !desc ? input.sort() : input.sort().reverse();
} else {
var property: string = propertyToCheck.substr(0, 1) === '+' || propertyToCheck.substr(0, 1) === '-'
? propertyToCheck.substr(1)
: propertyToCheck;

return input.sort(function (a: any, b: any) {
return !desc
? OrderBy._orderByComparator(OrderBy._getDeepValue(a, property), OrderBy._getDeepValue(b, property))
: -OrderBy._orderByComparator(OrderBy._getDeepValue(a, property), OrderBy._getDeepValue(b, property));
});
else {
//Loop over property of the array in order and sort
return value.sort(function(a:any,b:any){
for(let i:number = 0; i < config.length; i++){
let desc = config[i].substr(0, 1) == '-';
let property = config[i].substr(0, 1) == '+' || config[i].substr(0, 1) == '-'
? config[i].substr(1)
: config[i];

let aValue = a[property];
let bValue = b[property];

let propertySplit = property.split('.');

if(typeof aValue === 'undefined' && typeof bValue === 'undefined' && propertySplit.length > 1){
aValue = a;
bValue = b;
for(let j = 0; j < propertySplit.length; j++) {
aValue = aValue[propertySplit[j]];
bValue = bValue[propertySplit[j]];
}
}
} else {
//Loop over property of the array in order and sort
return input.sort(function (a: any, b: any) {
for (var i: number = 0; i < config.length; i++) {
var desc = config[i].substr(0, 1) === '-';
var property = config[i].substr(0, 1) === '+' || config[i].substr(0, 1) === '-'
? config[i].substr(1)
: config[i];

var comparison = !desc
? OrderBy._orderByComparator(OrderBy._getDeepValue(a, property), OrderBy._getDeepValue(b, property))
: -OrderBy._orderByComparator(OrderBy._getDeepValue(a, property), OrderBy._getDeepValue(b, property));

let comparison = !desc
? OrderByPipe._orderByComparator(aValue, bValue)
: -OrderByPipe._orderByComparator(aValue, bValue);

//Don't return 0 yet in case of needing to sort by next property
if (comparison !== 0) return comparison;
if(comparison != 0) return comparison;
}

return 0; //equal each other
});
}
}
}

export let ORDERBY_PROVIDERS = [
OrderByPipe
];
Binary file modified src/favicon.ico
Binary file not shown.
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<head>
<meta charset="utf-8">
<!--<link href="../node_modules/@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet">-->
<title>NinjaCodeGen - Angular Code Generator</title>
<title>NinjaCodeGen - Angular CRUD Code Generator</title>
<base href="/">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Description" content="Generate apps in Angular, ionic, Kendo UI, Xamarin, Electron, Vue.js, React, etc.">
<meta name="Keywords" content="Angular, Code Generator, React, codegen, app builder, app creator">
<meta name="Description" content="Angular Crud Code Generator, Ionic, Kendo UI, Xamarin, Electron, Vue.js, React, etc.">
<meta name="Keywords" content="Angular CRUD Generator, Angular CRUD Code, Angular Code Generator, Angular App Generator, CRUD Code, Ionic App Builder">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<!--<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">-->
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
Expand Down
6 changes: 6 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ body {
}

.navbar {
align-items: center;
background: transparent;
color: white;
font-size: 20px;
font-weight: 500;
font-family: Roboto,"Helvetica Neue",sans-serif;
padding: 0 16px;
position: fixed;
transition: background 0.5s linear;
width: 100%;
z-index: 999;
&.nav-transform {
background: #ee1933;
Expand Down