Merge branch 'master' of github.com:tainacan/tainacan
This commit is contained in:
commit
ffd2d4e2fa
|
@ -11,3 +11,4 @@ vendor
|
|||
src/vendor
|
||||
node_modules
|
||||
npm-debug.log
|
||||
src/assets/web-components.js
|
2
build.sh
2
build.sh
|
@ -5,6 +5,8 @@ source build-config.cfg
|
|||
#destination=~/devel/wordpress/wp-content/plugins/tainacan
|
||||
|
||||
sh compile-sass.sh
|
||||
npm run build
|
||||
|
||||
composer install
|
||||
|
||||
echo "Atualizando arquivos em $destination"
|
||||
|
|
|
@ -23,9 +23,10 @@ You wil also need:
|
|||
* `composer` to manage dependencies
|
||||
* `sass` to compile sass into css files
|
||||
* `phpunit` to run tests
|
||||
* `node` to work with Vue.js
|
||||
|
||||
```
|
||||
sudo apt-get install phpunit composer ruby
|
||||
sudo apt-get install phpunit composer ruby nodejs npm
|
||||
sudo gem install sass
|
||||
```
|
||||
|
||||
|
@ -44,6 +45,7 @@ Install dependencies via composer
|
|||
|
||||
```
|
||||
composer install
|
||||
npm install
|
||||
```
|
||||
|
||||
And that's pretty much all. Now you will want to set up your tests and your build.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,7 @@ class DevInterface {
|
|||
|
||||
add_action('add_meta_boxes', array(&$this, 'register_metaboxes'));
|
||||
add_action('save_post', array(&$this, 'save_post'));
|
||||
add_action('admin_notices', array(&$this, 'display_error'));
|
||||
add_action('admin_enqueue_scripts', array(&$this, 'add_admin_js'));
|
||||
|
||||
global $Tainacan_Collections, $Tainacan_Filters, $Tainacan_Logs, $Tainacan_Metadatas, $Tainacan_Taxonomies;
|
||||
|
||||
|
@ -24,6 +24,11 @@ class DevInterface {
|
|||
|
||||
}
|
||||
|
||||
function add_admin_js() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
wp_enqueue_script('tainacan-dev-admin', $TAINACAN_BASE_URL . '/assets/web-components.js');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run through all post types attributes and add metaboxes for them.
|
||||
*
|
||||
|
@ -59,6 +64,15 @@ class DevInterface {
|
|||
'normal'
|
||||
|
||||
);
|
||||
|
||||
add_meta_box(
|
||||
$col->get_db_identifier() . '_metadata_js',
|
||||
__('Metadata Components', 'tainacan'),
|
||||
array(&$this, 'metadata_components_metabox'),
|
||||
$col->get_db_identifier(), //post type
|
||||
'normal'
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,6 +227,76 @@ class DevInterface {
|
|||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
function metadata_components_metabox() {
|
||||
global $Tainacan_Collections, $Tainacan_Item_Metadata, $pagenow, $typenow, $post;
|
||||
|
||||
$collections = $Tainacan_Collections->fetch([], 'OBJECT');
|
||||
|
||||
// get current collection
|
||||
$current_collection = false;
|
||||
foreach ($collections as $col) {
|
||||
if ($col->get_db_identifier() == $typenow) {
|
||||
$current_collection = $col;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (false === $current_collection)
|
||||
return;
|
||||
|
||||
$entity = new \Tainacan\Entities\Item($post);
|
||||
|
||||
//for new Items
|
||||
if (!$entity->get_collection_id())
|
||||
$entity->set_collection($current_collection);
|
||||
|
||||
$metadata = $Tainacan_Item_Metadata->fetch($entity, 'OBJECT');
|
||||
|
||||
wp_nonce_field( 'save_metadata_'.$typenow, $typenow.'_metadata_noncename' );
|
||||
|
||||
?>
|
||||
|
||||
<input type="hidden" name="tnc_prop_collection_id" value="<?php echo $current_collection->get_id(); ?>" />
|
||||
|
||||
<div id="postcustomstuff">
|
||||
<table>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="left"><?php _e('Metadata', 'tainacan'); ?></th>
|
||||
<th><?php _e('Value', 'tainacan'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($metadata as $item_meta): ?>
|
||||
|
||||
<?php
|
||||
$value = $item_meta->get_value();
|
||||
if (is_array($value)) $value = json_encode($value);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<label><?php echo $item_meta->get_metadata()->get_name(); ?></label><br/>
|
||||
<small><?php echo $item_meta->get_metadata()->get_description(); ?></small>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo '<tainacan-text name="'.$item_meta->get_metadata()->get_name().'"></tainacan-text>'; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
function collections_dropdown($selected) {
|
||||
|
@ -303,16 +387,7 @@ class DevInterface {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
function display_error() {
|
||||
if ($this->has_errors === false)
|
||||
return;
|
||||
?>
|
||||
<div class="notice notice-success is-dismissible">
|
||||
<p><?php _e('Congratulations, you did it!', 'shapeSpace'); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
|
||||
const API_DIR = __DIR__ . '/api/';
|
||||
const CLASSES_DIR = __DIR__ . '/classes/';
|
||||
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
||||
|
||||
require_once(CLASSES_DIR . 'tainacan-creator.php');
|
||||
require_once(API_DIR . 'tainacan-rest-creator.php');
|
||||
|
|
Loading…
Reference in New Issue