Skip to content

Instantly share code, notes, and snippets.

From efca1d103a9bafe89ade34833d5d43a4d5f093ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20Mart=C3=ADn?= <elretirao@elretirao.net>
Date: Tue, 15 Mar 2011 18:58:13 +0100
Subject: [PATCH] Test case and documentation about collection_check_boxes labels should behave.
According to W3C, "The label element may contain at most one descendant input element, button element, select element, or textarea element."
---
lib/simple_form/action_view_extensions/builder.rb | 7 ++++---
test/action_view_extensions/builder_test.rb | 8 ++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
@javierv
javierv / gist:846609
Created February 27, 2011 22:17
Kaminari first page link with page param
diff --git a/lib/kaminari/helpers/tags.rb b/lib/kaminari/helpers/tags.rb
index 5d77d63..960b8be 100644
--- a/lib/kaminari/helpers/tags.rb
+++ b/lib/kaminari/helpers/tags.rb
@@ -48,7 +48,7 @@ module Kaminari
end
def page_url_for(page)
- @template.url_for @template.params.merge(@param_name => (page <= 1 ? nil : page)
+ @template.url_for @template.params.merge(@param_name => (page < 1 ? nil : page))
@javierv
javierv / test_database_fix
Created February 24, 2011 23:06
Fix for the test database in XapianDb
We couldn’t find that file to show.
@javierv
javierv / jasmine-jquery.diff
Created February 7, 2011 00:46
Patch to make it compatible with jasmine-ajax
diff --git a/spec/javascripts/lib/jasmine-jquery.js b/spec/javascripts/lib/jasmine-jquery.js
index 2fccd13..c17406f 100644
--- a/spec/javascripts/lib/jasmine-jquery.js
+++ b/spec/javascripts/lib/jasmine-jquery.js
@@ -28,6 +28,38 @@ jasmine.Fixtures = function() {
this.fixturesPath = 'spec/javascripts/fixtures';
};
+jasmine.Fixtures.XHR= window.XMLHttpRequest || (function(){
+ var progIdCandidates= ['Msxml2.XMLHTTP.4.0', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP'];
@javierv
javierv / gist:510293
Created August 5, 2010 20:02
Named routes for irregular plural of the plural
From 89ddcbe36e627919f0da45e414b65c5833643d48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20Mart=C3=ADn?= <elretirao@elretirao.net>
Date: Thu, 5 Aug 2010 21:59:35 +0200
Subject: [PATCH] Generated collection named routes now work with irregular plural of the plural.
In english, usually pluralizing a word twice gives the same result as pluralizing it just once.
However, with some words, and in many foreign languages, this is not the case.
For example, the plural of "taxi" is "taxis", but the plural of "taxis" is "taxes". We were pluralizing the resource :taxis, so were generating "taxes_path" instead of "taxis_path".