Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attaching Buttons to CRUD (Active Button) #18

Closed
luya-bot opened this issue Dec 18, 2017 · 3 comments
Closed

Attaching Buttons to CRUD (Active Button) #18

luya-bot opened this issue Dec 18, 2017 · 3 comments

Comments

@luya-bot
Copy link

This issue has originally been reported by @nadar at luyadev/luya#1506.
Moved here by @nadar.


A "DynamicButton" which allows you to copy a CRUD row, therefore we have to introduce a button ability similar to active windows, without an overlay.

Example Implementation of such a Button

  • Duplicate a Row
@nadar
Copy link
Member

nadar commented Jul 10, 2018

ActiveButton analog to ActiveWindow.

@nadar nadar changed the title Duplicate Button for CRUD Attaching Buttons to CRUD (Active Button) Jul 11, 2018
@nadar
Copy link
Member

nadar commented Oct 22, 2018

Usage / Implementation Idea:

class MyButton extends ActiveButton
{
     public funtion render()
     {
          return '<button type="button">My Button {{model.title}}</button>';
     }

     public function handle()
     {
          if ($this->model->updateAttributes(['is_triggered' => true]) {
               $this->sendReloadCrudEvent(); // commands the list to reload.
               return $this->successOutput('Yes pushed'); // same as for active windows
          }
     }
}

Attach the button in the ngrest model:

public function ngRestActiveButton()
{
     [
         'class' => 'app\MyButton',
    ] 
}

@nadar nadar closed this as completed Oct 22, 2018
@nadar nadar reopened this Oct 22, 2018
@nadar
Copy link
Member

nadar commented Nov 7, 2018

css classes for crud-buttons-button element:

success flash: crud-buttons-button-success (remove class after 5 seconds)
failure flash: crud-buttons-button-danger (remove class after 5 seconds)
spinning animation: crud-buttons-button-loading (add class when loading, remove after loading)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants