civicrm-core.git
3 years agoRefactor af-block directive into af-repeat and af-join
Coleman Watts [Fri, 27 Dec 2019 19:55:49 +0000 (14:55 -0500)]
Refactor af-block directive into af-repeat and af-join

This allows mix-n-match between blocks and repeatable things, allowing
entity fieldsets to be repeated, as well as arbitrary non-repeatable blocks.

3 years agoImplement afform blocks for multi-value custom groups
Coleman Watts [Fri, 20 Dec 2019 20:47:02 +0000 (15:47 -0500)]
Implement afform blocks for multi-value custom groups

3 years agoImplement afform blocks for Email, Phone, IM, Website
Coleman Watts [Tue, 10 Dec 2019 20:03:42 +0000 (15:03 -0500)]
Implement afform blocks for Email, Phone, IM, Website

Blocks are reusable, repeatable afforms that extend other entities

3 years agoUpdate git clone url
eileen [Thu, 2 Jan 2020 18:57:18 +0000 (18:57 +0000)]
Update git clone url

Note other updates around installation still needed

3 years agoFix #10 add prefix to new afforms to prevent name conflicts
Coleman Watts [Sat, 28 Dec 2019 01:23:30 +0000 (20:23 -0500)]
Fix #10 add prefix to new afforms to prevent name conflicts

3 years agoRemove unnecessary registerField process
Coleman Watts [Sun, 22 Dec 2019 01:10:49 +0000 (20:10 -0500)]
Remove unnecessary registerField process

3 years agoGUI - set default permission for new forms
Coleman Watts [Sat, 21 Dec 2019 00:51:51 +0000 (19:51 -0500)]
GUI - set default permission for new forms

3 years agoUpdate docs to reflect less metadata in default afform scope
Coleman Watts [Fri, 20 Dec 2019 12:18:45 +0000 (07:18 -0500)]
Update docs to reflect less metadata in default afform scope

3 years agoAfformScanner - Just use the long cache
Tim Otten [Fri, 20 Dec 2019 07:53:13 +0000 (23:53 -0800)]
AfformScanner - Just use the long cache

The long cache didn't exist when this class was first created, but it seems
better suited. #knockonwood

3 years agoAfformScanner - Simplify cache. Fix CLI/web sync bug.
Tim Otten [Fri, 20 Dec 2019 07:41:10 +0000 (23:41 -0800)]
AfformScanner - Simplify cache. Fix CLI/web sync bug.

Example bug:

1. Find a packaged (non-overriden) form - e.g. `mockPage`
2. Run `cv api4 Afform.update +w name=mockPage +v permissions='*always allow*'
3. Run `curl http://localhost/civicrm/mock-page`
4. Observe: the page-load fails even though the permissions say it should work

The call to `Afform.update` should trigger a cache-clear, but it only fixes
on the CLI...  because the CLI and web have different runtime IDs.

The runtime-id was included preventively in anticipation that oddball
multisite arrangements might need to store these things separately.  But I
think it's overdone, because the runtime-ID factors in things like
`SCRIPT_FILENAME` which has no bearing on the whether to use the same cache.

Let's KISS and *if* there's any kind of multisite issue, then we can revisit.

3 years agoToward #6 - use API instead of scanner to retrieve afforms
Coleman Watts [Fri, 20 Dec 2019 02:24:08 +0000 (21:24 -0500)]
Toward #6 - use API instead of scanner to retrieve afforms

3 years agoGUI - dropdown select for permissions field
Coleman Watts [Thu, 19 Dec 2019 13:28:58 +0000 (08:28 -0500)]
GUI - dropdown select for permissions field

3 years ago(NFC) Expand docblock for afform_civicrm_permission_check()
Tim Otten [Thu, 19 Dec 2019 06:47:10 +0000 (22:47 -0800)]
(NFC) Expand docblock for afform_civicrm_permission_check()

3 years agoafform_{html,gui} - Allow editing the `permission` via web UI
Tim Otten [Thu, 19 Dec 2019 04:23:41 +0000 (20:23 -0800)]
afform_{html,gui} - Allow editing the `permission` via web UI

3 years agoafform_{html,gui} - Require "administer CiviCRM" to open editor
Tim Otten [Thu, 19 Dec 2019 04:23:14 +0000 (20:23 -0800)]
afform_{html,gui} - Require "administer CiviCRM" to open editor

3 years ago(REF) AfformSaveTrait - Extract helper $isChanged
Tim Otten [Thu, 19 Dec 2019 04:12:54 +0000 (20:12 -0800)]
(REF) AfformSaveTrait - Extract helper $isChanged

I was originally expecting to need to flush the menu whenever the
`permission` changed.  That's not necessary now (because the true permission
check is deferred until it's needed), but the cleanup may still be helpful
in the future (e.g.  if we enable nav-menu integration or change the way
permissions are implemented).

3 years agoAfform.{prefill,submit} - APIs should respect `permission`
Tim Otten [Thu, 19 Dec 2019 05:43:05 +0000 (21:43 -0800)]
Afform.{prefill,submit} - APIs should respect `permission`

3 years agoAfformUsageTest - Add a basic test case of prefill/submit APIs
Tim Otten [Thu, 19 Dec 2019 05:42:24 +0000 (21:42 -0800)]
AfformUsageTest - Add a basic test case of prefill/submit APIs

3 years agoEnforce customizable `permission` for server routes. Add E2E test for server-routes.
Tim Otten [Thu, 19 Dec 2019 04:11:52 +0000 (20:11 -0800)]
Enforce customizable `permission` for server routes. Add E2E test for server-routes.

3 years agoAfform.get - Fix warning/test-failure when trying to load non-existent record
Tim Otten [Thu, 19 Dec 2019 04:56:49 +0000 (20:56 -0800)]
Afform.get - Fix warning/test-failure when trying to load non-existent record

3 years agoafform_mock - The extra dep should be a real module
Tim Otten [Thu, 19 Dec 2019 03:03:53 +0000 (19:03 -0800)]
afform_mock - The extra dep should be a real module

Using a real Angular module means that the page can be opened in an E2E test.

3 years agoStore 'permission' property for each form
Tim Otten [Thu, 19 Dec 2019 01:59:46 +0000 (17:59 -0800)]
Store 'permission' property for each form

3 years agoinfo.xml - Bump minimum version. Needs revised hook_civicrm_angularModules.
Tim Otten [Thu, 12 Dec 2019 23:58:29 +0000 (15:58 -0800)]
info.xml - Bump minimum version. Needs revised hook_civicrm_angularModules.

3 years agoGenerate partials via callback
Tim Otten [Thu, 12 Dec 2019 23:48:42 +0000 (15:48 -0800)]
Generate partials via callback

Technically, it's two changes:

1. Changing `snippets` to `partialsCallback` to reduce the amount of upfront IO/memory.
2. Changing the mocked-up filename to start with `~/theAngModule/`. So modules implemented in
   afform look more look other modules. Makes it work with `cv ang:html:list` and `cv ang:html:show`.

3 years agoRename modelListCtrl => afform
Coleman Watts [Thu, 12 Dec 2019 13:14:03 +0000 (08:14 -0500)]
Rename modelListCtrl => afform

3 years agoFix afform partial name
Coleman Watts [Wed, 11 Dec 2019 03:22:03 +0000 (22:22 -0500)]
Fix afform partial name

ng-include was failing with ~afform* but works with ~/afform*

3 years agoUse dynamic snippet for afform module layout.
Coleman Watts [Wed, 11 Dec 2019 03:01:16 +0000 (22:01 -0500)]
Use dynamic snippet for afform module layout.

3 years agoRemove redundant afformStandalone file
Coleman Watts [Wed, 11 Dec 2019 14:44:23 +0000 (09:44 -0500)]
Remove redundant afformStandalone file

3 years agoMerge afField module into af module
Coleman Watts [Wed, 11 Dec 2019 14:38:50 +0000 (09:38 -0500)]
Merge afField module into af module

3 years agoGUI - Add option to hide field labels
Coleman Watts [Wed, 11 Dec 2019 14:05:21 +0000 (09:05 -0500)]
GUI - Add option to hide field labels

3 years agoafform_gui - Tweak nav label
Tim Otten [Tue, 10 Dec 2019 21:07:35 +0000 (13:07 -0800)]
afform_gui - Tweak nav label

3 years agoFix ngRepeat syntax error
Coleman Watts [Tue, 10 Dec 2019 20:10:49 +0000 (15:10 -0500)]
Fix ngRepeat syntax error

3 years agoafform_gui, afform_html - Refresh after reverting
Tim Otten [Tue, 10 Dec 2019 06:21:04 +0000 (22:21 -0800)]
afform_gui, afform_html - Refresh after reverting

3 years agoafform_gui, afform_html - Adjust "Revert" button based on actual status
Tim Otten [Tue, 10 Dec 2019 06:12:01 +0000 (22:12 -0800)]
afform_gui, afform_html - Adjust "Revert" button based on actual status

3 years agoAfform.get - Return computed fields, `has_local` and `has_packaged`
Tim Otten [Tue, 10 Dec 2019 06:05:10 +0000 (22:05 -0800)]
Afform.get - Return computed fields, `has_local` and `has_packaged`

3 years agoafform_gui - Add nav item under "Administer => Customize Data and Screens"
Tim Otten [Tue, 10 Dec 2019 05:01:32 +0000 (21:01 -0800)]
afform_gui - Add nav item under "Administer => Customize Data and Screens"

3 years agoafform_gui - Add skeletal upgrader
Tim Otten [Tue, 10 Dec 2019 04:58:33 +0000 (20:58 -0800)]
afform_gui - Add skeletal upgrader

3 years agoStricter directives with better docs
Coleman Watts [Mon, 9 Dec 2019 15:49:02 +0000 (10:49 -0500)]
Stricter directives with better docs

3 years agoGUI - Rename af-block => af-container
Coleman Watts [Mon, 9 Dec 2019 13:13:30 +0000 (08:13 -0500)]
GUI - Rename af-block => af-container

Free up the term af-block to refer to something more specific than a container.

3 years agoPrettier json
Coleman Watts [Sat, 7 Dec 2019 20:29:17 +0000 (15:29 -0500)]
Prettier json

3 years agoFix handling of non-breaking spaces
Coleman Watts [Tue, 3 Dec 2019 18:04:13 +0000 (13:04 -0500)]
Fix handling of non-breaking spaces

See https://stackoverflow.com/questions/59215211/why-does-domdocument-mess-up-unicode-nonbreaking-spaces

3 years agoIn shallow mode, only convert markup to array that the GUI editor understands.
Coleman Watts [Sat, 30 Nov 2019 15:52:33 +0000 (10:52 -0500)]
In shallow mode, only convert markup to array that the GUI editor understands.

Any markup not using a tag/class/attribute understood by the GUI editor
will have its contents preserved "as-is" in a "#markup" string.

3 years agoAdd api/v4/formatExamples/stylized.php
Tim Otten [Thu, 28 Nov 2019 02:08:44 +0000 (18:08 -0800)]
Add api/v4/formatExamples/stylized.php

3 years agoFormat whitespace in aff.html files
Coleman Watts [Wed, 27 Nov 2019 14:42:22 +0000 (09:42 -0500)]
Format whitespace in aff.html files

Adds api options for use in GUI editor to autoformat html whitespace.
Results in much nicer looking markup!

3 years agoAfformTest - Add coverage for weirdly named file.
Tim Otten [Thu, 28 Nov 2019 01:45:19 +0000 (17:45 -0800)]
AfformTest - Add coverage for weirdly named file.

Also: Clarify that the API input is a formName and not strictly a
directiveName.

3 years agoApi improvements and test fix
Coleman Watts [Tue, 26 Nov 2019 18:33:53 +0000 (13:33 -0500)]
Api improvements and test fix

Improve efficiency by not fetching layout if not needed in api.get
Fix test failure by correctly merging existing metadata during update

3 years agoRemove client_route for now; might be yagni
Coleman Watts [Tue, 26 Nov 2019 17:27:46 +0000 (12:27 -0500)]
Remove client_route for now; might be yagni

3 years agoUse canonical name in api.afform.get
Coleman Watts [Tue, 26 Nov 2019 14:39:23 +0000 (09:39 -0500)]
Use canonical name in api.afform.get

Names were being munged in the api which led to a mismatch between
filenames and afform names.

3 years agoGUI: Correctly handle naming a newly created form
Coleman Watts [Tue, 26 Nov 2019 14:13:49 +0000 (09:13 -0500)]
GUI: Correctly handle naming a newly created form

3 years agoGUI: Add new block to the top
Coleman Watts [Mon, 25 Nov 2019 14:56:25 +0000 (09:56 -0500)]
GUI: Add new block to the top

Creates new items at top of block, underneath the fieldset legend if present

3 years agoGUI: Add wysiwyg markup block
Coleman Watts [Mon, 25 Nov 2019 00:52:40 +0000 (19:52 -0500)]
GUI: Add wysiwyg markup block

3 years agoDisplay improvements
Coleman Watts [Fri, 22 Nov 2019 17:49:17 +0000 (12:49 -0500)]
Display improvements

3 years agoGUI: Improve adding/removing entities in correct order
Coleman Watts [Thu, 21 Nov 2019 22:11:37 +0000 (17:11 -0500)]
GUI: Improve adding/removing entities in correct order

3 years agoGUI: use strict
Coleman Watts [Tue, 19 Nov 2019 21:22:02 +0000 (16:22 -0500)]
GUI: use strict

3 years agoGUI: Fix entity values selector
Coleman Watts [Tue, 19 Nov 2019 21:05:12 +0000 (16:05 -0500)]
GUI: Fix entity values selector

3 years agoGUI: Better widget for editing input type select
Coleman Watts [Tue, 19 Nov 2019 14:50:09 +0000 (09:50 -0500)]
GUI: Better widget for editing input type select

3 years agoGUI Add controls for text color, block border & block background color
Coleman Watts [Tue, 19 Nov 2019 13:42:51 +0000 (08:42 -0500)]
GUI Add controls for text color, block border & block background color

3 years agoGUI: Cleanup menus
Coleman Watts [Mon, 18 Nov 2019 13:22:37 +0000 (08:22 -0500)]
GUI: Cleanup menus

3 years agoGUI Validate drag-n-drop actions
Coleman Watts [Sun, 17 Nov 2019 15:19:12 +0000 (10:19 -0500)]
GUI Validate drag-n-drop actions

Prevent fields from being moved outside their entity fieldset(s)
Prevent fieldsets from being dragged into other fieldsets

3 years agoGUI Fix number field style
Coleman Watts [Sun, 17 Nov 2019 15:17:48 +0000 (10:17 -0500)]
GUI Fix number field style

3 years agoEdit option lists
Coleman Watts [Thu, 14 Nov 2019 19:07:37 +0000 (14:07 -0500)]
Edit option lists

3 years agoGUI: Config fields
Coleman Watts [Tue, 12 Nov 2019 21:58:55 +0000 (16:58 -0500)]
GUI: Config fields

3 years agoPerform deep merge on fieldDefn.input_attrs
Coleman Watts [Wed, 13 Nov 2019 15:28:00 +0000 (10:28 -0500)]
Perform deep merge on fieldDefn.input_attrs

3 years agoCore: Set breadcrumb as well as title
Coleman Watts [Tue, 12 Nov 2019 12:30:54 +0000 (07:30 -0500)]
Core: Set breadcrumb as well as title

3 years agoGUI: Entity config
Coleman Watts [Tue, 12 Nov 2019 03:20:12 +0000 (22:20 -0500)]
GUI: Entity config

3 years agoGUI: Entity tab style improvements
Coleman Watts [Sat, 9 Nov 2019 14:07:14 +0000 (09:07 -0500)]
GUI: Entity tab style improvements

3 years agoGUI: Add/remove block buttons
Coleman Watts [Fri, 8 Nov 2019 18:04:21 +0000 (13:04 -0500)]
GUI: Add/remove block buttons

3 years agoGUI: Refactor entity panel to directive & add field search
Coleman Watts [Fri, 8 Nov 2019 15:03:28 +0000 (10:03 -0500)]
GUI: Refactor entity panel to directive & add field search

3 years agoGUI configure form buttons
Coleman Watts [Thu, 7 Nov 2019 16:41:08 +0000 (11:41 -0500)]
GUI configure form buttons

3 years agoDon't write field defn unless changed
Coleman Watts [Thu, 7 Nov 2019 00:07:20 +0000 (19:07 -0500)]
Don't write field defn unless changed

3 years agoGUI: Bare bones field style
Coleman Watts [Wed, 6 Nov 2019 13:31:11 +0000 (08:31 -0500)]
GUI: Bare bones field style

3 years agoGUI: Add block button
Coleman Watts [Wed, 6 Nov 2019 13:29:09 +0000 (08:29 -0500)]
GUI: Add block button

3 years agoImprove admin bar style
Coleman Watts [Wed, 6 Nov 2019 12:25:35 +0000 (07:25 -0500)]
Improve admin bar style

3 years agoSave button for gui + api
Coleman Watts [Wed, 6 Nov 2019 02:35:02 +0000 (21:35 -0500)]
Save button for gui + api

3 years agoClarify docblock
Coleman Watts [Mon, 4 Nov 2019 21:47:44 +0000 (16:47 -0500)]
Clarify docblock

3 years agoConfigure layout style of blocks
Coleman Watts [Mon, 4 Nov 2019 14:40:20 +0000 (09:40 -0500)]
Configure layout style of blocks

3 years agoDynamic option lists for select elements
Coleman Watts [Mon, 4 Nov 2019 13:02:23 +0000 (08:02 -0500)]
Dynamic option lists for select elements

This should respond better to changes in the model.

3 years agoAdd forms, add/remove entities
Coleman Watts [Sun, 3 Nov 2019 00:14:47 +0000 (20:14 -0400)]
Add forms, add/remove entities

3 years agoFixes #4 - html encode injected properties and enable test
Coleman Watts [Sat, 2 Nov 2019 00:57:27 +0000 (20:57 -0400)]
Fixes #4 - html encode injected properties and enable test

3 years agoFields drag n drop
Coleman Watts [Fri, 1 Nov 2019 19:15:59 +0000 (15:15 -0400)]
Fields drag n drop

3 years agoWIP canvas
Coleman Watts [Thu, 31 Oct 2019 00:08:47 +0000 (20:08 -0400)]
WIP canvas

3 years agoRemove convertTextNodes
Coleman Watts [Wed, 30 Oct 2019 22:18:31 +0000 (18:18 -0400)]
Remove convertTextNodes

The api now returns them as an array so we don't need to worry about this on the client side.

3 years agoWIP fields
Coleman Watts [Tue, 29 Oct 2019 21:30:23 +0000 (17:30 -0400)]
WIP fields

3 years agoConfig forms - values section
Coleman Watts [Mon, 28 Oct 2019 01:52:14 +0000 (21:52 -0400)]
Config forms - values section

3 years agoHorizontal tabs
Coleman Watts [Fri, 25 Oct 2019 16:01:48 +0000 (12:01 -0400)]
Horizontal tabs

3 years agoAdd some metadata
Coleman Watts [Fri, 25 Oct 2019 14:32:24 +0000 (10:32 -0400)]
Add some metadata

3 years agoWIP beginning work on GUI
Coleman Watts [Thu, 24 Oct 2019 17:05:19 +0000 (13:05 -0400)]
WIP beginning work on GUI

3 years ago(REF) AHQ::makeRoot() - Extract helper from FormDataModel
Tim Otten [Fri, 1 Nov 2019 20:27:46 +0000 (13:27 -0700)]
(REF) AHQ::makeRoot() - Extract helper from FormDataModel

3 years agoFilterTest - Add basic unit test for the 'defn="..."` injection
Tim Otten [Fri, 1 Nov 2019 20:14:33 +0000 (13:14 -0700)]
FilterTest - Add basic unit test for the 'defn="..."` injection

3 years ago(REF) _afform_html_filter() - Extract method for unit-testing
Tim Otten [Fri, 1 Nov 2019 19:45:15 +0000 (12:45 -0700)]
(REF) _afform_html_filter() - Extract method for unit-testing

3 years ago(NFC) Small cleanup
Tim Otten [Fri, 1 Nov 2019 19:41:35 +0000 (12:41 -0700)]
(NFC) Small cleanup

3 years ago(REF) AfformScanner::getLayout() - Extract new method
Tim Otten [Fri, 1 Nov 2019 19:40:56 +0000 (12:40 -0700)]
(REF) AfformScanner::getLayout() - Extract new method

3 years agoFix parser to work with nested fields
Coleman Watts [Fri, 1 Nov 2019 13:57:25 +0000 (09:57 -0400)]
Fix parser to work with nested fields

Fields should be allowed to be inside other tags as long as they're
contained in an af-fieldset.

3 years agoAdd bin/test-all.sh
Tim Otten [Fri, 1 Nov 2019 05:20:26 +0000 (22:20 -0700)]
Add bin/test-all.sh

3 years agoFix warnings for `#text` format
Tim Otten [Fri, 1 Nov 2019 04:53:44 +0000 (21:53 -0700)]
Fix warnings for `#text` format

3 years agoaf-fieldset - More updates for switching E=>A
Tim Otten [Fri, 1 Nov 2019 04:53:24 +0000 (21:53 -0700)]
af-fieldset - More updates for switching E=>A

3 years agoRestrict af-fieldset directive to A not E
Coleman Watts [Thu, 31 Oct 2019 00:33:26 +0000 (20:33 -0400)]
Restrict af-fieldset directive to A not E

The af-fieldset directive was ambiguiously set to restrict: "AE"
but only "E" was supported. I want to pick one and stick with it, and
I prefer "A" because the fieldset is also a container, so div or fieldset
seem like the appropriate tag names.

3 years agoArrayHtml - Change text node format from string to array
Coleman Watts [Wed, 30 Oct 2019 20:53:19 +0000 (16:53 -0400)]
ArrayHtml - Change text node format from string to array

Everything in the arrayHtml is associative exept text nodes were just strings.
That made it difficult to loop through the whole thing in javascript, so
this updates the format to be consistent with everything else.

3 years agoArrayHtml - Treat `<af-entity/>` and `<af-field/>` as self-closing tags
Tim Otten [Tue, 29 Oct 2019 23:11:10 +0000 (16:11 -0700)]
ArrayHtml - Treat `<af-entity/>` and `<af-field/>` as self-closing tags

3 years agoArrayHtml - Encode self-closing HTML tags (`<img />`, `<br />`) normally
Tim Otten [Tue, 29 Oct 2019 23:07:12 +0000 (16:07 -0700)]
ArrayHtml - Encode self-closing HTML tags (`<img />`, `<br />`) normally