-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
Order Status
setting to the Top Products Widget.
- Loading branch information
Showing
6 changed files
with
139 additions
and
34 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
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,48 @@ | ||
if (typeof CommerceWidgets === typeof undefined) { | ||
CommerceWidgets = {}; | ||
} | ||
|
||
/** | ||
* Class CommerceWidgets.OrderStatuses | ||
*/ | ||
CommerceWidgets.OrderStatuses = Garnish.Base.extend( | ||
{ | ||
init: function(id, settings) { | ||
this.$container = $('#' + id); | ||
this.$menuBtn = $('.menubtn', this.$container); | ||
this.$statusInput = $('.status-input', this.$container); | ||
|
||
this.menuBtn = new Garnish.MenuBtn(this.$menuBtn, { | ||
onOptionSelect: $.proxy(this, 'onSelectStatus') | ||
}); | ||
|
||
var statusId = this.$statusInput.val(); | ||
|
||
var $currentStatus = $('[data-id="' + statusId + '"]', this.menuBtn.menu.$container); | ||
|
||
$currentStatus.trigger('click'); | ||
|
||
}, | ||
|
||
onSelectStatus: function(status) { | ||
this.deselectStatus(); | ||
|
||
var $status = $(status); | ||
$status.addClass('sel'); | ||
|
||
this.selectedStatus = $status; | ||
|
||
this.$statusInput.val($status.data('id')); | ||
|
||
// clone selected status item to menu menu | ||
var $label = $('.commerceStatusLabel', $status); | ||
this.$menuBtn.empty(); | ||
$label.clone().appendTo(this.$menuBtn); | ||
}, | ||
|
||
deselectStatus: function() { | ||
if (this.selectedStatus) { | ||
this.selectedStatus.removeClass('sel'); | ||
} | ||
} | ||
}); |
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
be10524
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.
#15