mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +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):
|
||||
"""Enable/disable pagekite service."""
|
||||
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
|
||||
if checkbox.checked == should_enable:
|
||||
return
|
||||
@ -278,14 +278,14 @@ def pagekite_enable(browser, should_enable):
|
||||
def pagekite_is_enabled(browser):
|
||||
"""Return whether pagekite is enabled."""
|
||||
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
|
||||
|
||||
|
||||
def pagekite_configure(browser, host, port, kite_name, kite_secret):
|
||||
"""Configure pagekite basic parameters."""
|
||||
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
|
||||
browser.fill('pagekite-server_domain', host)
|
||||
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):
|
||||
"""Return pagekite basic parameters."""
|
||||
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,
|
||||
int(browser.find_by_name('pagekite-server_port').value),
|
||||
browser.find_by_name('pagekite-kite_name').value,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "pagekite_introduction.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of FreedomBox.
|
||||
@ -22,7 +22,7 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
{% block configuration %}
|
||||
|
||||
<form class="form" method="post">
|
||||
{% csrf_token %}
|
||||
@ -45,6 +45,5 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block page_js %}
|
||||
|
||||
<script type="text/javascript" src="{% static 'pagekite/pagekite.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "pagekite_introduction.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of FreedomBox.
|
||||
@ -38,7 +38,7 @@
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% block configuration %}
|
||||
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{% blocktrans trimmed %}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "service-subsubmenu.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of FreedomBox.
|
||||
@ -18,30 +18,16 @@
|
||||
#
|
||||
{% endcomment %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% block description %}
|
||||
|
||||
{% block content %}
|
||||
<p>{{ description.0|safe }}</p>
|
||||
|
||||
{% block pagetitle %}
|
||||
<h2>{{ title }}</h2>
|
||||
{% endblock %}
|
||||
<ul>
|
||||
{% for paragraph in description|slice:"1:6" %}
|
||||
<li>{{ paragraph|safe }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% for paragraph in description %}
|
||||
<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>
|
||||
<p>{{ description|last|safe }}</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "pagekite_introduction.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of FreedomBox.
|
||||
@ -33,7 +33,7 @@
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% block configuration %}
|
||||
|
||||
<div class="alert alert-warning" role="alert">
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
"""
|
||||
URLs for the PageKite module
|
||||
"""
|
||||
@ -22,12 +21,10 @@ URLs for the PageKite module
|
||||
from django.conf.urls import url
|
||||
|
||||
from .views import StandardServiceView, CustomServiceView, ConfigurationView, \
|
||||
DeleteServiceView, index, FirstBootView, first_boot_skip
|
||||
DeleteServiceView, FirstBootView, first_boot_skip
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^sys/pagekite/$', index, name='index'),
|
||||
url(r'^sys/pagekite/configure/$', ConfigurationView.as_view(),
|
||||
name='configure'),
|
||||
url(r'^sys/pagekite/$', ConfigurationView.as_view(), name='index'),
|
||||
url(r'^sys/pagekite/services/standard/$', StandardServiceView.as_view(),
|
||||
name='standard-services'),
|
||||
url(r'^sys/pagekite/services/custom/$', CustomServiceView.as_view(),
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
|
||||
from django.contrib import messages
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.generic import TemplateView, View
|
||||
@ -34,10 +33,7 @@ from .forms import (AddCustomServiceForm, ConfigurationForm,
|
||||
|
||||
subsubmenu = [{
|
||||
'url': reverse_lazy('pagekite:index'),
|
||||
'text': _('About PageKite')
|
||||
}, {
|
||||
'url': reverse_lazy('pagekite:configure'),
|
||||
'text': _('Configure PageKite')
|
||||
'text': _('Configure')
|
||||
}, {
|
||||
'url': reverse_lazy('pagekite: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):
|
||||
"""Mixin to add 'subsubmenu' and 'title' to the context.
|
||||
|
||||
@ -67,7 +52,9 @@ class ContextMixin(object):
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Use self.title and the module-level subsubmenu"""
|
||||
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
|
||||
return context
|
||||
|
||||
@ -119,7 +106,6 @@ class CustomServiceView(ContextMixin, TemplateView):
|
||||
|
||||
class StandardServiceView(ContextMixin, FormView):
|
||||
template_name = 'pagekite_standard_services.html'
|
||||
title = 'PageKite Standard Services'
|
||||
form_class = StandardServiceForm
|
||||
success_url = reverse_lazy('pagekite:standard-services')
|
||||
|
||||
@ -135,7 +121,7 @@ class ConfigurationView(ContextMixin, FormView):
|
||||
template_name = 'pagekite_configure.html'
|
||||
form_class = ConfigurationForm
|
||||
prefix = 'pagekite'
|
||||
success_url = reverse_lazy('pagekite:configure')
|
||||
success_url = reverse_lazy('pagekite:index')
|
||||
|
||||
def get_initial(self):
|
||||
return utils.get_pagekite_config()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user