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
def list = { | |
[:] | |
} | |
def renderList = { | |
params.max = Math.min(params.max ? params.int('max') : 10, 100) | |
[productIds: Product.list(params)*.id, productInstanceTotal: Product.count()] | |
} | |
def renderProduct = { |
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
<div class="paginateButtons paginateTop"> | |
<g:paginate total="${productInstanceTotal}" /> | |
</div> | |
<div class="list"> | |
<g:each in="${productIds}"> | |
<g:include controller="product" action="renderProduct" id="${it}" /> | |
</g:each> | |
</div> | |
<div class="paginateButtons"> | |
<g:paginate total="${productInstanceTotal}" /> |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="layout" content="main" /> | |
<g:set var="entityName" value="${message(code: 'product.label', default: 'Product')}" /> | |
<title><g:message code="default.list.label" args="[entityName]" /></title> | |
</head> | |
<body> | |
<div class="nav"> | |
<span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span> |
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
import groovy.xml.MarkupBuilder; | |
class FrameworkTagLib { | |
static namespace = "ajax" | |
def include = { attrs -> | |
def controller = attrs.controller, action = attrs.action, id = attrs.id | |
def component = "${controller}-${action}" + (id ? "-${id}" : "") | |
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
var grailsAjax = { | |
refresh: function(target,params,cb) { | |
var component = $(target).parents('.ajax-component:first'); | |
if(!component.length) throw "Error: target does not belong to an ajax component" | |
var path = '../'+component.attr('id').replace(/-/g,'/'); | |
component.load(path,params,cb); | |
} | |
}; |
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
$(function() { | |
$('.body').delegate('.list a.color','click',function () { | |
var data = this.href.split(/\?/)[1]; | |
grailsAjax.refresh(this,data); | |
return false; | |
}); | |
}); |
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
$('.body').delegate('.prevLink, .step, .nextLink','click',function () { | |
var data = this.href.split(/\?/)[1]; | |
grailsAjax.refresh(this,data); | |
return false; | |
}); |
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 | |
$magePath = 'app/Mage.php'; | |
require_once $magePath; | |
umask(0); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
$types = array("config", "layout", "block_html", "translate", "collections", "eav", "config_api", "full_page"); | |
foreach($types as $type) { | |
Mage::app()->getCacheInstance()->cleanType($type); | |
} |
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
SERVER=yourdevserver.com | |
CODE_DIR=/var/www/html/ | |
git diff | ssh $SERVER -C "cd $CODE_DIR; patch -p1" |
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
import com.google.appengine.api.datastore.DatastoreService; | |
import com.google.appengine.api.datastore.DatastoreServiceFactory; | |
import com.google.appengine.api.datastore.Entity; | |
import com.google.appengine.api.datastore.Key; | |
/** | |
* Example (groovy syntax, but works just as well in Java): | |
* <pre> | |
EntityBuilder.build("Library"). | |
key(key). // can create your own Key instance |