Different search placeholder depdends on area

This commit is contained in:
Dmitriy Zaporozhets 2013-08-10 19:12:25 +03:00
parent 01be32043a
commit fb36355f2f
2 changed files with 10 additions and 1 deletions

View File

@ -226,4 +226,13 @@ module ApplicationHelper
content_tag :i, nil, class: 'icon-lock cgreen'
end
def search_placeholder
if @project && @project.persisted?
"Search in this project"
elsif @group && @group.persisted?
"Search in this group"
else
"Search"
end
end
end

View File

@ -1,6 +1,6 @@
.search
= form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f|
= text_field_tag "search", nil, placeholder: "Search", class: "search-input"
= text_field_tag "search", nil, placeholder: search_placeholder, class: "search-input"
= hidden_field_tag :group_id, @group.try(:id)
- if @project && @project.persisted?
= hidden_field_tag :project_id, @project.id