Skip to content

Commit

Permalink
Use requirejs
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrf committed Feb 22, 2013
1 parent 01ddf59 commit 27a0c9c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
12 changes: 7 additions & 5 deletions app/assets/javascripts/anti-flood.js
@@ -1,5 +1,7 @@
$('form').on('submit', function (e) {
$(this).find('input[type=submit], button[type!=button]').each(function () {
this.disabled = true
})
})
define(function () {
$('form').on('submit', function (e) {
$(this).find('input[type=submit], button[type!=button]').each(function () {
this.disabled = true;
})
});
});
4 changes: 1 addition & 3 deletions app/assets/javascripts/chooze.js
@@ -1,3 +1 @@
require('notification')
require('anti-flood')
require('locale')
define(['notification', 'anti-flood', 'locale'], function () { });
6 changes: 4 additions & 2 deletions app/assets/javascripts/locale.js
@@ -1,3 +1,5 @@
$('form.change-locale').change(function () {
$(this).submit();
define(function () {
$('form.change-locale').change(function () {
$(this).submit();
});
});
8 changes: 5 additions & 3 deletions app/assets/javascripts/notification.js
@@ -1,3 +1,5 @@
$(document).on('click', '.notification .button', function () {
$(this).closest('.notification').remove();
});
define(function () {
$(document).on('click', '.notification .button', function () {
$(this).closest('.notification').remove();
});
});
2 changes: 1 addition & 1 deletion app/views/layout.scala.html
Expand Up @@ -35,6 +35,6 @@
}
</footer>

<script src="@routes.Assets.at("javascripts/chooze.min.js")" type="text/javascript"></script>
@helper.requireJs(module = routes.Assets.at("javascripts/chooze").url, core = routes.Assets.at("javascripts/require.js").url)
</body>
</html>
3 changes: 2 additions & 1 deletion project/Build.scala
Expand Up @@ -15,7 +15,8 @@ object ApplicationBuild extends Build {
)

val main = play.Project(appName, appVersion, appDependencies).settings(
scalacOptions += "-feature"
scalacOptions += "-feature",
requireJs += "chooze.js"
)

}

0 comments on commit 27a0c9c

Please sign in to comment.