Add book link to the documentation

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-11-21 00:38:03 -04:00
parent a36c2a6590
commit 86399a5ee2
7 changed files with 78 additions and 17 deletions

1
.gitignore vendored
View File

@@ -33,3 +33,4 @@ static_collected/
google_fonts/ google_fonts/
node_modules/ node_modules/
docs/build/ docs/build/
docs/_templates/layout.html

View File

@@ -7,6 +7,7 @@
- Add sphinx sitemap extension. - Add sphinx sitemap extension.
- Move the file patching code from the Dependency class to a - Move the file patching code from the Dependency class to a
generalized utility of the storages app. generalized utility of the storages app.
- Add book link to the documentation.
3.2.10 (2019-11-19) 3.2.10 (2019-11-19)
=================== ===================

BIN
docs/_static/book_cover.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View File

@@ -1,16 +0,0 @@
<h3>Support</h3>
<p>
<a href='http://www.mayan-edms.com/providers/'>Consulting and support plans are available, click here</a>.
</p>
<hr />
<p>
Or consider supporting Mayan EDMS by contributing to its development. (US tax payers, please note this contribution is not tax deductible).
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="3PXN336XFXQNN">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" style="display: none !important;">
</form>
<hr />

41
docs/_templates/message_area.html vendored Normal file
View File

@@ -0,0 +1,41 @@
<style>
.wy-body-for-nav #message-area {
color: #b3b3b3;
margin: 1em 2em 1em 1em;
}
#message-area {
border: 1px dotted #2980B9;
padding: .5em;
margin: 1em 0;
text-align: center;
}
</style>
<div id="message-area">
<h3>Get the book!</h3>
<a href="https://www.mayan-edms.com/book/">
<img src="{{ pathto('_static/book_cover.jpg', 1) }}" />
</a>
<hr />
<p>
On-site consulting and support plans are available, <a href='https://www.mayan-edms.com/support/'>click here</a>.
</p>
<hr />
<p>
Or consider donating to support the continued development of the project.
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="3PXN336XFXQNN">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" style="display: none !important;">
</form>
</div>

View File

@@ -123,7 +123,7 @@ html_theme = 'sphinx_rtd_theme'
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
html_theme_options = { html_theme_options = {
'analytics_id': 'UA-52965619-6', 'analytics_id': 'UA-52965619-6'
} }
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
@@ -305,3 +305,4 @@ def setup(app):
substitutions=substitutions substitutions=substitutions
) )
) )
utils.patch_theme_template(app, templates_path=templates_path[0])

View File

@@ -1,5 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import shutil
from pathlib2 import Path
import sphinx_rtd_theme
from mayan.apps.storage.utils import patch_files
def load_env_file(filename='../config.env'): def load_env_file(filename='../config.env'):
result = {} result = {}
@@ -19,3 +25,30 @@ def generate_substitutions(dictionary):
result.append(('|{}|'.format(key), value)) result.append(('|{}|'.format(key), value))
return result return result
def patch_theme_template(app, templates_path):
package_path = Path(sphinx_rtd_theme.__file__)
source_file_path = package_path.parent / 'layout.html'
destination_path = Path(app.srcdir) / templates_path
destination_file_path = destination_path / 'layout.html'
with source_file_path.open(mode='r') as source_file_object:
with destination_file_path.open(mode='w+') as destination_file_object:
shutil.copyfileobj(
fsrc=source_file_object, fdst=destination_file_object
)
patch_files(
path=destination_path, replace_list=[
{
'filename_pattern': 'layout.html',
'content_patterns': [
{
'search': '</div>\n </nav>\n\n <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">',
'replace': '{% include "message_area.html" %}</div>\n </nav>\n\n <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">',
},
]
}
]
)