Add property "description" to common options #211
Conversation
@@ -19,6 +19,11 @@ module.exports = { | |||
placeholder: 'Placeholder', | |||
tooltip: 'The placeholder text that will appear when this field is empty.' | |||
}, | |||
description: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you also want to add this to the settings of the component? I like what you have added here. Thanks for your contribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an extra bit of HTML to display the description when rendering a component, it's in my other pull request on the ngFormio repo. formio/ngFormio@321d9a3#diff-cc84655aafd02adf5dd2a91991f14731
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And regarding adding the description to the template of all components, we're overriding the templates ourselves in the project we're using FormIO in, but we could add it in the Display tab of all components in this PR, if that's what you mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would like to see this as part of the standard form builder, so if you can provide a setting within the Display tab.
…nEditable === true
# Conflicts: # src/directives/formBuilderDnd.js
Also added a solution to this issue: #212 |
@@ -31,7 +31,7 @@ module.exports = [ | |||
|
|||
$scope.addComponent = function(component, index) { | |||
// Only edit immediately for components that are not resource comps. | |||
if (component.isNew && (!component.key || (component.key.indexOf('.') === -1))) { | |||
if (component.isNew && !component.isNonEditable && (!component.key || (component.key.indexOf('.') === -1))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like having negatives in variable names. I understand why you did this since you want reverse compatibility, but can we call this variable something like isStatic
, which I suppose could be interpreted as "Configurations are static". I am open to suggestions.
Thanks for your contributions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I was trying to come up with a fix to this issue: #212
I think we could add an "isConfigurable" property to all component that default to true, unless set to false by the person registering the component.
@@ -2925,6 +2925,9 @@ module.exports = ['debounce', function(debounce) { | |||
$scope.formComponents = _.cloneDeep(formioComponents.components); | |||
_.each($scope.formComponents, function(component, key) { | |||
component.settings.isNew = true; | |||
if (!component.settings.hasOwnProperty('isConfigurable')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I default the value to true, if it's not provided by the person registering the component.
@@ -3973,7 +3976,7 @@ app.run([ | |||
}); | |||
|
|||
$templateCache.put('formio/formbuilder/editbuttons.html', | |||
"<div class=\"component-btn-group\">\n <div class=\"btn btn-xxs btn-danger component-settings-button\" style=\"z-index: 1000\" ng-click=\"removeComponent(component, formComponent.confirmRemove)\"><span class=\"glyphicon glyphicon-remove\"></span></div>\n <div ng-if=\"::!hideMoveButton\" class=\"btn btn-xxs btn-default component-settings-button\" style=\"z-index: 1000\"><span class=\"glyphicon glyphicon glyphicon-move\"></span></div>\n <div ng-if=\"::formComponent.views && !component.isNonEditable\" class=\"btn btn-xxs btn-default component-settings-button\" style=\"z-index: 1000\" ng-click=\"editComponent(component)\"><span class=\"glyphicon glyphicon-cog\"></span></div>\n</div>\n" | |||
"<div class=\"component-btn-group\">\n <div class=\"btn btn-xxs btn-danger component-settings-button\" style=\"z-index: 1000\" ng-click=\"removeComponent(component, formComponent.confirmRemove)\"><span class=\"glyphicon glyphicon-remove\"></span></div>\n <div ng-if=\"::!hideMoveButton && component.isConfigurable\" class=\"btn btn-xxs btn-default component-settings-button\" style=\"z-index: 1000\"><span class=\"glyphicon glyphicon glyphicon-move\"></span></div>\n <div ng-if=\"::formComponent.views && !component.isNonEditable\" class=\"btn btn-xxs btn-default component-settings-button\" style=\"z-index: 1000\" ng-click=\"editComponent(component)\"><span class=\"glyphicon glyphicon-cog\"></span></div>\n</div>\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Components with isConfigurable: false
will not have an edit button.
<div ng-if="::!hideMoveButton" class="btn btn-xxs btn-default component-settings-button" style="z-index: 1000"><span class="glyphicon glyphicon glyphicon-move"></span></div> | ||
<div ng-if="::formComponent.views" class="btn btn-xxs btn-default component-settings-button" style="z-index: 1000" ng-click="editComponent(component)"><span class="glyphicon glyphicon-cog"></span></div> | ||
<div ng-if="::!hideMoveButton && component.isConfigurable" class="btn btn-xxs btn-default component-settings-button" style="z-index: 1000"><span class="glyphicon glyphicon glyphicon-move"></span></div> | ||
<div ng-if="::formComponent.views && !component.isNonEditable" class="btn btn-xxs btn-default component-settings-button" style="z-index: 1000" ng-click="editComponent(component)"><span class="glyphicon glyphicon-cog"></span></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be component.isConfigurable
?
I ended up bringing in the Description stuff into the next build, but left out the Thanks! |
Added a property "description" to components.
https://www.dropbox.com/s/qdkahwaoyt9ljuo/Screenshot%202017-01-10%2013.04.32.png?dl=0