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

Import project: suggest a config file (yaml) #166

Merged
merged 2 commits into from
Jul 11, 2023
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

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions readthedocsext/theme/templates/projects/import_config.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{% extends "projects/import_base.html" %}
{% load i18n %}

{% block project_add_content_subheader %}
{% trans "Add a configuration file to your project" %}
{% endblock project_add_content_subheader %}

{% block project_add_content_classes %}ui fourteen wide tablet twelve wide computer column{% endblock %}

{% block project_add_content_form %}
<div class="ui small info message">
{% blocktrans trimmed %}
A <code>.readthedocs.yaml</code> configuration file is required at the root of your repository in order to build your documentation.
{% endblocktrans %}

<a href="https://docs.readthedocs.io/page/config-file/index.html" target="_blank">
{% trans "Learn how to add a configuration file to your project." %}
</a>
</div>

<div class="ui basic fitted right aligned segment">
<span>{% trans "Example configuration for:" %}</span>
<div class="ui inline dropdown" data-bind="semanticui: { dropdown: {}}">
<input type="hidden" name="tool" value="sphinx">
<span class="text">Sphinx</span>
<i class="dropdown icon"></i>
<div class="menu">
<div class="item" data-value="sphinx">Sphinx</div>

{% comment %}
Adding a second option here will require a bit of JS or FUI:
https://github.com/readthedocs/ext-theme/issues/184
{% endcomment %}

{# The `actionable` class here prevents the select from selecting the text #}
<a class="actionable item" href="https://docs.readthedocs.io/page/config-file/index.html#getting-started-with-a-template" target="_blank">
{% trans "See more examples" %}
</a>
</div>
</div>
</div>

<div class="ui mini padded inverted scrolling segment">
<div class="ui top attached label">
<code>.readthedocs.yaml</code>
</div>
<a class="ui top right attached icon label" href="#" data-clipboard-target="#project-create-sample-sphinx">
<i class="fas fa-copy icon"></i>
</a>
<code class="highlight">
<pre id="project-create-sample-sphinx">
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version, and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optionally, but recommended,
# declare the Python requirements required to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
</pre>
</code>
</div>

{# Show the base form #}
{{ block.super }}

{% endblock project_add_content_form %}

{% block project_add_sidebar_help_topics %}
{% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/config-file/index.html" text="Configuration file tutorial" is_external=True class="item" %}
{% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/config-file/v2.html" text="Configuration file reference" is_external=True class="item" %}
{% include "includes/elements/link.html" with url="https://docs.readthedocs.io/page/guides/setup/git-repo-manual.html" text="Manually configuring a Git repository" is_external=True class="item" %}
{% endblock project_add_sidebar_help_topics %}
14 changes: 9 additions & 5 deletions src/js/application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,17 @@ export class Application {
});
jquery(".ui.menu > .item[data-tab]").tab();

// Initialize clipboard, but only for data-clipboard-text. This is the most
// generalized pattern for clipboard usage, so we won't yet worry about
// adding the other data binding selectors.
var clipboard_global = new clipboard(".ui.button[data-clipboard-text]");
jquery(".ui.button[data-clipboard-text]").popup({
/* Initialize clipboard.js using a few selectors that we are using. This
* isn't a great fit for Knockout custom data binding or plugin, as the
* library uses some builtin/hardcoded selectors. */
var clipboard_global = new clipboard(
"[data-clipboard-text], [data-clipboard-target]"
);
// Provide the user with some visual feedback using FUI popups
jquery("[data-clipboard-text], [data-clipboard-target]").popup({
on: "click",
hoverable: false,
content: "Copied!",
});
}
}