forked from alex-msk/AgileDwarf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4e1f03
commit 8b547d2
Showing
13 changed files
with
43 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gem 'acts_as_list', "0.9.19" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
class AdtaskinlController < ApplicationController | ||
unloadable | ||
|
||
before_filter :find_project, :authorize, :except=> :update | ||
before_action :find_project, :authorize, :except=> :update | ||
|
||
def update | ||
task = SprintsTasks.find(params[:id]) | ||
|
@@ -23,16 +21,28 @@ def update | |
def create | ||
trackers_avail=@project.trackers().select('id').all().pluck(:id) | ||
attribs = params.select{|k,v| k != 'id' and SprintsTasks.column_names.include? k } | ||
attribs = (attribs || {}).deep_dup | ||
|
||
attribs = Hash[*attribs.flatten] | ||
attribs['tracker_id'] = attribs['tracker_id'] || Setting.plugin_AgileDwarf[:tracker] | ||
#attribs = Hash[*attribs.flatten] | ||
#attribs['tracker_id'] = attribs['tracker_id'] || Setting.plugin_AgileDwarf[:tracker] | ||
|
||
if !trackers_avail.include?(attribs['tracker_id']) | ||
attribs['tracker_id']=@project.trackers().first() | ||
#if !trackers_avail.include?(attribs['tracker_id']) | ||
# attribs['tracker_id'][email protected]().first() | ||
#end | ||
|
||
#attribs['author_id'] = User.current.id | ||
#task = SprintsTasks.new(attribs) | ||
task = SprintsTasks.new | ||
|
||
tracker_id = attribs.delete(:tracker_id) | ||
tracker_id = Setting.plugin_AgileDwarf[:tracker] unless tracker_id.present? | ||
unless trackers_avail.include?(tracker_id) | ||
tracker_id = @project.trackers.first | ||
end | ||
|
||
attribs['author_id'] = User.current.id | ||
task = SprintsTasks.new(attribs) | ||
task.tracker_id = tracker_id | ||
task.author_id = User.current.id | ||
task.safe_attributes = attribs | ||
begin | ||
task.save! | ||
rescue => e | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
class Sprints < Version | ||
unloadable | ||
|
||
validate :start_and_end_dates | ||
|
||
class << self | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
require_dependency 'enabled_module' | ||
|
||
module EnabledModulePatch | ||
def self.included(base) | ||
base.send(:include, InstanceMethods) | ||
def self.prepended(base) | ||
base.send(:prepend, InstanceMethods) | ||
base.class_eval do | ||
alias_method_chain :module_enabled, :scrum | ||
|
||
end | ||
end | ||
|
||
module InstanceMethods | ||
# init task positions when enable module | ||
def module_enabled_with_scrum | ||
def module_enabled | ||
if name == 'scrum' | ||
max = 0 | ||
ActiveRecord::Base.connection.execute("select max(ir_position) from issues where project_id = #{self.project_id}").each{|row| max = row[0]} | ||
ActiveRecord::Base.connection.execute "update issues set ir_position = #{max} + id where ir_position is null" | ||
logger.info("Module attached to project #{self.project_id}") | ||
end | ||
module_enabled_without_scrum | ||
super | ||
end | ||
end | ||
end | ||
|
||
EnabledModule.send(:include, EnabledModulePatch) | ||
end |