Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New issue form customization. refs #22390

  • Loading branch information...
commit 45a1f46667182065db79cae528167cdc2a47cbc2 1 parent 872ca15
@vtsvang vtsvang authored
View
7 Gemfile
@@ -1,6 +1 @@
-gem 'deface'
-gem 'hashie'
-
-group :development do
- gem 'diffy'
-end
+gem 'deface'
View
5 app/overrides/issues/_new.rb
@@ -0,0 +1,5 @@
+Deface::Override.new(
+ :virtual_path => 'issues/new',
+ :name => 'undev_watchers_usable',
+ :replace => '#watchers_form',
+ :partial => 'issues/watchers_form')
View
3  app/views/hooks/redmine_undev_watchers/_includes.html.erb
@@ -1 +1,2 @@
-<%= javascript_include_tag "appendable_observe_searchfield.js", :plugin => 'redmine_undev_watchers' %>
+<%= javascript_include_tag "appendable_observe_searchfield.js", :plugin => 'redmine_undev_watchers' %>
+<%= stylesheet_link_tag 'new_issue_watchers_search.css', :plugin => 'redmine_undev_watchers' %>
View
16 app/views/issues/_watchers_form.html.erb
@@ -0,0 +1,16 @@
+<% if @issue.safe_attribute? 'watcher_user_ids' -%>
+ <p id="watchers_form">
+ <label><%= l(:label_issue_watchers) %></label>
+
+ <input type="text" id="watchers_search" autocomplete="off" />
+
+ <%= javascript_tag "appendableObserveSearchfield('watchers_search', 'watchers_inputs', '#{ escape_javascript url_for(
+ :controller => 'watchers',
+ :action => 'autocomplete_for_user',
+ :object_type => "issue") }', 'issue[watcher_user_ids][]')" %>
+
+ <span id="watchers_inputs" class="new-issue-watchers-inputs">
+ <%= watchers_checkboxes(@issue, @available_watchers) %>
+ </span>
+ </p>
+<% end %>
View
8 assets/javascripts/appendable_observe_searchfield.js
@@ -1,4 +1,4 @@
-function appendableObserveSearchfield(fieldId, targetId, url) {
+function appendableObserveSearchfield(fieldId, targetId, url, fieldName) {
$('#'+fieldId).each(function() {
var $this = $(this);
$this.attr('data-value-was', $this.val());
@@ -17,6 +17,12 @@ function appendableObserveSearchfield(fieldId, targetId, url) {
.end()
.append(data)
+ if(fieldName) {
+ $target
+ .find(":checkbox")
+ .attr("name", fieldName)
+ }
+
$target
.find(':checked')
.each(function(idx, el) {
View
12 assets/stylesheets/new_issue_watchers_search.css
@@ -0,0 +1,12 @@
+#watchers_inputs.new-issue-watchers-inputs {
+ padding-top: 5px;
+}
+
+#watchers_inputs.new-issue-watchers-inputs label {
+ float: none;
+ margin-left: 0;
+ display: block;
+ width: auto;
+ text-align: left;
+ font-weight: normal;
+}
View
4 init.rb
@@ -8,9 +8,9 @@
Redmine::Plugin.register :redmine_undev_watchers do
name 'Redmine Undev watchers'
author 'tsvang@undev.ru'
- description 'This is custom watchers select form'
+ description 'This plugin makes watchers forms more usable.'
version '0.0.1'
- # url 'http://github.com/Undev/redmine_close_button' if respond_to?(:url)
+ url 'http://github.com/Undev/redmine_undev_watchers' if respond_to?(:url)
author_url 'http://github.com/Undev'
requires_redmine :version_or_higher => '0.9.0'
end
View
5 lib/redmine_undev_watchers.rb
@@ -1,4 +1,3 @@
module RedmineUndevGit
-end
-
-require 'redmine_undev_watchers/hooks'
+ require 'redmine_undev_watchers/hooks'
+end
View
7 lib/redmine_undev_watchers/hooks.rb
@@ -1,10 +1,3 @@
-# module RedmineUndevWatchers
-# class Hooks < Redmine::Hook::ViewListener
-# render_on :view_issues_new_top, :partial => 'issues/some_partial'
-# end
-# end
-
-
module RedmineUndevWatchers
class ViewHooks < Redmine::Hook::ViewListener
render_on :view_layouts_base_html_head,
Please sign in to comment.
Something went wrong with that request. Please try again.