mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Implement feedback fixes
Enhancement Fix ModelAdmin import form not POSTing to correct form
This commit is contained in:
parent
cf5c055ded
commit
56c2363909
5
admin/client/dist/js/bundle.js
vendored
5
admin/client/dist/js/bundle.js
vendored
@ -666,7 +666,7 @@ i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Obj
|
||||
function t(e){r(this,t)
|
||||
var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))
|
||||
return n.handleClick=n.handleClick.bind(n),n}return o(t,e),s(t,[{key:"render",value:function n(){return u["default"].createElement("button",{className:"grid-field__icon-action font-icon-"+this.props.icon+" btn--icon-large",
|
||||
onClick:this.handleClick})}},{key:"handleClick",value:function i(e){return console.log("handle click"),!1}}]),t}(d["default"])
|
||||
onClick:this.handleClick})}},{key:"handleClick",value:function i(e){this.props.handleClick(e,this.props.record.ID)}}]),t}(d["default"])
|
||||
p.PropTypes={handleClick:u["default"].PropTypes.func.isRequired},t["default"]=p},function(e,t,n){"use strict"
|
||||
function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){var n=["id"]
|
||||
return n.reduce(function(e,n){return e.replace(":"+n,t[n])},e)}function a(e,t,n){var i={recordType:e},a={Accept:"text/json"},o=t.toLowerCase()
|
||||
@ -2156,8 +2156,7 @@ var s=n(108),l=i(s),u=n(33),c=i(u),d=(0,l["default"])({})},function(e,t,n){"use
|
||||
function i(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){var e=arguments.length<=0||void 0===arguments[0]?d:arguments[0],t=arguments[1],n=null,i=null,a=null,s={}
|
||||
|
||||
|
||||
switch(t.type){case"APOLLO_QUERY_RESULT":return e
|
||||
case c["default"].CREATE_RECORD:return(0,l["default"])(o({},e,{}))
|
||||
switch(t.type){case c["default"].CREATE_RECORD:return(0,l["default"])(o({},e,{}))
|
||||
case c["default"].UPDATE_RECORD:return(0,l["default"])(o({},e,{}))
|
||||
case c["default"].DELETE_RECORD:return(0,l["default"])(o({},e,{}))
|
||||
case c["default"].FETCH_RECORDS_REQUEST:return e
|
||||
|
4
admin/client/dist/styles/bundle.css
vendored
4
admin/client/dist/styles/bundle.css
vendored
@ -855,6 +855,10 @@ body .ui-tooltip{ border-width:2px; }
|
||||
top:6px;
|
||||
cursor:pointer;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices{
|
||||
padding:4px 5px;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Bootstrap v4.0.0-alpha.2 (http://getbootstrap.com)
|
||||
* Copyright 2011-2015 Twitter, Inc.
|
||||
|
@ -18,9 +18,6 @@ class GridFieldAction extends SilverStripeComponent {
|
||||
}
|
||||
|
||||
handleClick(event) {
|
||||
console.log('handle click');
|
||||
|
||||
return false;
|
||||
this.props.handleClick(event, this.props.record.ID);
|
||||
}
|
||||
}
|
||||
|
@ -147,17 +147,15 @@ $.entwine('ss', function($) {
|
||||
backdrop.addClass('fade in').fadeIn();
|
||||
}
|
||||
|
||||
$(this.data('target')).addClass('in');
|
||||
var modal = $(this.data('target'));
|
||||
|
||||
// workaround until GridField rewritten into react.
|
||||
var self = this;
|
||||
|
||||
$(this.data('target')).find('[data-dismiss]').on('click', function() {
|
||||
modal.addClass('in');
|
||||
modal.find('[data-dismiss]').on('click', function() {
|
||||
backdrop.fadeOut(function() {
|
||||
$(this).removeClass('in');
|
||||
backdrop.removeClass('in');
|
||||
});
|
||||
|
||||
$(self.data('target')).removeClass('in');
|
||||
modal.removeClass('in');
|
||||
})
|
||||
}
|
||||
});
|
||||
|
@ -10,10 +10,6 @@ function recordsReducer(state = initialState, action) {
|
||||
let apolloRecordRelation = {};
|
||||
|
||||
switch (action.type) {
|
||||
case 'APOLLO_QUERY_RESULT':
|
||||
|
||||
return state;
|
||||
|
||||
case ACTION_TYPES.CREATE_RECORD:
|
||||
return deepFreeze(Object.assign({}, state, {}));
|
||||
|
||||
|
@ -1 +1,5 @@
|
||||
@import "../../../../node_modules/chosen-js/chosen.css";
|
||||
|
||||
.chosen-container-multi .chosen-choices {
|
||||
padding: 4px 5px;
|
||||
}
|
||||
|
@ -521,6 +521,8 @@ abstract class ModelAdmin extends LeftAndMain
|
||||
$results = $loader->load($_FILES['_CsvFile']['tmp_name']);
|
||||
|
||||
$message = '';
|
||||
|
||||
if($results) {
|
||||
if ($results->CreatedCount()) {
|
||||
$message .= _t(
|
||||
'ModelAdmin.IMPORTEDRECORDS',
|
||||
@ -528,7 +530,7 @@ abstract class ModelAdmin extends LeftAndMain
|
||||
array('count' => $results->CreatedCount())
|
||||
);
|
||||
}
|
||||
if ($results->UpdatedCount()) {
|
||||
if ($results && $results->UpdatedCount()) {
|
||||
$message .= _t(
|
||||
'ModelAdmin.UPDATEDRECORDS',
|
||||
"Updated {count} records.",
|
||||
@ -545,6 +547,9 @@ abstract class ModelAdmin extends LeftAndMain
|
||||
if (!$results->CreatedCount() && !$results->UpdatedCount()) {
|
||||
$message .= _t('ModelAdmin.NOIMPORT', "Nothing to import");
|
||||
}
|
||||
} else {
|
||||
$message .= _t('ModelAdmin.NOIMPORT', "Nothing to import");
|
||||
}
|
||||
|
||||
$form->sessionMessage($message, 'good');
|
||||
return $this->redirectBack();
|
||||
|
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
|
||||
<div class="cms-content-header-tabs cms-tabset-nav-primary ss-ui-tabs-nav">
|
||||
<% if $SearchForm || $ImportForm %>
|
||||
<% if $SearchForm %>
|
||||
<button id="filters-button" class="btn btn-secondary btn--icon-large font-icon-search no-text" title="<%t CMSPagesController_Tools_ss.FILTER 'Filter' %>"></button>
|
||||
<% end_if %>
|
||||
<ul class="cms-tabset-nav-primary">
|
||||
@ -35,6 +35,20 @@
|
||||
<div class="cms-content-view">
|
||||
$EditForm
|
||||
</div>
|
||||
|
||||
<% if ImportForm %>
|
||||
<div id="{$EditForm.HTMLID}_ImportModal" class="modal fade grid-field-import" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content"><div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
$ImportForm
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end_if %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% if $SearchForm || $ImportForm %>
|
||||
<% if $SearchForm %>
|
||||
<div id="cms-content-tools-ModelAdmin" class="cms-content-filters">
|
||||
<% if $SearchForm %>
|
||||
<h3 class="cms-panel-header"><%t ModelAdmin_Tools_ss.FILTER 'Filter' %></h3>
|
||||
|
@ -46,21 +46,17 @@ class GridFieldImportButton implements GridField_HTMLProvider
|
||||
null
|
||||
);
|
||||
$button->addExtraClass('btn btn-secondary no-ajax font-icon-upload btn--icon-large action_import');
|
||||
|
||||
// means that you can only have 1 import per page
|
||||
$button
|
||||
->setAttribute('data-toggle', "modal")
|
||||
->setAttribute('data-target', "#". $gridField->ID() . ' .grid-field-import');
|
||||
->setAttribute('data-target', "#". $gridField->getForm()->getHTMLID() . '_ImportModal');
|
||||
|
||||
$button->setForm($gridField->getForm());
|
||||
$extra = null;
|
||||
|
||||
if($this->importFormField) {
|
||||
$extra = ($this->importFormField instanceof Form)
|
||||
? $this->importFormField->forTemplate()
|
||||
: $this->importFormField->Field();
|
||||
}
|
||||
|
||||
return array(
|
||||
$this->targetFragment => ($extra) ? '<p class="grid-csv-button">' . $button->Field() . '</p>'.$extra : '',
|
||||
$this->targetFragment => '<p class="grid-csv-button">'. $button->Field() . '</p>'
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user