cl-admin 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/cl_admin/application.js +16 -0
- data/app/assets/javascripts/cl_admin/datatables.js +3 -0
- data/app/assets/javascripts/cl_admin/vendor/jquery.dataTables.js +14839 -0
- data/app/assets/stylesheets/cl_admin/application.scss +16 -0
- data/app/assets/stylesheets/cl_admin/bootstrap-dashboard.scss +63 -0
- data/app/assets/stylesheets/cl_admin/bootstrap_overrides.scss +10 -0
- data/app/assets/stylesheets/cl_admin/buttons.scss +14 -0
- data/app/assets/stylesheets/cl_admin/dataTables.scss +476 -0
- data/app/assets/stylesheets/cl_admin/sidebar.scss +47 -0
- data/app/assets/stylesheets/cl_admin/utility.scss +0 -0
- data/app/assets/stylesheets/cl_admin/variables.scss +19 -0
- data/app/controllers/cl_admin/application_controller.rb +5 -0
- data/app/controllers/cl_admin/dashboard_controller.rb +7 -0
- data/app/controllers/cl_admin/resources_controller.rb +50 -0
- data/app/helpers/cl_admin/application_helper.rb +4 -0
- data/app/helpers/cl_admin/resources_helper.rb +4 -0
- data/app/views/cl_admin/dashboard/index.html.erb +23 -0
- data/app/views/cl_admin/resources/_form.html.erb +6 -0
- data/app/views/cl_admin/resources/index.html.erb +30 -0
- data/app/views/cl_admin/resources/new.html.erb +9 -0
- data/app/views/cl_admin/resources/show.html.erb +20 -0
- data/app/views/layouts/cl_admin/application.html.erb +74 -0
- data/config/routes.rb +7 -0
- data/lib/cl_admin.rb +18 -0
- data/lib/cl_admin/configuration.rb +13 -0
- data/lib/cl_admin/engine.rb +5 -0
- data/lib/cl_admin/resource.rb +77 -0
- data/lib/cl_admin/resource/field.rb +32 -0
- data/lib/cl_admin/simple_form.rb +168 -0
- data/lib/cl_admin/version.rb +3 -0
- data/lib/tasks/cl_admin_tasks.rake +4 -0
- data/test/cl_admin_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/thing.rb +2 -0
- data/test/dummy/app/models/widget.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +78 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cl_admin.rb +15 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20150128203934_create_widgets.rb +11 -0
- data/test/dummy/db/migrate/20150128221526_create_things.rb +10 -0
- data/test/dummy/db/schema.rb +31 -0
- data/test/dummy/log/development.log +35213 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/fixtures/things.yml +9 -0
- data/test/dummy/test/fixtures/widgets.yml +11 -0
- data/test/dummy/test/models/thing_test.rb +7 -0
- data/test/dummy/test/models/widget_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/application.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/bootstrap-dashboard.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/bootstrap_overrides.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/buttons.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/dataTables.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/nav-sidebar.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/sidebar.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/utility.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5ca297b84cede238f2f7e1100a9c8a60d82e472c/variables.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_alerts.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_badges.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_breadcrumbs.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_button-groups.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_carousel.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_close.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_code.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_component-animations.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_dropdowns.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_forms.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_glyphicons.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_input-groups.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_jumbotron.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_labels.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_list-group.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_media.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_mixins.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_modals.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_navbar.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_navs.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_normalize.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_pager.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_panels.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_popovers.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_print.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_progress-bars.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_responsive-embed.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_responsive-utilities.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_scaffolding.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_tables.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_thumbnails.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_tooltip.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_type.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_variables.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/9ae61fe7594fa207b8c0e792a71b3247f2ecb442/_wells.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/b92dbf189012ed16682faff674922d38a147d711/_bootstrap-sprockets.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/b92dbf189012ed16682faff674922d38a147d711/_bootstrap.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_alerts.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_background-variant.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_border-radius.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_center-block.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_clearfix.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_forms.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_gradients.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_grid-framework.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_hide-text.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_image.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_labels.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_list-group.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_nav-divider.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_nav-vertical-align.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_opacity.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_panels.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_progress-bar.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_reset-filter.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_resize.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_responsive-visibility.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_size.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_tab-focus.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_table-row.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_text-emphasis.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_text-overflow.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/d5ae62fa76c715540c1cd376eada878bee98456c/_vendor-prefixes.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/eaf2b3ba15346b0c73619d2ad3ae7fcdaf0aa56a/bootstrap-dashboard.scssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0682d76393eff7c31b20bbd3eba49fc8 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1fac683c0f668a2a7fd4ea1062b39fbf +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/20b34331df4be4854889a3c23377f45e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3553ed1f1b382b6b9bcc518b810b271b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/36f8ae187aff06bd327a0da82211ee0d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/3ddfe27fc34861ca04ca66a0c208c22c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/45171cfb63e99073564e0b228ac28041 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/50483055a8f88061f7d914fa626c5352 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/59d3c4356501b88041da3f30a13e79b6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5e5f5b6a9fadf420dcf484d703d04112 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5f31826a3e67ae3c19ad896764e142f2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/67ab6ab97c6f1be9661cec5fb1fe1bdc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6b48cbb5b69311776bf647f5441b8261 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/73076af09d2cc309d096d788850449d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/7dcfdb7c49f7e376d6f39367b09fbf5b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/855025ccf2d78ca8086c71dbd05ddb80 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/860a9b5297964d6c08619dad24f8cad0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8ac30b42f441d7367b119073c8906c78 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/93d5e5770edc2798869f9b91fdf3d4b6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9a36c88175eb86f93cfc7fc7735e0043 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a1d20140ba285327c174b822dc148de2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a25f613a8ecc416a21920d5066359695 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ac73d5c7b73b96c8bcaac0821ac18c89 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b28ce637ebd1a320b66c1f8df1c38b96 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b5e5faf9bf347d0e0a85cf07fe8222a3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bb9a1e25b5312dc605a09b6789849fdf +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bbd03989b5854f9ac01c0fe45267492c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c219a250b8b465cb233748d3c4bb7288 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cbe8158164315b4f1d1b81ff224c0ef4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d5a89fee789601bd5eefc3a114a80745 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d659ac88af9b82c8f1f5d6188aa9e71a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d6c1da9ef1be9fb5132d4dc6a04f95eb +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/db41ba23a87bb0501594066bbe6306d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ead728b75839b122c1534a25c900d55c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ee6cfea76b27b0352119a739b66636ad +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/eef986a2fcad7c282086103c05fcf9a7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f32f682108ad3b7c90921211cfedf112 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f403f6c6e97ccddaf5687f4d36860635 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f56098ce403bc1978064a814465248d4 +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +19 -0
- metadata +513 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
module ClAdmin
|
2
|
+
class Resource
|
3
|
+
class Field
|
4
|
+
attr_reader :attribute, :name
|
5
|
+
|
6
|
+
def initialize(attribute:, name: nil, create: true, index: true, show: true, edit: true)
|
7
|
+
@attribute = attribute
|
8
|
+
@name = name || attribute.titelize
|
9
|
+
@create = create
|
10
|
+
@index = index
|
11
|
+
@show = show
|
12
|
+
@edit = edit
|
13
|
+
end
|
14
|
+
|
15
|
+
def display_on_index?
|
16
|
+
!!@index
|
17
|
+
end
|
18
|
+
|
19
|
+
def display_on_create?
|
20
|
+
!!@create
|
21
|
+
end
|
22
|
+
|
23
|
+
def display_on_show?
|
24
|
+
!!@show
|
25
|
+
end
|
26
|
+
|
27
|
+
def display_on_edit?
|
28
|
+
!!@edit
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
require 'simple_form'
|
2
|
+
|
3
|
+
# Use this setup block to configure all options available in SimpleForm.
|
4
|
+
SimpleForm.setup do |config|
|
5
|
+
# Wrappers are used by the form builder to generate a
|
6
|
+
# complete input. You can remove any component from the
|
7
|
+
# wrapper, change the order or even add your own to the
|
8
|
+
# stack. The options given below are used to wrap the
|
9
|
+
# whole input.
|
10
|
+
config.wrappers :default, class: :input,
|
11
|
+
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
12
|
+
## Extensions enabled by default
|
13
|
+
# Any of these extensions can be disabled for a
|
14
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
15
|
+
# You can make any of these extensions optional by
|
16
|
+
# renaming `b.use` to `b.optional`.
|
17
|
+
|
18
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
19
|
+
# and required attributes
|
20
|
+
b.use :html5
|
21
|
+
|
22
|
+
# Calculates placeholders automatically from I18n
|
23
|
+
# You can also pass a string as f.input placeholder: "Placeholder"
|
24
|
+
b.use :placeholder
|
25
|
+
|
26
|
+
## Optional extensions
|
27
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
28
|
+
# to the input. If so, they will retrieve the values from the model
|
29
|
+
# if any exists. If you want to enable any of those
|
30
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
31
|
+
|
32
|
+
# Calculates maxlength from length validations for string inputs
|
33
|
+
b.optional :maxlength
|
34
|
+
|
35
|
+
# Calculates pattern from format validations for string inputs
|
36
|
+
b.optional :pattern
|
37
|
+
|
38
|
+
# Calculates min and max from length validations for numeric inputs
|
39
|
+
b.optional :min_max
|
40
|
+
|
41
|
+
# Calculates readonly automatically from readonly attributes
|
42
|
+
b.optional :readonly
|
43
|
+
|
44
|
+
## Inputs
|
45
|
+
b.use :label_input
|
46
|
+
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
47
|
+
b.use :error, wrap_with: { tag: :span, class: :error }
|
48
|
+
|
49
|
+
## full_messages_for
|
50
|
+
# If you want to display the full error message for the attribute, you can
|
51
|
+
# use the component :full_error, like:
|
52
|
+
#
|
53
|
+
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
54
|
+
end
|
55
|
+
|
56
|
+
# The default wrapper to be used by the FormBuilder.
|
57
|
+
config.default_wrapper = :default
|
58
|
+
|
59
|
+
# Define the way to render check boxes / radio buttons with labels.
|
60
|
+
# Defaults to :nested for bootstrap config.
|
61
|
+
# inline: input + label
|
62
|
+
# nested: label > input
|
63
|
+
config.boolean_style = :nested
|
64
|
+
|
65
|
+
# Default class for buttons
|
66
|
+
config.button_class = 'btn'
|
67
|
+
|
68
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
69
|
+
# :first lists the first message for each field.
|
70
|
+
# Use :to_sentence to list all errors for each field.
|
71
|
+
# config.error_method = :first
|
72
|
+
|
73
|
+
# Default tag used for error notification helper.
|
74
|
+
config.error_notification_tag = :div
|
75
|
+
|
76
|
+
# CSS class to add for error notification helper.
|
77
|
+
config.error_notification_class = 'error_notification'
|
78
|
+
|
79
|
+
# ID to add for error notification helper.
|
80
|
+
# config.error_notification_id = nil
|
81
|
+
|
82
|
+
# Series of attempts to detect a default label method for collection.
|
83
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
84
|
+
|
85
|
+
# Series of attempts to detect a default value method for collection.
|
86
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
87
|
+
|
88
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
89
|
+
# config.collection_wrapper_tag = nil
|
90
|
+
|
91
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
92
|
+
# config.collection_wrapper_class = nil
|
93
|
+
|
94
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
95
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
96
|
+
# SimpleForm will force this option to be a label.
|
97
|
+
# config.item_wrapper_tag = :span
|
98
|
+
|
99
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
100
|
+
# config.item_wrapper_class = nil
|
101
|
+
|
102
|
+
# How the label text should be generated altogether with the required text.
|
103
|
+
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
104
|
+
|
105
|
+
# You can define the class to use on all labels. Default is nil.
|
106
|
+
# config.label_class = nil
|
107
|
+
|
108
|
+
# You can define the default class to be used on forms. Can be overriden
|
109
|
+
# with `html: { :class }`. Defaulting to none.
|
110
|
+
# config.default_form_class = nil
|
111
|
+
|
112
|
+
# You can define which elements should obtain additional classes
|
113
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
114
|
+
|
115
|
+
# Whether attributes are required by default (or not). Default is true.
|
116
|
+
# config.required_by_default = true
|
117
|
+
|
118
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
119
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
120
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
121
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
122
|
+
# change this configuration to true.
|
123
|
+
config.browser_validations = false
|
124
|
+
|
125
|
+
# Collection of methods to detect if a file type was given.
|
126
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
127
|
+
|
128
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
129
|
+
# to match as key, and the input type that will be used when the field name
|
130
|
+
# matches the regexp as value.
|
131
|
+
# config.input_mappings = { /count/ => :integer }
|
132
|
+
|
133
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
134
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
135
|
+
# config.wrapper_mappings = { string: :prepend }
|
136
|
+
|
137
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
138
|
+
# override default inputs.
|
139
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
140
|
+
|
141
|
+
# Default priority for time_zone inputs.
|
142
|
+
# config.time_zone_priority = nil
|
143
|
+
|
144
|
+
# Default priority for country inputs.
|
145
|
+
# config.country_priority = nil
|
146
|
+
|
147
|
+
# When false, do not use translations for labels.
|
148
|
+
# config.translate_labels = true
|
149
|
+
|
150
|
+
# Automatically discover new inputs in Rails' autoload path.
|
151
|
+
# config.inputs_discovery = true
|
152
|
+
|
153
|
+
# Cache SimpleForm inputs discovery
|
154
|
+
# config.cache_discovery = !Rails.env.development?
|
155
|
+
|
156
|
+
# Default class for inputs
|
157
|
+
# config.input_class = nil
|
158
|
+
|
159
|
+
# Define the default class of the input wrapper of the boolean input.
|
160
|
+
config.boolean_label_class = 'checkbox'
|
161
|
+
|
162
|
+
# Defines if the default input wrapper class should be included in radio
|
163
|
+
# collection wrappers.
|
164
|
+
# config.include_default_input_wrapper_class = true
|
165
|
+
|
166
|
+
# Defines which i18n scope will be used in Simple Form.
|
167
|
+
# config.i18n_scope = 'simple_form'
|
168
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "cl_admin"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|