Creates tainacan_mobile_app page and emits events to mobile app. (https://github.com/tainacan/tainacan-mobile/issues/17)
This commit is contained in:
parent
dcebe2f77d
commit
0c56b19b6a
|
@ -36,6 +36,7 @@ module.exports = {
|
|||
'jQuery': true,
|
||||
'tainacan_extra_components': true,
|
||||
'tainacan_extra_plugins': true,
|
||||
'grecaptcha': true
|
||||
'grecaptcha': true,
|
||||
'webkit': true
|
||||
}
|
||||
}
|
|
@ -1320,7 +1320,7 @@ export default {
|
|||
|
||||
this.isLoading = false;
|
||||
|
||||
if (!this.$adminOptions.itemEditionMode) {
|
||||
if (!this.$adminOptions.itemEditionMode && !this.$adminOptions.mobileAppMode) {
|
||||
|
||||
if (!this.isOnSequenceEdit) {
|
||||
if (this.form.status != 'trash') {
|
||||
|
@ -1345,6 +1345,15 @@ export default {
|
|||
item: this.$adminOptions.itemEditionMode ? this.item : null
|
||||
},
|
||||
tainacan_plugin.admin_url);
|
||||
|
||||
// In Mobile app, we send a message to inform updates
|
||||
if (
|
||||
this.$adminOptions.mobileAppMode &&
|
||||
webkit &&
|
||||
webkit.messageHandlers &&
|
||||
webkit.messageHandlers.cordova_iab
|
||||
)
|
||||
webkit.messageHandlers.cordova_iab.postMessage(JSON.stringify({ 'type': 'item_updated', 'item': this.item }));
|
||||
})
|
||||
.catch((errors) => {
|
||||
|
||||
|
@ -1366,7 +1375,7 @@ export default {
|
|||
});
|
||||
},
|
||||
onDiscard() {
|
||||
if (!this.$adminOptions.itemEditionMode)
|
||||
if (!this.$adminOptions.itemEditionMode && !this.$adminOptions.mobileAppMode)
|
||||
this.$router.go(-1);
|
||||
|
||||
parent.postMessage({
|
||||
|
|
|
@ -76,6 +76,15 @@ class Admin {
|
|||
array( &$this, 'item_submission' )
|
||||
);
|
||||
|
||||
add_submenu_page(
|
||||
null, // Mobile app page is not listed in the menu
|
||||
__('Mobile App', 'tainacan'),
|
||||
__('Mobile App', 'tainacan'),
|
||||
'manage_tainacan',
|
||||
'tainacan_mobile_app',
|
||||
array( &$this, 'mobile_app' )
|
||||
);
|
||||
|
||||
add_action( 'load-' . $page_suffix, array( &$this, 'load_admin_page' ) );
|
||||
add_action( 'load-' . $roles_page_suffix, array( &$this, 'load_roles_page' ) );
|
||||
add_action( 'load-' . $reports_page_suffix, array( &$this, 'load_reports_page' ) );
|
||||
|
@ -480,5 +489,11 @@ class Admin {
|
|||
$submission->admin_page();
|
||||
}
|
||||
|
||||
public function mobile_app() {
|
||||
require_once('mobile-app/class-tainacan-mobile-app.php');
|
||||
$Mobile_app = new Mobile_App();
|
||||
$Mobile_app->admin_page();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<div class="wrap">
|
||||
<h1>
|
||||
<?php _e('Mobile App', 'tainacan'); ?>
|
||||
</h1>
|
||||
</div>
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Tainacan;
|
||||
|
||||
class Mobile_App {
|
||||
|
||||
public function __construct(){}
|
||||
|
||||
public function admin_page()
|
||||
{
|
||||
include('admin-page.php');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue