Git Product home page Git Product logo

oc-listswitch-plugin's Introduction

About

OctoberCMS plugin to add a toggleable switch as a column type to the backend.

Usage

To add a switch column to a list; set the type of the column to inetis-list-switch.

Example:

your_column:
    label: 'Your Label'
    # Define the type as "inetis-list-switch" to enable this functionality
    type: inetis-list-switch
    
    # Whether to use ✓/✗ icons to replace the Yes/No text (default: true)
    icon: true
   
    # Overrides the title displayed on hover over the column
    titleTrue: 'Unpublish item' # (default: 'inetis.listswitch::lang.inetis.listswitch.title_true')
    titleFalse: 'Publish item' # (default: 'inetis.listswitch::lang.inetis.listswitch.title_false')
    
    # Overrides the text displayed on the button
    textTrue: 'Published' # (default: 'inetis.listswitch::lang.inetis.listswitch.text_true')
    textFalse: 'Unpublished' #(default: 'inetis.listswitch::lang.inetis.listswitch.text_false')

Demo

Default behavior
switch-icon

Behavior with icon: false
switch-text

With custom titles
switch-icon-custom-titles

Author

inetis is a webdesign agency in Vufflens-la-Ville, Switzerland. We love coding and creating powerful apps and sites see our website.

oc-listswitch-plugin's People

Contributors

chvuagniaux avatar fl0cri avatar gergo85 avatar luketowers avatar winitop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

oc-listswitch-plugin's Issues

Override sortable feature

thanks for the excellent plugin
To preserve the sortable feature in plugin.php boot, there should be
if (isset($config['sortable'])) { $column['sortable'] = $config['sortable']; }

like it is for the label.
(could be for all config parameters actually)

[Question] - Compatible with relationship list

Hi,
Great plugin that's work like a charme ... Thanks, great idea !

However, I have a problem with the relationship lists.
If I try to use the switch on relationship lists I get an error.`

In my case Vehicle and Equipment models with a pivot table that contains a boolean column to set the equipment as "top list".

    pivot[is_top]:
        label: Top
        type: inetis-list-switch

Maybe because I'm trying to change a value on the pivot table !?

Plan to support other field type

Hello,

I wonder if there is a plan to support others field types like textfields, dropdown etc...

Cause a module that would allow inline editing for specific fields directly on backend list would be awesome !

I think about the addition of a custom option in column.yaml file, for example if you add :

editable: true

To any column type, it transform it to an inline editing element.

Fix for OC3

  • Make sure the css classes correspond to the switch column in all versions
  • set clickable to false explicitly
  • check the Title attribute in OC3

crashes tailor plugins in October 3

Tailor plugins don't work when listswitch is installed:

Undefined property: stdClass::$columns
~/plugins/inetis/listswitch/Plugin.php line 50

Undefined index

Hi,

I added a custom boolean column to my list by extending the Users controller, and would like to use this plugin to toggle quickly various properties.

When I use the 'switch' type, it works fine, but when I set the column type to inetis-list-switch, I get an 'undefined index' error here:

private function getConfig($config = null)
{
    if (is_null($config)) {
        // this line generates the error
        return self::$listConfig[$this->name];
    }
  
    return self::$listConfig[$this->name][$config];
}

It seems that the $listConfig array is not properly populated, but I'm not sure why.

Any ideas?

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.