From 413923b2af1cf5cb1df4e53845ace65b9d7a1471 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Thu, 22 May 2014 10:37:24 -0700 Subject: [PATCH] - replaceing stale PR-3101 with additional layout improvements. --- CRM/Event/Form/ManageEvent/Registration.php | 16 +++++- css/civicrm.css | 27 ++++++++++ css/crm.designer.css | 4 ++ js/view/crm.profile-selector.js | 13 +++++ .../Event/Form/ManageEvent/Registration.tpl | 50 ++++++++++--------- templates/CRM/UF/Page/ProfileTemplates.tpl | 7 +-- 6 files changed, 88 insertions(+), 29 deletions(-) diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index e7f16e73ea..59d9a77e16 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -327,10 +327,16 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent */ function buildRegistrationBlock(&$form) { $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event'); + $attributes['intro_text']['click_wysiwyg'] = true; $form->addWysiwyg('intro_text', ts('Introductory Text'), $attributes['intro_text']); // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing // explicit height and width. - $form->addWysiwyg('footer_text', ts('Footer Text'), array('rows' => 2, 'cols' => 40)); + $footerAttribs = array( + 'rows' => 2, + 'cols' => 40, + 'click_wysiwyg' => true, + ); + $form->addWysiwyg('footer_text', ts('Footer Text'), $footerAttribs); extract( self::getProfileSelectorTypes() ); @@ -428,11 +434,17 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent function buildThankYouBlock(&$form) { $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event'); + $attributes['thankyou_text']['click_wysiwyg'] = true; $form->add('text', 'thankyou_title', ts('Title'), $attributes['thankyou_title']); $form->addWysiwyg('thankyou_text', ts('Introductory Text'), $attributes['thankyou_text']); // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing // explicit height and width. - $form->addWysiwyg('thankyou_footer_text', ts('Footer Text'), array('rows' => 2, 'cols' => 40)); + $footerAttribs = array( + 'rows' => 2, + 'cols' => 40, + 'click_wysiwyg' => true, + ); + $form->addWysiwyg('thankyou_footer_text', ts('Footer Text'), $footerAttribs); } /** diff --git a/css/civicrm.css b/css/civicrm.css index ecb79db720..3c68c19156 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -225,11 +225,38 @@ input.crm-form-entityref { color: #3E3E3E; } +.crm-container .replace-plain, .crm-container textarea, .crm-container select.crm-form-multiselect { border: 1px solid #999; } +.crm-container .replace-plain { + cursor: pointer; + background: rgba(255,255,255,0.6); + min-height: 2em; + position: relative; + padding: 2px; +} + +.crm-container .replace-plain:focus, +.crm-container .replace-plain:hover { + box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + background: rgba(255,255,255,0.8); +} + +.crm-container .replace-plain .icon.edit-icon { + position: absolute; + top: .5em; + right: .5em; +} + +.crm-container .replace-plain a:active .icon.edit-icon, +.crm-container .replace-plain:focus .icon.edit-icon, +.crm-container .replace-plain:hover .icon.edit-icon { + background-image: url("../i/icons/jquery-ui-2786C2.png"); +} + /* ** class for hiding the text box; it is used in the OtherActivity template diff --git a/css/crm.designer.css b/css/crm.designer.css index 1196c45fb4..e5cd2c4ce8 100644 --- a/css/crm.designer.css +++ b/css/crm.designer.css @@ -9,6 +9,10 @@ padding: 4px; } +.crm-container .crm-profile-selector-preview .icon { + float: none; +} + .crm-designer-toolbar { width: 290px; position: absolute; diff --git a/js/view/crm.profile-selector.js b/js/view/crm.profile-selector.js index 1b76bbcf6d..befceec4ce 100644 --- a/js/view/crm.profile-selector.js +++ b/js/view/crm.profile-selector.js @@ -44,6 +44,7 @@ 'click .crm-profile-selector-edit': 'doEdit', 'click .crm-profile-selector-copy': 'doCopy', 'click .crm-profile-selector-create': 'doCreate', + 'click .crm-profile-selector-preview': 'doShowPreview', // prevent interaction with preview form 'click .crm-profile-selector-preview-pane': false, 'crmLoad .crm-profile-selector-preview-pane': 'disableForm' @@ -58,6 +59,7 @@ this.setUfGroupId(this.options.ufGroupId, {silent: true}); this.toggleButtons(); this.$('.crm-profile-selector-select select').css('width', '25em').crmSelect2(); + this.doShowPreview(); }, onChangeUfGroupId: function(event) { this.options.ufGroupId = $(event.target).val(); @@ -87,6 +89,17 @@ CRM.loadPage(CRM.url("civicrm/ajax/inline", {class_name: 'CRM_UF_Form_Inline_PreviewById', id: this.getUfGroupId()}), {target: $pane}); } }, + doShowPreview: function() { + var $preview = this.$('.crm-profile-selector-preview'); + var $pane = this.$('.crm-profile-selector-preview-pane'); + if ($preview.hasClass('crm-profile-selector-preview-show')) { + $preview.removeClass('crm-profile-selector-preview-show'); + $pane.show(); + } else { + $preview.addClass('crm-profile-selector-preview-show'); + $pane.hide(); + } + }, disableForm: function() { this.$(':input', '.crm-profile-selector-preview-pane').prop('readOnly', true); }, diff --git a/templates/CRM/Event/Form/ManageEvent/Registration.tpl b/templates/CRM/Event/Form/ManageEvent/Registration.tpl index eae7f9293a..b03c2c3e3a 100644 --- a/templates/CRM/Event/Form/ManageEvent/Registration.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Registration.tpl @@ -32,14 +32,13 @@ data-addtlPartc="{$addProfileBottomAdd}">{ts}remove profile{/ts}   {ts}add profile{/ts} -
+ class="icon ui-icon-plus">{ts}add another profile (bottom of page){/ts} {if $addProfileBottomAdd } - {ts}Change this if you want to use a different profile for additional participants.{/ts} +
{ts}Change this if you want to use a different profile for additional participants.{/ts}
{else} - {ts}Include additional fields on this registration form by configuring and selecting a CiviCRM Profile to be included at the bottom of the page.{/ts} +
{ts}Include additional fields on this registration form by selecting and configuring a CiviCRM Profile to be included at the bottom of the page.{/ts}
{/if}
@@ -139,20 +138,20 @@ - @@ -168,7 +167,7 @@ {if $smarty.foreach.profilePostIdName.last}    {ts}add profile{/ts} + class="icon ui-icon-plus">{ts}add another profile (bottom of page){/ts} {/if}
@@ -179,21 +178,21 @@
{$form.custom_pre_id.label}{$form.custom_pre_id.html}
- {ts}Include additional fields on this registration form by configuring and selecting a CiviCRM Profile to be included at the top of the page (immediately after the introductory message).{/ts}{help id="event-profile"}
+
{$form.custom_pre_id.html} +
{ts}Include additional fields on this registration form by selecting and configuring a CiviCRM Profile to be included at the top of the page (immediately after the introductory message).{/ts}{help id="event-profile"}
{$form.custom_post_id.label} {$form.custom_post_id.html} -   {ts}add profile{/ts} +
{ts}Include additional fields on this registration form by selecting and configuring a CiviCRM Profile to be included at the bottom of the page.{/ts}
+   {ts}add another profile (bottom of page){/ts}
- {ts}Include additional fields on this registration form by configuring and selecting a CiviCRM Profile to be included at the bottom of the page.{/ts}
- @@ -211,7 +210,7 @@    {ts}add profile{/ts} + class="icon ui-icon-plus">{ts}add another profile (bottom of page){/ts} {/if}
@@ -432,6 +431,8 @@ invert = 0 $(this).closest('tbody').append(''); var $el = $(this).closest('tbody').find('tr:last'); $el.load(urlPath, function() { $(this).trigger('crmLoad') }); + $(this).closest(".profile_bottom_link_main, .profile_bottom_link, .profile_bottom_add_link_main").hide(); + $el.find(".profile_bottom_link_main, .profile_bottom_link, .profile_bottom_add_link_main").show(); } function removeBottomProfile( e ) { @@ -439,6 +440,7 @@ invert = 0 $(e.target).parents('tr').find('.crm-profile-selector').val(''); $(e.target).parents('tr').hide(); + $(e.target).parents('tbody').find('tr:visible:last .profile_bottom_link_main, tr:visible:last .profile_bottom_link, tr:visible:last .profile_bottom_add_link_main').show(); } var strSameAs = ' - '+ts('same as for main contact')+' - '; diff --git a/templates/CRM/UF/Page/ProfileTemplates.tpl b/templates/CRM/UF/Page/ProfileTemplates.tpl index cdefd62113..9330d9c7de 100644 --- a/templates/CRM/UF/Page/ProfileTemplates.tpl +++ b/templates/CRM/UF/Page/ProfileTemplates.tpl @@ -114,9 +114,10 @@
{$form.additional_custom_pre_id.label}{$form.additional_custom_pre_id.html}
- {ts}Change this if you want to use a different profile for additional participants.{/ts} +
{$form.additional_custom_pre_id.html} +
{ts}Change this if you want to use a different profile for additional participants.{/ts}

{$form.additional_custom_post_id.label} {$form.additional_custom_post_id.html} -  {ts}Change this if you want to use a different profile for additional participants.{/ts} + +  {ts}add profile{/ts} -
- {ts}Change this if you want to use a different profile for additional participants.{/ts} + class="icon ui-icon-plus">{ts}add another profile (bottom of page){/ts}