This is for https://fedoraproject.org/wiki/Fedora_Engineering/FY16_Plan
If the FEDMENU_URL and FEDMENU_DATA_URL options are left out of the config, then nothing should change on the displayed page. If they are included, then they will be pulled in at page load time to render little menu buttons on the bottom right hand corner of the page.
There's an example up at http://threebean.org/fedmenu/
It will be a while until we are able to turn this on globally across all our apps. --- frontend/coprs_frontend/config/copr.conf | 4 ++++ frontend/coprs_frontend/coprs/__init__.py | 2 +- frontend/coprs_frontend/coprs/context_processors.py | 11 +++++++++++ frontend/coprs_frontend/coprs/templates/layout.html | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/frontend/coprs_frontend/config/copr.conf b/frontend/coprs_frontend/config/copr.conf index ab4fb96..064baa4 100644 --- a/frontend/coprs_frontend/config/copr.conf +++ b/frontend/coprs_frontend/config/copr.conf @@ -45,6 +45,10 @@ SEND_EMAILS = True ## post-process url leading to frontend # ENFORCE_PROTOCOL_FOR_FRONTEND_URL = "https"
+# URLs for fedmenu resources +#FEDMENU_URL = "http://threebean.org/fedmenu/" +#FEDMENU_DATA_URL = "http://threebean.org/fedmenu/dev-data.js" + # Kerberos authentication configuration. Example configuration abbreviated # like 'RH' (should not changed once used, reflects what is stored in database). # This requires mod_auth_kerb package (Fedora/RHEL) installed on your frontend diff --git a/frontend/coprs_frontend/coprs/__init__.py b/frontend/coprs_frontend/coprs/__init__.py index e86bb64..032ed4d 100644 --- a/frontend/coprs_frontend/coprs/__init__.py +++ b/frontend/coprs_frontend/coprs/__init__.py @@ -52,7 +52,7 @@ from coprs.views import recent_ns from coprs.views.recent_ns import recent_general from coprs.views.stats_ns import stats_receiver
-from .context_processors import include_banner +from .context_processors import include_banner, inject_fedmenu
setup_log()
diff --git a/frontend/coprs_frontend/coprs/context_processors.py b/frontend/coprs_frontend/coprs/context_processors.py index b84c241..895bb03 100644 --- a/frontend/coprs_frontend/coprs/context_processors.py +++ b/frontend/coprs_frontend/coprs/context_processors.py @@ -10,3 +10,14 @@ def include_banner(): return {"copr_banner": open(BANNER_LOCATION).read()} else: return {} + + +@app.context_processor +def inject_fedmenu(): + """ Inject fedmenu url if available. """ + if 'FEDMENU_URL' in app.config: + return dict( + fedmenu_url=app.config['FEDMENU_URL'], + fedmenu_data_url=app.config['FEDMENU_DATA_URL'], + ) + return dict() diff --git a/frontend/coprs_frontend/coprs/templates/layout.html b/frontend/coprs_frontend/coprs/templates/layout.html index bef3fbf..f9981e9 100644 --- a/frontend/coprs_frontend/coprs/templates/layout.html +++ b/frontend/coprs_frontend/coprs/templates/layout.html @@ -58,5 +58,21 @@ </small> </p> </div> + +{% if fedmenu_url is defined %} +<script src="{{fedmenu_url}}/js/fedora-libravatar.js"></script> +<script src="{{fedmenu_url}}/js/fedmenu.js"></script> +<script> + fedmenu({ + 'url': '{{fedmenu_data_url}}', + 'mimeType': 'application/javascript', + 'position': 'bottom-right', + {% if copr is defined %} + 'user': '{{copr.owner.name}}', + {% endif %} + }); +</script> +{% endif %} + </body> </html>
On 04/22/2015 04:51 PM, Ralph Bean wrote:
This is for https://fedoraproject.org/wiki/Fedora_Engineering/FY16_Plan
If the FEDMENU_URL and FEDMENU_DATA_URL options are left out of the config, then nothing should change on the displayed page. If they are included, then they will be pulled in at page load time to render little menu buttons on the bottom right hand corner of the page.
From long term perspective, it would be nice to package it as web asset
https://fedoraproject.org/wiki/Packaging:JavaScript so we can have this JS stored localy.
There's an example up at http://threebean.org/fedmenu/
It is awesome!
Mirek
On Thu, Apr 23, 2015 at 08:21:38AM +0200, Miroslav Suchy wrote:
On 04/22/2015 04:51 PM, Ralph Bean wrote:
This is for https://fedoraproject.org/wiki/Fedora_Engineering/FY16_Plan
If the FEDMENU_URL and FEDMENU_DATA_URL options are left out of the config, then nothing should change on the displayed page. If they are included, then they will be pulled in at page load time to render little menu buttons on the bottom right hand corner of the page.
From long term perspective, it would be nice to package it as web asset https://fedoraproject.org/wiki/Packaging:JavaScript so we can have this JS stored localy.
I see advantages of not having it packaged, among other a single place to update and see the changes in every one of our apps. So if we have a new app, we can just change the JSON blob and all our apps suddenly know about it, same thing for the layout/style.
Pierre
Dne 22.4.2015 v 16:51 Ralph Bean napsal(a):
This is for https://fedoraproject.org/wiki/Fedora_Engineering/FY16_Plan
If the FEDMENU_URL and FEDMENU_DATA_URL options are left out of the config, then nothing should change on the displayed page. If they are included, then they will be pulled in at page load time to render little menu buttons on the bottom right hand corner of the page.
There's an example up at http://threebean.org/fedmenu/
It will be a while until we are able to turn this on globally across all our apps.
Applied. Thank you.
copr-devel@lists.fedorahosted.org