Skip to content

Commit

Permalink
Added advanced options section with sliding
Browse files Browse the repository at this point in the history
  • Loading branch information
donuk committed May 18, 2015
1 parent 7ea7da2 commit c72691e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
25 changes: 25 additions & 0 deletions ng/js/animations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict";

angular.module('WPCFS')
.animation('.slide', function() {
var NG_HIDE_CLASS = 'ng-hide';
return {
beforeAddClass: function(element, className, done) {
if(className === NG_HIDE_CLASS) {
element.slideUp(done);
}
},
removeClass: function(element, className, done) {
if(className === NG_HIDE_CLASS) {
element.hide().slideDown(done);
}
},
enter: function(element, done) {
element.hide().slideDown()
return function(cancelled) {};
},
leave: function(element, done) {
element.slideUp();
},
}
});
2 changes: 1 addition & 1 deletion ng/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('WPCFS', ['ui.sortable'])
angular.module('WPCFS', ['ui.sortable','ngAnimate'])
.controller('WPCFSForm', ['$scope', function ($scope) {
$scope.sortableOptions = {
"containment": "#field-list"
Expand Down
6 changes: 6 additions & 0 deletions ng/partials/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@
</ul>
<a ng-click='add_field()'>Add Field</a>

<div>
<a ng-click='advanced=!advanced'>Toggle Advanced Options</a>
<div ng-show='advanced' class='slide'>
Advanced Options
</div>
</div>
</div>
12 changes: 11 additions & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ function widgets_init(){
function admin_enqueue_scripts(){
wp_enqueue_script(
"angularjs",
"https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js",
"//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js",
array('jquery')
);
wp_enqueue_script(
"angularjs-animate",
"//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js",
array('jquery')
);
wp_enqueue_script(
Expand All @@ -69,6 +74,11 @@ function admin_enqueue_scripts(){
plugin_dir_url(__FILE__).'/ng/js/services.js',
array('wp-custom-fields-search-editor')
);
wp_enqueue_script(
"wpcfs-angular-animations",
plugin_dir_url(__FILE__).'/ng/js/animations.js',
array('wp-custom-fields-search-editor','angularjs-animate')
);
wp_enqueue_script(
"wp-handlers",
plugin_dir_url(__FILE__).'/js/wp-handlers.js',
Expand Down

0 comments on commit c72691e

Please sign in to comment.