Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Add property "description" to common options #211

Closed
wants to merge 10 commits into from

Conversation

AbdallaElabd
Copy link
Contributor

@@ -19,6 +19,11 @@ module.exports = {
placeholder: 'Placeholder',
tooltip: 'The placeholder text that will appear when this field is empty.'
},
description: {
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

Copy link
Member

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.

@AbdallaElabd
Copy link
Contributor Author

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))) {
Copy link
Member

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.

Copy link
Contributor Author

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')) {
Copy link
Contributor Author

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"
Copy link
Contributor Author

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>
Copy link
Member

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?

@travist
Copy link
Member

travist commented Jan 16, 2017

I ended up bringing in the Description stuff into the next build, but left out the isConfigurable due to the risk. Please create a separate PR that includes just this capability.

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants