jabysoft-base 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +180 -0
- data/LICENSE +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/app/assets/javascripts/jabysoft.js +1 -0
- data/app/assets/stylesheets/jabysoft.sass +42 -0
- data/app/controllers/base_controller.rb +111 -0
- data/app/helpers/base_helper.rb +63 -0
- data/app/helpers/devise_helper.rb +17 -0
- data/app/helpers/links_helper.rb +84 -0
- data/app/helpers/render_helper.rb +19 -0
- data/app/models/concerns/extension_model_behaviour.rb +16 -0
- data/app/models/concerns/searchable_behaviour.rb +47 -0
- data/app/views/layouts/admin.html.haml +46 -0
- data/app/views/layouts/application.html.haml +31 -0
- data/app/views/shared/_datepicker_field.html.haml +9 -0
- data/app/views/shared/_layout.html.haml +7 -0
- data/app/views/shared/_messages.html.haml +7 -0
- data/app/views/shared/_panel.html.haml +5 -0
- data/app/views/shared/_search_form.html.haml +6 -0
- data/app/views/shared/form/_error_messages.html.haml +6 -0
- data/app/views/shared/modals/_delete_confirmation.html.haml +17 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/locales/en.yml +35 -0
- data/config/locales/pt-BR.yml +35 -0
- data/jabysoft-base.gemspec +37 -0
- data/lib/generators/haml/scaffold/scaffold_generator.rb +36 -0
- data/lib/generators/jabysoft/setup/USAGE +19 -0
- data/lib/generators/jabysoft/setup/setup_generator.rb +57 -0
- data/lib/generators/jabysoft/setup/templates/.rspec +3 -0
- data/lib/generators/jabysoft/setup/templates/Gemfile +48 -0
- data/lib/generators/jabysoft/setup/templates/assets/stylesheets/base.scss +24 -0
- data/lib/generators/jabysoft/setup/templates/assets/stylesheets/bootstrap-variables.scss +875 -0
- data/lib/generators/jabysoft/setup/templates/layouts/admin.html.haml +46 -0
- data/lib/generators/jabysoft/setup/templates/layouts/application.html.haml +31 -0
- data/lib/generators/jabysoft/setup/templates/spec/rails_helper.rb +92 -0
- data/lib/generators/jabysoft/setup/templates/spec/spec_helper.rb +97 -0
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +167 -0
- data/lib/jabysoft/base/version.rb +5 -0
- data/lib/jabysoft/base.rb +16 -0
- data/lib/templates/haml/scaffold/_form.html.haml +14 -0
- data/lib/templates/haml/scaffold/_index.html.haml +25 -0
- data/lib/templates/haml/scaffold/edit.html.haml +1 -0
- data/lib/templates/haml/scaffold/index.html.haml +1 -0
- data/lib/templates/haml/scaffold/new.html.haml +1 -0
- data/lib/templates/haml/scaffold/show.html.haml +1 -0
- data/lib/templates/rails/scaffold_controller/controller.rb +29 -0
- data/lib/templates/rspec/scaffold/controller_spec.rb +148 -0
- data/lib/templates/rspec/scaffold/model_spec.rb +14 -0
- data/lib/templates/rspec/scaffold/request_spec.rb +10 -0
- data/lib/templates/rspec/scaffold/routing_spec.rb +44 -0
- data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/vendor/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/vendor/assets/images/.keep +0 -0
- data/vendor/assets/javascripts/bootstrap/affix.js +162 -0
- data/vendor/assets/javascripts/bootstrap/alert.js +94 -0
- data/vendor/assets/javascripts/bootstrap/button.js +120 -0
- data/vendor/assets/javascripts/bootstrap/carousel.js +237 -0
- data/vendor/assets/javascripts/bootstrap/collapse.js +211 -0
- data/vendor/assets/javascripts/bootstrap/dropdown.js +165 -0
- data/vendor/assets/javascripts/bootstrap/modal.js +337 -0
- data/vendor/assets/javascripts/bootstrap/popover.js +108 -0
- data/vendor/assets/javascripts/bootstrap/scrollspy.js +172 -0
- data/vendor/assets/javascripts/bootstrap/tab.js +155 -0
- data/vendor/assets/javascripts/bootstrap/tooltip.js +514 -0
- data/vendor/assets/javascripts/bootstrap/transition.js +59 -0
- data/vendor/assets/javascripts/bootstrap-sprockets.js +12 -0
- data/vendor/assets/javascripts/bootstrap.js +2363 -0
- data/vendor/assets/javascripts/bootstrap.min.js +7 -0
- data/vendor/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/vendor/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/vendor/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/vendor/assets/stylesheets/_bootstrap.scss +56 -0
- data/vendor/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/vendor/assets/stylesheets/bootstrap/_badges.scss +68 -0
- data/vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss +28 -0
- data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +244 -0
- data/vendor/assets/stylesheets/bootstrap/_buttons.scss +168 -0
- data/vendor/assets/stylesheets/bootstrap/_carousel.scss +270 -0
- data/vendor/assets/stylesheets/bootstrap/_close.scss +36 -0
- data/vendor/assets/stylesheets/bootstrap/_code.scss +69 -0
- data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +37 -0
- data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +216 -0
- data/vendor/assets/stylesheets/bootstrap/_forms.scss +617 -0
- data/vendor/assets/stylesheets/bootstrap/_glyphicons.scss +307 -0
- data/vendor/assets/stylesheets/bootstrap/_grid.scss +84 -0
- data/vendor/assets/stylesheets/bootstrap/_input-groups.scss +171 -0
- data/vendor/assets/stylesheets/bootstrap/_jumbotron.scss +54 -0
- data/vendor/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/vendor/assets/stylesheets/bootstrap/_list-group.scss +130 -0
- data/vendor/assets/stylesheets/bootstrap/_media.scss +66 -0
- data/vendor/assets/stylesheets/bootstrap/_mixins.scss +40 -0
- data/vendor/assets/stylesheets/bootstrap/_modals.scss +150 -0
- data/vendor/assets/stylesheets/bootstrap/_navbar.scss +662 -0
- data/vendor/assets/stylesheets/bootstrap/_navs.scss +242 -0
- data/vendor/assets/stylesheets/bootstrap/_normalize.scss +424 -0
- data/vendor/assets/stylesheets/bootstrap/_pager.scss +54 -0
- data/vendor/assets/stylesheets/bootstrap/_pagination.scss +89 -0
- data/vendor/assets/stylesheets/bootstrap/_panels.scss +271 -0
- data/vendor/assets/stylesheets/bootstrap/_popovers.scss +131 -0
- data/vendor/assets/stylesheets/bootstrap/_print.scss +101 -0
- data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/vendor/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/vendor/assets/stylesheets/bootstrap/_responsive-utilities.scss +179 -0
- data/vendor/assets/stylesheets/bootstrap/_scaffolding.scss +161 -0
- data/vendor/assets/stylesheets/bootstrap/_tables.scss +234 -0
- data/vendor/assets/stylesheets/bootstrap/_theme.scss +291 -0
- data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/vendor/assets/stylesheets/bootstrap/_tooltip.scss +101 -0
- data/vendor/assets/stylesheets/bootstrap/_type.scss +298 -0
- data/vendor/assets/stylesheets/bootstrap/_utilities.scss +55 -0
- data/vendor/assets/stylesheets/bootstrap/_variables.scss +874 -0
- data/vendor/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_background-variant.scss +12 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_buttons.scss +65 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_list-group.scss +32 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/vendor/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- metadata +308 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2f17919c27f0cc74b82f52ba6b387009d3ae59a7
|
4
|
+
data.tar.gz: 725159bc10e219a37759cd92fdb8142e26d17a8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b7e30299e7bcc7c911508dbba0402f86f18ca7ea80fbc8ab39a40377f7382fd6818546e5eb71ecf4684cbbccbe3b0d826b1bbdca167e6a86251501a984e328d7
|
7
|
+
data.tar.gz: 4f6e6ad160decbb0a6c34465d57ce09409c24c8bab481fd5d566e25f915894cb4e99af969d4ec867afba1e41a0c37150d6d69f06052f0bf6f8490e61716bd52a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at TODO: Write your email address. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jabysoft-base (0.1.1)
|
5
|
+
devise (~> 4.2)
|
6
|
+
factory_girl_rails (~> 4.7)
|
7
|
+
pry-byebug (~> 3.4)
|
8
|
+
rails (~> 5.0)
|
9
|
+
rake (~> 11.0)
|
10
|
+
rspec-rails (~> 3.5)
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
actioncable (5.0.0.1)
|
16
|
+
actionpack (= 5.0.0.1)
|
17
|
+
nio4r (~> 1.2)
|
18
|
+
websocket-driver (~> 0.6.1)
|
19
|
+
actionmailer (5.0.0.1)
|
20
|
+
actionpack (= 5.0.0.1)
|
21
|
+
actionview (= 5.0.0.1)
|
22
|
+
activejob (= 5.0.0.1)
|
23
|
+
mail (~> 2.5, >= 2.5.4)
|
24
|
+
rails-dom-testing (~> 2.0)
|
25
|
+
actionpack (5.0.0.1)
|
26
|
+
actionview (= 5.0.0.1)
|
27
|
+
activesupport (= 5.0.0.1)
|
28
|
+
rack (~> 2.0)
|
29
|
+
rack-test (~> 0.6.3)
|
30
|
+
rails-dom-testing (~> 2.0)
|
31
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
32
|
+
actionview (5.0.0.1)
|
33
|
+
activesupport (= 5.0.0.1)
|
34
|
+
builder (~> 3.1)
|
35
|
+
erubis (~> 2.7.0)
|
36
|
+
rails-dom-testing (~> 2.0)
|
37
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
38
|
+
activejob (5.0.0.1)
|
39
|
+
activesupport (= 5.0.0.1)
|
40
|
+
globalid (>= 0.3.6)
|
41
|
+
activemodel (5.0.0.1)
|
42
|
+
activesupport (= 5.0.0.1)
|
43
|
+
activerecord (5.0.0.1)
|
44
|
+
activemodel (= 5.0.0.1)
|
45
|
+
activesupport (= 5.0.0.1)
|
46
|
+
arel (~> 7.0)
|
47
|
+
activesupport (5.0.0.1)
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
|
+
i18n (~> 0.7)
|
50
|
+
minitest (~> 5.1)
|
51
|
+
tzinfo (~> 1.1)
|
52
|
+
arel (7.1.1)
|
53
|
+
bcrypt (3.1.11)
|
54
|
+
builder (3.2.2)
|
55
|
+
byebug (9.0.5)
|
56
|
+
coderay (1.1.1)
|
57
|
+
concurrent-ruby (1.0.2)
|
58
|
+
devise (4.2.0)
|
59
|
+
bcrypt (~> 3.0)
|
60
|
+
orm_adapter (~> 0.1)
|
61
|
+
railties (>= 4.1.0, < 5.1)
|
62
|
+
responders
|
63
|
+
warden (~> 1.2.3)
|
64
|
+
diff-lcs (1.2.5)
|
65
|
+
docile (1.1.5)
|
66
|
+
erubis (2.7.0)
|
67
|
+
factory_girl (4.7.0)
|
68
|
+
activesupport (>= 3.0.0)
|
69
|
+
factory_girl_rails (4.7.0)
|
70
|
+
factory_girl (~> 4.7.0)
|
71
|
+
railties (>= 3.0.0)
|
72
|
+
globalid (0.3.7)
|
73
|
+
activesupport (>= 4.1.0)
|
74
|
+
i18n (0.7.0)
|
75
|
+
json (2.0.2)
|
76
|
+
loofah (2.0.3)
|
77
|
+
nokogiri (>= 1.5.9)
|
78
|
+
mail (2.6.4)
|
79
|
+
mime-types (>= 1.16, < 4)
|
80
|
+
method_source (0.8.2)
|
81
|
+
mime-types (3.1)
|
82
|
+
mime-types-data (~> 3.2015)
|
83
|
+
mime-types-data (3.2016.0521)
|
84
|
+
mini_portile2 (2.1.0)
|
85
|
+
minitest (5.9.0)
|
86
|
+
nio4r (1.2.1)
|
87
|
+
nokogiri (1.6.8)
|
88
|
+
mini_portile2 (~> 2.1.0)
|
89
|
+
pkg-config (~> 1.1.7)
|
90
|
+
orm_adapter (0.5.0)
|
91
|
+
pkg-config (1.1.7)
|
92
|
+
pry (0.10.4)
|
93
|
+
coderay (~> 1.1.0)
|
94
|
+
method_source (~> 0.8.1)
|
95
|
+
slop (~> 3.4)
|
96
|
+
pry-byebug (3.4.0)
|
97
|
+
byebug (~> 9.0)
|
98
|
+
pry (~> 0.10)
|
99
|
+
rack (2.0.1)
|
100
|
+
rack-test (0.6.3)
|
101
|
+
rack (>= 1.0)
|
102
|
+
rails (5.0.0.1)
|
103
|
+
actioncable (= 5.0.0.1)
|
104
|
+
actionmailer (= 5.0.0.1)
|
105
|
+
actionpack (= 5.0.0.1)
|
106
|
+
actionview (= 5.0.0.1)
|
107
|
+
activejob (= 5.0.0.1)
|
108
|
+
activemodel (= 5.0.0.1)
|
109
|
+
activerecord (= 5.0.0.1)
|
110
|
+
activesupport (= 5.0.0.1)
|
111
|
+
bundler (>= 1.3.0, < 2.0)
|
112
|
+
railties (= 5.0.0.1)
|
113
|
+
sprockets-rails (>= 2.0.0)
|
114
|
+
rails-dom-testing (2.0.1)
|
115
|
+
activesupport (>= 4.2.0, < 6.0)
|
116
|
+
nokogiri (~> 1.6.0)
|
117
|
+
rails-html-sanitizer (1.0.3)
|
118
|
+
loofah (~> 2.0)
|
119
|
+
railties (5.0.0.1)
|
120
|
+
actionpack (= 5.0.0.1)
|
121
|
+
activesupport (= 5.0.0.1)
|
122
|
+
method_source
|
123
|
+
rake (>= 0.8.7)
|
124
|
+
thor (>= 0.18.1, < 2.0)
|
125
|
+
rake (11.2.2)
|
126
|
+
responders (2.2.0)
|
127
|
+
railties (>= 4.2.0, < 5.1)
|
128
|
+
rspec-core (3.5.2)
|
129
|
+
rspec-support (~> 3.5.0)
|
130
|
+
rspec-expectations (3.5.0)
|
131
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
132
|
+
rspec-support (~> 3.5.0)
|
133
|
+
rspec-mocks (3.5.0)
|
134
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
135
|
+
rspec-support (~> 3.5.0)
|
136
|
+
rspec-rails (3.5.1)
|
137
|
+
actionpack (>= 3.0)
|
138
|
+
activesupport (>= 3.0)
|
139
|
+
railties (>= 3.0)
|
140
|
+
rspec-core (~> 3.5.0)
|
141
|
+
rspec-expectations (~> 3.5.0)
|
142
|
+
rspec-mocks (~> 3.5.0)
|
143
|
+
rspec-support (~> 3.5.0)
|
144
|
+
rspec-support (3.5.0)
|
145
|
+
simplecov (0.12.0)
|
146
|
+
docile (~> 1.1.0)
|
147
|
+
json (>= 1.8, < 3)
|
148
|
+
simplecov-html (~> 0.10.0)
|
149
|
+
simplecov-html (0.10.0)
|
150
|
+
slop (3.6.0)
|
151
|
+
sprockets (3.7.0)
|
152
|
+
concurrent-ruby (~> 1.0)
|
153
|
+
rack (> 1, < 3)
|
154
|
+
sprockets-rails (3.1.1)
|
155
|
+
actionpack (>= 4.0)
|
156
|
+
activesupport (>= 4.0)
|
157
|
+
sprockets (>= 3.0.0)
|
158
|
+
thor (0.19.1)
|
159
|
+
thread_safe (0.3.5)
|
160
|
+
tzinfo (1.2.2)
|
161
|
+
thread_safe (~> 0.1)
|
162
|
+
warden (1.2.6)
|
163
|
+
rack (>= 1.0)
|
164
|
+
websocket-driver (0.6.4)
|
165
|
+
websocket-extensions (>= 0.1.0)
|
166
|
+
websocket-extensions (0.1.2)
|
167
|
+
|
168
|
+
PLATFORMS
|
169
|
+
ruby
|
170
|
+
|
171
|
+
DEPENDENCIES
|
172
|
+
bundler (~> 1.12)
|
173
|
+
jabysoft-base!
|
174
|
+
simplecov (~> 0.12.0)
|
175
|
+
|
176
|
+
RUBY VERSION
|
177
|
+
ruby 2.3.1p112
|
178
|
+
|
179
|
+
BUNDLED WITH
|
180
|
+
1.12.1
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Jabysoft
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Jabysoft-base
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/jabysoft-base.svg)](https://badge.fury.io/rb/jabysoft-base)
|
3
|
+
|
4
|
+
Set of utilities to build rails applications with style.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'jabysoft-base'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install jabysoft-base
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Execute jabysoft:setup to initialize your Rails project.
|
25
|
+
|
26
|
+
$ rails generate jabysoft:setup
|
27
|
+
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jabysoft-base. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
//= require bootstrap-sprockets
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// Import Bootstrap Compass integration
|
2
|
+
@import "bootstrap-compass"
|
3
|
+
// Import custom Bootstrap variables
|
4
|
+
@import "bootstrap-variables"
|
5
|
+
// sprockets
|
6
|
+
@import "bootstrap-sprockets"
|
7
|
+
// Import Bootstrap for Sass
|
8
|
+
@import "bootstrap"
|
9
|
+
|
10
|
+
body
|
11
|
+
padding-top: $navbar-height + 10px
|
12
|
+
|
13
|
+
.page-header
|
14
|
+
a.btn
|
15
|
+
float: right
|
16
|
+
|
17
|
+
a.btn + a.btn
|
18
|
+
margin-right: 8px
|
19
|
+
|
20
|
+
input[type="radio"], input[type="checkbox"]
|
21
|
+
width: initial
|
22
|
+
height: initial
|
23
|
+
margin-top: 7px
|
24
|
+
|
25
|
+
|
26
|
+
.field_with_errors
|
27
|
+
@extend .has-error !optional
|
28
|
+
|
29
|
+
.search-field
|
30
|
+
width: 30%
|
31
|
+
|
32
|
+
.alert-notice
|
33
|
+
color: #3c763d
|
34
|
+
background-color: #dff0d8
|
35
|
+
border-color: #d6e9c6
|
36
|
+
|
37
|
+
.alert-notice hr
|
38
|
+
border-top-color: #c9e2b3
|
39
|
+
|
40
|
+
.alert-notice .alert-link
|
41
|
+
color: #2b542c
|
42
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
class BaseController < ApplicationController
|
2
|
+
# This class works as a Restfull CRUD Controller to provide the same
|
3
|
+
# crud functions to all subcontrollers
|
4
|
+
protect_from_forgery with: :exception
|
5
|
+
respond_to :json, :html, :xml
|
6
|
+
before_action :set_resource, only: [:show, :edit, :update, :destroy]
|
7
|
+
before_action :disable_edition, only: [:show]
|
8
|
+
before_action :load, except: [:index, :destroy]
|
9
|
+
|
10
|
+
PER_PAGE = 5
|
11
|
+
|
12
|
+
def index
|
13
|
+
if included_attributes
|
14
|
+
instance_variable_set(collection_instance_variable, model.includes(included_attributes).paginate(page: params[:page], per_page: PER_PAGE))
|
15
|
+
else
|
16
|
+
instance_variable_set(collection_instance_variable, model.paginate(page: params[:page], per_page: PER_PAGE))
|
17
|
+
end
|
18
|
+
search
|
19
|
+
respond_with collection_variable
|
20
|
+
end
|
21
|
+
|
22
|
+
def show
|
23
|
+
end
|
24
|
+
|
25
|
+
def new
|
26
|
+
instance_variable_set(instance_variable, model.new)
|
27
|
+
end
|
28
|
+
|
29
|
+
def edit
|
30
|
+
end
|
31
|
+
|
32
|
+
def create
|
33
|
+
instance_variable_set(instance_variable, model.new(permit_params))
|
34
|
+
flash[:success] = I18n.t('created', model: model.model_name.human) if variable.save
|
35
|
+
responds
|
36
|
+
end
|
37
|
+
|
38
|
+
def update
|
39
|
+
flash[:success] = I18n.t('updated', model: model.model_name.human) if variable.update(permit_params)
|
40
|
+
responds
|
41
|
+
end
|
42
|
+
|
43
|
+
def destroy
|
44
|
+
flash[:success] = I18n.t('destroyed', model: model.model_name.human) if variable.destroy
|
45
|
+
redirect_to index_path
|
46
|
+
end
|
47
|
+
|
48
|
+
def template_not_found
|
49
|
+
redirect_to '/404.html'
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def search
|
54
|
+
return unless params[:search].present?
|
55
|
+
result = collection_variable.search(params[:search])
|
56
|
+
instance_variable_set(collection_instance_variable, result)
|
57
|
+
end
|
58
|
+
|
59
|
+
def variable
|
60
|
+
instance_variable_get(instance_variable)
|
61
|
+
end
|
62
|
+
|
63
|
+
def collection_variable
|
64
|
+
instance_variable_get(collection_instance_variable)
|
65
|
+
end
|
66
|
+
|
67
|
+
def controller_namespace
|
68
|
+
params[:controller].split('/').first if params[:controller].include?('/')
|
69
|
+
end
|
70
|
+
|
71
|
+
def instance_variable
|
72
|
+
"@#{model.name.underscore}"
|
73
|
+
end
|
74
|
+
|
75
|
+
def collection_instance_variable
|
76
|
+
"@#{model.name.underscore.pluralize}"
|
77
|
+
end
|
78
|
+
|
79
|
+
def set_resource
|
80
|
+
instance_variable_set(instance_variable, model.find(params[:id]))
|
81
|
+
end
|
82
|
+
|
83
|
+
def responds
|
84
|
+
if controller_namespace
|
85
|
+
respond_with controller_namespace.to_sym, variable
|
86
|
+
else
|
87
|
+
respond_with variable
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# to be used by subclasses
|
92
|
+
def included_attributes
|
93
|
+
nil
|
94
|
+
end
|
95
|
+
|
96
|
+
def load
|
97
|
+
end
|
98
|
+
|
99
|
+
protected
|
100
|
+
def model
|
101
|
+
params[:controller].camelize.singularize.constantize if params[:controller]
|
102
|
+
end
|
103
|
+
|
104
|
+
def index_path
|
105
|
+
Rails.application.routes.url_helpers.send("#{params[:controller].camelize.underscore}_path")
|
106
|
+
end
|
107
|
+
|
108
|
+
def disable_edition
|
109
|
+
@readonly = true
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module BaseHelper
|
2
|
+
|
3
|
+
def translate_attribute(model, attribute = nil, options = {})
|
4
|
+
return model.human_attribute_name(attribute) if attribute
|
5
|
+
if options.any?
|
6
|
+
return model.model_name.human.pluralize if options[:pluralize]
|
7
|
+
else
|
8
|
+
model.model_name.human
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
alias_method :ta, :translate_attribute
|
13
|
+
|
14
|
+
def edit_url_for(model)
|
15
|
+
if model.id
|
16
|
+
path = "edit_#{model.model_name.to_s.underscore}_path"
|
17
|
+
Rails.application.routes.url_helpers.send(path.to_sym, id: model.id)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit_admin_url_for(model)
|
22
|
+
if model.id
|
23
|
+
path = "edit_admin_#{model.model_name.to_s.underscore}_path"
|
24
|
+
Rails.application.routes.url_helpers.send(path.to_sym, id: model.id)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def remote_request(type, path, params={}, target_tag_id = nil)
|
29
|
+
if target_tag_id
|
30
|
+
"$.#{type}('#{path}',
|
31
|
+
{ #{collect_request_params(params)} },
|
32
|
+
function(data) {$('##{target_tag_id}').html(data);}
|
33
|
+
);"
|
34
|
+
else
|
35
|
+
"$.#{type}('#{path}',
|
36
|
+
{ #{collect_request_params(params)} }
|
37
|
+
);"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def boolean_image(boolean)
|
42
|
+
if boolean
|
43
|
+
"<span class='glyphicon glyphicon-ok green'>".html_safe
|
44
|
+
else
|
45
|
+
"<span class='glyphicon glyphicon-remove red'>".html_safe
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def short_date(date)
|
50
|
+
return "" unless date
|
51
|
+
l(date, format: :short)
|
52
|
+
end
|
53
|
+
|
54
|
+
def price(value)
|
55
|
+
number_to_currency(value)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
def collect_request_params(params)
|
60
|
+
params.collect { |param| "#{param[0]}: #{param[1]}" }.join(", ")
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module DeviseHelper
|
2
|
+
|
3
|
+
def devise_error_messages!
|
4
|
+
return '' if resource.errors.empty?
|
5
|
+
|
6
|
+
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
|
7
|
+
html = <<-HTML
|
8
|
+
<div class="alert alert-error alert-danger"> <button type="button"
|
9
|
+
class="close" data-dismiss="alert">x</button>
|
10
|
+
#{messages}
|
11
|
+
</div>
|
12
|
+
HTML
|
13
|
+
|
14
|
+
html.html_safe
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module LinksHelper
|
2
|
+
|
3
|
+
def link_to_new(model, url, html_options = {})
|
4
|
+
button_class = 'btn btn-default btn-lg'
|
5
|
+
html_options.reverse_merge!(class: button_class)
|
6
|
+
authorized = authorize_button :create, model, html_options, button_class if model.present?
|
7
|
+
if authorized
|
8
|
+
link_to t('new', model: model.model_name.human), url, html_options
|
9
|
+
else
|
10
|
+
content_tag(:div, class: 'tooltip-wrapper', "data-title" => I18n.t('not_authorized')) do
|
11
|
+
link_to t('new', model: model.model_name.human), url, html_options
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def link_to_edit(model, url, html_options = {})
|
17
|
+
button_class = 'btn btn-default btn-sm'
|
18
|
+
html_options.reverse_merge!(class: button_class)
|
19
|
+
authorized = authorize_button :update, model, html_options, button_class if model.present?
|
20
|
+
if authorized
|
21
|
+
link_to t('edit'), url, html_options
|
22
|
+
else
|
23
|
+
content_tag(:div, class: 'tooltip-wrapper', "data-title" => I18n.t('not_authorized')) do
|
24
|
+
link_to t('edit'), url, html_options
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def link_to_show(model, url, html_options = {})
|
30
|
+
button_class = 'btn btn-default btn-sm'
|
31
|
+
html_options.reverse_merge!(class: button_class)
|
32
|
+
authorized = authorize_button :read, model, html_options, button_class if model.present?
|
33
|
+
if authorized
|
34
|
+
link_to t('show'), url, html_options
|
35
|
+
else
|
36
|
+
content_tag(:div, class: 'tooltip-wrapper', "data-title" => I18n.t('not_authorized')) do
|
37
|
+
link_to t('show'), url, html_options
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def link_to_destroy(model, url, html_options = {})
|
43
|
+
button_class = 'btn btn-danger glyphicon glyphicon-trash'
|
44
|
+
html_options.reverse_merge!({class: button_class, "data-target" => "#delete-confirmation", "data-toggle" => "modal"})
|
45
|
+
authorized = authorize_button :destroy, model, html_options, button_class if model.present?
|
46
|
+
if authorized
|
47
|
+
link_to '', url, html_options
|
48
|
+
else
|
49
|
+
content_tag(:div, class: 'tooltip-wrapper', "data-title" => I18n.t('not_authorized')) do
|
50
|
+
link_to t('destroy'), url, html_options
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def link_to_back(url, html_options = {})
|
56
|
+
html_options.reverse_merge!(class: 'btn btn-default')
|
57
|
+
link_to t('back'), url, html_options
|
58
|
+
end
|
59
|
+
|
60
|
+
def submit_or_edit_button(form, edit_path, is_edition)
|
61
|
+
if is_edition && params[:action] != 'new'
|
62
|
+
link_to_edit form.object, edit_path, class: "btn btn-primary btn-lg"
|
63
|
+
else
|
64
|
+
submit_button(form)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def submit_button(form, value = nil)
|
69
|
+
if value
|
70
|
+
form.submit value, class: "btn btn-primary btn-lg"
|
71
|
+
else
|
72
|
+
form.submit t('save'), class: "btn btn-primary btn-lg"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
def authorize_button(action, model, options, button_class)
|
78
|
+
return true #FIXME - to be removed
|
79
|
+
unless can? action, model
|
80
|
+
options.merge!(class: button_class+" disabled ") and return false
|
81
|
+
end
|
82
|
+
true
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RenderHelper
|
2
|
+
|
3
|
+
def render_flash_messages
|
4
|
+
render 'shared/messages'
|
5
|
+
end
|
6
|
+
|
7
|
+
def error_messages_for(resource)
|
8
|
+
render partial: 'shared/form/error_messages', locals: { resource: resource }
|
9
|
+
end
|
10
|
+
|
11
|
+
def datepicker_field_for(form, field)
|
12
|
+
render 'shared/datepicker_field', f: form, field: field
|
13
|
+
end
|
14
|
+
|
15
|
+
def search_form(url)
|
16
|
+
render 'shared/search_form', url: url
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ExtensionModelBehaviour
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
# It gives model additional scope active and scoped.
|
4
|
+
|
5
|
+
included do
|
6
|
+
scope :active, -> { where(active: true) }
|
7
|
+
scope :scoped, -> { select(:id, scoped_attribute) }
|
8
|
+
|
9
|
+
private
|
10
|
+
def self.scoped_attribute
|
11
|
+
return :code if column_names.include? 'code'
|
12
|
+
:name
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|