Permalink
Browse files

Version 0.0.1

  • Loading branch information...
0 parents commit 4574db3145930db385d314aa4038d1dff67d8428 @akzhan akzhan committed Oct 29, 2010
@@ -0,0 +1 @@
+*.swp
@@ -0,0 +1,42 @@
+# Redmine Close Issue button
+
+## Introduction
+
+Plugin that places "Close issue" button into contextual toolbar of shown issue.
+
+This button acts as typical "Update" form submittion and shown when:
+
+ * User allowed to close issue.
+
+ * Issue is not already closed nor rejected.
+
+## Screenshot
+
+![Contextual toolbar of Redmine issue](http://github.com/akzhan/redmine_close_button/raw/master/screenshot.png "Contextual toolbar of Redmine issue")
+
+## Compatibility
+
+Tested with Redmine 1.0.2.
+
+## Installation
+
+Download the sources and put them to your vendor/plugins folder.
+
+ $ cd {REDMINE_ROOT}
+ $ git clone git://github.com/akzhan/redmine_close_button.git vendor/plugins/redmine_close_button
+
+Restart Redmine and have a fun!
+
+## Translations
+
+- en by Akzhan Abdulin
+- ru by Akzhan Abdulin
+
+Contributions are welcome!
+
+## Changelog
+
+### 0.0.1
+
+- First public release.
+
@@ -0,0 +1,14 @@
+<%= stylesheet_link_tag "redmine_close_button.css", :plugin => 'redmine_close_button' %>
+<div class="contextual">
+<%= link_to_if_authorized(l(:button_update), {:controller => 'issues', :action => 'edit', :id => @issue }, :onclick => 'showAndScrollTo("update", "notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
+<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time-add' %>
+<% replace_watcher ||= 'watcher' %>
+<%= watcher_tag(@issue, User.current, {:id => replace_watcher, :replace => ['watcher','watcher2']}) %>
+<%= link_to_if_authorized l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-duplicate' %>
+<%= link_to_if_authorized l(:button_copy), new_issue_move_path(:id => @issue, :copy_options => {:copy => 't'}), :class => 'icon icon-copy' %>
+<%= link_to_if_authorized l(:button_move), new_issue_move_path(:id => @issue), :class => 'icon icon-move' %>
+<%= link_to l(:button_close), 'javascript:;', :class => 'icon icon-close redmine-close-button' %>
+<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => (@issue.leaf? ? l(:text_are_you_sure) : l(:text_are_you_sure_with_children)), :method => :post, :class => 'icon icon-del' %>
+</div>
+<%= javascript_include_tag "redmine_close_button.js", :plugin => 'redmine_close_button' %>
+
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,62 @@
+document.observe('dom:loaded', function()
+{
+ var ID_CLOSED = 5;
+ var ID_REJECTED = 6;
+
+ // redmine uses prototype so use it.
+
+ var s = $('issue_status_id');
+ if (s === null)
+ {
+ return;
+ }
+ var options = s.childNodes;
+ var needCloseButton = false;
+ for (var i = options.length - 1; i >= 0; i--)
+ {
+ var option = options[i];
+ var v = parseInt(option.value, 10);
+ if (v === ID_REJECTED)
+ {
+ if (option.selected)
+ {
+ needCloseButton = false;
+ break;
+ }
+ }
+ if (v === ID_CLOSED)
+ {
+ if (option.selected)
+ {
+ needCloseButton = false;
+ break;
+ }
+ else
+ {
+ needCloseButton = true;
+ }
+ }
+ }
+ if (!needCloseButton)
+ {
+ return;
+ }
+ var f = $('issue-form');
+ var area = $$('div.content>div.contextual')[0];
+ if (f === null || area === null)
+ {
+ return;
+ }
+ var closer = function(e)
+ {
+ s.value = ID_CLOSED;
+ f.submit();
+ };
+ var closeButtons = $$('a.redmine-close-button');
+ for (var i = closeButtons.length - 1; i >= 0; i--)
+ {
+ var closeButton = closeButtons[i];
+ closeButton.style.display = 'inline';
+ closeButton.observe('click', closer);
+ }
+});
@@ -0,0 +1,8 @@
+.icon-close
+{
+ background-image: url(../images/close.png);
+}
+a.redmine-close-button
+{
+ display: none;
+}
@@ -0,0 +1,3 @@
+# English strings go here for Rails i18n
+en:
+ button_close: "Close"
@@ -0,0 +1,3 @@
+# Russian strings go here for Rails i18n
+ru:
+ button_close: "Закрыть"
11 init.rb
@@ -0,0 +1,11 @@
+require 'redmine'
+
+Redmine::Plugin.register :redmine_close_button do
+ name 'Redmine Close Button plugin'
+ author 'akzhan.abdulin@gmail.com'
+ description 'This is the Close Issue button plugin for Redmine'
+ version '0.0.1'
+ url 'http://github.com/akzhan/redmine_close_button'
+ author_url 'http://github.com/akzhan'
+end
+
@@ -0,0 +1,2 @@
+# English strings go here
+button_close: "Close"
@@ -0,0 +1,2 @@
+# Russian strings go here
+button_close: "Закрыть"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,5 @@
+# Load the normal Rails helper
+require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
+
+# Ensure that we are using the temporary fixture path
+Engines::Testing.set_fixture_path

0 comments on commit 4574db3

Please sign in to comment.