Skip to content

Commit 4fe3b3f

Browse files
Mattia RoccobertonMattia Roccoberton
authored andcommitted
Updated blaze; added accordions; improved some styles
1 parent 67004f1 commit 4fe3b3f

15 files changed

Lines changed: 217 additions & 112 deletions

README.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Features:
77
- CSS only theme with clean UI
88
- compact nested forms
99
- [customizable](#customize): colors, sidebar position, scroll on cells
10-
- custom controls / components: [toggle](#toggle), [Sidebar menu](#sidebar-menu), [Readonly field](#readonly-field)
10+
- custom controls / components: [toggle](#toggle), [Sidebar menu](#sidebar-menu), [Accordion](#accordion), [Readonly field](#readonly-field)
1111
- Blaze CSS [widgets](#blaze-widgets)
1212

1313
## Install
@@ -105,30 +105,53 @@ Standard checkbox with label on the left:
105105
A sidebar menu (*priority* option permit to put the sidebar above the filters):
106106

107107
```rb
108-
sidebar :help, priority: 0 do
109-
ul class: 'blaze-menu' do
110-
li do
111-
link_to 'Menu item 1', admin_root_path
112-
end
113-
li do
114-
link_to 'Menu item 2', admin_root_path
115-
end
116-
li do
117-
link_to 'Menu item 3', admin_root_path
118-
end
108+
sidebar :help, priority: 0 do
109+
ul class: 'blaze-menu' do
110+
li do
111+
link_to 'Menu item 1', admin_root_path
112+
end
113+
li do
114+
link_to 'Menu item 2', admin_root_path
115+
end
116+
li do
117+
link_to 'Menu item 3', admin_root_path
119118
end
120119
end
120+
end
121121
```
122122

123123
![menu](extra/screenshot4.jpg)
124124

125+
### Accordion
126+
127+
An accordion group in a form:
128+
129+
```rb
130+
f.accordion_group do
131+
f.accordion 'First accordion' do
132+
f.inputs for: [:detail, f.object.detail || Detail.new] do |f2|
133+
f2.input :meta_title
134+
f2.input :meta_keywords
135+
end
136+
end
137+
f.accordion 'Second accordion' do
138+
f.inputs for: [:more_detail, f.object.morel_detail || Detail.new] do |f2|
139+
f2.input :meta_title
140+
f2.input :meta_keywords
141+
end
142+
end
143+
end
144+
```
145+
125146
### Readonly field
126147

127-
Some readonly fields in form:
148+
Some readonly fields in a form:
149+
150+
`f.readonly :position`
128151

129-
`f.readonly 'Code', 'Automatically set after save'`
152+
`f.readonly :position, f.object.position * 2`
130153

131-
`f.readonly :position, f.object.position`
154+
`f.readonly 'Code', 'Automatically set after save', class: 'a-wrapper-class'`
132155

133156
`f.readonly nil, 'Value only, no label'`
134157

app/assets/stylesheets/activeadmin_blaze_theme/blaze/blaze.colors.scss

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,20 @@
1111
.u-bg-#{$name} {
1212
background-color: $value;
1313
}
14-
}
14+
15+
.u-fill-#{$name} {
16+
fill: $value;
17+
}
18+
19+
.u-stroke-#{$name} {
20+
stroke: $value;
21+
}
22+
}
23+
24+
.u-stroke-none {
25+
stroke: none;
26+
}
27+
28+
.u-fill-none {
29+
fill: none;
30+
}

app/assets/stylesheets/activeadmin_blaze_theme/blaze/components.cards.scss

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.c-card {
55
@include list--unstyled;
66
display: block;
7+
width: 100%;
78
border-radius: $card-border-radius;
89
background-color: $card-background-color;
910
box-shadow: $card-box-shadow;
@@ -19,32 +20,44 @@
1920
}
2021

2122
.c-card__header {
22-
padding: $spacing-small $spacing-small 0;
23+
padding: $card-header-padding;
2324

2425
.c-heading {
2526
padding: 0;
2627
}
2728
}
2829

29-
.c-card__item,
30-
.c-card__body,
30+
.c-card__item {
31+
padding: $card-item-padding;
32+
}
33+
34+
.c-card__body {
35+
padding: $card-body-padding;
36+
}
37+
3138
.c-card__footer {
32-
padding: $spacing-small;
39+
padding: $card-footer-padding;
3340
}
3441

3542
.c-card__item + .c-card__footer--block {
3643
padding: 0;
3744
}
3845

3946
.c-card__footer--block {
40-
padding: $spacing-small 0 0;
47+
padding: $card-footer-block-padding;
48+
49+
.c-input-group .c-button {
50+
border-bottom: 0;
51+
}
4152

4253
.c-input-group .c-button:first-child {
54+
border-left: 0;
4355
border-top-left-radius: 0;
4456
border-bottom-left-radius: 0;
4557
}
4658

4759
.c-input-group .c-button:last-child {
60+
border-right: 0;
4861
border-top-right-radius: 0;
4962
border-bottom-right-radius: 0;
5063
}

app/assets/stylesheets/activeadmin_blaze_theme/blaze/components.headings.scss

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,3 @@
1212
font-size: $heading-subheading-font-size;
1313
opacity: $heading-subheading-opacity;
1414
}
15-
16-
h1.c-heading {
17-
font-size: $text-font-size-super;
18-
}
19-
20-
h2.c-heading {
21-
font-size: $text-font-size-xlarge;
22-
}
23-
24-
h3.c-heading {
25-
font-size: $text-font-size-large;
26-
}
27-
28-
h4.c-heading {
29-
font-size: $text-font-size-medium;
30-
}
31-
32-
h5.c-heading {
33-
font-size: $text-font-size-small;
34-
}
35-
36-
h6.c-heading {
37-
font-size: $text-font-size-xsmall;
38-
}

app/assets/stylesheets/activeadmin_blaze_theme/blaze/components.inputs.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,18 @@
8787
// SELECTS, CHECKBOXES AND RADIOS
8888
select.c-field {
8989
cursor: pointer;
90+
91+
&::-ms-expand {
92+
display: none;
93+
}
9094
}
9195

9296
// SELECTS
9397
select.c-field:not([multiple]) {
9498
padding-right: 1em;
95-
background: url("data:image/png;base64,R0lGODlhDwAUAIABAAAAAP///yH5BAEAAAEALAAAAAAPABQAAAIXjI+py+0Po5wH2HsXzmw//lHiSJZmUAAAOw==") no-repeat 99% 50%;
99+
background-image: url("data:image/png;base64,R0lGODlhDwAUAIABAAAAAP///yH5BAEAAAEALAAAAAAPABQAAAIXjI+py+0Po5wH2HsXzmw//lHiSJZmUAAAOw==");
100+
background-repeat: no-repeat;
101+
background-position: 99% 50%;
96102
}
97103

98104
// CHECKBOXES and RADIOs

app/assets/stylesheets/activeadmin_blaze_theme/blaze/components.tabs.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@
1717
box-shadow: 0 -.2em 0 0 $tab-heading-box-shadow-color inset;
1818
}
1919

20+
.c-tabs__nav {
21+
overflow: hidden;
22+
23+
.c-tabs__headings {
24+
margin-bottom: -1em;
25+
padding-bottom: 1em;
26+
overflow-y: hidden;
27+
overflow-x: auto;
28+
}
29+
30+
.c-tab-heading {
31+
white-space: nowrap;
32+
}
33+
}
34+
2035
.c-tab-heading--active {
2136
@include tab-heading--color;
2237
}

app/assets/stylesheets/activeadmin_blaze_theme/blaze/components.trees.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
color: $tree-item-expandable-indicator-color;
2929
content: "\276F";
3030
}
31+
32+
.c-tree {
33+
display: none;
34+
}
3135
}
3236

3337
.c-tree__item--expanded {
@@ -36,4 +40,8 @@
3640
color: $tree-item-expanded-indicator-color;
3741
content: "\276F";
3842
}
43+
44+
.c-tree {
45+
display: block;
46+
}
3947
}

app/assets/stylesheets/activeadmin_blaze_theme/blaze/mixins/_components.buttons.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
@mixin button {
5959
@include button-color;
60-
display: inline;
60+
display: inline-block;
6161
max-width: 100%;
6262
margin: $button-margin;
6363
padding: $button-padding;

app/assets/stylesheets/activeadmin_blaze_theme/blaze/mixins/_settings.global.scss

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ $text-font-family-serif: Georgia, Cambria, "Times New Roman", Times, serif !defa
220220
$text-font-family-mono: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace !default;
221221
$text-font-size-super: 2em !default;
222222
$text-font-size-xlarge: 1.5em !default;
223-
$text-font-size-large: 1.17em !default;
223+
$text-font-size-large: 1.25em !default;
224224
$text-font-size-medium: 1em !default;
225-
$text-font-size-small: .83em !default;
225+
$text-font-size-small: .8em !default;
226226
$text-font-size-xsmall: .67em !default;
227227
$text-font-weight: normal !default;
228228
$text-font-weight-heavy: bold !default;
@@ -292,17 +292,17 @@ $alert-border-radius: $border-radius !default;
292292
//
293293
// Avatar
294294
//
295-
$avatar-margin: 0;
296-
$avatar-background-color: $color-brand;
297-
$avatar-color: $color-white;
298-
$avatar-img-border-radius: $border-radius-rounded;
299-
$avatar-inner-img-size: 50%;
300-
$avatar-xsmall-size: 1em;
301-
$avatar-small-size: 2em;
302-
$avatar-medium-size: 3em;
303-
$avatar-large-size: 4em;
304-
$avatar-xlarge-size: 5em;
305-
$avatar-super-size: 6em;
295+
$avatar-margin: 0 !default;
296+
$avatar-background-color: $color-brand !default;
297+
$avatar-color: $color-white !default;
298+
$avatar-img-border-radius: $border-radius-rounded !default;
299+
$avatar-inner-img-size: 50% !default;
300+
$avatar-xsmall-size: 1em !default;
301+
$avatar-small-size: 2em !default;
302+
$avatar-medium-size: 3em !default;
303+
$avatar-large-size: 4em !default;
304+
$avatar-xlarge-size: 5em !default;
305+
$avatar-super-size: 6em !default;
306306

307307
//
308308
// Badges
@@ -467,7 +467,7 @@ $card-image-padding: $spacing-medium 0 0 !default;
467467
$card-header-padding: $spacing-medium $spacing-medium 0 !default;
468468
$card-body-padding: $spacing-medium !default;
469469
$card-footer-padding: $spacing-medium !default;
470-
$card-footer-block-padding: 0 !default;
470+
$card-footer-block-padding: $spacing-small 0 0 !default;
471471

472472
$card-item-padding: $spacing-small !default;
473473
$card-item-border-width: $border-width !default;
@@ -511,8 +511,8 @@ $card-item-warning-active-background-color: map-get($colors, warning-dark) !defa
511511
$card-item-success-active-background-color: map-get($colors, success-dark) !default;
512512
$card-item-error-active-background-color: map-get($colors, error-dark) !default;
513513

514-
$card-accordion-chevron-border: 2px solid;
515-
$card-accordion-chevron-size: .75em;
514+
$card-accordion-chevron-border: 2px solid !default;
515+
$card-accordion-chevron-size: .75em !default;
516516

517517
//
518518
// Drawers
@@ -622,8 +622,8 @@ $list-inline-item-bullet-padding: 0 $spacing-small 0 0 !default;
622622
//
623623
// Medias
624624
//
625-
$media-image-width: $avatar-medium-size;
626-
$media-body-margin-left: $spacing-small;
625+
$media-image-width: $avatar-medium-size !default;
626+
$media-body-margin-left: $spacing-small !default;
627627

628628
//
629629
// Modals
@@ -707,19 +707,19 @@ $pagination-ellipsis-padding: 0 $spacing-medium !default;
707707
//
708708
// Panels
709709
//
710-
$panel-nav-top: ($nav-item-padding * 2) + ($text-line-height * 1em);
711-
$panel-nav-bottom: $panel-nav-top;
710+
$panel-nav-top: ($nav-item-padding * 2) + ($text-line-height * 1em) !default;
711+
$panel-nav-bottom: $panel-nav-top !default;
712712

713713
//
714714
// Progress
715715
//
716-
$progress-background-color: map-get($colors, grey-lighter);
717-
$progress-color: $color-white;
718-
$progress-border: 0;
719-
$progress-border-radius: $border-radius;
720-
$progress-rounded-border-radius: $border-radius-rounded;
721-
$progress-bar-background-color: $color-default;
722-
$progress-bar-text-align: center;
716+
$progress-background-color: map-get($colors, grey-lighter) !default;
717+
$progress-color: $color-white !default;
718+
$progress-border: 0 !default;
719+
$progress-border-radius: $border-radius !default;
720+
$progress-rounded-border-radius: $border-radius-rounded !default;
721+
$progress-bar-background-color: $color-default !default;
722+
$progress-bar-text-align: center !default;
723723

724724
//
725725
// Ranges
@@ -840,16 +840,16 @@ $toggle-handle-disabled-background-color: map-get($colors, grey-lighter) !defaul
840840
//
841841
// Tooltips
842842
//
843-
$tooltip-z-index: $z-over-page;
844-
$tooltip-arrow-width: .6em;
845-
$tooltip-body-padding: $spacing-small $spacing-medium;
846-
$tooltip-body-background-color: map-get($colors, black);
847-
$tooltip-body-color: map-get($colors, white);
848-
$tooltip-line-height: 1.45;
849-
$tooltip-body-border-width: 1px;
850-
$tooltip-body-border-style: solid;
851-
$tooltip-body-border-color: $tooltip-body-background-color;
852-
$tooltip-body-border-radius: $border-radius;
843+
$tooltip-z-index: $z-over-page !default;
844+
$tooltip-arrow-width: .6em !default;
845+
$tooltip-body-padding: $spacing-small $spacing-medium !default;
846+
$tooltip-body-background-color: map-get($colors, black) !default;
847+
$tooltip-body-color: map-get($colors, white) !default;
848+
$tooltip-line-height: 1.45 !default;
849+
$tooltip-body-border-width: 1px !default;
850+
$tooltip-body-border-style: solid !default;
851+
$tooltip-body-border-color: $tooltip-body-background-color !default;
852+
$tooltip-body-border-radius: $border-radius !default;
853853

854854
//
855855
// Trees

app/assets/stylesheets/activeadmin_blaze_theme/blaze/objects.drawers.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
overflow-y: auto;
1212
-webkit-overflow-scrolling: touch;
1313

14-
> .c-card {
14+
> .c-card {
1515
background-color: transparent;
1616
box-shadow: none;
1717
}

0 commit comments

Comments
 (0)