From 764301555cc32da1d96d99b75aac535e42e622d2 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Tue, 29 Sep 2015 08:45:47 +0000 Subject: [PATCH] Added view on site on webapps --- orchestra/contrib/domains/admin.py | 18 ++- orchestra/contrib/systemusers/settings.py | 2 - orchestra/contrib/webapps/admin.py | 12 +- .../contrib/websites/backends/wordpress.py | 5 +- .../static/orchestra/images/view-on-site.png | Bin 0 -> 344 bytes .../static/orchestra/images/view-on-site.svg | 116 ++++++++++++++++++ scripts/container/create.sh | 4 + 7 files changed, 144 insertions(+), 13 deletions(-) create mode 100644 orchestra/static/orchestra/images/view-on-site.png create mode 100644 orchestra/static/orchestra/images/view-on-site.svg diff --git a/orchestra/contrib/domains/admin.py b/orchestra/contrib/domains/admin.py index 75b7857d..7f7e0573 100644 --- a/orchestra/contrib/domains/admin.py +++ b/orchestra/contrib/domains/admin.py @@ -1,6 +1,7 @@ from django import forms from django.contrib import admin from django.db.models.functions import Concat, Coalesce +from django.templatetags.static import static from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin @@ -79,12 +80,19 @@ class DomainAdmin(AccountAdminMixin, ExtendedModelAdmin): def display_websites(self, domain): if apps.isinstalled('orchestra.contrib.websites'): - webs = domain.websites.all() - if webs: + websites = domain.websites.all() + if websites: links = [] - for web in webs: - url = change_url(web) - links.append('%s' % (url, web.name)) + for website in websites: + context = { + 'title': _("View on site"), + 'url': website.get_absolute_url(), + 'image': '' % static('orchestra/images/view-on-site.png'), + } + site_link = '%(image)s' % context + admin_url = change_url(website) + link = '%s %s' % (admin_url, website.name, site_link) + links.append(link) return '
'.join(links) return _("No website") display_websites.admin_order_field = 'websites__name' diff --git a/orchestra/contrib/systemusers/settings.py b/orchestra/contrib/systemusers/settings.py index f0138d23..33efff1c 100644 --- a/orchestra/contrib/systemusers/settings.py +++ b/orchestra/contrib/systemusers/settings.py @@ -11,7 +11,6 @@ SYSTEMUSERS_SHELLS = Setting('SYSTEMUSERS_SHELLS', ( ('/dev/null', _("No shell, FTP only")), ('/bin/rssh', _("No shell, SFTP/RSYNC only")), - ('/usr/bin/git-shell', _("No shell, GIT only")), ('/bin/bash', "/bin/bash"), ('/bin/sh', "/bin/sh"), ), @@ -29,7 +28,6 @@ SYSTEMUSERS_DISABLED_SHELLS = Setting('SYSTEMUSERS_DISABLED_SHELLS', default=( '/dev/null', '/bin/rssh', - '/usr/bin/git-shell', ), ) diff --git a/orchestra/contrib/webapps/admin.py b/orchestra/contrib/webapps/admin.py index 527a7cc4..663798cc 100644 --- a/orchestra/contrib/webapps/admin.py +++ b/orchestra/contrib/webapps/admin.py @@ -1,6 +1,7 @@ from django import forms from django.contrib import admin from django.core.urlresolvers import reverse +from django.templatetags.static import static from django.utils.encoding import force_text from django.utils.translation import ugettext, ugettext_lazy as _ @@ -64,10 +65,17 @@ class WebAppAdmin(SelectPluginAdminMixin, AccountAdminMixin, ExtendedModelAdmin) def display_websites(self, webapp): websites = [] for content in webapp.content_set.all(): + context = { + 'title': _("View on site"), + 'url': content.get_absolute_url(), + 'image': '' % static('orchestra/images/view-on-site.png'), + } + site_link = '%(image)s' % context website = content.website - url = change_url(website) + admin_url = change_url(website) name = "%s on %s" % (website.name, content.path) - websites.append('%s' % (url, name)) + link = '%s %s' % (admin_url, name, site_link) + websites.append(link) if not websites: add_url = reverse('admin:websites_website_add') add_url += '?account=%s' % webapp.account_id diff --git a/orchestra/contrib/websites/backends/wordpress.py b/orchestra/contrib/websites/backends/wordpress.py index 1a98d86b..f2668145 100644 --- a/orchestra/contrib/websites/backends/wordpress.py +++ b/orchestra/contrib/websites/backends/wordpress.py @@ -1,8 +1,5 @@ -import os import textwrap -from django.utils.translation import ugettext_lazy as _ - from orchestra.contrib.orchestration import ServiceController @@ -10,7 +7,7 @@ class WordPressURLBackend(ServiceController): """ Configures WordPress site URL with associated website domain. """ - verbose_name = _("WordPress URL") + verbose_name = "WordPress URL" model = 'websites.Content' default_route_match = "content.webapp.type == 'wordpress-php'" diff --git a/orchestra/static/orchestra/images/view-on-site.png b/orchestra/static/orchestra/images/view-on-site.png new file mode 100644 index 0000000000000000000000000000000000000000..108af0df4d97549466c614bb72c943a4f22ec913 GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4u@pObhHwBu4M$1`kk47*5m^jW ze;tGwoit`w00kvWTq8Eak7 zG1d2iy&g-VO#8?4XL3}${>CwFZ8EK9XmxB%QrQ-qtyavm*GJ<9%fuJGzGjZvUhV~~ zonN)~NPnKp_|)sdHxt4%#EI|KcPk7Noeo`Db9Nvr4HY}k^B0ST{Z7t zM!5@zHTf=kISG8=ZQ7?w+yCmQqVUEB^aO ibb-=JsHpT6YN0gAAUoelF{r5}E*~{Dj*8 literal 0 HcmV?d00001 diff --git a/orchestra/static/orchestra/images/view-on-site.svg b/orchestra/static/orchestra/images/view-on-site.svg new file mode 100644 index 00000000..8bebaa34 --- /dev/null +++ b/orchestra/static/orchestra/images/view-on-site.svg @@ -0,0 +1,116 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/container/create.sh b/scripts/container/create.sh index ab366b0e..2b780112 100755 --- a/scripts/container/create.sh +++ b/scripts/container/create.sh @@ -40,10 +40,14 @@ sed -i "s/\tlocalhost$/\tlocalhost $NAME/" $CONTAINER/etc/hosts sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" $CONTAINER/etc/locale.gen chroot $CONTAINER locale-gen +echo -e "#!/bin/sh\nexit 101\n" > $CONTAINER/usr/sbin/policy-rc.d +chmod 755 $CONTAINER/usr/sbin/policy-rc.d + chroot $CONTAINER apt-get update chroot $CONTAINER apt-get install -y --force-yes \ nano git screen sudo iputils-ping python3 python3-pip wget curl dnsutils rsyslog +rm $CONTAINER/usr/sbin/policy-rc.d chroot $CONTAINER apt-get clean