Plugin Directory

Changeset 1827857


Ignore:
Timestamp:
02/23/2018 04:07:50 PM (8 years ago)
Author:
canvasflow
Message:

Display publish state in canvasflow metabox

Location:
canvasflow/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • canvasflow/trunk/README.md

    r1826541 r1827857  
    5555
    5656#### Changelog
     57##### 0.11.1
     58* Display publish state in canvasflow metabox
     59
    5760##### 0.11.0
    5861* Add support for metabox in post editor
     
    9295
    9396#### Upgrade Notice
     97##### 0.11.1
     98* Display publish state in canvasflow metabox
     99
    94100##### 0.11.0
    95101* Support for canvasflow as metabox in post editor
  • canvasflow/trunk/assets/css/style.css

    r1699142 r1827857  
    6969    }
    7070}
     71
     72.meta-box-button {
     73    display: inline-block;
     74    padding: 0 12px 1px;
     75    border: 1px solid;
     76    box-shadow: 0 1px 0 #006799;
     77    border-color: #0073aa #006799 #006799;
     78    border-radius: 3px;
     79    background: #0085ba;
     80    color: #fff;
     81    text-decoration: none;
     82    text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
     83    height: 27px;
     84    line-height: 29px;
     85}
     86
     87a.meta-box-button {color:#fff;}
     88
     89.meta-box-post-state-in-sync {
     90    color: #009932;
     91    font-weight: 600;
     92}
     93
     94.meta-box-post-state-unpublished {
     95    color: #595959;
     96    font-weight: 600;
     97}
     98
     99.meta-box-post-state-out-sync {
     100    color: #FF530D;
     101    font-weight: 600;
     102}
  • canvasflow/trunk/canvasflow-plugin.php

    r1826541 r1827857  
    33  Plugin Name: Canvasflow for WordPress
    44  Description: This out-of-the-box connector provides a quick and simple way to push your blog content directly to an existing Canvasflow publication.
    5   Version: 0.11.0
     5  Version: 0.11.1
    66    Developer:  Canvasflow
    77    Developer URI: https://canvasflow.io
  • canvasflow/trunk/includes/canvasflow-metabox.php

    r1826541 r1827857  
    134134                        $selected_issue_id = $selection->issue_id;
    135135                    }
     136
     137                    $post_state = $this->get_post_state($post_id);
     138                    $post_state_content = "";
     139                    $post_state_style = "";
     140                    if($post_state == "unpublished") {
     141                        $post_state_style = "meta-box-post-state-unpublished";
     142                        $post_state_content = "Unpublished";
     143                    } else if($post_state == "out_of_sync") {
     144                        $post_state_style = "meta-box-post-state-out-sync";
     145                        $post_state_content = "Out of sync";
     146                    } else {
     147                        $post_state_style = "meta-box-post-state-in-sync";
     148                        $post_state_content = "In sync";
     149                    }
    136150                   
    137151                    include( plugin_dir_path( __FILE__ ) . 'views/canvasflow-metabox-view.php');
     
    144158           
    145159        }
     160
     161        function get_post_state($post_id) {
     162            $user_id = $this->user_id;
     163            $post_table_name = $this->wpdb->prefix."posts";
     164            $query = "SELECT canvasflow_posts.id as id, canvasflow_posts.published as published, post.post_modified as post_modified_date FROM {$post_table_name} as post LEFT JOIN wp_canvasflow_posts as canvasflow_posts ON(post.id = canvasflow_posts.post_id) WHERE canvasflow_posts.post_id = ${post_id} LIMIT 1;";
     165
     166            $posts = $this->wpdb->get_results($query);
     167            if(sizeof ($posts) == 0) {
     168                return "unpublished";
     169            } else {
     170                $post = $posts[0];
     171                $published = $post->published;
     172                $post_modified_date = $post->post_modified_date;
     173                if(strtotime($post_modified_date) > strtotime($published)){
     174                    return "out_of_sync";
     175                } else {
     176                    return "in_sync";
     177                }
     178            }
     179        }
    146180    }
    147181?>
  • canvasflow/trunk/includes/views/canvasflow-metabox-view.php

    r1826541 r1827857  
    2828                    <small>
    2929                        <em>
    30                             Issue in canvasflow where the article is going to be published.
     30                            Target issue
    3131                        </em>
    3232                    </small>
     
    6060                    <small>
    6161                        <em>
    62                             Determines the style applied to an uploaded article.
     62                            CF Style
    6363                        </em>
    6464                    </small>
     65                </td>
     66            </tr>
     67            <tr>
     68                <th scope="row">
     69                    <label for="style_id">Publish state</label>
     70                </th>
     71                <td id="cf_state" class="<?php echo $post_state_style?>">
     72                    <?php echo $post_state_content?>
    6573                </td>
    6674            </tr>
     
    7280<hr>
    7381<div style="text-align: right;">
    74     <a id="cf_publish" style="display: inline-block; padding: 0 12px 2px; border: 0; box-shadow: 0 1px 0 #006799; border-color: #0073aa #006799 #006799; border-radius: 6px; background: #0085ba; color: #fff; text-decoration: none; text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799; height: 30px;line-height: 28px;" href="javascript:;">Update</a>
     82    <a id="cf_publish" class="meta-box-button" href="javascript:;">Publish to Canvasflow</a>
    7583</div>
    7684
     
    95103        request.done(function (response, textStatus, xhr){
    96104            var status = xhr.status;
     105            let currentClass = $('#cf_state').attr('class');
     106            $("#cf_state").removeClass(currentClass);
     107            $("#cf_state").addClass('meta-box-post-state-in-sync');
     108            $("#cf_state").html("In Sync");
    97109            alert('Article publish successfully');
    98110        });
  • canvasflow/trunk/readme.txt

    r1826541 r1827857  
    7070
    7171== Changelog ==
     72= 0.11.1 =
     73* Display publish state in canvasflow metabox
     74
    7275= 0.11.0 =
    7376* Add support for metabox in post editor
     
    106109
    107110== Upgrade Notice ==
     111= 0.11.1 =
     112Display publish state in canvasflow metabox
     113
    108114= 0.11.0 =
    109115Support for canvasflow as metabox in post editor
Note: See TracChangeset for help on using the changeset viewer.