{% from 'macros.html' import card_shell %} {% macro publish_card(title, other_file_type, content_list) %} {% call card_shell(title=title, file_count=content_list|length, icon_class='bi-file-earmark', color='secondary') %}
{% set uploaded_content = [] %} {% if content_list|length > 0 %} {% for filename in content_list %} {% if all_tgp_contents[filename] %}{% do uploaded_content.append(filename) %}{% endif %} {% endfor %}
File
{{ filename }} {% if all_tgp_contents[filename] %} {% else %} {% endif %} {% if all_tgp_contents[filename] and all_tgp_contents[filename]['published'] %} {% else %} {% endif %}
{% else %}
No additional files configured
{% endif %}
{% endcall %} {% endmacro %}
{% set tg_session_id = project.main_config.get_tg_session_id(instance) %} {% set is_valid_session = project.get_tgp(instance).check_session() %} {% set tgproject_handler = project.get_tgp(instance) %} {% set current_tg_project_id = project.main_config.get_tg_project_id(instance) %} {% set action = 'publish' %}
{% if instance == 'test' %}
Test Environment — Publishing here makes your project visible on the test repository.
{% else %}
Production Environment — Publishing here makes your project publicly available. This action cannot be undone.
{% endif %}
{% include 'includes/get_sessionid.html' %}
{% include 'includes/set_sessionid.html' %}
{% if is_valid_session %}
{% include 'includes/tg_project_info.html' %} {% if not current_tg_project_id %}
No TextGrid Project Selected

Please select or create a TextGrid project to publish your collections.

{% else %}
Publish Project
Make your uploaded collections publicly available
{% if proof_error is defined and proof_error %} {% endif %}
{% set p_validation = project.get_validation_results(refresh=False) %} {% set tg_project = tg_project if tg_project else project.get_tgp(instance) %} {% set all_tgp_contents = tg_project.get_project_contents() %} {% for c_validation in p_validation["subprojects"] %} {% set uploaded = [] %} {% set published = [] %} {% call card_shell(title=c_validation.title, file_count=c_validation.files|length, icon_class='bi-folder2', color='primary') %}
{% for file_name, file_errors in c_validation.files.items() %} {% if 'file_attributes' in c_validation %} {% set title = c_validation.file_attributes[file_name]['work_title'] %} {% else %} {% set title = file_name %} {% endif %} {% if all_tgp_contents[title] %}{% do uploaded.append(title) %}{% endif %} {% if all_tgp_contents[title] and all_tgp_contents[title]['published'] %}{% do published.append(title) %}{% endif %} {% endfor %}
File
{{ title }} {% if len(file_errors) == 0 %} {% else %} {% endif %} {% if all_tgp_contents[title] %} {% else %} {% endif %} {% if all_tgp_contents[title] and all_tgp_contents[title]['published'] %} {% else %} {% endif %}
{% endcall %} {% endfor %} {{ publish_card(title='OTHER FILES', other_file_type='other_files', content_list=project.project_config.other_files.get_all_other_files()) }} {{ publish_card(title='PORTALCONFIG', other_file_type='portalconfig', content_list=[project.project_config.other_files.portalconfig]) }} {{ publish_card(title='README', other_file_type='readme', content_list=[project.project_config.other_files.readme]) }} {% endif %}
{% endif %}