Merge pull request #298 from bhollis/i18n-helpers

Fix Padrino helpers that require an i18n locale to be present
This commit is contained in:
Thomas Reynolds 2012-03-09 10:19:15 -08:00
commit 8d22fee8d8
5 changed files with 16 additions and 18 deletions

View file

@ -1,10 +1,12 @@
Feature: Built-in macro view helpers
In order to simplify generating HTML
Scenario: Using the link_to helper
Scenario: Using the padrino helpers
Given the Server is running at "padrino-helpers-app"
When I go to "/former_padrino_test.html"
And I should see 'href="test2.com"'
And I should see 'src="/images/test2.png"'
Then I should see 'src="/javascripts/test1.js"'
Then I should see 'href="/stylesheets/test1.css"'
And I should see 'src="/javascripts/test1.js"'
And I should see 'href="/stylesheets/test1.css"'
And I should see '1 KB'

View file

@ -1,4 +1,5 @@
<%= stylesheet_link_tag "test1" %>
<%= javascript_include_tag "test1" %>
<%= image_tag "test2.png", :alt => "alt" %>
<%= link_to "Has param", "test2.com", :class => "test" %>
<%= link_to "Has param", "test2.com", :class => "test" %>
<%= number_to_human_size(1024) %>

View file

@ -1,13 +1,4 @@
require "middleman-core/vendor/padrino-core-0.10.5/lib/padrino-core/support_lite"
# require 'i18n'
require 'enumerator'
# require 'active_support/core_ext/string/conversions' # to_date
require 'active_support/core_ext/float/rounding' # round
require 'active_support/option_merger' # with_options
require 'active_support/core_ext/object/with_options' # with_options
# require 'active_support/inflector' # humanize
FileSet.glob_require('../vendor/padrino-helpers-0.10.5/lib/padrino-helpers/**/*.rb', __FILE__)
require 'middleman-core/vendor/padrino-helpers-0.10.5/lib/padrino-helpers'
# Built-in helpers
module Middleman::CoreExtensions::DefaultHelpers
@ -27,9 +18,10 @@ module Middleman::CoreExtensions::DefaultHelpers
app.helpers Helpers
# app.ready do
# ::I18n.load_path = Dir["#{File.join(root, 'locales', '*.yml')}"]
# end
app.ready do
::I18n.load_path += Dir["#{File.join(root, 'locales','*.yml')}"]
::I18n.load_path += Dir["#{File.dirname(__FILE__)}/../vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/*.yml"]
end
end
alias :included :registered
end

View file

@ -1,4 +1,4 @@
require 'padrino-core/support_lite' unless defined?(SupportLite)
require 'middleman-core/vendor/padrino-core-0.10.5/lib/padrino-core/support_lite' unless defined?(SupportLite)
require 'cgi'
# require 'i18n'
require 'enumerator'

View file

@ -36,5 +36,8 @@ Gem::Specification.new do |s|
# Web Server
s.add_dependency("thin", ["~> 1.3.1"])
# i18n, needed for Padrino helpers
s.add_dependency("i18n", ["~> 0.6.0"])
end