Skip to content

Instantly share code, notes, and snippets.

View bueckl's full-sized avatar

Jochen Gülden bueckl

View GitHub Profile
@bueckl
bueckl / gist:c56f5380e81c9fa7d56e
Created June 24, 2015 13:53
Hide Browser URL Bar
<!-- Make it fullscreen / hide the browser URL bar -->
<meta name="apple-mobile-web-app-capable" content="yes" />
@bueckl
bueckl / Multi Column Nav Example #SS3, #Silverstripe 3
Last active August 29, 2015 14:25
Multi Column Nav Example #SS3, #Silverstripe 3
/* On Controller …
This method splits the nav in rows of 3
*/
public function getCustomMenu($level = 1) {
@bueckl
bueckl / HTMLGridfield.php
Created August 17, 2015 16:06
HTML in Gridfield
function getColourNice(){
$obj= HTMLText::create();
$obj->setValue('<div style="background-color: '.$this->Colour.'; width: 100px; height: 100px;">&nbsp;</div>');
return $obj;
}
@bueckl
bueckl / using an action to render a SiteTree object
Created August 30, 2015 18:47
#SilverStripe - Using an action to render a SiteTree object
public function show(SS_HTTPRequest $request) {
$page = DataObject::get_by_id('SiteTree', $this->URLParams['ID'] );
if(!$page) {
return $this->httpError(404,'That page could not be found');
}
$controller = new ObjektPage_Controller($page);
$controller->init();
@bueckl
bueckl / second-bootstrap-modal.js
Created September 8, 2015 22:27
Open second bootstrap modal
$('#TermsModal').on('shown.bs.modal', function () {
$('#MyModal').css('z-index', 1040);
});
$('#TermsModal').on('hidden.bs.modal', function () {
$('#MyModal').css('z-index', 1050);
});
@bueckl
bueckl / FadeInOutOnScrollDown
Last active November 28, 2015 19:05
Fadeout on Scroll
$(window).on('scroll', function() {
var header = $("header");
var scrollBottom = $(document).height() - $(this).scrollTop() - $(this).height();
if ($(this).scrollTop() > 350 && scrollBottom > 450 ) {
if (!header.data('faded')) header.data('faded', 1).stop(true).fadeTo(400, 0);
} else if (header.data('faded')) {
header.data('faded', 0).stop(true).fadeTo(400, 1);
}
});
@bueckl
bueckl / JSON2Template
Created December 11, 2015 10:33
#Silverstripe Convert JSON Data to ArrayData for Template
//http://stackoverflow.com/questions/19888110/silverstripe-convert-twitter-json-string-to-dataobject-to-loop-though-in-templa
public static function getTwitterFeed(){
$settings = array(
'oauth_access_token' => "xxx",
'oauth_access_token_secret' => "xxx",
'consumer_key' => "xxx",
'consumer_secret' => "xxx"
);
@bueckl
bueckl / i18n.yml
Created January 5, 2016 14:39
Order Translations YML #SilverStripe
---
Name: customi18n
Before: 'defaulti18n'
---
i18n:
module_priority:
- mysite
- othermodule
@bueckl
bueckl / Social.ss
Created April 4, 2016 08:36
Social Icons Example including OpenGraph Meta Data etc, #SS3 #FontAwesome
<div class="social-icons well">
<meta property="og:title" content="$Item.T('OpenImmoObjekttitel')" />
<meta property="og:type" content="website" />
<meta property="og:url" content="$Item.CanonicalLinkURL" />
<meta property="og:image" content="$Item.ImmoImages.First.Image.CroppedWatermarkedImage(470,246).AbsoluteURL" />
<meta property="og:site_name" content="mallorca-immobilien-guide.de" />
<meta property="og:description" content="$Item.T('OpenImmoObjektbeschreibung')" />
@bueckl
bueckl / dropdown.js
Last active June 13, 2016 16:19
Make Dropdown Menu work on Touch devices
function isTouchDevice() {
return 'ontouchstart' in document.documentElement;
}
// Hack to make dropdown menu work on touch devices
var el = $('#main-nav ul.nav > li.dropdown-large a.dropdown-toggle');
/* If mobile browser, prevent click on parent nav item from redirecting to URL */