Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
petrmm committed Jun 6, 2019
0 parents commit b894e0f
Show file tree
Hide file tree
Showing 15 changed files with 1,068 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
.vscode
.DS_Store
120 changes: 120 additions & 0 deletions assets/imapie.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.integromat_api_row td, .integromat_api_row th {
padding: 5px 0 !important;
}

.integromat_api_row th {
min-width: 250px;
}

.integromat_api_row h3 {
margin: 30px 0 0;
}

.integromat_api_row p.desc {
font-weight: normal;
margin: 5px 0;
}

.imapie_settings_container.wait {
filter: opacity(20%)
}

.imapie_settings_container.wait * {
cursor: wait;
}

.uncheck_all {
cursor: pointer;
text-decoration: underline;
}


.ui-tabs {
position: relative;
padding: .2em;
}
.ui-tabs .ui-tabs-nav {
margin: 0;
padding: .2em .2em 0;
}
.ui-tabs .ui-tabs-nav li {
list-style: none;
float: left;
position: relative;
top: 0;
margin: 1px .2em 0 0;
border-bottom-width: 0;
padding: 0;
white-space: nowrap;
background-color: white;
}
.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
float: left;
padding: .5em 1em;
text-decoration: none;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active {
margin-bottom: -1px;
padding-bottom: 1px;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,
.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,
.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor {
cursor: text;
}
.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor {
cursor: pointer;
}
.ui-tabs .ui-tabs-panel {
display: block;
border-width: 0;
padding: 1em 1.4em;
background: none;
}

/* Component containers
----------------------------------*/
.ui-widget.ui-widget-content {
border: 1px solid #c5c5c5;
}
.ui-widget-content {
border: 1px solid #dddddd;
background: #ffffff;
color: #333333;
}
.ui-widget-content a {
color: #333333;
}
.ui-widget-header {
border: 1px solid #dddddd;
background: #e9e9e9;
color: #333333;
font-weight: bold;
}
.ui-widget-header a {
color: #333333;
}

/* Layout helpers
----------------------------------*/
.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
content: "";
display: table;
border-collapse: collapse;
}
.ui-helper-clearfix:after {
clear: both;
}
.ui-helper-zfix {
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0);
}
.ui-front {
z-index: 100;
}
46 changes: 46 additions & 0 deletions assets/imapie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
$ = jQuery;
$(document).ready(function () {

$imapieTabs = $("#imapie_tabs").tabs();

$('#imapie_tabs #submit').click(function (e) {
$('.imapie_settings_container').addClass('wait');

$.when(
$.post('options.php', $('#impaie_form_post').serialize()),
$.post('options.php', $('#impaie_form_user').serialize()),
$.post('options.php', $('#impaie_form_comment').serialize()),
$.post('options.php', $('#impaie_form_term').serialize())

).done(function(a1, a2, a3, a4) {
$('.imapie_settings_container').removeClass('wait');
});

return false;
e.preventDefault()
})


$('.uncheck_all').click(function (e) {
uncheckAllStatus = $(this).attr('data-status');

if (uncheckAllStatus == 0) {
$(this).attr('data-status', 1);
} else {
$(this).attr('data-status', 0);
}

$(this).closest('form').find('input[type="checkbox"]').each(function () {
if (uncheckAllStatus == 0) {
$(this).prop('checked', true);
} else {
$(this).prop('checked', false);
}
})
return false;
e.preventDefault()
})


})

Binary file added assets/screenshot-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php defined( 'ABSPATH' ) or die( 'No direct access allowed' );

/**
* @package Custom_Fields_For_REST_API
* @version 1.0
*/

/*
Plugin Name: Custom Fields for REST API
Description: Enhances Wordpress REST API v2 about metadata
Author: Integromat
Author URI: http://www.integromat.com/
Version: 1.0
*/

define('IMAPIE_FIELD_PREFIX', 'integromat_api_field_');
define('IMAPIE_MENUITEM_IDENTIFIER', 'integromat_api_mi');


include __DIR__ . '/response/response.php';
include __DIR__ . '/settings/render.php';
include __DIR__ . '/settings/Controller.php';
include __DIR__ . '/settings/MetaObject.php';
$IAPIControler = new \IntegromatAPI\Controller();
$IAPIControler->init();


// Custom CSS, JS
add_action('admin_enqueue_scripts', function ($hook) {
if (!isset($_GET['page']) || $_GET['page'] !== IMAPIE_MENUITEM_IDENTIFIER) {
return;
}
wp_enqueue_style('imapie_css', plugin_dir_url(__FILE__) . '/assets/imapie.css');
wp_enqueue_script('imapie_js', plugin_dir_url(__FILE__) . '/assets/imapie.js');

// Load WP native jQuery libraries
wp_enqueue_script('jquery-ui-tabs');
});

Loading

0 comments on commit b894e0f

Please sign in to comment.