Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permet d'installer un plugin de recherche #2387

Merged
merged 2 commits into from Mar 31, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -104,6 +104,9 @@

{# RSS links #}
<link rel="alternate" type="application/rss+xml" title="Forum" href="{% url "post-feed-rss" %}">

{# OpenSearch plugin autodiscovery #}
<link rel="search" type="application/opensearchdescription+xml" title="{{ app.site.litteral_name }}" href="{% url "zds.search.views.opensearch" %}">

This comment has been minimized.

Copy link
@DevHugo

DevHugo Mar 7, 2015

Contributor

L'attribut title me semble pas pertinent

This comment has been minimized.

Copy link
@Fulbert

Fulbert Mar 21, 2015

Author Contributor

Sur Firefox, lorsque l'on clique pour ajouter le plugin de recherche, il y a la phrase : Ajouter "Zeste de Savoir". Ce qui me semble correct ? Si je mets "Rechercher sur Zeste de Savoir", ça rend Ajouter "Rechercher sur Zeste de Savoir".

This comment has been minimized.

Copy link
@DevHugo

DevHugo Mar 27, 2015

Contributor

C'est bon au début, y'avait rien.

</head>
<body class="{% block body_class %}{% endblock %}"
itemscope
@@ -485,11 +488,11 @@
</ol>
</div>
<div class="search header-right" id="search">
<form action="/rechercher">
<input type="text" name="q" placeholder="Rechercher">
<button type="submit" class="ico-after search-submit" title="Lancer la recherche">{% trans "OK" %}</button>
<form action="{% url "haystack_search" %}">
<input type="text" name="q" placeholder="{% trans "Rechercher" %}">
<button type="submit" class="ico-after search-submit" title="{% trans "Lancer la recherche" %}">{% trans "OK" %}</button>
</form>
<a href="/rechercher" title="Recherche avancée" class="search-more"></a>
<a href="{% url "haystack_search" %}" title="{% trans "Recherche avancée" %}" class="search-more"></a>
</div>
</div>
</div>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

This comment has been minimized.

Copy link
@DevHugo

DevHugo Mar 7, 2015

Contributor

Ça serait cool, d'ajouter les attributs suivants:

   <AdultContent>false</AdultContent>
    <Language>fr-fr</Language>
    <Contact>http://zestedesavoir.com/pages/contact/</Contact>
``

Et au moins une balise pour l'image favicon 
<Image height="57" width="57" type="image/png">http://zestedesavoir.com/static/images/favicon.cbe63cc70f5c.png</Image>

``

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>{{ site_name }}</ShortName>
<Description>Rechercher sur {{ site_name}}</Description>
<InputEncoding>UTF-8</InputEncoding>
<Url type="text/html" method="GET" template="{{ search_url }}">
<Param name="q" value="{searchTerms}"/>
</Url>
<Url type="application/opensearchdescription+xml" rel="self" template="{% url "zds.search.views.opensearch" %}" />
</OpenSearchDescription>
@@ -8,9 +8,12 @@
from zds.search.forms import CustomSearchForm

urlpatterns = patterns('haystack.views',
url(r'^$', search_view_factory(
view_class=CustomSearchView,
template='search/search.html',
form_class=CustomSearchForm
), name='haystack_search'),
url(r'^$', search_view_factory(
view_class=CustomSearchView,
template='search/search.html',
form_class=CustomSearchForm
), name='haystack_search'))

urlpatterns += patterns('',

This comment has been minimized.

Copy link
@DevHugo

DevHugo Mar 7, 2015

Contributor

Tu peux directement écrire quelque chose comme :

urlpatterns = patterns(
                        url(r'^$', search_view_factory(
                            view_class=CustomSearchView,
                            template='search/search.html',
                            form_class=CustomSearchForm
                        ), name='haystack_search'),

                        url(r'^opensearch.xml', 'zds.search.views.opensearch')
)

This comment has been minimized.

Copy link
@Fulbert

Fulbert Mar 21, 2015

Author Contributor

Ça ne fonctionne pas comme ça (tu as enlevé le premier paramètre haystack.views).

url(r'^opensearch.xml', 'zds.search.views.opensearch')
)
@@ -1,9 +1,11 @@
# coding: utf-8

from django.shortcuts import render
from django.core.urlresolvers import reverse

from haystack.views import SearchView

from zds import settings
from zds.search.constants import MODEL_NAMES
from zds.utils.paginator import paginator_range

@@ -31,3 +33,13 @@ def create_response(self):

context.update(self.extra_context())
return render(self.request, self.template, context)


def opensearch(request):
"""Generate OpenSearch Description file"""

return render(request, 'search/opensearch.xml', {
'site_name': settings.ZDS_APP['site']['litteral_name'],
'site_image_16': '',

This comment has been minimized.

Copy link
@DevHugo

DevHugo Mar 7, 2015

Contributor

Tu utilise cet attribut ? sinon, il sert a quoi ?

'search_url': settings.ZDS_APP['site']['url'] + reverse('haystack_search')

This comment has been minimized.

Copy link
@Fulbert

Fulbert Mar 3, 2015

Author Contributor

Je suis pas sûr concernant la méthode pour récupérer l'URL. Vous en pensez quoi ?

This comment has been minimized.

Copy link
@DevHugo

DevHugo Mar 7, 2015

Contributor

Ça m'a l'air ok (à tester).

}, content_type='text/xml')
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.