From e8eeadc3c2f16ae1de33e250a4f1d2177acc7561 Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 11 Nov 2013 09:58:55 +0100 Subject: [PATCH 01/20] Prepares assets --- app/assets/javascripts/backlogs/backlog.js | 7 ++----- app/assets/javascripts/backlogs/common.js | 3 --- .../javascripts/backlogs/editable_inplace.js | 3 --- app/assets/javascripts/backlogs/impediment.js | 3 --- .../javascripts/backlogs/master_backlog.js | 3 --- app/assets/javascripts/backlogs/model.js | 11 +++-------- app/assets/javascripts/backlogs/show_main.js | 3 --- app/assets/javascripts/backlogs/sprint.js | 3 --- app/assets/javascripts/backlogs/story.js | 13 +++++-------- app/assets/javascripts/backlogs/task.js | 5 +---- app/assets/javascripts/backlogs/taskboard.js | 3 --- app/assets/javascripts/backlogs/work_package.js | 5 +---- .../stylesheets/backlogs/master_backlog.css.erb | 7 +++++-- .../stylesheets/backlogs/taskboard.css.erb | 16 +++++----------- 14 files changed, 22 insertions(+), 63 deletions(-) diff --git a/app/assets/javascripts/backlogs/backlog.js b/app/assets/javascripts/backlogs/backlog.js index 29551d36d4..3d60254689 100644 --- a/app/assets/javascripts/backlogs/backlog.js +++ b/app/assets/javascripts/backlogs/backlog.js @@ -1,11 +1,8 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /****************************************** BACKLOG A backlog is a visual representation of - a sprint and its stories. It's is not a - sprint. Imagine it this way: a sprint is + a sprint and its stories. It is not a + sprint. Imagine it this way: A sprint is a start and end date, and a set of objectives. A backlog is something you would draw up on the board or a spread- diff --git a/app/assets/javascripts/backlogs/common.js b/app/assets/javascripts/backlogs/common.js index 329d19b280..afe9ee672d 100644 --- a/app/assets/javascripts/backlogs/common.js +++ b/app/assets/javascripts/backlogs/common.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery*/ - if (window.RB === null || window.RB === undefined) { window.RB = (function ($) { var object, Factory, Dialog, UserPreferences, diff --git a/app/assets/javascripts/backlogs/editable_inplace.js b/app/assets/javascripts/backlogs/editable_inplace.js index 751fb9e3d4..8fa0d85f0d 100644 --- a/app/assets/javascripts/backlogs/editable_inplace.js +++ b/app/assets/javascripts/backlogs/editable_inplace.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - RB.EditableInplace = (function ($) { return RB.Object.create(RB.Model, { diff --git a/app/assets/javascripts/backlogs/impediment.js b/app/assets/javascripts/backlogs/impediment.js index 54fee77783..e1072dd06a 100644 --- a/app/assets/javascripts/backlogs/impediment.js +++ b/app/assets/javascripts/backlogs/impediment.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /************************************** IMPEDIMENT ***************************************/ diff --git a/app/assets/javascripts/backlogs/master_backlog.js b/app/assets/javascripts/backlogs/master_backlog.js index 926fadc2a9..5d189816ed 100644 --- a/app/assets/javascripts/backlogs/master_backlog.js +++ b/app/assets/javascripts/backlogs/master_backlog.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - // Initialize the backlogs after DOM is loaded jQuery(function ($) { diff --git a/app/assets/javascripts/backlogs/model.js b/app/assets/javascripts/backlogs/model.js index 720daa9c3c..4a7390c92e 100644 --- a/app/assets/javascripts/backlogs/model.js +++ b/app/assets/javascripts/backlogs/model.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /*************************************** MODEL Common methods for sprint, work_package, @@ -353,7 +350,7 @@ RB.Model = (function ($) { }, processError: function (x, t, e) { - // Do nothing. Feel free to override + // Override as needed }, refresh: function (obj) { @@ -404,14 +401,12 @@ RB.Model = (function ($) { // if the user saves this edit we will receive a validation error // the following 3 lines will prevent the override of the status id // otherwise we would loose the status id of the current ticket - if (!(editor.val() === '' && fieldName === 'status_id')){ j.children('div.' + fieldName).children('.v').text(editor.val()); } + j.children('div.' + fieldName).children('.t').text(editor.children(':selected').text()); - // } else if (this.type.match(/textarea/)) { - // this.setValue('div.' + fieldName + ' .textile', editors[ii].value); - // this.setValue('div.' + fieldName + ' .html', '-- will be displayed after save --'); + } else { j.children('div.' + fieldName).text(editor.val()); } diff --git a/app/assets/javascripts/backlogs/show_main.js b/app/assets/javascripts/backlogs/show_main.js index 17c37fb8c1..38b814ae87 100644 --- a/app/assets/javascripts/backlogs/show_main.js +++ b/app/assets/javascripts/backlogs/show_main.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals jQuery, RB*/ - // Initialize everything after DOM is loaded jQuery(function ($) { var defaultDialogColor; // this var is used as cache for some computation in diff --git a/app/assets/javascripts/backlogs/sprint.js b/app/assets/javascripts/backlogs/sprint.js index 2f4760bbb1..3b96f3f31a 100644 --- a/app/assets/javascripts/backlogs/sprint.js +++ b/app/assets/javascripts/backlogs/sprint.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /*************************************** SPRINT ***************************************/ diff --git a/app/assets/javascripts/backlogs/story.js b/app/assets/javascripts/backlogs/story.js index 6dc8fbddf8..220f6ab972 100644 --- a/app/assets/javascripts/backlogs/story.js +++ b/app/assets/javascripts/backlogs/story.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /************************************** STORY ***************************************/ @@ -39,9 +36,7 @@ RB.Story = (function ($) { return "Story #" + this.getID(); }, - editorDisplayed: function (editor) { - // editor.dialog("option", "position", "center"); - }, + editorDisplayed: function (editor) { }, getPoints: function () { var points = parseInt(this.$.find('.story_points').first().text(), 10); @@ -84,8 +79,10 @@ RB.Story = (function ($) { data += "&" + this.$.find('.editor').serialize(); } -//TODO: this might be unsave in case the parent of this story is not the sprint backlog, then we dont have -//a sprintId an cannot generate a valid url - one option might be to take RB.constants.sprint_id hoping it exists + //TODO: this might be unsave in case the parent of this story is not the + // sprint backlog, then we dont have a sprintId an cannot generate a + // valid url - one option might be to take RB.constants.sprint_id + // hoping it exists if (this.isNew()) { url = RB.urlFor('create_story', {sprint_id: sprintId}); } else { diff --git a/app/assets/javascripts/backlogs/task.js b/app/assets/javascripts/backlogs/task.js index 02358a45e3..c162843504 100644 --- a/app/assets/javascripts/backlogs/task.js +++ b/app/assets/javascripts/backlogs/task.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /************************************** TASK ***************************************/ @@ -75,7 +72,7 @@ RB.Task = (function ($) { if (this.$.parent('td').first().hasClass('closed')) { // This is only for the purpose of making the Remaining Hours reset // instantaneously after dragging to a closed status. The server should - // still make sure to reset the value to be sure. + // still make sure to reset the value. this.$.children('.remaining_hours.editor').val(''); this.$.children('.remaining_hours.editable').text(''); } diff --git a/app/assets/javascripts/backlogs/taskboard.js b/app/assets/javascripts/backlogs/taskboard.js index 35d903d23b..ef9916c9e9 100644 --- a/app/assets/javascripts/backlogs/taskboard.js +++ b/app/assets/javascripts/backlogs/taskboard.js @@ -1,6 +1,3 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /*************************************** TASKBOARD ***************************************/ diff --git a/app/assets/javascripts/backlogs/work_package.js b/app/assets/javascripts/backlogs/work_package.js index 1e067eb6f3..3e0f789d85 100644 --- a/app/assets/javascripts/backlogs/work_package.js +++ b/app/assets/javascripts/backlogs/work_package.js @@ -1,8 +1,5 @@ -/*jslint indent: 2*/ -/*globals window, document, jQuery, RB*/ - /************************************** - ISSUE + WORK PACKAGE ***************************************/ RB.WorkPackage = (function ($) { return RB.Object.create(RB.Model, { diff --git a/app/assets/stylesheets/backlogs/master_backlog.css.erb b/app/assets/stylesheets/backlogs/master_backlog.css.erb index c1ea6774d4..a5a9582da3 100644 --- a/app/assets/stylesheets/backlogs/master_backlog.css.erb +++ b/app/assets/stylesheets/backlogs/master_backlog.css.erb @@ -29,8 +29,11 @@ margin: 0 0 10px 0; width: 100%; } -/* this adds space at the bottom of the main content div to leave enough space for the menu -without cutting it even if the bottom backlog does not contain any elements*/ +/* + this adds space at the bottom of the main content div to leave enough space + for the menu without cutting it even if the bottom backlog does not contain + any elements + */ .controller-rb_master_backlogs.action-index #content { padding-bottom: 180px; } diff --git a/app/assets/stylesheets/backlogs/taskboard.css.erb b/app/assets/stylesheets/backlogs/taskboard.css.erb index 7c07912bd9..ee404737b4 100644 --- a/app/assets/stylesheets/backlogs/taskboard.css.erb +++ b/app/assets/stylesheets/backlogs/taskboard.css.erb @@ -18,13 +18,12 @@ } /* - swimlane class is used by: - - #board_header - - .board + swimlane class is used by: + - #board_header + - .board -Also use by the Column Width preference to -determine the unit width of the swimlanes. -See RB.Taskboard.initialize() + Also use by the Column Width preference to determine the unit width of the + swimlanes. See RB.Taskboard.initialize() */ #rb .swimlane { min-width:105px; /* width + (2*margin) + (2*padding) + (2*border) of .work_package */ @@ -129,8 +128,6 @@ See RB.Taskboard.initialize() #rb .story .story-bar .status { float: left; } - - #rb .story .subject { height: 52px; line-height:13px; @@ -139,12 +136,9 @@ See RB.Taskboard.initialize() padding:2px; width:186px; } - - #rb .story.closed .subject { text-decoration:line-through; } - /* item styles used by .task and .impediment */ #rb .work_package, #rb .placeholder { From 9b6f9d5240e5841fda4a5ffbff3b182d24726a3f Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 11 Nov 2013 10:21:04 +0100 Subject: [PATCH 02/20] Prepares controllers --- app/controllers/rb_application_controller.rb | 6 +++--- app/controllers/rb_sprints_controller.rb | 11 ++++++----- app/controllers/rb_wikis_controller.rb | 10 ++++------ app/controllers/version_settings_controller.rb | 6 ++++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app/controllers/rb_application_controller.rb b/app/controllers/rb_application_controller.rb index 0a28eedfbd..ac4cb72cfa 100644 --- a/app/controllers/rb_application_controller.rb +++ b/app/controllers/rb_application_controller.rb @@ -1,4 +1,4 @@ -# Base class of all controllers in Redmine Backlogs +# Base class of all controllers in Backlogs class RbApplicationController < ApplicationController unloadable @@ -8,8 +8,8 @@ class RbApplicationController < ApplicationController private - # Loads the project to be used by the authorize filter to - # determine if User.current has permission to invoke the method in question. + # Loads the project to be used by the authorize filter to determine if + # User.current has permission to invoke the method in question. def load_sprint_and_project if params[:sprint_id] @sprint = Sprint.find(params[:sprint_id]) diff --git a/app/controllers/rb_sprints_controller.rb b/app/controllers/rb_sprints_controller.rb index 94a9dfdfb2..a3e5900ef7 100644 --- a/app/controllers/rb_sprints_controller.rb +++ b/app/controllers/rb_sprints_controller.rb @@ -1,7 +1,7 @@ -# Responsible for exposing sprint CRUD. It SHOULD NOT be used -# for displaying the taskboard since the taskboard is a management -# interface used for managing objects within a sprint. For -# info about the taskboard, see RbTaskboardsController +# Responsible for exposing sprint CRUD. It SHOULD NOT be used for displaying the +# taskboard since the taskboard is a management interface used for managing +# objects within a sprint. For info about the taskboard, see +# RbTaskboardsController class RbSprintsController < RbApplicationController unloadable @@ -16,7 +16,8 @@ class RbSprintsController < RbApplicationController end end -#overwrite load_sprint_and_project to load the sprint from the :id instead of :sprint_id + # Overwrite load_sprint_and_project to load the sprint from the :id instead of + # :sprint_id def load_sprint_and_project if params[:id] @sprint = Sprint.find(params[:id]) diff --git a/app/controllers/rb_wikis_controller.rb b/app/controllers/rb_wikis_controller.rb index 8438b08b6e..07f9c26c11 100644 --- a/app/controllers/rb_wikis_controller.rb +++ b/app/controllers/rb_wikis_controller.rb @@ -1,16 +1,14 @@ class RbWikisController < RbApplicationController unloadable - # NOTE: This method is public (see init.rb). We will let Redmine core's - # WikiController#index tak care of autorization - # NOTE: this method does create a template page when called. + # NOTE: The methods #show and #edit are public (see init.rb). We will let + # OpenProject's WikiController#index take care of autorization + # + # NOTE: The methods #show and #edit create a template page when called. def show redirect_to :controller => '/wiki', :action => 'index', :project_id => @project.id, :id => @sprint.wiki_page end - # NOTE: This method is public (see init.rb). We will let Redmine core's - # WikiController#index tak care of autorization - # NOTE: this method does create a template page when called. def edit redirect_to :controller => '/wiki', :action => 'edit', :project_id => @project.id, :id => @sprint.wiki_page end diff --git a/app/controllers/version_settings_controller.rb b/app/controllers/version_settings_controller.rb index 94ea2513fb..3635691af5 100644 --- a/app/controllers/version_settings_controller.rb +++ b/app/controllers/version_settings_controller.rb @@ -8,6 +8,8 @@ class VersionSettingsController < RbApplicationController private def authorize - super "versions", "edit" #everyone with the right to edit versions has the right to edit version settings + # Everyone with the right to edit versions has the right to edit version + # settings + super "versions", "edit" end -end \ No newline at end of file +end From dbd171ca0fb8ae2ecd4bbadc7e6c664c3bb81329 Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 11 Nov 2013 10:31:15 +0100 Subject: [PATCH 03/20] Prepares models --- app/models/burndown.rb | 3 ++- app/models/impediment.rb | 2 +- app/models/sprint.rb | 8 ++++---- app/models/task.rb | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/models/burndown.rb b/app/models/burndown.rb index 8f36d0f0a1..36c92ef465 100644 --- a/app/models/burndown.rb +++ b/app/models/burndown.rb @@ -83,7 +83,8 @@ class Burndown def workday_before(date = Date.today) d = date - 1 - d = workday_before(d) unless (d.wday > 0 and d.wday < 6) #TODO: make wday configurable + #TODO: make weekday configurable + d = workday_before(d) unless (d.wday > 0 and d.wday < 6) d end end diff --git a/app/models/impediment.rb b/app/models/impediment.rb index d8d5e92bca..a82c06e949 100644 --- a/app/models/impediment.rb +++ b/app/models/impediment.rb @@ -55,7 +55,7 @@ class Impediment < Task (self.blocks_ids - currently_blocking).each{ |id| rel = Relation.new(:relation_type => Relation::TYPE_BLOCKS, :from => self) - rel.to_id = id #attr_protected + rel.to_id = id self.relations_from << rel } end diff --git a/app/models/sprint.rb b/app/models/sprint.rb index 87af90f1c2..2839f400e1 100644 --- a/app/models/sprint.rb +++ b/app/models/sprint.rb @@ -10,7 +10,7 @@ class Sprint < Version } } - #null last ordering + # null last ordering scope :order_by_date, :order => "COALESCE(start_date, CAST('4000-12-30' as date)) ASC, COALESCE(effective_date, CAST('4000-12-30' as date)) ASC" scope :order_by_name, :order => "#{Version.table_name}.name ASC" @@ -73,8 +73,8 @@ class Sprint < Version end def days(cutoff = nil, alldays = false) - # assumes mon-fri are working days, sat-sun are not. this - # assumption is not globally right, we need to make this configurable. + # TODO: Assumes mon-fri are working days, sat-sun are not. This assumption + # is not globally right, we need to make this configurable. cutoff = self.effective_date if cutoff.nil? (self.start_date .. cutoff).select {|d| alldays || (d.wday > 0 and d.wday < 6) } @@ -88,7 +88,7 @@ class Sprint < Version bd = self.burndown('up') return false if bd.blank? - # assume a sprint is active if it's only 2 days old + # Assume a sprint is active if it's only 2 days old return true if bd.remaining_hours.size <= 2 WorkPackage.exists?(['fixed_version_id = ? and ((updated_on between ? and ?) or (created_on between ? and ?))', diff --git a/app/models/task.rb b/app/models/task.rb index 5b3ef10b99..53bd1863bd 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -10,8 +10,8 @@ class Task < WorkPackage task_type.blank? ? nil : task_type.to_i end - # This method is used by Backlogs::List. - # It ensures, that tasks and stories follow a similar interface + # This method is used by Backlogs::List. It ensures, that tasks and stories + # follow a similar interface def self.types [self.type] end @@ -51,7 +51,7 @@ class Task < WorkPackage end end - # assumes the task is already under the same story as 'prev_id' + # Assumes the task is already under the same story as 'prev_id' def move_after(prev_id) if prev_id.blank? sib = self.siblings From 42ca826d27bfe7806173a379f58627284b238c4a Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 11 Nov 2013 11:10:40 +0100 Subject: [PATCH 04/20] Prepare views --- .../projects/settings/_versions.html.erb | 20 +++++++++++++++---- .../rb_burndown_charts/_burndown.html.erb | 2 +- .../rb_master_backlogs/_backlog.html.erb | 5 ++--- app/views/rb_master_backlogs/index.html.erb | 6 ++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/views/projects/settings/_versions.html.erb b/app/views/projects/settings/_versions.html.erb index 975ba8c431..397488d33a 100644 --- a/app/views/projects/settings/_versions.html.erb +++ b/app/views/projects/settings/_versions.html.erb @@ -19,13 +19,25 @@ <%=h version.description %> <%= l("version_status_#{version.status}") %> <%=h format_version_sharing(version.sharing) %> - <%= link_to_if_authorized(h(version.wiki_page_title), {:controller => '/wiki', :action => 'show', :project_id => version.project, :id => Wiki.titleize(version.wiki_page_title)}) || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %> + <%= link_to_if_authorized(h(version.wiki_page_title), + { :controller => '/wiki', + :action => 'show', + :project_id => version.project, + :id => Wiki.titleize(version.wiki_page_title) }) || h(version.wiki_page_title) unless version.wiki_page_title.blank? || version.project.wiki.nil? %> <% if version.project == @project %> - <%= link_to_if_authorized l(:button_edit), {:controller => '/versions', :action => 'edit', :id => version}, :class => 'icon icon-edit' %> - <%= link_to_if_authorized l(:button_delete), {:controller => '/versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> + <%= link_to_if_authorized l(:button_edit), + { :controller => '/versions', :action => 'edit', :id => version }, + :class => 'icon icon-edit' %> + <%= link_to_if_authorized l(:button_delete), + { :controller => '/versions', :action => 'destroy', :id => version }, + :confirm => l(:text_are_you_sure), + :method => :delete, + :class => 'icon icon-del' %> <% elsif @project.enabled_modules.collect(&:name).include?("backlogs") %> - <%= link_to_if_authorized l(:button_edit), {:controller => '/versions', :action => 'edit', :id => version, :project_id => @project.id }, :class => 'icon icon-edit' %> + <%= link_to_if_authorized l(:button_edit), + { :controller => '/versions', :action => 'edit', :id => version, :project_id => @project.id }, + :class => 'icon icon-edit' %> <% end %> diff --git a/app/views/rb_burndown_charts/_burndown.html.erb b/app/views/rb_burndown_charts/_burndown.html.erb index 523b763e77..96ecbc6156 100644 --- a/app/views/rb_burndown_charts/_burndown.html.erb +++ b/app/views/rb_burndown_charts/_burndown.html.erb @@ -1,4 +1,4 @@ - +<%= javascript_include_tag 'backlogs/jquery.flot/excanvas.js' %>