I have a requirement where a user is allowed to add a single type of widget
in an area
which should layout in the form of a grid. The widget itself contains a value which determines its width by using bootstrap
classes. Here is the widget definition
// lib/modules/grid-item-widget/index.js
module.exports={
extend: 'apostrophe-widgets',
label: 'Grid Item',
addFields: [
{
name: 'grid',
type: 'select',
choices:[
{label:'10%',value:'col-md-2'}
,{label:'30%',value:'col-md-3'}
,{label:'50%',value:'col-md-6'}
,{label:'70%',value:'col-md-8'}
,{label:'100%',value:'col-md-12'}
]
},
{
name: 'image',
type: 'singleton',
label: 'Presentation Image',
widgetType: 'apostrophe-images',
options: {
limit: 1
}
}
]
};
and this is the html
//lib/modules/grid-item-widget/views/widget.html
<div class="col-xs-12 col-md-{{ data.widget.grid }}">
{{
apos.singleton(data.widget,'image','apostrophe-images',{edit:false})
}}
</div>
The problem is that there is a lot of markup which contains the apos-ui elements as part of the area item. And I want to make these columns part of the area wrappers markup, so that the elements can float on the page properly along with the apos-ui controls.
What happens at the moment is that the user experience is not very intuitive since the apos-ui controls just overlap over each other.