Skip to content

Commit

Permalink
Merge pull request #47 from nutso/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
teresan committed Sep 7, 2014
2 parents ec3d8ad + 98eaf5b commit 73bee2f
Show file tree
Hide file tree
Showing 13 changed files with 338 additions and 88 deletions.
7 changes: 4 additions & 3 deletions README.md
@@ -1,6 +1,7 @@
# redmine-plugin-recurring-tasks

Plugin for Redmine project management software to configure recurring tasks. Any task can be set to recur on a fixed (e.g. every Monday) or flexible (e.g. 2 days after task was last completed) schedule.
Plugin for Redmine project management software to configure recurring tasks. Any task can be set to recur on a fixed (e.g. every Monday) or flexible (e.g. 2 days after task was last completed) schedule.
The plugin creates a new issue in Redmine for each recurrence, linking the duplicated issue as a related issue.

Released under GPLv2 in accordance with Redmine licensing.

Expand All @@ -26,7 +27,7 @@ You should now be able to see the plugin list in Administration -> Plugins.

Crontab example (running the check for recurrence every 6 hours):
```bash
* */4 * * * /bin/sh "cd {path_to_redmine} && rake RAILS_ENV=production redmine:recur_tasks" >> log/cron_rake.log 2>&1
* */4 * * * /bin/sh "cd {path_to_redmine} && bundle exec rake RAILS_ENV=production redmine:recur_tasks" >> log/cron_rake.log 2>&1
```

## Upgrade or Migrate Plugin
Expand All @@ -39,7 +40,7 @@ Please check the Release Notes (ReleaseNotes.md) for substantive or breaking cha

2. Run database migrations (make a db backup before)

rake redmine:plugins:migrate RAILS_ENV=production
bundle exec rake redmine:plugins:migrate RAILS_ENV=production

3. Restart Redmine (or web server)

Expand Down
8 changes: 7 additions & 1 deletion ReleaseNotes.md
Expand Up @@ -2,8 +2,9 @@

## Features Requested

* Recur on day x of every n months ([#26](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/26))
* Recur on last day of every n months ([#26](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/26))
* Option to 'predict' recurrences on calendar -- perhaps ghost the projected recurrences in ([#38](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/38))
* Option to re-open recurring issue instead of creating a new issue, so all comments/information are stored in a single place ([#45](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/45))

## Known Issues

Expand All @@ -14,6 +15,11 @@



## Version 1.4.0 (07 Sep 2014)

* French translation updated by @fidergo-stephane-gourichon ([#46](https://github.com/nutso/redmine-plugin-recurring-tasks/pull/46))
* Recur on day x of every n months ([#26](https://github.com/nutso/redmine-plugin-recurring-tasks/issues/26)) -- contributed by @cryptogopher ([#41](https://github.com/nutso/redmine-plugin-recurring-tasks/pull/41))

## Version 1.3.0 (01 Mar 2014)

* Russian translation contributed by @box789 ([#30](https://github.com/nutso/redmine-plugin-recurring-tasks/pull/30))
Expand Down
32 changes: 24 additions & 8 deletions app/controllers/recurring_tasks_controller.rb
Expand Up @@ -7,6 +7,8 @@ class RecurringTasksController < ApplicationController
before_filter :find_recurring_task, :except => [:index, :new, :create]
before_filter :set_interval_units, :except => [:index, :show]
before_filter :set_recurrable_issues, :except => [:index, :show]
before_filter :cancel_edit, :only => [:new, :create, :edit, :update] # #41 TODO is this necessary?


def index
@recurring_tasks = RecurringTask.all_for_project(@project)
Expand All @@ -25,12 +27,13 @@ def new
end

# creates a new recurring task
def create
params[:recurring_task][:interval_unit] = RecurringTask.get_interval_from_localized_name(params[:recurring_task][:interval_localized_name])
def create
# params[:recurring_task][:interval_unit] = RecurringTask.get_interval_from_localized_name(params[:recurring_task][:interval_localized_name]) #41
@recurring_task = RecurringTask.new(params[:recurring_task])
if @recurring_task.save
flash[:notice] = l(:recurring_task_created)
redirect_to :action => :show, :id => @recurring_task.id
# redirect_to :action => :show, :id => @recurring_task.id #41
redirect_to :controller => :issues, :action => :show, :id => @recurring_task.issue.id #41
else
logger.debug "Could not create recurring task from #{params[:post]}"
render :new # errors are displayed to user on form
Expand All @@ -40,15 +43,25 @@ def create
def edit
# default behavior is fine
end

def cancel_edit # #41 TODO is this necessary?
if params[:commit] == l(:button_cancel)
redirect_to :back
end
rescue ActionController::RedirectBackError
redirect_to default
end


# saves the task and redirects to show
def update
logger.info "Updating recurring task #{params[:id]}"

params[:recurring_task][:interval_unit] = RecurringTask.get_interval_from_localized_name(params[:recurring_task][:interval_localized_name])
# params[:recurring_task][:interval_unit] = RecurringTask.get_interval_from_localized_name(params[:recurring_task][:interval_localized_name]) #41
if @recurring_task.update_attributes(params[:recurring_task])
flash[:notice] = l(:recurring_task_saved)
redirect_to :action => :show
# redirect_to :action => :show #41
redirect_to :controller => :issues, :action => :show, :id => @recurring_task.issue.id # #41
else
logger.debug "Could not save recurring task #{@recurring_task}"
render :edit # errors are displayed to user on form
Expand All @@ -60,10 +73,12 @@ def destroy

if @recurring_task.destroy
flash[:notice] = l(:recurring_task_removed)
redirect_to :action => :index
# redirect_to :action => :index #41
redirect_to :back #41
else
flash[:notice] = l(:error_recurring_task_could_not_remove)
redirect_to :action => :show, :id => @recurring_task
# redirect_to :action => :show, :id => @recurring_task #41
render :back #41
end
end

Expand All @@ -85,6 +100,7 @@ def find_recurring_task
end

def set_interval_units
@interval_units = RecurringTask::INTERVAL_UNITS_LOCALIZED
# @interval_units = RecurringTask::INTERVAL_UNITS_LOCALIZED #41
@interval_units = RecurringTask::INTERVAL_UNITS_LOCALIZED.collect{|k,v| [v, k]} #41
end
end

0 comments on commit 73bee2f

Please sign in to comment.