Show an icon when asking the user a question.

master
Pacman Ghost 5 years ago
parent c96508f467
commit 4ddd071f3b
  1. BIN
      web/public/images/ask.png
  2. 10
      web/src/App.js
  3. 2
      web/src/ArticleSearchResult.js
  4. 28
      web/src/PublicationSearchResult.js
  5. 2
      web/src/PublisherSearchResult.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

@ -162,13 +162,12 @@ export default class App extends React.Component
showErrorMsg( content ) {
// show the error message in a modal dialog
this.ask(
<div> <img className="icon" src="/images/error.png" alt="Error." /> {content} </div>,
this.ask( content, "error",
{ "OK": null }
) ;
}
ask( content, buttons ) {
ask( content, iconType, buttons ) {
// prepare the buttons
let buttons2 = [] ;
for ( let b in buttons ) {
@ -182,7 +181,10 @@ export default class App extends React.Component
} ;
}
// show the dialog
this.setState( { askDialog: { content: content, buttons: buttons2 } } ) ;
this.setState( { askDialog: {
content: <div> <img src={"/images/"+iconType+".png"} className="icon" alt={iconType+" icon"} /> {content} </div>,
buttons: buttons2
} } ) ;
}
logInternalError( msg, detail ) {

@ -129,7 +129,7 @@ export class ArticleSearchResult extends React.Component
Delete this article?
<div style={{margin:"0.5em 0 0 2em",fontStyle:"italic"}} dangerouslySetInnerHTML = {{ __html: this.props.data.article_title }} />
</div> ) ;
gAppRef.ask( content, {
gAppRef.ask( content, "ask", {
"OK": () => {
// delete the article on the server
axios.get( gAppRef.makeFlaskUrl( "/article/delete/" + this.props.data.article_id ) )

@ -144,7 +144,7 @@ export class PublicationSearchResult extends React.Component
<div style={{margin:"0.5em 0 0.5em 2em",fontStyle:"italic"}} dangerouslySetInnerHTML = {{ __html: this._makeDisplayName() }} />
{warning}
</div> ) ;
gAppRef.ask( content, {
gAppRef.ask( content, "ask", {
"OK": () => {
// delete the publication on the server
axios.get( gAppRef.makeFlaskUrl( "/publication/delete/" + this.props.data.pub_id, {list:1} ) )
@ -176,32 +176,6 @@ export class PublicationSearchResult extends React.Component
.catch( err => {
doDelete( err ) ;
} ) ;
// confirm the operation
const content = ( <div>
Delete this publication?
<div style={{margin:"0.5em 0 0 2em",fontStyle:"italic"}} dangerouslySetInnerHTML = {{ __html: this._makeDisplayName() }} />
</div> ) ;
gAppRef.ask( content, {
"OK": () => {
// delete the publication on the server
axios.get( gAppRef.makeFlaskUrl( "/publication/delete/" + this.props.data.pub_id, {list:1} ) )
.then( resp => {
// update the cached publications
gAppRef.caches.publications = resp.data.publications ;
// update the UI
this.props.onDelete( "pub_id", this.props.data.pub_id ) ;
if ( resp.data.warning )
gAppRef.showWarningToast( <div> The publication was deleted. <p> {resp.data.warning} </p> </div> ) ;
else
gAppRef.showInfoToast( <div> The publication was deleted. </div> ) ;
} )
.catch( err => {
gAppRef.showErrorToast( <div> Couldn't delete the publication: <div className="monospace"> {err.toString()} </div> </div> ) ;
} ) ;
},
"Cancel": null,
} ) ;
}
_makeDisplayName() {

@ -126,7 +126,7 @@ export class PublisherSearchResult extends React.Component
<div style={{margin:"0.5em 0 0.5em 2em",fontStyle:"italic"}} dangerouslySetInnerHTML={{__html: this.props.data.publ_name}} />
{warning}
</div> ) ;
gAppRef.ask( content, {
gAppRef.ask( content, "ask", {
"OK": () => {
// delete the publisher on the server
axios.get( gAppRef.makeFlaskUrl( "/publisher/delete/" + this.props.data.publ_id, {list:1} ) )

Loading…
Cancel
Save