wallaby 4.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +29 -0
- data/app/assets/javascripts/wallaby/application.js +15 -0
- data/app/assets/javascripts/wallaby/form.js +8 -0
- data/app/assets/stylesheets/wallaby/application.scss +51 -0
- data/app/assets/stylesheets/wallaby/base/_functions.scss +0 -0
- data/app/assets/stylesheets/wallaby/base/_layout.scss +14 -0
- data/app/assets/stylesheets/wallaby/base/_mixins.scss +0 -0
- data/app/assets/stylesheets/wallaby/base/_normalize.scss +0 -0
- data/app/assets/stylesheets/wallaby/base/_reset.scss +0 -0
- data/app/assets/stylesheets/wallaby/base/_vars.scss +5 -0
- data/app/assets/stylesheets/wallaby/components/_forms.scss +53 -0
- data/app/assets/stylesheets/wallaby/components/_nav.scss +19 -0
- data/app/assets/stylesheets/wallaby/components/_pagination.scss +105 -0
- data/app/assets/stylesheets/wallaby/components/_tables.scss +78 -0
- data/app/assets/stylesheets/wallaby/components/_text.scss +11 -0
- data/app/assets/stylesheets/wallaby/form.scss +11 -0
- data/app/assets/stylesheets/wallaby/summernote.scss.erb +7 -0
- data/app/controllers/wallaby/application_controller.rb +21 -0
- data/app/controllers/wallaby/core_controller.rb +28 -0
- data/app/controllers/wallaby/resources_controller.rb +134 -0
- data/app/controllers/wallaby/secure_controller.rb +42 -0
- data/app/routes/wallaby/resources_router.rb +52 -0
- data/app/security/ability.rb +33 -0
- data/app/views/layouts/wallaby/_footer.html.erb +2 -0
- data/app/views/layouts/wallaby/_header.html.erb +57 -0
- data/app/views/layouts/wallaby/_navs.html.erb +1 -0
- data/app/views/layouts/wallaby/application.html.erb +22 -0
- data/app/views/layouts/wallaby/error.html.erb +20 -0
- data/app/views/wallaby/core/home.html.erb +5 -0
- data/app/views/wallaby/errors/access_denied.html.erb +1 -0
- data/app/views/wallaby/errors/not_authenticated.html.erb +1 -0
- data/app/views/wallaby/errors/not_found.html.erb +6 -0
- data/app/views/wallaby/errors/unprocessable_entity.erb +1 -0
- data/app/views/wallaby/resources/_form.html.erb +12 -0
- data/app/views/wallaby/resources/_index_actions.html.erb +1 -0
- data/app/views/wallaby/resources/_resource_actions.html.erb +3 -0
- data/app/views/wallaby/resources/edit.html.erb +14 -0
- data/app/views/wallaby/resources/form/_belongs_to.html.erb +21 -0
- data/app/views/wallaby/resources/form/_bigint.html.erb +9 -0
- data/app/views/wallaby/resources/form/_binary.html.erb +12 -0
- data/app/views/wallaby/resources/form/_bit.html.erb +9 -0
- data/app/views/wallaby/resources/form/_bit_varying.html.erb +9 -0
- data/app/views/wallaby/resources/form/_boolean.html.erb +14 -0
- data/app/views/wallaby/resources/form/_cidr.html.erb +9 -0
- data/app/views/wallaby/resources/form/_citext.html.erb +21 -0
- data/app/views/wallaby/resources/form/_color.html.erb +20 -0
- data/app/views/wallaby/resources/form/_date.html.erb +29 -0
- data/app/views/wallaby/resources/form/_daterange.html.erb +37 -0
- data/app/views/wallaby/resources/form/_datetime.html.erb +30 -0
- data/app/views/wallaby/resources/form/_decimal.html.erb +9 -0
- data/app/views/wallaby/resources/form/_email.html.erb +5 -0
- data/app/views/wallaby/resources/form/_float.html.erb +9 -0
- data/app/views/wallaby/resources/form/_has_and_belongs_to_many.html.erb +13 -0
- data/app/views/wallaby/resources/form/_has_many.html.erb +13 -0
- data/app/views/wallaby/resources/form/_has_one.html.erb +7 -0
- data/app/views/wallaby/resources/form/_hstore.html.erb +25 -0
- data/app/views/wallaby/resources/form/_inet.html.erb +9 -0
- data/app/views/wallaby/resources/form/_int4range.html.erb +18 -0
- data/app/views/wallaby/resources/form/_int8range.html.erb +18 -0
- data/app/views/wallaby/resources/form/_integer.html.erb +9 -0
- data/app/views/wallaby/resources/form/_json.html.erb +23 -0
- data/app/views/wallaby/resources/form/_jsonb.html.erb +23 -0
- data/app/views/wallaby/resources/form/_ltree.html.erb +5 -0
- data/app/views/wallaby/resources/form/_macaddr.html.erb +9 -0
- data/app/views/wallaby/resources/form/_money.html.erb +12 -0
- data/app/views/wallaby/resources/form/_numrange.html.erb +18 -0
- data/app/views/wallaby/resources/form/_password.html.erb +5 -0
- data/app/views/wallaby/resources/form/_point.html.erb +18 -0
- data/app/views/wallaby/resources/form/_string.html.erb +5 -0
- data/app/views/wallaby/resources/form/_text.html.erb +21 -0
- data/app/views/wallaby/resources/form/_time.html.erb +29 -0
- data/app/views/wallaby/resources/form/_tsrange.html.erb +38 -0
- data/app/views/wallaby/resources/form/_tstzrange.html.erb +38 -0
- data/app/views/wallaby/resources/form/_tsvector.html.erb +5 -0
- data/app/views/wallaby/resources/form/_uuid.html.erb +9 -0
- data/app/views/wallaby/resources/form/_xml.html.erb +23 -0
- data/app/views/wallaby/resources/index/_belongs_to.html.erb +1 -0
- data/app/views/wallaby/resources/index/_bigint.html.erb +1 -0
- data/app/views/wallaby/resources/index/_binary.html.erb +1 -0
- data/app/views/wallaby/resources/index/_bit.html.erb +5 -0
- data/app/views/wallaby/resources/index/_bit_varying.html.erb +5 -0
- data/app/views/wallaby/resources/index/_boolean.html.erb +5 -0
- data/app/views/wallaby/resources/index/_cidr.html.erb +6 -0
- data/app/views/wallaby/resources/index/_citext.html.erb +12 -0
- data/app/views/wallaby/resources/index/_color.html.erb +5 -0
- data/app/views/wallaby/resources/index/_date.html.erb +7 -0
- data/app/views/wallaby/resources/index/_daterange.html.erb +8 -0
- data/app/views/wallaby/resources/index/_datetime.html.erb +7 -0
- data/app/views/wallaby/resources/index/_decimal.html.erb +1 -0
- data/app/views/wallaby/resources/index/_email.html.erb +1 -0
- data/app/views/wallaby/resources/index/_float.html.erb +1 -0
- data/app/views/wallaby/resources/index/_has_and_belongs_to_many.html.erb +11 -0
- data/app/views/wallaby/resources/index/_has_many.html.erb +11 -0
- data/app/views/wallaby/resources/index/_has_one.html.erb +1 -0
- data/app/views/wallaby/resources/index/_hstore.html.erb +12 -0
- data/app/views/wallaby/resources/index/_inet.html.erb +6 -0
- data/app/views/wallaby/resources/index/_int4range.html.erb +7 -0
- data/app/views/wallaby/resources/index/_int8range.html.erb +7 -0
- data/app/views/wallaby/resources/index/_integer.html.erb +1 -0
- data/app/views/wallaby/resources/index/_json.html.erb +12 -0
- data/app/views/wallaby/resources/index/_jsonb.html.erb +12 -0
- data/app/views/wallaby/resources/index/_ltree.html.erb +12 -0
- data/app/views/wallaby/resources/index/_macaddr.html.erb +5 -0
- data/app/views/wallaby/resources/index/_money.html.erb +1 -0
- data/app/views/wallaby/resources/index/_numrange.html.erb +7 -0
- data/app/views/wallaby/resources/index/_point.html.erb +6 -0
- data/app/views/wallaby/resources/index/_string.html.erb +12 -0
- data/app/views/wallaby/resources/index/_text.html.erb +12 -0
- data/app/views/wallaby/resources/index/_time.html.erb +6 -0
- data/app/views/wallaby/resources/index/_tsrange.html.erb +8 -0
- data/app/views/wallaby/resources/index/_tstzrange.html.erb +8 -0
- data/app/views/wallaby/resources/index/_tsvector.html.erb +12 -0
- data/app/views/wallaby/resources/index/_uuid.html.erb +12 -0
- data/app/views/wallaby/resources/index/_xml.html.erb +12 -0
- data/app/views/wallaby/resources/index.html.erb +66 -0
- data/app/views/wallaby/resources/new.html.erb +14 -0
- data/app/views/wallaby/resources/shared/_resource_nav.html.erb +29 -0
- data/app/views/wallaby/resources/show/_belongs_to.html.erb +7 -0
- data/app/views/wallaby/resources/show/_bigint.html.erb +1 -0
- data/app/views/wallaby/resources/show/_binary.html.erb +1 -0
- data/app/views/wallaby/resources/show/_bit.html.erb +5 -0
- data/app/views/wallaby/resources/show/_bit_varying.html.erb +5 -0
- data/app/views/wallaby/resources/show/_boolean.html.erb +5 -0
- data/app/views/wallaby/resources/show/_cidr.html.erb +6 -0
- data/app/views/wallaby/resources/show/_citext.html.erb +1 -0
- data/app/views/wallaby/resources/show/_color.html.erb +5 -0
- data/app/views/wallaby/resources/show/_date.html.erb +7 -0
- data/app/views/wallaby/resources/show/_daterange.html.erb +7 -0
- data/app/views/wallaby/resources/show/_datetime.html.erb +6 -0
- data/app/views/wallaby/resources/show/_decimal.html.erb +1 -0
- data/app/views/wallaby/resources/show/_email.html.erb +1 -0
- data/app/views/wallaby/resources/show/_float.html.erb +1 -0
- data/app/views/wallaby/resources/show/_has_and_belongs_to_many.html.erb +5 -0
- data/app/views/wallaby/resources/show/_has_many.html.erb +5 -0
- data/app/views/wallaby/resources/show/_has_one.html.erb +1 -0
- data/app/views/wallaby/resources/show/_hstore.html.erb +5 -0
- data/app/views/wallaby/resources/show/_inet.html.erb +6 -0
- data/app/views/wallaby/resources/show/_int4range.html.erb +7 -0
- data/app/views/wallaby/resources/show/_int8range.html.erb +7 -0
- data/app/views/wallaby/resources/show/_integer.html.erb +1 -0
- data/app/views/wallaby/resources/show/_json.html.erb +5 -0
- data/app/views/wallaby/resources/show/_jsonb.html.erb +5 -0
- data/app/views/wallaby/resources/show/_ltree.html.erb +1 -0
- data/app/views/wallaby/resources/show/_macaddr.html.erb +5 -0
- data/app/views/wallaby/resources/show/_money.html.erb +1 -0
- data/app/views/wallaby/resources/show/_numrange.html.erb +7 -0
- data/app/views/wallaby/resources/show/_point.html.erb +6 -0
- data/app/views/wallaby/resources/show/_string.html.erb +1 -0
- data/app/views/wallaby/resources/show/_text.html.erb +1 -0
- data/app/views/wallaby/resources/show/_time.html.erb +6 -0
- data/app/views/wallaby/resources/show/_tsrange.html.erb +7 -0
- data/app/views/wallaby/resources/show/_tstzrange.html.erb +7 -0
- data/app/views/wallaby/resources/show/_tsvector.html.erb +1 -0
- data/app/views/wallaby/resources/show/_uuid.html.erb +5 -0
- data/app/views/wallaby/resources/show/_xml.html.erb +5 -0
- data/app/views/wallaby/resources/show.html.erb +31 -0
- data/app/views/wallaby/shared/_flash_messages.html.erb +13 -0
- data/config/locales/en.yml +29 -0
- data/config/routes.rb +34 -0
- data/lib/adaptors/wallaby/active_record/model_decorator/fields_builder.rb +105 -0
- data/lib/adaptors/wallaby/active_record/model_decorator/title_field_finder.rb +18 -0
- data/lib/adaptors/wallaby/active_record/model_decorator.rb +81 -0
- data/lib/adaptors/wallaby/active_record/model_finder.rb +12 -0
- data/lib/adaptors/wallaby/active_record/model_operator/normalizer.rb +44 -0
- data/lib/adaptors/wallaby/active_record/model_operator/permitter.rb +50 -0
- data/lib/adaptors/wallaby/active_record/model_operator/querier.rb +47 -0
- data/lib/adaptors/wallaby/active_record/model_operator/validator.rb +16 -0
- data/lib/adaptors/wallaby/active_record/model_operator.rb +82 -0
- data/lib/adaptors/wallaby/active_record.rb +2 -0
- data/lib/decorators/wallaby/resource_decorator.rb +78 -0
- data/lib/errors/wallaby/deprecated.rb +4 -0
- data/lib/errors/wallaby/general_error.rb +4 -0
- data/lib/errors/wallaby/invalid_error.rb +4 -0
- data/lib/errors/wallaby/model_not_found.rb +4 -0
- data/lib/errors/wallaby/not_authenticated.rb +4 -0
- data/lib/errors/wallaby/not_implemented.rb +4 -0
- data/lib/errors/wallaby/operation_not_found.rb +4 -0
- data/lib/errors/wallaby/resource_not_found.rb +4 -0
- data/lib/forms/wallaby/form_builder.rb +30 -0
- data/lib/handlers/wallaby/cached_compiled_erb.rb +14 -0
- data/lib/helpers/wallaby/application_helper.rb +30 -0
- data/lib/helpers/wallaby/core_helper.rb +50 -0
- data/lib/helpers/wallaby/form_helper.rb +21 -0
- data/lib/helpers/wallaby/links_helper.rb +83 -0
- data/lib/helpers/wallaby/paginatable_helper.rb +9 -0
- data/lib/helpers/wallaby/resources_helper.rb +55 -0
- data/lib/helpers/wallaby/secure_helper.rb +25 -0
- data/lib/helpers/wallaby/sorting_helper.rb +43 -0
- data/lib/helpers/wallaby/styling_helper.rb +57 -0
- data/lib/interfaces/wallaby/mode.rb +18 -0
- data/lib/interfaces/wallaby/model_decorator.rb +58 -0
- data/lib/interfaces/wallaby/model_finder.rb +5 -0
- data/lib/interfaces/wallaby/model_operator.rb +31 -0
- data/lib/services/wallaby/decorator_finder.rb +16 -0
- data/lib/services/wallaby/lookup_context_wrapper.rb +40 -0
- data/lib/services/wallaby/map.rb +53 -0
- data/lib/services/wallaby/model_servicer.rb +38 -0
- data/lib/services/wallaby/servicer_finder.rb +5 -0
- data/lib/tasks/wallaby_tasks.rake +4 -0
- data/lib/utils/wallaby/utils.rb +31 -0
- data/lib/wallaby/configuration/models.rb +17 -0
- data/lib/wallaby/configuration/security.rb +30 -0
- data/lib/wallaby/configuration.rb +49 -0
- data/lib/wallaby/engine.rb +89 -0
- data/lib/wallaby/version.rb +3 -0
- data/lib/wallaby.rb +5 -0
- metadata +459 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b7937875c96f6ecc708f03cc9a71b40b06958bf3
|
|
4
|
+
data.tar.gz: dd4f53a8a16d8e8a8e0ce2ebbf49379a89653cc7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ab1541f97dd55962b4fa24d6747f0e2e9d5ceb76c8cc4f23931cb4593ab8d67bfc221dfd0f603d75550d8d3367bd66945c5f1f72139d40f96f59d3aa0e11c687
|
|
7
|
+
data.tar.gz: 1a8465bdbd6d6ed4b003a8ae8ded2a000f4a24b634fb872e236c24cee6edff5de5b76b910209fdf7e0c2f7c2b2933a4f2017dba54b2f6068a46f8dfcfd63d8b6
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2015 Tian Chen
|
|
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/Rakefile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
8
|
+
|
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
+
rdoc.title = 'Wallaby'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
18
|
+
load 'rails/tasks/engine.rake'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
load 'rails/tasks/statistics.rake'
|
|
22
|
+
|
|
23
|
+
Bundler::GemHelper.install_tasks
|
|
24
|
+
|
|
25
|
+
require 'rspec/core/rake_task'
|
|
26
|
+
|
|
27
|
+
RSpec::Core::RakeTask.new :spec
|
|
28
|
+
|
|
29
|
+
task default: :spec
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//= require jquery
|
|
2
|
+
//= require jquery_ujs
|
|
3
|
+
//= require bootstrap-sprockets
|
|
4
|
+
jQuery(function ($) {
|
|
5
|
+
$('[data-toggle="tooltip"]').tooltip({ html: true })
|
|
6
|
+
|
|
7
|
+
$('.search-form').each(function () {
|
|
8
|
+
var $this = $(this)
|
|
9
|
+
$(this).find('input:visible').on('focus', function () {
|
|
10
|
+
$this.addClass('focus')
|
|
11
|
+
}).on('blur', function () {
|
|
12
|
+
$this.removeClass('focus')
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
|
|
3
|
+
*/
|
|
4
|
+
@import "bootstrap-sprockets";
|
|
5
|
+
@import "bootstrap";
|
|
6
|
+
@import 'base/_vars';
|
|
7
|
+
@import 'base/_mixins';
|
|
8
|
+
@import 'base/_functions';
|
|
9
|
+
@import 'base/_normalize';
|
|
10
|
+
@import 'base/_reset';
|
|
11
|
+
@import 'base/_layout';
|
|
12
|
+
@import 'components/_text';
|
|
13
|
+
@import 'components/_nav';
|
|
14
|
+
@import 'components/_tables';
|
|
15
|
+
@import 'components/_forms';
|
|
16
|
+
@import 'components/_pagination';
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
nav.top-nav {
|
|
23
|
+
margin-bottom: 0px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
section.fields {
|
|
27
|
+
padding: 10px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
div.page-header {
|
|
31
|
+
margin-top: 0px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
margin-top: 5px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ul.text-danger {
|
|
39
|
+
margin-top: 5px;
|
|
40
|
+
margin-bottom: 5px;
|
|
41
|
+
padding-left: 25px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.color-square {
|
|
45
|
+
display: inline-block;
|
|
46
|
+
margin-right: 3px;
|
|
47
|
+
width: 17px;
|
|
48
|
+
height: 17px;
|
|
49
|
+
border: 1px solid #eeeeee;
|
|
50
|
+
vertical-align: text-top;
|
|
51
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Forms
|
|
3
|
+
// --------------------------------------------------
|
|
4
|
+
.search-form {
|
|
5
|
+
position: relative;
|
|
6
|
+
border-bottom: 1px solid $hr-border;
|
|
7
|
+
margin-top: -15px;
|
|
8
|
+
margin-left: -15px;
|
|
9
|
+
margin-right: -15px;
|
|
10
|
+
margin-bottom: 10px;
|
|
11
|
+
box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
|
|
12
|
+
|
|
13
|
+
.right {
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 10;
|
|
16
|
+
right: 15px;
|
|
17
|
+
top: 50%;
|
|
18
|
+
margin-top: -17px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
form {
|
|
22
|
+
padding: 15px 97px 15px 40px;
|
|
23
|
+
&:before {
|
|
24
|
+
position: absolute;
|
|
25
|
+
@extend .glyphicon, .glyphicon-search:before;
|
|
26
|
+
z-index: 10;
|
|
27
|
+
left: 15px;
|
|
28
|
+
top: 50%;
|
|
29
|
+
margin-top: -9px;
|
|
30
|
+
font-size: $font-size-large;
|
|
31
|
+
color: $gray-lighter;
|
|
32
|
+
}
|
|
33
|
+
input {
|
|
34
|
+
font-size: $font-size-large;
|
|
35
|
+
width: 100%;
|
|
36
|
+
border: none;
|
|
37
|
+
&:focus {
|
|
38
|
+
outline: unset;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
&.focus {
|
|
43
|
+
form:before {
|
|
44
|
+
color: $btn-primary-bg;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.sort {
|
|
49
|
+
form {
|
|
50
|
+
padding-right: 197px;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.pagination {
|
|
2
|
+
@extend .pull-right;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
padding-left: 0;
|
|
5
|
+
margin: 0 auto;
|
|
6
|
+
border-radius: $border-radius-base;
|
|
7
|
+
|
|
8
|
+
> span {
|
|
9
|
+
display: inline; // Remove list-style and block-level defaults
|
|
10
|
+
position: relative;
|
|
11
|
+
float: left; // Collapse white-space
|
|
12
|
+
line-height: $line-height-base;
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
background-color: $pagination-bg;
|
|
15
|
+
border: 1px solid $pagination-border;
|
|
16
|
+
margin-left: -1px;
|
|
17
|
+
&.first > a {
|
|
18
|
+
content: '«';
|
|
19
|
+
}
|
|
20
|
+
&.last > a {
|
|
21
|
+
content: '»';
|
|
22
|
+
}
|
|
23
|
+
&.previous > a {
|
|
24
|
+
content: '‹';
|
|
25
|
+
}
|
|
26
|
+
&.next > a {
|
|
27
|
+
content: '›';
|
|
28
|
+
}
|
|
29
|
+
> a {
|
|
30
|
+
display: inline-block;
|
|
31
|
+
color: $pagination-color;
|
|
32
|
+
padding: $padding-base-vertical $padding-base-horizontal;
|
|
33
|
+
}
|
|
34
|
+
&:first-child {
|
|
35
|
+
margin-left: 0;
|
|
36
|
+
@include border-left-radius($border-radius-base);
|
|
37
|
+
}
|
|
38
|
+
&:last-child {
|
|
39
|
+
@include border-right-radius($border-radius-base);
|
|
40
|
+
}
|
|
41
|
+
&.page, &.first, &.prev, &.next, &.last {
|
|
42
|
+
&.gap, &.current {
|
|
43
|
+
padding: $padding-base-vertical $padding-base-horizontal;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
> span > a {
|
|
49
|
+
&:hover,
|
|
50
|
+
&:focus {
|
|
51
|
+
z-index: 2;
|
|
52
|
+
color: $pagination-hover-color;
|
|
53
|
+
background-color: $pagination-hover-bg;
|
|
54
|
+
border-color: $pagination-hover-border;
|
|
55
|
+
text-decoration: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
> .current {
|
|
60
|
+
&,
|
|
61
|
+
&:hover,
|
|
62
|
+
&:focus {
|
|
63
|
+
z-index: 3;
|
|
64
|
+
color: $pagination-active-color;
|
|
65
|
+
background-color: $pagination-active-bg;
|
|
66
|
+
border-color: $pagination-active-border;
|
|
67
|
+
cursor: default;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
> .disabled {
|
|
72
|
+
> span,
|
|
73
|
+
> span:hover,
|
|
74
|
+
> span:focus,
|
|
75
|
+
> a,
|
|
76
|
+
> a:hover,
|
|
77
|
+
> a:focus {
|
|
78
|
+
color: $pagination-disabled-color;
|
|
79
|
+
background-color: $pagination-disabled-bg;
|
|
80
|
+
border-color: $pagination-disabled-border;
|
|
81
|
+
cursor: $cursor-disabled;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Sizing
|
|
87
|
+
// --------------------------------------------------
|
|
88
|
+
|
|
89
|
+
// Large
|
|
90
|
+
.pagination-lg {
|
|
91
|
+
@include pagination-size($padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $border-radius-large);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Small
|
|
95
|
+
.pagination-sm {
|
|
96
|
+
@include pagination-size($padding-small-vertical, $padding-small-horizontal, $font-size-small, $line-height-small, $border-radius-small);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.pagination-info {
|
|
100
|
+
line-height: 34px;
|
|
101
|
+
color: $breadcrumb-color;
|
|
102
|
+
b {
|
|
103
|
+
color: $gray-light;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Tables
|
|
3
|
+
// --------------------------------------------------
|
|
4
|
+
table.data-table {
|
|
5
|
+
@extend .table;
|
|
6
|
+
thead tr th {
|
|
7
|
+
color: $gray-light;
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
&.asc, &.desc {
|
|
10
|
+
a {
|
|
11
|
+
display: block;
|
|
12
|
+
position: relative;
|
|
13
|
+
padding-right: 22px;
|
|
14
|
+
}
|
|
15
|
+
a:after {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 50%;
|
|
18
|
+
margin-top: -7px;
|
|
19
|
+
right: 4px;
|
|
20
|
+
@extend .glyphicon;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&.asc {
|
|
24
|
+
a:after {
|
|
25
|
+
@extend .glyphicon-sort-by-attributes:before;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
&.desc {
|
|
29
|
+
a:after {
|
|
30
|
+
@extend .glyphicon-sort-by-attributes-alt:before;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
tbody tr td {
|
|
35
|
+
padding: 8px 12px;
|
|
36
|
+
a, a:hover {
|
|
37
|
+
text-decoration: none;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
i.glyphicon {
|
|
41
|
+
color: $gray-lighter;
|
|
42
|
+
&:hover {
|
|
43
|
+
color: $gray-light;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
a {
|
|
47
|
+
i.glyphicon {
|
|
48
|
+
margin-right: 2px;
|
|
49
|
+
color: inherit;
|
|
50
|
+
&:hover {
|
|
51
|
+
color: inherit;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
i.glyphicon.glyphicon-circle-arrow-up {
|
|
55
|
+
color: $gray-lighter;
|
|
56
|
+
&:hover {
|
|
57
|
+
color: $gray-light;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
table.detail-table {
|
|
64
|
+
@extend .table;
|
|
65
|
+
thead tr th, tbody tr th {
|
|
66
|
+
color: $gray-light;
|
|
67
|
+
text-transform: uppercase;
|
|
68
|
+
}
|
|
69
|
+
tbody tr {
|
|
70
|
+
td {
|
|
71
|
+
padding: 8px 12px;
|
|
72
|
+
|
|
73
|
+
a, a:hover {
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@include text-emphasis-variant('.text-primary', #205081);
|
|
2
|
+
|
|
3
|
+
@include text-emphasis-variant('.text-success', #8eb021);
|
|
4
|
+
|
|
5
|
+
@include text-emphasis-variant('.text-info', #59afe1);
|
|
6
|
+
|
|
7
|
+
@include text-emphasis-variant('.text-warning', #f6c342);
|
|
8
|
+
|
|
9
|
+
@include text-emphasis-variant('.text-danger', #d04437);
|
|
10
|
+
|
|
11
|
+
@include text-emphasis-variant('.text-muted', #dddddd);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%
|
|
2
|
+
# NOTE: we have a problem with summernote.css that
|
|
3
|
+
# we need to dynamically convert it to a scss format
|
|
4
|
+
# The reason is hard to explain, so let it be :P
|
|
5
|
+
css_file = "#{ Gem.loaded_specs['summernote-rails'].full_gem_path }/vendor/assets/stylesheets/summernote.css"
|
|
6
|
+
%>
|
|
7
|
+
<%= File.open(css_file, "r").read %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class Wallaby::ApplicationController < ::Wallaby.configuration.base_controller
|
|
2
|
+
helper Wallaby::ApplicationHelper
|
|
3
|
+
|
|
4
|
+
rescue_from \
|
|
5
|
+
Wallaby::ResourceNotFound,
|
|
6
|
+
Wallaby::ModelNotFound,
|
|
7
|
+
with: :not_found
|
|
8
|
+
rescue_from ActionController::ParameterMissing, with: :unprocessable_entity
|
|
9
|
+
|
|
10
|
+
layout 'wallaby/application'
|
|
11
|
+
|
|
12
|
+
def not_found(exception = nil)
|
|
13
|
+
@exception = exception
|
|
14
|
+
render 'wallaby/errors/not_found', status: 404
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def unprocessable_entity(exception)
|
|
18
|
+
@exception = exception
|
|
19
|
+
render 'wallaby/errors/unprocessable_entity', status: 422
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Wallaby
|
|
2
|
+
class CoreController < SecureController
|
|
3
|
+
helper Wallaby::CoreHelper
|
|
4
|
+
|
|
5
|
+
before_action :authenticate_user!, except: [ :status ]
|
|
6
|
+
|
|
7
|
+
def status
|
|
8
|
+
render text: 'healthy'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
begin # helper methods
|
|
13
|
+
helper_method \
|
|
14
|
+
:current_resources_name,
|
|
15
|
+
:current_model_class
|
|
16
|
+
|
|
17
|
+
def current_resources_name
|
|
18
|
+
@current_resources_name ||= params[:resources]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def current_model_class
|
|
22
|
+
@current_model_class ||= if self.class.respond_to? :model_class
|
|
23
|
+
self.class.model_class
|
|
24
|
+
end || Wallaby::Utils.to_model_class(current_resources_name)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
module Wallaby
|
|
2
|
+
class ResourcesController < CoreController
|
|
3
|
+
helper Wallaby::ResourcesHelper
|
|
4
|
+
|
|
5
|
+
def self.resources_name
|
|
6
|
+
if self < Wallaby::ResourcesController
|
|
7
|
+
Wallaby::Utils.to_resources_name name.gsub('Controller', '')
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.model_class
|
|
12
|
+
if self < Wallaby::ResourcesController
|
|
13
|
+
Wallaby::Utils.to_model_class name.gsub('Controller', ''), name
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def index
|
|
18
|
+
authorize! :index, current_model_class
|
|
19
|
+
collection
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def new
|
|
23
|
+
authorize! :new, new_resource
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def create
|
|
27
|
+
authorize! :create, current_model_class
|
|
28
|
+
@resource, is_success = current_model_service.create params, current_ability
|
|
29
|
+
if is_success
|
|
30
|
+
redirect_to resources_index_path, notice: 'successfully created'
|
|
31
|
+
else
|
|
32
|
+
flash.now[:error] = 'failed to create'
|
|
33
|
+
render :new
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def show
|
|
38
|
+
authorize! :show, resource
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def edit
|
|
42
|
+
authorize! :edit, resource
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def update
|
|
46
|
+
authorize! :update, resource
|
|
47
|
+
@resource, is_success = current_model_service.update resource, params, current_ability
|
|
48
|
+
if is_success
|
|
49
|
+
redirect_to resources_show_path, notice: 'successfully updated'
|
|
50
|
+
else
|
|
51
|
+
flash.now[:error] = 'failed to update'
|
|
52
|
+
render :edit
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def destroy
|
|
57
|
+
authorize! :destroy, resource
|
|
58
|
+
if current_model_service.destroy resource, params
|
|
59
|
+
redirect_to resources_index_path, notice: 'successfully destroyed'
|
|
60
|
+
else
|
|
61
|
+
redirect_to resources_show_path, error: 'failed to destroy'
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
protected
|
|
66
|
+
def _prefixes
|
|
67
|
+
@_prefixes ||= begin
|
|
68
|
+
current_script = env['SCRIPT_NAME'].try(:[], 1..-1).presence
|
|
69
|
+
resource_path = current_resources_name.gsub '::', '/'
|
|
70
|
+
script_prefix = [ current_script, resource_path ].compact.join '/'
|
|
71
|
+
|
|
72
|
+
wallaby_path = Wallaby::ResourcesController.controller_path
|
|
73
|
+
suffix = %w( new create edit update ).include?(params[:action]) ? 'form' : params[:action]
|
|
74
|
+
|
|
75
|
+
minimal_prefixes = super[0..super.index(wallaby_path)]
|
|
76
|
+
if resource_path != controller_path
|
|
77
|
+
minimal_prefixes.unshift script_prefix
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
minimal_prefixes.map do |prefix|
|
|
81
|
+
[ "#{ prefix }/#{ suffix }", prefix ]
|
|
82
|
+
end.flatten
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def lookup_context
|
|
87
|
+
@_lookup_context ||= Wallaby::LookupContextWrapper.new super
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def resources_index_path(name = current_resources_name)
|
|
91
|
+
wallaby_engine.resources_path name
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def resources_show_path(name = current_resources_name, id = resource_id)
|
|
95
|
+
wallaby_engine.resource_path name, id
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def current_model_service
|
|
99
|
+
@current_model_service ||= Wallaby::ServicerFinder.find(current_model_class).new current_model_class, current_model_decorator
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def new_resource
|
|
103
|
+
@resource ||= current_model_service.new params
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
begin # helper methods
|
|
107
|
+
helper_method :resource_id, :resource, :collection, :current_model_decorator
|
|
108
|
+
|
|
109
|
+
def resource_id
|
|
110
|
+
params[:id]
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def collection
|
|
114
|
+
@collection ||= begin
|
|
115
|
+
page_number = params.delete :page
|
|
116
|
+
per_number = params.delete(:per) || 50
|
|
117
|
+
|
|
118
|
+
query = current_model_service.collection params, current_ability
|
|
119
|
+
query = query.page page_number if query.respond_to? :page
|
|
120
|
+
query = query.per per_number if query.respond_to? :per
|
|
121
|
+
query
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def resource
|
|
126
|
+
@resource ||= current_model_service.find resource_id, params
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def current_model_decorator
|
|
130
|
+
@current_model_decorator ||= Wallaby::DecoratorFinder.find_model current_model_class
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Wallaby
|
|
2
|
+
class SecureController < ApplicationController
|
|
3
|
+
helper Wallaby::SecureHelper
|
|
4
|
+
|
|
5
|
+
rescue_from Wallaby::NotAuthenticated, with: :not_authenticated
|
|
6
|
+
rescue_from CanCan::AccessDenied, with: :access_denied
|
|
7
|
+
helper_method :current_user
|
|
8
|
+
|
|
9
|
+
protected
|
|
10
|
+
def not_authenticated(exception)
|
|
11
|
+
@exception = exception
|
|
12
|
+
render 'wallaby/errors/not_authenticated', status: 401, layout: 'wallaby/error'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def access_denied(exception)
|
|
16
|
+
@exception = exception
|
|
17
|
+
render 'wallaby/errors/access_denied', status: 403
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def current_user
|
|
21
|
+
@current_user ||= if security_config.current_user? || !defined? super
|
|
22
|
+
instance_exec &security_config.current_user
|
|
23
|
+
else
|
|
24
|
+
super
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def authenticate_user!
|
|
29
|
+
authenticated = if security_config.authenticate? || !defined? super
|
|
30
|
+
instance_exec &security_config.authenticate
|
|
31
|
+
else
|
|
32
|
+
super
|
|
33
|
+
end
|
|
34
|
+
fail Wallaby::NotAuthenticated if !authenticated
|
|
35
|
+
true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def security_config
|
|
39
|
+
Wallaby.configuration.security
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|