basepack 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/README.md +64 -44
  4. data/app/assets/javascripts/basepack/loading_spinner.coffee.erb +2 -2
  5. data/app/controllers/basepack/base_controller.rb +22 -1
  6. data/app/views/forms/_bulk_edit.html.haml +1 -1
  7. data/app/views/forms/_export.html.haml +18 -17
  8. data/app/views/forms/_import.html.haml +2 -2
  9. data/app/views/forms/_import_configuration_csv.html.haml +10 -7
  10. data/app/views/forms/_query.html.haml +8 -8
  11. data/app/views/forms/_show.html.haml +1 -1
  12. data/app/views/forms/_show_without_blanks.html.haml +1 -1
  13. data/app/views/forms/buttons/_apply.html.haml +1 -1
  14. data/app/views/forms/buttons/_bulk_delete.html.haml +3 -3
  15. data/app/views/forms/buttons/_create.html.haml +1 -2
  16. data/app/views/forms/buttons/_delete.html.haml +1 -1
  17. data/app/views/forms/buttons/_edit.html.haml +1 -1
  18. data/app/views/forms/buttons/_export.html.haml +1 -2
  19. data/app/views/forms/buttons/_import.html.haml +1 -1
  20. data/app/views/forms/buttons/_print.html.haml +1 -1
  21. data/app/views/forms/buttons/_query.html.haml +3 -3
  22. data/app/views/forms/buttons/_submit_create.html.haml +1 -1
  23. data/app/views/forms/edit/_form_colorpicker.html.haml +4 -4
  24. data/app/views/forms/edit/_form_datetime.html.haml +4 -4
  25. data/app/views/forms/edit/_form_enumeration.html.haml +19 -20
  26. data/app/views/forms/edit/_tag_list_with_suggestions.html.haml +1 -1
  27. data/config/basepack-settings.yml +2 -1
  28. data/config/locales/cs.yml +60 -5
  29. data/config/locales/en.yml +53 -9
  30. data/config/locales/kaminari.en.yml +1 -1
  31. data/lib/basepack.rb +1 -0
  32. data/lib/basepack/engine.rb +1 -0
  33. data/lib/basepack/forms/query.rb +1 -1
  34. data/lib/basepack/import/model_dragonfly.rb +2 -2
  35. data/lib/basepack/rails_admin/fields_types/phone.rb +61 -0
  36. data/lib/basepack/version.rb +1 -1
  37. data/lib/generators/basepack/install_generator.rb +41 -24
  38. data/lib/generators/basepack/templates/import.rb +4 -1
  39. data/lib/generators/rails/scaffold_controller_generator.rb +12 -0
  40. data/spec/dummy_app/app/controllers/employee_with_destroyable_nesteds_controller.rb +3 -0
  41. data/spec/dummy_app/app/models/employee_with_destroyable_nested.rb +6 -0
  42. data/spec/dummy_app/config/routes.rb +6 -2
  43. data/spec/dummy_app/db/development.sqlite3 +0 -0
  44. data/spec/dummy_app/db/migrate/20140117153133_add_phone_to_employee.rb +5 -0
  45. data/spec/dummy_app/db/schema.rb +2 -27
  46. data/spec/dummy_app/db/test.sqlite3 +0 -0
  47. data/spec/dummy_app/log/development.log +2907 -0
  48. data/spec/dummy_app/log/test.log +16850 -0
  49. data/spec/dummy_app/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  50. data/spec/dummy_app/tmp/cache/assets/development/sprockets/6f4d8a75f9952ad791647a0c21be66d3 +0 -0
  51. data/spec/dummy_app/tmp/cache/assets/development/sprockets/93a7167bf36c621d305a9481e3d25bce +0 -0
  52. data/spec/dummy_app/tmp/cache/assets/development/sprockets/a6fad88c8628b92fa21b43b1aa76cf7d +0 -0
  53. data/spec/dummy_app/tmp/cache/assets/development/sprockets/b8a8c2faf730407b004ec269c26473d7 +0 -0
  54. data/spec/dummy_app/tmp/cache/assets/development/sprockets/cb1f853dc4682e46b8f6922910af7491 +0 -0
  55. data/spec/dummy_app/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  56. data/spec/dummy_app/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  57. data/spec/dummy_app/tmp/cache/assets/test/sprockets/0006b869e74d698c8b4e140f70f87b90 +0 -0
  58. data/spec/dummy_app/tmp/cache/assets/test/sprockets/2d71a2a9ba73844a029c993068e478d5 +0 -0
  59. data/spec/dummy_app/tmp/cache/assets/test/sprockets/2f416db7ec3594c66c478e2c70dc5032 +0 -0
  60. data/spec/dummy_app/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  61. data/spec/dummy_app/tmp/cache/assets/test/sprockets/3202398591e97bce52539e961f5516c4 +0 -0
  62. data/spec/dummy_app/tmp/cache/assets/test/sprockets/6659113c653e0ca831f730df1b6b0558 +0 -0
  63. data/spec/dummy_app/tmp/cache/assets/test/sprockets/780412261881a814294a5333a4a042d2 +0 -0
  64. data/spec/dummy_app/tmp/cache/assets/test/sprockets/7af866e59b2c1fec401995dbceaf6e72 +0 -0
  65. data/spec/dummy_app/tmp/cache/assets/test/sprockets/8618734b87c2e32d68b15881891d9286 +0 -0
  66. data/spec/dummy_app/tmp/cache/assets/test/sprockets/93a7167bf36c621d305a9481e3d25bce +0 -0
  67. data/spec/dummy_app/tmp/cache/assets/test/sprockets/9b856b2df0d8b82ecd548aebe2c5268f +0 -0
  68. data/spec/dummy_app/tmp/cache/assets/test/sprockets/a6fad88c8628b92fa21b43b1aa76cf7d +0 -0
  69. data/spec/dummy_app/tmp/cache/assets/test/sprockets/c174814b8349dc263c8f65404949e933 +0 -0
  70. data/spec/dummy_app/tmp/cache/assets/test/sprockets/c81fa603414eab811f5a75f5be6fc7a0 +0 -0
  71. data/spec/dummy_app/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  72. data/spec/dummy_app/tmp/cache/assets/test/sprockets/dbc50e82415d51f2497fbc2dc1983bc2 +0 -0
  73. data/spec/dummy_app/tmp/cache/assets/test/sprockets/dcaf58e5c22740a96f5f349888c4cc6f +0 -0
  74. data/spec/dummy_app/tmp/cache/assets/test/sprockets/ed9f6df23839a0fd1983de2fcda43c5c +0 -0
  75. data/spec/dummy_app/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  76. data/spec/dummy_app/tmp/capybara/capybara-201312292242327883099760.html +127 -0
  77. data/spec/integration/basic/edit/basepack_basic_edit_spec.rb +58 -0
  78. data/spec/integration/basic/show/basepack_basic_show_spec.rb +49 -0
  79. metadata +58 -7
  80. data/lib/generators/basepack/templates/dragonfly.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db881493cb9c532a418fea20b75359a4ecba6520
4
- data.tar.gz: 097ce9f20af7db454b57b60074f1b1fca0f1338c
3
+ metadata.gz: 42b4c4e9de574ee382862177ef70d09534fdde0b
4
+ data.tar.gz: 62e39464fbf10f75dd1f47ed47806b430ceceaf1
5
5
  SHA512:
6
- metadata.gz: 54b88969c6d58bc1a50f3ca736cbf6d7655b1ee6d97382bdb3316716009bfaa4cc7179cd454f02e8021701c8917ef53463e87ceaf62301579196bfb9d5f39e9f
7
- data.tar.gz: 03af11a78d8072bfb87fffeae449eb8faca8b89ec3aff3cea09aca750fe7767ba84260464e6bb5bdfeae08a1a6b8ab867162bceb32f8ba97a6ee6712992181ad
6
+ metadata.gz: 6a1b4624838eee920a54a6103b470cea5bcb417b3388697b455507c1e1a893c43fbfc22a54e127dab2610bd926b5efd2ede84c6c5b25507b9610f5d8364e1880
7
+ data.tar.gz: aeef6cc1cab16311d1fb27c9e5648f30184c36eb0f7f75bf576c6a50eadb4d62493b99a11cc21b5405b1f1a1a94eacb71bae250f95909ba70e6b120de073abf5
data/Gemfile CHANGED
@@ -16,7 +16,7 @@ group :test, :development do
16
16
  gem 'capybara'
17
17
  gem 'warden'
18
18
  gem 'database_cleaner'
19
- gem 'dragonfly', '>= 0.9'
19
+ gem 'dragonfly', '~> 1.0.2'
20
20
  gem 'rack-cache', :require => 'rack/cache'
21
21
  gem 'paperclip', '>= 3.4'
22
22
  gem 'timecop'
@@ -32,7 +32,7 @@ group :test, :development do
32
32
  gem 'sass-rails', '~> 4.0.0'
33
33
  gem 'bootstrap-sass', '~> 2.2'
34
34
  gem 'launchy'
35
- gem "twitter-bootstrap-rails"
35
+ gem "twitter-bootstrap-rails", "~> 2.2.8"
36
36
  gem "selenium-webdriver"
37
37
  gem "simple_form"
38
38
  end
data/README.md CHANGED
@@ -1,10 +1,20 @@
1
1
  Basepack
2
2
  =======
3
+ [![Gem Version](https://badge.fury.io/rb/basepack.png)](http://badge.fury.io/rb/basepack)
3
4
  [![Build Status](https://api.travis-ci.org/lksv/basepack.png?branch=master)](http://travis-ci.org/lksv/base_pack)
4
5
  [![Dependency Status](https://gemnasium.com/lksv/basepack.png)](https://gemnasium.com/lksv/basepack)
5
6
 
6
7
  **Basepack** is a Ruby on Rails framework for quick creation of information
7
- systems.
8
+ systems.
9
+
10
+ **Basepack** dramatically helps you to start your new project.
11
+ There are out of the box form fields like: date (datepicker), datetime, html5
12
+ wysiwig, tags, file upload and others. Further more there is support for
13
+ dynamic field hiding depending on state of other fields as well as
14
+ options of selectbox content modifications dependant on other fields.
15
+
16
+ **Basepack** contains a lot of predefined forms, views and actions which you might need
17
+ (filter form, bulk changes, delete\_all, import, export, ...).
8
18
 
9
19
  ## Features
10
20
 
@@ -15,18 +25,24 @@ systems.
15
25
  * Automatic form validation
16
26
  * Import and Export functionality for resource
17
27
  * Easy way to create custom actions
28
+ * Security: permited parameters are automatically defined against fields in edit forms which are (read-write).
18
29
  * Authentication (via [Devise](ttps://github.com/plataformatec/devise))
19
30
  * Authorization (via [Cancan](https://github.com/ryanb/cancan.git))
20
31
 
32
+ All the field form definitions are done by [RailsAdmin](https://github.com/sferik/rails_admin) and are configured
33
+ accordingly. It simplifies configuration process and if you wish to use
34
+ RailsAdmin as an admin interface.
35
+
36
+
21
37
  ## Documentation
22
38
 
23
- [Turorial](https://github.com/lksv/basepack/wiki/Tutorial)
39
+ [Tutorial](https://github.com/lksv/basepack/wiki/Tutorial)
24
40
 
25
41
  See project [wiki](https://github.com/lksv/basepack/wiki).
26
42
 
27
43
  ## Demo
28
44
 
29
- *currently we are preparing
45
+ *Currently [zorec](https://github.com/zorec) is preparing
30
46
  [basepace_example application](https://github.com/zorec/basepack_example)*
31
47
 
32
48
  The running application will be available at [http://basepack-example.herokuapp.com/](http://basepack-example.herokuapp.com/)
@@ -35,7 +51,7 @@ The running application will be available at [http://basepack-example.herokuapp.
35
51
 
36
52
  In your `Gemfile`, add the following dependencies:
37
53
 
38
- gem "basepack", git: "https://github.com/lksv/basepack.git"
54
+ gem "basepack"
39
55
 
40
56
  Run:
41
57
 
@@ -45,23 +61,13 @@ And then run:
45
61
 
46
62
  rails g basepack:install
47
63
 
48
- This generator will install **Basepack**,
49
- [Devise](https://github.com/plataformatec/devise) and
50
- [CanCan](https://github.com/ryanb/cancan.git) and following gems
51
- * inherited\_resources
52
- * ransack
53
- * kaminari
54
- * simple\_form
55
- * settingslogic
56
- * twitter-bootstrap-rails
57
- * bootbox-rails
58
-
59
- if you don't already have them installed.
64
+ The generator will install several gems. Also, generator asks to delete
65
+ `app/views/layouts/application.html.erb` because differend .haml version will be created.
66
+ If you don't know what to answer then answer 'yes' to generator's question.
60
67
 
61
- Define inital ability in `app/models/ability.rb`. You can put ```can
62
- :manage, :all``` to enable anybody to perform any
63
- action on any object. See more on [CanCan
64
- wiki](https://github.com/ryanb/cancan/wiki/Defining-Abilities).
68
+ In a bigger project do not forget to change ability in `app/models/ability.rb`. By
69
+ default, the generator adds ```can :manage, :all``` to enable anybody to perform any action on any object.
70
+ See more on [CanCan wiki](https://github.com/ryanb/cancan/wiki/Defining-Abilities).
65
71
 
66
72
  Migrate your database and start the server:
67
73
 
@@ -82,14 +88,20 @@ Then
82
88
  ```rake db:migrate```
83
89
  ```rails s```
84
90
 
85
- Notice that files for views are not generated (directories appp/views/projects and appp/views/tasks are empty), but all RESTful actions are working correctly. It is because views iherit default structure and you can easily override these defaults by creating appropriate files.
91
+ Notice that:
92
+ 1. Generated controllers inherits form ResourcesController.
93
+ 2. Files for views are not generated (directories appp/views/projects
94
+ and appp/views/tasks are empty), but all RESTful actions are working correctly.
95
+ It is because views inherit default structure from controller inheritance)
96
+ and you can easily override these defaults by creating appropriate files.
86
97
 
87
98
  ## Basic usage
88
99
 
89
100
  After scaffolding your resources, you can customize fields used in individual actions by [Railsdmin DSL](https://github.com/sferik/rails_admin/wiki/Railsadmin-DSL)
90
101
 
91
102
  File ```app/models/project.rb```:
92
- ```
103
+
104
+ ```ruby
93
105
  class Project < ActiveRecord::Base
94
106
  has_many :tasks, inverse_of: :project
95
107
  validates :name, :short_description, presence: true
@@ -120,16 +132,27 @@ end
120
132
  ```
121
133
 
122
134
  File ```app/models/task.rb```
123
- ```
135
+ ```ruby
124
136
  class Task < ActiveRecord::Base
125
137
  belongs_to :project, inverse_of: :tasks
126
- belongs_to :user
138
+ belongs_to :user, inverse_of: :tasks
127
139
  end
128
140
  ```
129
- IMPORTANT! Make sure that you define inverse_of option on has_one, has_many and belongs_to associations. It is necessary for correct functioning of **Basepack**, see [Rails documentation](http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Bi-directional+associations) for explaination.
141
+
142
+ Add folowing line to ```app/models/user``` file:
143
+ ```ruby
144
+ has_many tasks, inverse_of: user
145
+ ```
146
+
147
+ Pleas note that ```inverse_of``` option is included on association. It is
148
+ necessary for correct functioning of **Basepack**, see
149
+ [Rails documentation](http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Bi-directional+associations)
150
+ and [RailsAdmin
151
+ wiki](https://github.com/sferik/rails_admin/wiki/Associations-basics#inverse_of-avoiding-edit-association-spaghetti-issues)
152
+ for explaination.
130
153
 
131
154
 
132
- Another difference is controllers which inherit from ResourcesController. Full inheritance hierarchy looks this way:
155
+ Almoust all the staff what Baseback do is through Basepack::BaseController which inherit from ResourcesController. Full inheritance hierarchy looks this way:
133
156
  ```
134
157
  ProjectsController < ResourcesController < Basepack::BaseController < InheritedResources::Base
135
158
  ```
@@ -137,18 +160,14 @@ ProjectsController < ResourcesController < Basepack::BaseController < InheritedR
137
160
 
138
161
  If you are not familiar with [InheritedResources](https://github.com/josevalim/inherited_resources), take a look at it.
139
162
 
140
- Basepack::BaseController adds to it:
141
- * strong parameters handling
142
- * ```options``` method
143
- * ```taggings``` method
144
- * ```build_resource``` method
145
-
146
163
  You do NOT need to define permitted parameters anymore. It is defined by RailsAdmin DSL, more precisely by what you set as visible in edit action.
147
164
  So file ```app/models/project.rb```:
148
165
 
149
- ```
166
+ ```ruby
150
167
  class Project < ActiveRecord::Base
151
- ...
168
+ #...
169
+ rails_admin do
170
+ #...
152
171
  edit do
153
172
  field :name
154
173
  field :short_description
@@ -156,7 +175,7 @@ class Project < ActiveRecord::Base
156
175
  field :start
157
176
  field :finish
158
177
  end
159
- ...
178
+ end
160
179
  end
161
180
  ```
162
181
 
@@ -191,14 +210,7 @@ background architecture it is recommended to get to know at least with:
191
210
  **Basepack** was also
192
211
  inspired by [RailsAdmin](https://github.com/sferik/rails_admin) and
193
212
  still using [RailsAdmin
194
- DSL](https://github.com/sferik/rails_admin/wiki/Railsadmin-DSL) for defining the forms.
195
-
196
- TODO - explain the concept. Class ```Basepack::Form::Base``` and ```Basepack::Form::Fields::Base```.
197
- Controller action as ```<form_name>_form_for``` and ```form_factory_rails_admin```.
198
-
199
- ## Customining Views
200
-
201
- ## Customizing Form View
213
+ DSL](https://github.com/sferik/rails_admin/wiki/Railsadmin-DSL) for defining the forms, sessins and fields group.
202
214
 
203
215
  License
204
216
  =======
@@ -208,8 +220,16 @@ This project rocks and uses LGPL-LICENSE.
208
220
  Credits
209
221
  =======
210
222
 
211
- [RailsAdmin](https://github.com/sferik/rails_admin) field forms was
223
+ [RailsAdmin](https://github.com/sferik/rails_admin) field views and some forms (export form) was
212
224
  originaly taken from rails-admin.
213
225
 
214
226
  [nested_form_ui](https://github.com/tb/nested_form_ui) - stylesheed and
215
227
  code for orderable was inspired by this project.
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+ [![Analytics](https://ga-beacon.appspot.com/UA-46491076-2/basepack/README.md?pixel)](https://github.com/igrigorik/ga-beacon)
@@ -6,10 +6,10 @@
6
6
  @remove_spinner()
7
7
  spinner_html: '
8
8
  <div class="modal hide fade" id="page-spinner">
9
- <div class="modal-head card-title"> <%= I18n.t :loading %></div>
9
+ <div class="modal-head card-title"> <%= I18n.t :"misc.loading" %></div>
10
10
  <div class="modal-body card-body">
11
11
  <i class="icon-spinner icon-spin icon-2x"></i>
12
- &emsp;<%= I18n.t :loading %>
12
+ &emsp;<%= I18n.t :"misc.loading" %>
13
13
  </div>
14
14
  </div>
15
15
  '
@@ -159,7 +159,7 @@ module Basepack
159
159
  if filter.save
160
160
  flash.now[:notice] = message_new_done(Basepack::Utils.model_config(filter_class).label)
161
161
  else
162
- flash.now[:error] = I18n.t :error_filter, scope: [:misc]
162
+ flash.now[:error] = I18n.t('basepack.query.error_filter')
163
163
  end
164
164
  end
165
165
 
@@ -491,6 +491,27 @@ module Basepack
491
491
  end
492
492
  end
493
493
 
494
+ # Returns array of associations which are automatically included within
495
+ # list form. Is is particulary handfull when you are showing some value
496
+ # form associated model in the list column.
497
+ # For example, image you need to show list of task with their assigne:
498
+ # class Task < ActiveRecord::Base
499
+ # belongs_to :assigne, class_name: 'User'
500
+ # delegate :name, to: assignee, prefix: true
501
+ # rails_admin do
502
+ # list do
503
+ # field :name
504
+ # field :assignee_name
505
+ # end
506
+ # end
507
+ # end
508
+ #
509
+ # This method returns all association of defined fields which are
510
+ # belongs_to_association or has_one_association type
511
+ # Association from the example above is included by default.
512
+ #
513
+ # You can extend/redefine this method in subclass for futher include.
514
+ #
494
515
  def collection_includes
495
516
  resource_config.fields.select do |f|
496
517
  f.type.in?([:belongs_to_association, :has_one_association]) && !f.polymorphic?
@@ -1,7 +1,7 @@
1
1
  .form-bulk-edit
2
2
  = form.render_form do
3
3
 
4
- %h3 Bulk edit for #{form.collection.count} items
4
+ %h3= I18n.t('basepack.bulk_edit.title', count: form.collection.count)
5
5
 
6
6
  = form_display_base_errors(form.resource)
7
7
  .form-inputs
@@ -1,6 +1,7 @@
1
1
  .form-export
2
2
  .well.well-small
3
- Počet záznamů pro export:
3
+ = I18n.t('basepack.export.no_exported_items', default: [:'admin.export.no_exported_items'])
4
+ \:
4
5
  %b= export_form.collection.total_count
5
6
 
6
7
  = form_tag form.path, method: 'post', class: 'form-horizontal denser' do
@@ -14,9 +15,9 @@
14
15
  %label.checkbox{:for => 'check_all'}
15
16
  = 'Vybrat všechny pole'
16
17
  = check_box_tag 'check_all', 'all', true, data: {toggle: "checkboxes", target: "input[name^='schema[]']"}
17
- %legend= t('admin.export.select')
18
+ %legend= t('basepack.export.select', default: [:'admin.export.select'])
18
19
  .control-group
19
- %label.control-label{"data-toggle" => 'tooltip', title: t('admin.export.click_to_reverse_selection'), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('admin.export.fields_from', :name => resource_config.label_plural.downcase)
20
+ %label.control-label{"data-toggle" => 'tooltip', title: t('basepack.export.click_to_reverse_selection', default: [:'admin.export.click_to_reverse_selection']), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('basepack.export.fields_from', default: [:'admin.export.fields_from'], :name => resource_config.label_plural.downcase)
20
21
  .controls
21
22
  - form.visible_fields.select {|f| !f.association? || f.polymorphic? }.each do |field|
22
23
  %label.checkbox{for: "schema_#{field.name}"}
@@ -25,7 +26,7 @@
25
26
 
26
27
  - form.visible_fields.select {|f| f.association? && !f.polymorphic? }.each do |field|
27
28
  .control-group
28
- %label.control-label{"data-toggle" => 'tooltip', 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)
29
+ %label.control-label{"data-toggle" => 'tooltip', title: t('basepack.export.click_to_reverse_selection', default: [:'admin.export.click_to_reverse_selection']), :onclick => 'jQuery(this).siblings(".controls").find("input").click()'}= t('basepack.export.fields_from_associated', default: [:'admin.export.fields_from_associated'], :name => field.label.downcase)
29
30
  .controls
30
31
  - field.nform.visible_fields.reject {|f| f.association? }.each do |afield|
31
32
  %label.checkbox{:for => "schema_#{field.name}_#{afield.name}"}
@@ -33,38 +34,38 @@
33
34
  = afield.label
34
35
 
35
36
  %fieldset
36
- %legend= t('admin.export.options_for', :name => 'csv')
37
+ %legend= t('basepack.export.options_for', default: [:'admin.export.options_for'], :name => 'csv')
37
38
  -#.control-group
38
39
  -# - guessed_encoding = (Rails.configuration.database_configuration[Rails.env]['encoding'].presence rescue 'UTF-8') || 'UTF-8'
39
- -# %label.control-label{:for => "csv_options_encoding_to"}= t('admin.export.csv.encoding_to')
40
+ -# %label.control-label{:for => "csv_options_encoding_to"}= t('basepack.export.csv.encoding_to', default: [:'admin.export.csv.encoding_to'])
40
41
  -# .controls
41
42
  -# -# from http://books.google.com/support/partner/bin/answer.py?answer=30990 :
42
43
  -# = 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"])
43
- -# %p.help-block= t('admin.export.csv.encoding_to_help', :name => guessed_encoding)
44
+ -# %p.help-block= t('basepack.export.csv.encoding_to_help', default: [:'admin.export.csv.encoding_to_help'], :name => guessed_encoding)
44
45
 
45
46
  .control-group
46
- %label.control-label{:for => "csv_options_skip_header"}= t('admin.export.csv.skip_header')
47
+ %label.control-label{:for => "csv_options_skip_header"}= t('basepack.export.csv.skip_header', default: [:'admin.export.csv.skip_header'])
47
48
  .controls
48
49
  = check_box_tag 'csv_options[skip_header]', 'true'
49
- %p.help-block= t('admin.export.csv.skip_header_help')
50
+ %p.help-block= t('basepack.export.csv.skip_header_help', default: [:'admin.export.csv.skip_header_help'])
50
51
 
51
52
  .control-group
52
- %label.control-label{:for => "csv_options_col_sep"}= t('admin.export.csv.col_sep')
53
+ %label.control-label{:for => "csv_options_col_sep"}= t('basepack.export.csv.col_sep.label', default: [:'admin.export.csv.col_sep'])
53
54
  .controls
54
55
  = select_tag 'csv_options[col_sep]',
55
56
  options_for_select({'' => Basepack::Settings.export.default_col_sep,
56
- "<comma> ','" => ',',
57
- "<semicolon> ';'" => ';',
58
- '<tabs>' => "'\t'" })
59
- %p.help-block= t('admin.export.csv.col_sep_help', :value => Basepack::Settings.export.default_col_sep)
57
+ t('basepack.export.csv.col_sep.comma') => ',',
58
+ t('basepack.export.csv.col_sep.semicolon') => ';',
59
+ t('basepack.export.csv.col_sep.tab') => "'\t'" })
60
+ %p.help-block= t('basepack.export.csv.col_sep_help', default: [:'admin.export.csv.col_sep_help'], :value => Basepack::Settings.export.default_col_sep)
60
61
 
61
62
  .form-actions
62
63
  .pull-right
63
64
  %button.btn.btn-primary{:type => "submit", :name => 'csv'}
64
65
  %i.icon-white.icon-ok
65
- = t("admin.export.confirmation", :name => 'csv')
66
+ = t("basepack.export.confirmation", default: :"admin.export.confirmation", :name => 'csv')
66
67
  %button.btn.btn-info{:type => "submit", :name => 'json'}
67
- = t("admin.export.confirmation", :name => 'json')
68
+ = t("basepack.export.confirmation", default: :"admin.export.confirmation", :name => 'json')
68
69
  %button.btn.btn-info{:type => "submit", :name => 'xml'}
69
- = t("admin.export.confirmation", :name => 'xml')
70
+ = t("basepack.export.confirmation", default: :"admin.export.confirmation", :name => 'xml')
70
71
 
@@ -11,8 +11,8 @@
11
11
  .pull-right
12
12
  = render "forms/buttons/refresh"
13
13
 
14
- %legend Nový import
14
+ %legend= t('basepack.import.new_import')
15
15
  = form.edit_form.render
16
16
 
17
- %legend Seznam importů
17
+ %legend= t('basepack.import.import_list')
18
18
  = form.list_form.render
@@ -1,17 +1,20 @@
1
- %legend Konfigurace CSV importu
1
+ %legend= I18n.t('basepack.import.csv.configuration')
2
2
 
3
3
  = form.render_form do
4
4
  .form-inputs
5
- = form.builder.input :col_sep, label: t('admin.export.csv.col_sep') do
5
+ = form.builder.input :col_sep, label: t('basepack.export.csv.col_sep.label') do
6
6
  %select{name: "import[configuration][col_sep]"}
7
- = options_for_select({"<comma> ','" => ',', "<semicolon> ';'" => ';', '<tabs>' => "'\t'"}, configuration[:col_sep] || ',')
8
- = form.builder.input :blank_vals, label: 'Prázdné hodnoty' do
7
+ = options_for_select({I18n.t('basepack.export.csv.col_sep.comma') => Basepack::Settings.import.default_col_sep,
8
+ I18n.t('basepack.export.csv.col_sep.semicolon') => ';',
9
+ I18n.t('basepack.export.csv.col_sep.tab') => "'\t'"},
10
+ configuration[:col_sep] || ',')
11
+ = form.builder.input :blank_vals, label: I18n.t('basepack.import.csv.blank_vals.label') do
9
12
  %select{name: "import[configuration][blank_vals]"}
10
- = options_for_select({"Přeskočit" => 'skip', "Nastavit" => 'use'}, configuration[:blank_vals] || 'skip')
13
+ = options_for_select({I18n.t('basepack.import.csv.blank_vals.skip') => 'skip', I18n.t('basepack.import.csv.blank_vals.use') => 'use'}, configuration[:blank_vals] || 'skip')
11
14
  %hr
12
15
  - mapping = configuration[:mapping] || []
13
16
  - csv_cols.each_with_index do |col, i|
14
- = form.builder.input :"col_#{i}", label: html_escape(col.presence || "Sloupec #{i + 1}") do
17
+ = form.builder.input :"col_#{i}", label: html_escape(col.presence || I18n.t('basepack.import.csv.column', idx: i+1)) do
15
18
  %select{name: "import[configuration][mapping][]"}
16
19
  = options_for_select(select_options, select_options.find {|o| o[0] == col} || mapping[i])
17
20
  .form-actions
@@ -20,4 +23,4 @@
20
23
  %button.btn.btn-primary{type: "submit", name: "import[state]", value: "not_started",
21
24
  'data-disable-with' => "<i class='icon-white icon-ok'></i> #{t("admin.form.save")}"}
22
25
  %i.icon-white.icon-ok
23
- Spustit
26
+ = I18n.t('basepack.import.csv.start')
@@ -3,7 +3,7 @@
3
3
  html: {method: :post, id: 'filter-form', class: 'form-horizontal form-search'} do |f|
4
4
  .modal-header
5
5
  = render 'forms/buttons/modal_close'
6
- %h3= I18n.t('admin.misc.filter')
6
+ %h3= I18n.t('basepack.query.filter')
7
7
 
8
8
  .modal-body
9
9
  = form_display_base_errors form.resource_filter
@@ -11,12 +11,12 @@
11
11
  = yield(:query)
12
12
  - else
13
13
  .input-append
14
- = text_field_tag 'query', form.query, autofocus: true, placeholder: I18n.t('admin.misc.filter'), class: "search-query"
15
- %button{type: "submit", class: "btn", title: I18n.t('admin.misc.filter'), 'data-disable-with' => "<i class='icon-search'></i>"}
14
+ = text_field_tag 'query', form.query, autofocus: true, placeholder: I18n.t('basepack.query.filter'), class: "search-query"
15
+ %button{type: "submit", class: "btn", title: I18n.t('basepack.query.filter'), 'data-disable-with' => "<i class='icon-search'></i>"}
16
16
  %i.icon-search
17
17
  #complex-filters-menu.dropdown.pull-right
18
18
  %a.btn.dropdown-toggle{href: "#", "data-toggle" => "dropdown"}
19
- = I18n.t('admin.misc.add_filter')
19
+ = I18n.t('basepack.query.add_filter')
20
20
  %span.caret
21
21
  = render "forms/query_menu", form: form
22
22
  .clearfix
@@ -35,18 +35,18 @@
35
35
  - unless form.edit_ql
36
36
  = button_tag class: 'btn', name: 'edit_ql', data: {"remote-form" => "parent=form", "remote-target" => "parent=.form-query"} do
37
37
  %i.icon-pencil
38
- =I18n.t('misc.modify_query')
38
+ =I18n.t('basepack.query.modify_query')
39
39
  - if Basepack::Settings.filters.model_name and can?(:create, Basepack::Settings.filters.model_name.constantize)
40
40
  = hidden_field_tag 'filter_name'
41
- = button_tag class: 'btn', id: 'filter-add', title: I18n.t('misc.save_filter') do
41
+ = button_tag class: 'btn', id: 'filter-add', title: I18n.t('basepack.query.save_filter') do
42
42
  %i.icon-plus
43
- =I18n.t('misc.save_filter')
43
+ =I18n.t('basepack.query.save_filter')
44
44
  :javascript
45
45
  jQuery(function($) {
46
46
  $("#filter-add").click(function(e) {
47
47
  e.preventDefault();
48
48
 
49
- bootbox.prompt(#{I18n.t('misc.enter_filter_name').to_json}, function(result) {
49
+ bootbox.prompt(#{I18n.t('basepack.query.enter_filter_name').to_json}, function(result) {
50
50
  if (result) {
51
51
  $('#filter-form input[name=filter_name]').val(result);
52
52
  $('#filter-form').submit();