Giter Site home page Giter Site logo

library's People

Contributors

lpmi-13 avatar mohsin avatar scottbedard avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

library's Issues

belongsToMany relationship

Sorry, this is repost issue that previously sent on october-widgets/hasmany.

So, is it possible to use hasmany widget for belongsToMany relationship?
Thanks

formwidget for morphOne / morphMany

HI,
It's possible to make a form widget for Polymorphic relations ?
I have a Model "Event" used to create a calendar with dates...
And I have several Models who morph one OR many Event ( Like a Todo Model for my exemple, it morphOne to Event)

  • When the polymorphic relation is One, I would like to render the created event form on the same Todo form. And when I save the form. Todo and Event creating and morphing.
  • When the polymorphic relation is Many, I would like to render a popup form (Like owl-hasMany).

I try to modify owl-hasMany but I can't get the Todo[Event[my_field]] when form is posting.

My EventableOne was the MorphOne Form widget who render the relation field on the form:

/**
 * FormWidget for MorphOne Event
 */
class EventableOne extends FormWidgetBase
{

    public $relatedModel;

    public function widgetDetails()
    {
        return [
            'name'        => 'EventableRelation',
            'description' => 'Form widget to manage eventable relationship'
        ];
    }

    protected $defaultAlias = 'eventableone';

    public function init()
    {
       $this->relatedModel = new $this->model->morphOne[$this->fieldName][0];
    }

    public function render()
    {
        $this->prepareVars();
        return $this->makePartial('eventableone');
    }




    /**
     * Prepares the form widget view data
     */
    public function prepareVars(){
        $this->vars['alias'] = $this->alias;

        // Load relationship for widget
        $relationship = $this->loadRelationship();
        $relationship->model = new Event(); // Init the model
        $formWidget = $this->makeWidget('Backend\Widgets\Form', $relationship); // Make widget

        $modelFormClassBase = class_basename(get_class($this->model));
        $modelRelationClassBase = class_basename(get_class($formWidget->model));

        $this->vars['formWidget'] = $formWidget;
        $formWidget->bindToController();    // Bind Model to controller
        $this->vars['default'] = isset($this->config->default);

    }

    private function loadRelationship(){

        // Explode model path for determining plugin path
        $fieldName = $this->fieldName;

        // Get the model name if multiple or single mode
        $parts = explode('\\', strtolower($this->model->morphOne[$fieldName][0]));

        // Load relationship model, and configure the widget
        $relationship = $this->makeConfig("@/plugins/$parts[0]/$parts[1]/models/$parts[3]/fields.yaml");


        $relationship->model = $this->relatedModel;
        $relationship->alias = $this->alias.$fieldName;

        // Load form header
        if (isset($this->config->formLabel))
            $this->vars['formLabel'] = htmlspecialchars($this->config->formLabel);
        else {
            $modelName = explode('\\', get_class($this->relatedModel));
            $this->vars['formLabel'] = end($modelName);
        }

        return $relationship;
    }

fields.yaml on models/todo :

    events:
        label: Events
        type: eventableone

Thank's for the help

Update filter regex docs for tagbox

Your regex in your example for alphanumeric filters does not work.

Using something like filter: "[^a-zA-Z0-9]+" seems to work. But even better is filter: "[^a-zA-Z0-9_.-]+" (alphanumeric and dashes/underscores).

Preview widgets with screenshots

The list is a quite nifty thing to have,but sometimes a pictures says more than a thousand words. Would it be possible to include a screenshot of the functionality in each repo?

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.