Skip to content

Commit

Permalink
Merge pull request #461 from CityOfNewYork/develop
Browse files Browse the repository at this point in the history
Additions to v2.4

Co-authored-by: Joel Castillo <[email protected]>
  • Loading branch information
joelbcastillo authored Jan 30, 2019
2 parents 7d1d529 + 736b060 commit 3c9cbc5
Show file tree
Hide file tree
Showing 40 changed files with 2,015 additions and 2,018 deletions.
4 changes: 2 additions & 2 deletions app/constants/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
PermissionPair(CLOSE, "Close Request"),
PermissionPair(RE_OPEN, "Re-Open Request"),
PermissionPair(CHANGE_PRIVACY_TITLE, "Change Title Privacy"),
PermissionPair(CHANGE_PRIVACY_AGENCY_REQUEST_SUMMARY, "Change Agency Description Privacy"),
PermissionPair(CHANGE_PRIVACY_AGENCY_REQUEST_SUMMARY, "Change Agency Request Summary Privacy"),
PermissionPair(EDIT_TITLE, "Edit Title"),
PermissionPair(EDIT_AGENCY_REQUEST_SUMMARY, "Edit Agency Description"),
PermissionPair(EDIT_AGENCY_REQUEST_SUMMARY, "Edit Agency Request Summary"),
PermissionPair(ADD_FILE, "Add Files"),
PermissionPair(ADD_LINK, "Add Links"),
PermissionPair(ADD_OFFLINE_INSTRUCTIONS, "Add Offline Instructions"),
Expand Down
4 changes: 2 additions & 2 deletions app/lib/jinja_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def format_event_type(type_):
event_type.REQ_REOPENED: "Request Re-Opened",
event_type.REQ_TITLE_EDITED: "Title Changed",
event_type.REQ_TITLE_PRIVACY_EDITED: "Title Privacy Changed",
event_type.REQ_AGENCY_REQ_SUM_EDITED: "Agency Description Changed",
event_type.REQ_AGENCY_REQ_SUM_PRIVACY_EDITED: "Agency Description Privacy Changed",
event_type.REQ_AGENCY_REQ_SUM_EDITED: "Agency Request Summary Changed",
event_type.REQ_AGENCY_REQ_SUM_PRIVACY_EDITED: "Agency Request Summary Privacy Changed",
event_type.FILE_ADDED: "File Response Added",
event_type.FILE_EDITED: "File Response Changed",
event_type.FILE_REMOVED: "File Response Deleted",
Expand Down
6 changes: 3 additions & 3 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ class Requests(db.Model):
not OPEN - the request must be completed by this date
submission - a Enum that selects from a list of submission methods
status - an Enum that selects from a list of different statuses a request can have
privacy - a JSON object that contains the boolean privacy options of a request's title and agency description
privacy - a JSON object that contains the boolean privacy options of a request's title and agency request summary
(True = Private, False = Public)
agency_request_summary - a string that contains an additional description of the request created by the agency
agency_request_summary_release_date - a datetime of when the agency_request_summary will be made public
Expand Down Expand Up @@ -1118,11 +1118,11 @@ def history_row_content(self):
event_type.REQ_TITLE_EDITED:
self.RowContent(self, "changed", "{} the title."),
event_type.REQ_AGENCY_REQ_SUM_EDITED:
self.RowContent(self, "changed", "{} the agency description."),
self.RowContent(self, "changed", "{} the agency request summary."),
event_type.REQ_TITLE_PRIVACY_EDITED:
self.RowContent(self, "changed", "{} the title privacy."),
event_type.REQ_AGENCY_REQ_SUM_PRIVACY_EDITED:
self.RowContent(self, "changed", "{} the agency description privacy."),
self.RowContent(self, "changed", "{} the agency request summary privacy."),
event_type.FILE_ADDED:
self.RowContent(self, "added", "{} a file response."),
event_type.FILE_EDITED:
Expand Down
4 changes: 2 additions & 2 deletions app/report/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def get():
"active_users": [('', ''), ('o8pj0k', 'John Doe')]}), 200
"""
agency_ein = request.args.get('agency_ein')
user_guid = request.args.get('user_guid')
user_guid = request.args.get('user_guid', '')
requests_opened = 0
requests_closed = 0
active_users = []
is_visible = False
results = False
if agency_ein:
if agency_ein and user_guid == '':
if agency_ein == 'all':
active_requests = Requests.query.with_entities(Requests.status).join(
Agencies, Requests.agency_ein == Agencies.ein).filter(
Expand Down
8 changes: 4 additions & 4 deletions app/request/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
@request_api_blueprint.route('/edit_privacy', methods=['GET', 'POST'])
def edit_privacy():
"""
Edits the privacy privacy options of a request's title and agency description.
Edits the privacy privacy options of a request's title and agency request summary.
Retrieves updated privacy options from AJAX call on view_request page and stores changes into database.
:return: JSON Response with updated title and agency description privacy options
:return: JSON Response with updated title and agency request summary privacy options
"""
request_id = flask_request.form.get('id')
current_request = Requests.query.filter_by(id=request_id).first()
Expand Down Expand Up @@ -73,10 +73,10 @@ def edit_privacy():
@request_api_blueprint.route('/view/edit', methods=['PUT'])
def edit_request_info():
"""
Edits the title and agency description of a FOIL request through an API PUT method.
Edits the title and agency request summary of a FOIL request through an API PUT method.
Retrieves updated edited content from AJAX call on view_request page and stores changes into database.
:return: JSON Response with updated content: either request title or agency description)
:return: JSON Response with updated content: either request title or agency request summary)
"""
edit_request = flask_request.form
request_id = flask_request.form.get('pk')
Expand Down
2 changes: 1 addition & 1 deletion app/search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def search_requests(query,
:param query: string to query for
:param foil_id: search by request id?
:param title: search by title?
:param agency_request_summary: search by agency description?
:param agency_request_summary: search by agency request summary?
:param description: search by description?
:param requester_name: search by requester name?
:param date_rec_from: date created/submitted from
Expand Down
8 changes: 4 additions & 4 deletions app/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ def requests():
Anonymous Users can search by:
- Title (public only)
- Agency Description (public only)
- Agency Request Summary (public only)
Public Users can search by:
- Title (public only OR public and private if user is requester)
- Agency Description (public only)
- Agency Request Summary (public only)
- Description (if user is requester)
Agency Users can search by:
- Title
- Agency Description
- Agency Request Summary
- Description
- Requester Name
Expand Down Expand Up @@ -154,7 +154,7 @@ def requests_doc(doc_type):
"Agency",
"Title",
"Description",
"Agency Description",
"Agency Request Summary",
"Current Status",
"Date Created",
"Date Received",
Expand Down
Binary file added app/static/img/best_of_new_york_winner-2018.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/static/img/closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/static/img/open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/static/img/overdue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/static/img/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/static/img/soon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions app/static/js/request/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,20 @@ function updateCustomRequestFormDropdowns() {
// loop through each request type dropdown
$(".request-type").each(function () {
var requestTypeOptions = "#" + this.id + " > option";
if (this.value !== "") { // if the dropdown is not exmpty execute this block
if (this.value !== "") { // if the dropdown is not empty execute this block
$(requestTypeOptions).each(function () { // loop through each option in the dropdown
if (this.text !== "" && this.text !== categoryDividerText) { // only update options that actually have text
var originalText = originalFormNames[this.value]; // get the actual form name
if (backwards[this.value] === 0) { // if there are no instances of the form keep the text at 0
$(this).text(originalText + " (" + (backwards[this.value]).toString() + " of " + maxRepeatable[this.value].toString() + ")");
}
else { // use the following formula, maxRepeatable[this.value] - backwards[this.value] - repeatableCounter[this.value] + 1 to calculate what instance number is currently being processed
$(this).text(originalText + " (" + (maxRepeatable[this.value] - backwards[this.value] - repeatableCounter[this.value] + 1).toString() + " of " + maxRepeatable[this.value].toString() + ")");
if (showMultipleRequestTypes) {
$(this).text(originalText + " (" + (maxRepeatable[this.value] - backwards[this.value] - repeatableCounter[this.value] + 1).toString() + " of " + maxRepeatable[this.value].toString() + ")");
}
else { // use original text if only one custom form can display
$(this).text(originalText);
}
}
if (backwards[this.value] > 1) { // update the backwards counter for the next time you see the same form selected in another dropdown
backwards[this.value]--;
Expand Down
4 changes: 3 additions & 1 deletion app/static/js/request/new-request-agency.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ $(document).ready(function () {
// append a new dropdown and content div every time the additional content button is clicked
$("#custom-request-form-additional-content").click(function () {
customRequestFormCounter = customRequestFormCounter + 1;
var dropdownTemplate = "<div class='panel panel-default appended-div' id='custom-request-panel-" + customRequestFormCounter + "'><div class='panel-heading' id='custom-request-forms-" + customRequestFormCounter + "' style='display: block;'><label class='request-heading request-type-label' for='request_type'>Request Type (optional)</label><button type='button' class='close panel-dismiss' id='panel-dismiss-button-" + customRequestFormCounter + "' data-target='#panel-dismiss-modal' data-toggle='modal'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button><select class='input-block-level request-type' id='request-type-" + customRequestFormCounter + "' name='request_type'></select><br></div>";
var dropdownTemplate = "<div class='panel panel-default appended-div' id='custom-request-panel-" + customRequestFormCounter + "'><div class='panel-heading' id='custom-request-forms-" + customRequestFormCounter + "' style='display: block;'><label class='request-heading request-type-label' for='request_type'>Request Type (optional)</label><button type='button' class='close panel-dismiss' id='panel-dismiss-button-" + customRequestFormCounter + "' data-target='#panel-dismiss-modal' data-toggle='modal'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button><select class='input-block-level request-type' id='request-type-" + customRequestFormCounter + "' name='request_type' aria-label='Request Type " + customRequestFormCounter + "'></select><br></div>";
var contentTemplate = "<div class='panel-body' id='custom-request-form-content-" + customRequestFormCounter + "' hidden></div></div>";
$(dropdownTemplate + contentTemplate).insertBefore("#custom-request-form-additional-content");
$("#custom-request-form-additional-content").hide();
Expand All @@ -97,6 +97,8 @@ $(document).ready(function () {

previousValues[customRequestFormCounter - 1] = "";
currentValues[customRequestFormCounter - 1] = "";

$("#request-type-" + customRequestFormCounter).focus();
});

// jQuery mask plugin to format fields
Expand Down
4 changes: 3 additions & 1 deletion app/static/js/request/new-request-anon.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ $(document).ready(function () {
// append a new dropdown and content div every time the additional content button is clicked
$("#custom-request-form-additional-content").click(function () {
customRequestFormCounter = customRequestFormCounter + 1;
var dropdownTemplate = "<div class='panel panel-default appended-div' id='custom-request-panel-" + customRequestFormCounter + "'><div class='panel-heading' id='custom-request-forms-" + customRequestFormCounter + "' style='display: block;'><label class='request-heading request-type-label' for='request_type'>Request Type (optional)</label><button type='button' class='close panel-dismiss' id='panel-dismiss-button-" + customRequestFormCounter + "' data-target='#panel-dismiss-modal' data-toggle='modal'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button><select class='input-block-level request-type' id='request-type-" + customRequestFormCounter + "' name='request_type'></select><br></div>";
var dropdownTemplate = "<div class='panel panel-default appended-div' id='custom-request-panel-" + customRequestFormCounter + "'><div class='panel-heading' id='custom-request-forms-" + customRequestFormCounter + "' style='display: block;'><label class='request-heading request-type-label' for='request_type'>Request Type (optional)</label><button type='button' class='close panel-dismiss' id='panel-dismiss-button-" + customRequestFormCounter + "' data-target='#panel-dismiss-modal' data-toggle='modal'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button><select class='input-block-level request-type' id='request-type-" + customRequestFormCounter + "' name='request_type' aria-label='Request Type " + customRequestFormCounter + "'></select><br></div>";
var contentTemplate = "<div class='panel-body' id='custom-request-form-content-" + customRequestFormCounter + "' hidden></div></div>";
$(dropdownTemplate + contentTemplate).insertBefore("#custom-request-form-additional-content");
$("#custom-request-form-additional-content").hide();
Expand All @@ -123,6 +123,8 @@ $(document).ready(function () {

previousValues[customRequestFormCounter - 1] = "";
currentValues[customRequestFormCounter - 1] = "";

$("#request-type-" + customRequestFormCounter).focus();
});

// jQuery mask plugin to format fields
Expand Down
4 changes: 3 additions & 1 deletion app/static/js/request/new-request-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ $(document).ready(function () {
// append a new dropdown and content div every time the additional content button is clicked
$("#custom-request-form-additional-content").click(function () {
customRequestFormCounter = customRequestFormCounter + 1;
var dropdownTemplate = "<div class='panel panel-default appended-div' id='custom-request-panel-" + customRequestFormCounter + "'><div class='panel-heading' id='custom-request-forms-" + customRequestFormCounter + "' style='display: block;'><label class='request-heading request-type-label' for='request_type'>Request Type (optional)</label><button type='button' class='close panel-dismiss' id='panel-dismiss-button-" + customRequestFormCounter + "' data-target='#panel-dismiss-modal' data-toggle='modal'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button><select class='input-block-level request-type' id='request-type-" + customRequestFormCounter + "' name='request_type'></select><br></div>";
var dropdownTemplate = "<div class='panel panel-default appended-div' id='custom-request-panel-" + customRequestFormCounter + "'><div class='panel-heading' id='custom-request-forms-" + customRequestFormCounter + "' style='display: block;'><label class='request-heading request-type-label' for='request_type'>Request Type (optional)</label><button type='button' class='close panel-dismiss' id='panel-dismiss-button-" + customRequestFormCounter + "' data-target='#panel-dismiss-modal' data-toggle='modal'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button><select class='input-block-level request-type' id='request-type-" + customRequestFormCounter + "' name='request_type' aria-label='Request Type " + customRequestFormCounter + "'></select><br></div>";
var contentTemplate = "<div class='panel-body' id='custom-request-form-content-" + customRequestFormCounter + "' hidden></div></div>";
$(dropdownTemplate + contentTemplate).insertBefore("#custom-request-form-additional-content");
$("#custom-request-form-additional-content").hide();
Expand All @@ -105,6 +105,8 @@ $(document).ready(function () {

previousValues[customRequestFormCounter - 1] = "";
currentValues[customRequestFormCounter - 1] = "";

$("#request-type-" + customRequestFormCounter).focus();
});

// Apply parsley validation styles to the input forms for a new request.
Expand Down
Loading

0 comments on commit 3c9cbc5

Please sign in to comment.