Commit fb36355f2ff6d4c5465158608c60e0d33cb552ee
1 parent
01be3204
Exists in
master
and in
4 other branches
Different search placeholder depdends on area
Showing
2 changed files
with
10 additions
and
1 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -226,4 +226,13 @@ module ApplicationHelper | @@ -226,4 +226,13 @@ module ApplicationHelper | ||
| 226 | content_tag :i, nil, class: 'icon-lock cgreen' | 226 | content_tag :i, nil, class: 'icon-lock cgreen' |
| 227 | end | 227 | end |
| 228 | 228 | ||
| 229 | + def search_placeholder | ||
| 230 | + if @project && @project.persisted? | ||
| 231 | + "Search in this project" | ||
| 232 | + elsif @group && @group.persisted? | ||
| 233 | + "Search in this group" | ||
| 234 | + else | ||
| 235 | + "Search" | ||
| 236 | + end | ||
| 237 | + end | ||
| 229 | end | 238 | end |
app/views/layouts/_search.html.haml
| 1 | .search | 1 | .search |
| 2 | = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| | 2 | = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| |
| 3 | - = text_field_tag "search", nil, placeholder: "Search", class: "search-input" | 3 | + = text_field_tag "search", nil, placeholder: search_placeholder, class: "search-input" |
| 4 | = hidden_field_tag :group_id, @group.try(:id) | 4 | = hidden_field_tag :group_id, @group.try(:id) |
| 5 | - if @project && @project.persisted? | 5 | - if @project && @project.persisted? |
| 6 | = hidden_field_tag :project_id, @project.id | 6 | = hidden_field_tag :project_id, @project.id |