Project

General

Profile

Feature #4138 » 0002-Make-time-entries-searchable-by-their-custom-field-v.patch

Patch against trunk @ r21200. - Mischa The Evil, 2021-08-26 10:33

View differences:

app/views/custom_fields/_form.html.erb
47 47
      <p><%= f.check_box :is_filter %></p>
48 48
    <% end %>
49 49

  
50
    <% if %w(IssueCustomField ProjectCustomField).include?(@custom_field.class.name) && @custom_field.format.searchable_supported %>
50
    <% if %w(IssueCustomField ProjectCustomField TimeEntryCustomField).include?(@custom_field.class.name) && @custom_field.format.searchable_supported %>
51 51
      <p><%= f.check_box :searchable %></p>
52 52
    <% end %>
53 53
    <%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %>
test/fixtures/custom_fields.yml
146 146
  - Other value
147 147
  field_format: list
148 148
  position: 1
149
custom_fields_012: 
150
  name: Searchable time entry field
151
  regexp: ""
152
  is_for_all: false
153
  is_filter: false
154
  type: TimeEntryCustomField
155
  possible_values: ""
156
  id: 12
157
  is_required: false
158
  field_format: string
159
  searchable: true
160
  default_value: ""
161
  editable: true
162
  position: 2
test/fixtures/custom_values.yml
101 101
  customized_id: 1
102 102
  id: 17
103 103
  value: '2009-12-01'
104
custom_values_018: 
105
  customized_type: TimeEntry
106
  custom_field_id: 12
107
  customized_id: 2
108
  id: 18
109
  value: "stringfortimeentry custom field search"
test/functional/search_controller_test.rb
201 201
    end
202 202
  end
203 203

  
204
  def test_search_time_entries_searchable_custom_fields_on_project
205
    get :index, :params => {:id => 1, :q => "stringfortimeentry", :time_entries => 1}
206
    assert_response :success
207

  
208
    assert_select '#search-results' do
209
      assert_select 'dt.time-entry', 1
210
      assert_select 'dt.time-entry span.project', 0
211
      assert_select 'dt.time-entry a', :text => /150.00 hours \(Bug #1 \(New\): Cannot print recipes\)/
212
    end
213
  end
214

  
204 215
  def test_search_all_projects_with_scope_param
205 216
    get :index, :params => {:q => 'issue', :scope => 'all'}
206 217
    assert_response :success
(4-4/4)