Plugin Directory

Changeset 1181636


Ignore:
Timestamp:
06/16/2015 05:49:27 AM (11 years ago)
Author:
samwilson
Message:

Shortcode.

Location:
tabulate/trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • tabulate/trunk/README.md

    r1181512 r1181636  
    3131   negations of all of these). Multiple filters are conjunctive (i.e. with a
    3232   logical *and*).
    33 1. Access can be granted to *read*, *create*, *update*, *delete*, and *import*
     332. Access can be granted to *read*, *create*, *update*, *delete*, and *import*
    3434   records in any or all tables. (This can be done by anyone with the
    3535   *promote_users* capability.)
    36 2. CSV data can be imported, with the UI supporting column mapping, data
     363. CSV data can be imported, with the UI supporting column mapping, data
    3737   validation, and previewing prior to final import. If an imported row has a
    3838   value for the Primary Key, the existing row will be overwritten.
    39 3. Data can be exported to CSV, including after filters have been applied.
    40 4. A quick-jump navigation box (located top right of every page) can be
     394. Data can be exported to CSV, including after filters have been applied.
     405. A quick-jump navigation box (located top right of every page) can be
    4141   activated by installing the [WP REST API](https://wordpress.org/plugins/json-rest-api/)
    4242   plugin.
    43 5. Records in tables with *date* columns can be viewed in a calendar.
    44 6. Entity Relationship Diagrams (drawn with [GraphViz](http://graphviz.org/))
     436. Records in tables with *date* columns can be viewed in a calendar.
     447. Entity Relationship Diagrams (drawn with [GraphViz](http://graphviz.org/))
    4545   can be automatically generated, with any specified subset of tables. Foreign
    4646   keys are displayed as directed edges. This feature is only available if the
    4747   [TFO Graphviz plugin](https://wordpress.org/plugins/tfo-graphviz/) is installed.
    48 7. All data modifications are recorded, along with optional comments that users
     488. All data modifications are recorded, along with optional comments that users
    4949   can provide when updating data.
     509. The `[tabulate]` shortcode can be used to embed tables, lists, and row-counts
     51   into WordPress content. For more details, see the [FAQ section](https://wordpress.org/plugins/tabulate/faq/).
    5052
    5153## Installation
     
    6365## Frequently Asked Questions
    6466
    65 ### How should issues be reported?
     67### How does one use the shortcode?
     68
     69A [Shortcode](http://codex.wordpress.org/Shortcode) is a WordPress method of
     70embedding content into posts and pages. Tabulate provides one short code,
     71`[tabulate]`, which can be used to add tables, lists, and record-counts to your
     72content. Its parameters are as follows:
     73
     74`table` — The name of the table in question. Required. No default.
     75
     76`format` — One of `table`, `list`, or `count`. Optional. Defaults to `table`.
     77
     78Do note that if a table is not accessible to the browsing user then nothing will
     79be displayed. (This currently means that anonymous users can not view any
     80Tabulate data, because there is no way to grant them access; this will be fixed
     81soon.)
     82
     83### Where should issues be reported?
    6684
    6785Please log all bugs, feature requests, and other issues in the GitHub issue
    68 tracker: https://github.com/tabulate/tabulate/issues
     86tracker at https://github.com/tabulate/tabulate/issues
    6987
    7088### What modifications does Tabulate make to the database?
     
    8098
    8199### Where is the developers' documentation?
     100
    82101For information about the development of Tabulate or integrating other plugins
    83102with it please see
     
    95114https://github.com/tabulate/tabulate/commits/master
    96115
    97 Prior to version 1, changes are not being lsited here (there are too many of
     116Prior to version 1, changes are not being listed here (there are too many of
    98117them, and nothing is stable yet).
    99118
  • tabulate/trunk/tabulate.php

    r1181537 r1181636  
    33 * Plugin Name: Tabulate
    44 * Description: Manage relational tabular data within the WP admin area, using the full power of your MySQL database.
    5  * Version: 0.15.0
     5 * Version: 0.16.0
    66 * Author: Sam Wilson
    77 * Author URI: http://samwilson.id.au/
     
    1010 */
    1111
    12 define( 'TABULATE_VERSION', '0.15.0' );
     12define( 'TABULATE_VERSION', '0.16.0' );
    1313define( 'TABULATE_SLUG', 'tabulate' );
    1414
     
    4242    add_filter( 'json_endpoints', array( $jsonController, 'register_routes' ) );
    4343} );
     44
     45// Shortcode.
     46$shortcode = new \WordPress\Tabulate\Shortcode( $wpdb );
     47add_shortcode(TABULATE_SLUG, array( $shortcode, 'run' ) );
  • tabulate/trunk/templates/table.html

    r1160146 r1181636  
    103103</div>
    104104
    105 <table class='wp-list-table widefat'>
    106     <thead>
    107         <tr>
    108             <th>&nbsp;</th>
    109             {% for column in table.get_columns %}
    110             <th>{{column.get_title}}</th>
    111             {% endfor %}
    112         </tr>
    113     </thead>
    114     <tbody>
    115         {% for record in records %}
    116         <tr>
    117             <td>
    118                 <a href="{{ record.get_url() }}" class="">Edit</a>
    119             </td>
    120             {% for column in table.get_columns %}
    121             <td class="type-{{ column.type }} {% if column.is_foreign_key %}is-foreign-key{% endif %}">
    122 
    123                 {% if column.is_foreign_key %}
    124 
    125                 <a href="{{ record.get_referenced_record(column.get_name).get_url }}">
    126                     {{ attribute(record, column.get_name~'FKTITLE') }}
    127                 </a>
    128 
    129                 {% elseif column.is_boolean %}
    130                 {% if attribute(record, column.get_name) is sameas(true) %}
    131                 Yes
    132                 {% elseif attribute(record, column.get_name) is sameas(false) %}
    133                 No
    134                 {% else %}
    135 
    136                 {% endif %}
    137 
    138                 {% else %}
    139                 {{ attribute(record, column.get_name) }}
    140 
    141                 {% endif %}
    142             </td>
    143             {% endfor %}
    144         </tr>
    145         {% endfor %}
    146     </tbody>
    147 </table>
     105{% include 'data_table.html' with { links:true } %}
    148106
    149107{%endblock%}
Note: See TracChangeset for help on using the changeset viewer.