-
Notifications
You must be signed in to change notification settings - Fork 126
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 #888 from tf/searchable-select
Use searchable select boxes in admin forms
- Loading branch information
Showing
41 changed files
with
1,229 additions
and
450 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
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,33 +1,33 @@ | ||
jQuery(function($) { | ||
$('.admin_users form.pageflow_invitation_form').each(function() { | ||
var quotaStates = $('.quota_state', this); | ||
var quotaStateContainer = $('#quota_state_container', this); | ||
var accountSelect = $('#invitation_form_membership_entity_id', this); | ||
var fieldsets = $('#invitation_form_details', this).add('fieldset.actions', this); | ||
|
||
function filterQuotaStatesBySelectedAccount() { | ||
function updateQutaState() { | ||
var selectedAccountId = accountSelect.val(); | ||
|
||
quotaStates.each(function(){ | ||
var quotaState = $(this); | ||
var accountId = quotaState.data('accountId').toString(); | ||
$.get('/admin/users/quota_state?account_id=' + selectedAccountId) | ||
.success(function(html) { | ||
quotaStateContainer.html(html); | ||
updateForm(); | ||
}); | ||
} | ||
|
||
if (accountId !== selectedAccountId) { | ||
$(quotaState).hide(); | ||
} | ||
else { | ||
$(quotaState).show(); | ||
function updateForm() { | ||
if (quotaAvailable()) { | ||
fieldsets.show(); | ||
} | ||
else { | ||
fieldsets.hide(); | ||
} | ||
} | ||
|
||
if ($(quotaState).data('state') === 'available') { | ||
fieldsets.show(); | ||
} | ||
else { | ||
fieldsets.hide(); | ||
} | ||
} | ||
}); | ||
function quotaAvailable() { | ||
return !!quotaStateContainer.find('[data-state=available]').length; | ||
} | ||
|
||
filterQuotaStatesBySelectedAccount(); | ||
accountSelect.on('change', filterQuotaStatesBySelectedAccount); | ||
accountSelect.on('change', updateQutaState); | ||
updateForm(); | ||
}); | ||
}); |
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,3 +1,5 @@ | ||
@import "active_admin/searchable_select"; | ||
|
||
@import "pageflow/mixins"; | ||
|
||
@import "pageflow/admin/badge_list"; | ||
|
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
float: right; | ||
} | ||
|
||
span[title] { | ||
td > span[title] { | ||
border-bottom: 1px #aaa dotted; | ||
cursor: default; | ||
} | ||
|
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
Oops, something went wrong.