rails_admin_export 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +27 -0
- data/app/views/rails_admin/main/export.html.haml +317 -0
- data/config/locales/export.en.yml +11 -0
- data/lib/rails_admin_export.rb +21 -0
- data/lib/rails_admin_export/engine.rb +4 -0
- data/lib/rails_admin_export/version.rb +3 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjE1NTE2YzY3N2Y1YWY0OWQ5MjJmYzBkNjg2NGFmZmEzNmNhMjJkNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDg0OGYxNjRmYzE1ODE0MmI5ZjQ1NjVjNDMyMTU1N2E4ZGRhZGY1Zg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Zjc2MjAzYWNlMGY0NDdjMTQzNzQ4MmZlOWJhNzM2ZjY4NTNhMzA2ZDliMDkw
|
10
|
+
OWM5N2YwODNjYjQ5NDZlM2Q4M2Q3OWZhNDY5NDVmMzM4NDY4YWFmOTgyZmJl
|
11
|
+
MmFlMDExMDQyNzc0NTU5Nzk2MTZiNzRkYmNiMmUzMTM3MjJkODU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTM4YmE4MmM0YjBjYWY1MGVhOWI5MDk3MWNlZWYwODJhOTg2OTI1NTA5M2U2
|
14
|
+
YjAzOGNkMDkxMmM2YjhlODhiMGU2NGE1M2U1YzNhYjU1MDc0MTIwYTllOTNh
|
15
|
+
ZWQ0MTJlYjcyODZiYzFmOWE0ZWY5ZWQxOGI3MmIzZDc1ZTUwMTA=
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'RailsAdminExport'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
@@ -0,0 +1,317 @@
|
|
1
|
+
- params = request.params.except(:action, :controller, :utf8, :page, :per_page, :format, :authenticity_token)
|
2
|
+
- visible_fields = @model_config.export.with(view: self, object: @abstract_model.model.new, controller: self.controller).visible_fields
|
3
|
+
|
4
|
+
- if @abstract_model.model==TweetMetric && params["f"].nil?
|
5
|
+
:ruby
|
6
|
+
require 'rails_admin/config/fields/types/datetime.rb'
|
7
|
+
query = params[:query]
|
8
|
+
params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export, :_pjax)
|
9
|
+
params.delete(:query) if params[:query].blank?
|
10
|
+
params.delete(:sort_reverse) unless params[:sort_reverse] == 'true'
|
11
|
+
sort_reverse = params[:sort_reverse]
|
12
|
+
sort = params[:sort]
|
13
|
+
params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
|
14
|
+
|
15
|
+
export_action = RailsAdmin::Config::Actions.find(:export, { controller: self.controller, abstract_model: @abstract_model })
|
16
|
+
export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
|
17
|
+
|
18
|
+
properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).visible_fields
|
19
|
+
# columns paginate
|
20
|
+
@filterable_fields = @model_config.list.fields.select(&:filterable?)
|
21
|
+
sets = get_column_sets(properties)
|
22
|
+
properties = sets[params[:set].to_i] || []
|
23
|
+
other_left = ((params[:set].to_i - 1) >= 0) && sets[params[:set].to_i - 1].present?
|
24
|
+
other_right = sets[params[:set].to_i + 1].present?
|
25
|
+
@index = 0
|
26
|
+
@ordered_filters = (params[:f] || @model_config.list.filters).inject({}) { |memo, filter|
|
27
|
+
field_name = filter.is_a?(Array) ? filter.first : filter
|
28
|
+
(filter.is_a?(Array) ? filter.last : { (@index += 1) => { "v" => '' } }) .each do |index, filter_hash|
|
29
|
+
unless filter_hash['disabled']
|
30
|
+
memo[index] = { field_name => filter_hash }
|
31
|
+
else
|
32
|
+
params[:f].delete(field_name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
memo
|
36
|
+
}.to_a.sort_by(&:first)
|
37
|
+
|
38
|
+
@ordered_filter_string = @ordered_filters.map do |duplet|
|
39
|
+
filter_index = duplet[0]
|
40
|
+
filter_for_field = duplet[1]
|
41
|
+
filter_name = filter_for_field.keys.first
|
42
|
+
filter_hash = filter_for_field.values.first
|
43
|
+
field = @filterable_fields.find{ |field| field.name == filter_name.to_sym }
|
44
|
+
field_options = case field.type
|
45
|
+
when :enum
|
46
|
+
options_for_select(field.with(object: @abstract_model.model.new).enum, filter_hash['v'])
|
47
|
+
else
|
48
|
+
''
|
49
|
+
end
|
50
|
+
%{
|
51
|
+
$.filters.append(#{field.label.to_json}, #{field.name.to_json}, #{field.type.to_json}, #{filter_hash['v'].to_json}, #{filter_hash['o'].to_json}, #{field_options.to_json}, #{filter_index.to_json});
|
52
|
+
}
|
53
|
+
end.join.html_safe if @ordered_filters
|
54
|
+
|
55
|
+
|
56
|
+
= content_for :contextual_tabs do
|
57
|
+
= bulk_menu
|
58
|
+
- if @filterable_fields.present?
|
59
|
+
%li.dropdown{style: 'float:right'}
|
60
|
+
%a.dropdown-toggle{href: '#', :'data-toggle' => "dropdown"}
|
61
|
+
= t('admin.misc.add_filter')
|
62
|
+
%b.caret
|
63
|
+
%ul.dropdown-menu#filters{style: 'left:auto; right:0;'}
|
64
|
+
- @filterable_fields.each do |field|
|
65
|
+
- field_options = case field.type
|
66
|
+
- when :enum
|
67
|
+
- 'options_for_select(field.with(object: @abstract_model.model.new).enum)'
|
68
|
+
- else
|
69
|
+
- ''
|
70
|
+
%li
|
71
|
+
%a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => ""}= field.label
|
72
|
+
|
73
|
+
#list
|
74
|
+
%script
|
75
|
+
jQuery(function($) {
|
76
|
+
$.filters.options.regional = {
|
77
|
+
datePicker: {
|
78
|
+
dateFormat: #{raw I18n.t("admin.misc.filter_date_format", default: I18n.t("admin.misc.filter_date_format", locale: :en)).to_json},
|
79
|
+
dayNames: #{raw RailsAdmin::Config::Fields::Types::Datetime.day_names.to_json},
|
80
|
+
dayNamesShort: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
|
81
|
+
dayNamesMin: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
|
82
|
+
firstDay: "1",
|
83
|
+
monthNames: #{raw RailsAdmin::Config::Fields::Types::Datetime.month_names.to_json},
|
84
|
+
monthNamesShort: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_month_names.to_json}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
= @ordered_filter_string
|
89
|
+
|
90
|
+
});
|
91
|
+
%style
|
92
|
+
- properties.select{ |p| p.column_width.present? }.each do |property|
|
93
|
+
= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }"
|
94
|
+
= "#list td.#{property.css_class} { max-width: #{property.column_width}px; }"
|
95
|
+
= form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
|
96
|
+
.well
|
97
|
+
%span#filters_box
|
98
|
+
%hr.filters_box{style: "display:#{@ordered_filters.empty? ? 'none' : 'block'}"}
|
99
|
+
Choose an account to export
|
100
|
+
- if export_action
|
101
|
+
%span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
|
102
|
+
|
103
|
+
= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: "form" do
|
104
|
+
= hidden_field_tag :bulk_action
|
105
|
+
%table.table.table-condensed.table-striped
|
106
|
+
%thead
|
107
|
+
%tr
|
108
|
+
%th.shrink
|
109
|
+
%input.toggle{type: "checkbox"}
|
110
|
+
- if other_left
|
111
|
+
%th.other.left.shrink= "..."
|
112
|
+
- properties.each do |property|
|
113
|
+
- selected = (sort == property.name.to_s)
|
114
|
+
- if property.sortable
|
115
|
+
- sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})
|
116
|
+
- sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected)
|
117
|
+
%th{class: "#{property.sortable && "header pjax" || nil} #{sort_direction if property.sortable && sort_direction} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location), rel: "tooltip", title: "#{property.hint}"}= property.label
|
118
|
+
- if other_right
|
119
|
+
%th.other.right.shrink= "..."
|
120
|
+
%th.last.shrink
|
121
|
+
%tbody
|
122
|
+
- elsif @abstract_model.model==TweetMetric && params["f"].present? && params["f"]["account"].nil?
|
123
|
+
:ruby
|
124
|
+
require 'rails_admin/config/fields/types/datetime.rb'
|
125
|
+
query = params[:query]
|
126
|
+
params = request.params.except(:authenticity_token, :action, :controller, :utf8, :bulk_export, :_pjax)
|
127
|
+
params.delete(:query) if params[:query].blank?
|
128
|
+
params.delete(:sort_reverse) unless params[:sort_reverse] == 'true'
|
129
|
+
sort_reverse = params[:sort_reverse]
|
130
|
+
sort = params[:sort]
|
131
|
+
params.delete(:sort) if params[:sort] == @model_config.list.sort_by.to_s
|
132
|
+
|
133
|
+
export_action = RailsAdmin::Config::Actions.find(:export, { controller: self.controller, abstract_model: @abstract_model })
|
134
|
+
export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
|
135
|
+
|
136
|
+
properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).visible_fields
|
137
|
+
# columns paginate
|
138
|
+
@filterable_fields = @model_config.list.fields.select(&:filterable?)
|
139
|
+
sets = get_column_sets(properties)
|
140
|
+
properties = sets[params[:set].to_i] || []
|
141
|
+
other_left = ((params[:set].to_i - 1) >= 0) && sets[params[:set].to_i - 1].present?
|
142
|
+
other_right = sets[params[:set].to_i + 1].present?
|
143
|
+
@index = 0
|
144
|
+
@ordered_filters = (params[:f] || @model_config.list.filters).inject({}) { |memo, filter|
|
145
|
+
field_name = filter.is_a?(Array) ? filter.first : filter
|
146
|
+
(filter.is_a?(Array) ? filter.last : { (@index += 1) => { "v" => '' } }) .each do |index, filter_hash|
|
147
|
+
unless filter_hash['disabled']
|
148
|
+
memo[index] = { field_name => filter_hash }
|
149
|
+
else
|
150
|
+
params[:f].delete(field_name)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
memo
|
154
|
+
}.to_a.sort_by(&:first)
|
155
|
+
|
156
|
+
@ordered_filter_string = @ordered_filters.map do |duplet|
|
157
|
+
filter_index = duplet[0]
|
158
|
+
filter_for_field = duplet[1]
|
159
|
+
filter_name = filter_for_field.keys.first
|
160
|
+
filter_hash = filter_for_field.values.first
|
161
|
+
field = @filterable_fields.find{ |field| field.name == filter_name.to_sym }
|
162
|
+
field_options = case field.type
|
163
|
+
when :enum
|
164
|
+
options_for_select(field.with(object: @abstract_model.model.new).enum, filter_hash['v'])
|
165
|
+
else
|
166
|
+
''
|
167
|
+
end
|
168
|
+
%{
|
169
|
+
$.filters.append(#{field.label.to_json}, #{field.name.to_json}, #{field.type.to_json}, #{filter_hash['v'].to_json}, #{filter_hash['o'].to_json}, #{field_options.to_json}, #{filter_index.to_json});
|
170
|
+
}
|
171
|
+
end.join.html_safe if @ordered_filters
|
172
|
+
|
173
|
+
|
174
|
+
= content_for :contextual_tabs do
|
175
|
+
= bulk_menu
|
176
|
+
- if @filterable_fields.present?
|
177
|
+
%li.dropdown{style: 'float:right'}
|
178
|
+
%a.dropdown-toggle{href: '#', :'data-toggle' => "dropdown"}
|
179
|
+
= t('admin.misc.add_filter')
|
180
|
+
%b.caret
|
181
|
+
%ul.dropdown-menu#filters{style: 'left:auto; right:0;'}
|
182
|
+
- @filterable_fields.each do |field|
|
183
|
+
- field_options = case field.type
|
184
|
+
- when :enum
|
185
|
+
- 'options_for_select(field.with(object: @abstract_model.model.new).enum)'
|
186
|
+
- else
|
187
|
+
- ''
|
188
|
+
%li
|
189
|
+
%a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => ""}= field.label
|
190
|
+
|
191
|
+
#list
|
192
|
+
%script
|
193
|
+
jQuery(function($) {
|
194
|
+
$.filters.options.regional = {
|
195
|
+
datePicker: {
|
196
|
+
dateFormat: #{raw I18n.t("admin.misc.filter_date_format", default: I18n.t("admin.misc.filter_date_format", locale: :en)).to_json},
|
197
|
+
dayNames: #{raw RailsAdmin::Config::Fields::Types::Datetime.day_names.to_json},
|
198
|
+
dayNamesShort: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
|
199
|
+
dayNamesMin: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_day_names.to_json},
|
200
|
+
firstDay: "1",
|
201
|
+
monthNames: #{raw RailsAdmin::Config::Fields::Types::Datetime.month_names.to_json},
|
202
|
+
monthNamesShort: #{raw RailsAdmin::Config::Fields::Types::Datetime.abbr_month_names.to_json}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
= @ordered_filter_string
|
207
|
+
|
208
|
+
});
|
209
|
+
%style
|
210
|
+
- properties.select{ |p| p.column_width.present? }.each do |property|
|
211
|
+
= "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }"
|
212
|
+
= "#list td.#{property.css_class} { max-width: #{property.column_width}px; }"
|
213
|
+
= form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
|
214
|
+
.well
|
215
|
+
%span#filters_box
|
216
|
+
%hr.filters_box{style: "display:#{@ordered_filters.empty? ? 'none' : 'block'}"}
|
217
|
+
Choose an account to export
|
218
|
+
- if export_action
|
219
|
+
%span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
|
220
|
+
|
221
|
+
= form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: "form" do
|
222
|
+
= hidden_field_tag :bulk_action
|
223
|
+
%table.table.table-condensed.table-striped
|
224
|
+
%thead
|
225
|
+
%tr
|
226
|
+
%th.shrink
|
227
|
+
%input.toggle{type: "checkbox"}
|
228
|
+
- if other_left
|
229
|
+
%th.other.left.shrink= "..."
|
230
|
+
- properties.each do |property|
|
231
|
+
- selected = (sort == property.name.to_s)
|
232
|
+
- if property.sortable
|
233
|
+
- sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})
|
234
|
+
- sort_direction = (sort_reverse == 'true' ? "headerSortUp" : "headerSortDown" if selected)
|
235
|
+
%th{class: "#{property.sortable && "header pjax" || nil} #{sort_direction if property.sortable && sort_direction} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location), rel: "tooltip", title: "#{property.hint}"}= property.label
|
236
|
+
- if other_right
|
237
|
+
%th.other.right.shrink= "..."
|
238
|
+
%th.last.shrink
|
239
|
+
%tbody
|
240
|
+
- else
|
241
|
+
= form_tag export_path(params.merge(all: true)), method: 'post', class: 'form-horizontal denser' do
|
242
|
+
|
243
|
+
%input{name: "send_data", type: "hidden", value: "true"}/
|
244
|
+
%fieldset{id: 'fields_to_export'}
|
245
|
+
%div.control-group
|
246
|
+
%div.controls
|
247
|
+
%label.checkbox{for: 'check_all'}
|
248
|
+
= t('admin.export.select_all_fields')
|
249
|
+
= check_box_tag 'all', 'all', true, { id: 'check_all' }
|
250
|
+
%legend
|
251
|
+
%i.icon-chevron-down
|
252
|
+
= t('admin.export.select')
|
253
|
+
.control-group
|
254
|
+
%label.control-label{rel: 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), onclick: 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from', name: @model_config.label_plural.downcase)
|
255
|
+
.controls
|
256
|
+
- visible_fields.select{ |f| !f.association? }.each do |field|
|
257
|
+
- list = field.virtual? ? 'methods' : 'only'
|
258
|
+
- if field.association? && field.association.polymorphic?
|
259
|
+
%label.checkbox{for: "schema_#{list}_#{field.method_name}"}
|
260
|
+
= check_box_tag "schema[#{list}][]", field.method_name, true, { id: "schema_#{list}_#{field.method_name}" }
|
261
|
+
= field.label + " [id]"
|
262
|
+
- polymorphic_type_column_name = @abstract_model.properties.find {|p| field.association.foreign_type == p.name }.name
|
263
|
+
%label.checkbox{for: "schema_#{list}_#{polymorphic_type_column_name}"}
|
264
|
+
= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { id: "schema_#{list}_#{polymorphic_type_column_name}" }
|
265
|
+
= field.label + " [type]"
|
266
|
+
- else
|
267
|
+
%label.checkbox{for: "schema_#{list}_#{field.name}"}
|
268
|
+
= check_box_tag "schema[#{list}][]", field.name, true, { id: "schema_#{list}_#{field.name}" }
|
269
|
+
= field.label
|
270
|
+
|
271
|
+
- visible_fields.select{ |f| f.association? }.each do |field|
|
272
|
+
- fields = field.associated_model_config.export.with(controller: self.controller, view: self, object: (associated_model = field.associated_model_config.abstract_model.model).new).visible_fields.select{ |f| !f.association? }
|
273
|
+
.control-group
|
274
|
+
%label.control-label{rel: 'tooltip', :'data-original-title' => t('admin.export.click_to_reverse_selection'), onclick: 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from_associated', name: field.label.downcase)
|
275
|
+
.controls
|
276
|
+
- fields.each do |associated_model_field|
|
277
|
+
- list = associated_model_field.virtual? ? 'methods' : 'only'
|
278
|
+
%label.checkbox{for: "schema_include_#{field.name}_#{list}_#{associated_model_field.name}"}
|
279
|
+
= check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { id: "schema_include_#{field.name}_#{list}_#{associated_model_field.name}" }
|
280
|
+
= associated_model_field.label
|
281
|
+
|
282
|
+
%fieldset
|
283
|
+
%legend
|
284
|
+
%i.icon-chevron-down
|
285
|
+
= t('admin.export.options_for', name: 'csv')
|
286
|
+
.control-group
|
287
|
+
- guessed_encoding = @abstract_model.encoding
|
288
|
+
%label.control-label{for: "csv_options_encoding_to"}= t('admin.export.csv.encoding_to')
|
289
|
+
.controls
|
290
|
+
-# from http://books.google.com/support/partner/bin/answer.py?answer=30990 :
|
291
|
+
= select_tag 'csv_options[encoding_to]', options_for_select(["", "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE", "UTF-7", "ISO-8859-1", "ISO-8859-15", "IBM-850", "MacRoman", "Windows-1252", "ISO-8859-3", "IBM-852", "ISO-8859-2", "MacCE", "Windows-1250", "IBM-855", "ISO-8859-5", "ISO-IR-111", "KOI8-R", "MacCyrillic", "Windows-1251", "CP-866", "KOI-U", "MacUkranian", "GB2312", "GBK", "GB18030", "HZ", "ISO-2022-CN", "Big5", "Big5-HKSCS", "EUC-TW", "EUC-JP", "ISO-2022-JP", "Shift_JIS", "EUC-KR", "UHC", "JOHAB", "ISO-2022-KR"])
|
292
|
+
%p.help-block= t('admin.export.csv.encoding_to_help', name: guessed_encoding)
|
293
|
+
|
294
|
+
.control-group
|
295
|
+
%label.control-label{for: "csv_options_skip_header"}= t('admin.export.csv.skip_header')
|
296
|
+
.controls
|
297
|
+
= check_box_tag 'csv_options[skip_header]', 'true'
|
298
|
+
%p.help-block= t('admin.export.csv.skip_header_help')
|
299
|
+
|
300
|
+
.control-group
|
301
|
+
%label.control-label{for: "csv_options_generator_col_sep"}= t('admin.export.csv.col_sep')
|
302
|
+
.controls
|
303
|
+
= select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), "<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'" })
|
304
|
+
%p.help-block= t('admin.export.csv.col_sep_help', value: t('admin.export.csv.default_col_sep'))
|
305
|
+
|
306
|
+
.form-actions
|
307
|
+
%input{type: :hidden, name: 'return_to', value: (params[:return_to].presence || request.referer)}
|
308
|
+
%button.btn.btn-primary{type: "submit", name: 'csv'}
|
309
|
+
%i.icon-white.icon-ok
|
310
|
+
= t("admin.export.confirmation", name: 'csv')
|
311
|
+
%button.btn.btn-info{type: "submit", name: 'json'}
|
312
|
+
= t("admin.export.confirmation", name: 'json')
|
313
|
+
%button.btn.btn-info{type: "submit", name: 'xml'}
|
314
|
+
= t("admin.export.confirmation", name: 'xml')
|
315
|
+
%button.btn{type: "submit", name: "_continue"}
|
316
|
+
%i.icon-remove
|
317
|
+
= t("admin.form.cancel")
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "rails_admin_export/engine"
|
2
|
+
|
3
|
+
module RailsAdminExport
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'rails_admin/config/actions'
|
7
|
+
|
8
|
+
module RailsAdmin
|
9
|
+
module Config
|
10
|
+
module Actions
|
11
|
+
class Export < Base
|
12
|
+
RailsAdmin::Config::Actions.register(self)
|
13
|
+
|
14
|
+
register_instance_option :object_level do
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_admin_export
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kuber Aaganja
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.14
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.14
|
27
|
+
description: Description of RailsAdminExport.
|
28
|
+
email:
|
29
|
+
- kuberaaganja@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.rdoc
|
36
|
+
- Rakefile
|
37
|
+
- app/views/rails_admin/main/export.html.haml
|
38
|
+
- config/locales/export.en.yml
|
39
|
+
- lib/rails_admin_export.rb
|
40
|
+
- lib/rails_admin_export/engine.rb
|
41
|
+
- lib/rails_admin_export/version.rb
|
42
|
+
homepage: http://rubygems.org/gems/rails_admin_export
|
43
|
+
licenses: []
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.2.2
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: Summary of RailsAdminExport.
|
65
|
+
test_files: []
|