Skip to content

Commit a43ccee

Browse files
committed
Cleanup the search code in preparation for removal of the shim-layer,
use a static button and don't send extraneous GET parameters - Legacy-Id: 5464
1 parent 833437a commit a43ccee

10 files changed

Lines changed: 113 additions & 195 deletions

File tree

ietf/templates/idrfc/date_column.html

Lines changed: 0 additions & 37 deletions
This file was deleted.

ietf/templates/idrfc/main.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ <h1>Search Internet-Drafts and RFCs</h1>
7777
{% endif %}
7878
</div>
7979
{% endblock content %}
80-
{% block scripts %}
81-
YAHOO.util.Event.onContentReady("search_submit_button", function () {
82-
var oButton = new YAHOO.widget.Button("search_submit_button", {});
83-
});
84-
{% endblock scripts %}
8580

8681
{% block js %}
8782
<script type="text/javascript" src="/js/doc-search.js"></script>

ietf/templates/idrfc/search_form.html

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,54 +32,46 @@
3232
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3333
{% endcomment %}
3434

35-
<form name="search_form" id="search_form" class="search_form" action="/doc/search/" method="get" {# onsubmit="submitSearch();return false;" #}>
35+
<form id="search_form" class="search_form" action="/doc/search/" method="get">
3636

3737
<div class="search_field">
3838
<label>Name/number/title:</label> {{ form.name }}
3939
</div>
4040

4141
<div class="search_field">
42-
<label>Types:</label>
43-
<table id="search_types">
44-
<tr><td>{{ form.rfcs }} RFCs</td></tr>
45-
<tr><td>{{ form.activeDrafts }} Internet-Drafts (active)</td></tr>
46-
<tr><td>{{ form.oldDrafts }} Internet-Drafts (expired/replaced/withdrawn)</td></tr>
47-
</table>
42+
<label>Types:</label>
43+
<table id="search_types">
44+
<tr><td><label>{{ form.rfcs }} RFCs</label></td></tr>
45+
<tr><td><label>{{ form.activeDrafts }} Internet-Drafts (active)</label></td></tr>
46+
<tr><td><label>{{ form.oldDrafts }} Internet-Drafts (expired/replaced/withdrawn)</label></td></tr>
47+
</table>
4848
</div>
4949

50-
<span class="toggle_advanced"><b><img src="/images/{% if meta.advanced %}minus{% else %}plus{% endif %}.png" alt="" id="search_advanced-img" /> Advanced</b></span>
50+
<b class="toggle_advanced"><img src="/images/{% if meta.advanced %}minus{% else %}plus{% endif %}.png" alt="" /> Advanced</b>
5151

52-
<div id="search_advanced" style="{% if not meta.advanced %}display:none;{%endif%}margin-top:1em;">
52+
<div id="search_advanced" style="{% if not meta.advanced %}display:none;{%endif%}">
5353
Additional search criteria:
5454

5555
<div class="search_field">
56-
<label><input type="radio" class="radio" name="by" value="author" {% ifequal meta.by "author" %}checked="checked"{% endifequal %}/> Author (last name):</label> {{ form.author }}
56+
<label><input type="radio" class="radio" name="by" value="author" {% if meta.by == "author" %}checked="checked"{% endif %}/> Author (last name):</label> {{ form.author }}
5757
</div>
5858
<div class="search_field">
59-
<label><input type="radio" class="radio" name="by" value="group" {% ifequal meta.by "group" %}checked="checked"{% endifequal %}/> WG:</label> {{ form.group }}
59+
<label><input type="radio" class="radio" name="by" value="group" {% if meta.by == "group" %}checked="checked"{% endif %}/> WG:</label> {{ form.group }}
6060
</div>
6161
<div class="search_field">
62-
<label><input type="radio" class="radio" name="by" value="area" {% ifequal meta.by "area" %}checked="checked"{% endifequal %}/> Area:</label> {{ form.area }}
62+
<label><input type="radio" class="radio" name="by" value="area" {% if meta.by == "area" %}checked="checked"{% endif %}/> Area:</label> {{ form.area }}
6363
</div>
6464
<div class="search_field">
65-
<label><input type="radio" class="radio" name="by" value="ad" {% ifequal meta.by "ad" %}checked="checked"{% endifequal %}/> Responsible AD:</label> {{ form.ad }}
65+
<label><input type="radio" class="radio" name="by" value="ad" {% if meta.by == "ad" %}checked="checked"{% endif %}/> Responsible AD:</label> {{ form.ad }}
6666
</div>
6767
<div class="search_field">
68-
<label><input type="radio" class="radio" name="by" value="state" {% ifequal meta.by "state" %}checked="checked"{% endifequal %}/> IESG State:</label> {{ form.state }} :: {{ form.subState }}
68+
<label><input type="radio" class="radio" name="by" value="state" {% if meta.by == "state" %}checked="checked"{% endif %}/> IESG State:</label> {{ form.state }} :: {{ form.subState }}
6969
</div>
70-
{% comment %}
71-
<div class="search_field" style="text-decoration:line-through;color:#808080;">
72-
<label>Ballot position:</label> {{ form.positionAd }} has position {{ form.positionValue }}
73-
</div>
74-
{% endcomment %}
7570

7671
</div><!-- end of advanced -->
7772

78-
<div style="padding-top:0.5em;">
79-
{# <input type="hidden" name="ajax" value="" /> #}
80-
<span class="first-child">
81-
<button type="submit" name="search_submit" id="id_search_submit">Search</button>
82-
</span>
73+
<div class="submit">
74+
<input type="submit" class="button" value="Search"/>
8375
</div>
8476

8577
</form>

ietf/templates/idrfc/search_main.html

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{% block content %}
3939
<h1>Internet-Drafts and RFCs</h1>
4040

41-
<div class="ietf-box search_form_box">
41+
<div class="ietf-box search-form-box">
4242
{% include "idrfc/search_form.html" %}
4343
</div>
4444

@@ -48,32 +48,6 @@ <h1>Internet-Drafts and RFCs</h1>
4848
{% endif %}
4949
</div>
5050
{% endblock content %}
51-
{% block scripts %}
52-
YAHOO.util.Event.onContentReady("search_submit_button", function () {
53-
var oButton = new YAHOO.widget.Button("search_submit_button", {});
54-
});
55-
{% if meta.searching %}
56-
(function ($) {
57-
$(document).ready(function () {
58-
$('.addtolist a').click(function() {
59-
var trigger = $(this);
60-
$.ajax({
61-
url: trigger.attr('href'),
62-
type: 'GET',
63-
cache: false,
64-
dataType: 'json',
65-
success: function(response){
66-
if (response.success) {
67-
trigger.replaceWith('added');
68-
}
69-
}
70-
});
71-
return false;
72-
});
73-
});
74-
})(jQuery);
75-
{% endif %}
76-
{% endblock scripts %}
7751

7852
{% block js %}
7953
<script type="text/javascript" src="/js/doc-search.js"></script>

ietf/templates/idrfc/search_result_row.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{% load ietf_filters %}
3636
{% load ballot_icon %}
3737
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
38-
{% if user.is_authenticated and show_add_to_list %}
38+
{% if show_add_to_list and user.is_authenticated %}
3939
<td class="addtolist">
4040
{% if doc.id %}
4141
<a href="{% url community_add_document doc.id.draft_name %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a>
@@ -51,7 +51,12 @@
5151
{% endif %}
5252
</td>
5353
<td class="title">{{ doc.title }}</td>
54-
{% include "idrfc/date_column.html" %}
54+
55+
<td class="date">{% if not doc.rfc %}{{ doc.publication_date }}{% else %}{{ doc.publication_date|date:"Y-m" }}{% endif %}
56+
{% if doc.publication_date|timesince_days|new_enough:request %}<br/><span class="ietf-small ietf-highlight-y">{% if not doc.rfc%}<a href="http:{{rfcdiff_prefix}}?url2={{doc.id.draft_name_and_revision}}">new</a>{%else%}new{%endif%}</span>{%endif%}
57+
{% if doc.id and doc.id.expected_expiration_date and doc.id.expected_expiration_date|timesince_days|expires_soon:request %}<br/><span class="ietf-small ietf-highlight-y">expires soon</span>{%endif%}
58+
</td>
59+
5560
{% include "idrfc/status_columns.html" %}
5661
{% include "idrfc/ipr_column.html" %}
5762
{# <td class="ad">{% if doc.ad_name %}{{ doc.ad_name }}{% else %}&nbsp;{% endif %}</td> #}

ietf/templates/idrfc/search_results.html

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,27 @@
3838
{% if not docs %}
3939
<p><b>No documents match your query.</b></p>
4040
{% else %}
41-
{% regroup docs by view_sort_group as grouped_docs %}
41+
4242
<table class="ietf-table ietf-doctable">
43-
<tr>{% if user.is_authenticated %}<th></th>{% endif %}
44-
{% for hdr in meta.hdrs %}
45-
{% include "idrfc/table_header.html" %}
46-
{% endfor %}
43+
<tr>
44+
{% if user.is_authenticated %}<th></th>{% endif %}
45+
46+
{% for hdr in meta.hdrs %}
47+
<th class="{{ hdr.htype }}" {% if hdr.colspan %}colspan="{{ hdr.colspan }}"{% endif %}>
48+
{{ hdr.htitle }}
49+
50+
<a href="{{ meta.rqps }}&sortBy={{hdr.htype}}"><img src="/images/sort-header-{% if hdr.selected %}filled{% else %}clear{% endif %}.png"/></a>
51+
</th>
52+
{% endfor %}
4753
</tr>
4854
<!-- <tr><th></th><th class="doc">Document</th><th class="title">Title</th><th class="date">Date</th><th class="status" colspan="2">Status</th><th class="ad">Area Director</th></tr> -->
49-
{% for doc_group in grouped_docs %}
50-
<tr class="header"><td colspan="7">{{doc_group.grouper}}s</td></tr>
55+
{% regroup docs by view_sort_group as grouped_docs %}
56+
{% for doc_group in grouped_docs %}
57+
<tr class="header"><td colspan="7">{{ doc_group.grouper }}s</td></tr>
58+
5159
{% with 1 as show_add_to_list %}
5260
{% for doc in doc_group.list %}
53-
{% include "idrfc/search_result_row.html" %}
61+
{% include "idrfc/search_result_row.html" %}
5462
{% endfor %}
5563
{% endwith %}
5664

ietf/templates/idrfc/table_header.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

ietf/templates/ipr/search.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<h1>IPR Search</h1>
1212
<h2>Document Search</h2>
13-
<div class="ietf-box search_form_box">
13+
<div class="ietf-box search-form-box">
1414
<form method="get">
1515
<input type="hidden" name="option" value="document_search">
1616

static/css/base2.css

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,16 @@ body { margin: 0; }
8282
.ietf-stream .entry-title .entry-date { float: right; }
8383
.ietf-stream .entry-comment { background: #eeeeee; margin: 1em 0px; padding: 1em; }
8484

85-
.search_form_box {width: 99.5%; margin-top:8px; padding:4px; margin-bottom:1em; padding-left:8px;}
85+
.search-form-box { width: 99.5%; margin-top:8px; padding:4px; margin-bottom:1em; padding-left:8px; }
8686
form#search_form { padding-top: 4px; padding-bottom: 4px; }
87+
#search_form .submit { padding-top: 0.5em; }
88+
#search_form .submit .button { padding: 0.2em 0.5em; border: 1px solid #999; }
8789
#search_form input { padding: 0; padding-left: 2px; border: 1px solid #89d;}
88-
#search_form input.radio { padding-left: 0; border: 0; }
90+
#search_form input.radio { padding-left: 0; border: 0; }
8991
#search_form select { border: 1px solid #89d; }
9092
#search_form div.search_field { margin-top:2px; clear:both;}
91-
#search_form label { width: 170px; float: left; }
93+
#search_form .search_field > label { width: 170px; float: left; }
94+
#search_form #search_advanced { margin-top: 1em; }
9295
/* checkboxes for document types */
9396
#search_form table#search_types { border-collapse:collapse;}
9497
#search_form #search_types td { padding:0; }
@@ -106,12 +109,13 @@ table.ietf-table { border-collapse:collapse; border:1px solid #7f7f7f; }
106109
.ietf-table tr.evenrow { background-color: #EDF5FF; }
107110
.ietf-table tr.oddrow { background-color: white; }
108111
.ietf-table td { border-right: 1px solid #cbcbcb; padding:3px 6px; vertical-align: top; }
109-
.ietf-table th { color:white; background: #2647A0; text-align:left; padding:3px 6px; border-right: 1px solid #7f7f7f; }
112+
.ietf-table th { color: #fff; background: #2647A0; text-align: left; padding:3px 6px; border-right: 1px solid #7f7f7f; }
110113

111114
.ietf-doctable tr.header { border-top: 1px solid #7f7f7f; border-bottom: 1px solid #7f7f7f; border-left: 1px solid white; border-right:2px solid white;}
112115
.ietf-doctable tr.header td {padding: 6px 6px; font-weight: bold; }
113116
.ietf-doctable table { max-width: 1200px; }
114-
.ietf-doctable th { cursor: pointer }
117+
.ietf-doctable th { cursor: pointer; white-space: nowrap; }
118+
.ietf-doctable th img { border-style: none; vertical-align: top; }
115119
.ietf-doctable th.doc, .ietf-doctable td.doc { min-width:20em; max-width: 35em; }
116120
.ietf-doctable th.title, .ietf-doctable td.title { min-width: 20em; max-width: 35em; }
117121
.ietf-doctable th.date, .ietf-doctable td.date { white-space:nowrap; min-width: 6em;}
@@ -206,12 +210,13 @@ table.milestones .doc { display: block; padding-left: 1em; }
206210

207211
.stream-state .milestone { display: inline-block; font-size: smaller; background-color: #d5dde6; padding: 0 0.2em; margin-left: 0.3em; }
208212

209-
.button {
213+
.button, .button:hover:disabled {
210214
display: inline-block; padding: 4px 12px; margin-right: 0.3em;
211215
color: #222; font-weight: normal; text-align: center; text-decoration: none; outline: none; cursor: pointer;
212-
background: #eee; background: linear-gradient(#fff, #ddd); background: -webkit-linear-gradient(#fff, #ddd); background: -moz-linear-gradient(#fff, #ddd);
216+
background: #eee; background: linear-gradient(#fff, #e0e0e0); background: -webkit-linear-gradient(#fff, #e0e0e0); background: -moz-linear-gradient(#fff, #e0e0e0);
213217
border: 1px solid #666; border-radius: 3px;
214218
transition-duration: 0.2s;
215219
}
216220
.button:hover { color: #111; background: #ddd; background: linear-gradient(#eee, #ccc); background: -webkit-linear-gradient(#eee, #ccc); background: -moz-linear-gradient(#eee, #ccc); }
217221
.button:active { color: #000; background: #ccc; }
222+
.button:disabled, .button:hover:disabled { color: #999; cursor: default; }

0 commit comments

Comments
 (0)