Skip to content

Commit

Permalink
render extension partials only once, even when overriden
Browse files Browse the repository at this point in the history
  • Loading branch information
codez committed Jul 20, 2015
1 parent 349c922 commit 6567af3
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 52 deletions.
111 changes: 68 additions & 43 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,91 +1,116 @@
PATH
remote: .
specs:
wagons (0.4.2)
wagons (0.4.3)
bundler (>= 1.1)
rails (>= 3.2)
seed-fu-ndo (>= 0.0.2)

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.8)
actionpack (= 4.1.8)
actionview (= 4.1.8)
actionmailer (4.2.1)
actionpack (= 4.2.1)
actionview (= 4.2.1)
activejob (= 4.2.1)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.8)
actionview (= 4.1.8)
activesupport (= 4.1.8)
rack (~> 1.5.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.1)
actionview (= 4.2.1)
activesupport (= 4.2.1)
rack (~> 1.6)
rack-test (~> 0.6.2)
actionview (4.1.8)
activesupport (= 4.1.8)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.1)
activesupport (= 4.2.1)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.8)
activesupport (= 4.1.8)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.1)
activesupport (= 4.2.1)
globalid (>= 0.3.0)
activemodel (4.2.1)
activesupport (= 4.2.1)
builder (~> 3.1)
activerecord (4.1.8)
activemodel (= 4.1.8)
activesupport (= 4.1.8)
arel (~> 5.0.0)
activesupport (4.1.8)
i18n (~> 0.6, >= 0.6.9)
activerecord (4.2.1)
activemodel (= 4.2.1)
activesupport (= 4.2.1)
arel (~> 6.0)
activesupport (4.2.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (5.0.1.20140414130214)
arel (6.0.0)
builder (3.2.2)
erubis (2.7.0)
globalid (0.3.5)
activesupport (>= 4.1.0)
hike (1.2.3)
i18n (0.6.11)
json (1.8.1)
i18n (0.7.0)
json (1.8.2)
loofah (2.0.1)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
metaclass (0.0.4)
mime-types (2.4.3)
minitest (5.4.3)
mini_portile (0.6.2)
minitest (5.6.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.10.1)
multi_json (1.11.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
open4 (1.3.4)
rack (1.5.2)
rack-test (0.6.2)
rack (1.6.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.8)
actionmailer (= 4.1.8)
actionpack (= 4.1.8)
actionview (= 4.1.8)
activemodel (= 4.1.8)
activerecord (= 4.1.8)
activesupport (= 4.1.8)
rails (4.2.1)
actionmailer (= 4.2.1)
actionpack (= 4.2.1)
actionview (= 4.2.1)
activejob (= 4.2.1)
activemodel (= 4.2.1)
activerecord (= 4.2.1)
activesupport (= 4.2.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.8)
sprockets-rails (~> 2.0)
railties (4.1.8)
actionpack (= 4.1.8)
activesupport (= 4.1.8)
railties (= 4.2.1)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
railties (4.2.1)
actionpack (= 4.2.1)
activesupport (= 4.2.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
seed-fu (2.3.3)
activerecord (>= 3.1, < 4.2)
activesupport (>= 3.1, < 4.2)
seed-fu (2.3.5)
activerecord (>= 3.1, < 4.3)
activesupport (>= 3.1, < 4.3)
seed-fu-ndo (0.0.2)
seed-fu (>= 2.2.0)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.2)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.4)
thread_safe (0.3.5)
tilt (1.4.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
Expand Down
2 changes: 1 addition & 1 deletion lib/wagons/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Wagons
VERSION = '0.4.2'
VERSION = '0.4.3'
end
2 changes: 1 addition & 1 deletion lib/wagons/view_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def files_to_partial_names(files)
files.map do |f|
m = f.match(/views.(.+?[\/\\])_(.+)\.\w+\.\w+$/)
m[1] + m[2]
end
end.uniq
end

def glob_pattern(list)
Expand Down
1 change: 1 addition & 0 deletions test/dummy/app/views/people/_list_main.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
List Main
4 changes: 3 additions & 1 deletion test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
config.eager_load = false

# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'

# Show full error reports and disable caching
Expand All @@ -30,4 +30,6 @@

# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr

config.active_support.test_order = :random
end
2 changes: 1 addition & 1 deletion test/dummy/db/migrate/20120606125104_create_people.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def change
t.string :name
t.date :birthday

t.timestamps
t.timestamps :null => false
end
end
end
8 changes: 4 additions & 4 deletions test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

ActiveRecord::Schema.define(version: 20120606125104) do

create_table "people", force: true do |t|
t.string "name"
create_table "people", force: :cascade do |t|
t.string "name", limit: 255
t.date "birthday"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
List Superliner
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def change
create_table :cities do |t|
t.string :name

t.timestamps
t.timestamps :null => false
end

add_column :people, :city_id, :integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ class PeopleControllerTest < ActionController::TestCase
get :index
assert_template 'index'
assert_template '_list_superliner'
assert_template '_list_main'
assert_template '_sidebar'
assert_template '_sidebar_superliner'
assert_match /42/, @response.body
assert_match /Superliner Details/, @response.body
assert_match /List Superliner/, @response.body
assert_no_match /List Main/, @response.body
assert_no_match /List Superliner\s*List Superliner/m, @response.body
assert_no_match /Main Details/, @response.body
end
end

0 comments on commit 6567af3

Please sign in to comment.