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

Add support for big-image #635

Merged
merged 3 commits into from
Jan 17, 2023
Merged

Add support for big-image #635

merged 3 commits into from
Jan 17, 2023

Conversation

lognaturel
Copy link
Contributor

Closes #34

Why is this the best possible solution? Were any other approaches considered?

I tried to follow the implementation for other media types exactly. I didn't consider any alternatives.

I considered not adding big-image to all of the translation tests but I decided it would feel more consistent to do so.

What are the regression risks?

This is an additive change that doesn't touch much existing logic so regression risks are low. There's some possibility of regression with other media types but they're well tested.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

Yes, XLSForm/xlsform.github.io#234

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run nosetests and verified all tests pass
  • run black pyxform tests to format code
  • verified that any code or assets from external sources are properly credited in comments

@lognaturel lognaturel changed the title Big image Add support for big-image Jan 13, 2023
# Guidance hint alone is not OK since they may be hidden by default.
if not any((self.label, self.media, self.hint)) and self.guidance_hint:
raise PyXFormError(msg)

# big-image must combine with image
if not ("image" in self.media) and "big-image" in self.media:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest if "image" not in self.media and "big-image" in self.media

# Guidance hint alone is not OK since they may be hidden by default.
if not any((self.label, self.media, self.hint)) and self.guidance_hint:
raise PyXFormError(msg)

# big-image must combine with image
if not ("image" in self.media) and "big-image" in self.media:
raise PyXFormError("You must specify an image in order to use big-image.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest raise PyXFormError(f"In order to use big-image, you must specify an image for the survey element named {self.name}

Copy link
Contributor

@lindsay-stevens lindsay-stevens left a comment

Choose a reason for hiding this comment

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

LGTM. 2 minor suggestions around validation/message.

@lindsay-stevens
Copy link
Contributor

One other thought, is it fine that the translation test test_missing_translation__one_lang_all_cols__warn__default passes, seeing as the question type is note and there's a big-image specified?

@lognaturel
Copy link
Contributor Author

the question type is note and there's a big-image specified

Yes, this is fine and good! big-image can be used to provide a bigger image either for a question label or for a select choice. A note is a read-only text question and can have the same label types as other question types.

@lognaturel lognaturel merged commit 16b25b5 into XLSForm:master Jan 17, 2023
@lognaturel lognaturel deleted the big-image branch January 17, 2023 19:35
@lognaturel
Copy link
Contributor Author

For posterity/anyone watching who may have opinions, I want to acknowledge that this is the first column with a - in its name, all others use underscore.

I went with it because it matches the underlying XForm spec and is more of a type/variant than the other column headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

big-image and media::big-image column heading for itext tag is not available in XLSForm
2 participants