Simplify "add to campaign" dialog

Talked to @clarkepaul and simplified to avoid title duplication
This commit is contained in:
Ingo Schommer 2016-08-18 15:43:35 +12:00
parent a9bdf33ca8
commit 84cdb15a5f
4 changed files with 11 additions and 10 deletions

View File

@ -2,7 +2,6 @@ import React from 'react';
import { Modal } from 'react-bootstrap-4'; import { Modal } from 'react-bootstrap-4';
import SilverStripeComponent from 'lib/SilverStripeComponent'; import SilverStripeComponent from 'lib/SilverStripeComponent';
import FormBuilder from 'components/FormBuilder/FormBuilder'; import FormBuilder from 'components/FormBuilder/FormBuilder';
import i18n from 'i18n';
class AddToCampaignModal extends SilverStripeComponent { class AddToCampaignModal extends SilverStripeComponent {
constructor(props) { constructor(props) {
@ -96,9 +95,9 @@ class AddToCampaignModal extends SilverStripeComponent {
show={this.props.show} show={this.props.show}
onHide={this.props.handleHide} onHide={this.props.handleHide}
> >
<Modal.Header closeButton> {this.props.title !== false &&
<Modal.Title>{this.props.title}</Modal.Title> <Modal.Header closeButton><Modal.Title>{this.props.title}</Modal.Title></Modal.Header>
</Modal.Header> }
<Modal.Body> <Modal.Body>
{body} {body}
{response} {response}
@ -118,7 +117,7 @@ AddToCampaignModal.propTypes = {
AddToCampaignModal.defaultProps = { AddToCampaignModal.defaultProps = {
show: false, show: false,
title: i18n._t('Campaigns.AddToCampaign', 'Add to campaign'), title: null,
}; };
export default AddToCampaignModal; export default AddToCampaignModal;

View File

@ -176,8 +176,8 @@ class AddToCampaignHandler {
$inChangeSets = array_unique(ChangeSetItem::get_for_object($object)->column('ChangeSetID')); $inChangeSets = array_unique(ChangeSetItem::get_for_object($object)->column('ChangeSetID'));
$changeSets = $this->getAvailableChangeSets()->map(); $changeSets = $this->getAvailableChangeSets()->map();
$campaignDropdown = DropdownField::create('Campaign', _t('Campaigns.CampaignTitle', 'Campaigns'), $changeSets); $campaignDropdown = DropdownField::create('Campaign', '', $changeSets);
$campaignDropdown->setEmptyString(_t('Campaigns.AddToCampaign', 'Select a Campaign')); $campaignDropdown->setEmptyString(_t('Campaigns.AddToCampaignFormFieldLabel', 'Select a Campaign'));
$campaignDropdown->addExtraClass('noborder'); $campaignDropdown->addExtraClass('noborder');
$campaignDropdown->setDisabledItems($inChangeSets); $campaignDropdown->setDisabledItems($inChangeSets);
@ -216,7 +216,7 @@ class AddToCampaignHandler {
$form->unsetValidator(); $form->unsetValidator();
$form->loadDataFrom($this->data); $form->loadDataFrom($this->data);
$form->addExtraClass('add-to-campaign__form'); $form->addExtraClass('form--no-dividers add-to-campaign__form');
return $form; return $form;
} }

View File

@ -20,7 +20,8 @@ class AddToCampaignHandler_FormAction extends FormAction
function __construct() function __construct()
{ {
parent::__construct('addtocampaign', _t('CAMPAIGNS.ADDTOCAMPAIGN', 'Add to campaign')); parent::__construct('addtocampaign', _t('CAMPAIGNS.ADDTOCAMPAIGN', 'Add to Campaign'));
$this->setUseButtonTag(false); $this->setUseButtonTag(false);
$this->addExtraClass('add-to-campaign-action'); $this->addExtraClass('add-to-campaign-action');
$this->setValidationExempt(true); $this->setValidationExempt(true);

View File

@ -75,7 +75,7 @@ en:
NOANSWER: 'No' NOANSWER: 'No'
YESANSWER: 'Yes' YESANSWER: 'Yes'
CAMPAIGNS: CAMPAIGNS:
ADDTOCAMPAIGN: 'Add to campaign' ADDTOCAMPAIGN: 'Add to Campaign'
CMSLoadingScreen_ss: CMSLoadingScreen_ss:
LOADING: Loading... LOADING: Loading...
REQUIREJS: 'The CMS requires that you have JavaScript enabled.' REQUIREJS: 'The CMS requires that you have JavaScript enabled.'
@ -106,6 +106,7 @@ en:
MENUTITLE: Campaigns MENUTITLE: Campaigns
Campaigns: Campaigns:
AddToCampaign: 'Add To Campaign' AddToCampaign: 'Add To Campaign'
AddToCampaignFormFieldLabel: 'Select a Campaign'
CampaignTitle: 'Campaign' CampaignTitle: 'Campaign'
ChangePasswordEmail_ss: ChangePasswordEmail_ss:
CHANGEPASSWORDFOREMAIL: 'The password for account with email address {email} has been changed. If you didn\''t change your password please change your password using the link below' CHANGEPASSWORDFOREMAIL: 'The password for account with email address {email} has been changed. If you didn\''t change your password please change your password using the link below'