-
Notifications
You must be signed in to change notification settings - Fork 40
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
CareersBlock for Resource Page template sections streamblock(USAJobs API) #799
CareersBlock for Resource Page template sections streamblock(USAJobs API) #799
Conversation
Codecov Report
@@ Coverage Diff @@
## release/public-beta-20170216 #799 +/- ##
===============================================================
Coverage ? 63.11%
===============================================================
Files ? 124
Lines ? 2700
Branches ? 208
===============================================================
Hits ? 1704
Misses ? 988
Partials ? 8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great. Just caught a few small things. Nice work!
@@ -22,7 +22,7 @@ | |||
url(r'^documents/', include(wagtaildocs_urls)), | |||
url(r'^search/$', search_views.search, name='search'), | |||
url(r'^updates/$', home_views.updates), | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to add a preference to your text editor to strip out extraneous whitespace like this. Not a big deal, but will result in fewer false diffs.
@@ -0,0 +1,17 @@ | |||
{% load wagtailcore_tags %} | |||
<section class="slab slab--neutral" style="padding:1rem"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to avoid inline styles. Does the default padding on the .slab class not work?
</ul> | ||
</li><br> | ||
{% empty %} | ||
<p>There are currently no open positions available. Please check back on this page or Job Announcements on <a href='https://www.usajobs.gov/' title='USAJobs website'>USAJOBs</a> for the latest FEC Vacancy Announcements.")</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p>
should be outside the <ul>
fec/home/templatetags/open_jobs.py
Outdated
|
||
@register.inclusion_tag('partials/jobs.html') | ||
def get_jobs(): | ||
from django.http import HttpResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imports should be at the top of the file.
fec/home/templatetags/open_jobs.py
Outdated
querystring = {"Organization":"PU00","WhoMayApply":"All"} | ||
|
||
headers = { | ||
'authorization-key': "ZQbNd1iLrQ+rPN3Rj2Q9gDy2Qpi/3haXSXGuHbP1SRk=", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this key private? If so, it shouldn't be checked in and should instead be set as a secret env var (and should probably be replaced now if it is supposed to be private).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am waiting to hear back from USAjobs API support regarding a ticket I submitted to resolve this.
in prep for pen testing
The USAJobs API key has been deactivated and removed from checked-in code. A new key will be set as an environmental variable using "create-user-provided-service (cups)" on the next push. |
The previous two hotfixes seem to have gotten in the way of this latest migration, so this changeset fixes them and sets things straight again.
Cool. You'll just need to also add the env var lookup to |
make staging use the umbrella
@johnnyporkchops do you know if you'll be able to finish this up today? I'd like to get it merged in if possible. |
Yes, I will update shortly |
Fixes migrations in CMS develop branch
--@ccostino added the API Key as a sensitive env var to CF using UUPS. I have referenced it in fec/settings/base.py and as a variable in home/templatetags/open_jobs.py. --There are no open FEC jobs, so it will show the alt language. If we want see a job list for presentation/testing purposes, one could temporarily change line #14 in open_jobs.py to read Please let me know of any changes, I will make them ASAP |
Let me know if I can also build the about/careers page when this is merged in. |
<li> | ||
<h3><a href="{{ j.PositionURI }}">{{ j.PositionID }} , {{ j.PositionTitle}}</a></h3> | ||
<ul class="u-padding--bottom"> | ||
<li class='t-sans'><strong>Open Period:</strong> {{ j.PositionStartDate }} - {{ j.PositionEndDate }}</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super small thing, but prefer double quotes for attributes in HTML. Also, you can just put .t-sans
on the parent element, I believe.
fec/home/templatetags/open_jobs.py
Outdated
jobData = [] | ||
for i in responses['SearchResult']['SearchResultItems']: | ||
x= {} | ||
x = { "PositionTitle": i["MatchedObjectDescriptor"]["PositionTitle"] , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small formatting things:
- Each item should be on a new line (
PositionURI
is on the same line asPositionID
) - Key names should be lower case and use underscores instead of camelCase
Looking great. Just had a few small code style comments. |
This block allows one to add a list of all open FEC jobs in the Resource Page template using a streamfield static block. To be used in creating the /about/careers page. The list is real-time and will always be up to date upon page load. Below is a screenshot of careers page made with the Resource Page template and this new block.
In the final page, It shows current openings if there are any, otherwise in shows "check back later" language. (The query is currently querying the PeaceCorps ("Organization":"PU00") for demo purposes since we have no open jobs, will switch to FEC (LF00) in production.
Files:
home/templatetags/open_jobs.py
home/templates/block/careers.html
home/templates/partials/jobs.html
home/blocks.py
This uses home/templatetags/open_jobs.py to register an inclusion for jobs.html partial and query the USAJobs API
A block definition for CareersBlock is added to the streamfield definition for ResourceBlock that is available in the editing interface on Resource Page template. (The best part is I could add this without having to alter any models or makemigrations :-)
Related issues:
https://github.com/18F/fec-cms/issues/769
https://github.com/18F/fec-cms/issues/678
Similar PR:
https://github.com/18F/fec-cms/pull/735
Below is a screenshot of careers page made using this new streamfield block inside Resource Page template: