diff --git a/examples/members.txt b/examples/members.txt index 87969b0..7da3409 100644 --- a/examples/members.txt +++ b/examples/members.txt @@ -100,3 +100,6 @@ Pekka,Pöytä,pekka.p.pouta@mosh.pit,Tuska,1,0 {"status": "success", "errors": []} // example response on failure (code will be 400) {"status": "failure", "errors": ["failure adding item Pekka, P\u00f6yt\u00e42, pekka.p.pouta@mosh.pit, Tuska, Eip"]} + +//member request from official page +POST /members/api/request \ No newline at end of file diff --git a/members/static/js/application_controllers.js b/members/static/js/application_controllers.js new file mode 100644 index 0000000..387e1b3 --- /dev/null +++ b/members/static/js/application_controllers.js @@ -0,0 +1,43 @@ +//app + +app = angular.module('applicationApp', []); + +//tokens + +app.config(['$httpProvider', function ($httpProvider) { + $httpProvider.defaults.xsrfCookieName = 'csrftoken'; + $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; +}]); + +//helpers + +function notyfication(type,timeout){ + return function(msg){ + noty({ + 'text': msg, + 'layout': "bottomRight", + 'type': type, + 'timeout': timeout + }); + }; +} +var notyError = notyfication('error',2500); +var notySuccess = notyfication('success',2500); + +//controllers + +app.controller("applicationController", function($scope, $http, $location) { + $scope.firstName = ""; + $scope.lastName = ""; + $scope.email = ""; + //$scope.year = "1"; + $scope.AYY = ""; + $scope.JAS = ""; + $scope.POR = ""; + $scope.send = function() { + $http.post("/members/api/request", {"first_name":$scope.firstName, "last_name":$scope.lastName, "email":$scope.email, /*"year":$scope.year,*/ "AYY":$scope.AYY, "jas":$scope.JAS, "POR":$scope.POR}).then(function(data){ + notySuccess("Hakemus lähetetty!"); + $location.path("application/"); + }); + } +}); \ No newline at end of file diff --git a/members/templates/application_index.html b/members/templates/application_index.html new file mode 100644 index 0000000..f58f6cd --- /dev/null +++ b/members/templates/application_index.html @@ -0,0 +1,65 @@ + + + + + + + + + Jäseneksi Aalto-yliopiston Sähköinsinöörikiltaan + + + + + + + + + {%load staticfiles %} + + + + + +

Killan jäseneksi liittyminen on helppoa ja hauskaa. Täytä vain alla oleva lomake.

+

Muista myös maksaa jäsenmaksusi!

+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
+
+ + +
+
+ + +
+ + +
+ \ No newline at end of file diff --git a/members/views.py b/members/views.py index 637b91f..585f9f8 100644 --- a/members/views.py +++ b/members/views.py @@ -13,6 +13,10 @@ import json def index(request, *args, **kwargs): return render(request, 'members_index.html',{}) +@ensure_csrf_cookie +def applicationindex(request, *args, **kwargs): + return render(request, 'application_index.html',{}) + @ensure_csrf_cookie @require_http_methods(["GET"]) @permission_required('members.change_member', login_url='/login') diff --git a/sikweb/urls.py b/sikweb/urls.py index ad7017e..be74ec6 100644 --- a/sikweb/urls.py +++ b/sikweb/urls.py @@ -32,7 +32,8 @@ from members.views import member_requests #infoscreen from infoscreen.views import index as infoindex from infoscreen.views import abb_job_list - +#application +from members.views import applicationindex urlpatterns = [ # main @@ -54,4 +55,6 @@ urlpatterns = [ #infoscreen url(r'^infoscreen/$', infoindex), url(r'^infoscreen/abbjobs$', abb_job_list), + #application + url(r'^application/$', applicationindex), ] diff --git a/webapp/templates/index.html b/webapp/templates/index.html new file mode 100644 index 0000000..7194da3 --- /dev/null +++ b/webapp/templates/index.html @@ -0,0 +1,31 @@ + \ No newline at end of file