mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
pagekite: Bring subsubmenu below description. Remove About section.
- Fixed broken functional tests - Pagekite index page directly takes to configuration Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
1eca9ffd2d
commit
a4e01eb629
@ -262,7 +262,7 @@ def download_file_logged_in(browser, url, suffix=''):
|
|||||||
def pagekite_enable(browser, should_enable):
|
def pagekite_enable(browser, should_enable):
|
||||||
"""Enable/disable pagekite service."""
|
"""Enable/disable pagekite service."""
|
||||||
nav_to_module(browser, 'pagekite')
|
nav_to_module(browser, 'pagekite')
|
||||||
browser.find_link_by_href('/plinth/sys/pagekite/configure/').first.click()
|
browser.find_link_by_href('/plinth/sys/pagekite/').first.click()
|
||||||
checkbox = browser.find_by_id('id_pagekite-enabled').first
|
checkbox = browser.find_by_id('id_pagekite-enabled').first
|
||||||
if checkbox.checked == should_enable:
|
if checkbox.checked == should_enable:
|
||||||
return
|
return
|
||||||
@ -278,14 +278,14 @@ def pagekite_enable(browser, should_enable):
|
|||||||
def pagekite_is_enabled(browser):
|
def pagekite_is_enabled(browser):
|
||||||
"""Return whether pagekite is enabled."""
|
"""Return whether pagekite is enabled."""
|
||||||
nav_to_module(browser, 'pagekite')
|
nav_to_module(browser, 'pagekite')
|
||||||
browser.find_link_by_href('/plinth/sys/pagekite/configure/').first.click()
|
browser.find_link_by_href('/plinth/sys/pagekite/').first.click()
|
||||||
return browser.find_by_id('id_pagekite-enabled').checked
|
return browser.find_by_id('id_pagekite-enabled').checked
|
||||||
|
|
||||||
|
|
||||||
def pagekite_configure(browser, host, port, kite_name, kite_secret):
|
def pagekite_configure(browser, host, port, kite_name, kite_secret):
|
||||||
"""Configure pagekite basic parameters."""
|
"""Configure pagekite basic parameters."""
|
||||||
nav_to_module(browser, 'pagekite')
|
nav_to_module(browser, 'pagekite')
|
||||||
browser.find_link_by_href('/plinth/sys/pagekite/configure/').first.click()
|
browser.find_link_by_href('/plinth/sys/pagekite/').first.click()
|
||||||
# time.sleep(0.250) # Wait for 200ms show animation to complete
|
# time.sleep(0.250) # Wait for 200ms show animation to complete
|
||||||
browser.fill('pagekite-server_domain', host)
|
browser.fill('pagekite-server_domain', host)
|
||||||
browser.fill('pagekite-server_port', str(port))
|
browser.fill('pagekite-server_port', str(port))
|
||||||
@ -297,7 +297,7 @@ def pagekite_configure(browser, host, port, kite_name, kite_secret):
|
|||||||
def pagekite_get_configuration(browser):
|
def pagekite_get_configuration(browser):
|
||||||
"""Return pagekite basic parameters."""
|
"""Return pagekite basic parameters."""
|
||||||
nav_to_module(browser, 'pagekite')
|
nav_to_module(browser, 'pagekite')
|
||||||
browser.find_link_by_href('/plinth/sys/pagekite/configure/').first.click()
|
browser.find_link_by_href('/plinth/sys/pagekite/').first.click()
|
||||||
return (browser.find_by_name('pagekite-server_domain').value,
|
return (browser.find_by_name('pagekite-server_domain').value,
|
||||||
int(browser.find_by_name('pagekite-server_port').value),
|
int(browser.find_by_name('pagekite-server_port').value),
|
||||||
browser.find_by_name('pagekite-kite_name').value,
|
browser.find_by_name('pagekite-kite_name').value,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "pagekite_introduction.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of FreedomBox.
|
# This file is part of FreedomBox.
|
||||||
@ -22,7 +22,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
{% block content %}
|
{% block configuration %}
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
@ -45,6 +45,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block page_js %}
|
{% block page_js %}
|
||||||
|
|
||||||
<script type="text/javascript" src="{% static 'pagekite/pagekite.js' %}"></script>
|
<script type="text/javascript" src="{% static 'pagekite/pagekite.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "pagekite_introduction.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of FreedomBox.
|
# This file is part of FreedomBox.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block configuration %}
|
||||||
|
|
||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
{% blocktrans trimmed %}
|
{% blocktrans trimmed %}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "service-subsubmenu.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of FreedomBox.
|
# This file is part of FreedomBox.
|
||||||
@ -18,30 +18,16 @@
|
|||||||
#
|
#
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% block description %}
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
{% block content %}
|
<p>{{ description.0|safe }}</p>
|
||||||
|
|
||||||
{% block pagetitle %}
|
<ul>
|
||||||
<h2>{{ title }}</h2>
|
{% for paragraph in description|slice:"1:6" %}
|
||||||
{% endblock %}
|
<li>{{ paragraph|safe }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
{% for paragraph in description %}
|
<p>{{ description|last|safe }}</p>
|
||||||
<p>{{ paragraph|safe }}</p>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% if manual_page %}
|
|
||||||
<p class="manual-page">
|
|
||||||
<a href="{% url 'help:manual-page' manual_page %}">
|
|
||||||
{% trans 'Learn more...' %}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a class="btn btn-primary btn-md" href="{% url 'pagekite:configure' %}">
|
|
||||||
{% trans "Configure PageKite" %}</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "pagekite_introduction.html" %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
#
|
#
|
||||||
# This file is part of FreedomBox.
|
# This file is part of FreedomBox.
|
||||||
@ -33,7 +33,7 @@
|
|||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block configuration %}
|
||||||
|
|
||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,6 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
URLs for the PageKite module
|
URLs for the PageKite module
|
||||||
"""
|
"""
|
||||||
@ -22,12 +21,10 @@ URLs for the PageKite module
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from .views import StandardServiceView, CustomServiceView, ConfigurationView, \
|
from .views import StandardServiceView, CustomServiceView, ConfigurationView, \
|
||||||
DeleteServiceView, index, FirstBootView, first_boot_skip
|
DeleteServiceView, FirstBootView, first_boot_skip
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^sys/pagekite/$', index, name='index'),
|
url(r'^sys/pagekite/$', ConfigurationView.as_view(), name='index'),
|
||||||
url(r'^sys/pagekite/configure/$', ConfigurationView.as_view(),
|
|
||||||
name='configure'),
|
|
||||||
url(r'^sys/pagekite/services/standard/$', StandardServiceView.as_view(),
|
url(r'^sys/pagekite/services/standard/$', StandardServiceView.as_view(),
|
||||||
name='standard-services'),
|
name='standard-services'),
|
||||||
url(r'^sys/pagekite/services/custom/$', CustomServiceView.as_view(),
|
url(r'^sys/pagekite/services/custom/$', CustomServiceView.as_view(),
|
||||||
|
|||||||
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.template.response import TemplateResponse
|
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.views.generic import TemplateView, View
|
from django.views.generic import TemplateView, View
|
||||||
@ -34,10 +33,7 @@ from .forms import (AddCustomServiceForm, ConfigurationForm,
|
|||||||
|
|
||||||
subsubmenu = [{
|
subsubmenu = [{
|
||||||
'url': reverse_lazy('pagekite:index'),
|
'url': reverse_lazy('pagekite:index'),
|
||||||
'text': _('About PageKite')
|
'text': _('Configure')
|
||||||
}, {
|
|
||||||
'url': reverse_lazy('pagekite:configure'),
|
|
||||||
'text': _('Configure PageKite')
|
|
||||||
}, {
|
}, {
|
||||||
'url': reverse_lazy('pagekite:standard-services'),
|
'url': reverse_lazy('pagekite:standard-services'),
|
||||||
'text': _('Standard Services')
|
'text': _('Standard Services')
|
||||||
@ -47,17 +43,6 @@ subsubmenu = [{
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
|
||||||
"""Serve introduction page"""
|
|
||||||
return TemplateResponse(
|
|
||||||
request, 'pagekite_introduction.html', {
|
|
||||||
'title': pagekite.name,
|
|
||||||
'description': pagekite.description,
|
|
||||||
'manual_page': pagekite.manual_page,
|
|
||||||
'subsubmenu': subsubmenu
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
class ContextMixin(object):
|
class ContextMixin(object):
|
||||||
"""Mixin to add 'subsubmenu' and 'title' to the context.
|
"""Mixin to add 'subsubmenu' and 'title' to the context.
|
||||||
|
|
||||||
@ -67,7 +52,9 @@ class ContextMixin(object):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
"""Use self.title and the module-level subsubmenu"""
|
"""Use self.title and the module-level subsubmenu"""
|
||||||
context = super(ContextMixin, self).get_context_data(**kwargs)
|
context = super(ContextMixin, self).get_context_data(**kwargs)
|
||||||
context['title'] = getattr(self, 'title', '')
|
context['title'] = pagekite.name
|
||||||
|
context['description'] = pagekite.description
|
||||||
|
context['manual_page'] = pagekite.manual_page
|
||||||
context['subsubmenu'] = subsubmenu
|
context['subsubmenu'] = subsubmenu
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@ -119,7 +106,6 @@ class CustomServiceView(ContextMixin, TemplateView):
|
|||||||
|
|
||||||
class StandardServiceView(ContextMixin, FormView):
|
class StandardServiceView(ContextMixin, FormView):
|
||||||
template_name = 'pagekite_standard_services.html'
|
template_name = 'pagekite_standard_services.html'
|
||||||
title = 'PageKite Standard Services'
|
|
||||||
form_class = StandardServiceForm
|
form_class = StandardServiceForm
|
||||||
success_url = reverse_lazy('pagekite:standard-services')
|
success_url = reverse_lazy('pagekite:standard-services')
|
||||||
|
|
||||||
@ -135,7 +121,7 @@ class ConfigurationView(ContextMixin, FormView):
|
|||||||
template_name = 'pagekite_configure.html'
|
template_name = 'pagekite_configure.html'
|
||||||
form_class = ConfigurationForm
|
form_class = ConfigurationForm
|
||||||
prefix = 'pagekite'
|
prefix = 'pagekite'
|
||||||
success_url = reverse_lazy('pagekite:configure')
|
success_url = reverse_lazy('pagekite:index')
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
return utils.get_pagekite_config()
|
return utils.get_pagekite_config()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user