Skip to content

Commit

Permalink
Refactor table search templates
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Strozzi <laps15@inf.ufpr.br>
  • Loading branch information
laps15 committed Jul 11, 2018
1 parent d2a282b commit 4e81d3f
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 166 deletions.
15 changes: 12 additions & 3 deletions templates/table/search/fields_table.twig
@@ -1,7 +1,16 @@
<table class="data"{{ search_type == 'zoom' ? ' id="tableFieldsId"' }}>
{% include 'table/search/table_header.twig' with {
'geom_column_flag': geom_column_flag
} only %}
<thead>
<tr>
{% if geom_column_flag %}
<th>{% trans 'Function' %}</th>
{% endif %}
<th>{% trans 'Column' %}</th>
<th>{% trans 'Type' %}</th>
<th>{% trans 'Collation' %}</th>
<th>{% trans 'Operator' %}</th>
<th>{% trans 'Value' %}</th>
</tr>
</thead>
<tbody>
{% if search_type == 'zoom' %}
{% include 'table/search/rows_zoom.twig' with {
Expand Down
67 changes: 0 additions & 67 deletions templates/table/search/options.twig

This file was deleted.

43 changes: 0 additions & 43 deletions templates/table/search/options_zoom.twig

This file was deleted.

25 changes: 0 additions & 25 deletions templates/table/search/search_and_replace.twig

This file was deleted.

150 changes: 134 additions & 16 deletions templates/table/search/selection_form.twig
Expand Up @@ -21,12 +21,49 @@
'keys' : keys,
'criteria_column_names': criteria_column_names,
'criteria_column_types': criteria_column_types
} only %}
{% include 'table/search/options_zoom.twig' with {
'data_label': data_label,
'column_names': column_names,
'max_plot_limit': max_plot_limit
} only %}
} only %}<table class="data">
{# Select options for data label #}
<tr>
<td>
<label for="dataLabel">
{% trans 'Use this column to label each point' %}
</label>
</td>
<td>
<select name="dataLabel" id="dataLabel" >
<option value = "">
{% trans 'None' %}
</option>
{% for i in 0..column_names|length - 1 %}
{% if data_label is defined and data_label == column_names[i]|e %}
<option value="{{ column_names[i] }}" selected="selected">
{{ column_names[i] }}
</option>
{% else %}
<option value="{{ column_names[i] }}" >
{{ column_names[i] }}
</option>
{% endif %}
{% endfor %}
</select>
</td>
</tr>
{# Inputbox for changing default maximum rows to plot #}
<tr>
<td>
<label for="maxRowPlotLimit">
{% trans 'Maximum rows to plot' %}
</label>
</td>
<td>
<input type="number"
name="maxPlotLimit"
id="maxRowPlotLimit"
required="required"
value="{{ max_plot_limit }}" />
</td>
</tr>
</table>
</fieldset>
</fieldset>
{% elseif search_type == 'normal' %}
Expand Down Expand Up @@ -57,10 +94,73 @@
<div id="gis_editor"></div>
<div id="popup_background"></div>
</fieldset>
{% include 'table/search/options.twig' with {
'column_names': column_names,
'max_rows': max_rows
} only %}
{{ Util_getDivForSliderEffect('searchoptions', 'Options'|trans) }}

{# Displays columns select list for selecting distinct columns in the search #}
<fieldset id="fieldset_select_fields">
<legend>
{% trans 'Select columns (at least one):' %}
</legend>
<select name="columnsToDisplay[]"
size="{{ min(column_names|length, 10) }}"
multiple="multiple">
{% for each_field in column_names %}
<option value="{{ each_field }}"
selected="selected">
{{ each_field }}
</option>
{% endfor %}
</select>
<input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct" />
<label for="oDistinct">DISTINCT</label>
</fieldset>

{# Displays input box for custom 'Where' clause to be used in the search #}
<fieldset id="fieldset_search_conditions">
<legend>
<em>{% trans 'Or' %}</em>
{% trans 'Add search conditions (body of the "where" clause):' %}
</legend>
{{ Util_showMySQLDocu('Functions') }}
<input type="text" name="customWhereClause" class="textfield" size="64" />
</fieldset>

{# Displays option of changing default number of rows displayed per page #}
<fieldset id="fieldset_limit_rows">
<legend>{% trans 'Number of rows per page' %}</legend>
<input type="number"
name="session_max_rows"
required="required"
min="1"
value="{{ max_rows }}"
class="textfield" />
</fieldset>

{# Displays option for ordering search results by a column value (Asc or Desc) #}
<fieldset id="fieldset_display_order">
<legend>{% trans 'Display order:' %}</legend>
<select name="orderByColumn"><option value="--nil--"></option>
{% for each_field in column_names %}
<option value="{{ each_field }}">
{{ each_field }}
</option>
{% endfor %}
</select>

{{ Util_getRadioFields(
'order',
{
'ASC': 'Ascending'|trans,
'DESC': 'Descending'|trans
},
'ASC',
false,
true,
'formelement'
) }}

</fieldset>
<div class="clearfloat"></div>
</fieldset>
{% elseif search_type == 'replace' %}
{% include 'table/search/form_tag.twig' with {
Expand All @@ -74,12 +174,30 @@
<fieldset id="fieldset_find">
<legend>
{% trans 'Find and replace' %}
</legend>
{% include 'table/search/search_and_replace.twig' with {
'column_names': column_names,
'column_types': column_types,
'sql_types': sql_types,
'types': types
</legend>{% trans 'Find:' %}
<input type="text" value="" name="find" required />
{% trans 'Replace with:' %}
<input type="text" value="" name="replaceWith" />

{% trans 'Column:' %}
<select name="columnIndex">
{% for i in 0..column_names|length - 1 %}
{% set type = types[column_names[i]] %}

{% if sql_types.getTypeClass(type) == 'CHAR' %}
<option value="{{ i }}">
{{- column_names[i] -}}
</option>
{% endif %}
{% endfor %}
</select>

{% include 'checkbox.twig' with {
'html_field_id': 'useRegex',
'html_field_name': 'useRegex',
'label': 'Use regular expression'|trans,
'checked': false,
'onclick': false
} only %}
</fieldset>
</fieldset>
Expand Down
12 changes: 0 additions & 12 deletions templates/table/search/table_header.twig

This file was deleted.

0 comments on commit 4e81d3f

Please sign in to comment.