diff --git a/.gitignore b/.gitignore index d82bbed..45c1249 100644 --- a/.gitignore +++ b/.gitignore @@ -108,4 +108,5 @@ migrations/ *~ \#* .#* -*.sqlite3 \ No newline at end of file +*.sqlite3 +.sass-cache \ No newline at end of file diff --git a/avisstage/config.rb b/avisstage/config.rb new file mode 100644 index 0000000..64d4c4b --- /dev/null +++ b/avisstage/config.rb @@ -0,0 +1,25 @@ +require 'compass/import-once/activate' +# Require any additional compass plugins here. + +# Set this to the root of your project when deployed: +http_path = "/" +css_dir = "static/css" +sass_dir = "sass" +images_dir = "static/images" +javascripts_dir = "static/js" + +# You can select your preferred output style here (can be overridden via the command line): +# output_style = :expanded or :nested or :compact or :compressed + +# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true + +# To disable debugging comments that display the original location of your selectors. Uncomment: +# line_comments = false + + +# If you prefer the indented syntax, you might want to regenerate this +# project again passing --syntax sass, or you can uncomment this: +# preferred_syntax = :sass +# and then run: +# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass diff --git a/avisstage/models.py b/avisstage/models.py index 436b9d5..f1b5b11 100644 --- a/avisstage/models.py +++ b/avisstage/models.py @@ -50,8 +50,10 @@ def create_user_profile(sender, instance, created, **kwargs): l.set_option( ldap.OPT_DEBUG_LEVEL, 255 ) info = l.search_s('dc=spi,dc=ens,dc=fr', ldap.SCOPE_SUBTREE, - '(uid=%s)' % (instance.username,), - ['cn','mailRoutingAddress', 'homeDirectory']) + ('(uid=%s)' % (instance.username,)), + [str("cn"), + str("mailRoutingAddress"), + str("homeDirectory")]) if len(info) > 0: infos = info[0][1] profil.nom = infos.get('cn', [''])[0] diff --git a/avisstage/sass/screen.scss b/avisstage/sass/screen.scss new file mode 100644 index 0000000..821036a --- /dev/null +++ b/avisstage/sass/screen.scss @@ -0,0 +1,102 @@ +@import "compass/reset"; + +@import url('https://fonts.googleapis.com/css?family=Dosis:300,500,700|Podkova:700'); + +$fond: #E80051; +$barre: $fond * 0.7; + +body { + background: $fond; + font-family: 'Dosis', sans-serif; + line-height: 1.4; + font-size: 19px; + font-weight: 300; +} + +h1, h2, h3, h4 { + font-family: Podkova; +} + +h1 { + font-size: 2em; +} + +.beta { + opacity: 0.5; + font-size: 0.7em; + display: inline-block; + transform: translate(-1em, 0.6em) rotate(-15deg); +} + +a { + font-weight: bold; +} + +header { + background: $barre; + display: flex; + justify-content: space-between; + align-items: center; + + nav ul { + display: inline-flex; + + li { + display: inline-table; + + a { + text-align: center; + display: table-cell; + padding: 0 20px; + height: 90px; + vertical-align: middle; + + &:hover { + background: $barre * 0.6; + } + } + } + } + + a { + color: #fff; + text-decoration: none; + } + + h1 { + padding: 15px; + } +} + +p { + +} + +.content { + background: #efefef; + max-width: 900px; + padding: 30px; + margin: 15px auto; + + p { + margin: 0.5em 0; + } +} + + +// Index + +.homeh1 { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 1.2em; + padding-bottom: 10px; + border-bottom: 3px solid #000; + margin-bottom: 15px; + + & > * { + display: inline-block; + } + +} diff --git a/avisstage/static/css/screen.css b/avisstage/static/css/screen.css new file mode 100644 index 0000000..8833d54 --- /dev/null +++ b/avisstage/static/css/screen.css @@ -0,0 +1,161 @@ +@import url("https://fonts.googleapis.com/css?family=Dosis:300,500,700|Podkova:700"); +/* line 5, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font: inherit; + font-size: 100%; + vertical-align: baseline; +} + +/* line 22, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +html { + line-height: 1; +} + +/* line 24, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +ol, ul { + list-style: none; +} + +/* line 26, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +table { + border-collapse: collapse; + border-spacing: 0; +} + +/* line 28, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +caption, th, td { + text-align: left; + font-weight: normal; + vertical-align: middle; +} + +/* line 30, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +q, blockquote { + quotes: none; +} +/* line 103, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +q:before, q:after, blockquote:before, blockquote:after { + content: ""; + content: none; +} + +/* line 32, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +a img { + border: none; +} + +/* line 116, ../../../../../../../var/lib/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ +article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { + display: block; +} + +/* line 8, ../../sass/screen.scss */ +body { + background: #E80051; + font-family: 'Dosis', sans-serif; + line-height: 1.4; + font-size: 19px; + font-weight: 300; +} + +/* line 16, ../../sass/screen.scss */ +h1, h2, h3, h4 { + font-family: Podkova; +} + +/* line 20, ../../sass/screen.scss */ +h1 { + font-size: 2em; +} + +/* line 24, ../../sass/screen.scss */ +.beta { + opacity: 0.5; + font-size: 0.7em; + display: inline-block; + transform: translate(-1em, 0.6em) rotate(-15deg); +} + +/* line 31, ../../sass/screen.scss */ +a { + font-weight: bold; +} + +/* line 35, ../../sass/screen.scss */ +header { + background: #a20039; + display: flex; + justify-content: space-between; + align-items: center; +} +/* line 41, ../../sass/screen.scss */ +header nav ul { + display: inline-flex; +} +/* line 44, ../../sass/screen.scss */ +header nav ul li { + display: inline-table; +} +/* line 47, ../../sass/screen.scss */ +header nav ul li a { + text-align: center; + display: table-cell; + padding: 0 20px; + height: 90px; + vertical-align: middle; +} +/* line 54, ../../sass/screen.scss */ +header nav ul li a:hover { + background: #610022; +} +/* line 61, ../../sass/screen.scss */ +header a { + color: #fff; + text-decoration: none; +} +/* line 66, ../../sass/screen.scss */ +header h1 { + padding: 15px; +} + +/* line 75, ../../sass/screen.scss */ +.content { + background: #efefef; + max-width: 900px; + padding: 30px; + margin: 15px auto; +} +/* line 81, ../../sass/screen.scss */ +.content p { + margin: 0.5em 0; +} + +/* line 89, ../../sass/screen.scss */ +.homeh1 { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 1.2em; + padding-bottom: 10px; + border-bottom: 3px solid #000; + margin-bottom: 15px; +} +/* line 98, ../../sass/screen.scss */ +.homeh1 > * { + display: inline-block; +} diff --git a/avisstage/static/images/home1.jpg b/avisstage/static/images/home1.jpg new file mode 100644 index 0000000..1bf02c0 Binary files /dev/null and b/avisstage/static/images/home1.jpg differ diff --git a/avisstage/static/images/home2.jpg b/avisstage/static/images/home2.jpg new file mode 100644 index 0000000..298cd64 Binary files /dev/null and b/avisstage/static/images/home2.jpg differ diff --git a/avisstage/templates/avisstage/base.html b/avisstage/templates/avisstage/base.html new file mode 100644 index 0000000..e584aef --- /dev/null +++ b/avisstage/templates/avisstage/base.html @@ -0,0 +1,73 @@ +{% load staticfiles %} + + + + + {% block title %}ExperiENS{% endblock %} + + {% if request.user.is_authenticated %} + + {% endif %} + + {% block extra_head %}{% endblock %} + + + +
+

ExperiENS beta

+ + +
+ + {# BLOCK FEEDBACK #} + {% if request.user.is_authenticated %} +
+
+
+

Envoyer un avis sur le siteX

+
+ {% csrf_token %} +

Connecté en tant que {{ user.profil }}

+

+ +
+
+
+
+ + Feedback + + {% endif %} + {# ENDBLOCK FEEDBACK #} + + +
+ {% if messages %} + + {% endif %} + {% block content %}{% endblock %} +
+ + diff --git a/avisstage/templates/avisstage/index.html b/avisstage/templates/avisstage/index.html new file mode 100644 index 0000000..6d2fa35 --- /dev/null +++ b/avisstage/templates/avisstage/index.html @@ -0,0 +1,33 @@ +{% extends "avisstage/base.html" %} +{% load staticfiles %} + +{% block content %} +
+

ExperiENS beta

+

Partagez vos expériences de stages !

+
+ +
+ Ce site est en cours de développement, et fait l'objet de mises à jours régulières. N'hésitez pas cependant à remplir une fiche pour vos stages, utiliser la recherche, et donner votre avis en utilisant le bouton "feedback". +
+ + {% if not request.user.is_authenticated %} +
+

Connexion

+

Connexion via le serveur central d'authentification ENS (identifiants clipper)

+
+ {% endif %} + +
+
+

Ne partez plus en stage en terre inconnue : nourrissez-vous de l'expérience de {{ stats.num_stages }} stages effectués par la communauté normalienne, repérez les bons plans, et ne faites pas les mêmes erreurs ! + {% if request.user.is_authenticated %}
Rechercher des stages{% endif %}

+ +
+
+ +

Vous revenez du bout du monde (ou de la rue d'à côté) ? N'attendez plus, rédigez un avis sur votre stage pour que votre expérience profite à d'autres ! + {% if request.user.is_authenticated %}
Partager ses stages{% endif %}

+
+
+{% endblock %} diff --git a/avisstage/templates/avisstage/perso.html b/avisstage/templates/avisstage/perso.html new file mode 100644 index 0000000..69d424b --- /dev/null +++ b/avisstage/templates/avisstage/perso.html @@ -0,0 +1,25 @@ +{% extends "avisstage/base.html" %} +{% load staticfiles %} + +{% block content %} +

Mon espace personnel

+

{{ user.nom }} Modifier mes infos

+ +
+

Mes stages

+ +
+{% endblock %} diff --git a/avisstage/urls.py b/avisstage/urls.py new file mode 100644 index 0000000..2d61037 --- /dev/null +++ b/avisstage/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import include, url +from . import views + +urlpatterns = [ + url(r'^$', views.index, name='index'), + url(r'^perso/$', views.perso, name='perso'), + url(r'^profil/show/(?P\w+)/$', views.profil, name='profil'), + url(r'^recherche/$', views.recherche, name='recherche'), + url(r'^feedback/$', views.feedback, name='feedback'), +] diff --git a/avisstage/views.py b/avisstage/views.py index 91ea44a..d87321c 100644 --- a/avisstage/views.py +++ b/avisstage/views.py @@ -1,3 +1,16 @@ from django.shortcuts import render -# Create your views here. +def index(request): + return render(request, 'avisstage/index.html') + +def perso(request): + return render(request, 'avisstage/perso.html') + +def profil(request, profil_id): + return render(request, 'avisstage/profil.html') + +def recherche(request): + return render(request, 'avisstage/recherche.html') + +def feedback(request): + return render(request, 'avisstage/feedback.html') diff --git a/experiENS/settings_base.py b/experiENS/settings_base.py index 40e2293..02d0cf8 100644 --- a/experiENS/settings_base.py +++ b/experiENS/settings_base.py @@ -28,6 +28,7 @@ INSTALLED_APPS = ( 'django.contrib.staticfiles', 'django.contrib.gis', + 'django_cas_ng', 'djrichtextfield', 'taggit', 'avisstage' @@ -43,6 +44,27 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + # insert your TEMPLATE_DIRS here + ], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.contrib.auth.context_processors.auth', + 'django.template.context_processors.debug', + 'django.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + ROOT_URLCONF = 'experiENS.urls' WSGI_APPLICATION = 'experiENS.wsgi.application' @@ -80,3 +102,10 @@ DJRICHTEXTFIELD_CONFIG = { 'width': 700 } } + +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'django_cas_ng.backends.CASBackend', +) + +CAS_SERVER_URL = "https://cas.eleves.ens.fr/" diff --git a/experiENS/settings_dev.py b/experiENS/settings_dev.py index 3b47856..e886954 100644 --- a/experiENS/settings_dev.py +++ b/experiENS/settings_dev.py @@ -4,11 +4,9 @@ from secrets import SECRET_KEY DEBUG = True -TEMPLATE_DEBUG = True - DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', + 'ENGINE': 'django.contrib.gis.db.backends.spatialite', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } @@ -20,3 +18,5 @@ INSTALLED_APPS += ( MIDDLEWARE_CLASSES += ( 'debug_toolbar.middleware.DebugToolbarMiddleware', ) + +SPATIALITE_LIBRARY_PATH = 'mod_spatialite' diff --git a/experiENS/urls.py b/experiENS/urls.py index 26a87ff..d944017 100644 --- a/experiENS/urls.py +++ b/experiENS/urls.py @@ -1,11 +1,13 @@ from django.conf.urls import include, url from django.contrib import admin +from django_cas_ng import views as django_cas_views + urlpatterns = [ - # Examples: - # url(r'^$', 'experiENS.views.home', name='home'), - # url(r'^blog/', include('blog.urls')), + url(r'^', include('avisstage.urls', namespace='avisstage')), + url(r'^login/$', django_cas_views.login, name = "login"), + url(r'^logout/$', django_cas_views.logout, name = "logout"), url(r'^djrichtextfield/', include('djrichtextfield.urls')), url(r'^admin/', include(admin.site.urls)), ]