Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Commit

Permalink
typos
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 7, 2012
1 parent b76f28b commit 960e7ae
Show file tree
Hide file tree
Showing 16 changed files with 141 additions and 263 deletions.
6 changes: 2 additions & 4 deletions CD-collection/app/templates/@layout.latte
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />

<meta charset="utf-8">
<meta name="description" content="Nette Framework example" />
<meta n:ifset="$robots" name="robots" content="{$robots}">

<title>{block #title|striptags|trim}{/block} | Nette example</title>

<link rel="stylesheet" type="text/css" media="screen" href="{$basePath}/css/site.css" />
<link rel="stylesheet" media="screen" href="{$basePath}/css/site.css" />
<script src="http://nette.github.com/resources/js/netteForms.js"></script>
</head>

Expand Down
6 changes: 2 additions & 4 deletions Demo/Finder.filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<meta charset="utf-8">
<title>Nette\Finder custom filters | Nette Framework</title>

<link rel="stylesheet" type="text/css" media="screen" href="files/style.css" />
<link rel="stylesheet" media="screen" href="files/style.css" />
</head>

<body>
Expand Down
12 changes: 3 additions & 9 deletions Fifteen/app/templates/Default.default.latte
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="content-language" content="en">
<meta http-equiv="imagetoolbar" content="no">
<meta name="author" content="David Grudl">
<meta name="copyright" content="David Grudl">
<link rel="stylesheet" type="text/css" media="screen" href="{$basePath}/css/style.css">

<meta charset="utf-8">
<title>Fifteen - Nette Framework example</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" media="screen" href="{$basePath}/css/style.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js" type="text/javascript"></script>
<script src="{$basePath}/js/fifteen.js" type="text/javascript"></script>
<script src="{$basePath}/js/jquery.nette.js" type="text/javascript"></script>
</head>
Expand Down
18 changes: 12 additions & 6 deletions Fifteen/www/js/fifteen.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,34 @@ jQuery(function($) {

var active = false;

$('.fifteen a.ajax').live('click', function(event) {
$('body').on('click', '.fifteen a.ajax', function(event) {
event.preventDefault();
event.stopImmediatePropagation();
if (active || $.active) return;
if (active || $.active) {
return;
}

active = true;
var payload;
var delta = $(this).attr('rel').split(',');
var img = $('img', this);
img.css('z-index', 1000);
img.animate({
'left': delta[0] * (img.attr('width') + 1) + 'px',
'top': delta[1] * (img.attr('height') + 1) + 'px'
left: delta[0] * img.attr('width'),
top: delta[1] * img.attr('height')
});
img.queue(function() {
active = false;
if (payload) $.nette.success(payload);
if (payload) {
$.nette.success(payload);
}
});

$.post($.nette.href = this.href, function(data) {
payload = data;
if (!active) $.nette.success(payload);
if (!active) {
$.nette.success(payload);
}
});

$.nette.spinner.css({
Expand Down
12 changes: 3 additions & 9 deletions Fifteen/www/js/jquery.nette.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,16 @@ if (typeof jQuery != 'function') {
(function($) {

$.nette = {
success: function(payload)
{
// redirect
success: function(payload) {
if (payload.redirect) {
window.location.href = payload.redirect;
return;
}

// state
if (payload.state) {
$.nette.state = payload.state;
}

// snippets
if (payload.snippets) {
for (var i in payload.snippets) {
$.nette.updateSnippet(i, payload.snippets[i]);
Expand All @@ -42,14 +38,12 @@ if (typeof jQuery != 'function') {
}
},

updateSnippet: function(id, html)
{
updateSnippet: function(id, html) {
$('#' + id).html(html);
},

// create animated spinner
createSpinner: function(id)
{
createSpinner: function(id) {
return this.spinner = $('<div></div>').attr('id', id ? id : 'ajax-spinner').ajaxStart(function() {
$(this).show();

Expand Down
14 changes: 4 additions & 10 deletions Forms/CSRF-protection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,29 @@


$form = new Form;

$form->addProtection('Security token did not match. Possible CSRF attack.', 3);

$form->addHidden('id')->setDefaultValue(123);
$form->addSubmit('submit', 'Delete item');



// Check if form was successfully submitted?
if ($form->isSubmitted() && $form->isValid()) {
if ($form->isSuccess()) {
echo '<h2>Form was submitted and successfully validated</h2>';

Debugger::dump($form->values);

exit; // here is usually redirect to another page
}



// Render form
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<meta charset="utf-8">
<title>Nette\Forms CSRF protection example | Nette Framework</title>

<style type="text/css">
<style>
.required {
color: maroon
}
Expand All @@ -64,7 +58,7 @@
text-align: right;
}
</style>
<link rel="stylesheet" type="text/css" media="screen" href="files/style.css" />
<link rel="stylesheet" media="screen" href="files/style.css" />
</head>

<body>
Expand Down
57 changes: 18 additions & 39 deletions Forms/basic-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

/**
* Nette\Forms basic example.
*
* - form definition using fluent interfaces
* - form groups usage
* - default rendering
*/


Expand All @@ -18,25 +14,6 @@
Debugger::enable();


$countries = array(
'Europe' => array(
'CZ' => 'Czech Republic',
'SK' => 'Slovakia',
'GB' => 'United Kingdom',
),
'CA' => 'Canada',
'US' => 'United States',
'?' => 'other',
);

$sex = array(
'm' => 'male',
'f' => 'female',
);



// Define form with validation rules
$form = new Form;

// group Personal data
Expand All @@ -51,7 +28,10 @@
->addRule($form::INTEGER, 'Age must be numeric value')
->addRule($form::RANGE, 'Age must be in range from %d to %d', array(10, 100));

$form->addRadioList('gender', 'Your gender:', $sex);
$form->addRadioList('gender', 'Your gender:', array(
'm' => 'male',
'f' => 'female',
));

$form->addText('email', 'Email:')
->setEmptyValue('@')
Expand All @@ -78,6 +58,14 @@
->addConditionOn($form['send'], $form::EQUAL, TRUE)
->addRule($form::FILLED, 'Enter your shipping address');

$countries = array(
'Europe' => array(
'CZ' => 'Czech Republic',
'SK' => 'Slovakia',
),
'US' => 'USA',
'?' => 'other',
);
$form->addSelect('country', 'Country:', $countries)
->setPrompt('Select your country')
->addConditionOn($form['send'], $form::EQUAL, TRUE)
Expand Down Expand Up @@ -112,41 +100,32 @@



// Check if form was submitted?
if ($form->isSubmitted()) {

// Check if form is valid
if ($form->isValid()) {
echo '<h2>Form was submitted and successfully validated</h2>';

Debugger::dump($form->values);

exit; // here is usually redirect to another page
}

} else {
// not submitted, define default values
$defaults = array(
$form->setDefaults(array( // not submitted, define default values
'name' => 'John Doe',
'userid' => 231,
'country' => 'CZ', // Czech Republic
);

$form->setDefaults($defaults);
'country' => 'CZ',
));
}



// Render form
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<meta charset="utf-8">
<title>Nette\Forms basic example | Nette Framework</title>

<style type="text/css">
<style>
.required {
color: maroon
}
Expand All @@ -167,7 +146,7 @@
text-align: right;
}
</style>
<link rel="stylesheet" type="text/css" media="screen" href="files/style.css" />
<link rel="stylesheet" media="screen" href="files/style.css" />
<script src="http://nette.github.com/resources/js/netteForms.js"></script>
</head>

Expand Down
Loading

0 comments on commit 960e7ae

Please sign in to comment.