Skip to content

Commit

Permalink
Fix a bug in story creation
Browse files Browse the repository at this point in the history
  Remove auto scroll from add story method
  Add highlight function for when a story be saved
  • Loading branch information
davidsilveira committed Jan 15, 2018
1 parent 5e18297 commit 7202c85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed
- Adjusted README to use yarn install instead npm install on project setup
- Remove auto scroll to bottom when adding a story and highlights it instead

## [1.16.1] 2018-01-03
### Fixed
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/global_listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ $(function() {
// Show chilly bin if it's hidden
$('.hide_chilly_bin.pressed').click();
var newStoryElement = $('#chilly_bin div.story:last');
$('#chilly_bin').scrollTo(newStoryElement, 100);
});

// keycut listener
Expand Down
16 changes: 11 additions & 5 deletions app/assets/javascripts/views/story_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module.exports = FormView.extend({
"fileuploaddone": "attachmentDone",
"fileuploadstart": "attachmentStart",
"fileuploadfail": "attachmentFail",
"click #locate": "highlightSearchedStories"
"click #locate": "highlightSearchedStory"
},

// Triggered whenever a story is dropped to a new position
Expand Down Expand Up @@ -301,6 +301,7 @@ module.exports = FormView.extend({
that.enableForm();
that.model.set({ editing: editMode });
that.toggleControlButtons(false);
that.highlightStory();
},
error: function(model, response) {
var json = $.parseJSON(response.responseText);
Expand Down Expand Up @@ -373,13 +374,18 @@ module.exports = FormView.extend({
return story;
},

highlightSearchedStories: function () {
let storyID = `#story-${ this.model.get('id') }`;
let storyElement = $(storyID);
highlightSearchedStory: function () {
const storyItem = `#story-${ this.model.get('id') }`
const storyElement = $(storyItem);
$('.content-wrapper').animate({
scrollTop: storyElement.offset().top - 15
}, 'fast');
storyElement.effect("highlight", {color: 'lightgreen'}, 1500);
this.highlightStory();
},

highlightStory: function () {
const element = $(`#story-${ this.model.get('id') }`);
element.effect("highlight", {color: 'lightgreen'}, 1500);
},

render: function() {
Expand Down

0 comments on commit 7202c85

Please sign in to comment.