Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
#411 Exception for checkbox and other oneliners
Browse files Browse the repository at this point in the history
  • Loading branch information
damianprzygodzki committed Apr 25, 2017
1 parent bc4424d commit 185b9d1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/widget/RawWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,11 @@ class RawWidget extends Component {
const widgetBody = this.renderWidget();
const {validStatus} = widgetData[0];

// We have to hardcode that exception in case of having
// wrong two line rendered one line widgets
const oneLineException =
['Switch', 'YesNo', 'Label', 'Button'].indexOf(widgetType) > -1;

// Unsupported widget type
if(!widgetBody){
console.warn(
Expand All @@ -692,7 +697,7 @@ class RawWidget extends Component {
key="title"
className={
'form-control-label ' +
((type === 'primary') ?
((type === 'primary' && !oneLineException) ?
'col-sm-12 panel-title' : 'col-sm-3')
}
title={caption}
Expand All @@ -702,8 +707,9 @@ class RawWidget extends Component {
}
<div
className={
((type === 'primary' || noLabel) ?
'col-sm-12 ' : 'col-sm-9 ') +
(((type === 'primary' || noLabel) &&
!oneLineException ) ?
'col-sm-12 ' : 'col-sm-9 ') +
(fields[0].devices ? 'form-group-flex ': '')
}
onMouseEnter={() => this.handleErrorPopup(true)}
Expand Down

0 comments on commit 185b9d1

Please sign in to comment.