Skip to content

Commit

Permalink
Making Websites With October CMS - Part 31 - Success and Error Messag…
Browse files Browse the repository at this point in the history
…es in forms
  • Loading branch information
Ivan Dorić committed Mar 4, 2017
1 parent 8e5727b commit ec8e55b
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 51 deletions.
2 changes: 1 addition & 1 deletion config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
|
*/

'driver' => 'smtp',
'driver' => 'log',

/*
|--------------------------------------------------------------------------
Expand Down
152 changes: 106 additions & 46 deletions octobermovies.sublime-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -336,30 +336,39 @@
"buffers":
[
{
"file": "themes/olympos/pages/movies.htm",
"file": "plugins/watchlearn/contact/components/contactform/default.htm",
"settings":
{
"buffer_size": 888,
"buffer_size": 804,
"encoding": "UTF-8",
"line_ending": "Windows"
"line_ending": "Unix"
}
},
{
"file": "themes/olympos/pages/homepage.htm",
"file": "themes/olympos/assets/sass/_globals.scss",
"settings":
{
"buffer_size": 2718,
"buffer_size": 2196,
"encoding": "UTF-8",
"line_ending": "Windows"
"line_ending": "Unix"
}
},
{
"file": "themes/olympos/pages/movie-single.htm",
"file": "themes/olympos/layouts/default.htm",
"settings":
{
"buffer_size": 1058,
"buffer_size": 1618,
"encoding": "UTF-8",
"line_ending": "Windows"
"line_ending": "Unix"
}
},
{
"file": "config/mail.php",
"settings":
{
"buffer_size": 4431,
"encoding": "UTF-8",
"line_ending": "Unix"
}
}
],
Expand Down Expand Up @@ -581,14 +590,25 @@
"expanded_folders":
[
"/Users/idoric/Development/public/octobermovies",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies",
"/Users/idoric/Development/public/octobermovies/config",
"/Users/idoric/Development/public/octobermovies/plugins",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/contact",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/contact/components",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/contact/components/contactform",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies/models",
"/Users/idoric/Development/public/octobermovies/themes",
"/Users/idoric/Development/public/octobermovies/themes/olympos",
"/Users/idoric/Development/public/octobermovies/themes/olympos/pages"
"/Users/idoric/Development/public/octobermovies/themes/olympos/assets",
"/Users/idoric/Development/public/octobermovies/themes/olympos/layouts"
],
"file_history":
[
"/Users/idoric/Development/public/octobermovies/themes/olympos/pages/homepage.htm",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies/routes.php",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies/models/Actor.php",
"/Users/idoric/Development/public/octobermovies/themes/olympos/pages/movie-single.htm",
"/Users/idoric/Development/public/octobermovies/themes/olympos/pages/movies.htm",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies/Plugin.php",
"/Users/idoric/Development/public/octobermovies/document.md",
"/Users/idoric/Development/public/octobermovies/plugins/watchlearn/movies/updates/version.yaml",
Expand Down Expand Up @@ -711,11 +731,7 @@
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/sass/modules/_alert-bar.scss",
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/parts/get_cookie.php",
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/archive-activities.php",
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/sass/_list-activities.scss",
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/parts/homepage/venues-near-you.php",
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/parts/list-venue/venue-description.php",
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/parts/map-everything.php",
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/sass/modules/_twitter-feed.scss"
"/Users/ivan/Development/public/activenation/wp-content/themes/olympos/sass/_list-activities.scss"
],
"find":
{
Expand Down Expand Up @@ -928,100 +944,144 @@
"groups":
[
{
"selected": 0,
"selected": 2,
"sheets":
[
{
"buffer": 0,
"file": "themes/olympos/pages/movies.htm",
"file": "plugins/watchlearn/contact/components/contactform/default.htm",
"semi_transient": false,
"settings":
{
"buffer_size": 888,
"buffer_size": 804,
"regions":
{
},
"selection":
[
[
312,
312
58,
58
]
],
"settings":
{
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage"
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage",
"tabs_extra_last_activated": 1488640709.86,
"tabs_extra_last_activated_sheet_index": 0,
"tabs_extra_spawned": true
},
"translation.x": 0.0,
"translation.y": 8.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 0,
"stack_index": 2,
"type": "text"
},
{
"buffer": 1,
"file": "themes/olympos/pages/homepage.htm",
"file": "themes/olympos/assets/sass/_globals.scss",
"semi_transient": false,
"settings":
{
"buffer_size": 2718,
"buffer_size": 2196,
"regions":
{
},
"selection":
[
[
247,
247
2085,
2085
]
],
"settings":
{
"auto_indent": true,
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage"
"syntax": "Packages/Syntax Highlighting for Sass/Syntaxes/SCSS.tmLanguage",
"tabs_extra_last_activated": 1488640620.65,
"tabs_extra_last_activated_sheet_index": 1,
"tabs_extra_spawned": true
},
"translation.x": 0.0,
"translation.y": 181.0,
"translation.y": 4757.0,
"zoom_level": 1.0
},
"stack_index": 1,
"stack_index": 3,
"type": "text"
},
{
"buffer": 2,
"file": "themes/olympos/pages/movie-single.htm",
"file": "themes/olympos/layouts/default.htm",
"semi_transient": false,
"settings":
{
"buffer_size": 1058,
"buffer_size": 1618,
"regions":
{
},
"selection":
[
[
247,
88
1296,
1296
]
],
"settings":
{
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage"
"syntax": "Packages/Twig/Syntaxes/HTML (Twig).tmLanguage",
"tabs_extra_last_activated": 1488641967.22,
"tabs_extra_last_activated_sheet_index": 2,
"tabs_extra_spawned": true
},
"translation.x": 0.0,
"translation.y": 0.0,
"translation.y": 1426.0,
"zoom_level": 1.0
},
"stack_index": 2,
"stack_index": 0,
"type": "text"
},
{
"buffer": 3,
"file": "config/mail.php",
"semi_transient": false,
"settings":
{
"buffer_size": 4431,
"regions":
{
},
"selection":
[
[
550,
550
]
],
"settings":
{
"incomplete_sync": null,
"remote_loading": false,
"synced": false,
"syntax": "Packages/PHP/PHP.sublime-syntax",
"tabs_extra_last_activated": 1488640959.42,
"tabs_extra_last_activated_sheet_index": 3,
"tabs_extra_spawned": true
},
"translation.x": 0.0,
"translation.y": 259.0,
"zoom_level": 1.0
},
"stack_index": 1,
"type": "text"
}
]
Expand Down Expand Up @@ -1079,6 +1139,10 @@
"last_filter": "",
"selected_items":
[
[
"homep",
"themes/olympos/pages/homepage.htm"
],
[
"movie.",
"plugins/watchlearn/movies/models/Movie.php"
Expand Down Expand Up @@ -1586,10 +1650,6 @@
[
"geoi",
"wp-content/themes/olympos/parts/geoip.php"
],
[
".gitig",
".gitignore"
]
],
"width": 0.0
Expand All @@ -1604,6 +1664,10 @@
"wat",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"watch",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"",
"~/Burza/patternlab/patternlab.sublime-project"
Expand Down Expand Up @@ -1640,10 +1704,6 @@
"gauss",
"~/Development/public/gaussdev/gaussdev.sublime-project"
],
[
"watch",
"~/Development/public/watchlearn/watchlearn.sublime-project"
],
[
"sp",
"~/Development/public/springfall/springfall.sublime-project"
Expand Down
14 changes: 11 additions & 3 deletions plugins/watchlearn/contact/components/contactform/default.htm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form data-request="contactform::onSend" data-request-validate data-request-flash>
<form data-request="contactform::onSend" class="contact-form" data-request-validate data-request-flash>
<label>Your name</label>
<input type="text" name="name">
<span data-validate-for="name">Hey! How about inputing your name.</span>
Expand All @@ -14,6 +14,14 @@
<button type="submit" data-attach-loading>Send</button>

<div class="alert alert-danger" data-validate-error>
<p data-message></p>
</div>
<p data-message></p>
</div>

<div class="flash error">
Ooops. Something went wrong please check the requiered fields.
</div>

<div class="flash success">
Your message has been sent. Thank you.
</div>
</form>
11 changes: 11 additions & 0 deletions themes/olympos/assets/compiled/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion themes/olympos/assets/compiled/css/style.css.map

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions themes/olympos/assets/sass/_globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,23 @@ form{
.clr{clear:both;}
.clr{content:"test";}

.flash{
padding:20px;
color: #fff;
display: none;

&.active{
display: block;
}

&.error{
background: red;
}

&.success{
background: green;
}
}



Expand Down
17 changes: 17 additions & 0 deletions themes/olympos/layouts/default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@

<!-- Scripts -->
<script src="{{ 'assets/compiled/js/all.js'|theme }}"></script>

<script type="text/javascript">

jQuery(document).ready(function($){
$('.contact-form').on('ajaxError', function(event, message){
$('.flash').removeClass('active');
$('.flash.error').addClass('active');
});

$('.contact-form').on('ajaxSuccess', function(event, message){
$('.flash').removeClass('active');
$('.flash.success').addClass('active');
});
});

</script>

{% framework extras %}
{% scripts %}

Expand Down

0 comments on commit ec8e55b

Please sign in to comment.