This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from aldryn/feature/cleanup
Frontend Cleanup
- Loading branch information
Showing
6 changed files
with
77 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
aldryn_newsblog/boilerplates/bootstrap3/static/js/addons/cl.newsblog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*! | ||
* @author: Divio AG | ||
* @copyright: http://www.divio.ch | ||
*/ | ||
|
||
//###################################################################################################################### | ||
// #NAMESPACES# | ||
var Cl = window.Cl || {}; | ||
|
||
//###################################################################################################################### | ||
// #UTILS# | ||
(function ($) { | ||
'use strict'; | ||
|
||
Cl.newsBlog = { | ||
|
||
init: function () { | ||
var that = this; | ||
|
||
// there might be more addons available within one page | ||
$('.js-aldryn-newsblog-article-search').each(function () { | ||
that._search($(this)); | ||
}); | ||
}, | ||
|
||
_search: function (container) { | ||
var form = container.find('form'); | ||
|
||
form.on('submit', function (e) { | ||
e.preventDefault(); | ||
|
||
$.ajax({ | ||
type: 'GET', | ||
url: form.prop('action'), | ||
data: form.serialize() | ||
}).always(function (data) { | ||
form.siblings('.js-search-results').html(data); | ||
}).fail(function () { | ||
alert('REQUEST TIMEOUT'); | ||
}); | ||
}); | ||
} | ||
|
||
}; | ||
|
||
// autoload | ||
$(function () { | ||
if ($('.js-aldryn-newsblog-article-search').length) { | ||
Cl.newsBlog.init(); | ||
} | ||
}); | ||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters