Skip to content

Commit

Permalink
Merge pull request #11 from jonathanpberger/master
Browse files Browse the repository at this point in the history
Clean up (and DRY up) some markdown.
  • Loading branch information
se3000 committed Aug 26, 2012
2 parents 221f2d1 + 44850e3 commit 5f2620f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
8 changes: 8 additions & 0 deletions app/helpers/application_helper.rb
Expand Up @@ -14,6 +14,8 @@ def dynamic_new_item_path(opts={})
end

def standup_closing
return "STRETCH! It's Floor Friday!" if Date.today.wday == 5

index = rand(STANDUP_CLOSINGS.length)
STANDUP_CLOSINGS[index]
end
Expand All @@ -29,4 +31,10 @@ def show_or_edit_post_path(post)
edit_post_path(post)
end
end

def markdown_placeholder
"A description will appear in the email (and the blog if public), but not be visible during standup. Wrap code in backticks (\"`\") and wrap URLs in angle brackets (\"<\" and \">\") for Markdown goodness."

end

end
4 changes: 2 additions & 2 deletions app/views/items/_as_markdown.html.erb
Expand Up @@ -4,9 +4,9 @@
<% items[kind].each do |item| %>
<% if item.date.present? %>
* <%= Date::DAYNAMES[item.date.wday] %>: <%= item.title %>
### <%= Date::DAYNAMES[item.date.wday] %>: <%= item.title %>
<% else %>
* <%= item.title.html_safe %>
### <%= item.title.html_safe %>
<% end %>
<% if item.description.present? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/items/new.html.erb
Expand Up @@ -49,7 +49,7 @@
<div class='control-group'>
<%= f.label :description, class: 'control-label' %><br />
<div class='controls'>
<%= f.text_area :description, placeholder: "A description will appear in the email (and the blog if public), but not be visible during standup. Markdown available." %>
<%= f.text_area :description, placeholder: markdown_placeholder %>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/items/new_event.html.erb
Expand Up @@ -55,7 +55,7 @@
<div class='control-group'>
<%= f.label :description, class: 'control-label' %><br />
<div class='controls'>
<%= f.text_area :description, placeholder: "A description will appear in the email (and the blog if public), but not be visible during standup. Markdown available." %>
<%= f.text_area :description, placeholder: markdown_placeholder %>
</div>
</div>

Expand Down
6 changes: 6 additions & 0 deletions spec/helpers/application_helper_spec.rb
Expand Up @@ -3,9 +3,15 @@
describe ApplicationHelper do
describe "#close_standup" do
it "picks a closing" do
Date.stub_chain(:today, :wday).and_return(4)
helper.should_receive(:rand).and_return(0)
helper.standup_closing.should == "STRETCH!"
end

it "should remind us when its Floor Friday" do
Date.stub_chain(:today, :wday).and_return(5)
helper.standup_closing.should == "STRETCH! It's Floor Friday!"
end
end

describe "#pending_post_count" do
Expand Down

0 comments on commit 5f2620f

Please sign in to comment.