Skip to content

Commit

Permalink
Merge pull request #1459 from haohangyan/webpage_fix
Browse files Browse the repository at this point in the history
Correct the block in footer
  • Loading branch information
kkaris authored Oct 2, 2024
2 parents 0466f8b + 03ebc90 commit 8f26e8c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion indra/assemblers/html/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def save_model(self, fname, **kwargs):
Parameters
----------
fname : str
fname : str | Path
The path to the file to save the HTML into.
"""
if self.model is None:
Expand Down
2 changes: 1 addition & 1 deletion indra/assemblers/html/templates/indra/statements_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
title="Belief score for this statement">{{ belief_score }}</small>
{%- endmacro %}

{% block header_desc %}
{% block footer_desc %}
This page allows you to curate the loaded statements. For more information
please see the
<a href="https://indra.readthedocs.io/en/latest/tutorials/html_curation.html"
Expand Down
6 changes: 3 additions & 3 deletions indra/assemblers/html/templates/indra/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
text-align: left;
padding: 0.5em;
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
height: 110px;
height: 65;
}

.footer h4, .footer p, .footer a {
Expand Down Expand Up @@ -157,7 +157,7 @@
{% if not simple %}
.content {
padding-top:85px;
padding-bottom: 110px
padding-bottom: 65px
}

@media (max-width: 1800px) {
Expand Down Expand Up @@ -253,7 +253,7 @@ <h2>{{ title }}</h2>

<div class="side-info-block">
<div id="about-this-project">
{% block header_desc %}
{% block footer_desc %}
{% endblock %}
</div>
</div>
Expand Down
47 changes: 25 additions & 22 deletions indra/tests/test_html_assembler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
from pathlib import Path

from indra.assemblers.english import AgentWithCoordinates
from indra.assemblers.html.assembler import HtmlAssembler, tag_text, loader, \
Expand All @@ -10,6 +11,8 @@
from indra.util.statement_presentation import AveAggregator, StmtStat, \
internal_source_mappings

HERE = Path(__file__).parent


def make_stmt():
src = Agent('SRC', db_refs={'HGNC': '11283'})
Expand Down Expand Up @@ -92,12 +95,12 @@ def test_colors_in_html():

stmt = Activation(ag_a, ag_b, evidence=evidences)
ha = HtmlAssembler(statements=[stmt])
ha.save_model('./temp_simple.html')
ha.save_model(HERE / 'temp_simple.html')
ha = HtmlAssembler(statements=[stmt])
ha.save_model('./temp_not_simple.html', simple=False)
with open('./temp_simple.html') as fh:
ha.save_model(HERE / 'temp_not_simple.html', simple=False)
with open(HERE / 'temp_simple.html') as fh:
simple_html = fh.read()
with open('./temp_not_simple.html') as fh:
with open(HERE / 'temp_not_simple.html') as fh:
not_simple_html = fh.read()
assert all(color in simple_html for color in colors)
assert all(color in not_simple_html for color in colors)
Expand Down Expand Up @@ -140,13 +143,13 @@ def test_custom_colors_in_html():

stmt = Activation(ag_a, ag_b, evidence=evidences)
ha = HtmlAssembler(statements=[stmt], custom_sources=custom_sources)
ha.save_model('./temp_custom_colors_simple.html')
with open('./temp_custom_colors_simple.html') as fh:
ha.save_model(HERE / 'temp_custom_colors_simple.html')
with open(HERE / 'temp_custom_colors_simple.html') as fh:
simple_html = fh.read()

ha = HtmlAssembler(statements=[stmt], custom_sources=custom_sources)
ha.save_model('./temp_not_simple.html', simple=False)
with open('./temp_custom_colors_simple.html') as fh:
ha.save_model(HERE / 'temp_not_simple.html', simple=False)
with open(HERE / 'temp_custom_colors_simple.html') as fh:
not_simple_html = fh.read()

# Check if style rule appears
Expand Down Expand Up @@ -175,19 +178,19 @@ def test_skip_sources_not_in_evidences():
not_in_html.append(source)
stmt = Activation(ag_a, ag_b, evidence=evidences)
ha = HtmlAssembler(statements=[stmt])
ha.save_model('./temp_simple.html')
with open('./temp_simple.html') as fh:
ha.save_model(HERE / 'temp_simple.html')
with open(HERE / 'temp_simple.html') as fh:
simple_html = fh.read()

ha = HtmlAssembler(statements=[stmt])
ha.save_model('./temp_not_simple.html', simple=False)
with open('./temp_not_simple.html') as fh:
ha.save_model(HERE / 'temp_not_simple.html', simple=False)
with open(HERE / 'temp_not_simple.html') as fh:
not_simple_no_show_html = fh.read()

ha = HtmlAssembler(statements=[stmt])
ha.save_model('./temp_not_simple_no_show.html',
ha.save_model(HERE / 'temp_not_simple_no_show.html',
show_only_available=True)
with open('./temp_not_simple_no_show.html') as fh:
with open(HERE / 'temp_not_simple_no_show.html') as fh:
not_simple_html = fh.read()
assert all(color in simple_html for color in colors)
assert all(color in not_simple_html for color in colors)
Expand Down Expand Up @@ -215,9 +218,9 @@ def test_readers_only():
not_in_html.append(source)
stmt = Activation(ag_a, ag_b, evidence=evidences)
ha = HtmlAssembler(statements=[stmt])
ha.save_model('./temp_no_show_rd_only.html',
ha.save_model(HERE / 'temp_no_show_rd_only.html',
show_only_available=True)
with open('./temp_no_show_rd_only.html') as fh:
with open(HERE / 'temp_no_show_rd_only.html') as fh:
no_show_html = fh.read()
assert all(color in no_show_html for color in colors)

Expand All @@ -244,9 +247,9 @@ def test_databases_only():
not_in_html.append(source)
stmt = Activation(ag_a, ag_b, evidence=evidences)
ha = HtmlAssembler(statements=[stmt])
ha.save_model('./temp_no_show_db_only.html',
ha.save_model(HERE / 'temp_no_show_db_only.html',
show_only_available=True)
with open('./temp_no_show_db_only.html') as fh:
with open(HERE / 'temp_no_show_db_only.html') as fh:
no_show_html = fh.read()
assert all(color in no_show_html for color in colors)

Expand Down Expand Up @@ -336,8 +339,8 @@ def test_source_info_to_source_colors():
def test_generate_source_css():
source_info = source_json()
src_col = _source_info_to_source_colors(source_info)
generate_source_css(fname='./temp.css', source_colors=src_col)
with open('./temp.css') as fh:
generate_source_css(fname=HERE / 'temp.css', source_colors=src_col)
with open(HERE / 'temp.css') as fh:
css_str = fh.read()

rule_string = '.source-{src} {{\n background-color: {src_bg};\n ' \
Expand Down Expand Up @@ -653,7 +656,7 @@ def test_sort_default():

# Check to make sure the HTML assembler runs.
model = ha.make_model()
with open('test_agent_pair.html', 'w') as f:
with open(HERE / 'test_agent_pair.html', 'w') as f:
f.write(model)


Expand All @@ -668,7 +671,7 @@ def test_sort_group_by_relation():

# Make sure the HTML assembles.
model = ha.make_model(grouping_level='relation')
with open('test_relation.html', 'w') as f:
with open(HERE / 'test_relation.html', 'w') as f:
f.write(model)


Expand Down

0 comments on commit 8f26e8c

Please sign in to comment.