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

Revise index pages source args to make it easier to use #688

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions ppa/archive/management/commands/index_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,27 @@ def add_arguments(self, parser):
parser.add_argument(
"source_ids", nargs="*", help="List of specific items to index (optional)"
)
parser.add_argument(
"--source", help="Limit to one source", choices=Command.sources.keys()
)
parser.add_argument(
"--expedite",
help="Only index works with page count mismatch between Solr and database",
action="store_true",
default=False,
)

# add source names as arguments to take advantage of
# argparse built in prefixing; lower case args but display proper case
source_arg_group = parser.add_argument_group(
"Source", "Limit indexing to all works from a specific source"
)
for source_name in Command.sources.keys():
source_arg_group.add_argument(
f"--{source_name.lower()}",
help=source_name,
dest="source",
action="store_const",
const=source_name,
)

def handle(self, *args, **kwargs):
self.verbosity = kwargs.get("verbosity", self.v_normal)
num_processes = kwargs.get("processes", cpu_count())
Expand Down
3 changes: 3 additions & 0 deletions ppa/archive/templates/archive/snippets/page_preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{% gale_page_url source_url page.order as page_link %}
{# currently no other sources with page level content, so no other case needed #}
{% endif %}
{% if source == 'HathiTrust' or source == 'Gale' %} {# we currently only support page images for these two #}
<div class="preview">
<a href="{{ page_link }}"
target="_blank" rel="noopener noreferrer">
Expand All @@ -39,9 +40,11 @@
<img src="{{ 1x_img }}" srcset="{{ 1x_img}}, {{ 2x_img }} 2x"
alt="page {{ page.label }}"/>
{% endwith %}
{% else %}
{% endif %}
</a>
</div>
{% endif %}
{% if page.title %}<a>p. {{ page.title }}</a>{% endif %}
<div class="snippets">
<p class="page-number">
Expand Down
Loading