Update scroll and sale in activate view.

Fixes #939
This commit is contained in:
Oskar Hahn 2013-11-06 17:39:12 +01:00
parent 983a373102
commit 01eb64c1d2
2 changed files with 6 additions and 2 deletions

View File

@ -88,6 +88,8 @@ class ActivateView(RedirectView):
set_active_slide(kwargs['callback'], kwargs=dict(request.GET.items())) set_active_slide(kwargs['callback'], kwargs=dict(request.GET.items()))
config['projector_scroll'] = config.get_default('projector_scroll') config['projector_scroll'] = config.get_default('projector_scroll')
config['projector_scale'] = config.get_default('projector_scale') config['projector_scale'] = config.get_default('projector_scale')
call_on_projector({'scroll': config['projector_scroll'],
'scale': config['projector_scale']})
class SelectWidgetsView(TemplateView): class SelectWidgetsView(TemplateView):
@ -155,7 +157,7 @@ class ProjectorControllView(RedirectView):
config['projector_scroll'] = config.get_default('projector_scroll') config['projector_scroll'] = config.get_default('projector_scroll')
call_on_projector({'scroll': config['projector_scroll'], call_on_projector({'scroll': config['projector_scroll'],
'scale': config['projector_scale']}) 'scale': config['projector_scale']})
def get_ajax_context(self, **kwargs): def get_ajax_context(self, **kwargs):
return { return {

View File

@ -41,9 +41,10 @@ class ProjectorViewTest(TestCase):
class ActivateViewTest(TestCase): class ActivateViewTest(TestCase):
rf = RequestFactory() rf = RequestFactory()
@patch('openslides.projector.views.call_on_projector')
@patch('openslides.projector.views.config') @patch('openslides.projector.views.config')
@patch('openslides.projector.views.set_active_slide') @patch('openslides.projector.views.set_active_slide')
def test_get(self, mock_set_active_slide, mock_config): def test_get(self, mock_set_active_slide, mock_config, mock_call_on_projector):
view = views.ActivateView() view = views.ActivateView()
view.request = self.rf.get('/?some_key=some_value') view.request = self.rf.get('/?some_key=some_value')
@ -54,6 +55,7 @@ class ActivateViewTest(TestCase):
mock_config.get_default.assert_has_calls([call('projector_scroll'), mock_config.get_default.assert_has_calls([call('projector_scroll'),
call('projector_scale')]) call('projector_scale')])
self.assertEqual(mock_config.__setitem__.call_count, 2) self.assertEqual(mock_config.__setitem__.call_count, 2)
self.assertTrue(mock_call_on_projector.called)
class SelectWidgetsViewTest(TestCase): class SelectWidgetsViewTest(TestCase):