docbrown/app/assets/javascripts/initializers/initializeDrawerSliders.js
Ben Halpern f073eb5754
Add badges and org cta (#324)
* Make org proof a required field

* Fix color picker and other minor org adjustments

* Add MVP of org add'l sidebar

* Add proof to org factory

* Fix org create action and fix tests

* Add new org fields to admin panel & lint

* Add proof to org edit for backward compatibility

* Add org info to edit preview

* Move preview edit notice to inside article div

* MVP of badge "final" steps

* Add info to user sidebar and clean up badge commit

* Modify sidebar for data

* Add organization decorator

* Add conditional so only users have new swipe nav, not orgs

* Add cloudinary prefix to badges

* Disallow duplicate badges
2018-05-17 18:22:37 -04:00

57 lines
No EOL
1.9 KiB
JavaScript

function initializeDrawerSliders() {
if(!initializeSwipeGestures.called) {
swipeState = "middle";
initializeSwipeGestures();
}
if (document.getElementById("on-page-nav-controls")){
if (document.getElementById("sidebar-bg-left")){
document.getElementById("sidebar-bg-left").onclick = function(){
swipeState = "middle";
slideSidebar("left","outOfView");
}
}
if (document.getElementById("sidebar-bg-right")){
document.getElementById("sidebar-bg-right").onclick = function(){
swipeState = "middle";
slideSidebar("right","outOfView");
}
}
if (document.getElementById("on-page-nav-butt-left")){
document.getElementById("on-page-nav-butt-left").onclick = function(){
swipeState = "left"
slideSidebar("left","intoView");
}
}
if (document.getElementById("on-page-nav-butt-right")){
document.getElementById("on-page-nav-butt-right").onclick = function(){
swipeState = "right"
slideSidebar("right","intoView");
}
}
InstantClick.on('change', function() {
document.getElementsByTagName('body')[0].classList.remove('modal-open');
slideSidebar("right","outOfView");
slideSidebar("left","outOfView");
});
listenForNarrowMenuClick();
}
}
function listenForNarrowMenuClick(event) {
var navLinks = document.getElementsByClassName("narrow-nav-menu");
var narrowFeedButt = document.getElementById("narrow-feed-butt");
for (var i = 0; i < navLinks.length; i++) {
document.getElementById("narrow-nav-menu").classList.remove("showing");
}
if (narrowFeedButt) {
narrowFeedButt.onclick = function(){
document.getElementById("narrow-nav-menu").classList.add("showing");
}
}
for (var i = 0; i < navLinks.length; i++) {
navLinks[i].onclick = function(event){
document.getElementById("narrow-nav-menu").classList.remove("showing");
}
}
}