Skip to content

Commit

Permalink
Merge pull request #37 from open-sausages/pulls/1.0/create-success-msg
Browse files Browse the repository at this point in the history
FIX Create campaign success message
  • Loading branch information
flamerohr authored Aug 3, 2017
2 parents a772c8f + 2828216 commit fe5768f
Show file tree
Hide file tree
Showing 18 changed files with 328 additions and 133 deletions.
5 changes: 5 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
},
"rules": {
"init-declarations": 1
},
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
}
}
Binary file added client/dist/images/empty-campaign-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion client/dist/styles/bundle.css.map

This file was deleted.

9 changes: 6 additions & 3 deletions client/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
}
} else {
ss.i18n.addDictionary('en', {
"CampaignAdmin.ADDCAMPAIGN": "Add campaign",
"CampaignAdmin.ADDCAMPAIGN": "Add new",
"CampaignAdmin.DELETECAMPAIGN": "Are you sure you want to delete this record?",
"CampaignAdmin.DRAFT": "Draft",
"CampaignAdmin.ITEM_SUMMARY_PLURAL": "%s items",
Expand All @@ -15,6 +15,9 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
"CampaignAdmin.NO_CHANGES": "No changes",
"CampaignAdmin.PUBLISHCAMPAIGN": "Publish campaign",
"CampaignAdmin.REMOVED": "Removed",
"CampaignAdmin.REVERTCAMPAIGN": "Revert"
"CampaignAdmin.REVERTCAMPAIGN": "Revert",
"CampaignAdmin.NEWCAMPAIGNSUCCESS": "Nice one! You have successfully created a campaign.",
"CampaignAdmin.SELECTFROMSECTIONS": "Select \"Add to Campaign\" from pages, files, and other admin sections with content types",
"CampaignAdmin.LOADING": "Loading..."
});
}
}
9 changes: 6 additions & 3 deletions client/lang/src/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"CampaignAdmin.ADDCAMPAIGN": "Add campaign",
"CampaignAdmin.ADDCAMPAIGN": "Add new",
"CampaignAdmin.DELETECAMPAIGN": "Are you sure you want to delete this record?",
"CampaignAdmin.DRAFT": "Draft",
"CampaignAdmin.ITEM_SUMMARY_PLURAL": "%s items",
Expand All @@ -8,5 +8,8 @@
"CampaignAdmin.NO_CHANGES": "No changes",
"CampaignAdmin.PUBLISHCAMPAIGN": "Publish campaign",
"CampaignAdmin.REMOVED": "Removed",
"CampaignAdmin.REVERTCAMPAIGN": "Revert"
}
"CampaignAdmin.REVERTCAMPAIGN": "Revert",
"CampaignAdmin.NEWCAMPAIGNSUCCESS": "Nice one! You have successfully created a campaign.",
"CampaignAdmin.SELECTFROMSECTIONS": "Select \"Add to Campaign\" from pages, files, and other admin sections with content types",
"CampaignAdmin.LOADING": "Loading..."
}
6 changes: 5 additions & 1 deletion client/src/containers/CampaignAdmin/CampaignAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { bindActionCreators } from 'redux';
import { withRouter } from 'react-router';
import getFormState from 'lib/getFormState';
import backend from 'lib/Backend';
import * as campaignActions from 'state/campaign/CampaignActions';
import * as breadcrumbsActions from 'state/breadcrumbs/BreadcrumbsActions';
import Breadcrumb from 'components/Breadcrumb/Breadcrumb';
import SilverStripeComponent from 'lib/SilverStripeComponent';
Expand Down Expand Up @@ -119,7 +120,8 @@ class CampaignAdmin extends SilverStripeComponent {
// open the new campaign in edit mode after save completes
const sectionUrl = this.props.sectionConfig.url;
const id = response.record.id;
this.props.router.push(`${sectionUrl}/set/${id}/edit`);
this.props.campaignActions.setNewItem(id);
this.props.router.push(`${sectionUrl}/set/${id}/show`);
}

return response;
Expand Down Expand Up @@ -166,6 +168,7 @@ class CampaignAdmin extends SilverStripeComponent {
const formActionProps = {
title: i18n._t('CampaignAdmin.ADDCAMPAIGN'),
icon: 'plus',
extraClass: 'btn-primary',
handleClick: this.addCampaign.bind(this),
};
const formBuilderProps = {
Expand Down Expand Up @@ -410,6 +413,7 @@ function mapStateToProps(state, ownProps) {
function mapDispatchToProps(dispatch) {
return {
breadcrumbsActions: bindActionCreators(breadcrumbsActions, dispatch),
campaignActions: bindActionCreators(campaignActions, dispatch),
};
}

Expand Down
39 changes: 39 additions & 0 deletions client/src/containers/CampaignAdmin/CampaignAdmin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@
}
}
}

.campaign-admin__campaign-preview--empty {
align-items: center;
justify-content: center;
}

.campaign-admin__empty-heading {
font-size: $font-size-h1;
margin-bottom: 1em;
}

.campaign-admin__empty-info {
padding-top: calc(270px + 0.5em);
background-image: url('empty-campaign-preview.png');
background-repeat: no-repeat;
background-position: 50% 0;
font-size: $font-size-lg;
}
}

.campaign-admin__campaign-items {
Expand Down Expand Up @@ -77,6 +95,27 @@
}
}

.list-group-wrapper--empty {
.list-group {
border-bottom: 0;
}

.list-group-item {
background: transparent;
font-style: italic;
border-bottom: 0;
cursor: default;
}

.accordion__title {
cursor: default;

&:before {
display: none;
}
}
}

.campaign-admin__item-links--is-linked {
opacity: 1;

Expand Down
Loading

0 comments on commit fe5768f

Please sign in to comment.