Skip to content

Commit

Permalink
Merge branch 'develop' into refactor/admin
Browse files Browse the repository at this point in the history
Conflicts:
	assets/css/admin-views.css
	includes/class-admin-views.php
  • Loading branch information
Luis Godinho committed Sep 16, 2015
2 parents c702d79 + 429a3f0 commit 69fa6ba
Show file tree
Hide file tree
Showing 114 changed files with 9,994 additions and 8,502 deletions.
3 changes: 3 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src_dir: .
coverage_clover: ./tmp/clover.xml
json_path: ./tmp/coveralls-upload.json
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,16 @@ languages/gravityview-pt.po

## Plugin-specific files:

# Unit tests
/tmp
/tests/bin/tmp

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml
languages/gravityview-de.mo


languages/gravityview-de.po
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
language: php

sudo: false

php:
- 5.3
- 5.4
- 5.5
- 5.6

env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=4.2 WP_MULTISITE=0
- WP_VERSION=4.1 WP_MULTISITE=0
- WP_VERSION=4.0 WP_MULTISITE=0

matrix:
include:
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=1

before_script:
- bash tests/bin/install.sh gravityview_test root '' localhost $WP_VERSION
- bash tests/bin/travis.sh before

script: phpunit -c phpunit.xml.dist

after_script:
- bash tests/bin/travis.sh after
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover ./tmp/clover.xml
13 changes: 7 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ module.exports = function(grunt) {
"assets/js/admin-post-edit.js",
"assets/js/admin-widgets.js",
"assets/js/admin-entries-list.js",
"assets/js/fe-views.js"
"assets/js/fe-views.js",
"includes/widgets/search-widget/assets/js/source/admin-widgets.js"
],

// used to generate a react build for the live environment
Expand Down Expand Up @@ -115,12 +116,12 @@ module.exports = function(grunt) {
searchExt: {
files: [{
expand: true,
cwd: 'includes/extensions/search-widget/assets/js/source/',
cwd: 'includes/widgets/search-widget/assets/js/source/',
src: ['*.js','!*.min.js'],
dest: 'includes/extensions/search-widget/assets/js/',
dest: 'includes/widgets/search-widget/assets/js/',
ext: '.min.js'
}]
},
}
},

watch: {
Expand All @@ -129,8 +130,8 @@ module.exports = function(grunt) {
tasks: ['uglify:main','newer:jshint']
},
extension_js: {
files: ['includes/extensions/**/*.js','!includes/extensions/**/*.min.js'],
tasks: ['uglify:searchExt']
files: ['includes/widgets/**/*.js','!includes/widgets/**/*.min.js'],
tasks: ['uglify:searchExt','newer:jshint']
},
templates: {
files: ['templates/css/**/*.scss','!templates/css/**/*.css'],
Expand Down
1 change: 0 additions & 1 deletion assets/css/admin-views.css

This file was deleted.

3 changes: 3 additions & 0 deletions assets/css/scss/admin-metabox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

padding: 0;

// Hide until shown using JS
display: none;

// For the Advanced Filter plugin, and any other field filters
.gform-field-filter {
clear: both;
Expand Down
8 changes: 8 additions & 0 deletions assets/css/scss/admin-tooltips.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ body .ui-tooltip {
border-color: #999 transparent;
border-width: 10px 10px 0;
}

/**
* Fix double close icons in jQuery UI dialog boxes
* @see https://github.com/katzwebservices/GravityView/issues/438
*/
.gv-dialog .ui-dialog-titlebar-close:before {
content: '';
}
8 changes: 7 additions & 1 deletion assets/css/scss/admin-views.scss
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,11 @@ hr {
font-size: 1.1em;
clear: left;

// Hide search mode by default
&.gv-setting-container-search_mode {
display: none;
}

&:last-child {
// border-bottom: none;
padding-bottom: .5em;
Expand Down Expand Up @@ -766,10 +771,11 @@ hr {

}

.gv-widget-search-fields, .gv-dialog-options {
.gv-widget-search-fields, .postbox .gv-dialog-options {

table {
padding-bottom: 15px;
margin: .5em auto; // Give rows some breathing room around other settings

td, th {
text-align: left;
Expand Down
32 changes: 27 additions & 5 deletions assets/js/admin-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
// Checks if the execution is on a Start Fresh context
startFreshStatus: false,

/**
* @since 1.14
* @var int The width of the modal dialogs to use for field and widget settings
*/
dialogWidth: 650,

init: function () {

// short tag
Expand Down Expand Up @@ -246,6 +252,7 @@
vcfg.currentFormId = '';
vcfg.togglePreviewButton();
$( "#gravityview_view_config, #gravityview_select_template, #gravityview_sort_filter, .gv-form-links" ).hide();
viewGeneralSettings.metaboxObj.hide();

},

Expand Down Expand Up @@ -421,9 +428,9 @@
resizable: false,
width: function () {

// If the window is wider than 550px, use 550
if ( $( window ).width() > 550 ) {
return 550;
// If the window is wider than {vcfg.dialogWidth}px, use vcfg.dialogWidth
if ( $( window ).width() > vcfg.dialogWidth ) {
return vcfg.dialogWidth;
}

// Otherwise, return the window width, less 10px
Expand Down Expand Up @@ -520,6 +527,7 @@

$( '#gravityview_view_config' ).slideDown( 150 );

viewGeneralSettings.metaboxObj.show();
viewConfiguration.toggleDropMessage();
viewConfiguration.init_droppables();
viewConfiguration.init_tooltips();
Expand Down Expand Up @@ -643,13 +651,13 @@
parent.find( ".gv-template-preview" ).dialog( {
dialogClass: 'wp-dialog gv-dialog',
appendTo: $( "#gravityview_select_template" ),
width: 550,
width: viewConfiguration.dialogWidth,
open: function () {
$( '<div class="gv-overlay" />' ).prependTo( '#wpwrap' );
},
close: function () {
$( this ).dialog( "option", "appendTo", parent );
$( '#wpwrap > .gv-overlay' ).fadeOut( 'fast', function () {
$( '#wpwrap' ).find('> .gv-overlay' ).fadeOut( 'fast', function () {
$( this ).remove();
} );
},
Expand Down Expand Up @@ -972,6 +980,13 @@
* @return {void}
*/
enable_publish: function () {

/**
* Added in ~ WP 3.8
* @see https://github.com/WordPress/WordPress/blob/master/wp-admin/js/post.js#L365-L367
*/
$( document ).trigger( 'autosave-enable-buttons.edit-post' );

// Restore saving after settings are generated
$( '#publishing-action #publish' ).prop( 'disabled', null ).removeClass( 'button-primary-disabled' );
},
Expand All @@ -981,6 +996,13 @@
* @return {void}
*/
disable_publish: function () {

/**
* Added in ~ WP 3.8
* @see https://github.com/WordPress/WordPress/blob/master/wp-admin/js/post.js#L363-L364
*/
$( document ).trigger( 'autosave-disable-buttons.edit-post' );

$( '#publishing-action #publish' ).prop( 'disabled', 'disabled' ).addClass( 'button-primary-disabled' );
},

Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin-views.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/config.doxygen
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = GravityView
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.13
PROJECT_NUMBER = 1.13.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Plugin Name: GravityView
* Plugin URI: http://gravityview.co
* Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output.
* Version: 1.13
* Version: 1.13.1
* Author: Katz Web Services, Inc.
* Author URI: http://www.katzwebservices.com
* Text Domain: gravityview
Expand Down Expand Up @@ -89,7 +89,7 @@
*/
final class GravityView_Plugin {

const version = '1.13';
const version = '1.13.1';

private static $instance;

Expand Down
6 changes: 3 additions & 3 deletions includes/admin/class.render.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function get_default_field_options( $field_type, $template_id, $fi
);

// Match Table as well as DataTables
if( preg_match( '/table/ism', $template_id ) ) {
if( preg_match( '/table/ism', $template_id ) && 'single' !== $context ) {
$field_options['width'] = array(
'type' => 'number',
'label' => __('Percent Width', 'gravityview'),
Expand Down Expand Up @@ -211,10 +211,10 @@ public static function render_field_options( $field_type, $template_id, $field_i
switch( $option['type'] ) {
// Hide hidden fields
case 'hidden':
$output .= '<div class="gv-setting-container screen-reader-text">'. $field_output . '</div>';
$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>';
break;
default:
$output .= '<div class="gv-setting-container">'. $field_output .'</div>';
$output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>';
}
}

Expand Down
6 changes: 1 addition & 5 deletions includes/admin/metaboxes/views/select-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
//current value
$current_template = gravityview_get_template_id( $post->ID );

/**
* @filter `gravityview_register_directory_template` Fetch available View templates
* @param array $templates Templates to show
*/
$templates = apply_filters( 'gravityview_register_directory_template', array() );
$templates = gravityview_get_registered_templates();

// current input
?>
Expand Down
2 changes: 1 addition & 1 deletion includes/class-admin-approve-entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public static function update_approved( $entry_id = 0, $approved = 0, $form_id =
if( class_exists( 'RGFormsModel' ) ){
global $current_user;
get_currentuserinfo();
RGFormsModel::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
RGFormsModel::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note, 'gravityview' );
}

/**
Expand Down
63 changes: 47 additions & 16 deletions includes/class-admin-views.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function __construct() {

add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );

add_action( 'manage_gravityview_posts_custom_column', array( __CLASS__, 'add_connected_form_column_content'), 10, 2 );
add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );

}

Expand Down Expand Up @@ -214,31 +214,60 @@ public function tooltips( $tooltips = array() ) {
*
* @return void
*/
static public function add_connected_form_column_content( $column_name = NULL, $post_id ) {
public function add_custom_column_content( $column_name = NULL, $post_id ) {

if( !empty( $column_name ) && $column_name !== 'gv_connected_form' ) { return; }
$output = '';

$form_id = gravityview_get_form_id( $post_id );
switch ( $column_name ) {
case 'gv_template':

// All Views should have a connected form. If it doesn't, that's not right.
if( empty($form_id) ) {
do_action( 'gravityview_log_error', sprintf( '[add_connected_form_column_content] View ID %s does not have a connected GF form.', $post_id ) );
echo __( 'Not connected.', 'gravityview' );
return;
}
$template_id = gravityview_get_template_id( $post_id );

$form = gravityview_get_form( $form_id );
// All Views should have a connected form. If it doesn't, that's not right.
if ( empty( $template_id ) ) {
do_action( 'gravityview_log_error', sprintf( __METHOD__ . ' View ID %s does not have a connected template.', $post_id ) );
break;
}

if( !$form ) {
do_action( 'gravityview_log_error', sprintf( '[add_connected_form_column_content] Connected form not found: Form #%d', $form_id ) );
$templates = gravityview_get_registered_templates();

echo __( 'The connected form can not be found; it may no longer exist.', 'gravityview' );
}
$template = isset( $templates[ $template_id ] ) ? $templates[ $template_id ] : false;

// Generate backup if label doesn't exist: `example_name` => `Example Name`
$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );

echo self::get_connected_form_links_html( $form, $post_id );
$output = $template ? $template['label'] : $template_id_pretty;

break;

case 'gv_connected_form':

$form_id = gravityview_get_form_id( $post_id );

// All Views should have a connected form. If it doesn't, that's not right.
if ( empty( $form_id ) ) {
do_action( 'gravityview_log_error', sprintf( '[add_data_source_column_content] View ID %s does not have a connected GF form.', $post_id ) );
$output = __( 'Not connected.', 'gravityview' );
break;
}

$form = gravityview_get_form( $form_id );

if ( ! $form ) {
do_action( 'gravityview_log_error', sprintf( '[add_data_source_column_content] Connected form not found: Form #%d', $form_id ) );

$output = __( 'The connected form can not be found; it may no longer exist.', 'gravityview' );
}

$output = self::get_connected_form_links( $form );

break;
}

echo $output;
}


/**
* Get HTML links relating to a connected form, like Edit, Entries, Settings, Preview
* @param array|int $form_id Gravity Forms forms array, or the form ID
Expand Down Expand Up @@ -367,6 +396,8 @@ public function add_post_type_columns( $columns ) {

$columns['gv_connected_form'] = __('Data Source', 'gravityview');

$columns['gv_template'] = __('Template', 'gravityview');

// Add the date back in.
$columns['date'] = $date;

Expand Down
Loading

0 comments on commit 69fa6ba

Please sign in to comment.