forked from railsadminteam/rails_admin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ekoshairy/master
Data I/O Admin
- Loading branch information
Showing
9 changed files
with
171 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,5 +72,4 @@ group :development, :test do | |
gem 'devise' | ||
gem 'paperclip', '~> 2.7' | ||
end | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,12 @@ | ||
- params = request.params.except(:action, :controller, :utf8, :page, :per_page, :format, :authenticity_token) | ||
- visible_fields = @model_config.export.with(:view => self, :object => @abstract_model.model.new).visible_fields | ||
|
||
|
||
- specs = @model_config.export.with(:view => self, :object => @abstract_model.model.new).extract_specs | ||
|
||
- specs_fields = @model_config.export.with(:view => self, :object => @abstract_model.model.new).spec_fields specs[0] | ||
|
||
|
||
|
||
|
||
= form_tag export_path(params.merge(:all => true)), :method => 'post', :class => 'form-horizontal denser' do | ||
|
||
%input{:name => "send_data", :type => "hidden", :value => "true"}/ | ||
%fieldset | ||
%legend | ||
%i.icon-chevron-down | ||
= t('admin.export.select') | ||
|
||
.control-group | ||
%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) | ||
.controls | ||
- visible_fields.select{ |f| !f.spec? }.each do |field| | ||
- list = field.virtual? ? 'methods' : 'only' | ||
- if field.association? && field.association[:polymorphic] | ||
%label.checkbox{:for => "schema_#{list}_#{field.method_name}"} | ||
= check_box_tag "schema[#{list}][]", field.method_name, true, { :id => "schema_#{list}_#{field.method_name}" } | ||
= field.label + " [id]" | ||
- polymorphic_type_column_name = @abstract_model.properties.find {|p| field.association[:foreign_type] == p[:name] }[:name] | ||
%label.checkbox{:for => "schema_#{list}_#{polymorphic_type_column_name}"} | ||
= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { :id => "schema_#{list}_#{polymorphic_type_column_name}" } | ||
= field.label + " [type]" | ||
- else | ||
%label.checkbox{:for => "schema_#{list}_#{field.name}"} | ||
= check_box_tag "schema[#{list}][]", field.name, true, { :id => "schema_#{list}_#{field.name}" } | ||
= field.label | ||
|
||
|
||
|
||
- specs.each do |spec| | ||
- spec_fields = @model_config.export.with(:view => self, :object => @abstract_model.model.new).spec_fields spec | ||
.control-group | ||
%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 => spec) | ||
</br> | ||
</br> | ||
</br> | ||
.controls | ||
- spec_fields.select{ |f| !f.association? || f.association[:polymorphic] }.each do |field| | ||
- list = field.virtual? ? 'methods' : 'only' | ||
- if field.association? && field.association[:polymorphic] | ||
%label.checkbox{:for => "schema_#{list}_#{field.method_name}"} | ||
= check_box_tag "schema[#{list}][]", field.method_name, true, { :id => "schema_#{list} _#{field.method_name}" } | ||
= field.label + " [id]" | ||
- polymorphic_type_column_name = @abstract_model.properties.find {|p| field.association[:foreign_type] == p[:name] }[:name] | ||
%label.checkbox{:for => "schema_#{list}_#{polymorphic_type_column_name}"} | ||
= check_box_tag "schema[#{list}][]", polymorphic_type_column_name, true, { :id => "schema_#{list}_#{polymorphic_type_column_name}" } | ||
= field.label + " [type]" | ||
- else | ||
%label.checkbox{:for => "schema_#{list}_#{field.name}"} | ||
= check_box_tag "schema[#{list}][]", field.name, true, { :id => "schema_#{list}_#{field.name}" } | ||
= field.label | ||
|
||
|
||
|
||
|
||
- visible_fields.select{ |f| f.association? && !f.association[:polymorphic] }.each do |field| | ||
- fields = field.associated_model_config.export.with(:view => self, :object => (associated_model = field.associated_model_config.abstract_model.model).new).new_fields.select{ |f| !f.association? } | ||
.control-group | ||
%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) | ||
.controls | ||
- fields.each do |associated_model_field| | ||
- list = associated_model_field.virtual? ? 'methods' : 'only' | ||
%label.checkbox{:for => "schema_include_#{field.name}_#{list}_#{associated_model_field.name}"} | ||
= check_box_tag "schema[include][#{field.name}][#{list}][]", associated_model_field.name, true, { :id => "schema_include_#{field.name}_#{list}_#{associated_model_field.name}" } | ||
= associated_model_field.label | ||
|
||
%fieldset | ||
%legend | ||
%i.icon-chevron-down | ||
= t('admin.export.options_for', :name => 'csv') | ||
.control-group | ||
- guessed_encoding = (Rails.configuration.database_configuration[Rails.env]['encoding'].presence rescue 'UTF-8') || 'UTF-8' | ||
%label.control-label{:for => "csv_options_encoding_to"}= t('admin.export.csv.encoding_to') | ||
.controls | ||
-# from http://books.google.com/support/partner/bin/answer.py?answer=30990 : | ||
= 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"]) | ||
%p.help-block= t('admin.export.csv.encoding_to_help', :name => guessed_encoding) | ||
|
||
.control-group | ||
%label.control-label{:for => "csv_options_skip_header"}= t('admin.export.csv.skip_header') | ||
.controls | ||
= check_box_tag 'csv_options[skip_header]', 'true' | ||
%p.help-block= t('admin.export.csv.skip_header_help') | ||
|
||
.control-group | ||
%label.control-label{:for => "csv_options_generator_col_sep"}= t('admin.export.csv.col_sep') | ||
.controls | ||
= select_tag 'csv_options[generator][col_sep]', options_for_select({ '' => t('admin.export.csv.default_col_sep'), "<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'" }) | ||
%p.help-block= t('admin.export.csv.col_sep_help', :value => t('admin.export.csv.default_col_sep')) | ||
|
||
.form-actions | ||
%input{:type => :hidden, :name => 'return_to', :value => (params[:return_to].presence || request.referer)} | ||
Confirm Exporting of Selected Items: | ||
%button.btn.btn-primary{:type => "submit", :name => 'csv'} | ||
%i.icon-white.icon-ok | ||
= t("admin.export.confirmation", :name => 'csv') | ||
%button.btn.btn-info{:type => "submit", :name => 'json'} | ||
= t("admin.export.confirmation", :name => 'json') | ||
%button.btn.btn-info{:type => "submit", :name => 'xml'} | ||
= t("admin.export.confirmation", :name => 'xml') | ||
%button.btn{:type => "submit", :name => "_continue"} | ||
%i.icon-remove | ||
= t("admin.form.cancel") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<h1>File Upload</h1> | ||
<%= form_for :upload_file, :url=>{ :action=>"import"}, :html => { :multipart => true } do |f| %> | ||
<table> | ||
<tr> | ||
<td> | ||
<label for="import_file"> | ||
Select a CSV File : | ||
</label> | ||
</td> | ||
<td > | ||
<%= f.file_field :file%> | ||
</td> | ||
|
||
</tr> | ||
<tr> | ||
<td> | ||
<label for="category"> | ||
Select Imported Items Category : | ||
</label> | ||
</td> | ||
<td> | ||
<%= f.select :category, options_for_select(["Category"]+Tag.first_level_categorization_nodes.map(&:tagname).sort) %> | ||
|
||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan='2'> | ||
<button class="btn btn-primary" type="submit"> | ||
|
||
Upload File</button> | ||
</td> | ||
</tr> | ||
</table> | ||
<% end %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.