Commit ea1e5d4d authored by Carolina's avatar Carolina

Merge branch 'staging' into 'master'

Staging into master

See merge request !28
parents 36078084 e339d1f3
Pipeline #8944 passed with stages
in 6 minutes and 15 seconds
......@@ -18,6 +18,8 @@ EMAIL_USE_TLS=
ALLOWED_HOSTS=localhost
GOOGLE_ANALYTICS_CODE=
GOOGLE_TAG_MANAGER_CODE=
GOOGLE_MAPS_TOKEN=
RECAPTCHA_PUBLIC_KEY=
RECAPTCHA_PUBLIC_KEY=
......@@ -33,3 +35,5 @@ AWS_DEFAULT_ACL=
COMPRESS_OFFLINE=
COMPRESS_ENABLED=
BASE_URL =
......@@ -112,6 +112,7 @@ deploy.sh
# mediafiles
mediafiles/
staticfiles/
# vscode
.vscode/
\ No newline at end of file
......@@ -81,6 +81,9 @@ To deploy this project, you need to configure settings in your environment
* EMAIL_USE_TLS: if 'True', uses TLS when sending emails
* GOOGLE_ANALYTICS_CODE: The code for google analytics
* GOOGLE_MAPS_TOKEN: Api key for access to service from google maps
* GOOGLE_TAG_MANAGER: Google tag manager ID
* RECAPTCHA_PUBLIC_KEY: public Key for recaptcha service
* RECAPTCHA_PRIVATE_KEY: private key for recaptcha service
......@@ -94,6 +97,8 @@ To deploy this project, you need to configure settings in your environment
* COMPRESS_OFFLINE: if 'True', uses pre compiled static assets
* COMPRESS_ENABLED: if 'True', enables compiled static assets
* BASE_URL: Domain site URL (this must include ending backslash)
* ROLLBAR_ACCESS_TOKEN
* CHILE_ATIENDE_ACCESS_TOKEN
* CLAVE_UNICA_CALLBACK: The url that clave única will call on login
......
......@@ -129,6 +129,9 @@ class PetitionerCompanyValidationView(BaseAPIView):
def get(self, request, company_rut=None, **kwargs):
company_rut = format_rut(company_rut)
# Get company
company=None
company_dict = False
try:
company = Company.objects.get(rut=company_rut)
if company.status == CompanyStatuses.PRE_REGISTERED:
......@@ -157,10 +160,7 @@ class PetitionerCompanyValidationView(BaseAPIView):
user_authorized = False
if user:
if company:
user_authorized = company.is_user_authorized_to_view(user)
if not user_authorized:
company_dict = False
user_authorized = company.is_user_authorized_to_view(user)
return Response({
'status': 'OK',
......
......@@ -11,6 +11,14 @@ doctype 5
html(lang="es")
head
if google_tag_manager_code
script.
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{google_tag_manager_code}}');
// version=1.0.2
if google_analytics_code
// Global site tag (gtag.js) - Google Analytics
......@@ -145,6 +153,9 @@ html(lang="es")
block stylesheets
body(class='{{body_class|default:""}}')
noscript
iframe(src='https://www.googletagmanager.com/ns.html?id=', height='0', width='0', style='display:none;visibility:hidden')
{% cms_toolbar %}
header
{% include 'includes/navbar.pug' %}
......
......@@ -8,7 +8,7 @@ footer.footer(class="{% if footer_class %}{{footer_class}}{% else %}mt-5{% endif
.col-4.col-sm-3.logo-col
img.logo(src="{% static 'img/logo-minecon.svg' %}", width='120', alt='Logo Minecon')
.col-8.col-sm-9.pt-2
a.super-gob-cl-es-una(href='https://super.digital.gob.cl/que-es-chileatiende?skin=exterior') super.gob.cl
a.super-gob-cl-es-una(href='{{base_url}}') super.gob.cl
| es una idea del
br
| Ministerio de Economía,
......@@ -18,17 +18,17 @@ footer.footer(class="{% if footer_class %}{{footer_class}}{% else %}mt-5{% endif
.col-sm-6.col-lg-3.mb-4.mb-sm-0
ul.p-3.footer-links
li
a(href='https://super.gob.cl/que-es-super', target='_blank') Sobre SUPER
a(href='{{base_url}}que-es-super', target='_blank') Sobre SUPER
li
a(href='https://super.gob.cl/contacto', target='_blank') Contacto
a(href='{{base_url}}contacto', target='_blank') Contacto
li
a(href='https://super.gob.cl/gps', target='_blank') Ir a sitio GPS
a(href='{{base_url}}gps', target='_blank') Ir a sitio GPS
.col-sm-6.col-lg-3
ul.p-3.footer-links
li
a(href='https://super.gob.cl/preguntas-frecuentes', target='_blank') Preguntas frecuentes
a(href='{{base_url}}preguntas-frecuentes', target='_blank') Preguntas frecuentes
li
a(href='https://super.gob.cl/instituciones', target='_blank')
a(href='{{base_url}}instituciones', target='_blank')
| Instituciones que publican
br
|
......
......@@ -4,7 +4,7 @@
nav.navbar.navbar-dark.navbar-expand-lg.fixed-top.bg-tertiary.px-3
.container
a.navbar-brand(href="/")
a.navbar-brand(href="{{base_url}}")
img(
src="{% static 'img/logo-super.svg' %}",
alt="Logo SUPER"
......
......@@ -11,6 +11,7 @@ from django import template
# enums
from companies.enums import AddManagerRequestStatuses
from permit_requests.models import PermitRequestStatus
register = template.Library()
......@@ -52,3 +53,11 @@ def is_url_with_parameter(url):
return False
else:
return True
@register.filter
def get_description(id):
try:
status = PermitRequestStatus.objects.get(id=id)
return status.description
except AttributeError:
return ''
......@@ -409,6 +409,7 @@ class UpdatePermitRequestStatusView(BaseAPIView):
extra_data['stage'] = status.stage
extra_data['status'] = status.base_status.name
extra_data['permit_request_status_id'] = status.id
if not message:
message = (
......
......@@ -42,7 +42,7 @@ if permit_requests
.col-sm-4
.d-flex.justify-content-between.align-items-center
a.btn.btn-outline-primary(
href='{{permit.permit.permalink}}'
href='{{base_url}}fichas/{{permit.permit.permit_id}}'
target='_blank'
)
small
......
......@@ -258,13 +258,3 @@ class Permit(BaseModel):
print("-- Problema de conexión en página " + str(iteration) + ". Reintento... n°" + str(intentos))
if intentos > 5:
quit()
def get_super_url(self):
"""
Returns the url from SUPER corresponding to this permit
"""
return urllib.parse.urljoin(
settings.SUPER_PAGES_URL,
str(self.permit_id)
)
......@@ -64,7 +64,7 @@ block content
small #[b TRÁMITE PRESENCIAL]
if object.permalink
a.btn.btn-block.btn-outline-primary(
href='{{object.get_super_url}}',
href='{{base_url}}fichas/{{object.permit_id}}',
)
small #[b VER GUÍA PERMISO]
else
......
......@@ -7,3 +7,19 @@ def google_analytics_code(request):
'google_analytics_code': settings.GOOGLE_ANALYTICS_CODE,
'site': Site.objects.get_current(),
}
def google_tag_manager_code(request):
return {
'google_tag_manager_code': settings.GOOGLE_TAG_MANAGER_CODE,
'site': Site.objects.get_current(),
}
def google_maps_token(request):
return {
'google_maps_token': settings.GOOGLE_MAPS_TOKEN,
'site': Site.objects.get_current(),
}
def base_url(request):
return {'base_url': settings.BASE_URL}
......@@ -33,6 +33,8 @@ LOCALLY_ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', 'localhost').split(',')
ADMINS = eval(os.getenv('ADMINS')) if os.getenv('ADMINS') else ()
GOOGLE_ANALYTICS_CODE = os.getenv('GOOGLE_ANALYTICS_CODE')
GOOGLE_TAG_MANAGER_CODE = os.getenv('GOOGLE_TAG_MANAGER_CODE')
GOOGLE_MAPS_TOKEN= os.getenv('GOOGLE_MAPS_TOKEN')
SECRET_KEY = os.getenv('SECRET_KEY', 'CHANGE ME')
......@@ -68,7 +70,4 @@ DGD_EMAIL_CLIENT_ID = os.getenv('DGD_EMAIL_CLIENT_ID', '')
DGD_EMAIL_CLIENT_SECRET = os.getenv('DGD_EMAIL_CLIENT_SECRET', '')
DGD_EMAIL_TOKEN_APP = os.getenv('DGD_EMAIL_TOKEN_APP', '')
SUPER_PAGES_URL = os.getenv(
'SUPER_PAGES_URL',
'https://super.gob.cl/fichas/'
)
BASE_URL = os.getenv('BASE_URL', 'https://test.super.gob.cl/')
......@@ -42,8 +42,9 @@ def get_local_value(key, default_value=None):
except AttributeError:
return default_value
GOOGLE_ANALYTICS_CODE = get_local_value('GOOGLE_ANALYTICS_CODE', None)
GOOGLE_TAG_MANAGER_CODE = get_local_value('GOOGLE_TAG_MANAGER_CODE', None)
GOOGLE_MAPS_TOKEN = get_local_value('GOOGLE_MAPS_TOKEN')
# default keys, replace with somethign your own
RECAPTCHA_PUBLIC_KEY = get_local_value('RECAPTCHA_PUBLIC_KEY', None)
......@@ -262,6 +263,9 @@ TEMPLATES = [
'cms.context_processors.cms_settings',
'sekizai.context_processors.sekizai',
'project.context_processors.google_analytics_code',
'project.context_processors.google_tag_manager_code',
'project.context_processors.google_maps_token',
'project.context_processors.base_url',
],
'loaders': [
('pypugjs.ext.django.Loader', (
......@@ -297,13 +301,15 @@ if 'DOCKER' not in os.environ:
# The default is to use the SMTP backend.
# Third-party backends can be specified by providing a Python path
# to a module that defines an EmailBackend class.
if DEBUG or not ENABLE_EMAILS or TEST:
if not ENABLE_EMAILS:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
else:
EMAIL_BACKEND = get_local_value(
'EMAIL_BACKEND',
'django.core.mail.backends.smtp.EmailBackend',
)
print("system email backenc seleted: " + EMAIL_BACKEND)
# Password validation
......@@ -559,11 +565,7 @@ CMS_TEMPLATES = [
CMS_PERMISSION = True
SUPER_PAGES_URL = get_local_value(
'SUPER_PAGES_URL',
'https://super.digital.gob.cl/fichas/'
)
BASE_URL = get_local_value('BASE_URL', '')
# CLAVE UNICA
CLAVE_UNICA_CALLBACK = get_local_value('CLAVE_UNICA_CALLBACK', '')
CLAVE_UNICA_CLIENT_ID = get_local_value('CLAVE_UNICA_CLIENT_ID', '')
......
......@@ -8,17 +8,20 @@ class ProjectStatuses(object):
CANCELLED = 'cancelled'
ACTIVE = 'active'
FINISHED = 'finished'
DELETED = 'deleted'
STATUSES = (
(CANCELLED, _('Cancelled')),
(ACTIVE, _('Active')),
(FINISHED, _('Finished')),
(DELETED, _('Deleted')),
)
CSS_CLASSES = {
CANCELLED: 'text-danger',
ACTIVE: 'text-dark',
FINISHED: 'text-success',
DELETED: 'text-danger',
}
......
extends base.pug
- load i18n
- load i18n utils
block options
......@@ -82,6 +82,12 @@ block content
b Estado
.col-md-8
| {{ permit_request.status.base_status.name }}
if permit_request.status
.row.py-2
.col-md-4
b Descripción
.col-md-8
| {{ permit_request.status.description }}
section.section-colored
.section-header
......@@ -98,9 +104,13 @@ block content
p.mb-0
| Emisor:
b {{permit_request.permit.public_service}}
p.mb-0
| Estado:
b {{notification.status}}
p
| Estado:
b {{notification.status}}
if notification.extra_data.permit_request_status_id
| Descripción:
b {{notification.extra_data.permit_request_status_id|get_description}}
.col-lg-3.text-right
small.text-success.font-weight-medium
| {{permit_request.get_status_display|capfirst}}
......
......@@ -6,7 +6,7 @@ extends base.pug
block javascripts
script(src="{% static 'js/projects/map.js' %}")
script(src="https://maps.googleapis.com/maps/api/js?key=AIzaSyABauQ4s_k8LFbx_2KtPiNGeyPWA7rujsY&libraries=drawing,geometry&callback=initMap")
script(src="https://maps.googleapis.com/maps/api/js?key={{google_maps_token}}&libraries=drawing,geometry&callback=initMap")
block javascript_data
script(type="text/javascript").
......
......@@ -7,7 +7,7 @@ block javascripts
script(src="{% static 'js/formset.js' %}")
script(src="{% static 'js/projects/create.js' %}")
script(src="{% static 'js/projects/map.js' %}")
script(src="https://maps.googleapis.com/maps/api/js?key=AIzaSyABauQ4s_k8LFbx_2KtPiNGeyPWA7rujsY&libraries=drawing&callback=initMap")
script(src="https://maps.googleapis.com/maps/api/js?key={{google_maps_token}}&libraries=drawing&callback=initMap")
block javascript_data
script(type="text/javascript").
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment