My DevHelper add-on

xfrocks

Well-known member
Hi there,

So we all have worked with XenForo for a while. I'm not sure about you but when I do something too many times, I will hate it day by day. Coding should be fun instead of repeating ourselves everything single day! In order to save 30 minutes, I spent quite a lot of times to make an add-on that will help me to do a few things, fast:

1. Input: data structure. Output: a DataWriter, a Model, a ControllerAdmin (with all templates and phrases). I need this because so many times I have to manage a list of something. Now all I need is something like this

PHP:
$this->addExtraData('item', array(
'item_id' => array('type' => 'uint', 'autoIncrement' => true),
'name' => array('type' => 'string', 'length' => 255, 'required' => true),
'description' => array('type' => 'string', 'required' => true),
'image_date' => array('type' => 'uint', 'default' => 0),
), 'item_id');

And boom! I have the DataWriter ready. The Model is also in place (with all the standard get() and count() method, supports conditions and fetch options, etc.). The ControllerAdmin is also generated for me. The add-on even creates a route prefix for me in the AdminCP. I just need to create a new admin navigation record. Awesome!

2. Too many time I have to navigate into xenforo/library, copy the add-on directory, open a new Finder window, navigate to some/path, paste the add-on directory. Export the xml. Zip it. Only to find out I forgot to copy the add-on directory in xenforo/js! Now, all I have to do is a single line:

PHP:
$this->setExportPath('some/path');

And now all I have to do is go to the add-on edit page, click a link and get all the files copied nicely to the target directory. The add-on also generate a FileSums.php file, ready to be used in file_health_check (I still have to type the code event listener manually).

3. I want my add-ons to have their javascript files minified but minify them manually is just too much. I'm too lazy! So now DevHelper will detect the javascript files in the "full" directory (inside the add-on directory in xenforo/js) and minify it as necessary for me. Simple!

4. Template editing in the AdminCP sucks! I tested to use Dreamweaver + WebDAV but it's just too slow. Plus, if you have a typo, good luck finding it with your eyes! So I integrated ACE editor into AdminCP and it works very well! Recently, I changed to use CodeMirror and it's even better! (Thanks Naatan for his add-on, I didn't know about CodeMirror until recently + his save key binding is so smart I have to implement it too).

So. Some features bragging. If you have sometime, feel free to get it here https://github.com/xfrocks/DevHelper -- I haven't had time to write up documentation, yet. It's a little bit of a mess. Just posting here to see if people find it useful :D
 
Top Bottom