Clean up SilverStripe ModelAdmin (no sidebar, no filter, no import, no print)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I managed to get the compiled version with patched QT working on ubuntu precise 64bit (12.04 LTS) and thought I'd share my bash history in the hopes it might spare others some trouble shooting. | |
# Also note that this install process takes rather long, you might want to consider running it in a screen or something | |
# you will be needing git if you haven't got it yet | |
sudo apt-get install git-core | |
# as per installation instructions, install dependencies for wkhtmltopdf | |
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev | |
# clone the repo | |
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyModelAdmin extends ModelAdmin { | |
private static $managed_models = array('MyDataObject'); | |
private static $url_segment = 'foobar'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
version = ">= 0" | |
ARGV.clear | |
ARGV << "compile" | |
path = ".." | |
i = 0 | |
while !File.exists?(File.join(path, "config.rb")) | |
if i > 3 then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return children from the stage site | |
* | |
* @param showAll Inlcude all of the elements, even those not shown in the menus. | |
* (only applicable when extension is applied to {@link SiteTree}). | |
* @return SS_List | |
*/ | |
public function stageChildren($showAll = false) { | |
$baseClass = ClassInfo::baseDataClass($this->owner->class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class GridFieldPersonSalutationDropDown implements GridField_ColumnProvider, GridField_URLHandler { | |
public function augmentColumns($gridField, &$columns) { | |
$columns[] = 'Salutation'; | |
} | |
public function getColumnsHandled($gridField) { | |
return array('Salutation'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin rgba-background($color, $opacity) { | |
$rgba: rgba($color, $opacity); | |
$IEcolor: ie_hex_str($rgba); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{$IEcolor}', endColorstr='#{$IEcolor}', GradientType=0 ); | |
background: $rgba; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Page extends SiteTree { | |
... | |
function Content() { | |
$content = $this->Content; | |
// move class to the beginning right after <img | |
$pattern[0] = '/(<img)([^>]*?)(class=(\'|")([^>]*?)(\'|"))([^>]*?>)/i'; | |
$replacement[0] = '$1 $3$2$7'; | |
// add <a> to all images with class popup and a src having _resampled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (class_exists('AssetManager')) DataObjectManager::allow_assets_override(false); // if DOM is installed | |
Object::add_extension('Folder', 'myAssetsFolderDecorator'); | |
if (class_exists('AssetManager')) DataObjectManager::allow_assets_override(true); // if DOM is installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class myPage extends Page { | |
public static $has_one = array( | |
'Folder' => 'Folder' | |
); | |
public function getCMSFields() { | |
$fields = parent::getCMSFields(); | |
//$PhotoManager = new ImageDataObjectManager (/* some params here */); |