bootstrap4_rails_components 0.1.0
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.md +362 -0
- data/Rakefile +23 -0
- data/app/assets/config/bootstrap4_rails_components_manifest.js +3 -0
- data/app/assets/javascripts/bootstrap4_rails_components/application.js +8 -0
- data/app/assets/javascripts/bootstrap4_rails_components/vendor/tooltips.js +42 -0
- data/app/assets/stylesheets/bootstrap4_rails_components/bootstrap/application.scss +2 -0
- data/app/controllers/bootstrap4_rails_components/application_controller.rb +5 -0
- data/app/helpers/bootstrap4_rails_components/application_helper.rb +38 -0
- data/app/models/bootstrap4_rails_components/application_record.rb +5 -0
- data/config/initializers/web_app_manifest.rb +3 -0
- data/config/locales/en.yml +63 -0
- data/config/routes.rb +2 -0
- data/config/spring.rb +1 -0
- data/lib/bootstrap4_rails_components.rb +75 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/alert.rb +52 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/badge.rb +39 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/base.rb +151 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/breadcrumb.rb +23 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/breadcrumb_item.rb +28 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/button.rb +74 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/button_group.rb +36 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/button_toolbar.rb +21 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/card.rb +81 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/card_body.rb +15 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/card_footer.rb +15 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/card_header.rb +35 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/card_image.rb +33 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/card_image_overlay.rb +46 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/carousel.rb +57 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/carousel_caption.rb +34 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/carousel_control.rb +73 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/carousel_indicators.rb +54 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/carousel_item.rb +49 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/collapse.rb +32 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/dropdown.rb +51 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/dropdown_divider.rb +19 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/dropdown_header.rb +23 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/dropdown_item.rb +41 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/dropdown_menu.rb +32 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/dropdown_toggle.rb +82 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/embed.rb +80 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/form.rb +13 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/input_group.rb +13 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/jumbotron.rb +13 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/list_group.rb +39 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/list_group_item.rb +69 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/media.rb +15 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/media_body.rb +15 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/media_object.rb +23 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/modal.rb +66 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/modal_body.rb +16 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/modal_footer.rb +16 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/modal_header.rb +37 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/nav.rb +71 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/nav_item.rb +103 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/nav_link.rb +62 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/navbar.rb +97 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/navbar_brand.rb +25 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/navbar_nav.rb +48 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/navbar_text.rb +21 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/navbar_toggler.rb +38 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/page_item.rb +66 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/pagination.rb +30 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/popover.rb +12 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/progress.rb +44 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/progress_bar.rb +51 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/tab_content.rb +15 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/tab_pane.rb +49 -0
- data/lib/bootstrap4_rails_components/bootstrap/components/table.rb +17 -0
- data/lib/bootstrap4_rails_components/bootstrap/readme.md +1 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/activatable.rb +32 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/alignable.rb +33 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/collapse_toggleable.rb +35 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/collapsible.rb +42 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/disableable.rb +49 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/dismissible.rb +24 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/dropdown_directionable.rb +40 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/headable.rb +20 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/modalable.rb +104 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/progressable.rb +42 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/remotable.rb +24 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/sizable.rb +40 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/themeable.rb +51 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/titleable.rb +20 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/tooltipable.rb +95 -0
- data/lib/bootstrap4_rails_components/bootstrap/utilities/wrappable.rb +48 -0
- data/lib/bootstrap4_rails_components/engine.rb +38 -0
- data/lib/bootstrap4_rails_components/ui/base.rb +42 -0
- data/lib/bootstrap4_rails_components/ui/bootstrap.rb +44 -0
- data/lib/bootstrap4_rails_components/ui/utilities.rb +10 -0
- data/lib/bootstrap4_rails_components/ui/utilities/initializer.rb +88 -0
- data/lib/bootstrap4_rails_components/version.rb +5 -0
- metadata +372 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d95fa97be82dda0504b17ded2956922b301d76b9a2552f738fb00caff3bed0a4
|
4
|
+
data.tar.gz: c559d3b5e39ccb4a236807836076eb1ded7c0784317c9952df0267d7bf046b47
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1db08296203374a1abeaa47bd78edb59ff4c08ea89388261a7c2daabf3bc3374da2a7e0378cd97f1e980000a5939a33cae7366827ce9b939cf88dde142c74718
|
7
|
+
data.tar.gz: e8dda339f0e98d5266928aff9fc5172903f13ef1e9d1708cb4cdef9846bee57faa73b276de04f6271e9390a829a4ee6205cdbef6643693626307dcf2fba9e7ac
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 jonathanroehm
|
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/README.md
ADDED
@@ -0,0 +1,362 @@
|
|
1
|
+
## Note: this document is out of date and needs to be re-written. This gem is not yet ready for use.
|
2
|
+
|
3
|
+
# Network for Good's Design System for Ruby on Rails
|
4
|
+
The authoritative resource for the Network for Good front-end UI, empowered by the NFG Design System.
|
5
|
+
|
6
|
+
Note: the readme documentation is a little out of date and will be updated with accurate info soon (note added on Jan. 19, 2019)
|
7
|
+
|
8
|
+
[Jump to development / setting up the gem locally](https://github.com/network-for-good/bootstrap4_rails_components/blob/master/README.md#local-development--accessing-documentation)
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'bootstrap4_rails_components'
|
12
|
+
```
|
13
|
+
|
14
|
+
NFG UX & UI team_ (J&K) are excited to bring you... the *Network For Good design system* gem or: `bootstrap4_rails_components` gem. This bad boy is an all encompassing one-stop shop for everything front-end for Network for Good products.
|
15
|
+
|
16
|
+
This gem is an organic, evolving and ongoing work that is the loving result of 4+ years of study, practice, implementation, planning, drafting and good ol' sweat. After a dozen code drafts, a fully realized Sketch design system suite, and the canvas to work on... we're building a robust design system framework.
|
17
|
+
|
18
|
+
With this gem, you can stand up a brand new rails app and it will seamlessly, from day 1, look, feel and be a Network for Good product. *Huzzah*
|
19
|
+
|
20
|
+
## Accessing Component Code Examples & Documentation:
|
21
|
+
To review the documentation for the components, get code samples and browse the library, follow the instructions at the bottom for getting the gem setup locally. It has its own `test_app` so the documentation is hosted there and the gem doesn't need to be added to a seperate parent app (unless you want to). We intend to get this online in its own dedicated space... until then, that's your best bet for browsing docs.
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
### Include the gem in your Gemfile
|
26
|
+
```ruby
|
27
|
+
gem 'bootstrap4_rails_components'
|
28
|
+
```
|
29
|
+
|
30
|
+
### Import & Require the gem's assets
|
31
|
+
_NOTE:_ This gem has not taken over ownership of JS from Evo yet. Some styles have been brought over for documentation visual check purposes (the core styling is in place), but it's not fully brought over yet. This includes javascript plugins, etc. To use `bootstrap4_rails_components` images, note the special requirements:
|
32
|
+
|
33
|
+
In `application.scss` add your pertinent stylesheet suite based on whatever context you're building an interface. These are currently two categories: `admin` and `public` (and `email`)
|
34
|
+
|
35
|
+
#### SCSS Application stylesheets
|
36
|
+
*Admin* stylesheets should be `@imported` in your pertinent application.scss file:
|
37
|
+
```scss
|
38
|
+
@import 'bootstrap4_rails_components/network_for_good/admin/application';
|
39
|
+
```
|
40
|
+
|
41
|
+
*Public* stylesheets should be `@imported` in your pertinent application.scss file:
|
42
|
+
```scss
|
43
|
+
@import 'bootstrap4_rails_components/network_for_good/public/application';
|
44
|
+
```
|
45
|
+
|
46
|
+
*Email* stylesheeets should be `@imported` as above:
|
47
|
+
```scss
|
48
|
+
@import 'bootstrap4_rails_components/network_for_good/email/application';
|
49
|
+
```
|
50
|
+
|
51
|
+
#### Javascript
|
52
|
+
Currently, there is only one javascript library. This will likely change, but the current setup is as follows:
|
53
|
+
|
54
|
+
Javascript should be `//= required` in your pertinent application.js file:
|
55
|
+
```js
|
56
|
+
//= require bootstrap4_rails_components/application
|
57
|
+
```
|
58
|
+
|
59
|
+
# Usage
|
60
|
+
|
61
|
+
## Network for Good design system components
|
62
|
+
|
63
|
+
This gem allows you to add any NFG design component to your haml view at command. You can build one line, all inclusive components and build out high level pre-designed and pre-configured context-specific components.
|
64
|
+
|
65
|
+
Components also come with traits. Traits are stackable and overwriteable. Traits are meaningful symbols added as the first array of arguments on your component. Read more about traits below. The key value of traits: it provides pre-set and pre-designed components out of the box so that you don't need to go through the monotonous task of adding theme colors, sizes, headlines, etc every time you need to use that component. *Handy*
|
66
|
+
|
67
|
+
All components accept the same attributes when appropriate. This list will expand but here is a sample:
|
68
|
+
|
69
|
+
* All html attributes (`id`, `data`, `aria`, `required`, if it's an attribute, it's available)
|
70
|
+
* `body: 'Inserted content into the obvious content space for the component'`
|
71
|
+
* `title: 'For modals and tiles'`
|
72
|
+
* `headline: 'For components with headlines like media objects'`
|
73
|
+
* `:collapsible` and `:collapsed`
|
74
|
+
* more to come...
|
75
|
+
* `tooltip: 'My tooltip text'` is available on many components (that would make sense to have tooltips) and will automatically apply a tooltip to the component
|
76
|
+
|
77
|
+
|
78
|
+
Examples:
|
79
|
+
```haml
|
80
|
+
// Produce a styled, pre-designed submit button for your form on the fly
|
81
|
+
= ui.bootstrap :button, :submit
|
82
|
+
|
83
|
+
// Is the traited / predesigned equivalent of...
|
84
|
+
= ui.bootstrap :button, as: :button, type: 'submit', icon: 'chevron-right', body: 'Save & Exit', theme: :primary, disable_with: "<i class='fa fa-spinner fa-spin mr-1'></i> Saving..."
|
85
|
+
|
86
|
+
// Build your own button
|
87
|
+
= ui.bootstrap :button, :danger, data: { describe: 'delete-button' } do
|
88
|
+
= ui.bootstrap :icon, 'trash', class: 'mr-1', text: 'Delete Row'
|
89
|
+
```
|
90
|
+
|
91
|
+
#### Trait details
|
92
|
+
Traits are designed to allow you to speedily build components, or pre-design complex components using meaningful symbols.
|
93
|
+
|
94
|
+
Traits are pre-designed / pre-created in the gem (the process / system for this is getting an update after some very cool conversations recently, but the implementation on the front end likely won't be changing)
|
95
|
+
|
96
|
+
We use two general "kinds" of traits (this is being examined in more detail, but the usage is the same).
|
97
|
+
|
98
|
+
The first "kind" of trait is "speedy" versions of options. The second "kind" of trait are more like a combination of options.
|
99
|
+
|
100
|
+
We do this, for example, with an error alert, which then pre-supplies a set of options...
|
101
|
+
|
102
|
+
```haml
|
103
|
+
= ui.bootstrap :alert, :error
|
104
|
+
|
105
|
+
// is the pre-designed error alert that looks like this:
|
106
|
+
= ui.bootstrap :alert, :dismissible, theme: :danger, heading: 'Oops!', body: 'There appears to be someting wrong with your submission! Please take a look...'
|
107
|
+
```
|
108
|
+
|
109
|
+
The second kind of trait is the speedy version (described above).
|
110
|
+
|
111
|
+
Here are some implementation examples of speedy traits:
|
112
|
+
* For components that are "themeable" (alerts, buttons, etc) and are designated as such, automatically get a theme trait:
|
113
|
+
* `ui.bootstrap :button, :primary` is a speedy way to write `ui.bootstrap :button, theme: :primary`
|
114
|
+
* `:primary`
|
115
|
+
* `:secondary`
|
116
|
+
* `:success`
|
117
|
+
* `:danger`
|
118
|
+
* `:warning`
|
119
|
+
* `:info`
|
120
|
+
* `:light`
|
121
|
+
* `:dark`
|
122
|
+
* For components that are resizable (buttons, modals, etc)
|
123
|
+
* `ui.bootstrap :button, :large` is the same as `ui.bootstrap :button, size: :large`
|
124
|
+
* `:lg`
|
125
|
+
* `:large`
|
126
|
+
* `:sm`
|
127
|
+
* `:small`
|
128
|
+
* For components that are collapsible (Tiles for example)
|
129
|
+
* `ui.bootstrap :tile, :collapsible` is the same as `ui.bootstrap :tile, collapsed: false`
|
130
|
+
* `ui.bootstrap :tile, :collapsed` is the same as `ui.bootstrap :tile, collapsed: true`
|
131
|
+
* `:collapsible`
|
132
|
+
* `:collapsed`
|
133
|
+
* And more... to be documented
|
134
|
+
|
135
|
+
More soon...
|
136
|
+
|
137
|
+
### NFG Components
|
138
|
+
Syntax: `= ui.bootstrap :component_name, optional_traits, options`
|
139
|
+
|
140
|
+
Components are organized into 4 major groupings. Currently 3 of the groupings are available through this gem.
|
141
|
+
|
142
|
+
#### Foundations
|
143
|
+
The basic essentials that form elements
|
144
|
+
* `:color`
|
145
|
+
* `:icon`
|
146
|
+
* `:image`
|
147
|
+
* `:input`
|
148
|
+
* `:grid`
|
149
|
+
* `:typeface`
|
150
|
+
|
151
|
+
#### Elements
|
152
|
+
The main component blocks, made up of foundation components.
|
153
|
+
|
154
|
+
* `:activity`
|
155
|
+
* `:alert`
|
156
|
+
* `:badge`
|
157
|
+
* `:breadcrumb`
|
158
|
+
* `:breadcrumb_item`
|
159
|
+
* `:button`
|
160
|
+
* `:chart`
|
161
|
+
* `:dropdown`
|
162
|
+
* `:form_control`
|
163
|
+
* `:input_group`
|
164
|
+
* `:key`
|
165
|
+
* `:list_group_item`
|
166
|
+
* `:loader`
|
167
|
+
* `:media_object`
|
168
|
+
* `:nav`
|
169
|
+
* `:popover`
|
170
|
+
* `:progress_bar`
|
171
|
+
* `:slat`
|
172
|
+
* `:stat`
|
173
|
+
* `:table`
|
174
|
+
* `:task`
|
175
|
+
* `:tooltip`
|
176
|
+
|
177
|
+
#### Patterns
|
178
|
+
Groupings of elements to create rich interfaces. For example, an `:activity_feed` (one of the patterns) is made up many `:activity`
|
179
|
+
|
180
|
+
* `:activity_feed`
|
181
|
+
* `:button_group`
|
182
|
+
* `:card`
|
183
|
+
* `:carousel`
|
184
|
+
* `:empty_state`
|
185
|
+
* `:filter_bar`
|
186
|
+
* `:form_group`
|
187
|
+
* `:graph`
|
188
|
+
* `:jumbotron`
|
189
|
+
* `:list_group`
|
190
|
+
* `:media`
|
191
|
+
* `:modal`
|
192
|
+
* `:navbar`
|
193
|
+
* `:slat_list`
|
194
|
+
* `:task_list`
|
195
|
+
* *Tiles*
|
196
|
+
* `:tile`
|
197
|
+
* `:tile_body`
|
198
|
+
* `:tile_header`
|
199
|
+
* `:tile_section`
|
200
|
+
|
201
|
+
### Component traits for design system components
|
202
|
+
*Coming soon*
|
203
|
+
|
204
|
+
## Bootstrap design system components
|
205
|
+
|
206
|
+
Utilize all bootstrap4 components, coded to strict bootstrap standards via a similar method: `= ui.bootstrap :my_component, options...`
|
207
|
+
|
208
|
+
*Note: while the names of bootstrap components and network for good components may be similar or identical (ex.: the design system has an `:alert` as does bootstrap), do not use bootstrap components on the front-end. _Only use `ui.bootstrap` components for front-end code._ Great care has been taken to ensure that any component you'd expect to have from bootstrap4 is made available by an appropriately coded and designed design system component*
|
209
|
+
|
210
|
+
The bootstrap side of this will eventually be isolated into its own gem. Until then, it lives within the `bootstrap4_rails_components` gem.
|
211
|
+
|
212
|
+
```haml
|
213
|
+
// An example alert
|
214
|
+
= ui.bootstrap :alert, theme: :danger, dismissible: false, headline: 'Oh snap!', body: 'The alert body content'
|
215
|
+
|
216
|
+
// Build your own button
|
217
|
+
= ui.bootstrap :button, theme: :danger, data: { describe: 'delete-button' } do
|
218
|
+
= fa_icon 'trash', class: 'mr-1', text: 'Delete Row'
|
219
|
+
```
|
220
|
+
|
221
|
+
#### Bootstrap components
|
222
|
+
Syntax: `= ui.bootstrap :component_name, options`
|
223
|
+
|
224
|
+
* `:alert`
|
225
|
+
* `:badge`
|
226
|
+
* `:breadcrumb`
|
227
|
+
* `:breadcrumb_item`
|
228
|
+
* `:button`
|
229
|
+
* `:button_group`
|
230
|
+
* `:card`
|
231
|
+
* `:carousel`
|
232
|
+
* `:dropdown`
|
233
|
+
* `:form`
|
234
|
+
* `:input_group`
|
235
|
+
* `:jumbotron`
|
236
|
+
* `:list_group`
|
237
|
+
* `:list_group_item`
|
238
|
+
* `:media_object`
|
239
|
+
* `:modal`
|
240
|
+
* `:nav`
|
241
|
+
* `:navbar`
|
242
|
+
* `:pagination`
|
243
|
+
* `:popover`
|
244
|
+
* `:progress`
|
245
|
+
* `:table`
|
246
|
+
* `:tooltip`
|
247
|
+
|
248
|
+
## Local development & accessing documentation
|
249
|
+
|
250
|
+
1. Clone repo:
|
251
|
+
|
252
|
+
```
|
253
|
+
$ git clone https://github.com/network-for-good/bootstrap4_rails_components.git
|
254
|
+
```
|
255
|
+
|
256
|
+
2. Bundle gems
|
257
|
+
|
258
|
+
```
|
259
|
+
$ bundle exec bundle install
|
260
|
+
```
|
261
|
+
|
262
|
+
### To test the gem locally on your host app
|
263
|
+
See this gist: https://gist.github.com/jonathanroehm/70749fb6f29c61d0af7c7ed9cc233f79
|
264
|
+
|
265
|
+
All done!
|
266
|
+
|
267
|
+
## To browse the components:
|
268
|
+
Browse the components at: *http://localhost:3000/*
|
269
|
+
|
270
|
+
_From the gem's root directory (not spec/test_app/):_,
|
271
|
+
Begin rails server the normal way.
|
272
|
+
|
273
|
+
```
|
274
|
+
$ rails s
|
275
|
+
```
|
276
|
+
|
277
|
+
If you're running other rails apps on port 3000 or 3001 you can run this on another port, for example:
|
278
|
+
|
279
|
+
```
|
280
|
+
$ rails s -p 3003
|
281
|
+
```
|
282
|
+
|
283
|
+
Documentation .haml files can be found here:
|
284
|
+
```
|
285
|
+
/spec/test_app/app/views
|
286
|
+
```
|
287
|
+
Within that folder are all of the component code examples found when you click through the navigation. Divided up as `Bootstrap`, then the grouping names: `patterns`, `elements`, `foundations`.
|
288
|
+
|
289
|
+
## Specs
|
290
|
+
_From the gem's root directory (not spec/test_app/):_
|
291
|
+
This gem comes with spring, you can use spring when executing rspec
|
292
|
+
|
293
|
+
```
|
294
|
+
$ spring rspec
|
295
|
+
```
|
296
|
+
|
297
|
+
## To do's:
|
298
|
+
1. Create a generator for adding a new bootstrap component and a new nfg component. perhaps run through a script (or skip) to set it up to have utilities in place... do you want it to be...
|
299
|
+
```
|
300
|
+
$ Collapsible? (Y/n):
|
301
|
+
```
|
302
|
+
|
303
|
+
2. Write out a step by step process for manually creating a component of different nesting levels
|
304
|
+
|
305
|
+
3. Trait documentation
|
306
|
+
|
307
|
+
4. RDoc
|
308
|
+
|
309
|
+
5. Userful error library, particularly on any quirky things (also note quirky things as code-smell stuff to fix.).
|
310
|
+
|
311
|
+
6. Look into setting up an installer for allowing configuration options (specifically, initially on whether or not to include simple_form)
|
312
|
+
|
313
|
+
7. Host test_app on heroku for online documentation
|
314
|
+
|
315
|
+
8. Migrate test_app content into the design system CMS app.
|
316
|
+
|
317
|
+
9. Design token integration
|
318
|
+
|
319
|
+
10. API feed for design token for third party sites like wordpress?
|
320
|
+
|
321
|
+
11. Add I18n lookup.
|
322
|
+
|
323
|
+
12. Update browser gem in all NFG apps to 2.5+
|
324
|
+
|
325
|
+
13. Review what's involved in having simple_form "subscribe" to our design system inputs and form controls, particularly the advanced ones (like radio buttons with images) so that the design system is actually hosting the html and not obnoxiously complicated simple_form classes doing that job.
|
326
|
+
|
327
|
+
14. Design tokens
|
328
|
+
|
329
|
+
15. need a better way to define and create / map traits. I am not enjoying the bloat in attr_readers...
|
330
|
+
|
331
|
+
16. Generator for customizable components with commented out class methods (like devise's generated controllers) for easy customization (reference that kicked this off was the modal title ... allowing an icon on the bs version might be what you want to do if you're a gem consumer...)
|
332
|
+
|
333
|
+
17. Consider implementing a universal catch all "content" attribute when there's only one region so that users don't need to guess if a something like the dropdown header uses `heading` or `body` or `content` for passing in the content.
|
334
|
+
|
335
|
+
18. Create a registered list ... for things like tooltippable nfg components (all? some?) -- that way can mass add modules for nfg side as needed.
|
336
|
+
|
337
|
+
19. Look into collapsible toggle / collapse toggle, There are lots of buttons that have their classes removed so they can behave as a "link"
|
338
|
+
|
339
|
+
20. Trait specs
|
340
|
+
|
341
|
+
21. Consider moving component_css_class out of private so it can be manipulated in the component (instead of needing stuff like remove_component_css_classes methods)
|
342
|
+
|
343
|
+
22. Author useful error notifications for missing traits (instead of 'something_trait' method error)
|
344
|
+
|
345
|
+
23. need an overlay_blocker
|
346
|
+
|
347
|
+
24. should form-row be a (nfg?) component? see: Givecorps-site/app/views/bootstrap4/addresses/_address_form.html.haml
|
348
|
+
|
349
|
+
25. card sub title and card title components?
|
350
|
+
|
351
|
+
26. consider typeface for link_to so we can supply our luxuries to link_to.
|
352
|
+
|
353
|
+
27. Add a trait for dropdown items where we pass in a "not_deletable" type of attribute that shows when a can't delete condition is present -- or make it more generic and have it be embedded dropdown text that we conditionalize on the component.
|
354
|
+
|
355
|
+
28. Examine how theme css prefix class is being worked out... looks like we'd be better off having some kind of value that's shared / accessible... somethign like "type of theme" ... :text (text-success). right now, we're doing it by setting the prefix to 'text-'
|
356
|
+
|
357
|
+
29. Slat list sm ...
|
358
|
+
|
359
|
+
31. _Add a generator to supply the bootstrap shared examples for spec writing your own components._
|
360
|
+
|
361
|
+
32. Need to integrate will_paginate rendering into the bootstrap4_rails_components gem.
|
362
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
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 = 'Bootstrap4RailsComponents'
|
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/test_app/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
var init_plugin;
|
2
|
+
|
3
|
+
init_plugin = function(parent) {
|
4
|
+
// Don't add tooltips for mobile devices
|
5
|
+
// TODO: This should probably be a configuration setting (mobile strictness, etc)
|
6
|
+
if (!($("[data-toggle='tooltip']").length && !('ontouchstart' in window))) {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
|
10
|
+
// When inintializing, dispose of the tooltips.
|
11
|
+
$("[data-toggle='tooltip']").tooltip('dispose');
|
12
|
+
|
13
|
+
// Find the parent so we can contextualize which tooltips are initialized
|
14
|
+
// Ex: tooltips within an ajax modal
|
15
|
+
parent.find("[data-toggle='tooltip']").tooltip();
|
16
|
+
|
17
|
+
// Tooltip!
|
18
|
+
return $('body').tooltip({
|
19
|
+
selector: "[data-toggle~='tooltip']"
|
20
|
+
});
|
21
|
+
};
|
22
|
+
|
23
|
+
$(function() {
|
24
|
+
var body, doc, modal;
|
25
|
+
|
26
|
+
doc = $(document);
|
27
|
+
body = $('body');
|
28
|
+
modal = $('.modal');
|
29
|
+
|
30
|
+
// Turn on tooltips for the page when the DOM is ready
|
31
|
+
init_plugin(body);
|
32
|
+
|
33
|
+
// Initialize tooltips for the modal when it loads up
|
34
|
+
doc.on('shown.bs.modal', function(e) {
|
35
|
+
return init_plugin(modal);
|
36
|
+
});
|
37
|
+
|
38
|
+
// Account for ajax modals and re-initialize the tooltips for the modal.
|
39
|
+
return doc.on('hidden.bs.modal ajax:success', function(e, xhr, settings) {
|
40
|
+
return init_plugin(body);
|
41
|
+
});
|
42
|
+
});
|