-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add priority option to action item #5334
Add priority option to action item #5334
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5334 +/- ##
==========================================
+ Coverage 98.29% 98.29% +<.01%
==========================================
Files 294 294
Lines 10982 10989 +7
==========================================
+ Hits 10795 10802 +7
Misses 187 187
Continue to review full report at Codecov.
|
Interesting idea, I would like to see more feedback from others. My first thought is to add a |
@varyonic I think priority is better one, since we already have such option also for sidebar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andreslemik , can you please also add note in documentation about new option here https://github.com/activeadmin/activeadmin/blob/master/docs/8-custom-actions.md#action-items
@@ -32,6 +32,16 @@ | |||
expect(resource.action_items.first.html_class).to eq("action_item test") | |||
end | |||
|
|||
it 'should be ordered by priority' do | |||
resource.add_action_item :first, priority: 0 do | |||
# Empty ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add one action item without priority to this example for testing default priority
@@ -110,6 +110,10 @@ def initialize(name, options = {}, &block) | |||
def html_class | |||
"action_item #{@options[:class]}".rstrip | |||
end | |||
|
|||
def priority | |||
@options[:priority] || 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andreslemik please fix docs for add_action_item method with including description for new option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fivell, all done
@varyonic what do you think ? |
Add priority option to action item (cherry picked from commit a971426)
Able to add action item to the beginning of action items via adding
priority: 0
.