Skip to content

Commit

Permalink
Merge pull request #33838 from dimagi/rc/adjust-input-size
Browse files Browse the repository at this point in the history
Rc/adjust input size
  • Loading branch information
Robert-Costello authored Dec 5, 2023
2 parents 91bb602 + 15e3777 commit 1df6804
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions corehq/apps/cloudcare/static/cloudcare/js/form_entry/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ hqDefine("cloudcare/js/form_entry/const", function () {
TEXT_ALIGN_CENTER: 'text-align-center',
TEXT_ALIGN_RIGHT: 'text-align-right',
BUTTON_SELECT: 'button-select',
SHORT: 'short',
MEDIUM: 'medium',

// Note it's important to differentiate these two
NO_PENDING_ANSWER: undefined,
Expand All @@ -52,6 +54,8 @@ hqDefine("cloudcare/js/form_entry/const", function () {
BLOCK_SUBMIT: 'block-submit',
BLOCK_ALL: 'block-all',
FULL_WIDTH: 'col-sm-12',
SHORT_WIDTH: 'col-sm-2',
MEDIUM_WIDTH: 'col-sm-4',

// XForm Navigation
QUESTIONS_FOR_INDEX: 'questions_for_index',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ hqDefine("cloudcare/js/form_entry/form_ui", function () {
};

Question.prototype.setWidths = function () {
const self = this;
const columnWidth = Question.calculateColumnWidthForPerRowStyle(this.style);
const perRowPattern = new RegExp(`\\d+${constants.PER_ROW}(\\s|$)`);

Expand All @@ -872,6 +873,12 @@ hqDefine("cloudcare/js/form_entry/form_ui", function () {
this.labelWidth = constants.LABEL_WIDTH;
this.questionTileWidth = constants.FULL_WIDTH;
}

if (self.stylesContains(constants.SHORT)) {
self.controlWidth = constants.SHORT_WIDTH;
} else if (self.stylesContains(constants.MEDIUM)) {
self.controlWidth = constants.MEDIUM_WIDTH;
}
};

/**
Expand Down

0 comments on commit 1df6804

Please sign in to comment.