Skip to content

Commit

Permalink
Demo files that don't start with TEST_
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Aug 16, 2017
1 parent 711a1b6 commit f82fec7
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 13 deletions.
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ demo/public/app/Assets/*
!demo/public/app/Assets/.htaccess
demo/public/app/Cache/*
!demo/public/app/Cache/.htaccess
demo/public/app/Controllers/*
!demo/public/app/Controllers/TEST_*
demo/public/app/Controllers/TEST_*
demo/public/app/Logs
demo/public/app/Models/*
!demo/public/app/Models/TEST_*
demo/public/app/Models/TEST_*
demo/public/app/Packages
demo/public/app/Resources/*
!demo/public/app/Resources/.htaccess
demo/public/uploads
demo/public/app/Views/*
!demo/public/app/Views/TEST_*
demo/public/app/Views/TEST_*

# --- JS DOC RESOURCES --- #
docs/resources
Expand Down
33 changes: 33 additions & 0 deletions demo/public/app/Controllers/AJAX123.controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace App\Controllers;

use Twist\Core\Controllers\BaseAJAX;

class AJAX123 extends BaseAJAX {

public function knock() {
$this -> _ajaxFail();
$this -> _ajaxMessage( 'The knock was too quiet' );
return $this -> _ajaxRespond();
}

public function ring() {
$this -> _ajaxMessage( 'The doorbell made a noise' );
$objResponse = array(
'response' => 'Hello? Who\'s there?',
'datetime' => date( 'Y-m-d H:i:s' )
);
return $this -> _ajaxRespond( $objResponse );
}

public function POSTage() {
$this -> _ajaxMessage( 'Your age was calculated' );
$objResponse = array(
//'yourDob' => $this -> _posted( 'dob' ),
'yourAge' => \Twist::DateTime() -> getAge( strtotime( $this -> _posted( 'dob' ) ) )
);
return $this -> _ajaxRespond( $objResponse );
}

}
24 changes: 24 additions & 0 deletions demo/public/app/Controllers/HelloWorld.controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Controllers;
use \Twist\Core\Controllers\Base;

class HelloWorld extends Base {

public function _index() {
return $this -> _view( 'welcome.tpl' );
}

public function view() {
return $this -> _view( 'views.tpl' );
}

public function ajaxrequests() {
return $this -> _view( 'ajax.tpl' );
}

public function testuploads() {
return $this -> _view( 'upload.tpl' );
}

}
5 changes: 5 additions & 0 deletions demo/public/app/Models/Books.model.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

class Books {

}
65 changes: 65 additions & 0 deletions demo/public/app/Views/ajax.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html class="no-js" lang="en-GB">
<head>
<meta charset="utf-8">
<title>TwistPHP - The PHP MVC Framework with a TWIST</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
{resource:arable}
{resource:modernizr}
</head>
<body>
<h1>AJAX</h1>
<form id="test-form">
<input name="firstname" type="text" value="Philip"> <input name="lastname" type="text" value="Fry"> <input name="dob" type="date" value="1974-08-14">
</form>
{resource:babel,polyfill}
{resource:twist/ajax}
<script>
var door = new twistajax( '/ajax' );
door.get( 'knock' )
.then( response => {
console.log( response );
} )
.catch( e => {
console.error( 'Sorry, I didn\'t hear you knock because: ' + e );
door.get( 'ring' )
.then( response => {
console.log( response );
} )
.catch( e => {
console.error( 'Sorry, I didn\'t hear you ring because: ' + e );
} );
} );
door.post( 'age', {
firstname: 'Andrew',
lastname: 'Hosgood',
dob: '1986-09-24'
} )
.then( response => {
console.log( response );
} )
.catch( e => {
console.error( 'Something broke:', e );
} );
door.postForm( 'age', '#test-form' )
.then( response => {
console.log( response );
} )
.catch( e => {
console.error( 'Something broke:', e );
} );
door.postForm( 'age2', '#test-form' )
.then( response => {
console.log( response );
} )
.catch( e => {
console.error( 'Something broke:', e );
} );
</script>
</body>
</html>
31 changes: 31 additions & 0 deletions demo/public/app/Views/upload.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html class="no-js" lang="en-GB">
<head>
<meta charset="utf-8">
<title>TwistPHP - The PHP MVC Framework with a TWIST</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
{resource:arable}
{resource:modernizr}
</head>
<body>
<h1>Uploading</h1>

<div id="twistupload-test-1"></div>
<div id="twistupload-test-2"></div>
<div id="twistupload-test-3"></div>
<div id="twistupload-test-4"></div>
{resource:twist/fileupload}
<script>
var fileuploadtest1 = new twistfileupload( 'twistupload-test-1', '/upload/file', 'test-1', false, { foo: 'bar' } );
var fileuploadtest2 = new twistfileupload( 'twistupload-test-2', '/upload/file', 'test-2', true, { foo: 'bar' } );
var fileuploadtest3 = new twistfileupload( 'twistupload-test-3', '/upload/asset', 'test-3', false, { foo: 'bar' } );
var fileuploadtest4 = new twistfileupload( 'twistupload-test-4', '/upload/asset', 'test-4', true, { foo: 'bar' } );
</script>
<!--
{file:upload}
{file:upload,multiple=1}
{asset:upload}
{asset:upload,multiple=1}
-->
</body>
</html>
17 changes: 17 additions & 0 deletions demo/public/app/Views/views.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html class="no-js" lang="en-GB">
<head>
<meta charset="utf-8">
<title>TwistPHP - The PHP MVC Framework with a TWIST</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
{resource:arable}
{resource:modernizr}
</head>
<body>
<h1>Welcome!</h1>
<h2>What a beautiful {date:l} it is :)</h2>
<script>
causeanerror( 'Foo bar' );
</script>
</body>
</html>
18 changes: 18 additions & 0 deletions demo/public/app/Views/welcome.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html class="no-js" lang="en-GB">
<head>
<meta charset="utf-8">
<title>TwistPHP - The PHP MVC Framework with a TWIST</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
{resource:arable}
{resource:modernizr}
</head>
<body>
<h1>TwistPHP</h1>
<ul>
<li><a href="/view">Views</a></li>
<li><a href="/ajaxrequests">AJAX requests</a></li>
<li><a href="/uploads">Fie uploads</a></li>
</ul>
</body>
</html>

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions src/Core/Resources/twist/fileupload/js/twistfileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ export default class twistfileupload {

console.warn( 'Your browser does not support AJAX uploading', 'warn', true );
}

// setInterval( () => {
// if( this.uploaded.length ) {
// console.log( this.uploaded );
// }
// }, 1000 );
}

static prettySize( intBytes ) {
Expand Down

0 comments on commit f82fec7

Please sign in to comment.