Skip to content

Commit

Permalink
anketa popup: reading cookie stuff from settings (#141)
Browse files Browse the repository at this point in the history
* fixes #140

Signed-off-by: Adrian Matejov <[email protected]>
  • Loading branch information
Adman committed Jun 11, 2019
1 parent 8da95c3 commit 1d53415
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions votrfront/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

ua_code = None

anketa_cookie_name = 'anketaKolacik2019Leto'
anketa_cookie_hide_date = '02 July 2019'

servers = [
dict(
title='ais2.uniba.sk + REST',
Expand Down
2 changes: 2 additions & 0 deletions votrfront/front.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def static_url(filename):
def app_response(request, **my_data):
my_data['url_root'] = request.url_root
my_data['instance_name'] = request.app.settings.instance_name
my_data['anketa_cookie_name'] = request.app.settings.anketa_cookie_name
my_data['anketa_cookie_hide_date'] = request.app.settings.anketa_cookie_hide_date
if 'csrf_token' not in my_data:
my_data['servers'] = request.app.settings.servers

Expand Down
4 changes: 2 additions & 2 deletions votrfront/js/AnketaPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { CacheRequester, Loading } from './ajax';
var dropCookie = true; // false disables the Cookie, allowing you to style the banner
var cookieDurationClose = 3;
var cookieDurationVote = 60;
var cookieName = 'anketaKolacik2019Leto'; // Name of our cookie
var cookieName = Votr.settings.anketa_cookie_name; // Name of our cookie
var cookieValue = 'on'; // Value of cookie
var cookieHideDate = Date.parse('02 July 2019'); // Starting this day the cookie won't be visible
var cookieHideDate = Date.parse(Votr.settings.anketa_cookie_hide_date); // Starting this day the cookie won't be visible


export class AnketaPopup extends React.Component {
Expand Down

0 comments on commit 1d53415

Please sign in to comment.