Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
woodyhayday committed Dec 23, 2024
1 parent 2c12884 commit e415a2f
Show file tree
Hide file tree
Showing 12 changed files with 189 additions and 88 deletions.
18 changes: 15 additions & 3 deletions ProjectPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Project Pages
Plugin URI: https://projectpages.io
Description: Project Pages is the simplest way to share your projects beautifully.
Version: 2.0.5
Version: 2.1
Author: <a href="https://projectpages.io">Project Pages.io</a>
*/

Expand Down Expand Up @@ -408,6 +408,8 @@ function projectPages_admin_menu() {
$project_pages_settings_menu_item = add_submenu_page( 'edit.php?post_type=projectpage', 'Project Pages', 'Settings', 'manage_options', $projectPages_slugs['settings'], 'projectPages_pages_settings' );
add_action( "admin_print_styles-{$project_pages_settings_menu_item}", 'projectPages_enqueue_settings_page' );

do_action('project_pages_admin_menu');

}

// put out any logic we need to admin header (menu rewrite url for js)
Expand Down Expand Up @@ -466,7 +468,7 @@ function projectPages_enqueue_editor_page() {
wp_enqueue_script( 'bootstrap-datepicker-js', PROJECTPAGES_URL . 'js/libs/bootstrap-datepicker.min.js', array('jquery') );

wp_enqueue_style( 'projectpagesadmcss', plugins_url('/css/ProjectPages.Admin.min.css',__FILE__) );
wp_enqueue_script( 'pp_editor_js', PROJECTPAGES_URL . 'js/ProjectPages.Admin.min.js' );
wp_enqueue_script( 'pp_editor_js', PROJECTPAGES_URL . 'js/ProjectPages.admin.editor.min.js' );
//wp_enqueue_script( 'pp_editor_bs_select_js', PROJECTPAGES_URL . 'js/libs/bootstrap-select.js', array('jquery','bootstrap-js') );
//wp_enqueue_style( 'pp_editor_bs_select_css', plugins_url('/css/bootstrap-select.min.css',__FILE__) );
wp_enqueue_style( 'projectpagesspectrumcss', plugins_url('/css/libs/spectrum.css',__FILE__) );
Expand Down Expand Up @@ -1664,4 +1666,14 @@ function projectPages_enqueue_announcement_script($hook) {
));
}
add_action('admin_enqueue_scripts', 'projectPages_enqueue_announcement_script');
add_action('wp_ajax_dismiss_announcement_pp', 'projectPages_dismiss_announcement');
add_action('wp_ajax_dismiss_announcement_pp', 'projectPages_dismiss_announcement');


function pp_component($component, $args = array()){

global $pp_component_args;
$pp_component_args = $args;

include PROJECTPAGES_PATH . 'pages/components/' . $component . '.php';

}
1 change: 1 addition & 0 deletions css/ProjectPages.Settings.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion includes/ProjectPages.Config.Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/* ======================================================
General storage :D
====================================================== */
global $projectPageStatuses;
global $projectPageStatuses, $projectPageDefaultStatuses;
$projectPageStatuses = array(

// Hard typed for fun.
Expand All @@ -35,6 +35,8 @@
'evolved' => array(__('Evolved','projectpages'), 'violet')

);
// clone it into defaults
$projectPageDefaultStatuses = $projectPageStatuses;

// permalink root structure: e.g. yourblog.com/projects/PROJECT
// superceded by setting, see: projectPages_permalink_root()
Expand Down
10 changes: 10 additions & 0 deletions includes/ProjectPages.DAL.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,16 @@ function projectPages_get_single_project( $force_refresh = false ){
// no cache, or force refresh, retrieve:
$project = projectPages_getProject( $post->ID, $post, true, true );

// check for missing statuses (in pro we can now customise statuses which can mean we lose some)
if ( !isset( $project['status'] ) || !in_array( $project['status'], projectPages_statuses_all() ) ){

// default
$project['status'] = 'idea';
$project['status_label'] = __('Idea','projectpages');
$project['status_colour'] = 'teal';

}

// cache it
$project_pages_single = $project;

Expand Down
13 changes: 10 additions & 3 deletions includes/ProjectPages.MetaBoxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,16 @@ public function print_meta_box( $post, $metabox ) {
<?php foreach ($projectPageStatuses as $statusKey => $status){
echo '<option value="'.$statusKey.'"';
if (isset($projectPageMeta['status']) && $projectPageMeta['status'] == $statusKey) echo ' selected="selected"';
echo '><div class="statusCircle '.$status[1].'"></div>'.$status[0].'</option>';
} ?>
echo '>'.$status[0].'</option>'; // <div class="statusCircle '.$status[1].'"></div>
}
?>
</select>
<?php
// from 2.1 there's custom statuses in pro, so we need to catch situations where a status has been deleted
if (isset($projectPageMeta['status']) && !array_key_exists($projectPageMeta['status'], $projectPageStatuses)) {
echo '<div class="alert alert-warning">' . sprintf(__('Your original status (%s) is no longer available (Custom statuses have been changed). Please select a different status or edit your custom statuses.','projectpages'), ucfirst($projectPageMeta['status'])) . '</div>';
}
?>
</td>
</tr>

Expand Down Expand Up @@ -1052,7 +1059,7 @@ public function print_meta_box( $post, $metabox ) {

<div class="mb-3">
<label class="form-label"><?php _e( 'Log:', 'projectpages' ); ?></label>
<?php wp_editor( '', 'project_page_add_log_body', array( 'height', 500 ) ); ?>
<?php wp_editor( '', 'project_page_add_log_body', array( 'height', 500, 'tinymce' => true ) ); ?>
</div>
</div>
<div class="modal-footer">
Expand Down
1 change: 0 additions & 1 deletion js/ProjectPages.Admin.min.js

This file was deleted.

22 changes: 21 additions & 1 deletion js/ProjectPages.Admin.js → js/ProjectPages.admin.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,34 @@ function projectPages_open_log_edit_modal( id ){

if ( log ){

var log_body = '';
if ( typeof log.body == 'string' ){
log_body = log.body;
}

var content;
var inputid = 'project_page_edit_log_body';
var editor = tinyMCE.get(inputid);
if (editor) {
// Ok, the active tab is Visual
content = editor.getContent();
} else {
// The active tab is HTML, so just query the textarea
content = jQuery('#'+inputid).val();
}

// fill in data
jQuery('#project-pages-edit-log-id').val( id );
jQuery('#project-pages-edit-log-title').val( log.title );
jQuery('#project-pages-edit-log-date').val( log.date );
jQuery('#project-pages-edit-log-dashicon').val( log.icon );
dashiconsPickerChange( '#project-pages-edit-log-dashicon', log.icon );
//tinyMCE.activeEditor.setContent( projectPages_decodeHtml( log.body ) );
tinyMCE.get('project_page_edit_log_body').setContent( projectPages_decodeHtml( log.body ) );
if ( editor ){
editor.setContent( projectPages_decodeHtml( log_body ) );
} else {
jQuery('#project_page_edit_log_body').val( projectPages_decodeHtml( log_body ) );
}



Expand Down
Loading

0 comments on commit e415a2f

Please sign in to comment.