Skip to content

Commit

Permalink
Change help button to point to Google help page
Browse files Browse the repository at this point in the history
In order for the change to come into effect, one must set the
GGRC_EXTRENAL_HELP_URL environment variable and re-deploy the
application settings.
  • Loading branch information
plamut committed Nov 10, 2016
1 parent 4feb91e commit f32a2d2
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ src/app.yaml : src/app.yaml.dist
CUSTOM_URL_ROOT="$(CUSTOM_URL_ROOT)" \
ABOUT_URL="$(ABOUT_URL)" \
ABOUT_TEXT="$(ABOUT_TEXT)" \
EXTERNAL_HELP_URL="$(EXTERNAL_HELP_URL)" \
INSTANCE_CLASS="$(INSTANCE_CLASS)" \
MAX_INSTANCES="$(MAX_INSTANCES)" \
AUTHORIZED_DOMAINS="$(AUTHORIZED_DOMAINS)"
Expand Down
1 change: 1 addition & 0 deletions bin/deploy_appengine
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ make deploy \
CUSTOM_URL_ROOT="${CUSTOM_URL_ROOT}" \
ABOUT_URL="${ABOUT_URL}" \
ABOUT_TEXT="${ABOUT_TEXT}" \
EXTERNAL_HELP_URL="${EXTERNAL_HELP_URL}" \
INSTANCE_CLASS="${INSTANCE_CLASS}" \
MAX_INSTANCES="${MAX_INSTANCES}" \
AUTHORIZED_DOMAINS="${AUTHORIZED_DOMAINS}"
1 change: 1 addition & 0 deletions bin/init_vagrant_env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export DEV_PREFIX=/vagrant-dev
export GGRC_EXTERNAL_HELP_URL='#set_GGRC_EXTERNAL_HELP_URL_env_var'

echo "Initializing environment"
cd /vagrant
Expand Down
1 change: 1 addition & 0 deletions extras/deploy_settings_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ RISK_ASSESSMENT_URL='http://localhost:8080'
CUSTOM_URL_ROOT=''
ABOUT_URL='#'
ABOUT_TEXT='About gGRC'
EXTERNAL_HELP_URL='#set_GGRC_EXTERNAL_HELP_URL_env_var'
INSTANCE_CLASS='B4'
MAX_INSTANCES='4'
1 change: 1 addition & 0 deletions src/app.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ env_variables:
GGRC_CUSTOM_URL_ROOT: "{CUSTOM_URL_ROOT}"
GGRC_ABOUT_URL: "{ABOUT_URL}"
GGRC_ABOUT_TEXT: "{ABOUT_TEXT}"
GGRC_EXTERNAL_HELP_URL: "{EXTERNAL_HELP_URL}"
MAX_INSTANCES: "{MAX_INSTANCES}"
AUTHORIZED_DOMAINS: "{AUTHORIZED_DOMAINS}"
2 changes: 1 addition & 1 deletion src/ggrc/assets/mustache/base_objects/page_header.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
</ul>
</li>
<li>
<a href="javascript://" id="#page-help" data-toggle="modal-ajax-helpform" data-help-slug="{{self.page_help()|trim}}">
<a id="#page-help" href="{{GGRC.config.external_help_url}}" target="_blank">
<i class="fa fa-question-circle"></i>
<span>Help</span>
</a>
Expand Down
1 change: 1 addition & 0 deletions src/ggrc/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
CUSTOM_URL_ROOT = os.environ.get("GGRC_CUSTOM_URL_ROOT")
ABOUT_URL = os.environ.get("GGRC_ABOUT_URL")
ABOUT_TEXT = os.environ.get("GGRC_ABOUT_TEXT")
EXTERNAL_HELP_URL = os.environ.get("GGRC_EXTERNAL_HELP_URL")

if len(SETTINGS_MODULE.strip()) == 0:
raise RuntimeError("Specify your settings using the `GGRC_SETTINGS_MODULE` "
Expand Down
7 changes: 7 additions & 0 deletions src/ggrc/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
from ggrc.utils import benchmark


EXTERNAL_HELP_URL = getattr(settings, "EXTERNAL_HELP_URL", "")


# Needs to be secured as we are removing @login_required

@app.route("/_background_tasks/reindex", methods=["POST"])
Expand Down Expand Up @@ -102,10 +105,14 @@ def get_config_json():
"""Get public app config"""
with benchmark("Get config JSON"):
public_config = dict(app.config.public_config)

for extension_module in get_extension_modules():
if hasattr(extension_module, 'get_public_config'):
public_config.update(
extension_module.get_public_config(get_current_user()))

public_config['external_help_url'] = EXTERNAL_HELP_URL

return json.dumps(public_config)


Expand Down

0 comments on commit f32a2d2

Please sign in to comment.