catch up with dev

This commit is contained in:
Taylor Griffin
2014-09-20 23:01:35 +10:00
4 changed files with 11 additions and 2 deletions

View File

@@ -45,5 +45,5 @@ submit the change with your pull request.
- Marlena Compton / [Marlena](https://github.com/marlena)
- Elizabeth A. Kari / [catfriend](https://github.com/catfriend)
- Cheri Allen / [cherimarie](https://github.com/cherimarie)
- Shiho Takagi / [oshiho3](https:://github.com/oshiho3)
- Maki Sugita / [macckii](https:://github.com/macckii)
- Shiho Takagi / [oshiho3](https://github.com/oshiho3)

View File

@@ -15,6 +15,7 @@
= form_tag(new_photo_path, :method => :get, :class => 'form-inline') do
= label_tag :set, "Choose a photo set:", :class => 'control-label'
= select_tag :set, options_for_select(@sets, @current_set), :class => 'input-large'
= hidden_field_tag :planting_id, @planting_id
= submit_tag "Search", :class => 'btn btn-primary'
%div.pagination

View File

@@ -7,7 +7,7 @@ module Haml::Filters
def render(text)
# turn [tomato](crop) into [tomato](http://growstuff.org/crops/tomato)
expanded = text.gsub(/\[(.*?)\]\(crop\)/) do |m|
expanded = text.gsub(/\[([^\[\]]+?)\]\(crop\)/) do |m|
crop_str = $1
# find crop case-insensitively
crop = Crop.where('lower(name) = ?', crop_str.downcase).first

View File

@@ -52,4 +52,12 @@ describe 'Haml::Filters::Growstuff_Markdown' do
rendered.should match /#{output_link(@crop, 'ToMaTo')}/
end
it "fixes PT bug #78615258 (Markdown rendering bug with URLs and crops in same text)" do
tomato = FactoryGirl.create(:tomato)
string = "[test](http://example.com) [tomato](crop)"
rendered = Haml::Filters::GrowstuffMarkdown.render(string)
rendered.should match /#{output_link(tomato)}/
rendered.should match "<a href=\"http://example.com\">test</a>"
end
end