diff --git a/ghost/admin/app/components/gh-select-native.js b/ghost/admin/app/components/gh-select-native.js deleted file mode 100644 index 9499c7d782..0000000000 --- a/ghost/admin/app/components/gh-select-native.js +++ /dev/null @@ -1,40 +0,0 @@ -import Component from 'ember-component'; -import {reads} from 'ember-computed'; - -function K() { - return this; -} - -export default Component.extend({ - content: null, - prompt: null, - optionValuePath: 'id', - optionLabelPath: 'title', - selection: null, - action: K, // action to fire on change - - // shadow the passed-in `selection` to avoid - // leaking changes to it via a 2-way binding - _selection: reads('selection'), - - actions: { - change() { - // jscs:disable requireArrayDestructuring - let selectEl = this.$('select')[0]; - // jscs:enable requireArrayDestructuring - let {selectedIndex} = selectEl; - - // decrement index by 1 if we have a prompt - let hasPrompt = !!this.get('prompt'); - let contentIndex = hasPrompt ? selectedIndex - 1 : selectedIndex; - - let selection = this.get('content').objectAt(contentIndex); - - // set the local, shadowed selection to avoid leaking - // changes to `selection` out via 2-way binding - this.set('_selection', selection); - - this.sendAction('action', selection); - } - } -}); diff --git a/ghost/admin/app/templates/components/gh-timezone-select.hbs b/ghost/admin/app/templates/components/gh-timezone-select.hbs index b8e84f71a8..8b770b2f5a 100644 --- a/ghost/admin/app/templates/components/gh-timezone-select.hbs +++ b/ghost/admin/app/templates/components/gh-timezone-select.hbs @@ -1,13 +1,13 @@ - {{gh-select-native + {{one-way-select id="activeTimezone" name="general[activeTimezone]" - content=selectableTimezones + options=selectableTimezones optionValuePath="name" optionLabelPath="label" - selection=selectedTimezone - action="setTimezone" + value=selectedTimezone + update=(action "setTimezone") }} {{#if hasTimezoneOverride}} diff --git a/ghost/admin/app/templates/post-settings-menu.hbs b/ghost/admin/app/templates/post-settings-menu.hbs index 1cb5f3689a..8e1fd9ae80 100644 --- a/ghost/admin/app/templates/post-settings-menu.hbs +++ b/ghost/admin/app/templates/post-settings-menu.hbs @@ -67,14 +67,14 @@ - {{gh-select-native - name="post-setting-author" + {{one-way-select id="author-list" - content=authors + name="post-setting-author" + options=authors optionValuePath="id" optionLabelPath="name" - selection=selectedAuthor - action="changeAuthor" + value=selectedAuthor + update=(action "changeAuthor") }} diff --git a/ghost/admin/app/templates/team/user.hbs b/ghost/admin/app/templates/team/user.hbs index 62bb11abcd..c05558f964 100644 --- a/ghost/admin/app/templates/team/user.hbs +++ b/ghost/admin/app/templates/team/user.hbs @@ -115,12 +115,13 @@
- {{gh-select-native id="new-user-role" - content=roles + {{one-way-select + id="new-user-role" + options=roles optionValuePath="id" optionLabelPath="name" - selection=model.role - action="changeRole" + value=model.role + update=(action "changeRole") }}

What permissions should this user have?

diff --git a/ghost/admin/tests/acceptance/editor-test.js b/ghost/admin/tests/acceptance/editor-test.js index 055330c7f9..486fd2b2d9 100644 --- a/ghost/admin/tests/acceptance/editor-test.js +++ b/ghost/admin/tests/acceptance/editor-test.js @@ -208,7 +208,7 @@ describe('Acceptance: Editor', function() { find('#activeTimezone option[value="Pacific/Kwajalein"]').prop('selected', true); }); - triggerEvent('#activeTimezone select', 'change'); + triggerEvent('#activeTimezone', 'change'); // save the settings click('.view-header .btn.btn-blue'); diff --git a/ghost/admin/tests/acceptance/settings/general-test.js b/ghost/admin/tests/acceptance/settings/general-test.js index 4a42243956..822caff265 100644 --- a/ghost/admin/tests/acceptance/settings/general-test.js +++ b/ghost/admin/tests/acceptance/settings/general-test.js @@ -135,12 +135,12 @@ describe('Acceptance: Settings - General', function () { andThen(() => { expect(currentURL(), 'currentURL').to.equal('/settings/general'); - expect(find('#activeTimezone select option').length, 'available timezones').to.equal(66); + expect(find('#activeTimezone option').length, 'available timezones').to.equal(66); expect(find('#activeTimezone option:selected').text().trim()).to.equal('(GMT) UTC'); find('#activeTimezone option[value="Africa/Cairo"]').prop('selected', true); }); - triggerEvent('#activeTimezone select', 'change'); + triggerEvent('#activeTimezone', 'change'); click('.view-header .btn.btn-blue'); andThen(() => { diff --git a/ghost/admin/tests/unit/components/gh-select-native-test.js b/ghost/admin/tests/unit/components/gh-select-native-test.js deleted file mode 100644 index 258a456345..0000000000 --- a/ghost/admin/tests/unit/components/gh-select-native-test.js +++ /dev/null @@ -1,28 +0,0 @@ -/* jshint expr:true */ -import {expect} from 'chai'; -import { - describeComponent, - it -} from 'ember-mocha'; - -describeComponent( - 'gh-select-native', - 'Unit: Component: gh-select-native', - { - unit: true - // specify the other units that are required for this test - // needs: ['component:foo', 'helper:bar'] - }, - function () { - it('renders', function () { - // creates the component instance - let component = this.subject(); - - expect(component._state).to.equal('preRender'); - - // renders the component on the page - this.render(); - expect(component._state).to.equal('inDOM'); - }); - } -);