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

SearchKit - POC help text #24819

Merged
merged 2 commits into from
Mar 13, 2023
Merged

SearchKit - POC help text #24819

merged 2 commits into from
Mar 13, 2023

Conversation

colemanw
Copy link
Member

Overview

This gives a little nudge to https://lab.civicrm.org/dev/user-interface/-/issues/49 with some examples of how to add help text in SearchKit.

Before

No help

After

image

Comments

@shaneonabike has asked how to do this. This PR gets the process started and hopefully makes it easy to add more.
To add more help text, simply add more to one of the two .hlp files I've added, and then add a new <a crm-ui-help... to an angular .html file.

@civibot
Copy link

civibot bot commented Oct 25, 2022

(Standard links)

@civibot civibot bot added the master label Oct 25, 2022
@yashodha
Copy link
Contributor

@colemanw You might want to resolve the conflicts and push again for this.

@colemanw
Copy link
Member Author

Done.
What do you think @shaneonabike are you up for adding to this?

@colemanw
Copy link
Member Author

retest this please

@shaneonabike
Copy link
Contributor

Hi @colemanw

I don't mind creating a merge to make this happen, but it's going to have to wait a few weeks b/c I'm a little in the crunch with several clients presently. Is that going to work with your flow?

@colemanw
Copy link
Member Author

colemanw commented Nov 1, 2022

That's fine @shaneonabike when you get some time it would be appreciated.

@shaneonabike
Copy link
Contributor

@colemanw Ok I took at the changes needed but I'm still a bit confused. I see with your patch we need to append the text and things. How can we roll a patch together? Do you just need me to apply your patch to my core, then build out the extra stuff and you'll cherry pick those changes to put into a new patch...

@colemanw
Copy link
Member Author

@shaneonabike I've just rebased this so it's nice and fresh. Now you could check out this branch locally, make some commits, and then submit a PR to this PR :)

@shaneonabike
Copy link
Contributor

I'm not an admin so I don't think I can directly edit your PR. Anyway, I checked out your branch and then added the items. Here's the patch relatively if you want to just drop it into your code. I think that I added it in the same context that you did, but I can't be 100% sure.

diff --git a/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html b/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html
index 16ea194e8c..3714137f3b 100644
--- a/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html
+++ b/ext/search_kit/ang/crmSearchAdmin/displays/colType/field.html
@@ -36,6 +36,7 @@
     <input type="checkbox" ng-checked="col.empty_value" ng-click="$ctrl.parent.toggleEmptyVal(col)" >
     {{:: ts('Empty placeholder') }}
   </label>
+  <a crm-ui-help="hs({id: 'empty', title: ts('Empty placeholder')})"></a>
   <textarea rows="2" class="form-control crm-flex-1" ng-if="col.empty_value" ng-model="col.empty_value" ng-model-options="{updateOn: 'blur'}"></textarea>
   <crm-search-admin-token-select ng-if="col.empty_value" model="col" field="empty_value" suffix=":label"></crm-search-admin-token-select>
 </div>
diff --git a/ext/search_kit/ang/crmSearchAdmin/displays/colType/html.html b/ext/search_kit/ang/crmSearchAdmin/displays/colType/html.html
index 609f296b92..518918f79d 100644
--- a/ext/search_kit/ang/crmSearchAdmin/displays/colType/html.html
+++ b/ext/search_kit/ang/crmSearchAdmin/displays/colType/html.html
@@ -17,6 +17,7 @@
     <input type="checkbox" ng-checked="col.empty_value" ng-click="$ctrl.parent.toggleEmptyVal(col)" >
     {{:: ts('Empty placeholder') }}
   </label>
+  <a crm-ui-help="hs({id: 'empty', title: ts('Empty placeholder')})"></a>
   <textarea rows="2" class="form-control crm-flex-1" ng-if="col.empty_value" ng-model="col.empty_value" ng-model-options="{updateOn: 'blur'}"></textarea>
   <crm-search-admin-token-select ng-if="col.empty_value" model="col" field="empty_value" suffix=":label"></crm-search-admin-token-select>
 </div>
diff --git a/ext/search_kit/templates/CRM/Search/Help/Display.hlp b/ext/search_kit/templates/CRM/Search/Help/Display.hlp
index 71ca83e60f..528fb70cb4 100644
--- a/ext/search_kit/templates/CRM/Search/Help/Display.hlp
+++ b/ext/search_kit/templates/CRM/Search/Help/Display.hlp
@@ -1,3 +1,7 @@
 {htxt id="rewrite"}
   <p>{ts}Both search tokens and smarty tags are supported when rewriting fields.{/ts}</p>
+  <p>{ts}SMARTY conditions can be used by placing quotations around the values that should be evaluated.{/ts}</p>
+{/htxt}
+{htxt id="empty"}
+  <p>{ts}SMARTY conditions can be used by placing quotations around the values that should be evaluated.{/ts}</p>
 {/htxt}


Copy link
Contributor

@kurund kurund left a comment

Choose a reason for hiding this comment

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

@colemanw

This looks good, working as expected and ready to merge once below items are done.

@colemanw
Copy link
Member Author

Ok FYI @shaneonabike since a PR is just a branch you can actually checkout the PR branch, make a commit and then submit a PR to the PR!
But I've applied your patch & will merge what we've got.
If you want to add more help text please feel free.

@colemanw colemanw merged commit 14dc5a3 into civicrm:master Mar 13, 2023
@colemanw colemanw deleted the searchKitHelp branch March 13, 2023 15:32
@shaneonabike
Copy link
Contributor

Hey @colemanw ahhh I tried to checkout and commit to your branch not branch your branch darn. Ok next time.

Anyway, I'll see after it's live if there other things and make another merge! Hoooray more progress

👍

@colemanw
Copy link
Member Author

@shaneonabike

ahhh I tried to checkout and commit to your branch not branch your branch darn. Ok next time.

That's the idea, you can checkout and commit to my branch, then push the branch to your own fork and make a PR against my PR :)

Anyway, I'll see after it's live if there other things and make another merge! Hoooray more progress

It's merged now, so yes please feel free to do a followup PR. Thanks!

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

Successfully merging this pull request may close these issues.

4 participants