Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
c0976d9a
Verified
Commit
c0976d9a
authored
Jun 19, 2019
by
Sébastiaan Versteeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove last dependency on hash in location, use sessionStorage
parent
ed9ae402
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
31 deletions
+21
-31
website/events/static/events/js/main.js
website/events/static/events/js/main.js
+21
-30
website/payments/static/payments/js/main.js
website/payments/static/payments/js/main.js
+0
-1
No files found.
website/events/static/events/js/main.js
View file @
c0976d9a
const
BIRTHDAYS_COOKIE
=
'
showbirthdays
'
;
const
VIEW_COOKIE
=
'
calendarview
'
;
const
DATE_STORAGE
=
'
calendardate
'
;
const
SOURCES
=
{
events
:
{
id
:
'
event
'
,
...
...
@@ -19,17 +20,17 @@ const SOURCES = {
},
};
function
check
ResponsiveState
(
calendar
,
windowWidth
,
view
)
{
var
buttonText
=
gettext
(
'
show birthdays
'
);
function
check
ViewState
(
calendar
)
{
let
buttonText
=
gettext
(
'
show birthdays
'
);
if
(
calendar
.
getEventSourceById
(
SOURCES
.
birthdays
.
id
))
{
calendar
.
getEventSourceById
(
SOURCES
.
birthdays
.
id
).
remove
();
}
if
(
windowWidth
<=
768
)
{
if
(
window
.
inner
Width
<=
768
)
{
calendar
.
setOption
(
'
header
'
,
{
right
:
''
});
}
else
{
if
(
view
.
type
===
'
list
'
)
{
if
(
calendar
.
view
.
type
===
'
list
'
)
{
calendar
.
setOption
(
'
header
'
,
{
right
:
'
list,timeGridWeek,dayGridMonth
'
});
...
...
@@ -43,7 +44,10 @@ function checkResponsiveState(calendar, windowWidth, view) {
});
}
}
$
(
'
.fc-showBirthdays-button
'
).
html
(
buttonText
);
const
showBirthdaysBtn
=
calendar
.
el
.
querySelector
(
'
.fc-showBirthdays-button
'
);
if
(
showBirthdaysBtn
)
{
showBirthdaysBtn
.
innerHTML
=
buttonText
;
}
}
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
...
...
@@ -61,20 +65,21 @@ document.addEventListener('DOMContentLoaded', function () {
if
(
Cookies
.
get
(
BIRTHDAYS_COOKIE
))
{
eventSources
.
push
(
SOURCES
.
birthdays
);
}
let
tmpView
=
window
.
innerWidth
<
979
?
'
list
'
:
'
timeGridWeek
'
;
if
(
Cookies
.
get
(
VIEW_COOKIE
)
!==
undefined
)
{
tmpView
=
Cookies
.
get
(
VIEW_COOKIE
);
let
defaultView
=
window
.
innerWidth
<
979
?
'
list
'
:
'
timeGridWeek
'
;
if
(
Cookies
.
get
(
VIEW_COOKIE
)
!==
undefined
&&
window
.
innerWidth
>=
979
)
{
defaultView
=
Cookies
.
get
(
VIEW_COOKIE
);
}
if
(
window
.
location
.
hash
.
indexOf
(
'
date
'
)
>
-
1
)
{
defaultDate
=
window
.
location
.
hash
.
substr
(
window
.
location
.
hash
.
indexOf
(
'
date
'
)
+
5
,
24
);
if
(
sessionStorage
.
getItem
(
DATE_STORAGE
)
)
{
defaultDate
=
sessionStorage
.
getItem
(
DATE_STORAGE
);
}
const
calendar
=
new
FullCalendar
.
Calendar
(
calendarEl
,
{
plugins
:
[
'
timeGrid
'
,
'
dayGrid
'
,
'
bootstrap
'
,
listViewPlugin
],
aspectRatio
:
1.8
,
themeSystem
:
'
bootstrap
'
,
defaultView
:
tmp
View
,
defaultView
:
default
View
,
defaultDate
:
defaultDate
,
eventSources
:
eventSources
,
firstDay
:
1
,
...
...
@@ -112,11 +117,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
}
:
{},
header
:
{
right
:
'
showBirthdays, list,timeGridWeek,dayGridMonth prev,next today
'
},
eventClick
:
function
({
jsEvent
,
event
})
{
console
.
log
(
event
);
if
(
event
.
url
&&
event
.
extendedProps
.
blank
)
{
jsEvent
.
preventDefault
();
window
.
open
(
event
.
url
,
'
_blank
'
);
...
...
@@ -129,18 +130,14 @@ document.addEventListener('DOMContentLoaded', function () {
viewSkeletonRender
:
function
({
view
})
{
const
prevView
=
Cookies
.
get
(
VIEW_COOKIE
);
const
date
=
calendar
.
getDate
();
window
.
location
.
hash
=
'
date=
'
+
date
.
toISOString
()
+
'
&view=
'
+
view
.
type
;
if
(
view
.
type
!==
prevView
)
{
const
windowWidth
=
window
.
innerWidth
;
Cookies
.
set
(
VIEW_COOKIE
,
view
.
type
);
check
ResponsiveState
(
calendar
,
windowWidth
,
view
);
check
ViewState
(
calendar
);
}
},
datesRender
:
function
(
{
view
}
)
{
datesRender
:
function
()
{
const
date
=
calendar
.
getDate
();
window
.
location
.
hash
=
'
date=
'
+
date
.
toISOString
()
+
'
&view=
'
+
view
.
type
;
sessionStorage
.
setItem
(
DATE_STORAGE
,
date
.
toISOString
())
;
},
windowResize
:
function
()
{
const
windowWidth
=
window
.
innerWidth
;
...
...
@@ -149,17 +146,11 @@ document.addEventListener('DOMContentLoaded', function () {
if
(
view
!==
currentView
.
type
)
{
calendar
.
changeView
(
view
);
}
else
{
check
ResponsiveState
(
calendar
,
windowWidth
,
currentView
);
check
ViewState
(
calendar
);
}
}
});
calendar
.
render
();
if
(
calendar
.
view
.
type
!==
tmpView
)
{
calendar
.
changeView
(
tmpView
);
}
else
{
var
windowWidth
=
window
.
innerWidth
;
checkResponsiveState
(
calendar
,
windowWidth
,
calendar
.
view
);
}
checkViewState
(
calendar
);
});
website/payments/static/payments/js/main.js
View file @
c0976d9a
...
...
@@ -5,7 +5,6 @@
var
signaturePad
=
new
SignaturePad
(
signatureCanvas
);
function
canvasToField
()
{
console
.
log
(
'
canvas field
'
);
if
(
signaturePad
.
toData
().
length
)
{
signatureField
.
val
(
signaturePad
.
toDataURL
(
"
image/svg+xml
"
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment