Skip to content

Commit 11e7580

Browse files
committed
Use Webpack Encore to manage assets
1 parent 03a70a3 commit 11e7580

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8144
-1376
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/app/config/parameters.yml
22
/build/
3+
/node_modules/
34
/phpunit.xml
45
/.php_cs
56
/var/*
@@ -16,3 +17,5 @@
1617
!var/SymfonyRequirements.php
1718
/vendor/
1819
/web/bundles/
20+
/web/build/fonts/glyphicons-*
21+
/web/build/images/glyphicons-*

app/Resources/assets/js/admin.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
require('eonasdan-bootstrap-datetimepicker');
2+
3+
require('imports-loader?define=>false!typeahead.js/dist/typeahead.jquery.min.js');
4+
const Bloodhound = require('imports-loader?define=>false!typeahead.js/dist/bloodhound.js');
5+
window.Bloodhound = Bloodhound;
6+
require('../scss/bootstrap-tagsinput.scss');
7+
require('bootstrap-tagsinput');
8+
9+
$(function() {
10+
// Datetime picker initialization.
11+
// See http://eonasdan.github.io/bootstrap-datetimepicker/
12+
$('[data-toggle="datetimepicker"]').datetimepicker({
13+
icons: {
14+
time: 'fa fa-clock-o',
15+
date: 'fa fa-calendar',
16+
up: 'fa fa-chevron-up',
17+
down: 'fa fa-chevron-down',
18+
previous: 'fa fa-chevron-left',
19+
next: 'fa fa-chevron-right',
20+
today: 'fa fa-check-circle-o',
21+
clear: 'fa fa-trash',
22+
close: 'fa fa-remove'
23+
}
24+
});
25+
26+
// Bootstrap-tagsinput initialization
27+
// http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
28+
var $input = $('input[data-toggle="tagsinput"]');
29+
if ($input.length) {
30+
var source = new Bloodhound({
31+
local: $input.data('tags'),
32+
queryTokenizer: Bloodhound.tokenizers.whitespace,
33+
datumTokenizer: Bloodhound.tokenizers.whitespace
34+
});
35+
source.initialize();
36+
$input.tagsinput({
37+
trimValue: true,
38+
focusClass: 'focus',
39+
typeahead: {
40+
name: 'tags',
41+
source: source.ttAdapter()
42+
}
43+
});
44+
}
45+
})
46+
47+
// Handling the modal confirmation message.
48+
$(document).on('submit', 'form[data-confirmation]', function (event) {
49+
var $form = $(this),
50+
$confirm = $('#confirmationModal');
51+
52+
if ($confirm.data('result') !== 'yes') {
53+
//cancel submit event
54+
event.preventDefault();
55+
56+
$confirm
57+
.off('click', '#btnYes')
58+
.on('click', '#btnYes', function () {
59+
$confirm.data('result', 'yes');
60+
$form.find('input[type="submit"]').attr('disabled', 'disabled');
61+
$form.submit();
62+
})
63+
.modal('show');
64+
}
65+
});

app/Resources/assets/js/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// loads the Bootstrap jQuery plugins
2+
require('bootstrap-sass/assets/javascripts/bootstrap/dropdown.js');
3+
require('bootstrap-sass/assets/javascripts/bootstrap/modal.js');
4+
require('bootstrap-sass/assets/javascripts/bootstrap/transition.js');
5+
6+
// loads the code syntax highlighting library
7+
require('./highlight.js');

app/Resources/assets/js/highlight.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var hljs = require('highlight.js/lib/highlight.js');
2+
3+
hljs.configure({
4+
languages: ['twig', 'php']
5+
});
6+
7+
hljs.initHighlightingOnLoad();
8+
9+
module.exports = hljs;

app/Resources/assets/js/login.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$(function() {
2+
var usernameEl = $('#username');
3+
var passwordEl = $('#password');
4+
5+
// in a real application, hardcoding the user/password would be idiotic
6+
// but for the demo application it's very convenient to do so
7+
if (!usernameEl.val() && !passwordEl.val()) {
8+
usernameEl.val('jane_admin');
9+
passwordEl.val('kitten');
10+
}
11+
});

app/Resources/assets/scss/admin.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@import "~bootswatch/flatly/variables";
2+
@import "~eonasdan-bootstrap-datetimepicker/src/sass/bootstrap-datetimepicker-build.scss";
3+
4+
/* Page: 'Backend post index'
5+
------------------------------------------------------------------------- */
6+
body#admin_post_index .item-actions {
7+
white-space: nowrap
8+
}
9+
10+
body#admin_post_index .item-actions a.btn + a.btn {
11+
margin-left: 4px
12+
}
13+
14+
/* Page: 'Backend post show'
15+
------------------------------------------------------------------------- */
16+
body#admin_post_show .post-tags .label-default {
17+
background-color: #e9ecec;
18+
color: #6D8283;
19+
font-size: 16px;
20+
margin-right: 10px;
21+
padding: .4em 1em .5em;
22+
}
23+
body#admin_post_show .post-tags .label-default i {
24+
color: #95A6A7;
25+
}

0 commit comments

Comments
 (0)