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

Afform - Easier layout creation with predefined container styles and built-in title #22975

Merged
merged 6 commits into from
Mar 20, 2022

Conversation

colemanw
Copy link
Member

Overview

This makes layouts easier to make, by adding predefined "Panel Pane" and "Collapsible" styles which can be applied to any container element. It also makes container titles easier to work with, and fixes some issues with saving blocks.

Before

No predefined style for creating a dashboard dashlet or collapsible fieldset.

After

Any container can be given a title and styled as a panel pane and/or collapsible:

image

This gives a nice-looking dashboard:

image

@civibot
Copy link

civibot bot commented Mar 18, 2022

(Standard links)

@civibot civibot bot added the master label Mar 18, 2022
@colemanw
Copy link
Member Author

@eileenmcnaughton to avoid merge-conflicts I included the commit from #22963 in this PR, but we should merge that one first and I can rebase it out of this.

@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Mar 19, 2022

I had this loading when documenting here - https://lab.civicrm.org/documentation/docs/user-en/-/merge_requests/549/diffs - so it worked

One weird thing I noticed is how the label looks when the style is inline

With the pr
image

Without - note I didn't re-configure the afform - afform content below

image

<af-form ctrl="afform">
  <af-entity data="{source_contact_id: 'user_contact_id', activity_type_id: '2', status_id: '1'}" type="Activity" name="Activity1" label="Schedule call" actions="{create: true, update: true}" security="RBAC" />
  <fieldset af-fieldset="Activity1">
    <div class="af-markup" style="background-color: #e1e4f4; border: 1px outset #000000">
      
      
      <p><strong>Example of adding text content</strong></p>

    
    
    </div>
    <div class="af-container af-collapsible af-container-style-pane af-layout-cols" af-title="My container ttit" style="background-color: #f7d4d4; border: 1px groove #000000">
      <af-field name="assignee_contact_id" />
      <af-field name="target_contact_id" defn="{input_type: 'Select', input_attrs: {}}" />
      <af-field name="subject" defn="{input_attrs: {placeholder: 'kkkd'}}" />
    </div>
    <af-field name="details" />
  </fieldset>
  <button class="af-button btn btn-primary" crm-icon="fa-check" ng-click="afform.submit()">Submit</button>
</af-form>

Also - in greenwitch theme - I found it hard to tell which of the layout options is selected - the grey vs grey wasn't clear to me (that is probably pr-exisiting)

image

…n css

Now this widget supports having a `placeholder`.
Also gave it its own css instead of piggybacking off crm-editable classes,
as that was a bit messy and Shoreditch was applying some extra stuff which
then had to be undone.
Before: A fieldset `<legend>` was treated as its own element. This was more flexible but more complex.
After: Augenerated `<legend> for fieldsets or `<h4>` for other containers based on new `af-title` directive.

This allows central control of titles for e.g. collapsible styles.
Fixes dev/core#3110
Adds a predefined "Panel Pane" style, for creating dashboards.
@colemanw
Copy link
Member Author

Thanks @eileenmcnaughton I've rebased this PR now that #22963 is merged and also fixed the titles for inline/column layouts.

@eileenmcnaughton
Copy link
Contributor

OK - that looks better!

@eileenmcnaughton eileenmcnaughton merged commit 7ae979d into civicrm:master Mar 20, 2022
@eileenmcnaughton eileenmcnaughton deleted the afformLayout2 branch March 20, 2022 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants