Skip to content

Commit

Permalink
Pr aarhus changes (#8)
Browse files Browse the repository at this point in the history
* Merged #8:
  - Moved template load from templateService to .twig to speed up initial load and avoid multiple api calls.
  - Fixed shared channel overview html.
  • Loading branch information
tuj authored Feb 8, 2019
1 parent 84f73e9 commit 0327757
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 53 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 1.2.0

* Merged https://github.com/os2display/admin-bundle/pull/8:
- Moved template load from templateService to .twig to speed up initial load and avoid multiple api calls.
- Fixed shared channel overview html.

## 1.1.1

* Merged https://github.com/os2display/admin-bundle/pull/6: Only display the add role modal if the user has admin privileges.
Expand Down
22 changes: 9 additions & 13 deletions Controller/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,13 @@ class MainController extends Controller
*/
public function indexAction()
{
// Add paths to css files for activated templates.
$templates = array();
$slideTemplates = $this->container->get('os2display.template_service')
->getEnabledSlideTemplates();
foreach ($slideTemplates as $template) {
$templates[] = $template->getPathCss();
}
$screenTemplates = $this->container->get('os2display.template_service')
->getEnabledScreenTemplates();
foreach ($screenTemplates as $template) {
$templates[] = $template->getPathCss();
}
$templateService = $this->container->get('os2display.template_service');
$serializer = $this->container->get('jms_serializer');

$templateRenderArray = [
'screens' => json_decode($serializer->serialize($templateService->getAllScreenTemplates(), 'json', SerializationContext::create()->setGroups(array('api')))),
'slides' => json_decode($serializer->serialize($templateService->getAllSlideTemplates(), 'json', SerializationContext::create()->setGroups(array('api')))),
];

// Get current user.
$user = $this->getUser();
Expand Down Expand Up @@ -84,7 +79,8 @@ public function indexAction()
'apps' => $mergedApps,
'bootstrap' => $mergedBootstrap,
'modules' => $mergedModules,
'templates' => $templates,
'templates' => $templateRenderArray,
'jsonTemplates' => json_encode($templateRenderArray),
'user' => $user
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@

<div class="overview--channels">
<div class="spinner overview--spinner" data-ng-show="loading"></div>
<div class="overview--channel" data-ng-repeat="channel in channels" data-ng-if="!ikOverlay && !loading">
<ik-shared-channel class="overview--channel-container" data-ng-click="clickSharedChannel(channel, index.index)" ik-channel="channel" ik-width="300" ik-sharing-index="index.index" ik-single-slide="{{ikOverlay}}" ik-clickable="true"></ik-shared-channel>
<div>{{channel.title}}</div>
</div>
<div class="overview--channel" data-ng-repeat="channel in channels" data-ng-if="ikOverlay && !loading">
<div class="overview--channel-link" data-ng-click="clickSharedChannel(channel, index.index)" data-ng-class="{'is-selected': channelSelected(channel)}">
<span class="overview--overlay">
<span class="overview--link-check"></span>
</span>
<div class="overview--channel" data-ng-repeat="channel in channels" data-ng-if="!loading">
<div class="overview--channel-link">
<div class="overview--preview">
<ik-shared-channel class="overview--channel-container" data-ng-click="clickSharedChannel(channel, index.index)" ik-channel="channel" ik-width="300" ik-sharing-index="index.index" ik-single-slide="true" ik-clickable="true"></ik-shared-channel>
</div>
<div class="overview--info-texts">
<div class="overview--channel-label">{{channel.title}}</div>
</div>
</div>
<ik-shared-channel class="overview--channel-container" data-ng-click="clickSharedChannel(channel, index.index)" ik-channel="channel" ik-width="300" ik-sharing-index="index.index" ik-single-slide="{{ikOverlay}}"></ik-shared-channel>
<div>{{channel.title}}</div>
</div>
<div class="overview--section" data-ng-show="!loading" ng-if="channels.length === 0">
Ingen resultater.
Expand Down
4 changes: 2 additions & 2 deletions Resources/public/apps/ikShared/services/templateFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ angular.module('ikShared').factory('templateFactory', [
'use strict';

var factory = {};
var slideTemplates = null;
var screenTemplates = null;
var slideTemplates = OS2DISPLAY_TEMPLATES.slides;
var screenTemplates = OS2DISPLAY_TEMPLATES.screens;

/**
* Gets slide templates from cache or symfony.
Expand Down
26 changes: 2 additions & 24 deletions Resources/public/assets/build/os2displayadmin.min.js

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions Resources/views/Main/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@

{# Import css files for templates. #}
{% if templates is defined %}
{% for template in templates %}
<link rel="stylesheet" href="{{ template }}">
{% for template in templates.slides %}
<link rel="stylesheet" href="{{ template.paths.css }}">
{% endfor %}
{% for template in templates.screens %}
<link rel="stylesheet" href="{{ template.paths.css }}">
{% endfor %}
{% endif %}

Expand Down Expand Up @@ -60,10 +63,16 @@
},
"version": "{{ version }}"
};
</script>

<script type="text/javascript">
var OS2DISPLAY_CURRENT_USER = {{ user | raw }};
</script>

<script type="text/javascript">
var OS2DISPLAY_TEMPLATES = {{ jsonTemplates | raw }};
</script>

<script src="/proxy/socket.io/socket.io.js"></script>

{% if app.environment == 'prod' %}
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Os2DisplayAdminBundle",
"version": "1.0.0",
"version": "1.2.0",
"link": "https://github.com/os2display"
}

0 comments on commit 0327757

Please sign in to comment.