From 916864e24197825d1fb3b35ad211602831793b6a Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:09:06 -0500 Subject: [PATCH 01/11] Add ID to expanded story display. [#204] --- app/assets/javascripts/views/story_view.js | 4 ++++ spec/features/stories_spec.rb | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/views/story_view.js b/app/assets/javascripts/views/story_view.js index d12412bfa..6fc9fce9c 100644 --- a/app/assets/javascripts/views/story_view.js +++ b/app/assets/javascripts/views/story_view.js @@ -275,6 +275,10 @@ Fulcrum.StoryView = Fulcrum.FormView.extend({ }) ); + this.$el.append( + $('
').addClass('story-id').html("ID: " + this.model.escape('id')) + ); + this.$el.append( this.makeFormControl(function(div) { $(div).append(this.textField("title", { diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index 30f2778b4..4ff4a813f 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -16,13 +16,13 @@ :users => [user] end - describe "full story life cycle" do + describe "full story life cycle", js: true do before do project end - it "steps through the full story life cycle", :js => true do + it "steps through the full story life cycle" do visit project_path(project) click_on 'Add story' @@ -48,6 +48,16 @@ end + it "shows the story ID in the story tile" do + story = FactoryGirl.create :story, project: project, title: 'My Fantastic Story', requested_by: user + + visit project_path(project) + within("#story-#{story.id}") do + find('*', text: story.title).click + page.should have_selector('.story-id', text: "ID: #{story.id}") + end + end + end describe "delete a story" do From 0fbb1197efb9f06651f9ca4eff76d03f0c73248c Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:20:48 -0500 Subject: [PATCH 02/11] Don't show ID for new, unsaved story. [#204] --- app/assets/javascripts/views/story_view.js | 8 ++++-- spec/features/stories_spec.rb | 32 ++++++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/views/story_view.js b/app/assets/javascripts/views/story_view.js index 6fc9fce9c..2c1ff350e 100644 --- a/app/assets/javascripts/views/story_view.js +++ b/app/assets/javascripts/views/story_view.js @@ -275,9 +275,11 @@ Fulcrum.StoryView = Fulcrum.FormView.extend({ }) ); - this.$el.append( - $('
').addClass('story-id').html("ID: " + this.model.escape('id')) - ); + if(!this.model.isNew()) { + this.$el.append( + $('
').addClass('story-id').html("ID: " + this.model.escape('id')) + ); + } this.$el.append( this.makeFormControl(function(div) { diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index 4ff4a813f..34d5c0967 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -16,13 +16,13 @@ :users => [user] end - describe "full story life cycle", js: true do + describe "full story life cycle" do before do project end - it "steps through the full story life cycle" do + it "steps through the full story life cycle", js: true do visit project_path(project) click_on 'Add story' @@ -48,16 +48,32 @@ end - it "shows the story ID in the story tile" do - story = FactoryGirl.create :story, project: project, title: 'My Fantastic Story', requested_by: user + end - visit project_path(project) - within("#story-#{story.id}") do - find('*', text: story.title).click - page.should have_selector('.story-id', text: "ID: #{story.id}") + describe 'expanded story tile', js: true do + before(:each) { project } + + context 'saved story' do + it 'shows the story ID' do + story = FactoryGirl.create :story, project: project, title: 'My Fantastic Story', requested_by: user + + visit project_path project + within("#story-#{story.id}") do + find('*', text: story.title).click + page.should have_selector('.story-id', text: "ID: #{story.id}") + end end end + context 'unsaved story' do + it 'does not show the story id' do + visit project_path project + click_on 'Add story' + within '.story.editing' do + page.should_not have_text 'ID:' + end + end + end end describe "delete a story" do From 39366249fd6f3b1b69c44d7757e1da8b0071586e Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:22:11 -0500 Subject: [PATCH 03/11] All these specs use project, so let's just put it in a let! block. [#204] --- spec/features/stories_spec.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index 34d5c0967..2ea9e0cab 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -11,17 +11,12 @@ :password => 'password' } - let(:project) do + let!(:project) do FactoryGirl.create :project, :name => 'Test Project', :users => [user] end describe "full story life cycle" do - - before do - project - end - it "steps through the full story life cycle", js: true do visit project_path(project) @@ -51,8 +46,6 @@ end describe 'expanded story tile', js: true do - before(:each) { project } - context 'saved story' do it 'shows the story ID' do story = FactoryGirl.create :story, project: project, title: 'My Fantastic Story', requested_by: user @@ -101,9 +94,7 @@ end describe "show and hide columns" do - before do - project Capybara.ignore_hidden_elements = true end From a0cc56650e5dfe990174fd2d57141cce7a60b07f Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:25:13 -0500 Subject: [PATCH 04/11] Actually, we don't even need the let!, since we're always calling project explicitly before we use it. [#204] --- spec/features/stories_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index 2ea9e0cab..e776d95e9 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -11,7 +11,7 @@ :password => 'password' } - let!(:project) do + let(:project) do FactoryGirl.create :project, :name => 'Test Project', :users => [user] end From 3f019c1c9c026aa1b0f4e1b13680ee39a436817e Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:26:39 -0500 Subject: [PATCH 05/11] Remove whitespace, minor cleanup. [#204] --- spec/features/stories_spec.rb | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index e776d95e9..64ed27662 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -1,11 +1,6 @@ require 'spec_helper' describe "Stories" do - - before(:each) do - sign_in user - end - let(:user) { FactoryGirl.create :user, :email => 'user@example.com', :password => 'password' @@ -16,6 +11,10 @@ :users => [user] end + before(:each) do + sign_in user + end + describe "full story life cycle" do it "steps through the full story life cycle", js: true do visit project_path(project) @@ -40,9 +39,7 @@ end find('#in_progress .story.accepted .story-title').should have_content('New story') - end - end describe 'expanded story tile', js: true do @@ -70,7 +67,6 @@ end describe "delete a story" do - let(:story) { FactoryGirl.create(:story, :title => 'Delete Me', :project => project, :requested_by => user) @@ -99,7 +95,6 @@ end it "hides and shows the columns", :js => true do - visit project_path(project) columns = { @@ -130,7 +125,6 @@ click_link 'Close' end page.should_not have_css(selector) - end end end @@ -138,5 +132,4 @@ def story_selector(story) "#story-#{story.id}" end - end From 761464880923d736a9cfe88fc99cf29e1b47d240 Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:28:05 -0500 Subject: [PATCH 06/11] We don't need a let block for a single spec. --- spec/features/stories_spec.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index 64ed27662..8a3e9f69b 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -67,16 +67,10 @@ end describe "delete a story" do - let(:story) { - FactoryGirl.create(:story, :title => 'Delete Me', :project => project, + it "deletes the story", :js => true do + story = FactoryGirl.create(:story, :title => 'Delete Me', :project => project, :requested_by => user) - } - - before do - story - end - it "deletes the story", :js => true do visit project_path(project) within(story_selector(story)) do @@ -86,7 +80,6 @@ page.should_not have_css(story_selector(story)) end - end describe "show and hide columns" do From 2d673f3bbe427852b9163670f46f7add6c14817e Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:48:51 -0500 Subject: [PATCH 07/11] Add ID to hover balloon. [#204] --- .../javascripts/templates/story_hover.jst.ejs | 3 +++ spec/features/stories_spec.rb | 26 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/templates/story_hover.jst.ejs b/app/assets/javascripts/templates/story_hover.jst.ejs index c65faad2c..9def005e9 100644 --- a/app/assets/javascripts/templates/story_hover.jst.ejs +++ b/app/assets/javascripts/templates/story_hover.jst.ejs @@ -7,6 +7,9 @@ <%= story.get('estimate') %> <%= I18n.t('points') %> <% } %> + + ID: <%= story.get('id') %> + <% if (story.requested_by()) { %> <%= I18n.t("requested by user on date", {user: story.requested_by().get('name'), date: story.created_at()}) %> diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index 8a3e9f69b..cb01d07c1 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -12,6 +12,7 @@ end before(:each) do + Capybara.ignore_hidden_elements = true sign_in user end @@ -42,21 +43,30 @@ end end - describe 'expanded story tile', js: true do + describe 'ID display', js: true do context 'saved story' do - it 'shows the story ID' do - story = FactoryGirl.create :story, project: project, title: 'My Fantastic Story', requested_by: user + let!(:story) { FactoryGirl.create :story, project: project, title: 'My Fantastic Story', requested_by: user } + let(:story_div) { "#story-#{story.id}" } - visit project_path project - within("#story-#{story.id}") do + before(:each) { visit project_path project } + + it 'shows the story ID in the expanded tile' do + within(story_div) do find('*', text: story.title).click page.should have_selector('.story-id', text: "ID: #{story.id}") end end + + it 'shows the story ID in the hover balloon' do + within(story_div) do + find('.popover-activate').hover + end + page.should have_selector('.popover .content', text: "ID: #{story.id}") + end end context 'unsaved story' do - it 'does not show the story id' do + it 'does not show the story id in the expanded tile' do visit project_path project click_on 'Add story' within '.story.editing' do @@ -83,10 +93,6 @@ end describe "show and hide columns" do - before do - Capybara.ignore_hidden_elements = true - end - it "hides and shows the columns", :js => true do visit project_path(project) From 698f9a0a4ce1fb4b22703562417790be95bf120e Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:49:43 -0500 Subject: [PATCH 08/11] Use 'do' syntax for multiline block. --- spec/features/stories_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index cb01d07c1..4cf901c62 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' describe "Stories" do - let(:user) { + let(:user) do FactoryGirl.create :user, :email => 'user@example.com', :password => 'password' - } + end let(:project) do FactoryGirl.create :project, :name => 'Test Project', From 0087e1ef59504b5358cc7e5988d7951dba46adc9 Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:54:33 -0500 Subject: [PATCH 09/11] Use I18n. [#204] --- app/assets/javascripts/templates/story_hover.jst.ejs | 3 ++- app/assets/javascripts/views/story_view.js | 2 +- config/locales/en.yml | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/templates/story_hover.jst.ejs b/app/assets/javascripts/templates/story_hover.jst.ejs index 9def005e9..fb00fc3c8 100644 --- a/app/assets/javascripts/templates/story_hover.jst.ejs +++ b/app/assets/javascripts/templates/story_hover.jst.ejs @@ -8,8 +8,9 @@ <% } %> - ID: <%= story.get('id') %> + <%= story.humanAttributeName('id') %>: <%= story.get('id') %> +
<% if (story.requested_by()) { %> <%= I18n.t("requested by user on date", {user: story.requested_by().get('name'), date: story.created_at()}) %> diff --git a/app/assets/javascripts/views/story_view.js b/app/assets/javascripts/views/story_view.js index 2c1ff350e..220d680bf 100644 --- a/app/assets/javascripts/views/story_view.js +++ b/app/assets/javascripts/views/story_view.js @@ -277,7 +277,7 @@ Fulcrum.StoryView = Fulcrum.FormView.extend({ if(!this.model.isNew()) { this.$el.append( - $('
').addClass('story-id').html("ID: " + this.model.escape('id')) + $('
').addClass('story-id').html(I18n.t('activerecord.attributes.story.id') + ": " + this.model.escape('id')) ); } diff --git a/config/locales/en.yml b/config/locales/en.yml index 63d909c3f..462de0a47 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -41,7 +41,7 @@ en: n weeks: one: '1 week' other: '%{count} weeks' - + keycuts: keyboard_shortcuts: Keyboard shortcuts help: Help (this) @@ -55,7 +55,7 @@ en: toggle_my_work: Toggle my work toggle_labels_searches: Toggle labels & searches toggle_current: Toggle current - + activerecord: models: user: @@ -79,6 +79,7 @@ en: iteration_length: 'Iteration length' default_velocity: 'Default velocity' story: + id: 'ID' title: 'Title' description: 'Description' estimate: 'Estimate' From 406fc1ef668c49d81a5073838940acb3349f8737 Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Fri, 28 Feb 2014 18:59:06 -0500 Subject: [PATCH 10/11] Add missing end tag. [#204] --- app/assets/javascripts/templates/story_hover.jst.ejs | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/templates/story_hover.jst.ejs b/app/assets/javascripts/templates/story_hover.jst.ejs index fb00fc3c8..e159a03eb 100644 --- a/app/assets/javascripts/templates/story_hover.jst.ejs +++ b/app/assets/javascripts/templates/story_hover.jst.ejs @@ -17,6 +17,7 @@ <% } else { %> <%= I18n.t("requested on date", {date: story.created_at()}) %> <% } %> +
<% if (story.get('description')) { %>

<%= story.humanAttributeName('description') %>

From 413b914c8aad38fba17ab195cfeaf9d9d84a51e2 Mon Sep 17 00:00:00 2001 From: Marnen Laibow-Koser Date: Sun, 2 Mar 2014 14:48:10 -0500 Subject: [PATCH 11/11] Clean up a bit. [#204][#219] --- spec/features/stories_spec.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spec/features/stories_spec.rb b/spec/features/stories_spec.rb index 4cf901c62..5d1909521 100644 --- a/spec/features/stories_spec.rb +++ b/spec/features/stories_spec.rb @@ -12,7 +12,6 @@ end before(:each) do - Capybara.ignore_hidden_elements = true sign_in user end @@ -58,14 +57,12 @@ end it 'shows the story ID in the hover balloon' do - within(story_div) do - find('.popover-activate').hover - end + find(story_div).find('.popover-activate').hover page.should have_selector('.popover .content', text: "ID: #{story.id}") end end - context 'unsaved story' do + context 'unsaved story', js: true do it 'does not show the story id in the expanded tile' do visit project_path project click_on 'Add story' @@ -94,6 +91,8 @@ describe "show and hide columns" do it "hides and shows the columns", :js => true do + Capybara.ignore_hidden_elements = true + visit project_path(project) columns = {