Skip to content

Commit

Permalink
added 2 items for toybox
Browse files Browse the repository at this point in the history
added in numbers and date converters for toybox
  • Loading branch information
codingjungle committed Jul 19, 2022
1 parent 4d75101 commit 75db4a4
Show file tree
Hide file tree
Showing 18 changed files with 1,260 additions and 29 deletions.
429 changes: 409 additions & 20 deletions data/javascript.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/lang.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<app key="toolbox" version="50001">
<app key="toolbox" version="50002">
<word key="__app_toolbox" js="0">Dev Toolbox</word>
<word key="menutab__devtools" js="0">Dev Toolbox</word>
<word key="menutab__devtools_icon" js="0">wrench</word>
Expand Down
79 changes: 78 additions & 1 deletion data/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,27 @@
</div>
</div>
</div>
<div class="ipsMenu_title">
Converters
</div>
<div class="ipsMenu_innerContent">
<div class="ipsGrid">
<div class="ipsGrid_span3 ipsType_center ipsType_bold ipsPadding:half">
<a href="{url='app=toolbox&module=bt&controller=bt&do=numbers'}" data-ipsDialog data-ipsDialog-forceReload="true" data-ipsdialog-title="Numbers Converters">
<i class="fa fa-calculator"></i>
<br>
Numbers
</a>
</div>
<div class="ipsGrid_span3 ipsType_center ipsType_bold ipsPadding:half">
<a href="{url='app=toolbox&module=bt&controller=bt&do=numbers'}" data-ipsDialog data-ipsDialog-forceReload="true" data-ipsdialog-title="Dates Converters">
<i class="fa fa-calendar"></i>
<br>
Dates
</a>
</div>
</div>
</div>
<div class="ipsMenu_title">
System
</div>
Expand Down Expand Up @@ -309,6 +329,29 @@
<div class="ipsMargin_top">
<textarea id="elEncodedContainer">SGVsbG8gV29ybGQhISEhIQ==</textarea>
</div>
</div>]]></template>
<template template_group="bar" template_name="dates" template_data="$dates" template_location="front" template_app="toolbox"><![CDATA[<div class="ipsPadding ipsClearfix" data-ipstoolboxtoyboxdates >
<h4>Date</h4>
<div class="ipsMargin_top">
<label>
<input id="date" type="datetime-local" value="{$dates['date']}" data-input="dates">
</label>
</div>
<h4>Unix</h4>
<div class="ipsMargin_top">
<label>
<input id="unix" type="number" value="{$dates['unix']}" data-input="unix">
</label>
</div>
<h4>ISO 8601</h4>
<div class="ipsMargin_top">
<label>
<input id="iso" type="text" value="{$dates['iso']}" data-input="iso">
</label>
</div>
</div>]]></template>
<template template_group="bar" template_name="git" template_data="$info=null" template_location="front" template_app="toolbox"><![CDATA[{{if isset( $info['app'] ) }}
<div title="Application" data-ipsTooltip>{$info['app']}</div>
Expand Down Expand Up @@ -437,6 +480,40 @@
<button class="ipsPos_right ipsButton ipsButton_veryVerySmall ipsButton_primary ipsMargin_right:half" data-generate>Generate</button>
</div>
<div class="ipsMargin_top" id="elLoremContainer">{$lorem|raw}</div>
</div>]]></template>
<template template_group="bar" template_name="numbers" template_data="$output" template_location="front" template_app="toolbox"><![CDATA[<div class="ipsPadding ipsClearfix" data-ipstoolboxtoyboxnumbers>
<div id="error" class="ipsMessage ipsMessage_error{{if !isset($output['error']) }} ipsHide{{endif}}">
{{$error = $output['error'] ?? '';}}
{$error|raw}
</div>
<h4>Decimal</h4>
<div class="ipsMargin_top">
{{$dec = $output['decimal'] ?? 0;}}
<label>
<input id="decimal" type="number" value="{$dec}" data-input="decimal">
</label>
</div>
<h4>Hexadecimal</h4>
<div class="ipsMargin_top">
{{$hexa = $output['hexa'] ?? 0;}}
<label>
<input id="hexa" type="text" value="{$hexa}" data-input="hexa">
</label>
</div>
<h4>Ocatal</h4>
<div class="ipsMargin_top">
<label>
{{$octal = $output['octal'] ?? 0;}}
<input id="octal" type="number" value="{$octal}" data-input="octal">
</label>
</div>
<h4>Binary</h4>
<div class="ipsMargin_top">
<label>
{{$binary = $output['binary'] ?? 0;}}
<input id="binary" type="text" value="{$binary}" data-input="binary">
</label>
</div>
</div>]]></template>
<template template_group="bar" template_name="uuid" template_data="$form,$uuid" template_location="front" template_app="toolbox"><![CDATA[<div class="ipsPadding ipsClearfix" data-ipstoolboxtoyboxuuid>
{$form|raw}
Expand Down
3 changes: 2 additions & 1 deletion data/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"40001": "4.0.0",
"40002": "4.0.1",
"50000": "5.0.0",
"50001": "5.0.1"
"50001": "5.0.1",
"50002": "5.0.2"
}
22 changes: 21 additions & 1 deletion dev/html/front/bar/bar.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,27 @@
</div>
</div>
</div>

<div class="ipsMenu_title">
Converters
</div>
<div class="ipsMenu_innerContent">
<div class="ipsGrid">
<div class="ipsGrid_span3 ipsType_center ipsType_bold ipsPadding:half">
<a href="{url='app=toolbox&module=bt&controller=bt&do=numbers'}" data-ipsDialog data-ipsDialog-forceReload="true" data-ipsdialog-title="Numbers Converters">
<i class="fa fa-calculator"></i>
<br>
Numbers
</a>
</div>
<div class="ipsGrid_span3 ipsType_center ipsType_bold ipsPadding:half">
<a href="{url='app=toolbox&module=bt&controller=bt&do=numbers'}" data-ipsDialog data-ipsDialog-forceReload="true" data-ipsdialog-title="Dates Converters">
<i class="fa fa-calendar"></i>
<br>
Dates
</a>
</div>
</div>
</div>
<div class="ipsMenu_title">
System
</div>
Expand Down
24 changes: 24 additions & 0 deletions dev/html/front/bar/dates.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<ips:template parameters="$dates"/>
<div class="ipsPadding ipsClearfix" data-ipstoolboxtoyboxdates >

<h4>Date</h4>
<div class="ipsMargin_top">
<label>
<input id="date" type="datetime-local" value="{$dates['date']}" data-input="dates">
</label>
</div>

<h4>Unix</h4>
<div class="ipsMargin_top">
<label>
<input id="unix" type="number" value="{$dates['unix']}" data-input="unix">
</label>
</div>

<h4>ISO 8601</h4>
<div class="ipsMargin_top">
<label>
<input id="iso" type="text" value="{$dates['iso']}" data-input="iso">
</label>
</div>
</div>
35 changes: 35 additions & 0 deletions dev/html/front/bar/numbers.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<ips:template parameters="$output"/>
<div class="ipsPadding ipsClearfix" data-ipstoolboxtoyboxnumbers>
<div id="error" class="ipsMessage ipsMessage_error{{if !isset($output['error']) }} ipsHide{{endif}}">
{{$error = $output['error'] ?? '';}}
{$error|raw}
</div>
<h4>Decimal</h4>
<div class="ipsMargin_top">
{{$dec = $output['decimal'] ?? 0;}}
<label>
<input id="decimal" type="number" value="{$dec}" data-input="decimal">
</label>
</div>
<h4>Hexadecimal</h4>
<div class="ipsMargin_top">
{{$hexa = $output['hexa'] ?? 0;}}
<label>
<input id="hexa" type="text" value="{$hexa}" data-input="hexa">
</label>
</div>
<h4>Ocatal</h4>
<div class="ipsMargin_top">
<label>
{{$octal = $output['octal'] ?? 0;}}
<input id="octal" type="number" value="{$octal}" data-input="octal">
</label>
</div>
<h4>Binary</h4>
<div class="ipsMargin_top">
<label>
{{$binary = $output['binary'] ?? 0;}}
<input id="binary" type="text" value="{$binary}" data-input="binary">
</label>
</div>
</div>
69 changes: 69 additions & 0 deletions dev/js/front/controllers/profiler/ips.ui.toolbox.toyboxdates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
;( function($, _, undefined){
"use strict";
ips.createModule('ips.ui.toolbox.toyboxdates', () => {
/**
* Respond to a dialog trigger
*
* @param {element} elem The element this widget is being created on
* @param {object} options The options passed
* @param {event} e if lazyload, event that is fire
* @returns {void}
*/
const respond = (elem, options, e) => {
let el = $(elem);
if (!el.data('_loadedToyboxdates')) {
let mobject = _objectToyboxdates(el, options);
mobject.init();
el.data('_loadedToyboxdates', mobject);
}
},
/**
* Retrieve the instance (if any) on the given element
*
* @param {element} elem The element to check
* @returns {mixed} The instance or undefined
*/
getObj = (elem) => {
if( $( elem ).data('_loadedToyboxdates') ){
return $( elem ).data('_loadedToyboxdates');
}
return undefined;
};

// Register this module as a widget to enable the data API and
// jQuery plugin functionality
ips.ui.registerWidget( 'toolboxtoyboxdates', ips.ui.toolbox.toyboxdates, [] );

// Expose public methods
return {
respond: respond,
getObj: getObj
};
});
const _objectToyboxdates = function(elem, options) {
let ajax = ips.getAjax(),
init = () => {
elem.on('keyup input propertychange change','[data-input]',_process);
},
_process = (e) => {
let target = $(e.currentTarget),
type = target.attr('data-input'),
number = target.val(),
url = ips.getSetting('baseURL')+'index.php?app=toolbox&module=bt&controller=bt&do=dates&type='+type+'&time='+number;
ajax({
type: "GET",
url: url,
bypassRedirect: true,
success: function (data) {

elem.find('#unix').val(data.unix);
elem.find('#iso').val(data.iso);
elem.find('#date').val(data.date);
}
});
};
return {
init: init
}
};
}(jQuery, _));
77 changes: 77 additions & 0 deletions dev/js/front/controllers/profiler/ips.ui.toolbox.toyboxnumbers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
;( function($, _, undefined){
"use strict";
ips.createModule('ips.ui.toolbox.toyboxnumbers', () => {
/**
* Respond to a dialog trigger
*
* @param {element} elem The element this widget is being created on
* @param {object} options The options passed
* @param {event} e if lazyload, event that is fire
* @returns {void}
*/
const respond = (elem, options, e) => {
let el = $(elem);
if (!el.data('_loadedToyboxnumbers')) {
let mobject = _objectToyboxnumbers(el, options);
mobject.init();
el.data('_loadedToyboxnumbers', mobject);
}
},
/**
* Retrieve the instance (if any) on the given element
*
* @param {element} elem The element to check
* @returns {mixed} The instance or undefined
*/
getObj = (elem) => {
if( $( elem ).data('_loadedToyboxnumbers') ){
return $( elem ).data('_loadedToyboxnumbers');
}
return undefined;
};

// Register this module as a widget to enable the data API and
// jQuery plugin functionality
ips.ui.registerWidget( 'toolboxtoyboxnumbers', ips.ui.toolbox.toyboxnumbers, [] );

// Expose public methods
return {
respond: respond,
getObj: getObj
};
});
const _objectToyboxnumbers = function(elem, options) {
let ajax = ips.getAjax(),
init = () => {
elem.on('keyup input propertychange','[data-input]',_process);
},
_process = (e) => {
let target = $(e.currentTarget),
type = target.attr('data-input'),
number = target.val(),
url = ips.getSetting('baseURL')+'index.php?app=toolbox&module=bt&controller=bt&do=numbers&type='+type+'&number='+number;
ajax({
type: "GET",
url: url,
bypassRedirect: true,
success: function (data) {
_toolbox.l(data);

if(data.hasOwnProperty('error')){
elem.find('#error').removeClass('ipsHide').html(data.error);
}
else{
elem.find('#error').addClass('ipsHide');
elem.find('#decimal').val(data.decimal);
elem.find('#hexa').val(data.hexa);
elem.find('#octal').val(data.octal);
elem.find('#binary').val(data.binary);
}
}
});
};
return {
init: init
}
};
}(jQuery, _));
Loading

0 comments on commit 75db4a4

Please sign in to comment.