Skip to content

Commit

Permalink
add basic ui and control for #12
Browse files Browse the repository at this point in the history
  • Loading branch information
wdn5e-virginia-edu committed Jul 10, 2014
1 parent 6c843f3 commit 1cf63ab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/wide_tables_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ def find_results
@search_terms += "Source table = #{r_str}"
end

if defined?(params[:search_terms_op]) && params[:search_terms_op] == 'freetext'
str = str + ' and ( '
str = str + params[:search_terms]
str = str + ' )'
end

conditions = [str] + values

@wide_tables = WideTable.find(:all, :conditions => conditions)
Expand Down
17 changes: 17 additions & 0 deletions app/views/wide_tables/search_tables.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,23 @@
</td>
</tr>
<% end %>
<tr>
<td>Search&nbsp;Terms</td>
<td colspan="2" style="text-align:right;">
<select name="search_terms_op" onchange="$('.search_terms_extra').css('display', (0 == this.value.indexOf('freetext')) ? 'table-row' : 'none');">

<option value="no_freetext" selected="true">include only the terms above</option>
<optgroup label="advanced">
<option value="freetext">include also your free-text terms here:</option>
</optgroup>
</select>
</td>
</tr>
<tr class="search_terms_extra extra" style="display:none">
<td colspan="3" style="white-space: nowrap;">
<textarea name="search_terms" cols="50" rows="5"></textarea>
</td>
</tr>
</table>
<!--
<p class="note-text">For each of the following options, uncheck all to select all records.
Expand Down

0 comments on commit 1cf63ab

Please sign in to comment.