Attach js files to chat page in "_layout" template

This commit is contained in:
Dmitriy Simushev 2014-10-13 12:41:11 +00:00
parent 8eaf93a916
commit dcd17ed01c
4 changed files with 37 additions and 23 deletions

View File

@ -73,6 +73,9 @@ class OperatorChatController extends AbstractController
$page['mibewBasePath'] = $request->getBasePath();
$page['mibewBaseUrl'] = $request->getBaseUrl();
// Initialize client side application
$this->getAssetManager()->attachJs('js/compiled/chat_app.js');
// Render the page with chat.
return $this->render('chat', $page);
}

View File

@ -59,6 +59,9 @@ class UserChatController extends AbstractController
$page['mibewBasePath'] = $request->getBasePath();
$page['mibewBaseUrl'] = $request->getBaseUrl();
// Initialize client side application
$this->getAssetManager()->attachJs('js/compiled/chat_app.js');
// Expand page
return $this->render('chat', $page);
}
@ -88,6 +91,9 @@ class UserChatController extends AbstractController
return $this->render('nochat', $page);
}
// Initialize client side application
$this->getAssetManager()->attachJs('js/compiled/chat_app.js');
$thread = null;
// Try to get thread from the session
if (isset($_SESSION['threadid'])) {
@ -253,6 +259,9 @@ class UserChatController extends AbstractController
$page['mibewBasePath'] = $request->getBasePath();
$page['mibewBaseUrl'] = $request->getBaseUrl();
// Initialize client side application
$this->getAssetManager()->attachJs('js/compiled/chat_app.js');
// Expand page
return $this->render('chat', $page);
}

View File

@ -5,6 +5,31 @@
<title>{{#block "windowTitle"}}{{l10n "Mibew Messenger"}}{{/block}}</title>
<link rel="shortcut icon" href="{{asset "@CurrentStyle/images/favicon.ico"}}" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="{{asset "@CurrentStyle/chat.css"}}" media="all" />
<!-- Extra CSS files -->
{{cssAssets}}
<!-- External libs -->
<script type="text/javascript" src="{{asset "js/libs/jquery.min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/json2.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/underscore-min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/backbone-min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/backbone.marionette.min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/handlebars.min.js"}}"></script>
<!-- Javascript templates -->
<script type="text/javascript" src="{{asset "@CurrentStyle/templates_compiled/client_side/templates.js"}}"></script>
<!-- Default application files -->
<script type="text/javascript" src="{{asset "js/compiled/mibewapi.js"}}"></script>
<script type="text/javascript" src="{{asset "js/compiled/default_app.js"}}"></script>
<!-- Localized string -->
<script type="text/javascript" src="{{route "js_translation" locale=currentLocale}}"></script>
<!-- Extra JavaScript files -->
{{jsAssets}}
{{#block "head"}}{{/block}}
</head>

View File

@ -4,32 +4,9 @@
<link rel="stylesheet" type="text/css" href="{{asset "@CurrentStyle/chat_ie7.css"}}" media="all" />
<![endif]-->
{{cssAssets}}
<!-- External libs -->
<script type="text/javascript" src="{{asset "js/libs/jquery.min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/json2.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/underscore-min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/backbone-min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/backbone.marionette.min.js"}}"></script>
<script type="text/javascript" src="{{asset "js/libs/handlebars.min.js"}}"></script>
<!-- Javascript templates -->
<script type="text/javascript" src="{{asset "@CurrentStyle/templates_compiled/client_side/templates.js"}}"></script>
<!-- Application files -->
<script type="text/javascript" src="{{asset "js/compiled/mibewapi.js"}}"></script>
<script type="text/javascript" src="{{asset "js/compiled/default_app.js"}}"></script>
<script type="text/javascript" src="{{asset "js/compiled/chat_app.js"}}"></script>
<!-- Localized string -->
<script type="text/javascript" src="{{route "js_translation" locale=currentLocale}}"></script>
<!-- Add style scripts -->
<script type="text/javascript" src="{{asset "@CurrentStyle/js/compiled/scripts.js"}}"></script>
{{jsAssets}}
<!-- Run application -->
<script type="text/javascript"><!--
jQuery(document).ready(function(){