Git Product home page Git Product logo

revisions-plugin's People

Contributors

evwerkz avatar gergo85 avatar makhlukgod avatar pindagus avatar rubenvanerk avatar samuell1 avatar timfoerster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

revisions-plugin's Issues

Repeaters and Dropdowns throwing errors in revisionhistory field type

Version: ocms v3

Cannot use object of type Closure as array
~/plugins/samuell/revisions/formwidgets/RevisionHistory.php line 251
        $optionConfig = $field->config['options'];

        foreach ($oldValue as $item) {
            $old .= isset($optionConfig[$item]) ? $optionConfig[$item] . ' • ' : '';
        }

$field->config['options'] is a closure now. This closure is also present for repeaters. Therefore repeaters also pass this check

            if (isset($field->config['options'])) {
                return $this->getOptionsDiff($field, $oldValue, $newValue);
            }

Which results in method getFIELDNAMEOptions() not exists.

My current hotfixes in RevisionHistory:

    private function getDiff($fieldName, $oldValue, $newValue)
    {
        $fields = $this->parentForm->getFields();

        if (array_key_exists($fieldName, $fields)) {
            ...

            if (isset($field->config['widget']) && $field->config['widget'] === 'repeater') {
                return Diff::htmlDiff(e($oldValue), e($newValue));
            }

            if (isset($field->config['options'])) {
                return $this->getOptionsDiff($field, $oldValue, $newValue);
            }
        }

        return Diff::htmlDiff(e($oldValue), e($newValue));
    }

    private function getOptionsDiff($field, $oldValue, $newValue)
    {
        $optionConfig = $field->config['options']();
        ...
     }

I asked Daftspunky, if the options closure is intended, waiting for reply:
https://octobercms.slack.com/archives/C09864473/p1655826963967629

Method locale does not exist.

Hi! I got error :(

Screenshot 2020-11-16 at 18 28 02

Problem in view file _revisionhistory.htm at string 44:

<?= $record->created_at->locale(Lang::getLocale())->isoFormat('LLL') ?>

SQL error due to ->groupBy in getHistory() method

Hello,

I'm testing your module, you did a great job to provide the missing UI to the revisionable octobercms trait.

However, I got a bug after applying it to one of my model :

SQLSTATE[42000]: Syntax error or access violation: 1055 'bdd.system_revisions.id' isn't in GROUP BY (SQL: select * from system_revisions where system_revisions.revisionable_id = 21 and system_revisions.revisionable_id is not null and system_revisions.revisionable_type = Acme\Blog\Models\Post group by created_at, user_id order by created_at desc)

I would find a quick fix by commenting this line in getHistory() method of your RevisionHistory form widget :

->groupBy('created_at', 'user_id')

Best regards

Date always detected as a change in the revision

Hello,

I have a model with a date field, each time I save that model, a revision change is detected, even if I don't change anything

image

my database table is of type : "date"

image

and my field is a standard datepicker

image

Best regards,

Alex

Many to many relations

Hello,

My revisionable model contain many to many relations, but changes are not tracked.

Does this module support many to many relations ? If yes, how do you define them ?

Thank you

Alter the output before rendering

Hello,

Is it possible to alter the output of a field before rendering it ?

Because repeater fields render very badly and I would like to be able to deal with it before display it

image

Also, it would be great to not escape content when displaying it in partial like here :

<?= $getFieldDiff($revision->field, e($revision->old_value), e($revision->new_value)) ?>

And let user display html if they need to

Thank you

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.