Skip to content

Commit

Permalink
NEW Add ability to edit file in file insert modals
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Rainville committed Apr 27, 2020
1 parent a789c6b commit bc3f4a3
Show file tree
Hide file tree
Showing 48 changed files with 1,957 additions and 364 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ before_script:
# Install composer
- composer validate
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.x-dev --prefer-dist; fi
- composer require silverstripe/recipe-testing:^1 silverstripe/recipe-cms 4.x-dev --no-update --prefer-dist
- composer require silverstripe/recipe-testing:^1 silverstripe/recipe-cms:4.x-dev silverstripe/frameworktest:dev-master --no-update --prefer-dist
- composer update

# Remove preinstalled Chrome (google-chrome)
Expand Down
2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_ssembed.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_sslink-file.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/js/TinyMCE_ssmedia.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions client/lang/src/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"AssetAdmin.ADD_FILES": "Add from files",
"AssetAdmin.ADD_FOLDER_BUTTON": "Add folder",
"AssetAdmin.BACK": "Back",
"AssetAdmin.BACK_DESCRIPTION": "Navigate up a level",
"AssetAdmin.BROWSE": "Browse",
"AssetAdmin.BULK_ACTIONS_CONFIRM": "Are you sure you want to %s these files?",
"AssetAdmin.BULK_ACTIONS_DELETE": "Delete",
"AssetAdmin.BULK_ACTIONS_DELETE_SINGLE_ITEM_CONFIRM": "Are you sure you want to delete this file/folder?",
Expand All @@ -18,7 +20,10 @@
"AssetAdmin.CANCEL": "Cancel",
"AssetAdmin.CONFIRMDELETE": "Are you sure you want to delete this record?",
"AssetAdmin.CREATED": "First uploaded",
"AssetAdmin.CreateTitle": "Insert new media from the web",
"AssetAdmin.DELETE": "Delete",
"AssetAdmin.DETAILS": "Details",
"AssetAdmin.DISMISS": "Dismiss",
"AssetAdmin.DIM": "Dimensions",
"AssetAdmin.DROPZONE_CANCEL_UPLOAD": "Cancel upload",
"AssetAdmin.DROPZONE_CANCEL_UPLOAD_CONFIRMATION": "Are you sure you want to cancel this upload?",
Expand All @@ -34,6 +39,9 @@
"AssetAdmin.DROPZONE_SUCCESS_UPLOAD": "File uploaded",
"AssetAdmin.DROPZONE_UPLOAD": "Upload",
"AssetAdmin.EDIT": "Edit",
"AssetAdmin.EditTitle": "Media from the web",
"AssetAdmin.EMPTY": "No files",
"AssetAdmin.ERROR_OEMBED_REMOTE": "Embed is only compatible with remote files",
"AssetAdmin.FILENAME": "Filename",
"AssetAdmin.FILES": "Files",
"AssetAdmin.FILE_MISSING": "File cannot be found",
Expand All @@ -45,7 +53,10 @@
"AssetAdmin.JOINLAST": "and",
"AssetAdmin.LASTEDIT": "Last changed",
"AssetAdmin.LOADMORE": "Load more",
"AssetAdmin.NEXT": "Next",
"AssetAdmin.NOITEMSFOUND": "No items found",
"AssetAdmin.OR": "or",
"AssetAdmin.PREVIOUS": "Previous",
"AssetAdmin.PROMPTFOLDERNAME": "Please enter a folder name (or blank to cancel)",
"AssetAdmin.REPlACE_FILE_SUCCESS": "Upload successful, the file will be replaced when you Save.",
"AssetAdmin.SAVE": "Save",
Expand All @@ -63,13 +74,5 @@
"AssetAdmin.TITLE": "Title",
"AssetAdmin.TYPE": "File type",
"AssetAdmin.URL": "URL",
"AssetAdmin.ADD_FILES": "Add from files",
"AssetAdmin.BROWSE": "Browse",
"AssetAdmin.EMPTY": "No files",
"AssetAdmin.OR": "or",
"AssetAdmin.ERROR_OEMBED_REMOTE": "Embed is only compatible with remote files",
"AssetAdmin.CreateTitle": "Insert new media from the web",
"AssetAdmin.EditTitle": "Media from the web",
"AssetAdmin.NEXT": "Next",
"AssetAdmin.PREVIOUS": "Previous"
"AssetAdmin.VIEW": "View",
}
4 changes: 2 additions & 2 deletions client/src/components/GalleryItem/GalleryItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ class GalleryItem extends Component {
action = this.handleCancelUpload;
actionIcon = 'font-icon-cancel';
} else if (this.exists()) {
const label = i18n._t('AssetAdmin.DETAILS', 'Details');
overlay = <div className="gallery-item--overlay font-icon-edit">{label}</div>;
const label = i18n._t('AssetAdmin.VIEW', 'View');
overlay = <div className="gallery-item--overlay font-icon-eye">{label}</div>;
}

const badge = this.props.badge;
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/GalleryItem/GalleryItem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ $gallery-item-label-height: 40px;
text-align: center;

&::before {
margin-right: 5px;
margin-right: .385rem;
position: relative;
top: .2rem;
}
}

Expand Down
5 changes: 5 additions & 0 deletions client/src/components/UploadField/UploadField.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import CONSTANTS from 'constants/index';
import fieldHolder from 'components/FieldHolder/FieldHolder';
import fileShape from 'lib/fileShape';
import * as uploadFieldActions from 'state/uploadField/UploadFieldActions';
import * as modalActions from 'state/modal/ModalActions';
import PropTypes from 'prop-types';

/**
Expand Down Expand Up @@ -233,6 +234,7 @@ class UploadField extends Component {
* @param {Object} selectingItem
*/
handleReplaceShow(event, selectingItem) {
this.props.actions.modal.initFormStack('select', 'admin');
this.setState({
selecting: true,
selectingItem,
Expand Down Expand Up @@ -272,6 +274,7 @@ class UploadField extends Component {
*/
handleAddShow(event) {
event.preventDefault();
this.props.actions.modal.initFormStack('select', 'admin');
this.setState({
selecting: true,
selectingItem: null,
Expand All @@ -282,6 +285,7 @@ class UploadField extends Component {
* Close 'add from files' dialog
*/
handleHide() {
this.props.actions.modal.reset();
this.setState({
selecting: false,
selectingItem: null,
Expand Down Expand Up @@ -587,6 +591,7 @@ function mapDispatchToProps(dispatch) {
return {
actions: {
uploadField: bindActionCreators(uploadFieldActions, dispatch),
modal: bindActionCreators(modalActions, dispatch)
},
};
}
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/UploadField/tests/UploadField-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ describe('UploadField', () => {
setFiles: jest.fn(),
removeFile: jest.fn(),
},
modal: {
initFormStack: jest.fn(),
reset: jest.fn(),
}
},
data: {
multi: true,
Expand Down
Loading

0 comments on commit bc3f4a3

Please sign in to comment.