redmine_extensions 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e5bdd71d9b581303878b289c07e4fa88fec0f319ee9c94b310db8ffe9bcf71a
4
- data.tar.gz: 5c8d77bc0b82467bbb10a2429a984efdeece83f62372ce83f39c51f5977a7f89
3
+ metadata.gz: e01494fb8634b6116c7ee6df38c54a79845aed25438558c1bd068a24bc551d60
4
+ data.tar.gz: 3018303ecf9d11f4b9ed3720729cb7bcf0eef94adbdfebbc83fba0959a648698
5
5
  SHA512:
6
- metadata.gz: 4a46dc0c10ebbd8e95257516d22e49d4bef13c02fbc2564ad000dfc48f67e960c66ac9a5e4bc2e141bf4697ee3d33eae8a6abf127cd3fa56c1e99ce64a5354f2
7
- data.tar.gz: 20a9d5f7e2bc0dabf8465297965b5497bbd5f06b6c3991405ee5d5d66eaab09cb1d110f60ae37a7346bcbe5b6afd1aca70595aeb177d998c342afe40c60a8851
6
+ metadata.gz: 10c0ece096eeeaa651feeae6aafa0004270bd7a87ff15f4e4f8118e596f0dae6c17c0cbd0841a132c079cdc8e49bbcd5f509a0d0adf6bb528692806354c3a7c0
7
+ data.tar.gz: 0c77dcfcafb5d125ab9cdb22fc7b134665cf4afa45373bcfc39ea1e6c42c3050dda90061be766f8d45a15a1cabd9d196ef85a1ce3089da9e74299342120151ee
@@ -80,6 +80,7 @@ module RedmineExtensions
80
80
  template 'index.api.rsb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/index.api.rsb"
81
81
  template 'index.html.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/index.html.erb"
82
82
  template 'index.js.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/index.js.erb"
83
+ template '_list.html.erb.erb', "#{plugin_path}/app/views/#{model_name_pluralize_underscored}/_list.html.erb"
83
84
 
84
85
  if mail?
85
86
  template 'mailer.rb.erb', "#{plugin_path}/app/models/#{model_name_underscored}_mailer.rb"
@@ -0,0 +1,69 @@
1
+ <%%= form_tag({}, :data => {:cm_url => context_menu_<%= model_name_pluralize_underscored %>_path}) do -%>
2
+ <%%= hidden_field_tag 'back_url', url_for(:params => request.query_parameters), :id => nil %>
3
+ <div class="autoscroll">
4
+ <table class="list odd-even entities">
5
+ <thead>
6
+ <tr>
7
+ <th class="checkbox hide-when-print">
8
+ <%%= check_box_tag 'check_all', '', false, class: 'toggle-selection',
9
+ title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
10
+ </th>
11
+ <%% @query.inline_columns.each do |column| %>
12
+ <%%= column_header(@query, column) %>
13
+ <%% end %>
14
+ <th></th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <%% grouped_query_results(entities, @query) do |entity, group_name, group_count, group_totals| -%>
19
+ <%% if group_name %>
20
+ <%% reset_cycle %>
21
+ <tr class="group open">
22
+ <td colspan="<%%= @query.inline_columns.size + 2 %>">
23
+ <span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
24
+ <span class="name"><%%= group_name %></span>
25
+ <%% if group_count %>
26
+ <span class="count"><%%= group_count %></span>
27
+ <%% end %>
28
+ <span class="totals"><%%= group_totals %></span>
29
+ <%%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
30
+ "toggleAllRowGroups(this)", class: 'toggle-all') %>
31
+ </td>
32
+ </tr>
33
+ <%% end %>
34
+ <tr id="entity_id_<%%= entity.id %>" class="entity <%%= cycle('odd', 'even') %> hascontextmenu">
35
+ <td class="checkbox hide-when-print"><%%= check_box_tag("ids[]", entity.id, false, id: nil) %></td>
36
+ <%% @query.inline_columns.each do |column| %>
37
+ <%%= content_tag('td', column_content(column, entity), class: column.css_classes) %>
38
+ <%% end %>
39
+ <td class="buttons">
40
+ <%% if entity.editable_by?(User.current) -%>
41
+ <%%= link_to l(:button_edit), edit_<%= model_name_underscored %>_path(entity),
42
+ title: l(:button_edit),
43
+ class: 'icon-only icon-edit' %>
44
+ <%%= link_to l(:button_delete), <%= model_name_underscored %>_path(entity),
45
+ data: {confirm: l(:text_are_you_sure)},
46
+ method: :delete,
47
+ title: l(:button_delete),
48
+ class: 'icon-only icon-del' %>
49
+ <%% end -%>
50
+ </td>
51
+ </tr>
52
+ <%% @query.block_columns.each do |column|
53
+ if (text = column_content(column, entity)) && text.present? -%>
54
+ <tr class="<%%= current_cycle %>">
55
+ <td colspan="<%%= @query.inline_columns.size + 1 %>" class="<%%= column.css_classes %>">
56
+ <%% if query.block_columns.count > 1 %>
57
+ <span><%%= column.caption %></span>
58
+ <%% end %>
59
+ <%%= text %>
60
+ </td>
61
+ </tr>
62
+ <%% end -%>
63
+ <%% end -%>
64
+ <%% end -%>
65
+ </tbody>
66
+ </table>
67
+ </div>
68
+ <%% end -%>
69
+ <%%= context_menu %>
@@ -23,6 +23,9 @@ class <%= controller_class %>Controller < ApplicationController
23
23
  index_for_easy_query(<%= model_name %>Query)
24
24
  <% else %>
25
25
  retrieve_query(<%= model_name %>Query)
26
+ @entity_count = @query.<%= model_name_pluralize_underscored %>.count
27
+ @entity_pages = Paginator.new @entity_count, per_page_option, params['page']
28
+ @entities = @query.<%= model_name_pluralize_underscored %>(offset: @entity_pages.offset, limit: @entity_pages.per_page)
26
29
  <% end %>
27
30
  end
28
31
 
@@ -48,7 +51,7 @@ class <%= controller_class %>Controller < ApplicationController
48
51
  end
49
52
 
50
53
  def create
51
- @<%= model_name_underscored %> = <%= model_name %>.new<%= "author: User.current" if author? %>
54
+ @<%= model_name_underscored %> = <%= model_name %>.new <%= "author: User.current" if author? %>
52
55
  <%- if project? -%>
53
56
  @<%= model_name_underscored %>.project = @project
54
57
  <%- end -%>
@@ -13,26 +13,18 @@
13
13
  <%% end %>
14
14
  </div>
15
15
  <h2><%%= @query.queried_class.to_s %></h2>
16
- <div id="query_form_with_buttons" class="hide-when-print">
17
- <div id="query_form_content">
18
- <table class="list issues">
19
- <thead>
20
- <%% @query.available_columns.each do |column| %>
21
- <th>
22
- <%%= column.caption %>
23
- </th>
24
- <%% end %>
25
- </thead>
26
- <tbody>
27
- <%% @query.<%= model_name_pluralize_underscored %>.each do |entity| %>
28
- <tr>
29
- <%% @query.available_columns.each do |column| %>
30
- <%%= content_tag('td', column_content(column, entity)) %>
31
- <%% end %>
32
- </tr>
33
- <%% end %>
34
- </tbody>
35
- </table>
36
- </div>
37
- </div>
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 %>
38
30
  <% end %>
@@ -36,7 +36,6 @@ class <%= model_name %> < ActiveRecord::Base
36
36
  <%= 'validates :project_id, presence: true' if project? %>
37
37
  <%= 'validates :author_id, presence: true' if author? %>
38
38
 
39
- attr_protected :id
40
39
 
41
40
  <%- if associations.any? -%>
42
41
  <%- associations.each do |assoc_name, values| -%>
@@ -71,6 +70,10 @@ class <%= model_name %> < ActiveRecord::Base
71
70
  'icon icon-user'
72
71
  end
73
72
 
73
+ def editable_by?(user)
74
+ visible?(user)
75
+ end
76
+
74
77
  <%- if !project? -%>
75
78
  def project
76
79
  nil
@@ -24,7 +24,7 @@ class <%= model_name %>Query < Query
24
24
  group = l("label_filter_group_#{self.class.name.underscore}")
25
25
 
26
26
  <%- db_columns.each do |column_name, column_options| -%>
27
- @available_columns << QueryColumn.new('<%= column_options[:query_column_name] || column_name %>', caption: <%= model_name %>.human_attribute_name(:<%= column_name %>), title: <%= model_name %>.human_attribute_name(:<%= column_name %>), group: group)
27
+ @available_columns << QueryColumn.new(:<%= column_options[:query_column_name] || column_name %>, caption: <%= model_name %>.human_attribute_name(:<%= column_name %>), title: <%= model_name %>.human_attribute_name(:<%= column_name %>), group: group)
28
28
  <%- end -%>
29
29
  <%- if acts_as_customizable? -%>
30
30
  @available_columns += <%= model_name %>CustomField.visible.collect { |cf| QueryCustomFieldColumn.new(cf) }
@@ -33,6 +33,11 @@ class <%= model_name %>Query < Query
33
33
  @available_columns
34
34
  end
35
35
 
36
+ def initialize(attributes=nil, *args)
37
+ super attributes
38
+ self.filters ||= { "<%= db_columns.first[0] %>" => {:operator => "*", :values => []} }
39
+ end
40
+
36
41
  def default_columns_names
37
42
  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]}
38
43
  end
@@ -18,11 +18,14 @@ module RedmineExtensions
18
18
 
19
19
  config.autoload_paths << config.root.join('lib')
20
20
  config.eager_load_paths << config.root.join('app', 'models', 'easy_queries')
21
- config.assets.precompile << 'redmine_extensions/applications.js'
22
- config.assets.precompile << 'redmine_extensions/blocking.js'
23
- unless Rails.env.production?
24
- config.assets.precompile << 'redmine_extensions/jasmine_lib/jasmine_lib.js'
25
- config.assets.precompile << 'redmine_extensions/jasmine.css'
21
+
22
+ initializer 'redmine_extensions.assets' do
23
+ config.assets.precompile << 'redmine_extensions/applications.js'
24
+ config.assets.precompile << 'redmine_extensions/blocking.js'
25
+ unless Rails.env.production?
26
+ config.assets.precompile << 'redmine_extensions/jasmine_lib/jasmine_lib.js'
27
+ config.assets.precompile << 'redmine_extensions/jasmine.css'
28
+ end
26
29
  end
27
30
 
28
31
  #config.to_prepare goes after Reloader.to_prepare
@@ -1,3 +1,3 @@
1
1
  module RedmineExtensions
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Easy Software Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-12 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -97,6 +97,7 @@ files:
97
97
  - lib/generators/redmine_extensions/entity/entity_generator.rb
98
98
  - lib/generators/redmine_extensions/entity/templates/_%model_name_underscored%.api.rsb.tt
99
99
  - lib/generators/redmine_extensions/entity/templates/_form.html.erb.erb
100
+ - lib/generators/redmine_extensions/entity/templates/_list.html.erb.erb
100
101
  - lib/generators/redmine_extensions/entity/templates/_sidebar.html.erb.erb
101
102
  - lib/generators/redmine_extensions/entity/templates/context_menu.html.erb.erb
102
103
  - lib/generators/redmine_extensions/entity/templates/controller.rb.erb