redmine_extensions 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/redmine_extensions/entity/entity_generator.rb +21 -24
  3. data/lib/generators/redmine_extensions/entity/templates/_form.html.erb.erb +4 -0
  4. data/lib/generators/redmine_extensions/entity/templates/_sidebar.html.erb.erb +1 -1
  5. data/lib/generators/redmine_extensions/entity/templates/context_menu.html.erb.erb +1 -1
  6. data/lib/generators/redmine_extensions/entity/templates/controller.rb.erb +19 -16
  7. data/lib/generators/redmine_extensions/entity/templates/custom_field.rb.erb +7 -7
  8. data/lib/generators/redmine_extensions/entity/templates/edit.js.erb.erb +10 -9
  9. data/lib/generators/redmine_extensions/entity/templates/en.yml.erb +1 -2
  10. data/lib/generators/redmine_extensions/entity/templates/index.api.rsb.erb +5 -5
  11. data/lib/generators/redmine_extensions/entity/templates/index.html.erb.erb +2 -0
  12. data/lib/generators/redmine_extensions/entity/templates/index.js.erb.erb +7 -6
  13. data/lib/generators/redmine_extensions/entity/templates/mail_added.html.erb.erb +1 -1
  14. data/lib/generators/redmine_extensions/entity/templates/mail_added.text.erb.erb +2 -2
  15. data/lib/generators/redmine_extensions/entity/templates/mail_updated.text.erb.erb +2 -2
  16. data/lib/generators/redmine_extensions/entity/templates/migration.rb.erb +3 -1
  17. data/lib/generators/redmine_extensions/entity/templates/model.rb.erb +4 -4
  18. data/lib/generators/redmine_extensions/entity/templates/new.js.erb.erb +10 -9
  19. data/lib/generators/redmine_extensions/entity/templates/query.rb.erb +8 -5
  20. data/lib/generators/redmine_extensions/entity/templates/routes.rb.erb +12 -12
  21. data/lib/generators/redmine_extensions/entity/templates/show.html.erb.erb +37 -37
  22. data/lib/generators/redmine_extensions/entity/templates/show.js.erb.erb +7 -6
  23. data/lib/generators/redmine_extensions/plugin/plugin_generator.rb +3 -1
  24. data/lib/generators/redmine_extensions/plugin/templates/after_init.rb.erb +22 -0
  25. data/lib/generators/redmine_extensions/plugin/templates/init.rb.erb +4 -22
  26. data/lib/generators/redmine_extensions/plugin/templates/javascript.js +1 -0
  27. data/lib/generators/redmine_extensions/plugin/templates/stylesheet.css +3 -0
  28. data/lib/redmine_extensions/version.rb +1 -1
  29. metadata +12 -216
  30. data/app/assets/javascripts/redmine_extensions/redmine_extensions.js.orig +0 -648
  31. data/app/views/easy_entity_assignments/_query_index.html.erb.orig +0 -16
  32. data/lib/redmine_extensions/redmine_patches/controllers/issues_controller_patch.rb +0 -9
  33. data/lib/redmine_extensions/version.rb.orig +0 -7
  34. data/spec/redmine/app/controllers/custom_field_enumerations_controller.rb +0 -75
  35. data/spec/redmine/app/controllers/imports_controller.rb +0 -121
  36. data/spec/redmine/app/helpers/imports_helper.rb +0 -47
  37. data/spec/redmine/app/models/custom_field_enumeration.rb +0 -90
  38. data/spec/redmine/app/models/import.rb +0 -249
  39. data/spec/redmine/app/models/import_item.rb +0 -22
  40. data/spec/redmine/app/models/issue_import.rb +0 -186
  41. data/spec/redmine/app/views/attachments/image.html.erb +0 -3
  42. data/spec/redmine/app/views/attachments/other.html.erb +0 -3
  43. data/spec/redmine/app/views/common/_image.html.erb +0 -1
  44. data/spec/redmine/app/views/common/_other.html.erb +0 -1
  45. data/spec/redmine/app/views/custom_field_enumerations/create.js.erb +0 -2
  46. data/spec/redmine/app/views/custom_field_enumerations/destroy.html.erb +0 -14
  47. data/spec/redmine/app/views/custom_field_enumerations/index.html.erb +0 -47
  48. data/spec/redmine/app/views/custom_fields/formats/_enumeration.erb +0 -12
  49. data/spec/redmine/app/views/imports/_fields_mapping.html.erb +0 -90
  50. data/spec/redmine/app/views/imports/mapping.html.erb +0 -52
  51. data/spec/redmine/app/views/imports/mapping.js.erb +0 -1
  52. data/spec/redmine/app/views/imports/new.html.erb +0 -15
  53. data/spec/redmine/app/views/imports/run.html.erb +0 -20
  54. data/spec/redmine/app/views/imports/run.js.erb +0 -11
  55. data/spec/redmine/app/views/imports/settings.html.erb +0 -30
  56. data/spec/redmine/app/views/imports/show.html.erb +0 -38
  57. data/spec/redmine/app/views/layouts/_file.html.erb +0 -15
  58. data/spec/redmine/app/views/mailer/security_notification.html.erb +0 -13
  59. data/spec/redmine/app/views/mailer/security_notification.text.erb +0 -8
  60. data/spec/redmine/app/views/mailer/settings_updated.html.erb +0 -14
  61. data/spec/redmine/app/views/mailer/settings_updated.text.erb +0 -12
  62. data/spec/redmine/app/views/queries/_query_form.html.erb +0 -62
  63. data/spec/redmine/app/views/repositories/_changeset.html.erb +0 -40
  64. data/spec/redmine/app/views/search/index.api.rsb +0 -12
  65. data/spec/redmine/app/views/settings/_api.html.erb +0 -10
  66. data/spec/redmine/app/views/settings/_attachments.html.erb +0 -21
  67. data/spec/redmine/app/views/wiki/_new_modal.html.erb +0 -21
  68. data/spec/redmine/app/views/wiki/new.html.erb +0 -17
  69. data/spec/redmine/app/views/wiki/new.js.erb +0 -2
  70. data/spec/redmine/appveyor.yml +0 -36
  71. data/spec/redmine/db/migrate/20150725112753_insert_allowed_statuses_for_new_issues.rb +0 -23
  72. data/spec/redmine/db/migrate/20150730122707_create_imports.rb +0 -13
  73. data/spec/redmine/db/migrate/20150730122735_create_import_items.rb +0 -10
  74. data/spec/redmine/db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb +0 -9
  75. data/spec/redmine/db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb +0 -11
  76. data/spec/redmine/db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb +0 -9
  77. data/spec/redmine/db/migrate/20151020182731_fix_comma_in_user_format_setting_value.rb +0 -13
  78. data/spec/redmine/db/migrate/20151021184614_change_issue_categories_name_limit_to_60.rb +0 -9
  79. data/spec/redmine/db/migrate/20151021185456_change_auth_sources_filter_to_text.rb +0 -9
  80. data/spec/redmine/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb +0 -9
  81. data/spec/redmine/db/migrate/20151024082034_add_tokens_updated_on.rb +0 -10
  82. data/spec/redmine/db/migrate/20151025072118_create_custom_field_enumerations.rb +0 -10
  83. data/spec/redmine/db/migrate/20151031095005_add_projects_default_version_id.rb +0 -12
  84. data/spec/redmine/db/migrate/20160404080304_force_password_reset_during_setup.rb +0 -9
  85. data/spec/redmine/db/migrate/20160416072926_remove_position_defaults.rb +0 -13
  86. data/spec/redmine/db/migrate/20160529063352_add_roles_settings.rb +0 -5
  87. data/spec/redmine/lib/redmine/acts/positioned.rb +0 -118
  88. data/spec/redmine/lib/redmine/helpers/url.rb +0 -35
  89. data/spec/redmine/lib/redmine/hook/listener.rb +0 -32
  90. data/spec/redmine/lib/redmine/hook/view_listener.rb +0 -78
  91. data/spec/redmine/log/test.log +0 -2
  92. data/spec/redmine/plugins/dummy_plugin/Gemfile +0 -1
  93. data/spec/redmine/plugins/dummy_plugin/app/controllers/dummy_autocompletes_controller.rb +0 -4
  94. data/spec/redmine/plugins/dummy_plugin/app/views/dummy_autocompletes/index.html.erb +0 -3
  95. data/spec/redmine/plugins/dummy_plugin/config/locales/en.yml +0 -2
  96. data/spec/redmine/plugins/dummy_plugin/config/routes.rb +0 -1
  97. data/spec/redmine/plugins/dummy_plugin/init.rb +0 -34
  98. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/controllers/issues_controller_patch.example +0 -30
  99. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/helpers/issues_helper_patch.example +0 -30
  100. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/models/issue_patch.example +0 -30
  101. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/hooks.rb +0 -5
  102. data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/internals.rb +0 -4
  103. data/spec/redmine/public/images/jstoolbar/bt_precode.png +0 -0
  104. data/spec/redmine/public/images/reorder.png +0 -0
  105. data/spec/redmine/public/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js +0 -21
  106. data/spec/redmine/public/javascripts/redmine_extensions/application.js +0 -13
  107. data/spec/redmine/public/javascripts/redmine_extensions/easy_togglers.js +0 -58
  108. data/spec/redmine/public/javascripts/redmine_extensions/jquery.entityarray.js +0 -130
  109. data/spec/redmine/public/javascripts/redmine_extensions/redmine_extensions.js +0 -642
  110. data/spec/redmine/public/javascripts/responsive.js +0 -83
  111. data/spec/redmine/public/stylesheets/responsive.css +0 -799
  112. data/spec/redmine/test/fixtures/files/import_dates.csv +0 -4
  113. data/spec/redmine/test/fixtures/files/import_iso8859-1.csv +0 -3
  114. data/spec/redmine/test/fixtures/files/import_issues.csv +0 -4
  115. data/spec/redmine/test/fixtures/ldap/slapd.centos6.conf +0 -24
  116. data/spec/redmine/test/fixtures/ldap/slapd.ubuntu.12.04.conf +0 -23
  117. data/spec/redmine/test/fixtures/mail_handler/issue_update_with_cc.eml +0 -19
  118. data/spec/redmine/test/fixtures/mail_handler/ticket_on_project_given_by_to_header.eml +0 -60
  119. data/spec/redmine/test/fixtures/mail_handler/ticket_with_text_attachment_iso-8859-2.eml +0 -31
  120. data/spec/redmine/test/functional/custom_field_enumerations_controller_test.rb +0 -115
  121. data/spec/redmine/test/functional/imports_controller_test.rb +0 -205
  122. data/spec/redmine/test/functional/sessions_controller_test.rb +0 -138
  123. data/spec/redmine/test/integration/api_test/search_test.rb +0 -92
  124. data/spec/redmine/test/integration/routing/imports_test.rb +0 -36
  125. data/spec/redmine/test/integration/sessions_test.rb +0 -97
  126. data/spec/redmine/test/ui/custom_fields_test_ui.rb +0 -38
  127. data/spec/redmine/test/unit/attachment_transaction_test.rb +0 -76
  128. data/spec/redmine/test/unit/helpers/journals_helper_test.rb +0 -48
  129. data/spec/redmine/test/unit/helpers/wiki_helper_test.rb +0 -45
  130. data/spec/redmine/test/unit/issue_import_test.rb +0 -178
  131. data/spec/redmine/test/unit/lib/redmine/acts/positioned_with_scope_test.rb +0 -53
  132. data/spec/redmine/test/unit/lib/redmine/acts/positioned_without_scope_test.rb +0 -55
  133. data/spec/redmine/test/unit/lib/redmine/field_format/enumeration_format_test.rb +0 -91
  134. data/spec/support/easy_queries_helpers.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b7495846c82f712c1753c94dbf41cdedb9d1d78
4
- data.tar.gz: 9195fa39143a338c916132cdb4bcf11db76b4320
3
+ metadata.gz: e9dafb1894abe51656840de62914a350b3c9d78c
4
+ data.tar.gz: 6dcbff3717bfac6323606d4dffd6bb959ae5bf42
5
5
  SHA512:
6
- metadata.gz: 00f1c48572a81fda0a7d3bf5e9eeae51ecb2827ef5e26de29dcf9285e8aca65950c0ba17664fe5a627c3ce6752abb810eb968278efbd6873a5a638789c283d2b
7
- data.tar.gz: b33b94bd8821b076b4bfef9dbb0a57008f87ea8570af100a76eb6fcfe88cac3bdde487c015d11d8ae1eeb95fbf28290b7ff3a03a9611d89da81c3c33b6509de8
6
+ metadata.gz: 491d56cfee43c1daed176f2f94551daf40d02fb4718d215fb37743e634a8b439dd53f6db1c18f0be6a654c584ca0b6ebea8027018669b80a4077bd57b1e15d69
7
+ data.tar.gz: 0f2b44330b8a107a674b06652acd5bc82f91354c60f58065ffec60e76d1a30903ae0d1552695b1f634f37cf379bef2e859d32517870f890b66423051cd11db37
@@ -50,22 +50,15 @@ module RedmineExtensions
50
50
  template 'edit.js.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/edit.js.erb"
51
51
 
52
52
  if File.exists?("#{plugin_path}/config/locales/en.yml")
53
- append_to_file "#{plugin_path}/config/locales/en.yml" do
54
- "\n activerecord:" +
55
- "\n easy_query:" +
56
- "\n attributes:" +
57
- "\n #{model_name_underscored}:" +
58
- db_columns.collect { |column_name, column_options| "\n #{column_options[:lang_key]}: #{column_name.humanize}" }.join +
59
- "\n name:" +
60
- "\n #{model_name_underscored}_query: #{model_name_pluralize_underscored.titleize}" +
61
- "\n heading_#{model_name_underscored}_new: New #{model_name_underscored.titleize}" +
62
- "\n heading_#{model_name_underscored}_edit: Edit #{model_name_underscored.titleize}" +
63
- "\n button_#{model_name_underscored}_new: New #{model_name_underscored.titleize}" +
64
- "\n label_#{model_name_pluralize_underscored}: #{@model_name_pluralize_underscored.titleize}" +
65
- "\n label_#{model_name_underscored}: #{model_name_underscored.titleize}" +
66
- "\n permission_view_#{model_name_pluralize_underscored}: View #{model_name_pluralize_underscored.titleize}" +
67
- "\n permission_manage_#{model_name_pluralize_underscored}: Manage #{model_name_pluralize_underscored.titleize}" +
68
- "\n title_#{model_name_underscored}_new: Click to create new #{model_name_underscored.titleize}"
53
+ original_langfile = YAML.load_file("#{plugin_path}/config/locales/en.yml")
54
+
55
+ template 'en.yml.erb', "#{plugin_path}/tmp/tmp_en.yml"
56
+ added_translations = YAML.load_file("#{plugin_path}/tmp/tmp_en.yml")
57
+ File.delete("#{plugin_path}/tmp/tmp_en.yml")
58
+
59
+ merged_langfile = original_langfile.deep_merge(added_translations)
60
+ File.open("#{plugin_path}/config/locales/en.yml", "w") do |file|
61
+ file.write merged_langfile.to_yaml
69
62
  end
70
63
  else
71
64
  template 'en.yml.erb', "#{plugin_path}/config/locales/en.yml"
@@ -85,7 +78,7 @@ module RedmineExtensions
85
78
  template 'mail_updated.text.erb.erb', "#{plugin_path}/app/views/#{model_name_underscored}_mailer/#{model_name_underscored}_updated.text.erb"
86
79
  end
87
80
 
88
- template 'migration.rb.erb', "#{plugin_path}/db/migrate/#{Time.now.strftime('%Y%m%d%H%M%S')}_create_#{@model_name_pluralize_underscored}.rb"
81
+ template 'migration.rb.erb', "#{plugin_path}/db/migrate/#{Time.now.strftime('%Y%m%d%H%M%S%L')}_create_#{@model_name_pluralize_underscored}.rb"
89
82
  template 'model.rb.erb', "#{plugin_path}/app/models/#{model_name_underscored}.rb"
90
83
  template 'new.html.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/new.html.erb"
91
84
  template 'new.js.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/new.js.erb"
@@ -113,7 +106,7 @@ module RedmineExtensions
113
106
  template 'routes.rb.erb', "#{plugin_path}/config/routes.rb"
114
107
  end
115
108
 
116
- if File.exists?("#{plugin_path}/init.rb")
109
+ if File.exists?("#{plugin_path}/after_init.rb")
117
110
  s = "\nActiveSupport.on_load(:easyproject, yield: true) do"
118
111
  s << "\n require '#{plugin_name_underscored}/#{model_name_underscored}_hooks'\n"
119
112
  s << "\n Redmine::AccessControl.map do |map|"
@@ -145,7 +138,7 @@ module RedmineExtensions
145
138
  end
146
139
  s << "\nend"
147
140
 
148
- append_to_file "#{plugin_path}/init.rb", s
141
+ append_to_file "#{plugin_path}/after_init.rb", s
149
142
  end
150
143
 
151
144
 
@@ -216,12 +209,16 @@ module RedmineExtensions
216
209
  attr_name, attr_type, attr_idx = attr.split(':')
217
210
  #lang_key = "field_#{model_name_underscored}_#{attr_name.to_s.sub(/_id$/, '').sub(/^.+\./, '')}"
218
211
  lang_key = "#{attr_name.to_s.sub(/_id$/, '').sub(/^.+\./, '')}"
219
-
220
- @db_columns[attr_name] = {type: attr_type || 'string', idx: attr_idx, null: true, safe: true, query_type: attr_type || 'string', lang_key: lang_key}
212
+ if attr_type == 'timestamp'
213
+ @timestamp_exist = true
214
+ else
215
+ @db_columns[attr_name] = {type: attr_type || 'string', idx: attr_idx, null: true, safe: true, query_type: attr_type || 'string', lang_key: lang_key}
216
+ end
221
217
  end
222
218
 
223
219
  @db_columns['project_id'] = {type: 'integer', idx: nil, null: false, safe: false, class: 'Project', list_class_name: 'name', query_type: 'list_optional', query_column_name: 'project', lang_key: "field_#{model_name_underscored}_project"} if project? && !@db_columns.key?('project_id')
224
220
  @db_columns['author_id'] = {type: 'integer', idx: nil, null: false, safe: true, class: 'User', list_class_name: 'name', query_type: 'list', query_column_name: 'author', lang_key: "field_#{model_name_underscored}_author"} if author? && !@db_columns.key?('author_id')
221
+
225
222
  @db_columns['created_at'] = {type: 'datetime', idx: nil, null: false, safe: false, query_type: 'date', lang_key: "field_#{model_name_underscored}_created_at"}
226
223
  @db_columns['updated_at'] = {type: 'datetime', idx: nil, null: false, safe: false, query_type: 'date', lang_key: "field_#{model_name_underscored}_updated_at"}
227
224
  end
@@ -259,7 +256,7 @@ module RedmineExtensions
259
256
  end
260
257
  end
261
258
 
262
- @db_columns["#{assoc_model_class.underscore.singularize}_id"] = {type: 'integer', idx: true, null: false}
259
+ @db_columns["#{assoc_model_class.underscore.singularize}_id"] = {type: 'integer', idx: true, lang_key: assoc_model_class.underscore, query_type: 'list_optional', null: true}
263
260
  end
264
261
  end
265
262
  end
@@ -303,11 +300,11 @@ module RedmineExtensions
303
300
  end
304
301
 
305
302
  def edit_permission
306
- "edit_#{@model_name_pluralize_underscored}"
303
+ "manage_#{@model_name_pluralize_underscored}"
307
304
  end
308
305
 
309
306
  def delete_permission
310
- "edit_#{@model_name_pluralize_underscored}"
307
+ "manage_#{@model_name_pluralize_underscored}"
311
308
  end
312
309
 
313
310
  end
@@ -18,6 +18,10 @@
18
18
  <%- elsif column_options[:query_type] == 'text' -%>
19
19
  <%%= f.text_area :<%= column_name %>, :cols => 60, :rows => (<%= model_name_underscored %>.<%= column_name %>.blank? ? 10 : [[10, <%= model_name_underscored %>.<%= column_name %>.length / 50].max, 100].min), :accesskey => accesskey(:edit), :class => 'wiki-edit' %>
20
20
  <%%= wikitoolbar_for '<%= model_name_underscored %>_<%= column_name %>' %>
21
+ <%- elsif column_options[:query_type] == 'boolean' -%>
22
+ <%%= f.radio_button :<%= column_name %>, false %>
23
+ <%- else -%>
24
+ <%%= f.text_field :<%= column_name %> %>
21
25
  <%- end -%>
22
26
  </p>
23
27
  <%% end %>
@@ -1,6 +1,6 @@
1
1
  <ul>
2
2
  <%% if @<%= model_name_underscored %> && !@<%= model_name_underscored %>.new_record? %>
3
- <li><%%= link_to l(:button_edit), edit_polymorphic_path([@project, @<%= model_name_underscored %>]), title: l(:button_edit), class: 'icon icon-edit' %></li>
3
+ <li><%%= link_to l(:button_edit), edit_polymorphic_path([@project, @<%= model_name_underscored %>]), title: l(:button_edit), class: 'icon icon-edit button' %></li>
4
4
  <%% end %>
5
5
  <%% if @<%= model_name_underscored %>.nil? %>
6
6
  <li><%%= link_to l(:button_<%= model_name_underscored %>_new), new_polymorphic_path([@project, :<%= model_name_underscored %>]), title: l(:title_<%= model_name_underscored %>_new), class: 'icon icon-add button button-positive' %></li>
@@ -8,7 +8,7 @@
8
8
  <ul>
9
9
  <%% <%= model_name %>.statuses.keys.each do |s| -%>
10
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,
11
+ <%%= context_menu_link l("<%= model_name_underscored %>.statuses.#{s}"), bulk_update_<%= model_name_underscored %>_path(id: @<%= model_name_underscored %>_ids, <%= model_name_underscored %>: {status: s}, back_url: @back), method: :put,
12
12
  selected: (@selected[:status] == s), disabled: !@can[:edit], confirm: l(:text_are_you_sure) %>
13
13
  </li>
14
14
  <%% end -%>
@@ -2,8 +2,8 @@ class <%= controller_class %>Controller < ApplicationController
2
2
 
3
3
  menu_item :<%= model_name_pluralize_underscored %>
4
4
 
5
- before_filter :find_<%= model_name_underscored %>, :only => [:show, :edit, :update]
6
- before_filter :find_<%= model_name_pluralize_underscored %>, :only => [:context_menu, :bulk_edit, :bulk_update, :destroy]
5
+ before_filter :find_<%= model_name_underscored %>, only: [:show, :edit, :update]
6
+ before_filter :find_<%= model_name_pluralize_underscored %>, only: [:context_menu, :bulk_edit, :bulk_update, :destroy]
7
7
  <%- if project? -%>
8
8
  before_filter :find_project
9
9
  <%- end -%>
@@ -11,6 +11,7 @@ class <%= controller_class %>Controller < ApplicationController
11
11
 
12
12
  helper :<%= model_name_pluralize_underscored %>
13
13
  helper :custom_fields
14
+ helper :context_menus
14
15
  helper :attachments
15
16
  helper :issues
16
17
  include_query_helpers
@@ -58,14 +59,14 @@ class <%= controller_class %>Controller < ApplicationController
58
59
  flash[:notice] = l(:notice_successful_create)
59
60
  redirect_back_or_default <%= model_name_underscored %>_path(@<%= model_name_underscored %>)
60
61
  }
61
- format.api { render :action => 'show', :status => :created, :location => <%= model_name_underscored %>_url(@<%= model_name_underscored %>) }
62
- format.js { render :template => 'common/close_modal' }
62
+ format.api { render action: 'show', status: :created, location: <%= model_name_underscored %>_url(@<%= model_name_underscored %>) }
63
+ format.js { render template: 'common/close_modal' }
63
64
  end
64
65
  else
65
66
  respond_to do |format|
66
- format.html { render :action => 'new' }
67
+ format.html { render action: 'new' }
67
68
  format.api { render_validation_errors(@<%= model_name_underscored %>) }
68
- format.js { render :action => 'new' }
69
+ format.js { render action: 'new' }
69
70
  end
70
71
  end
71
72
  end
@@ -92,13 +93,13 @@ class <%= controller_class %>Controller < ApplicationController
92
93
  redirect_back_or_default <%= model_name_underscored %>_path(@<%= model_name_underscored %>)
93
94
  }
94
95
  format.api { render_api_ok }
95
- format.js { render :template => 'common/close_modal' }
96
+ format.js { render template: 'common/close_modal' }
96
97
  end
97
98
  else
98
99
  respond_to do |format|
99
- format.html { render :action => 'edit' }
100
+ format.html { render action: 'edit' }
100
101
  format.api { render_validation_errors(@<%= model_name_underscored %>) }
101
- format.js { render :action => 'edit' }
102
+ format.js { render action: 'edit' }
102
103
  end
103
104
  end
104
105
  end
@@ -122,13 +123,13 @@ class <%= controller_class %>Controller < ApplicationController
122
123
 
123
124
  def bulk_update
124
125
  unsaved, saved = [], []
125
- attributes = parse_params_for_bulk_update([:<%= model_name_underscored %>])
126
+ attributes = parse_params_for_bulk_update(params[:<%= model_name_underscored %>])
126
127
  @<%= model_name_pluralize_underscored %>.each do |entity|
127
128
  entity.init_journal(User.current) if entity.respond_to? :init_journal
128
129
  entity.safe_attributes = attributes
129
130
  if entity.save
130
131
  saved << entity
131
- else
132
+ else
132
133
  unsaved << entity
133
134
  end
134
135
  end
@@ -157,8 +158,9 @@ class <%= controller_class %>Controller < ApplicationController
157
158
  @<%= model_name_underscored %>_ids, @safe_attributes, @selected = [], [], {}
158
159
  @<%= model_name_pluralize_underscored %>.each do |e|
159
160
  @<%= 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|
161
+ @safe_attributes.concat e.safe_attribute_names
162
+ attributes = e.safe_attribute_names - (%w(custom_field_values custom_fields))
163
+ attributes.each do |c|
162
164
  column_name = c.to_sym
163
165
  if @selected.key? column_name
164
166
  @selected[column_name] = nil if @selected[column_name] != e.send(column_name)
@@ -185,7 +187,8 @@ class <%= controller_class %>Controller < ApplicationController
185
187
  end
186
188
 
187
189
  def find_<%= model_name_pluralize_underscored %>
188
- @<%= model_name_pluralize_underscored %> = <%= model_name %>.visible.where(:id => (params[:id] || params[:ids])).to_a
190
+ @<%= model_name_pluralize_underscored %> = <%= model_name %>.visible.where(id: (params[:id] || params[:ids])).to_a
191
+ @<%= model_name_underscored %> = @<%= model_name_pluralize_underscored %>.first if @<%= model_name_pluralize_underscored %>.count == 1
189
192
  raise ActiveRecord::RecordNotFound if @<%= model_name_pluralize_underscored %>.empty?
190
193
  raise Unauthorized unless @<%= model_name_pluralize_underscored %>.all?(&:visible?)
191
194
  @projects = @<%= model_name_pluralize_underscored %>.collect(&:project).compact.uniq
@@ -196,8 +199,8 @@ class <%= controller_class %>Controller < ApplicationController
196
199
 
197
200
  <%- if project? -%>
198
201
  def find_project
199
- @project ||= @<%= model_name_underscored %>.project if !@<%= model_name_underscored %>.nil?
200
- @project ||= Project.find(params[:project_id]) if !params[:project_id].blank?
202
+ @project ||= @<%= model_name_underscored %>.project if @<%= model_name_underscored %>
203
+ @project ||= Project.find(params[:project_id]) if params[:project_id].present?
201
204
  rescue ActiveRecord::RecordNotFound
202
205
  render_404
203
206
  end
@@ -1,7 +1,7 @@
1
- class <%= model_name %>CustomField < CustomField
2
-
3
- def type_name
4
- :label_<%= @model_name_pluralize_underscored %>
5
- end
6
-
7
- end
1
+ class <%= model_name %>CustomField < CustomField
2
+
3
+ def type_name
4
+ :label_<%= @model_name_pluralize_underscored %>
5
+ end
6
+
7
+ end
@@ -1,17 +1,18 @@
1
- $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/edit', :formats => [:html]) %>");
2
- showModal('ajax-modal');
1
+ var modal = $("#ajax-modal");
2
+ modal.html("<%%= j render(template: '<%= model_name_pluralize_underscored %>/edit', formats: [:html]) %>");
3
+ showModal(modal.attr("id"));
3
4
  var submitButton = {
4
- text:"<%%=j l(:button_update) -%%>",
5
- title:"<%%=j l(:button_update) -%%>",
5
+ text:"<%%=j l(:button_update) -%>",
6
+ title:"<%%=j l(:button_update) -%>",
6
7
  click: function() {$(this).find('form').submit()},
7
8
  'class': 'button-positive'
8
- }
9
+ };
9
10
  var closeButton = {
10
- text: "<%%=j l(:button_close) -%%>",
11
- title: "<%%=j l(:button_close) -%%>",
11
+ text: "<%%=j l(:button_close) -%>",
12
+ title: "<%%=j l(:button_close) -%>",
12
13
  click: function() {$(this).dialog('close');},
13
14
  'class': 'button'
14
- }
15
- $("#ajax-modal").dialog('option', {
15
+ };
16
+ modal.dialog('option', {
16
17
  buttons: [closeButton, submitButton]
17
18
  });
@@ -1,8 +1,7 @@
1
1
  en:
2
2
  activerecord:
3
3
  attributes:
4
- <%= model_name_underscored %>:
5
- <%= db_columns.collect{|column_name, column_options| "\n #{column_options[:lang_key]}: #{column_name.humanize}" }.join %>
4
+ <%= model_name_underscored %>: <%= db_columns.collect{|column_name, column_options| "\n #{column_options[:lang_key]}: #{column_name.humanize}" }.join %>
6
5
  easy_query:
7
6
  name:
8
7
  <%= model_name_underscored %>_query: <%= model_name_pluralize_underscored.titleize %>
@@ -1,5 +1,5 @@
1
- api.array :<%= model_name_pluralize_underscored %>, api_meta(total_count: @entity_count, offset: @offset, limit: @limit) do
2
- @entities.each do |<%= model_name_underscored %>|
3
- render_api_<%= model_name_underscored %>(api, <%= model_name_underscored %>)
4
- end
5
- end
1
+ api.array :<%= model_name_pluralize_underscored %>, api_meta(total_count: @entity_count, offset: @offset, limit: @limit) do
2
+ @entities.each do |<%= model_name_underscored %>|
3
+ render_api_<%= model_name_underscored %>(api, <%= model_name_underscored %>)
4
+ end
5
+ end
@@ -1,5 +1,7 @@
1
1
  <%%= render @query %>
2
2
  <%% ### PAGE CUSTOMS ########################################################## %>
3
+ <%%= context_menu context_menu_<%= model_name_pluralize_underscored %>_path(:project_id => @project) %>
3
4
  <%% content_for :sidebar do %>
4
5
  <%%= render :partial => '<%= model_name_pluralize_underscored %>/sidebar' %>
6
+ <%%= render :partial => 'sidebar/saved_easyqueries_by_type', :locals => {:query_class => @query.class, :project => @project} %>
5
7
  <%% end %>
@@ -1,11 +1,12 @@
1
- $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/index', :formats => [:html]) %>");
2
- showModal('ajax-modal');
1
+ var modal = $("#ajax-modal");
2
+ modal.html("<%%= j render(template: '<%= model_name_pluralize_underscored %>/index', formats: [:html]) %>");
3
+ showModal(modal.attr("id"));
3
4
  var closeButton = {
4
- text: "<%%=j l(:button_close) -%%>",
5
- title: "<%%=j l(:button_close) -%%>",
5
+ text: "<%%=j l(:button_close) -%>",
6
+ title: "<%%=j l(:button_close) -%>",
6
7
  click: function() {$(this).dialog('close');},
7
8
  'class': 'button'
8
- }
9
- $("#ajax-modal").dialog('option', {
9
+ };
10
+ modal.dialog('option', {
10
11
  buttons: [closeButton, submitButton]
11
12
  });
@@ -1 +1 @@
1
- <h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
1
+ <h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
@@ -1,2 +1,2 @@
1
- <%%= @<%= model_name_underscored %>.to_s %>
2
- <%%= @<%= model_name_underscored %>_url %>
1
+ <%%= @<%= model_name_underscored %>.to_s %>
2
+ <%%= @<%= model_name_underscored %>_url %>
@@ -1,2 +1,2 @@
1
- <%%= @<%= model_name_underscored %>.to_s %>
2
- <%%= @<%= model_name_underscored %>_url %>
1
+ <%%= @<%= model_name_underscored %>.to_s %>
2
+ <%%= @<%= model_name_underscored %>_url %>
@@ -1,9 +1,11 @@
1
1
  class Create<%= model_name_pluralize_underscored.camelize %> < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :<%= model_name_pluralize_underscored %>, force: true do |t|
4
- <%- db_columns.each do |column_name, column_attrs| -%>
4
+ <%- columns = db_columns.reject{|k| k.in?(["created_at", "updated_at"])} -%>
5
+ <%- columns.each do |column_name, column_attrs| -%>
5
6
  t.<%= column_attrs[:type] %> :<%= column_name %>, null: <%= column_attrs[:null] %>
6
7
  <%- end -%>
8
+ t.timestamps null: false
7
9
  end
8
10
  end
9
11
  end
@@ -2,7 +2,7 @@ class <%= model_name %> < ActiveRecord::Base
2
2
  include Redmine::SafeAttributes
3
3
 
4
4
  <%= 'belongs_to :project' if project? %>
5
- <%= 'belongs_to :author, class_name: \'User\', foreign_key: \'author_id\'' if author? %>
5
+ <%= 'belongs_to :author, class_name: \'User\'' if author? %>
6
6
 
7
7
  scope :visible, lambda { |*args|
8
8
  where(<%= model_name %>.visible_condition(args.shift || User.current, *args))<%= '.joins(:project)' if project? %>
@@ -33,8 +33,8 @@ class <%= model_name %> < ActiveRecord::Base
33
33
  acts_as_watchable
34
34
  <%- end -%>
35
35
 
36
- <%= 'validates :project_id, :presence => true' if project? %>
37
- <%= 'validates :author_id, :presence => true' if author? %>
36
+ <%= 'validates :project_id, presence: true' if project? %>
37
+ <%= 'validates :author_id, presence: true' if author? %>
38
38
 
39
39
  attr_protected :id
40
40
 
@@ -53,7 +53,7 @@ class <%= model_name %> < ActiveRecord::Base
53
53
  safe_attributes 'custom_field_values', 'custom_fields'
54
54
  <%- end -%>
55
55
  <%- if project? -%>
56
- safe_attributes 'project_id', :if => lambda {|<%= model_name_underscored %>, user| <%= model_name_underscored %>.new_record? }
56
+ safe_attributes 'project_id', if: ->(<%= model_name_underscored %>, _user) { <%= model_name_underscored %>.new_record? }
57
57
  <%- end -%>
58
58
 
59
59
  <%- if mail? -%>
@@ -1,17 +1,18 @@
1
- $("#ajax-modal").html("<%%= j render(:template => '<%= model_name_pluralize_underscored %>/new', :formats => [:html]) %>");
2
- showModal('ajax-modal');
1
+ var modal = $("#ajax-modal");
2
+ modal.html("<%%= j render(template: '<%= model_name_pluralize_underscored %>/new', formats: [:html]) %>");
3
+ showModal(modal.attr("id"));
3
4
  var submitButton = {
4
- text:"<%%=j l(:button_create) -%%>",
5
- title:"<%%=j l(:button_create) -%%>",
5
+ text:"<%%=j l(:button_create) -%>",
6
+ title:"<%%=j l(:button_create) -%>",
6
7
  click: function() {$(this).find('form').submit()},
7
8
  'class': 'button-positive'
8
- }
9
+ };
9
10
  var closeButton = {
10
- text: "<%%=j l(:button_close) -%%>",
11
- title: "<%%=j l(:button_close) -%%>",
11
+ text: "<%%=j l(:button_close) -%>",
12
+ title: "<%%=j l(:button_close) -%>",
12
13
  click: function() {$(this).dialog('close');},
13
14
  'class': 'button'
14
- }
15
- $("#ajax-modal").dialog('option', {
15
+ };
16
+ modal.dialog('option', {
16
17
  buttons: [closeButton, submitButton]
17
18
  });
@@ -9,7 +9,7 @@ class <%= model_name %>Query < EasyQuery
9
9
  add_available_filter '<%= column_name %>', name: ::<%= model_name %>.human_attribute_name(:<%= column_name %>), type: :<%= column_options[:query_type] %>, values: all_projects_values
10
10
  end
11
11
  <%- else -%>
12
- add_available_filter '<%= column_name %>', name: ::<%= model_name %>.human_attribute_name(:<%= column_name %>), type: :<%= column_options[:query_type] -%>
12
+ add_available_filter '<%= column_name %>', name: ::<%= model_name %>.human_attribute_name(:<%= column_name %>), type: :<%= column_options[:query_type] %>
13
13
  <%- end -%>
14
14
  <%- end -%>
15
15
 
@@ -22,17 +22,20 @@ class <%= model_name %>Query < EasyQuery
22
22
  return @available_columns if @available_columns
23
23
 
24
24
  <%- db_columns.each do |column_name, column_options| -%>
25
- add_available_column '<%= column_options[:query_column_name] || column_name %>', caption: ::<%= model_name %>.human_attribute_name(:<%= column_name %>)
25
+ add_available_column '<%= column_options[:query_column_name] || column_name %>', caption: ::<%= model_name %>.human_attribute_name(:<%= column_name %>), title: ::<%= model_name %>.human_attribute_name(:<%= column_name %>)
26
26
  <%- end -%>
27
27
  <%- if acts_as_customizable? -%>
28
- @available_columns += <%= model_name %>CustomField.visible.collect {|cf| QueryCustomFieldColumn.new(cf) }
28
+ @available_columns += <%= model_name %>CustomField.visible.collect { |cf| EasyQueryCustomFieldColumn.new(cf, :group => default_cf_group) }
29
29
  <%- end -%>
30
30
 
31
31
  @available_columns
32
32
  end
33
33
 
34
- def default_columns_names
35
- super.presence || <%= db_columns.collect{|column_name, column_options| (column_options[:query_column_name] || column_name).to_sym}[0..3].to_s %>.flat_map{|c| [c.to_s, c.to_sym]}
34
+ def default_list_columns
35
+ super.presence || <%= db_columns.collect{|column_name, column_options| (column_options[:query_column_name] || column_name).to_s}[0..3].to_s %>.flat_map{|c| [c.to_s, c.to_sym]}
36
36
  end
37
37
 
38
+ def default_columns_names
39
+ super.presence || <%= db_columns.collect{|column_name, column_options| (column_options[:query_column_name] || column_name).to_s}[0..3].to_s %>.flat_map{|c| [c.to_s, c.to_sym]}
40
+ end
38
41
  end