Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Feature/1753 search tab v2 #2213

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3a0a30f
Start work on adding search tab
zackkatz Dec 7, 2022
0a89a22
Proof of concept: get the fields to render using configuration
zackkatz Aug 4, 2023
25a4be2
Add contexts to the field settings
zackkatz Aug 4, 2023
26eae89
Remove Flexibility (remove IE support)
zackkatz Aug 7, 2023
5b0962a
Add "Advanced Search Fields" section
zackkatz May 10, 2024
9876f05
Remove usage of $gravityview_view globals
zackkatz May 16, 2024
5ea910a
Add some more context to the readme [ci skip]
zackkatz May 16, 2024
62b1d19
Don't show as a tab; show inside Search Bar widget
zackkatz May 22, 2024
8025067
When removing a search field, don't remove widget
zackkatz May 22, 2024
1fcb1db
Make the Search Bar widget wider
zackkatz May 22, 2024
303ac75
Don't show field details in Search Form
zackkatz May 22, 2024
557e821
Allow setting the ID attr HTML-type fields/widgets
zackkatz May 22, 2024
873dbce
Move search fields to top of widget settings
zackkatz May 22, 2024
ba0c76c
Push what I have so Vlad can test
zackkatz May 24, 2024
89762e7
Break up search in multiple parts for Layout Builder
doekenorg Nov 25, 2024
017f1c3
Merge branch 'develop' into feature/1753-search-tab-v2
doekenorg Nov 25, 2024
06e2b64
Close tabs when clicking inside a dialog
doekenorg Nov 25, 2024
113145d
Fix sorting on modals
doekenorg Nov 27, 2024
7c7acbe
Merge branch 'develop' into feature/1753-search-tab-v2
doekenorg Nov 28, 2024
f80cfda
Merge branch 'develop' into feature/1753-search-tab-v2
doekenorg Dec 2, 2024
002abdf
Add search type
doekenorg Dec 3, 2024
c7a4503
Fix search field modal
doekenorg Dec 3, 2024
03e557f
Add autoloader (for search only for now)
doekenorg Dec 3, 2024
c33678a
Fix widget template error
doekenorg Dec 3, 2024
96a481f
Fix saving fields on the search contexts
doekenorg Dec 3, 2024
6c83475
Add base for Search Fields
doekenorg Dec 3, 2024
7589a80
Hide "old" settings for now
doekenorg Dec 4, 2024
1646dce
Fix adding search type fields
doekenorg Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Start work on adding search tab
  • Loading branch information
zackkatz authored and doekenorg committed Nov 20, 2024
commit 3a0a30f52ad73c1e9a75b8b7e16c20ff60b8a190
31 changes: 31 additions & 0 deletions includes/admin/metaboxes/views/view-configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ function render_template_options( array $templates, ?string $selected_template )
<li><a href="#directory-view" class="nav-tab"><i class="dashicons dashicons-admin-page tab-icon"></i> <?php printf( esc_html__( '%s Layout', 'gk-gravityview' ), esc_html__( 'Multiple Entries', 'gk-gravityview' ) . '<span class="gv-responsive-label--collapse">' ); ?></span></a></li>
<li><a href="#single-view" class="nav-tab"><i class="dashicons dashicons-media-default tab-icon"></i> <?php printf( esc_html__( '%s Layout', 'gk-gravityview' ), esc_html__( 'Single Entry', 'gk-gravityview' ) . '<span class="gv-responsive-label--collapse">' ); ?></span></a></li>
<li><a href="#edit-view" class="nav-tab"><i class="dashicons dashicons-welcome-write-blog tab-icon"></i> <?php printf( esc_html__( '%s Layout', 'gk-gravityview' ), esc_html__( 'Edit Entry', 'gk-gravityview' ) . '<span class="gv-responsive-label--collapse">' ); ?></span></a></li>
<li><a href='#search-view' class='nav-tab'><i class='dashicons dashicons-search tab-icon'></i> <?php echo sprintf( esc_html__( '%s Layout', 'gk-gravityview' ), esc_html__( 'Search', 'gk-gravityview' ) . '<span class="gv-responsive-label--collapse">' ); ?></span>
</a></li>
</ul>

<div id="directory-view">
Expand Down Expand Up @@ -229,6 +231,35 @@ function render_template_options( array $templates, ?string $selected_template )
</div>

</div> <?php // end edit view tab ?>

<div id='search-view'>

<div id='search-fields' class='gv-section'>

<div class='notice notice-warning inline is-dismissible'>
<h3><?php printf( esc_html__( 'Note: %s', 'gk-gravityview' ), esc_html__( 'No Search Bar exists in the layout.', 'gk-gravityview' ) ); ?></h3>
<p><a data-beacon-article-modal="54c67bb9e4b0512429885513"
href="https://docs.gravityview.co/article/67-configuring-the-edit-entry-screen"><?php printf( esc_html__( 'Learn how to link to %s', 'gk-gravityview' ), esc_html__( 'Edit Entry', 'gk-gravityview' ) ); ?></a>
</p>
</div>

<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gk-gravityview' ); ?>
<span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gk-gravityview' ); ?></span>
</h4>

<div id="edit-active-fields" class="gv-grid">
<?php
do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/search', 'search' ), 'search', $post->ID, true );
?>
</div>

<?php
do_action( 'gravityview_render_field_pickers', 'search' );
?>

</div>

</div> <?php // end search view tab ?>
</div> <?php // end tabs ?>

<input type="hidden" name="gv_fields_done" value="1" />
2 changes: 1 addition & 1 deletion includes/class-admin-views.php
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ function render_directory_active_areas( $template_id = '', $context = 'single',
* @see GravityView_Template::assign_active_areas()
* @param array $template_areas Empty array, to be filled in by the template class
* @param string $template_id Template ID, like `default_list`, `default_table`, `preset_business_data`, etc. {@see GravityView_Template::__construct()}
* @param string $context Current View context: `directory`, `single`, or `edit` (default: 'single')
* @param string $context Current View context: `directory`, `single`, `edit`, or `search` (default: 'single')
*/
$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* GravityView preset template
*
* @file class-gravityview-preset-website-showcase.php
* @package GravityView
* @license GPL2+
* @author GravityView <[email protected]>
* @link http://gravityview.co
* @copyright Copyright 2015, Katz Web Services, Inc.
*
* @since 1.15
*/

/**
* GravityView_Default_Template_Edit class.
* Defines Edit Table(default) template (Edit Entry) - this is not visible; it's an internal template only.
*/
class GravityView_Default_Template_Search extends GravityView_Template {

function __construct( $id = 'search', $settings = array(), $field_options = array(), $areas = array() ) {

$edit_settings = array(
'slug' => 'search',
'type' => 'internal',
'label' => __( 'Search', 'gk-gravityview' ),
'description' => __('Display a search bar.', 'gk-gravityview'),
'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE),
'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ),
);

$settings = wp_parse_args( $settings, $edit_settings );

/**
* @see GravityView_Admin_Views::get_default_field_options() for Generic Field Options
* @var array
*/
$field_options = array();

$areas = array(
array(
'1-1' => array(
array(
'areaid' => 'search-fields',
'title' => __('Search Fields', 'gk-gravityview' )
)
)
)
);


parent::__construct( $id, $settings, $field_options, $areas );

}

}

new GravityView_Default_Template_Search;
1 change: 1 addition & 0 deletions includes/presets/default-search/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php // Silence is golden
1 change: 1 addition & 0 deletions includes/presets/register-default-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function gravityview_register_default_templates() {
include_once $path . 'default-table/class-gravityview-default-template-table.php';
include_once $path . 'default-list/class-gravityview-default-template-list.php';
include_once $path . 'default-edit/class-gravityview-default-template-edit.php';
include_once $path . 'default-search/class-gravityview-default-template-search.php';
include_once $path . 'business-listings/class-gravityview-preset-business-listings.php';
include_once $path . 'business-data/class-gravityview-preset-business-data.php';
include_once $path . 'profiles/class-gravityview-preset-profiles.php';
Expand Down