Skip to content

Commit

Permalink
CalderaWP#3204 bring back add-on search
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Pollock committed May 22, 2019
1 parent fd346d4 commit 6b6b036
Show file tree
Hide file tree
Showing 14 changed files with 9,748 additions and 9,641 deletions.
31 changes: 29 additions & 2 deletions classes/render/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ class Caldera_Forms_Render_Assets
*/
protected static $api_data_localized;

/**
* Stores modified-time for generated assets
*
* @since 1.8.5
*
* @var int
*/
protected static $client_modified_time;

/**
* Enqueue styles for field type
Expand Down Expand Up @@ -571,10 +579,11 @@ public static function make_url($name, $script = true)
$name = 'admin';
}

$version = self::get_client_modified_time();
if ($script) {
return "{$root_url}clients/{$name}/build/index.min.js";
return "{$root_url}clients/{$name}/build/index.min.js?h={$version}";
} else {
return "{$root_url}clients/{$name}/build/style.min.css";
return "{$root_url}clients/{$name}/build/style.min.css?h={$version}";
}
}

Expand All @@ -594,6 +603,24 @@ public static function make_url($name, $script = true)

}

/**
* Get the time the clients directory was modified at.
*
* - Used to hash the file URLs for client entry points.
* - This avoids running filetime or md5 hash on all 10 files.
*
* @since 1.8.6
*
* @return int
*/
protected static function get_client_modified_time(){
if( ! self::$client_modified_time ){
$dir = dirname(__FILE__,3). '/clients/admin/build/index.min.js' ;
self::$client_modified_time = filemtime($dir);
}
return self::$client_modified_time;
}

/**
* Is this the slug of a webpack entry point
*
Expand Down
11 changes: 7 additions & 4 deletions clients/admin/MainDashboard/MainDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import {DocSearchApp} from "../../components/DocSearch";
import DashboardPanels from './DashboardPanels';




/**
*
*/
export default function MainDashboard() {
return (
<DashboardPanels apiRoot={'https://calderaforms.com/wp-json'}/>
)
<DashboardPanels
apiRoot={'https://calderaforms.com/wp-json'}
/>
);

}
9 changes: 5 additions & 4 deletions clients/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import domReady from '@wordpress/dom-ready';
import MainDashboard from './MainDashboard/MainDashboard';





/**
* Controls the right side of the CF admin
*
* @since 1.8.6
*/
domReady(function () {
render(<MainDashboard/>, document.getElementById('caldera-forms-clippy'));
jQuery('.cf-entry-viewer-link').on('click', function () {
unmountComponentAtNode(document.getElementById('caldera-forms-clippy'));
})

});


66 changes: 63 additions & 3 deletions clients/admin/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
.p {
color: inherit;
}
#cf-addons {
.caldera-editor-header-nav {
height: 48px;
}

li.caldera-forms-toolbar-item {
padding: 0;
}

.panel-footer {
position: absolute;
bottom: 0px;
padding: 6px;
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.03);
left: 0px;
right: 0px;
border-top: 1px solid rgba(0, 0, 0, 0.06);
}
a.button {
text-align: center;
width: 100%;
background-color: #ff7e30 !important;
color: #fff !important;

}
a.button:hover {
background-color: #a3bf61 !important;
color: #fff !important;

}

.addon-panel {
margin: 10px;
width: 220px;
float: left;
height: 250px;
position: relative;
padding: 0;
border: 1px solid #a3bf61;
border-radius: 2px;
background: #fff;
}
}
.cf-pro-dashboard-panels {
.components-tab-panel__tabs {
.active-tab{
color: #ffffff;
background: #839e3f;
}

button {
display: inline-block;
padding: 12px;
text-decoration: none;
color: #839e3f;
background-color: #ffffff;
background-blend-mode: darken;
}


}
}

Loading

0 comments on commit 6b6b036

Please sign in to comment.