Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added field descriptions and placeholders in Add API fields #3512

Merged
merged 10 commits into from
Jun 20, 2018

Conversation

Nazarah
Copy link
Contributor

@Nazarah Nazarah commented Jun 14, 2018

Closes #3403

Changes

  1. i18n.json: added templates addApi_nameFieldInfo, addApi_descriptionFieldInfo and addApi_urlFieldInfo which describe purpose of name, description and URL fields (respectively) in Add API page.

  2. i18n.json: added template addApi_ownerHelpText that describes where an added API appears with what visibility.

  3. schema.json: added placeholder values under autoform attribute for Name, Description and URL fields.

  4. add.html: added templates texts describing the purpose of name, description and url fields.

  5. add.html: added template text describing where added API appears with what visibility.

  6. add.less: added new css class field-description-text to style field description texts.

Developer checklist

This checklist is to be completed by the PR developer:

  • Alternative solutions were compared/discussed before writing code
    • trade-offs with this solution are considered acceptable
  • Code in this PR adheres to the project styleguide
  • This pull request does not decrease project test coverage
  • If the code changes existing database collection(s), migration has been written
  • If UI texts are added or changed, all texts are internationalized

Reviewer checklist

Reviewed by: @username1

This list is to be completed by the pull request reviewer:

  • Code works as described/expected
  • Code seems to be error free
    • no browser console errors visible
    • no server console errors visible
    • passes CI build
  • Code is written in a way that promotes maintainability
    • easy to understand
    • well organized
    • follows project coding standards and conventions
    • well documented

1. i18n.json: added templates addApi_nameFieldInfo, addApi_descriptionFieldInfo and addApi_urlFieldInfo which describe purpose of name, description and URL fields (respectively) in Add API page.

2. i18n.json: added template addApi_ownerHelpText that describes where an added API appears with what visibility.

3. add.html: added placeholders for fields name, description and url

4. add.html: added templates texts describing purpose of name, description and URL fields.

5. add.html: added template text describing where added API appears with what visibility.

6. add.less: added new css class field-description-text to style field description texts.

7. add.js: added constant variables to compare placeholder values from name, description and URL fields in add API page.

8. Added event listeners for click and blur events in name, description and url fields in Add API page.
@ghost ghost assigned Nazarah Jun 14, 2018
@ghost ghost added the in progress label Jun 14, 2018
Nazarah added 6 commits June 18, 2018 12:37
1. add.js: added extra space before opening parenthesis in functions

2. add.js: removed unusued variable "event" from functions.

3. add.js: used '' instead "" for strings.

4. add.js and add.html: changed placeholder string to make it smaler in order to accommodate travis build passing.
1. add.js and add.html: changed placeholder message for description field.
1. add.js and add.html: changed placeholder string for description field
add.js: added value of apiDescriptionFieldValue within tild symbols instead single quotes.
1. add.js: removed trailing spaces in line 20 and 21
add.js: removed trailing space from line 21:49
Nazarah added 2 commits June 18, 2018 16:17
1. schema.js: added placeholder values for fields Name, Description and URL

2. add.html: removed placeholder values for Name, Description and URL from fieldsets

3. add.js: removed variables containing placeholder values for Name, Description and URL

4. Removed redundant event handlers for click and blur events in Name, Description and URL.
1. schema.js: added quotes within single quotes instead double quotes.

2. schema.js: reduced characters in a single line within 100 in placeholder values.
schema.js: added quotes within '' instead "" in line 41.
@matleppa
Copy link
Member

I'd suggest the description texts to be moved above the input field in order to keep them visible also in case the browser generates and adds a drop-down menu into input field.
An example added into issue 3403.

@matleppa matleppa changed the title field descriptions and placeholders in Add API fields Added field descriptions and placeholders in Add API fields Jun 20, 2018
@55
Copy link
Contributor

55 commented Jun 20, 2018

@matleppa let's not do it. Ecstatically it looks better as it's now. Help text != description (which has to go after title).

@Nazarah
Copy link
Contributor Author

Nazarah commented Jun 20, 2018

@matleppa before adding the templates to show help texts, the code used to be like the following:

{{# autoForm collection=ApisCollection id="addApiForm" type="insert" }}
          <!--invisible auto-value field-->
          {{> afQuickField name='latestMonitoringStatusCode' value="-1" type="hidden"}}
          <fieldset>
            {{> afQuickField name='name' id="api-name" }}
            {{> afQuickField name='description' rows=2 id="api-description" }}
            {{> afQuickField name='url' id="api-url" }}
            {{> afQuickField name='lifecycleStatus' id="api-lifecyclestatus" }}
          </fieldset>
          <button type="submit" class="btn btn-primary" id="submitapi-button">
            {{_ 'addApi_button_text' }}
          </button>
        {{/ autoForm }}

It means the fields are being populated using the Autoform package.
Also each individual field is defined using {{> afQuickField }} helpers.
For this reason, I was unable to find a way to display the help text between the input label and input field.
As an alternative solution, I added the description text for each field below the input field with by creating a new class .field-description-text in add.less

@matleppa
Copy link
Member

@55 OK, we can call it help text instead of description.
I think that helping user has a priority over aesthetic values.

It seems that in this very case there are some challenges because of use of afQuickField.

Copy link
Member

@matleppa matleppa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected.

@matleppa matleppa merged commit 820a198 into develop Jun 20, 2018
@ghost ghost removed the Ready for review label Jun 20, 2018
@matleppa matleppa deleted the feature/add-description-in-fields-under-addAPI-page branch June 20, 2018 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants