Giter Club home page Giter Club logo

papi's People

Contributors

dependabot[bot] avatar frozzare avatar gitter-badger avatar jordan-trahanov avatar kristofern avatar log1x avatar mykhailo-petrenko avatar nlemoine avatar rasmusbe avatar s3rgiosan avatar vinkla avatar zombiefredrik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

papi's Issues

add class to body based on page type

similar to single adding the classes "single" & "single-post",
it would be great if eg. the class "my-page-type" could be added to the body tag

Multi language support

Custom multi language support via tabs ui and automatic detecting depending on the PTB_LANG_CODE definition. Should follow ISO 639-1

Look over all JavaScript

Look over all JavaScript and remove the part of the property that loads the property JavaScript file and add them to the build script so we only have one JavaScript file for the project.

Tabs should be a property

Tabs should be a property instead of custom Papi feature.

Something like this:

$this->box([
  $this->property([
   'type' => 'tab',
   'title'  => 'Content',
   'settings'  => [
     'items' => 'array of properties'
   ]
  ]);
]);

This will remove a lot of complex functionality to determine if there is a tab or not in the core.

Relationships in sidebar

Relationships should be able to adapt to sidebar, even though it's a bad idea, but see my next issue about 1 relationship, where it could be a desired feature

Repeater + images

Images uploaded in a repeater field, aren't attached to the post. However, it works when not inside of a repeater.

Relationships limit selections

Be able to limit how many selections you can make.
E.g. -1 = as many as you like, 4 = max 4 items ('choose_max' => -1)
Similar to the way you can limit how many items to choose from ('show_max' => -1)

Repeater items order

Be able to order items in the reapeater, either by drag-and-drop or by setting order number.

Add `html_name` method to `Papi_Property` class

As discussed in #62 (comment) it would be nice with a html_name method in Papi_Property class so you can do:

`<input name="' . $this->html_name( $subproperty ) . '" />`

With or without a sub property value. If empty value just return $options->slug value.

To get this working for a repeater I think it's best to send in a second argument that is a count value or have a standard how this kind of properties should implement the counter.

SVG

Just started out with Papi. This is really good stuff!

I am using

        $this->box(
            'Logo', [
                papi_property(
                    [
                        'type'        => 'image',
                        'slug'        => 'page_logo'
                    ]
                )
            ]
        );

And this works great except when I try to upload a svg. I have allowed svg with wordpress so it is not that.

The field in wp-admin just wont update when I choose a svg.

May this be an issue with Papi or am I missing something?

Relationships search

Issue with case sensitive in search-box, e.g. I had a post namned "Middag, lunch och dryck", when searching for "mi" I found it, but when searching for "Mi" I didn't. Searching for "middag, l" also worked but "Middag, l" didn't.

Sort option on page types

Add support for sorting the page types with a sort order or something like that.

public static function page_type () {
    return array(
      'name'        => 'About us',
      'description' => 'About the company',
      'template'    => 'pages/about-us.php',
      'sort_order' => 12
    );
  }

Changelog v1.1.0

  • Add property color as a core property
  • Use WordPress attachment classes for property image
  • Sortable gallery
  • Use property type as 3:e value to generate slug instead of uniqid
  • Use the first column in repeater row as sortable handler instead of the full row
  • Fix better style for repeater property in seamless mode
  • Add a second parameter to _papi_get_all_page_types so it works to get all page types with a specified post type
  • Add a filter to the post/page list so it works to filter the list based on page type
  • Add menu order sort to relationship property
  • Fix so all pages should use only_page_type if it's available
  • Fix css issue with datetime property in Firefox
  • Update select2 to 3.5.2
  • Update moment.js to 2.9.0

Repeater property with WP editor doesn't work

Hi,

I'm trying to use a repeater with a WP editor and it doesn't work. The cloned editors do not respond to click events, only when I publish/update the page. I think that the problem is the duplicate ID's.

Regards,
Sérgio

Box's content disappears

I have a page type with an image repeater and when I create a new page of this type, I see the box and can select multiple images. The problem is that when I publish the page, the selections that I did not appear. In fact, the contents of that box is empty.

I can see, however, the images ID's and description in the postmeta database table.

public function register() {
        $this->box( 'Images', [
            $this->property( [
                'type'     => 'repeater',
                'title'    => 'Images',
                'slug'     => 'images',
                'sidebar'  => false,
                'settings' => [
                    'items' => [
                        $this->property( [
                            'type'  => 'image',
                            'title' => 'Image'
                        ] ),
                        $this->property( [
                            'type'  => 'text',
                            'title' => 'Image description'
                        ] )
                    ]
                ]
            ] )
        ] );
}

Am I missing something here?

Fix so property repeater use get options

Since commit abc3f38 it possible to access $this->get_options() on update_value. The property repeater should use this instead of hidden input fields to get information about columns and properties.

[bug] - _papi_page_type translated

I'm french and while using papi for a recent project, I noticed the page type value called Home was translated to Accueil.

That's because papi is using translation function esc_attr_e to escape attributes:
https://github.com/wp-papi/papi/blob/master/src/includes/admin/class-papi-admin.php#L166

The PR attached resolves this issue. I didn't check the whole code base for all translations functions (__(), _e(), _n(), _x(), _ex(), _nx(), esc_attr__(), esc_attr_e(), esc_attr_x(), esc_html__(), esc_html_e(), esc_html_x(), _n_noop(), _nx_noop(), translate_nooped_plural()) but they shouldn't be used as shortcuts to output raw values.

allow_html for text/string properties

It would be nice to enable html in the string/text (which is not an editor) properties, but not by default. So that you may use some html-markup.

papi on custom post type

Hi,

Is it possible to add papi properties to a custom post type? There's a post_type parameter on the box method but has no effect.

[admin columns] - Page type & post type

I noticed that Papi adds a custom column to every post type, whether there's used in Papi or not:
https://github.com/wp-papi/papi/blob/master/src/includes/admin/class-papi-admin.php#L386

There no logic filtering on which post type the column should be added:
https://github.com/wp-papi/papi/blob/master/src/includes/admin/class-papi-admin.php#L243

Unlike the page type filter:
https://github.com/wp-papi/papi/blob/master/src/includes/admin/class-papi-admin.php#L300

The post type filtering may be done on the class instantiation before seting up any hooks? What do you think?

Investigate how page types can reuse properties on several page types

It would be great to find a good and nice way to reuse properties on several page types.

Example how you could do it, not so nice maybe.

// page-types/functions.php
function _site_property_relationship ($title, $slug) {
  return array(
    'type' => 'relationship',
    'title' => $title,
    'slug' => $slug
   );
}

// page-types/first-page.php
$this->box('My box', array(
  _site_property_relationship('Mat & Bar', 'mat_bar'),
  _site_property_relationship('Event & Möten', 'event_meeting')
));

// page-types/second-page.php
$this->box('My box', array(
  _site_property_relationship('Mat & Bar', 'mat_bar'),
  _site_property_relationship('Event & Möten', 'event_meeting')
));

Associative arrays as property value don't work.

Thanks for really great plugin. It looked very promising and didn't disappoint at most. Experienced one issue that really bugged me while trying to create a custom property that needs to store several types of values.

Given:

<textarea name="<?php echo $options->slug; ?>[address]"><?php echo $value['address']; ?></textarea>

meta is saved, but looks like this (last row):

+---------+---------+------------------------+-----------------------------------+
| meta_id | post_id | meta_key               | meta_value                        |
+---------+---------+------------------------+-----------------------------------+
|    1211 |     413 | _edit_lock             | 1431414216:3                      |
|    1212 |     413 | _edit_last             | 3                                 |
|    1213 |     413 | _wp_page_template      | default                           |
|    1214 |     413 | _papi_page_type        | contact-page/class-tour-page-type |
|    1216 |     413 | _contact_maps_property | Googlemap                         |
|    1229 |     413 | address                | Sofia                             |
+---------+---------+------------------------+-----------------------------------+

As a result $value is always empty.

[Feature] - File property

Hi,

Would you agree to add a file property (like image but will accept any type of file)?
I can work on a PR if needed.

Add support for validation on properties

A new method that every property can use for validation.

Example:

function validate_value( $value ) {
    $valid = empty( $value );
    return array( $valid, 'Error message' );
}

This function should return two values, true or false if the value is valid and the error message if any.

Only have some page types under a page type

For example

When creating a container page with child page that used as items it would be nice to be able to create "MyImageItem" under "MyImageContainer".

Something like the page_types array option on the page type array.

public static function page_type () {
    return array(
      'name'        => 'My image container',
      'description' => 'Image container',
      'template'    => 'pages/no-preview.php',
      'page_types'  => array(
        'My_Image_Item_Page_Type'
      )
    );
  }

Page Type not registered as specific Page Type

If you have no properties registered to a specific Page Type and create a new page, that specific page will not have the page type set.
To recreate the bug:

  1. Create a new Page Type with no properties registered, eg PT1
  2. In wp-admin, add a new page and choose the newly created page type, eg PT1.
  3. Save the page and go back to the list of pages.
  4. The newly created page will not have the new page type set, should have PT1?

Multiple images in repeater can't be added

If i create a repeater and try to upload an image to anything except for the first row the image will seem uploaded, but upon saving it will be lost.

Example screenshot on how it looks:
screen shot 2015-05-06 at 22 55 09

Have checked the access/error-logs in nginx(running on bedrock-ansible stack) and there's no error output there. Also no error message in browser console or in wp-admin.

Tested in Chrome & Safari on latest OS X.

Imported pages should use only_page_type if it's available

When using papi/settings/only_page_type_{$post_type} and you import pages to the post type the page type value in the database don't exists. If papi/settings/only_page_type_{$post_type} exists for a post type it should use that if the page type value don't exists.

Another field for text?

Hi,

Thanks for this wonderful plugin. I really the approach you're using.

However, I didn't see any different properties for textarea and text fields? Do you mind if I submit a PR to add a new property?

Papi ajax

Papi ajax is a new admin class that will handle ajax request against Papi. The ajax class will render property html as a json object.

Request against http://wordpress/papi-ajax/?action=get_property&type=image&title=wow&slug=hej will return this

{
  "html": "property html"
}

All options that you can use in papi_property will work against action=get_property.

The repeater property will use this feature in v1.3.0 rather then the template html that exists in the page load.

This is just the start of the Papi ajax!

Property Flexible

  • Fix so it can render the saved data
  • Refactoring
  • Test to render the value in the theme
  • Add unit tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.