Git Product home page Git Product logo

bxrextra's Introduction

BxrExtra

BxrExtra is based on modExtra from Shaun McCormick.

Setup

Directions how to create component with name YourComponent using BxrExtra.

Create directory 'yourcomponent'. Clone BxrExtra to yourcomponent directory by running 'git clone git://github.com/TheBoxer/BxrExtra.git .' from yourcomponent folder. You can delete '.git' folder now.

Edit 'config.core.php' file and point 'MODX_CORE_PATH' constant to your MODx core location.

Now you want to rename BxrExtra to YourComponent, co first of all edit 'rename_it.sh' and set 'repl1' to 'YourComponent', 'repl2' to 'yourcomponent' and 'path' to './yourcomponent'.

Run 'rename_it.sh'.

Edit 'yourcomponent/core/components/yourcomponent/templates/home.tpl' and change id of div from 'bxrextra-panel-home-div' to 'yourcomponent-panel-home-div'.

After this changes add two settings in your manager System Settings:

  • 'yourcomponent.core_path' - Point to /yourcomponent/core/components/yourcomponent/
  • 'yourcomponent.assets_url' - /yourcomponent/assets/components/yourcomponent/

Assets url must be visible from web.

Next step is creating namespace with name 'YourComponent', core path 'Point to /yourcomponent/core/components/yourcomponent/' and assets path 'Point to /yourcomponent/assets/components/yourcomponent/'.

After you created namespace, add new action under YourComponent namespace with index controller and without parent controller.

Place just created action under Component menu (or where ever you want) with lexicon key 'yourcomponent' and description 'yourcomponent.menu_desc'. Then clear the cache and refresh manager page.

If you want to create default database table provided in BxrExtra add new snippet in your manager, call it createDBTable and set it as static. Set media sources for Static files to '(None)' and Static file to '[[++yourcomponent.core_path]]/elements/snippets/snippet.yourcomponentCreateDB.php'. Use 'createDBTable' snippet in any of your resources and run it. You shoud get 'Table created.' message.

Now you should have fully working extra with functions described below.

Functionality

  • Integrates a custom table of "Items"
  • A snippet listing Items sorted by name and templated with a chunk
  • A custom manager page to manage Items on
  • Class based processors
  • Grid with inline editing, right menu function and new item / update item / delete item window and search box
  • Drag and drop sort in grid

If you do not require all of this functionality, simply remove it and change the appropriate code.

Removing Drag&Drop

  • delete assets/components/yourcomponent/js/mgr/extra/griddraganddrop.js
  • in core/components/yourcomponent/controllers/home.class.php
    • remove $this->addJavascript($this->yourcomponent->config['jsUrl'].'mgr/extra/griddraganddrop.js');
  • in assets/components/yourcomponent/js/mgr/widgets/items.grid.js
    • remove ddGroup config parameter
    • remove enableDragDrop config parameter, or set to false
    • remove render and beforeDestroy listeners
    • remove getDragDropText function

Removing position from database (position is used for sort)

  • in core/components/yourcomponent/model/schema/yourcomponent.mysql.schema.xml
    • remove field with "position" key
  • remove all php files in core/component/yourcomponent/model/yourcomponent/mysql folder
  • in _build
    • rename build.config.sample.php to build.config.php
    • edit build.config.php and set MODX_BASE_PATH to path to your modx location
  • run _build/build.schema.php
    • it should make new files in core/component/yourcomponent/model/yourcomponent/mysql folder
  • remove yourcomponent_items table from database
  • run snippet that create database table (described in Setup)

Others

Fell free to open pull requests or add issues.

bxrextra's People

Contributors

theboxer avatar halftrainedharry avatar dimitrioskourkoumpas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.