Initialize "thread_log" client side app from controller

This commit is contained in:
Dmitriy Simushev 2014-10-13 09:52:06 +00:00
parent aee1aa6904
commit d92b88b65a
2 changed files with 9 additions and 12 deletions

View File

@ -201,12 +201,20 @@ class HistoryController extends AbstractController
'sanitize_message',
$thread->getMessages(false, $last_id)
);
$page['threadMessages'] = json_encode($messages);
$page['title'] = getlocal("Chat log");
$page = array_merge($page, prepare_menu($operator, false));
$this->getAssetManager()->attachJs('js/compiled/thread_log_app.js');
$this->getAssetManager()->attachJs(
sprintf(
'jQuery(document).ready(function(){Mibew.Application.start(%s);});',
json_encode(array('messages' => $messages))
),
\Mibew\Asset\AssetManagerInterface::INLINE,
1000
);
return $this->render('history_thread', $page);
}

View File

@ -1,15 +1,4 @@
{{#extends "_layout"}}
{{#override "head"}}
<!-- Start application -->
<script type="text/javascript"><!--
jQuery(document).ready(function(){
Mibew.Application.start({
messages: {{{threadMessages}}}
});
});
//--></script>
{{/override}}
{{#override "content"}}
{{l10n "This page displays chat details and content."}}