Skip to content

Commit

Permalink
feature search : set activeInput when user edits the textarea.
Browse files Browse the repository at this point in the history
This prevents a previous import from selectedFeatures overriding a keyboard edit.
frontend/app/
 4d8a71b 6854 Jan  2 16:38  components/panel/feature-list.js
 16651f2 1298 Jan  2 16:24  templates/components/panel/feature-list.hbs
  • Loading branch information
Don-Isdale committed Jan 2, 2019
1 parent 4600d4d commit 949ed7c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
25 changes: 23 additions & 2 deletions frontend/app/components/panel/feature-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const className = "feature-list";
selectedFeatures
activeInput is true if this textarea is the current data source,
false when selectedFeatures is the current data source.
{{textarea featureNameList }}
. edit or Enter
-> set activeInput=true
Expand Down Expand Up @@ -40,13 +43,15 @@ export default Ember.Component.extend({
let me = this;
/** this function is called before jQuery val() is updated. */
Ember.run.later(function () {
if (! me.get('activeInput'))
me.set('activeInput', true);
// featureNameListInput() does inputIsActive();
me.featureNameListInput();
// trigger fold
console.log(me.get('featureNameList'));
}, 500);
},
inputIsActive() {
this.inputIsActive();
},
featureNameListInput() {
this.featureNameListInput();
},
Expand Down Expand Up @@ -150,8 +155,24 @@ export default Ember.Component.extend({

/*----------------------------------------------------------------------------*/

/** The user has edited the featureNameList textarea, so note this input as active.
*/
inputIsActive() {
// console.log('inputIsActive');
if (! this.get('activeInput'))
this.set('activeInput', true);
},
/** Called when : enter, insert-newline, escape-press, paste.
*
* It would be possible, and somewhat simpler, to update featureNameList after
* every key press, but that could trigger downstream recalculations and
* produce a noisy display. Instead it is updated only for these major
* events, and the value of the textarea is read when the downstream component
* requires it.
*/
featureNameListInput() {
console.log('featureNameListInput');
this.inputIsActive();
this.incrementProperty('featureNameListEnter');
},
toSelectedFeatures() {
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/templates/components/panel/feature-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
{{textarea
class="form-control"
maxLength=15
input=(action 'inputIsActive')
enter=(action 'featureNameListInput')
insert-newline=(action 'featureNameListInput')
escape-press=(action 'featureNameListInput')
paste=(action 'paste')
placeholder="Feature (Marker/Gene) Names
(whitespace or comma separated)" }}
(whitespace or comma separated)" }}
</div>


Expand Down

0 comments on commit 949ed7c

Please sign in to comment.