Skip to content

Instantly share code, notes, and snippets.

# setup view class
use Text::Xslate;
{
my $view_conf = __PACKAGE__->config->{'Text::Xslate'} || +{};
unless (exists $view_conf->{path}) {
$view_conf->{path} = [ File::Spec->catdir(__PACKAGE__->base_dir(), 'tmpl') ];
}
my $view = Text::Xslate->new(+{
'syntax' => 'TTerse',
'module' => [ 'Text::Xslate::Bridge::TT2Like' ],
package DoubleSpark::Web::Dispatcher;
use strict;
use warnings;
use Amon2::Web::Dispatcher::RouterSimple;
# If the method with the update, Be sure to specify the POST.
# 更新処理を伴うメソッドは必ずPOSTを明示する事
connect '/' =>
{ controller => 'Root', action => 'index' };
package DoubleSpark::Web::Dispatcher;
use strict;
use warnings;
use Amon2::Web::Dispatcher::RouterSimple;
sub connect_with_method {
my ($method, $path, $dest, $opt) = @_;
$opt->{method} = $method;
connect $path => $dest, $opt;
}
smoke.confirm('アイコン画像を削除しますか?', function(e){
if (e) {
$.ajax({
url: '/support/icon/delete',
type: 'post',
data: {
id: id,
_token: app.token
}
})
package DoubleSpark::Web::Dispatcher;
use strict;
use warnings;
use Amon2::Web::Dispatcher::RouterSimple;
sub get($;$$) { connect_with_method('GET', @_) }
sub post($;$$) { connect_with_method('POST', @_) }
get '/' => 'Root#index';
get '/mock' => 'Root#mock';
@s-aska
s-aska / gist:1196956
Created September 6, 2011 08:29 — forked from aerith/gist:1196933
package Asayake::Web::Dispatcher;
use strict;
use warnings;
use Asayake::DB;
use Amon2::Web::Dispatcher::RouterSimple;
use Scalar::Util;
{
// Event Manager
c.addEvents = function(name){
c.events[name] = [];
}
c.addListener = function(name, fh, context){
c.events[name].push([fh, context]);
}
c.fireEvent = function() {
var args = $.makeArray(arguments);
var name = args.shift();
c.obj.get = function(obj, keys){
var f = obj;
var ns = keys.split('.');
for (var i = 0, max_i = ns.length; i < max_i; i++) {
f = f[ns[i]];
}
return f;
}
c.ui.hover = function(element, over, out, delay){
var timer;
$(element).hover(function(){
if (timer) {
clearTimeout(timer);
timer = null;
} else {
over.apply(this, arguments);
}
}, function(){
@s-aska
s-aska / tabMenu
Created September 10, 2011 08:32
// HTML
<ul class="tabs">
<li class="active">
<a
data-setup="tabMenu"
data-tab-id="menu"
data-tab-group="help"
>Menu</a>
</li>
<li>