-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from it3s/disable_list_buttons
Disable bulk action buttons if there is no selected item
- Loading branch information
Showing
15 changed files
with
137 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
App.components.listActions = -> | ||
attributes: -> | ||
bulkButtons: @container.find('.bulkActions button') | ||
|
||
initialize: -> | ||
@count = 0 | ||
@updateBulkButtons() | ||
@bindEvents() | ||
|
||
bindEvents: -> | ||
App.mediator.subscribe "listItem:selected", (evt, data) => | ||
@count++ | ||
@updateBulkButtons() | ||
|
||
App.mediator.subscribe "listItem:unselected", (evt, data) => | ||
@count-- | ||
@updateBulkButtons() | ||
|
||
App.mediator.subscribe "list:unselectedAll", (evt, data) => | ||
@count = 0 | ||
@updateBulkButtons() | ||
|
||
App.mediator.subscribe "list:selectedAll", (evt, data) => | ||
@count = data.count | ||
@updateBulkButtons() | ||
|
||
updateBulkButtons: -> | ||
@attr.bulkButtons.prop "disabled", (@count is 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
<div class="list-actions" data-components="stick" data-stick-options='{ "get_width_from": ".site-page" }'> | ||
<div class="list-actions" data-components="stick listActions" data-stick-options='{ "get_width_from": ".site-page" }'> | ||
<button class="select-all-btn" data-components='selectAll'> | ||
<input type="checkbox" name="all" /><%= t 'lists.select_all' %> | ||
</button> | ||
|
||
<%= link_to_modal icon("globe", t("geo_data.add_map.title")), "#bulk-add-to-map-modal", | ||
login_required: true, html: {class: "add-to-map", id: "bulk-add-to-map"} %> | ||
<span class="bulkActions"> | ||
<%= button_to_modal icon("globe", t("geo_data.add_map.title")), "#bulk-add-to-map-modal", | ||
login_required: true, html: {class: "add-to-map", id: "bulk-add-to-map"} %> | ||
<%= render 'shared/export/export_object', object: nil %> | ||
</span> | ||
<%= render "geo_data/bulk_add_map_modal" %> | ||
<%= render 'imports/modal' %> | ||
<%= render 'shared/export/export_object', object: nil %> | ||
<%= link_to icon('map-marker', t('geo_data.list.add_new')), new_geo_data_path, class: 'add-new-btn' , "data-components" => "loginRequired" %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<div class="list-actions" data-components="stick" data-stick-options='{ "get_width_from": ".site-page" }'> | ||
<div class="list-actions" data-components="stick listActions" data-stick-options='{ "get_width_from": ".site-page" }'> | ||
<button class="select-all-btn" data-components='selectAll'> | ||
<input type="checkbox" name="all" /><%= t 'lists.select_all' %> | ||
</button> | ||
|
||
<%= render 'imports/modal' %> | ||
<%= render 'shared/export/export_object', object: nil %> | ||
<span class="bulkActions"> | ||
<%= render 'shared/export/export_object', object: nil %> | ||
</span> | ||
|
||
<%= render 'imports/modal' %> | ||
<%= link_to icon('globe', t('maps.list.add_new')), new_map_path, class: 'add-new-btn' , "data-components" => "loginRequired" %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters