Skip to content
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

Added custom field option to view assets #12096

Merged
merged 14 commits into from
Nov 14, 2022

Conversation

snipe
Copy link
Owner

@snipe snipe commented Nov 10, 2022

This PR allows you to set the visibility on a custom field for the user with that asset checked out to them when they go to View Assigned Assets in their profile section.

Screen Shot 2022-11-10 at 5 45 41 PM

Screen Shot 2022-11-10 at 5 45 59 PM

This also adds a new column to the custom fields interface to show whether the field is displayed to the user or not.

Note: This does NOT currently display fields that are encrypted and doesn't currently handle any fancy formatting like dates, etc.

Signed-off-by: snipe <snipe@snipe.net>
…needed

Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
…_in_user_view column

Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
@what-the-diff
Copy link

what-the-diff bot commented Nov 10, 2022

  • Added a new column to the custom_fields table called display_in_user_view
  • Updated CustomFieldsController, ViewAssetsController and CustomFieldsTransformer with logic for this field
  • Created migration file 2022-11-07 134348 add display to user in custom fields php which adds the new column to the database
  • Updated general lang files with translations for this feature (en/admin/custom fields)
  • Added sortable to the table headers
  • Moved email column from 3rd position to 8th position
  • Changed order of columns in thead and tbody tags for consistency with each other, as well as added a new visible/hidden column between unique and db_field (display_in_user) view
  • Removed unnecessary tag around "Visible To User" text since it is already hidden by default on small screens using Bootstrap's responsive utility classes

@brianhoganm
Copy link

brianhoganm commented Nov 10, 2022 via email

@brianhoganm
Copy link

brianhoganm commented Nov 10, 2022 via email

Signed-off-by: snipe <snipe@snipe.net>
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it could be a really handy feature, and I do like the code cleanup as well. I had one small concern, but I'm not sure I'm correct on that one. Anyways, nice work, and thank you!

@@ -206,11 +217,13 @@
$('#field_encrypted').on('ifChecked', function(event){
$("#encrypt_warning").show();
$("#show_in_email").hide();
$("#display_in_user_view").hide();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we also need to enforce that these settings are forced to be set to zero when the field is encrypted.

My concern is - let's say you are creating a custom field, and you click 'show in email' and 'display in user view'. Then you click 'encrypt' - will it save 'show in email' as 1 still, even though the field is hidden? I'm not exactly sure.

app/Http/Controllers/CustomFieldsController.php Outdated Show resolved Hide resolved
Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe requested a review from uberbrady November 14, 2022 22:42
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, love it! Thank you!

@snipe
Copy link
Owner Author

snipe commented Nov 14, 2022

After they click on the location they can't view anything. I would love it
if they can view the current location. This would be AMAZING!!! I think if
there was a policy to allow users to view current locations would be very
beneficial.

That sounds like a different issue - it really just shouldn't be linked. A regular user shouldn't be able to see locations.

@snipe snipe merged commit 8122236 into develop Nov 14, 2022
@snipe snipe deleted the features/add_custom_field_option_to_view_assets branch November 14, 2022 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants