Skip to content

Commit

Permalink
adds help links
Browse files Browse the repository at this point in the history
  • Loading branch information
actlikewill committed Aug 10, 2023
1 parent 625844c commit 3aabf3f
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 18 deletions.
1 change: 1 addition & 0 deletions liiweb/templates/liiweb/legislation_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h1 class="my-4">{% trans 'Legislation' %}</h1>
</li>
</nav>
{% endblock %}
{% include "peachjam/_help_popover.html" with link="https://example.com" btn_text=help_button_text content=legislation_help_text %}
{% if view.variant == 'repealed' %}
<div class="alert alert-danger">{% trans 'You are viewing repealed legislation which is no longer in force.' %}</div>
{% endif %}
Expand Down
8 changes: 8 additions & 0 deletions liiweb/views/legislation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections import defaultdict

from django.shortcuts import get_object_or_404
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView

from peachjam.helpers import chunks, get_language
Expand Down Expand Up @@ -46,6 +47,13 @@ def get_context_data(self, **kwargs):

context["legislation_table"] = LegislationSerializer(qs, many=True).data

context["help_button_text"] = _("Help")
context["legislation_help_text"] = _(
"This is is a list of legislation for this jurisdiction. Click on the "
"tabs to filter according to current, repealed and subsidiary "
"legislation."
)

return context

def add_children(self, queryset):
Expand Down
23 changes: 18 additions & 5 deletions peachjam/js/components/FindDocuments/AdvancedSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,24 @@
</div>
</div>
</div>

<div class="text-end">
<button type="submit" class="btn btn-primary">
{{ $t('Search') }}
</button>
<div class="d-flex justify-content-between">
<div>
<a
href="#https://example.com"
class="btn btn-sm btn-outline-info"
data-bs-toggle="help-popover"
:data-bs-content="$t('This is Advanced Search. Enter keywords in the fields above for a more fine grained search of documents.')"
data-bs-trigger="click"
>
<i class="bi bi-question-circle" />
Help
</a>
</div>
<div>
<button type="submit" class="btn btn-primary">
{{ $t('Search') }}
</button>
</div>
</div>
</form>
</template>
Expand Down
13 changes: 12 additions & 1 deletion peachjam/js/components/FindDocuments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@
Filters <span v-if="selectedFacetsCount">({{ selectedFacetsCount }})</span>
</button>
</form>
<div class="my-2">
<a
href="#https://example.com"
class="btn btn-sm btn-outline-info"
data-bs-toggle="help-popover"
:data-bs-content="$t( 'You can search for documents by entering a keyword or phrase in the search box. You can also use the Advanced search to search for documents by more specific criteria.' )"
data-bs-trigger="click"
>
<i class="bi bi-question-circle" />
{{ $t("Help") }}
</a>
</div>
</div>
<div
id="nav-advanced-search"
Expand Down Expand Up @@ -105,7 +117,6 @@
{{ $t("No documents match your search.") }}
</div>
</div>

<div ref="filters-results-container">
<div class="row">
<div class="col col-lg-3">
Expand Down
5 changes: 4 additions & 1 deletion peachjam/js/locale/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@
"Try searching instead": "Essayez plutôt de faire une recherche",
"What changed?": "Quels sont les changements ?",
"Year": "Année",
"Years": "Années"
"Years": "Années",
"Help": "Aide",
"You can search for documents by entering a keyword or phrase in the search box. You can also use the Advanced search to search for documents by more specific criteria.": "Vous pouvez rechercher des documents en entrant un mot-clé ou une phrase dans la zone de recherche. Vous pouvez également utiliser la recherche avancée pour rechercher des documents selon des critères plus spécifiques.",
"This is Advanced Search. Enter keywords in the fields above for a more fine grained search of documents.": "Ceci est une recherche avancée. Entrez des mots-clés dans les champs ci-dessus pour une recherche plus fine des documents.",
}
5 changes: 4 additions & 1 deletion peachjam/js/locale/sw/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@
"Try searching instead": "Jaribu kutafuta badala yake",
"What changed?": "Nini kimebadilika?",
"Year": "Mwaka",
"Years": "Miaka"
"Years": "Miaka",
"Help": "Msaada",
"You can search for documents by entering a keyword or phrase in the search box. You can also use the Advanced search to search for documents by more specific criteria.": "Unaweza kutafuta nyaraka kwa kuingiza neno au kifungu cha maneno katika sanduku la utafutaji.Unaweza pia kutumia utafutaji wa kina kutafuta nyaraka kwa vigezo zaidi maalum.",
"This is Advanced Search. Enter keywords in the fields above for a more fine grained search of documents.": "Hii ni utafutaji wa kina. Weka maneno katika uga ulio juu kwa utafutaji wa nyaraka kwa undani zaidi."
}
7 changes: 4 additions & 3 deletions peachjam/js/peachjam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ class PeachJam {
// @ts-ignore
new window.bootstrap.Popover(el, {
html: true,
content:
(el.getAttribute('data-bs-content')
+ "<div><a href='" + el.getAttribute('href') + "' target='_blank' rel='noopener noreferrer'>Learn more</a></div>"),
content: `
${el.getAttribute('data-bs-content')}
<div><a href="${el.getAttribute('href')?.split('#')[1] || '#'}" target='_blank' rel='noopener noreferrer'>Learn more</a></div>
`,
container: 'body'
});
});
Expand Down
1 change: 1 addition & 0 deletions peachjam/templates/peachjam/_citations.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load peachjam i18n %}
<div class="container">
<div class="row">
{% include 'peachjam/_help_popover.html' with link='#' btn_text=help_button_text content=citations_help_text %}
<div class="col-sm">
<h4 class="mb-3">
{% translate 'Cited documents' %} <span class="badge bg-secondary">{{ cited_documents_count }}</span>
Expand Down
7 changes: 7 additions & 0 deletions peachjam/templates/peachjam/_help_popover.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="mb-3">
<a href="#{{ link }}"
class="btn btn-sm btn-outline-info"
data-bs-toggle="help-popover"
data-bs-content="{{ content }}"
data-bs-trigger="click"><i class="bi bi-question-circle"></i> {{ btn_text }}</a>
</div>
8 changes: 1 addition & 7 deletions peachjam/templates/peachjam/_related_documents.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{% load peachjam i18n %}
<h4>{% trans "Related documents" %}</h4>
<div class="mb-3">
<a href="#help"
class="btn btn-sm btn-outline-info"
data-bs-toggle="help-popover"
data-bs-content="Other documents related to this one."
data-bs-trigger="click"><i class="bi bi-question-circle"></i> Help</a>
</div>
{% include 'peachjam/_help_popover.html' with link='https://google.com' btn_text=help_button_text content=related_documents_help_text %}
<div class="row">
{% if relationships_as_subject %}
<div class="col-md">
Expand Down
9 changes: 9 additions & 0 deletions peachjam/views/generic_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import itertools

from django.shortcuts import get_object_or_404
from django.utils.translation import gettext_lazy as _
from django.views.generic import DetailView, ListView
from lxml import html

Expand Down Expand Up @@ -183,6 +184,14 @@ def get_context_data(self, **kwargs):
+ context["documents_citing_current_doc_count"]
)
context["labels"] = doc.labels.all()
context["help_button_text"] = _("Help")
context["citations_help_text"] = _(
"This is a list citations. On the left is a list of documents that this "
"document cites. On the right are documents that cite this one."
)
context["related_documents_help_text"] = _(
"This is a list of documents that are related to this one."
)

return context

Expand Down

0 comments on commit 3aabf3f

Please sign in to comment.