Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
brienne
Developer Documentation
Commits
532a6e33
Commit
532a6e33
authored
7 years ago
by
Sean Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Auto-import "Accordions" wiki page
https://wiki.civicrm.org/confluence/display/CRMDOC/Accordions
parent
0d7119a7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/framework/ui.md
+96
-0
96 additions, 0 deletions
docs/framework/ui.md
with
96 additions
and
0 deletions
docs/framework/ui.md
0 → 100644
+
96
−
0
View file @
532a6e33
# Accordions
CiviCRM uses accordions throughout its UI to minimize the visual weight
of the page (hiding less used pieces of content).
There are two types of accordions in use in CiviCRM:
1
\)
the more commonly used accordion widget which hides content already
in the rendered page
2
\)
the more advanced widget that uses ajax to render content when the
accordion header has been clicked
The format for a common accordion widget (collapsed by default) is as
follows:
<div
class=
"code panel"
style=
"border-width: 1px;"
>
<div
class=
"codeContent panelContent"
>
<div class="crm-accordion-wrapper collapsed">
<div class="crm-accordion-header">
Accordian Title here
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
<div class="crm-block crm-form-block crm-form-title-here-form-block">
Accordion Body here
</div><!-- / .crm-block -->
</div><!-- /.crm-accordion-body -->
</div><!-- /.crm-accordion-wrapper -->
</div>
</div>
Use class="crm-accordion-wrapper open" if you want the accordion body to
be open when the page loads.
Dynamic classes that are automatically applied to this type of accordion
are as follows:
*.crm-container .open .crm-accordion-header*
- applied when
crm-accordion-body is visible
\
**
.crm-container .collapsed .crm-accordion-header
*
- applied when
crm-accordion-body is hidden
\
*
*.crm-accordion-header:hover*
- css pseudo-class
crmAccordions function is automatically included in Common.js and does
not need to be added to templates that already include that file.
------
to make an ajax accordion work automatically (including opening and
loading accordions on page load):
<div
class=
"code panel"
style=
"border-width: 1px;"
>
<div
class=
"codeContent panelContent"
>
// Example from templates/CRM/Contribute/Form/Contribution.tpl// bind first click of accordion header to load crm-accordion-body with snippet
// everything else taken care of by cj().crm-accordions()
CRM.$(function($) {
cj('#adjust-option-type').hide();
cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() {
loadPanes(cj(this).attr('id'));
});
cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) {
loadPanes(cj(this).attr('id'));
});
});
// load panes function calls for snippet based on id of crm-accordion-header
function loadPanes( id ) {
var url = "{/literal}{crmURL p='civicrm/contact/view/contribution' q='snippet=4&formType=' h=0}{literal}" + id;
{/literal}
{if $contributionMode}
url = url + "&mode={$contributionMode}";
{/if}
{if $qfKey}
url = url + "&qfKey={$qfKey}";
{/if}
{literal}
if (! cj('div.'+id).html()) {
var loading = '<img src="{/literal}{$config->resourceBase}i/loading.gif{literal}" alt="{/literal}{ts escape='js'}loading{/ts}{literal}" /> {/literal}{ts escape='js'}Loading{/ts}{literal}...';
cj('div.'+id).html(loading);
cj.ajax({
url : url,
success: function(data) { cj('div.'+id).html(data).trigger('crmLoad'); }
});
}
}
</div>
</div>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment