redmine_extensions 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/redmine_extensions/redmine_extensions.js.orig +648 -0
  3. data/app/views/easy_entity_assignments/_query_index.html.erb.orig +16 -0
  4. data/config/locales/cs.yml +4 -1
  5. data/config/locales/en.yml +1 -0
  6. data/lib/generators/redmine_extensions/entity/templates/context_menu.html.erb.erb +14 -1
  7. data/lib/generators/redmine_extensions/entity/templates/controller.rb.erb +40 -6
  8. data/lib/generators/redmine_extensions/entity/templates/edit.js.erb.erb +5 -5
  9. data/lib/generators/redmine_extensions/entity/templates/index.js.erb.erb +3 -3
  10. data/lib/generators/redmine_extensions/entity/templates/new.js.erb.erb +5 -5
  11. data/lib/generators/redmine_extensions/entity/templates/show.js.erb.erb +3 -3
  12. data/lib/redmine_extensions/easy_query_helpers/outputs.rb +18 -2
  13. data/lib/redmine_extensions/query_output.rb +30 -11
  14. data/lib/redmine_extensions/redmine_patches/controllers/issues_controller_patch.rb +9 -0
  15. data/lib/redmine_extensions/version.rb +1 -1
  16. data/lib/redmine_extensions/version.rb.orig +7 -0
  17. data/spec/redmine/app/controllers/custom_field_enumerations_controller.rb +75 -0
  18. data/spec/redmine/app/controllers/imports_controller.rb +121 -0
  19. data/spec/redmine/app/helpers/imports_helper.rb +47 -0
  20. data/spec/redmine/app/models/custom_field_enumeration.rb +90 -0
  21. data/spec/redmine/app/models/import.rb +249 -0
  22. data/spec/redmine/app/models/import_item.rb +22 -0
  23. data/spec/redmine/app/models/issue_import.rb +186 -0
  24. data/spec/redmine/app/views/attachments/image.html.erb +3 -0
  25. data/spec/redmine/app/views/attachments/other.html.erb +3 -0
  26. data/spec/redmine/app/views/common/_image.html.erb +1 -0
  27. data/spec/redmine/app/views/common/_other.html.erb +1 -0
  28. data/spec/redmine/app/views/custom_field_enumerations/create.js.erb +2 -0
  29. data/spec/redmine/app/views/custom_field_enumerations/destroy.html.erb +14 -0
  30. data/spec/redmine/app/views/custom_field_enumerations/index.html.erb +47 -0
  31. data/spec/redmine/app/views/custom_fields/formats/_enumeration.erb +12 -0
  32. data/spec/redmine/app/views/imports/_fields_mapping.html.erb +90 -0
  33. data/spec/redmine/app/views/imports/mapping.html.erb +52 -0
  34. data/spec/redmine/app/views/imports/mapping.js.erb +1 -0
  35. data/spec/redmine/app/views/imports/new.html.erb +15 -0
  36. data/spec/redmine/app/views/imports/run.html.erb +20 -0
  37. data/spec/redmine/app/views/imports/run.js.erb +11 -0
  38. data/spec/redmine/app/views/imports/settings.html.erb +30 -0
  39. data/spec/redmine/app/views/imports/show.html.erb +38 -0
  40. data/spec/redmine/app/views/layouts/_file.html.erb +15 -0
  41. data/spec/redmine/app/views/mailer/security_notification.html.erb +13 -0
  42. data/spec/redmine/app/views/mailer/security_notification.text.erb +8 -0
  43. data/spec/redmine/app/views/mailer/settings_updated.html.erb +14 -0
  44. data/spec/redmine/app/views/mailer/settings_updated.text.erb +12 -0
  45. data/spec/redmine/app/views/queries/_query_form.html.erb +62 -0
  46. data/spec/redmine/app/views/repositories/_changeset.html.erb +40 -0
  47. data/spec/redmine/app/views/search/index.api.rsb +12 -0
  48. data/spec/redmine/app/views/settings/_api.html.erb +10 -0
  49. data/spec/redmine/app/views/settings/_attachments.html.erb +21 -0
  50. data/spec/redmine/app/views/wiki/_new_modal.html.erb +21 -0
  51. data/spec/redmine/app/views/wiki/new.html.erb +17 -0
  52. data/spec/redmine/app/views/wiki/new.js.erb +2 -0
  53. data/spec/redmine/appveyor.yml +36 -0
  54. data/spec/redmine/db/migrate/20150725112753_insert_allowed_statuses_for_new_issues.rb +23 -0
  55. data/spec/redmine/db/migrate/20150730122707_create_imports.rb +13 -0
  56. data/spec/redmine/db/migrate/20150730122735_create_import_items.rb +10 -0
  57. data/spec/redmine/db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb +9 -0
  58. data/spec/redmine/db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb +11 -0
  59. data/spec/redmine/db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb +9 -0
  60. data/spec/redmine/db/migrate/20151020182731_fix_comma_in_user_format_setting_value.rb +13 -0
  61. data/spec/redmine/db/migrate/20151021184614_change_issue_categories_name_limit_to_60.rb +9 -0
  62. data/spec/redmine/db/migrate/20151021185456_change_auth_sources_filter_to_text.rb +9 -0
  63. data/spec/redmine/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb +9 -0
  64. data/spec/redmine/db/migrate/20151024082034_add_tokens_updated_on.rb +10 -0
  65. data/spec/redmine/db/migrate/20151025072118_create_custom_field_enumerations.rb +10 -0
  66. data/spec/redmine/db/migrate/20151031095005_add_projects_default_version_id.rb +12 -0
  67. data/spec/redmine/db/migrate/20160404080304_force_password_reset_during_setup.rb +9 -0
  68. data/spec/redmine/db/migrate/20160416072926_remove_position_defaults.rb +13 -0
  69. data/spec/redmine/db/migrate/20160529063352_add_roles_settings.rb +5 -0
  70. data/spec/redmine/lib/redmine/acts/positioned.rb +118 -0
  71. data/spec/redmine/lib/redmine/helpers/url.rb +35 -0
  72. data/spec/redmine/lib/redmine/hook/listener.rb +32 -0
  73. data/spec/redmine/lib/redmine/hook/view_listener.rb +78 -0
  74. data/spec/redmine/log/test.log +2 -0
  75. data/spec/redmine/plugins/dummy_plugin/Gemfile +1 -0
  76. data/spec/redmine/plugins/dummy_plugin/app/controllers/dummy_autocompletes_controller.rb +4 -0
  77. data/spec/redmine/plugins/dummy_plugin/app/views/dummy_autocompletes/index.html.erb +3 -0
  78. data/spec/redmine/plugins/dummy_plugin/config/locales/en.yml +2 -0
  79. data/spec/redmine/plugins/dummy_plugin/config/routes.rb +1 -0
  80. data/spec/redmine/plugins/dummy_plugin/init.rb +34 -0
  81. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/controllers/issues_controller_patch.example +30 -0
  82. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/helpers/issues_helper_patch.example +30 -0
  83. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/models/issue_patch.example +30 -0
  84. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/hooks.rb +5 -0
  85. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/internals.rb +4 -0
  86. data/spec/redmine/public/images/jstoolbar/bt_precode.png +0 -0
  87. data/spec/redmine/public/images/reorder.png +0 -0
  88. data/spec/redmine/public/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js +21 -0
  89. data/spec/redmine/public/javascripts/redmine_extensions/application.js +13 -0
  90. data/spec/redmine/public/javascripts/redmine_extensions/easy_togglers.js +58 -0
  91. data/spec/redmine/public/javascripts/redmine_extensions/jquery.entityarray.js +130 -0
  92. data/spec/redmine/public/javascripts/redmine_extensions/redmine_extensions.js +642 -0
  93. data/spec/redmine/public/javascripts/responsive.js +83 -0
  94. data/spec/redmine/public/stylesheets/responsive.css +799 -0
  95. data/spec/redmine/test/fixtures/files/import_dates.csv +4 -0
  96. data/spec/redmine/test/fixtures/files/import_iso8859-1.csv +3 -0
  97. data/spec/redmine/test/fixtures/files/import_issues.csv +4 -0
  98. data/spec/redmine/test/fixtures/ldap/slapd.centos6.conf +24 -0
  99. data/spec/redmine/test/fixtures/ldap/slapd.ubuntu.12.04.conf +23 -0
  100. data/spec/redmine/test/fixtures/mail_handler/issue_update_with_cc.eml +19 -0
  101. data/spec/redmine/test/fixtures/mail_handler/ticket_on_project_given_by_to_header.eml +60 -0
  102. data/spec/redmine/test/fixtures/mail_handler/ticket_with_text_attachment_iso-8859-2.eml +31 -0
  103. data/spec/redmine/test/functional/custom_field_enumerations_controller_test.rb +115 -0
  104. data/spec/redmine/test/functional/imports_controller_test.rb +205 -0
  105. data/spec/redmine/test/functional/sessions_controller_test.rb +138 -0
  106. data/spec/redmine/test/integration/api_test/search_test.rb +92 -0
  107. data/spec/redmine/test/integration/routing/imports_test.rb +36 -0
  108. data/spec/redmine/test/integration/sessions_test.rb +97 -0
  109. data/spec/redmine/test/ui/custom_fields_test_ui.rb +38 -0
  110. data/spec/redmine/test/unit/attachment_transaction_test.rb +76 -0
  111. data/spec/redmine/test/unit/helpers/journals_helper_test.rb +48 -0
  112. data/spec/redmine/test/unit/helpers/wiki_helper_test.rb +45 -0
  113. data/spec/redmine/test/unit/issue_import_test.rb +178 -0
  114. data/spec/redmine/test/unit/lib/redmine/acts/positioned_with_scope_test.rb +53 -0
  115. data/spec/redmine/test/unit/lib/redmine/acts/positioned_without_scope_test.rb +55 -0
  116. data/spec/redmine/test/unit/lib/redmine/field_format/enumeration_format_test.rb +91 -0
  117. data/spec/support/easy_queries_helpers.rb +0 -0
  118. metadata +216 -10
@@ -0,0 +1,16 @@
1
+ <<<<<<< HEAD
2
+ <% query_outputs(query, entities: referenced_entities, options: { hascontextmenu: true, disable_sort: true }).each do |output| %>
3
+ <%= output.render_data %>
4
+ =======
5
+ <% if display_style == :list %>
6
+ <%= render :partial => 'easy_queries/easy_query_entities_list', :locals => {:query => query, :entities => entities, :options => {:hascontextmenu => true, :disable_sort => true} } -%>
7
+ <% elsif display_style == :tile %>
8
+ <div class="easy-entity-cards-container">
9
+ <div class="splitcontent">
10
+ <% entities.each do |referenced_entity| %>
11
+ <%# render_easy_entity_card(referenced_entity, entity, options.merge(:referenced_entities => referenced_entities)) %>
12
+ <% end %>
13
+ </div>
14
+ </div>
15
+ >>>>>>> stable
16
+ <% end %>
@@ -1,3 +1,6 @@
1
1
  cs:
2
- nothing: Nothing
2
+ nothing: Nic
3
3
  button_update_easy_settings: Uložit nastavení
4
+ label_no_output: Nebyl vybrán žádný výstup
5
+ label_easy_query_outputs: Výstupy
6
+ text_modal_is_closing: Vyčkejte prosím, toto okno bude zavřeno automaticky.
@@ -2,4 +2,5 @@ en:
2
2
  nothing: Nothing
3
3
  button_update_easy_settings: Update settings
4
4
  label_no_output: No output has been selected
5
+ label_easy_query_outputs: Outputs
5
6
  text_modal_is_closing: This modal dialog will be closed automatically, please wait.
@@ -2,7 +2,20 @@
2
2
  <%% if @<%= model_name_underscored %> -%>
3
3
  <li><%%= context_menu_link l(:button_edit), edit_<%= model_name_underscored %>_path(@<%= model_name_underscored %>), class: 'icon icon-edit', disabled: !@can[:edit] %></li>
4
4
  <%% end %>
5
+ <%% if @safe_attributes.include? 'status' -%>
6
+ <li class="folder">
7
+ <a href="#" class="submenu icon icon-issue-status" onclick="return false;"><%%= l(:field_status) -%></a>
8
+ <ul>
9
+ <%% <%= model_name %>.statuses.keys.each do |s| -%>
10
+ <li>
11
+ <%%= context_menu_link l("<%= model_name_underscored %>.statuses.#{s}"), bulk_update_<%= model_name_pluralize_underscored %>_path(ids: @<%= model_name_underscored %>_ids, <%= model_name_underscored %>: {status: s}, back_url: @back), method: :put,
12
+ selected: (@selected[:status] == s), disabled: !@can[:edit], confirm: l(:text_are_you_sure) %>
13
+ </li>
14
+ <%% end -%>
15
+ </ul>
16
+ </li>
17
+ <%% end %>
5
18
  <li><%%= context_menu_link l(:button_delete), <%= model_name_pluralize_underscored %>_path(ids: @<%= model_name_underscored %>_ids, back_url: @back), method: :delete, data: {confirm: l(:text_are_you_sure)}, class: 'icon icon-del', disabled: !@can[:delete] %></li>
6
19
 
7
20
  <%%= call_hook(:view_<%= model_name_pluralize_underscored %>_context_menu_end, {<%= model_name_underscored %>: @<%= model_name_underscored %>, <%= model_name_pluralize_underscored %>: @<%= model_name_pluralize_underscored %>, can: @can, back: @back, project: @project}) %>
8
- </ul>
21
+ </ul>
@@ -121,22 +121,56 @@ class <%= controller_class %>Controller < ApplicationController
121
121
  end
122
122
 
123
123
  def bulk_update
124
+ unsaved, saved = [], []
125
+ attributes = parse_params_for_bulk_update([:<%= model_name_underscored %>])
126
+ @<%= model_name_pluralize_underscored %>.each do |entity|
127
+ entity.init_journal(User.current) if entity.respond_to? :init_journal
128
+ entity.safe_attributes = attributes
129
+ if entity.save
130
+ saved << entity
131
+ else
132
+ unsaved << entity
133
+ end
134
+ end
135
+ respond_to do |format|
136
+ format.html do
137
+ if unsaved.blank?
138
+ flash[:notice] = l(:notice_successful_update)
139
+ else
140
+ flash[:error] = unsaved.map{|i| i.errors.full_messages}.flatten.uniq.join(",\n")
141
+ end
142
+ redirect_back_or_default :index
143
+ end
144
+ end
124
145
  end
125
146
 
126
147
  def context_menu
127
- if (@<%= model_name_pluralize_underscored %>.size == 1)
128
- @<%= model_name_underscored %> = @<%= model_name_pluralize_underscored %>.first
148
+ if @<%= model_name_pluralize_underscored %>.size == 1
149
+ @easy_tenant = @<%= model_name_pluralize_underscored %>.first
129
150
  end
130
- @<%= model_name_underscored %>_ids = @<%= model_name_pluralize_underscored %>.map(&:id).sort
131
151
 
132
152
  can_edit = @<%= model_name_pluralize_underscored %>.detect{|c| !c.editable?}.nil?
133
153
  can_delete = @<%= model_name_pluralize_underscored %>.detect{|c| !c.deletable?}.nil?
134
- @can = {:edit => can_edit, :delete => can_delete}
154
+ @can = {edit: can_edit, delete: can_delete}
135
155
  @back = back_url
136
156
 
137
- @safe_attributes = @<%= model_name_pluralize_underscored %>.map(&:safe_attribute_names).reduce(:&)
157
+ @<%= model_name_underscored %>_ids, @safe_attributes, @selected = [], [], {}
158
+ @<%= model_name_pluralize_underscored %>.each do |e|
159
+ @<%= model_name_underscored %>_ids << e.id
160
+ @safe_attributes.concat e.safe_attribute_names(User.current)
161
+ <%= model_name %>.safe_attribute_names.each do |c|
162
+ column_name = c.to_sym
163
+ if @selected.key? column_name
164
+ @selected[column_name] = nil if @selected[column_name] != e.send(column_name)
165
+ else
166
+ @selected[column_name] = e.send(column_name)
167
+ end
168
+ end
169
+ end
170
+
171
+ @safe_attributes.uniq!
138
172
 
139
- render :layout => false
173
+ render layout: false
140
174
  end
141
175
 
142
176
  def autocomplete
@@ -1,17 +1,17 @@
1
1
  $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/edit', :formats => [:html]) %>");
2
2
  showModal('ajax-modal');
3
3
  var submitButton = {
4
- text:"<%=j l(:button_update) -%>",
5
- title:"<%=j l(:button_update) -%>",
4
+ text:"<%%=j l(:button_update) -%%>",
5
+ title:"<%%=j l(:button_update) -%%>",
6
6
  click: function() {$(this).find('form').submit()},
7
7
  'class': 'button-positive'
8
8
  }
9
9
  var closeButton = {
10
- text: "<%=j l(:button_close) -%>",
11
- title: "<%=j l(:button_close) -%>",
10
+ text: "<%%=j l(:button_close) -%%>",
11
+ title: "<%%=j l(:button_close) -%%>",
12
12
  click: function() {$(this).dialog('close');},
13
13
  'class': 'button'
14
14
  }
15
15
  $("#ajax-modal").dialog('option', {
16
16
  buttons: [closeButton, submitButton]
17
- });
17
+ });
@@ -1,11 +1,11 @@
1
1
  $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/index', :formats => [:html]) %>");
2
2
  showModal('ajax-modal');
3
3
  var closeButton = {
4
- text: "<%=j l(:button_close) -%>",
5
- title: "<%=j l(:button_close) -%>",
4
+ text: "<%%=j l(:button_close) -%%>",
5
+ title: "<%%=j l(:button_close) -%%>",
6
6
  click: function() {$(this).dialog('close');},
7
7
  'class': 'button'
8
8
  }
9
9
  $("#ajax-modal").dialog('option', {
10
10
  buttons: [closeButton, submitButton]
11
- });
11
+ });
@@ -1,17 +1,17 @@
1
1
  $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/new', :formats => [:html]) %>");
2
2
  showModal('ajax-modal');
3
3
  var submitButton = {
4
- text:"<%=j l(:button_create) -%>",
5
- title:"<%=j l(:button_create) -%>",
4
+ text:"<%%=j l(:button_create) -%%>",
5
+ title:"<%%=j l(:button_create) -%%>",
6
6
  click: function() {$(this).find('form').submit()},
7
7
  'class': 'button-positive'
8
8
  }
9
9
  var closeButton = {
10
- text: "<%=j l(:button_close) -%>",
11
- title: "<%=j l(:button_close) -%>",
10
+ text: "<%%=j l(:button_close) -%%>",
11
+ title: "<%%=j l(:button_close) -%%>",
12
12
  click: function() {$(this).dialog('close');},
13
13
  'class': 'button'
14
14
  }
15
15
  $("#ajax-modal").dialog('option', {
16
16
  buttons: [closeButton, submitButton]
17
- });
17
+ });
@@ -1,11 +1,11 @@
1
1
  $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/show', :formats => [:html]) %>");
2
2
  showModal('ajax-modal');
3
3
  var closeButton = {
4
- text: "<%=j l(:button_close) -%>",
5
- title: "<%=j l(:button_close) -%>",
4
+ text: "<%%=j l(:button_close) -%%>",
5
+ title: "<%%=j l(:button_close) -%%>",
6
6
  click: function() {$(this).dialog('close');},
7
7
  'class': 'button'
8
8
  }
9
9
  $("#ajax-modal").dialog('option', {
10
10
  buttons: [closeButton, submitButton]
11
- });
11
+ });
@@ -31,7 +31,8 @@ module RedmineExtensions
31
31
  end
32
32
 
33
33
  def enabled_outputs
34
- res = @query.outputs
34
+ res = available_output_names.map(&:to_s) if available_output_names.count == 1
35
+ res ||= @query.outputs
35
36
  res << 'list' if res.empty? && available_outputs.empty?
36
37
  res
37
38
  end
@@ -49,7 +50,18 @@ module RedmineExtensions
49
50
  end
50
51
 
51
52
  def render_edit_selects(style=:check_box, options={})
52
- available_output_instances.map{|o| o.render_edit_box(style, options) }.join('').html_safe
53
+ options.delete(:enabled)
54
+ if available_outputs.count == 1
55
+ available_outputs.first.render_edit_box(:hidden_field, options)
56
+ else
57
+ h.content_tag(:p) do
58
+ s = h.content_tag(:label, h.l(:label_easy_query_outputs))
59
+ available_outputs.each do |o|
60
+ s << o.render_edit_box(style, options.dup)
61
+ end
62
+ s
63
+ end
64
+ end
53
65
  end
54
66
 
55
67
  def render_edit
@@ -64,6 +76,10 @@ module RedmineExtensions
64
76
  end
65
77
  end
66
78
 
79
+ def h
80
+ view_context
81
+ end
82
+
67
83
  def method_missing(name, *args)
68
84
  if name.to_s.ends_with?('?')
69
85
  output_enabled?(name.to_s[0..-2])
@@ -4,11 +4,6 @@ module RedmineExtensions
4
4
  attr_accessor :query
5
5
  delegate :options, to: :query
6
6
 
7
- def self.register_output(klass, options={})
8
- register_as = (options[:as] || klass.key).to_sym
9
- registered_outputs[register_as] = klass
10
- end
11
-
12
7
  def self.registered_outputs
13
8
  @@registered_outputs ||= {}
14
9
  end
@@ -17,6 +12,15 @@ module RedmineExtensions
17
12
  @@registered_per_query ||= {}
18
13
  end
19
14
 
15
+ def self.registered_whitelists
16
+ @@registered_whitelists ||= {}
17
+ end
18
+
19
+ def self.register_output(klass, options={})
20
+ register_as = (options[:as] || klass.key).to_sym
21
+ registered_outputs[register_as] = klass
22
+ end
23
+
20
24
  def self.register_output_for_query(klass, query_class_names, **options)
21
25
  register_as ||= (options[:as] || klass.key).to_sym
22
26
  Array.wrap(query_class_names).each do |query_class_name|
@@ -25,8 +29,18 @@ module RedmineExtensions
25
29
  end
26
30
  end
27
31
 
32
+ def self.whitelist_outputs_for_query(query_class_names, outputs)
33
+ Array.wrap(query_class_names).each do |query_class_name|
34
+ registered_whitelists[query_class_name] ||= []
35
+ registered_whitelists[query_class_name].concat( Array.wrap(outputs).map(&:to_s) ).uniq!
36
+ end
37
+ end
38
+
28
39
  def self.filter_registered_for(query)
29
- res = registered_outputs.select do |_name, output|
40
+ whitelist = registered_whitelists[query.type]
41
+ res = registered_outputs
42
+ res = res.slice(*whitelist.map(&:to_sym)) if whitelist
43
+ res = res.select do |name, output|
30
44
  output.available_for?(query)
31
45
  end
32
46
  res.merge(registered_per_query[query.type] || {})
@@ -94,16 +108,21 @@ module RedmineExtensions
94
108
  end
95
109
 
96
110
  def render_edit_box(style=:check_box, options={})
97
- raise 'Style of edit box is not allowed' unless [:check_box, :radio_button].include?(style)
98
-
99
111
  box_id = "#{query.modul_uniq_id}output_#{key}"
100
112
 
101
-
102
113
  options[:class] = "#{options[:class]} #{query.modul_uniq_id}output_switch #{query.modul_uniq_id}content_switch"
103
114
  options[:enabled] = enabled? unless options.key?(:enabled)
115
+
104
116
  r = ''
105
- r << h.send("#{style}_tag" , query.block_name.blank? ? 'outputs[]' : "#{query.block_name}[outputs][]", key, options[:enabled], id: box_id, class: options[:class])
106
- r << h.label_tag(box_id, h.l('label_my_page_issue_output.' + key), :class => 'inline')
117
+ case style
118
+ when :hidden_field
119
+ r << h.hidden_field_tag(query.block_name.blank? ? 'outputs[]' : "#{query.block_name}[outputs][]", key, id: box_id, class: options[:class])
120
+ when :check_box, :radio_button
121
+ r << h.send("#{style}_tag" , query.block_name.blank? ? 'outputs[]' : "#{query.block_name}[outputs][]", key, options[:enabled], id: box_id, class: options[:class])
122
+ r << h.label_tag(box_id, h.l('label_my_page_issue_output.' + key), :class => 'inline')
123
+ else
124
+ raise 'Style of edit box is not allowed'
125
+ end
107
126
  r.html_safe
108
127
  end
109
128
 
@@ -0,0 +1,9 @@
1
+ module RedmineExtensions
2
+ module IssuesControllerPatch
3
+
4
+ def ahojky
5
+ 'ahoj'
6
+ end
7
+
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module RedmineExtensions
2
- VERSION = '0.1.14'
2
+ VERSION = '0.1.15'
3
3
  end
@@ -0,0 +1,7 @@
1
+ module RedmineExtensions
2
+ <<<<<<< HEAD
3
+ VERSION = '0.1.13'
4
+ =======
5
+ VERSION = '0.0.38'
6
+ >>>>>>> stable
7
+ end
@@ -0,0 +1,75 @@
1
+ # Redmine - project management software
2
+ # Copyright (C) 2006-2016 Jean-Philippe Lang
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ class CustomFieldEnumerationsController < ApplicationController
19
+ layout 'admin'
20
+
21
+ before_action :require_admin
22
+ before_action :find_custom_field
23
+ before_action :find_enumeration, :only => :destroy
24
+
25
+ helper :custom_fields
26
+
27
+ def index
28
+ @values = @custom_field.enumerations.order(:position)
29
+ end
30
+
31
+ def create
32
+ @value = @custom_field.enumerations.build
33
+ @value.safe_attributes = params[:custom_field_enumeration]
34
+ @value.save
35
+ respond_to do |format|
36
+ format.html { redirect_to custom_field_enumerations_path(@custom_field) }
37
+ format.js
38
+ end
39
+ end
40
+
41
+ def update_each
42
+ saved = CustomFieldEnumeration.update_each(@custom_field, params[:custom_field_enumerations]) do |enumeration, enumeration_attributes|
43
+ enumeration.safe_attributes = enumeration_attributes
44
+ end
45
+ if saved
46
+ flash[:notice] = l(:notice_successful_update)
47
+ end
48
+ redirect_to :action => 'index'
49
+ end
50
+
51
+ def destroy
52
+ reassign_to = @custom_field.enumerations.find_by_id(params[:reassign_to_id])
53
+ if reassign_to.nil? && @value.in_use?
54
+ @enumerations = @custom_field.enumerations - [@value]
55
+ render :action => 'destroy'
56
+ return
57
+ end
58
+ @value.destroy(reassign_to)
59
+ redirect_to custom_field_enumerations_path(@custom_field)
60
+ end
61
+
62
+ private
63
+
64
+ def find_custom_field
65
+ @custom_field = CustomField.find(params[:custom_field_id])
66
+ rescue ActiveRecord::RecordNotFound
67
+ render_404
68
+ end
69
+
70
+ def find_enumeration
71
+ @value = @custom_field.enumerations.find(params[:id])
72
+ rescue ActiveRecord::RecordNotFound
73
+ render_404
74
+ end
75
+ end
@@ -0,0 +1,121 @@
1
+ # Redmine - project management software
2
+ # Copyright (C) 2006-2016 Jean-Philippe Lang
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ require 'csv'
19
+
20
+ class ImportsController < ApplicationController
21
+
22
+ before_action :find_import, :only => [:show, :settings, :mapping, :run]
23
+ before_action :authorize_global
24
+
25
+ helper :issues
26
+ helper :queries
27
+
28
+ def new
29
+ end
30
+
31
+ def create
32
+ @import = IssueImport.new
33
+ @import.user = User.current
34
+ @import.file = params[:file]
35
+ @import.set_default_settings
36
+
37
+ if @import.save
38
+ redirect_to import_settings_path(@import)
39
+ else
40
+ render :action => 'new'
41
+ end
42
+ end
43
+
44
+ def show
45
+ end
46
+
47
+ def settings
48
+ if request.post? && @import.parse_file
49
+ redirect_to import_mapping_path(@import)
50
+ end
51
+
52
+ rescue CSV::MalformedCSVError => e
53
+ flash.now[:error] = l(:error_invalid_csv_file_or_settings)
54
+ rescue ArgumentError, Encoding::InvalidByteSequenceError => e
55
+ flash.now[:error] = l(:error_invalid_file_encoding, :encoding => ERB::Util.h(@import.settings['encoding']))
56
+ rescue SystemCallError => e
57
+ flash.now[:error] = l(:error_can_not_read_import_file)
58
+ end
59
+
60
+ def mapping
61
+ @custom_fields = @import.mappable_custom_fields
62
+
63
+ if request.post?
64
+ respond_to do |format|
65
+ format.html {
66
+ if params[:previous]
67
+ redirect_to import_settings_path(@import)
68
+ else
69
+ redirect_to import_run_path(@import)
70
+ end
71
+ }
72
+ format.js # updates mapping form on project or tracker change
73
+ end
74
+ end
75
+ end
76
+
77
+ def run
78
+ if request.post?
79
+ @current = @import.run(
80
+ :max_items => max_items_per_request,
81
+ :max_time => 10.seconds
82
+ )
83
+ respond_to do |format|
84
+ format.html {
85
+ if @import.finished?
86
+ redirect_to import_path(@import)
87
+ else
88
+ redirect_to import_run_path(@import)
89
+ end
90
+ }
91
+ format.js
92
+ end
93
+ end
94
+ end
95
+
96
+ private
97
+
98
+ def find_import
99
+ @import = Import.where(:user_id => User.current.id, :filename => params[:id]).first
100
+ if @import.nil?
101
+ render_404
102
+ return
103
+ elsif @import.finished? && action_name != 'show'
104
+ redirect_to import_path(@import)
105
+ return
106
+ end
107
+ update_from_params if request.post?
108
+ end
109
+
110
+ def update_from_params
111
+ if params[:import_settings].is_a?(Hash)
112
+ @import.settings ||= {}
113
+ @import.settings.merge!(params[:import_settings])
114
+ @import.save!
115
+ end
116
+ end
117
+
118
+ def max_items_per_request
119
+ 5
120
+ end
121
+ end