Message ID | 20190114132510.20593-1-alialnu@mellanox.com |
---|---|
State | Changes Requested |
Headers | show |
Series | templates: Override page title based on set filters | expand |
On 15/1/19 12:25 am, Ali Alnubani wrote: > Set the document's title based on the applied filters, > giving priority to the series' title, and then to the > submitter's name if the series filter wasn't applied. > > Suggested-by: Thomas Monjalon <thomas@monjalon.net> > Signed-off-by: Ali Alnubani <alialnu@mellanox.com> I see what you're trying to do here. I don't think this should be done in JavaScript, until we fulfil our grand dreams of rewriting the entire web frontend as something fancier than what it is, this should be rendered in the template server-side. > --- > patchwork/templates/patchwork/partials/filters.html | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/patchwork/templates/patchwork/partials/filters.html b/patchwork/templates/patchwork/partials/filters.html > index 41ed2c2..9566cc0 100644 > --- a/patchwork/templates/patchwork/partials/filters.html > +++ b/patchwork/templates/patchwork/partials/filters.html > @@ -115,6 +115,11 @@ $(document).ready(function() { > } > }); > }); > +{% if "series" in filters.applied_filters %} > +document.title = "{{ filters.applied_filters.series.condition }}"; > +{% elif "submitter" in filters.applied_filters %} > +document.title = "{{ filters.applied_filters.submitter.condition }}"; > +{% endif %} > </script> > > <div class="filters"> >
diff --git a/patchwork/templates/patchwork/partials/filters.html b/patchwork/templates/patchwork/partials/filters.html index 41ed2c2..9566cc0 100644 --- a/patchwork/templates/patchwork/partials/filters.html +++ b/patchwork/templates/patchwork/partials/filters.html @@ -115,6 +115,11 @@ $(document).ready(function() { } }); }); +{% if "series" in filters.applied_filters %} +document.title = "{{ filters.applied_filters.series.condition }}"; +{% elif "submitter" in filters.applied_filters %} +document.title = "{{ filters.applied_filters.submitter.condition }}"; +{% endif %} </script> <div class="filters">
Set the document's title based on the applied filters, giving priority to the series' title, and then to the submitter's name if the series filter wasn't applied. Suggested-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Ali Alnubani <alialnu@mellanox.com> --- patchwork/templates/patchwork/partials/filters.html | 5 +++++ 1 file changed, 5 insertions(+)