Skip to content

Commit

Permalink
Merge pull request #139 from cityofaustin/114_attachments
Browse files Browse the repository at this point in the history
114 Attachments
  • Loading branch information
mateoclarke committed Jul 23, 2019
2 parents 01d7f3a + a5bff8e commit ed5c9b7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 49 deletions.
55 changes: 34 additions & 21 deletions knack/index.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
/* hide attachment type column (field contents are extracted via JS */
div.view_2107 .field_2403 { display: none; }
div.view_2108 .field_2403 { display: none; }
div.view_2107 .field_2403 {
display: none;
}
div.view_2108 .field_2403 {
display: none;
}
div.view_2565 .field_2403 {
display: none;
}

/* hide attachment type columns (in Traffic Counts), field contents extracted via JS */
div.view_2357 .field_3174 { display: none; }
div.view_2486 .field_3174 { display: none; }
div.view_2357 .field_3174 {
display: none;
}
div.view_2486 .field_3174 {
display: none;
}

/* hide attachment type columns (in Manage Requests under Traffic Counts), field contents extracted via JS */
div.view_2491 .field_3174 { display: none; }
div.view_2491 .field_3174 {
display: none;
}

/* hide attachment type columns (in Request Status under Traffic Counts), field contents extracted via JS */
div.view_2465 .field_3174 { display: none; }
div.view_2465 .field_3174 {
display: none;
}

/* move and style lat/lon fields and button to overlay React app map in View Work Order Details view (scene_1028) */
#lat-lon-form {
Expand Down Expand Up @@ -45,25 +60,23 @@ div.view_2465 .field_3174 { display: none; }
}

.big-button-container {
border-radius: 2px;
box-shadow: 0px 1px 2px 0px gray;
font-size: 2.5em;
padding: 10px;
margin: 20px;
max-width: 16em;
}
border-radius: 2px;
box-shadow: 0px 1px 2px 0px gray;
font-size: 2.5em;
padding: 10px;
margin: 20px;
max-width: 16em;
}

.big-button-container:hover {
background-color: #f7f7f7;
cursor: pointer;
background-color: #f7f7f7;
cursor: pointer;
}



.fa {
vertical-align: middle;
vertical-align: middle;
}



a.big-button {
text-decoration: none;
}
37 changes: 9 additions & 28 deletions knack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ $(document).on("knack-scene-render.any", function() {
changeFieldColor(".field_3265", colorMapOne);
});

$(document).on("knack-view-render.view_2107", function(event, page) {
function replaceAttachmentFilenameWithFileType(fileFieldId, typeFieldId) {
// replace attachment filename with attachment type
// find each attachment cell
$("td.field_2405").each(function() {
$("td." + fileFieldId).each(function() {
// find each attachment link within the cell
$(this)
.find("a")
Expand All @@ -110,7 +110,7 @@ $(document).on("knack-view-render.view_2107", function(event, page) {
// search the neighboring field (attachmenty type) and retrieve the corresponding type
$(this)
.closest("tr")
.children("td.field_2403")
.children("td." + typeFieldId)
.find("span")
.children("span")
.each(function(index2) {
Expand All @@ -123,33 +123,14 @@ $(document).on("knack-view-render.view_2107", function(event, page) {
$(this).html(attachmentType);
});
});
});
}

$(document).on("knack-view-render.view_2108", function(event, page) {
// replace attachment filename with attachment type
// find each attachment cell
$("td.field_2405").each(function() {
// find each attachment link within the cell
$(this)
.find("a")
.each(function(index) {
var attachmentType = "";
$(document).on("knack-view-render.view_2565", function(event, page) {
replaceAttachmentFilenameWithFileType("field_2405", "field_2403");
});

// search the neighboring field (attachmenty type) and retrieve the corresponding type
$(this)
.closest("tr")
.children("td.field_2403")
.find("span")
.children("span")
.each(function(index2) {
if (index == index2) {
attachmentType = $(this).text();
}
});
// update link contents
$(this).html(attachmentType);
});
});
$(document).on("knack-view-render.view_2107", function(event, page) {
replaceAttachmentFilenameWithFileType("field_2405", "field_2403");
});

function modCrumbtrail() {
Expand Down

0 comments on commit ed5c9b7

Please sign in to comment.