Plugin Directory

Changeset 1495983


Ignore:
Timestamp:
09/14/2016 09:25:32 PM (10 years ago)
Author:
stevorevo
Message:

Added missing inventory status update shortcode

Location:
virtuous/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • virtuous/trunk/admin/project-settings.php

    r1483555 r1495983  
    246246            <p><h3>Project Details</h3></p>
    247247            <p><strong>Shortcode name:</strong> virtuous_project_details</p>
    248             <p><strong>No optional attributes</strong></p>
     248            <p><strong>Optional attribute:</strong></p>
     249            <p>
     250                <strong>update_status</strong> - temporarily changes Inventory Status to Not Available<br/>
     251            </p>
    249252            <p><strong>Sample:</strong></p>
    250253            <p>
    251                 [virtuous_project_details]<br/>
     254                [virtuous_project_details update_status="true"]<br/>
    252255            </p>
    253256
  • virtuous/trunk/assets/js/virtuous.js

    r1483555 r1495983  
    11var $ = jQuery.noConflict();
    22
    3 function redirect_to_giving_fuel(redirect_url, project_id) {
     3function redirect_to_giving_fuel(redirect_url, project_id, update_status) {
    44
    55    var $ = jQuery.noConflict();
    6     var data = {
    7         action: 'update_project_status',
    8         project_id: project_id
    9     };
    10     $.post({
    11         url: virtuous_ajax_script.ajaxurl,
    12         data: data,
    13         success: function( response ) {
    14             console.log(response );
    15         },
    16         error: function( response ) {
    17             console.log( response );
    18         }
    19     });
     6
     7    if (update_status == 'true') {
     8        var data = {
     9            action: 'update_project_status',
     10            project_id: project_id
     11        };
     12        $.post({
     13            url: virtuous_ajax_script.ajaxurl,
     14            data: data,
     15            success: function( response ) {
     16                console.log(response );
     17            },
     18            error: function( response ) {
     19                console.log( response );
     20            }
     21        });     
     22    }
     23   
    2024    window.location.href = redirect_url;
    2125}
  • virtuous/trunk/lib/core/class-virtuous-project.php

    r1483555 r1495983  
    265265        $support_button_text = '';
    266266        $base_support_url = '';
     267
     268        extract( shortcode_atts(array(
     269          'update_status' => 'false'
     270        ), $atts ) );
    267271
    268272        $virtuous_api_project_types_serialized = get_option( 'virtuous_api_project_types' );
     
    334338
    335339                if ( $include_support_button ) {
    336                     $return_val .= '&nbsp;&nbsp;<button class="x-btn" type="button" onclick="redirect_to_giving_fuel(\'' . $support_url . '\', \'' . $id . '\')">' . $support_button_text . '</button>';
     340                    $return_val .= '&nbsp;&nbsp;<button class="x-btn" type="button" onclick="redirect_to_giving_fuel(\'' . $support_url . '\', \'' . $id . '\', \'' . $update_status . '\')">' . $support_button_text . '</button>';
    337341                }
    338342
Note: See TracChangeset for help on using the changeset viewer.