Skip to content

Instantly share code, notes, and snippets.

@JonDaniel
Created March 7, 2017 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonDaniel/1ec16832abc671b7bc2222f300cd25cf to your computer and use it in GitHub Desktop.
Save JonDaniel/1ec16832abc671b7bc2222f300cd25cf to your computer and use it in GitHub Desktop.
{% extends "master.html" %}
{% block init %}{{ aek.set_aek_version(1.4) }}
{% endblock %}
{% block title %}Feedback{% endblock %}
{% block main_content %}
{# AEK script to submit feedback like in the native Settings -> Feedback (android) or Settings -> Send Feedback (iOS) #}
{# Please note that in order to adapt this for your organisation, you will need to change the profile ID - you can find this #}
{# from URLs in app manager, e.g. in Settings -> Profile Settings the URL will be https://appmanager.ombiel.com/app-settings/CampusM/profilesettings/????/ #}
{# where ???? is the profileId for that particular profile #}
{% set profileId = ???? %}
{# The example set out below does both "ideas" and "user feedback" - "problems" is more complex and will be tackled in a later AEK script #}
{# It's unlikely that you'll want both in the same page - so it should be a simple matter to just remove the relevant form #}
{# Whilst this AEK performs very nearly the same as the native options, the OS version is not captured and the user-agent string is used as the model #}
{# Obtain a link to the main campusM web services functions #}
{% set cmwebservices = aek.extension("CMWebServices") %}
{# Add styling and a bit of javascript to make the tap-to-select stars work #}
<link rel="stylesheet" href="https://portal.ombiel.co.uk/assets/BradfordMDC/BradfordCouncil/css/bradford_mdc_aek-2.css" />
<script type="text/javascript" data-defer="true">
$("input.eduRadioInput").addClass("input_hidden");
$("label.eduLabel").click(function() {
$this = $(this);
$this.addClass('selected');
$this.prevAll('label').addClass('selected');
$this.nextAll('label').removeClass('selected');
});
</script>
<div>
<article>
<header class="theme1 schools">
<h1>Feedback</h1>
</header>
{{ aek.add_lib("aek-subpages") }}
{{ aek.add_lib("aek-icons") }}
{% set action = aek.request("_action") %}
{% set platform = aek.get_platform() %}
{% if platform == "web2" %}
{% set platform = "web" %}
{% endif %}
{{ aek.remove_from_cache }}
{# Actions ... #}
{% if action == "idea" %}
{% set response = cmwebservices.call("submitUserIdea", {"personId":aek.person_id,"password":"[[password]]","profileId":profileId,"platform":platform, "osVersion": "NA", "model": aek.request("useragent"),"comments":aek.request("comments") }) %}
{% set action = "" %}
{% if response.desc != "Successful" %}
<div class="errbtn">Failed to submit idea -- {{ response.detail.returnStatus.desc }}</div>
{% else %}
<div class="createdbtn">Created idea - {{ aek.request("comments") }} - thanks!</div>
{% endif %}
{% endif %}
{% if action == "feedback" %}
{% set response2 = cmwebservices.call("submitUserFeedback", {"personId":aek.person_id,"password":"[[password]]","profileId":profileId,"platform":platform,"osVersion":"NA","model":aek.request("useragent"),"appOrPage":"A","comments":aek.request("comments"),"rating":aek.request("rating") }) %}
{% set action = "" %}
{% if response2.desc != "Successful" %}
<div class="errbtn">Failed to submit feedback -- {{ response2.detail.returnStatus.desc }}</div>
{% else %}
<div class="createdbtn">Feedback sent - {{ aek.request("comments") }} - thanks!</div>
{% endif %}
{% endif %}
{# Show feedback form ... #}
{% if not action or action == "" %}
{# Ideas form ... #}
<section class="theme1">
<p class="introtext">Send idea about the app</p>
<form name="idea" action="{{aek.current_url}}">
<input type="hidden" name="_action" value="idea"/>
<input type="hidden" name="useragent" id="useragent2" value=""/>
<script type="text/javascript">
var elem = document.getElementById("useragent2");
elem.value = navigator.userAgent;
</script>
<textarea name="comments"/>
<input type="submit" class="buttonbmdc" name="submit" value="Submit idea"/>
</form>
</section>
{# Feedback form ... #}
<section class="theme1">
<p class="introtext">Send feedback about the app</p>
<form name="feedback" action="{{aek.current_url}}">
<input type="hidden" name="_action" value="feedback"/>
<input type="hidden" name="useragent" id="useragent" value=""/>
<script type="text/javascript">
var elem = document.getElementById("useragent");
elem.value = navigator.userAgent;
</script>
<textarea name="comments"/>
<div style="text-align: center"><h3>Tap a star to rate</h3>
<label class="eduLabel selected" for="o274961">
<input id="o274961" class="eduRadioInput input-type-radio input_hidden" type="radio" checked="" value="1" name="rating"/>
<img class="selectedImg" alt="X" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star_focus.png"/>
<img class="deselectedImg" alt="x" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star.png"/>
</label>
<label class="eduLabel selected" for="o274962">
<input id="o274962" class="eduRadioInput input-type-radio input_hidden" type="radio" checked="" value="2" name="rating"/>
<img class="selectedImg" alt="X" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star_focus.png"/>
<img class="deselectedImg" alt="x" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star.png"/>
</label>
<label class="eduLabel selected" for="o274963">
<input id="o274963" class="eduRadioInput input-type-radio input_hidden" type="radio" checked="" value="3" name="rating"/>
<img class="selectedImg" alt="X" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star_focus.png"/>
<img class="deselectedImg" alt="x" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star.png"/>
</label>
<label class="eduLabel selected" for="o274964">
<input id="o274964" class="eduRadioInput input-type-radio input_hidden" type="radio" checked="" value="4" name="rating"/>
<img class="selectedImg" alt="X" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star_focus.png"/>
<img class="deselectedImg" alt="x" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star.png"/>
</label>
<label class="eduLabel" for="o274965">
<input id="o274965" class="eduRadioInput input-type-radio input_hidden" type="radio" checked="" value="5" name="rating"/>
<img class="selectedImg" alt="X" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star_focus.png"/>
<img class="deselectedImg" alt="x" src="https://portal.ombiel.co.uk/assets/Educause/Educause/rating_star.png"/>
</label>
</div>
<input type="submit" class="buttonbmdc" name="submit" value="Submit feedback"/>
</form>
</section>
{% endif %}
</article>
</div>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment