redmine_extensions 0.6.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -32
  3. data/Rakefile +0 -8
  4. data/app/assets/javascripts/redmine_extensions/blocking.js +0 -3
  5. data/app/assets/javascripts/redmine_extensions/blocking_namespace.js +1 -2
  6. data/app/assets/javascripts/redmine_extensions/redmine_extensions.js +1 -33
  7. data/config/routes.rb +0 -7
  8. data/lib/redmine_extensions/easy_settings.rb +5 -5
  9. data/lib/redmine_extensions/engine.rb +12 -32
  10. data/lib/redmine_extensions/hooks.rb +6 -35
  11. data/lib/redmine_extensions/version.rb +1 -1
  12. data/lib/redmine_extensions.rb +5 -2
  13. data/spec/spec_helper.rb +10 -2
  14. metadata +3 -76
  15. data/app/assets/javascripts/redmine_extensions/blocking_render.js +0 -137
  16. data/app/assets/javascripts/redmine_extensions/blocking_schedule.js +0 -280
  17. data/app/assets/javascripts/redmine_extensions/event_bus.js +0 -61
  18. data/app/assets/stylesheets/redmine_extensions/application.css +0 -15
  19. data/lib/generators/redmine_extensions/entity/USAGE +0 -11
  20. data/lib/generators/redmine_extensions/entity/entity_generator.rb +0 -418
  21. data/lib/generators/redmine_extensions/entity/templates/_form.html.erb.erb +0 -51
  22. data/lib/generators/redmine_extensions/entity/templates/_list.html.erb.erb +0 -70
  23. data/lib/generators/redmine_extensions/entity/templates/_sidebar.html.erb.erb +0 -9
  24. data/lib/generators/redmine_extensions/entity/templates/app/models/%model_name_underscored%_query.rb.tt +0 -42
  25. data/lib/generators/redmine_extensions/entity/templates/app/views/%model_name_pluralize_underscored%/_%model_name_underscored%.api.rsb.tt +0 -18
  26. data/lib/generators/redmine_extensions/entity/templates/app/views/%model_name_pluralize_underscored%/_form.html.erb.tt +0 -62
  27. data/lib/generators/redmine_extensions/entity/templates/app/views/%model_name_pluralize_underscored%/edit.html.erb.tt +0 -8
  28. data/lib/generators/redmine_extensions/entity/templates/app/views/%model_name_pluralize_underscored%/new.html.erb.tt +0 -8
  29. data/lib/generators/redmine_extensions/entity/templates/context_menu.html.erb.erb +0 -20
  30. data/lib/generators/redmine_extensions/entity/templates/controller.rb.erb +0 -208
  31. data/lib/generators/redmine_extensions/entity/templates/custom_field.rb.erb +0 -11
  32. data/lib/generators/redmine_extensions/entity/templates/easy_query.rb.erb +0 -37
  33. data/lib/generators/redmine_extensions/entity/templates/edit.html.erb.erb +0 -19
  34. data/lib/generators/redmine_extensions/entity/templates/edit.js.erb.erb +0 -18
  35. data/lib/generators/redmine_extensions/entity/templates/en.yml.erb +0 -16
  36. data/lib/generators/redmine_extensions/entity/templates/entity_attribute_helper_patch.rb.erb +0 -10
  37. data/lib/generators/redmine_extensions/entity/templates/helper.rb.erb +0 -3
  38. data/lib/generators/redmine_extensions/entity/templates/hooks.rb.erb +0 -5
  39. data/lib/generators/redmine_extensions/entity/templates/index.api.rsb.erb +0 -3
  40. data/lib/generators/redmine_extensions/entity/templates/index.html.erb.erb +0 -30
  41. data/lib/generators/redmine_extensions/entity/templates/index.js.erb.erb +0 -12
  42. data/lib/generators/redmine_extensions/entity/templates/mail_added.html.erb.erb +0 -1
  43. data/lib/generators/redmine_extensions/entity/templates/mail_added.text.erb.erb +0 -2
  44. data/lib/generators/redmine_extensions/entity/templates/mail_updated.html.erb.erb +0 -1
  45. data/lib/generators/redmine_extensions/entity/templates/mail_updated.text.erb.erb +0 -2
  46. data/lib/generators/redmine_extensions/entity/templates/mailer.rb.erb +0 -41
  47. data/lib/generators/redmine_extensions/entity/templates/migration.rb.erb +0 -16
  48. data/lib/generators/redmine_extensions/entity/templates/model.rb.erb +0 -143
  49. data/lib/generators/redmine_extensions/entity/templates/new.html.erb.erb +0 -19
  50. data/lib/generators/redmine_extensions/entity/templates/new.js.erb.erb +0 -18
  51. data/lib/generators/redmine_extensions/entity/templates/query.rb.erb +0 -67
  52. data/lib/generators/redmine_extensions/entity/templates/routes.rb.erb +0 -15
  53. data/lib/generators/redmine_extensions/entity/templates/show.api.rsb.erb +0 -1
  54. data/lib/generators/redmine_extensions/entity/templates/show.html.erb.erb +0 -50
  55. data/lib/generators/redmine_extensions/entity/templates/show.js.erb.erb +0 -12
  56. data/lib/generators/redmine_extensions/entity/templates/spec/controllers/%model_name_underscored%_controller_spec.rb.tt +0 -94
  57. data/lib/generators/redmine_extensions/entity/templates/spec/factories.rb.erb +0 -11
  58. data/lib/generators/redmine_extensions/entity/templates/spec/requests/%model_name_underscored%_spec.rb.tt +0 -19
  59. data/lib/generators/redmine_extensions/plugin/USAGE +0 -13
  60. data/lib/generators/redmine_extensions/plugin/plugin_generator.rb +0 -74
  61. data/lib/generators/redmine_extensions/plugin/templates/Gemfile.erb +0 -1
  62. data/lib/generators/redmine_extensions/plugin/templates/after_init.rb.erb +0 -23
  63. data/lib/generators/redmine_extensions/plugin/templates/en.yml.erb +0 -3
  64. data/lib/generators/redmine_extensions/plugin/templates/gitkeep.erb +0 -0
  65. data/lib/generators/redmine_extensions/plugin/templates/hooks.rb.erb +0 -5
  66. data/lib/generators/redmine_extensions/plugin/templates/init.rb.erb +0 -20
  67. data/lib/generators/redmine_extensions/plugin/templates/internals.rb.erb +0 -4
  68. data/lib/generators/redmine_extensions/plugin/templates/issue_patch.example.erb +0 -30
  69. data/lib/generators/redmine_extensions/plugin/templates/issues_controller_patch.example.erb +0 -30
  70. data/lib/generators/redmine_extensions/plugin/templates/issues_helper_patch.example.erb +0 -30
  71. data/lib/generators/redmine_extensions/plugin/templates/javascript.js +0 -1
  72. data/lib/generators/redmine_extensions/plugin/templates/routes.rb.erb +0 -0
  73. data/lib/generators/redmine_extensions/plugin/templates/stylesheet.css +0 -3
  74. data/lib/redmine_extensions/core_ext/date_range.rb +0 -152
  75. data/lib/redmine_extensions/core_ext/object.rb +0 -19
  76. data/lib/redmine_extensions/core_ext/string.rb +0 -5
  77. data/lib/redmine_extensions/core_ext.rb +0 -3
  78. data/lib/redmine_extensions/deprecator.rb +0 -11
  79. data/lib/redmine_extensions/migration.rb +0 -9
  80. data/lib/redmine_extensions/patch_manager.rb +0 -440
  81. data/lib/redmine_extensions/rails_patches/route_set_generator_patch.rb +0 -10
  82. data/lib/redmine_extensions/redmine_patches/controllers/application_controller_patch.rb +0 -65
  83. data/lib/redmine_extensions/redmine_patches/models/custom_field_patch.rb +0 -11
  84. data/lib/redmine_extensions/redmine_patches/models/project_patch.rb +0 -10
  85. data/lib/tasks/redmine_extensions_tasks.rake +0 -4
  86. data/spec/init_rails.rb +0 -13
@@ -1,62 +0,0 @@
1
- <%%= labelled_form_for([@project, @<%= model_name_underscored %>], html: { multipart: <%= acts_as_attachable? %>, id: '<%= model_name_underscored %>_form', class: 'tabular', remote: request.xhr? }) do |f| %>
2
- <%%= error_messages_for @<%= model_name_underscored %> %>
3
-
4
- <div class="box">
5
- <%- if project? -%>
6
- <%% if <%= model_name_underscored %>.safe_attribute?('project_id') && !@project %>
7
- <p>
8
- <%%= f.label :project_id, ::<%= model_name %>.human_attribute_name(:project_id) %>
9
- <%%= f.select :project_id, Project.allowed_to(:manage_<%= model_name_pluralize_underscored %>).collect{|x| [x.name, x.id]}, include_blank: true %>
10
- </p>
11
- <%% end %>
12
- <%- end -%>
13
- <%- safe_columns.each do |column_name, column_options| -%>
14
- <%% if <%= model_name_underscored %>.safe_attribute?('<%= column_name %>') %>
15
- <p>
16
- <%%= f.label :<%= column_name %>, ::<%= model_name %>.human_attribute_name(:<%= column_name %>) %>
17
- <%- if column_options[:query_type] == 'string' || column_options[:query_type] == 'integer' -%>
18
- <%%= f.text_field :<%= column_name %> %>
19
- <%- elsif column_options[:query_type] == 'list' || column_options[:query_type] == 'list_optional' -%>
20
- <%%= f.select :<%= column_name %>, <%= column_options[:class] %>.all.collect{|x| [x.<%= column_options[:list_class_name] %>, x.id]}.sort, include_blank: true %>
21
- <%- elsif column_options[:query_type] == 'text' -%>
22
- <%%= 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' %>
23
- <%%= wikitoolbar_for '<%= model_name_underscored %>_<%= column_name %>' %>
24
- <%- elsif column_options[:query_type] == 'boolean' -%>
25
- <%%= f.radio_button :<%= column_name %>, false %>
26
- <%- else -%>
27
- <%%= f.text_field :<%= column_name %> %>
28
- <%- end -%>
29
- </p>
30
- <%% end %>
31
- <%- end -%>
32
- <% associations.each do |assoc| %>
33
- <%- next if assoc[1][:type] == 'has_many' -%>
34
- <% association_name = assoc[0] %>
35
- <p>
36
- <%%= f.label l(:label_<%= association_name %>) %>
37
- <%%= f.select :<%= association_name %>_id, <%= association_name.camelcase %>.visible.sorted.map{ |<%= association_name %>| [<%= association_name %>.to_s, <%= association_name %>.id]} %>
38
- </p>
39
- <% end %>
40
- <%- if acts_as_customizable? -%>
41
- <%% custom_field_values = <%= model_name_underscored %>.visible_custom_field_values %>
42
- <%% custom_field_values.each do |value| %>
43
- <p>
44
- <%%= custom_field_tag_with_label :<%= model_name_underscored %>, value %>
45
- </p>
46
- <%% end %>
47
- <%- end -%>
48
- <%- if acts_as_attachable? -%>
49
- <p id="attachments_form"><label><%%= l(:label_attachment_plural) %></label><%%= render :partial => 'attachments/form', :locals => {:container => <%= model_name_underscored %>} %></p>
50
- <%- end -%>
51
- </div>
52
-
53
- <%% if !request.xhr? %>
54
- <p>
55
- <%% if f.object.new_record? %>
56
- <%%= submit_tag l(:button_create), title: l(:button_create), class: "button-positive" %>
57
- <%% else %>
58
- <%%= submit_tag l(:button_update), title: l(:button_update), class: "button-positive" %>
59
- <%% end %>
60
- </p>
61
- <%% end %>
62
- <%% end %>
@@ -1,8 +0,0 @@
1
- <%%= title l(:heading_<%= model_name_underscored %>_edit) %>
2
-
3
- <%%= render partial: 'form', locals: { <%= model_name_underscored %>: @<%= model_name_underscored %> } %>
4
-
5
- <%% ### PAGE CUSTOMS ########################################################## %>
6
- <%% content_for :sidebar do %>
7
- <%%= render partial: '<%= model_name_pluralize_underscored %>/sidebar' %>
8
- <%% end %>
@@ -1,8 +0,0 @@
1
- <%%= title l(:heading_<%= model_name_underscored %>_new) %>
2
-
3
- <%%= render partial: 'form', locals: { <%= model_name_underscored %>: @<%= model_name_underscored %> } %>
4
-
5
- <%% ### PAGE CUSTOMS ########################################################## %>
6
- <%% content_for :sidebar do %>
7
- <%%= render partial: '<%= model_name_pluralize_underscored %>/sidebar' %>
8
- <%% end %>
@@ -1,20 +0,0 @@
1
- <ul>
2
- <%% if @<%= model_name_underscored %> %>
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
- <%% 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 |status| %>
10
- <li>
11
- <%%= context_menu_link l("<%= model_name_underscored %>.statuses.#{status}"), bulk_update_<%= model_name_underscored %>_path(id: @<%= model_name_underscored %>_ids, <%= model_name_underscored %>: { status: status }, back_url: @back), method: :put, selected: (@selected[:status] == status), disabled: !@can[:edit], confirm: l(:text_are_you_sure) %>
12
- </li>
13
- <%% end %>
14
- </ul>
15
- </li>
16
- <%% end %>
17
- <li><%%= context_menu_link l(:button_delete), <%= model_name_underscored %>_path(id: @<%= model_name_underscored %>_ids, back_url: @back), method: :delete, data: { confirm: l(:text_are_you_sure) }, class: 'icon icon-del', disabled: !@can[:delete] %></li>
18
-
19
- <%%= 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 }) %>
20
- </ul>
@@ -1,208 +0,0 @@
1
- class <%= controller_class %>Controller < ApplicationController
2
-
3
- menu_item :<%= model_name_pluralize_underscored %>
4
-
5
- before_action :authorize_global
6
- before_action :find_<%= model_name_underscored %>, only: [:show, :edit, :update]
7
- before_action :find_<%= model_name_pluralize_underscored %>, only: [:context_menu, :bulk_edit, :bulk_update, :destroy]
8
- <%- if project? -%>
9
- before_action :find_project
10
- <%- end -%>
11
-
12
- helper :<%= model_name_pluralize_underscored %>
13
- helper :custom_fields, :context_menus, :attachments, :issues
14
- include_query_helpers
15
-
16
- accept_api_auth :index, :show, :create, :update, :destroy
17
-
18
- def index
19
- <%- if Redmine::Plugin.installed?(:easy_extensions) %>
20
- index_for_easy_query(<%= model_name %>Query)
21
- <% else %>
22
- retrieve_query(<%= model_name %>Query)
23
- @entity_count = @query.<%= model_name_pluralize_underscored %>.count
24
- @entity_pages = Paginator.new @entity_count, per_page_option, params['page']
25
- @entities = @query.<%= model_name_pluralize_underscored %>(offset: @entity_pages.offset, limit: @entity_pages.per_page)
26
- <%- end %>
27
- end
28
-
29
- def show
30
- respond_to do |format|
31
- format.html
32
- format.api
33
- format.js
34
- end
35
- end
36
-
37
- def new
38
- @<%= model_name_underscored %> = <%= model_name %>.new
39
- <%- if project? -%>
40
- @<%= model_name_underscored %>.project = @project
41
- <%- end -%>
42
- @<%= model_name_underscored %>.safe_attributes = params[:<%= model_name_underscored %>]
43
-
44
- respond_to do |format|
45
- format.html
46
- format.js
47
- end
48
- end
49
-
50
- def create
51
- @<%= model_name_underscored %> = <%= model_name %>.new <%= "author: User.current" if author? %>
52
- <%- if project? -%>
53
- @<%= model_name_underscored %>.project = @project
54
- <%- end -%>
55
- @<%= model_name_underscored %>.safe_attributes = params[:<%= model_name_underscored %>]
56
- <%- if acts_as_attachable? -%>
57
- @<%= model_name_underscored %>.save_attachments(params[:attachments] || (params[:<%= model_name_underscored %>] && params[:<%= model_name_underscored %>][:uploads]))
58
- <%- end -%>
59
-
60
- respond_to do |format|
61
- if @<%= model_name_underscored %>.save
62
- format.html do
63
- flash[:notice] = l(:notice_successful_create)
64
- redirect_back_or_default <%= model_name_underscored %>_path(@<%= model_name_underscored %>)
65
- end
66
- format.api { render action: 'show', status: :created, location: <%= model_name_underscored %>_url(@<%= model_name_underscored %>) }
67
- format.js { render template: 'common/close_modal' }
68
- else
69
- format.html { render action: 'new' }
70
- format.api { render_validation_errors(@<%= model_name_underscored %>) }
71
- format.js { render action: 'new' }
72
- end
73
- end
74
- end
75
-
76
- def edit
77
- @<%= model_name_underscored %>.safe_attributes = params[:<%= model_name_underscored %>]
78
-
79
- respond_to do |format|
80
- format.html
81
- format.js
82
- end
83
- end
84
-
85
- def update
86
- @<%= model_name_underscored %>.safe_attributes = params[:<%= model_name_underscored %>]
87
- <%- if acts_as_attachable? -%>
88
- @<%= model_name_underscored %>.save_attachments(params[:attachments] || (params[:<%= model_name_underscored %>] && params[:<%= model_name_underscored %>][:uploads]))
89
- <%- end -%>
90
-
91
- respond_to do |format|
92
- if @<%= model_name_underscored %>.save
93
- format.html do
94
- flash[:notice] = l(:notice_successful_update)
95
- redirect_back_or_default <%= model_name_underscored %>_path(@<%= model_name_underscored %>)
96
- end
97
- format.api { render_api_ok }
98
- format.js { render template: 'common/close_modal' }
99
- else
100
- format.html { render action: 'edit' }
101
- format.api { render_validation_errors(@<%= model_name_underscored %>) }
102
- format.js { render action: 'edit' }
103
- end
104
- end
105
- end
106
-
107
- def destroy
108
- @<%= model_name_pluralize_underscored %>.each(&:destroy)
109
-
110
- respond_to do |format|
111
- format.html do
112
- flash[:notice] = l(:notice_successful_delete)
113
- redirect_back_or_default <%= model_name_pluralize_underscored %>_path
114
- end
115
- format.api { render_api_ok }
116
- end
117
- end
118
-
119
- def bulk_edit
120
- end
121
-
122
- def bulk_update
123
- unsaved, saved = [], []
124
- attributes = parse_params_for_bulk_update(params[:<%= model_name_underscored %>])
125
- @<%= model_name_pluralize_underscored %>.each do |entity|
126
- entity.init_journal(User.current) if entity.respond_to? :init_journal
127
- entity.safe_attributes = attributes
128
- if entity.save
129
- saved << entity
130
- else
131
- unsaved << entity
132
- end
133
- end
134
- respond_to do |format|
135
- format.html do
136
- if unsaved.blank?
137
- flash[:notice] = l(:notice_successful_update)
138
- else
139
- flash[:error] = unsaved.map{|i| i.errors.full_messages}.flatten.uniq.join(",\n")
140
- end
141
- redirect_back_or_default :index
142
- end
143
- end
144
- end
145
-
146
- def context_menu
147
- if @<%= model_name_pluralize_underscored %>.size == 1
148
- @<%= model_name_underscored %> = @<%= model_name_pluralize_underscored %>.first
149
- end
150
-
151
- can_edit = @<%= model_name_pluralize_underscored %>.detect{|c| !c.editable?}.nil?
152
- can_delete = @<%= model_name_pluralize_underscored %>.detect{|c| !c.deletable?}.nil?
153
- @can = {edit: can_edit, delete: can_delete}
154
- @back = back_url
155
-
156
- @<%= model_name_underscored %>_ids, @safe_attributes, @selected = [], [], {}
157
- @<%= model_name_pluralize_underscored %>.each do |e|
158
- @<%= model_name_underscored %>_ids << e.id
159
- @safe_attributes.concat e.safe_attribute_names
160
- attributes = e.safe_attribute_names - (%w(custom_field_values custom_fields))
161
- attributes.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!
172
-
173
- render layout: false
174
- end
175
-
176
- def autocomplete
177
- end
178
-
179
- private
180
-
181
- def find_<%= model_name_underscored %>
182
- @<%= model_name_underscored %> = <%= model_name %>.find(params[:id])
183
- rescue ActiveRecord::RecordNotFound
184
- render_404
185
- end
186
-
187
- def find_<%= model_name_pluralize_underscored %>
188
- @<%= model_name_pluralize_underscored %> = <%= model_name %>.visible.where(id: (params[:id] || params[:ids])).to_a
189
- @<%= model_name_underscored %> = @<%= model_name_pluralize_underscored %>.first if @<%= model_name_pluralize_underscored %>.count == 1
190
- raise ActiveRecord::RecordNotFound if @<%= model_name_pluralize_underscored %>.empty?
191
- raise Unauthorized unless @<%= model_name_pluralize_underscored %>.all?(&:visible?)
192
-
193
- @projects = @<%= model_name_pluralize_underscored %>.collect(&:project).compact.uniq
194
- @project = @projects.first if @projects.size == 1
195
- rescue ActiveRecord::RecordNotFound
196
- render_404
197
- end
198
-
199
- <%- if project? -%>
200
- def find_project
201
- @project ||= @<%= model_name_underscored %>.project if @<%= model_name_underscored %>
202
- @project ||= Project.find(params[:project_id]) if params[:project_id].present?
203
- rescue ActiveRecord::RecordNotFound
204
- render_404
205
- end
206
- <%- end -%>
207
-
208
- end
@@ -1,11 +0,0 @@
1
- class <%= model_name %>CustomField < CustomField
2
-
3
- def type_name
4
- :label_<%= @model_name_pluralize_underscored %>
5
- end
6
-
7
- def form_fields
8
- [:is_filter, :searchable, :is_required]
9
- end
10
-
11
- end
@@ -1,37 +0,0 @@
1
- class <%= model_name %>Query < EasyQuery
2
-
3
- self.queried_class = <%= model_name %>
4
-
5
- def initialize_available_filters
6
- on_filter_group(default_group_label) do
7
- <%- db_columns.each do |column_name, column_options| -%>
8
- <%- if project? && column_name == 'project_id' -%>
9
- if project.nil?
10
- add_available_filter '<%= column_name %>', name: <%= model_name %>.human_attribute_name(:<%= column_name %>), type: :<%= column_options[:query_type] %>, values: all_projects_values
11
- end
12
- <%- else -%>
13
- add_available_filter '<%= column_name %>', name: <%= model_name %>.human_attribute_name(:<%= column_name %>), type: :<%= column_options[:query_type] %>
14
- <%- end -%>
15
- <%- end -%>
16
- <%- if acts_as_customizable? -%>
17
- add_custom_fields_filters(<%= model_name %>CustomField)
18
- <%- end -%>
19
- end
20
- end
21
-
22
- def initialize_available_columns
23
- on_filter_group(default_group_label) do
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 %>), title: <%= model_name %>.human_attribute_name(:<%= column_name %>)
26
- <%- end -%>
27
- <%- if acts_as_customizable? -%>
28
- add_available_columns <%= model_name %>CustomField.sorted.visible.collect { |cf| EasyQueryCustomFieldColumn.new(cf, group: l(:label_filter_group_custom_fields)) }
29
- <%- end -%>
30
- end
31
- end
32
-
33
- def default_list_columns
34
- 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] }
35
- end
36
-
37
- end
@@ -1,19 +0,0 @@
1
- <%%= title l(:heading_<%= model_name_underscored %>_edit) %>
2
-
3
- <%%= form_for([@project, @<%= model_name_underscored %>], html: { multipart: <%= acts_as_attachable? %>, id: '<%= model_name_underscored %>_form', class: 'tabular', remote: request.xhr? }) do |f| %>
4
- <%%= error_messages_for @<%= model_name_underscored %> %>
5
-
6
- <div class="box">
7
- <%%= render partial: 'form', locals: {<%= model_name_underscored %>: @<%= model_name_underscored %>} %>
8
- </div>
9
-
10
- <%% if !request.xhr? %>
11
- <p>
12
- <%%= submit_tag l(:button_update), title: l(:button_update) %>
13
- </p>
14
- <%% end %>
15
- <%% end %>
16
- <%% ### PAGE CUSTOMS ########################################################## %>
17
- <%% content_for :sidebar do %>
18
- <%%= render partial: '<%= model_name_pluralize_underscored %>/sidebar' %>
19
- <%% end %>
@@ -1,18 +0,0 @@
1
- var modal = $("#ajax-modal");
2
- modal.html("<%%= j render(template: '<%= model_name_pluralize_underscored %>/edit', formats: [:html]) %>");
3
- showModal(modal.attr("id"));
4
- var submitButton = {
5
- text:"<%%=j l(:button_update) %>",
6
- title:"<%%=j l(:button_update) %>",
7
- click: function() {$(this).find('form').submit()},
8
- 'class': 'button-positive'
9
- };
10
- var closeButton = {
11
- text: "<%%=j l(:button_close) %>",
12
- title: "<%%=j l(:button_close) %>",
13
- click: function() {$(this).dialog('close');},
14
- 'class': 'button'
15
- };
16
- modal.dialog('option', {
17
- buttons: [closeButton, submitButton]
18
- });
@@ -1,16 +0,0 @@
1
- en:
2
- activerecord:
3
- attributes:
4
- <%= model_name_underscored %>: <%= db_columns.collect{|column_name, column_options| "\n #{column_options[:lang_key]}: #{column_name.humanize}" }.join %>
5
- easy_query:
6
- name:
7
- <%= model_name_underscored %>_query: <%= model_name_pluralize_underscored.titleize %>
8
- heading_<%= model_name_underscored %>_new: New <%= model_name_underscored.titleize %>
9
- heading_<%= model_name_underscored %>_edit: Edit <%= model_name_underscored.titleize %>
10
- button_<%= model_name_underscored %>_new: New <%= model_name_underscored.titleize %>
11
- label_<%= model_name_pluralize_underscored %>: <%= model_name_pluralize_underscored.titleize %>
12
- label_<%= model_name_underscored %>: <%= model_name_underscored.titleize %>
13
- permission_view_<%= model_name_pluralize_underscored %>: View <%= model_name_pluralize_underscored.titleize %>
14
- permission_manage_<%= model_name_pluralize_underscored %>: Manage <%= model_name_pluralize_underscored.titleize %>
15
- title_<%= model_name_underscored %>_new: Click to create new <%= model_name_underscored.titleize %>
16
- label_filter_group_<%= model_name_underscored %>_query: <%= model_name %>
@@ -1,10 +0,0 @@
1
- module <%= plugin_name.camelcase %>Patch
2
- module EntityAttributeHelperPatch
3
- def self.included(base)
4
- base.class_eval do
5
-
6
- end
7
- end
8
- end
9
- end
10
- EasyExtensions::PatchManager.register_helper_patch 'EntityAttributeHelper', '<%= plugin_name.camelcase %>Patch::EntityAttributeHelperPatch'
@@ -1,3 +0,0 @@
1
- module <%= controller_class %>Helper
2
-
3
- end
@@ -1,5 +0,0 @@
1
- module <%= plugin_title %>
2
- class <%= model_name %>Hooks < Redmine::Hook::ViewListener
3
-
4
- end
5
- end
@@ -1,3 +0,0 @@
1
- api.array :<%= model_name_pluralize_underscored %>, api_meta(total_count: @entity_count, offset: @offset, limit: @limit) do
2
- render(@entities, { api: api })
3
- end
@@ -1,30 +0,0 @@
1
- <% if Redmine::Plugin.installed?(:easy_extensions) %>
2
- <%%= render @query %>
3
- <%% ### PAGE CUSTOMS ########################################################## %>
4
- <%%= context_menu context_menu_<%= model_name_pluralize_underscored %>_path(project_id: @project) %>
5
- <%% content_for :sidebar do %>
6
- <%%= render partial: '<%= model_name_pluralize_underscored %>/sidebar' %>
7
- <%%= render partial: 'sidebar/saved_easyqueries_by_type', locals: { query_class: @query.class, project: @project } %>
8
- <%% end %>
9
- <% else %>
10
- <div class="contextual">
11
- <%% if User.current.allowed_to?(:add_<%= model_name_pluralize_underscored %>, @project, global: true) %>
12
- <%%= link_to l(:button_<%= model_name_underscored %>_new), new_<%= model_name_underscored %>_path, class: 'icon icon-add' %>
13
- <%% end %>
14
- </div>
15
- <h2><%%= @query.queried_class.to_s %></h2>
16
-
17
- <%%= form_tag(<%= model_name_pluralize_underscored %>_path, method: :get, id: 'query_form') do %>
18
- <%%= render partial: 'queries/query_form' %>
19
- <%% end %>
20
-
21
- <%% if @query.valid? %>
22
- <%% if @entities.empty? %>
23
- <p class="nodata"><%%= l(:label_no_data) %></p>
24
- <%% else %>
25
- <%%= render_query_totals(@query) %>
26
- <%%= render partial: 'list', locals: { entities: @entities }%>
27
- <span class="pagination"><%%= pagination_links_full @entity_pages, @entity_count %></span>
28
- <%% end %>
29
- <%% end %>
30
- <% end %>
@@ -1,12 +0,0 @@
1
- var modal = $("#ajax-modal");
2
- modal.html("<%%= j render(template: '<%= model_name_pluralize_underscored %>/index', formats: [:html]) %>");
3
- showModal(modal.attr("id"));
4
- var closeButton = {
5
- text: "<%%=j l(:button_close) %>",
6
- title: "<%%=j l(:button_close) %>",
7
- click: function() {$(this).dialog('close');},
8
- 'class': 'button'
9
- };
10
- modal.dialog('option', {
11
- buttons: [closeButton, submitButton]
12
- });
@@ -1 +0,0 @@
1
- <h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
@@ -1,2 +0,0 @@
1
- <%%= @<%= model_name_underscored %>.to_s %>
2
- <%%= @<%= model_name_underscored %>_url %>
@@ -1 +0,0 @@
1
- <h1><%%= link_to(@<%= model_name_underscored %>.to_s, @<%= model_name_underscored %>_url) %></h1>
@@ -1,2 +0,0 @@
1
- <%%= @<%= model_name_underscored %>.to_s %>
2
- <%%= @<%= model_name_underscored %>_url %>
@@ -1,41 +0,0 @@
1
- class <%= model_name %>Mailer < Mailer
2
-
3
- helper :<%= model_name_pluralize_underscored %>
4
-
5
- def <%= model_name_underscored %>_added(recipient, <%= model_name_underscored %>)
6
- <%- if project? -%>
7
- redmine_headers 'Project' => <%= model_name_underscored %>.project.identifier
8
-
9
- <%- end -%>
10
- <%- if author? -%>
11
- @author = <%= model_name_underscored %>.author
12
- <%- end -%>
13
- @<%= model_name_underscored %> = <%= model_name_underscored %>
14
- @<%= model_name_underscored %>_url = url_for(controller: '<%= model_name_pluralize_underscored %>', action: 'show', id: <%= model_name_underscored %>)
15
-
16
- message_id <%= model_name_underscored %>
17
- references <%= model_name_underscored %>
18
-
19
- mail to: recipient,
20
- subject: "#{l(:label_<%= model_name_underscored %>)}: #{<%= model_name_underscored %>.to_s}"
21
- end
22
-
23
- def <%= model_name_underscored %>_updated(recipient, <%= model_name_underscored %>)
24
- <%- if project? -%>
25
- redmine_headers 'Project' => <%= model_name_underscored %>.project.identifier
26
-
27
- <%- end -%>
28
- <%- if author? -%>
29
- @author = <%= model_name_underscored %>.author
30
- <%- end -%>
31
- @<%= model_name_underscored %> = <%= model_name_underscored %>
32
- @<%= model_name_underscored %>_url = url_for(controller: '<%= model_name_pluralize_underscored %>', action: 'show', id: <%= model_name_underscored %>)
33
-
34
- message_id <%= model_name_underscored %>
35
- references <%= model_name_underscored %>
36
-
37
- mail to: recipient,
38
- subject: "#{l(:label_<%= model_name_underscored %>)}: #{<%= model_name_underscored %>.to_s}"
39
- end
40
-
41
- end
@@ -1,16 +0,0 @@
1
- class Create<%= model_name_pluralize_underscored.camelize %> < ActiveRecord::Migration[<%= ActiveRecord::Migration::Current.current_version %>]
2
- def change
3
- create_table :<%= model_name_pluralize_underscored %> do |t|
4
- <%- columns = db_columns.reject{|k| k.in?(["created_at", "updated_at"])} -%>
5
- <%- author_col = db_columns.delete "author_id" %>
6
- <%- project_col = db_columns.delete "project_id" %>
7
- <%- columns.each do |column_name, column_attrs| -%>
8
- t.<%= column_attrs[:type] %> :<%= column_name %>, null: <%= column_attrs[:null] %>
9
- <%- end -%>
10
- <%= "t.belongs_to :author" if author_col %>
11
- <%= "t.belongs_to :project" if project_col %>
12
-
13
- t.timestamps
14
- end
15
- end
16
- end