Skip to content

Instantly share code, notes, and snippets.

@mlauren
mlauren / gist:7042875
Created October 18, 2013 15:01
global modal function
/**
* Modals for group roster options.
*/
Drupal.behaviors.apci_show_hide_roster_options = function(context) {
var modals = $('.apci-modal');
$(window).load(function(){
modals.appendTo('body');
});
<?php
function apci_groups_favorite_settings_form(&$form_state) {
$default_option = FALSE;
$form['options'] = array(
'#title' => t('Favorite'),
'#type' => 'checkbox',
'#default_value' => $default_option,
);
var child_array = [$('.views-widget'), $('.views-operator')];
for ( var i = 0; i < child_array.length; i++ ) {
var child = $(child_array[i] + ' .button');
}
child.click(function() {
$(this).closest('form').submit();
return false;
});
@mlauren
mlauren / weird-directive-thing.js
Last active August 29, 2015 14:05
messing w directives
poopoo.directive('fixedHeader', function() {
return {
// Restrict it to be an attribute in this case
restrict: 'A',
link: function(scope, element, attrs) {
window.scrollmything = function() {
var window = this;
window.elementHeight = element.height();
window.activate();
$(window).on('scroll', this.activate);
@mlauren
mlauren / listings.php
Last active March 2, 2016 16:11
replace typeFeaturedHomepage method for Class VoShortCodes
class VoShortCodes {
public static function typeFeaturedHomepage() {
$cache = new Cache();
$listings = [];
$searchMult = new VoSearchMult;
$types = ['RE','LA'];
(function( $ ) {
function getStyles(selector) {
return selector+" .modal-dialog {margin-top: 15%;}" +selector+" .modal-dialog .modal-content {border: 1px solid black; border-radius: 0;}" +selector+" .modal-dialog .modal-content .modal-header {padding: 22px;} "+selector+" .modal-dialog .modal-content .close {color: white; background: black;opacity: 1;padding: 3px; margin: -22px;} "+selector+" .modal-dialog .modal-content input.form-control { padding: 19px 10px; display:block; border: 1px solid black; border-radius: 0; width:100%; } @media (min-width: 768px) {.modal-dialog { width: 550px;margin: 30px auto;} } input[type='text'] {box-sizing: border-box;} .input-block-level {display: block;width: 100%; min-height: 28px; } input.form-control {box-sizing:border-box !important;} " +selector+" .modal-dialog .modal-content .modal-body {position: relative; padding: 0 10% 10%;}" +selector+" .modal-dialog .modal-content .btn {padding:9px 12px; font-size:12px; text-transform: none;}" +selector+" .modal-dialog .moda