-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Giovambattista Fazioli
committed
Oct 23, 2014
1 parent
f4ad5bf
commit 8a9da08
Showing
10 changed files
with
2,092 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## Version 0.2.0 | ||
|
||
* Improved bootstrap | ||
* Added options model and view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/** | ||
* CSS Style for Options page | ||
*/ | ||
|
||
.clearfix | ||
{ | ||
*zoom : 1 !important; | ||
} | ||
|
||
.clearfix:before, | ||
.clearfix:after | ||
{ | ||
display : table !important; | ||
line-height : 0 !important; | ||
content : "" !important; | ||
} | ||
|
||
.clearfix:after | ||
{ | ||
clear : both !important; | ||
} | ||
|
||
form#wp-securepass-options | ||
{ | ||
margin : 0 16px 0 0; | ||
} | ||
|
||
table.form-table | ||
{ | ||
border-collapse : separate; | ||
background-color : #f8f8f8; | ||
border : 1px solid #e5e5e5; | ||
-moz-border-radius : 3px; | ||
-webkit-border-radius : 3px; | ||
border-radius : 3px; | ||
} | ||
|
||
table.form-table th, | ||
table.form-table td | ||
{ | ||
padding : 10px; | ||
vertical-align : top; | ||
} | ||
|
||
table.form-table td input[type="text"] | ||
{ | ||
width : 100%; | ||
} | ||
|
||
/* OVERRIDE WORDPRESS ERROR */ | ||
|
||
table.form-table td div.error, | ||
table.form-table td div.updated | ||
{ | ||
margin : 0; | ||
} | ||
|
||
/* LISTS USERS */ | ||
select#temp-users | ||
{ | ||
width : 280px; | ||
float : left; | ||
} | ||
|
||
select#wpsp_field_list_users | ||
{ | ||
width : 280px; | ||
float : left; | ||
font-size : 12px; | ||
} | ||
|
||
button#wpsp-button-add, | ||
button#wpsp-button-remove, | ||
button#wpsp-button-remove-all | ||
{ | ||
width : 100px; | ||
margin-left : 8px; | ||
} | ||
|
||
button#wpsp-button-remove-all | ||
{ | ||
margin : 8px 0 0 8px; | ||
background-color : rgba(226, 134, 138, 0.11); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/** | ||
* Securepass Options. | ||
* | ||
* @class WPSecurePassOptions | ||
* @author =undo= <g.@wpxtre.me> | ||
* @copyright Copyright (C) 2014 wpXtreme Inc. All Rights Reserved. | ||
* @date 2014-10-15 | ||
* @version 1.0.0 | ||
*/ | ||
|
||
jQuery( function( $ ) | ||
{ | ||
"use strict"; | ||
window.WPSecurePassOptions = (function() | ||
{ | ||
/** | ||
* This object | ||
* | ||
* @type {{version: string, init: _init}} | ||
* @private | ||
*/ | ||
var _WPSecurePassOptions = { | ||
version: '1.0.0', | ||
init: _init | ||
}; | ||
|
||
/** | ||
* Init | ||
* | ||
* @returns {{version: string, init: _init}} | ||
* @private | ||
*/ | ||
function _init() | ||
{ | ||
// Init the select combo protocol. | ||
_initSelectProtocol(); | ||
|
||
// Init selects for uses | ||
_initSelectsUsers(); | ||
|
||
return _WPSecurePassOptions; | ||
|
||
} | ||
|
||
/** | ||
* Init the selects for users. | ||
* | ||
* @private | ||
*/ | ||
function _initSelectsUsers() | ||
{ | ||
var $source = $( 'select#temp-users' ); | ||
var $destination = $( 'select#wpsp_field_list_users' ); | ||
var $button_add = $( 'button#wpsp-button-add' ); | ||
var $button_remove = $( 'button#wpsp-button-remove' ); | ||
var $button_remove_all = $( 'button#wpsp-button-remove-all' ); | ||
|
||
// Button add | ||
$button_add.on( 'click', function( e ) | ||
{ | ||
e.preventDefault(); | ||
|
||
var value = $( 'option:selected', $source ).val(); | ||
var text = $( 'option:selected', $source ).text(); | ||
|
||
$destination.append( '<option value="' + value + '">' + text + '</option>' ); | ||
|
||
return false; | ||
} ); | ||
|
||
// Button remove | ||
$button_remove.on( 'click', function( e ) | ||
{ | ||
e.preventDefault(); | ||
|
||
$( 'option:selected', $destination ).remove(); | ||
|
||
return false; | ||
} ); | ||
|
||
// Button remove all | ||
$button_remove_all.on( 'click', function( e ) | ||
{ | ||
e.preventDefault(); | ||
|
||
// Select all option item. | ||
$destination.find( 'option' ).attr( 'selected', 'selected' ); | ||
$button_remove.trigger( 'click' ); | ||
|
||
return false; | ||
} ); | ||
|
||
// This is a hack to send in POST/GET the new value in the multiple select tag | ||
$( 'form#wp-securepass-options' ).submit( function() | ||
{ | ||
// Select all option item. | ||
$destination.find( 'option' ).attr( 'selected', 'selected' ); | ||
} ); | ||
} | ||
|
||
/** | ||
* Init the select combo protocol. | ||
* | ||
* @private | ||
*/ | ||
function _initSelectProtocol() | ||
{ | ||
$( 'form#wp-securepass-options select#wpsp_field_protocol' ).on( 'change', function() | ||
{ | ||
|
||
switch( $( this ).val() ) { | ||
|
||
// RADIUS | ||
case 'radius': | ||
$( 'form#wp-securepass-options h3:nth-child(10), form#wp-securepass-options table:nth-child(11)' ).hide(); | ||
$( 'form#wp-securepass-options h3:nth-child(8), form#wp-securepass-options table:nth-child(9)' ).show(); | ||
break; | ||
|
||
// RESTFul | ||
case 'restful': | ||
$( 'form#wp-securepass-options h3:nth-child(10), form#wp-securepass-options table:nth-child(11)' ).show(); | ||
$( 'form#wp-securepass-options h3:nth-child(8), form#wp-securepass-options table:nth-child(9)' ).hide(); | ||
break; | ||
} | ||
|
||
} ); | ||
} | ||
|
||
return _init(); | ||
})(); | ||
|
||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* SecurePass defines. | ||
* | ||
* @author =undo= <info@wpxtre.me> | ||
* @copyright Copyright (C) 2014 wpXtreme Inc. All Rights Reserved. | ||
* @date 2014-10-14 | ||
* @version 1.0.0 | ||
* @since 0.2.0 | ||
* | ||
*/ | ||
|
||
// Securepass main define | ||
define( 'WP_SECUREPASS_VERSION', '0.2.0' ); | ||
|
||
// TODO Not use yet | ||
define( 'WP_SECUREPASS_TEXTDOMAIN', 'wp-securepass' ); | ||
|
||
define( 'WP_SECUREPASS_URL', plugin_dir_url( __FILE__ ) ); | ||
|
||
// Useful define for assets folder | ||
define( 'WP_SECUREPASS_ASSETS_URL', WP_SECUREPASS_URL . 'assets/' ); | ||
define( 'WP_SECUREPASS_ASSETS_CSS_URL', WP_SECUREPASS_ASSETS_URL . 'css/' ); | ||
define( 'WP_SECUREPASS_ASSETS_JAVASCRIPT_URL', WP_SECUREPASS_ASSETS_URL . 'js/' ); |
Oops, something went wrong.