administrate 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of administrate might be problematic. Click here for more details.

Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/administrate/components/table.js +2 -2
  3. data/app/assets/stylesheets/administrate/application.scss +4 -5
  4. data/app/assets/stylesheets/administrate/base/_forms.scss +24 -15
  5. data/app/assets/stylesheets/administrate/base/_tables.scss +42 -14
  6. data/app/assets/stylesheets/administrate/base/_typography.scss +7 -4
  7. data/app/assets/stylesheets/administrate/components/_app-container.scss +4 -2
  8. data/app/assets/stylesheets/administrate/components/_attributes.scss +6 -3
  9. data/app/assets/stylesheets/administrate/components/_buttons.scss +11 -4
  10. data/app/assets/stylesheets/administrate/components/_cells.scss +3 -3
  11. data/app/assets/stylesheets/administrate/components/_field-unit.scss +8 -4
  12. data/app/assets/stylesheets/administrate/components/_flashes.scss +3 -3
  13. data/app/assets/stylesheets/administrate/components/_form-actions.scss +1 -2
  14. data/app/assets/stylesheets/administrate/components/_main-content.scss +27 -3
  15. data/app/assets/stylesheets/administrate/components/_navigation.scss +33 -0
  16. data/app/assets/stylesheets/administrate/components/_pagination.scss +3 -2
  17. data/app/assets/stylesheets/administrate/components/_search.scss +9 -4
  18. data/app/assets/stylesheets/administrate/library/_clearfix.scss +7 -0
  19. data/app/assets/stylesheets/administrate/library/_data-label.scss +1 -1
  20. data/app/assets/stylesheets/administrate/library/_variables.scss +13 -8
  21. data/app/assets/stylesheets/administrate/utilities/_text-color.scss +3 -0
  22. data/app/views/administrate/application/_collection.html.erb +4 -4
  23. data/app/views/administrate/application/_navigation.html.erb +18 -0
  24. data/app/views/administrate/application/_search.html.erb +1 -1
  25. data/app/views/administrate/application/edit.html.erb +9 -4
  26. data/app/views/administrate/application/index.html.erb +10 -6
  27. data/app/views/administrate/application/new.html.erb +9 -4
  28. data/app/views/administrate/application/show.html.erb +21 -16
  29. data/app/views/fields/date_time/_index.html.erb +1 -1
  30. data/app/views/fields/date_time/_show.html.erb +1 -1
  31. data/app/views/fields/has_one/_form.html.erb +3 -1
  32. data/app/views/fields/polymorphic/_form.html.erb +3 -1
  33. data/app/views/layouts/administrate/application.html.erb +9 -13
  34. data/docs/customizing_dashboards.md +1 -0
  35. data/docs/customizing_page_views.md +1 -1
  36. data/lib/administrate/engine.rb +0 -2
  37. data/lib/administrate/field/date_time.rb +13 -0
  38. data/lib/administrate/version.rb +1 -1
  39. data/lib/generators/administrate/views/layout_generator.rb +1 -1
  40. data/lib/generators/administrate/views/{sidebar_generator.rb → navigation_generator.rb} +3 -3
  41. metadata +7 -35
  42. data/app/assets/stylesheets/administrate/components/_header.scss +0 -15
  43. data/app/assets/stylesheets/administrate/components/_sidebar.scss +0 -22
  44. data/app/assets/stylesheets/administrate/components/_table.scss +0 -31
  45. data/app/views/administrate/application/_sidebar.html.erb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f99e940d39ae750c539424f5430bd5f07c1d33a5
4
- data.tar.gz: 8d9917e0b8332333309afdefe113cac7c3b0caee
3
+ metadata.gz: 73036f129507204033611e21b5a8633f80ac5b07
4
+ data.tar.gz: becbcb0e63d0b48e7d8c58cc722e51c57ab04640
5
5
  SHA512:
6
- metadata.gz: 32889166105790ee128bef195cba90618686b5a00d90a0c48195faa46d4b580c48032ce48145cf713348029048a288f51018cce289fa16402c43b0d89286fc49
7
- data.tar.gz: 4abd94bd39f09afb5b0054338b076e0f144f2d4b27473a2051d0a03c37fe4de7ca97b55d4c8b0ce80471900fe08ef3db8b2bce802a51a4298b6695373072d313
6
+ metadata.gz: ceed2a386fcf599d33808087ffa25acfd4416356901028206506aa2095bb5b6777dd712a961d952f99220bcc9f6b189ab215ba46779fa8b1172f6528ce1fb460
7
+ data.tar.gz: c35a39f4b91ed15dc22b533013d6fa407c6197878e8cf4085037a25f5a9816ffc0d6de4cae4a4afe89da956bbff3bacbb11bca0c4bbfd0f4c00b53959d635461
@@ -18,6 +18,6 @@ $(function() {
18
18
  }
19
19
  };
20
20
 
21
- $("table").on("click", ".table__row", visitDataUrl);
22
- $("table").on("keydown", ".table__row", visitDataUrl);
21
+ $("table").on("click", ".js-table-row", visitDataUrl);
22
+ $("table").on("keydown", ".js-table-row", visitDataUrl);
23
23
  });
@@ -1,12 +1,11 @@
1
1
  @charset "utf-8";
2
2
 
3
3
  @import "normalize-rails";
4
- @import "bourbon";
5
- @import "neat";
6
4
 
7
5
  @import "selectize";
8
6
  @import "datetime_picker";
9
7
 
8
+ @import "library/clearfix";
10
9
  @import "library/data-label";
11
10
  @import "library/variables";
12
11
 
@@ -23,9 +22,9 @@
23
22
  @import "components/field-unit";
24
23
  @import "components/flashes";
25
24
  @import "components/form-actions";
26
- @import "components/header";
27
25
  @import "components/main-content";
26
+ @import "components/navigation";
28
27
  @import "components/pagination";
29
28
  @import "components/search";
30
- @import "components/sidebar";
31
- @import "components/table";
29
+
30
+ @import "utilities/text-color";
@@ -7,13 +7,14 @@ fieldset {
7
7
 
8
8
  legend {
9
9
  font-weight: $bold-font-weight;
10
- margin-bottom: $small-spacing / 2;
10
+ margin: 0;
11
11
  padding: 0;
12
12
  }
13
13
 
14
14
  label {
15
15
  display: block;
16
16
  font-weight: $bold-font-weight;
17
+ margin: 0;
17
18
  }
18
19
 
19
20
  input,
@@ -23,9 +24,16 @@ select {
23
24
  font-size: $base-font-size;
24
25
  }
25
26
 
27
+ input,
28
+ select,
29
+ textarea {
30
+ display: block;
31
+ font-family: $base-font-family;
32
+ font-size: 16px;
33
+ }
34
+
26
35
  [type="color"],
27
36
  [type="date"],
28
- [type="datetime"],
29
37
  [type="datetime-local"],
30
38
  [type="email"],
31
39
  [type="month"],
@@ -38,31 +46,26 @@ select {
38
46
  [type="url"],
39
47
  [type="week"],
40
48
  input:not([type]),
41
- textarea,
42
- select[multiple] {
49
+ textarea {
50
+ appearance: none;
43
51
  background-color: $white;
44
52
  border: $base-border;
45
53
  border-radius: $base-border-radius;
46
- box-shadow: none;
47
- box-sizing: border-box;
48
- font-family: $base-font-family;
49
- font-size: $base-font-size;
50
54
  padding: $base-spacing / 3;
51
55
  transition: border-color $base-duration $base-timing;
52
56
  width: 100%;
53
57
 
54
58
  &:hover {
55
- border-color: shade($base-border-color, 20%);
59
+ border-color: mix($black, $base-border-color, 20%);
56
60
  }
57
61
 
58
62
  &:focus {
59
63
  border-color: $action-color;
60
- box-shadow: none;
61
64
  outline: none;
62
65
  }
63
66
 
64
67
  &:disabled {
65
- background-color: shade($base-background-color, 5%);
68
+ background-color: mix($black, $white, 5%);
66
69
  cursor: not-allowed;
67
70
 
68
71
  &:hover {
@@ -75,10 +78,6 @@ textarea {
75
78
  resize: vertical;
76
79
  }
77
80
 
78
- [type="search"] {
79
- appearance: none;
80
- }
81
-
82
81
  [type="checkbox"],
83
82
  [type="radio"] {
84
83
  display: inline;
@@ -92,3 +91,13 @@ textarea {
92
91
  select {
93
92
  width: 100%;
94
93
  }
94
+
95
+ [type="checkbox"],
96
+ [type="radio"],
97
+ [type="file"],
98
+ select {
99
+ &:focus {
100
+ outline: $focus-outline;
101
+ outline-offset: $focus-outline-offset;
102
+ }
103
+ }
@@ -1,27 +1,55 @@
1
1
  table {
2
- border-collapse: separate;
2
+ border-collapse: collapse;
3
+ font-size: 0.9em;
4
+ text-align: left;
3
5
  width: 100%;
4
- }
5
6
 
6
- th {
7
- border-bottom: 1px solid shade($base-border-color, 25%);
8
- text-align: left;
7
+ a {
8
+ color: inherit;
9
+ text-decoration: none;
10
+ }
9
11
  }
10
12
 
11
- th,
12
- td {
13
- padding: $small-spacing;
14
- vertical-align: middle;
13
+ thead {
14
+ font-weight: $bold-font-weight;
15
15
  }
16
16
 
17
- td {
17
+ tr {
18
18
  border-bottom: $base-border;
19
+ }
20
+
21
+ tbody tr {
22
+ &:hover {
23
+ background-color: $base-background-color;
24
+ cursor: pointer;
25
+ }
26
+
27
+ &:focus {
28
+ outline: $focus-outline;
29
+ outline-offset: -($focus-outline-width);
30
+ }
31
+ }
32
+
33
+ td,
34
+ th {
19
35
  font-feature-settings: "kern", "liga", "clig", "calt", "lnum", "tnum";
20
36
  font-kerning: normal;
21
37
  font-variant-ligatures: common-ligatures, contextual;
22
38
  font-variant-numeric: lining-nums, tabular-nums;
23
- overflow: hidden;
24
- text-overflow: ellipsis;
25
- white-space: nowrap;
26
- word-wrap: normal;
39
+ padding: 0.75rem;
40
+ vertical-align: middle;
41
+ }
42
+
43
+ td:first-child,
44
+ th:first-child {
45
+ padding-left: 2rem;
46
+ }
47
+
48
+ td:last-child,
49
+ th:last-child {
50
+ padding-right: 2rem;
51
+ }
52
+
53
+ td img {
54
+ max-height: 2rem;
27
55
  }
@@ -23,13 +23,16 @@ p {
23
23
 
24
24
  a {
25
25
  color: $action-color;
26
- text-decoration: none;
26
+ text-decoration-skip: ink;
27
27
  transition: color $base-duration $base-timing;
28
28
 
29
- &:active,
30
- &:focus,
31
29
  &:hover {
32
- color: shade($action-color, 25%);
30
+ color: mix($black, $action-color, 25%);
31
+ }
32
+
33
+ &:focus {
34
+ outline: $focus-outline;
35
+ outline-offset: $focus-outline-offset;
33
36
  }
34
37
  }
35
38
 
@@ -1,7 +1,9 @@
1
1
  .app-container {
2
- @include margin(null auto);
3
2
  align-items: stretch;
4
3
  display: flex;
5
- max-width: 100em;
4
+ margin-left: auto;
5
+ margin-right: auto;
6
+ max-width: 100rem;
6
7
  min-height: 100vh;
8
+ padding: $base-spacing;
7
9
  }
@@ -1,9 +1,11 @@
1
1
  .attribute-label {
2
2
  @include data-label;
3
- @include span-columns(2 of 12);
4
3
  clear: left;
4
+ float: left;
5
+ margin-bottom: $base-spacing;
5
6
  margin-top: 0;
6
7
  text-align: right;
8
+ width: calc(15% - 1rem);
7
9
  }
8
10
 
9
11
  .preserve-whitespace {
@@ -12,7 +14,8 @@
12
14
  }
13
15
 
14
16
  .attribute-data {
15
- @include span-columns(10 of 12);
16
- @include omega;
17
+ float: left;
17
18
  margin-bottom: $base-spacing;
19
+ margin-left: 2rem;
20
+ width: calc(85% - 1rem);
18
21
  }
@@ -1,4 +1,7 @@
1
- #{$all-buttons},
1
+ button,
2
+ input[type="button"],
3
+ input[type="reset"],
4
+ input[type="submit"],
2
5
  .button {
3
6
  appearance: none;
4
7
  background-color: $action-color;
@@ -19,12 +22,16 @@
19
22
  vertical-align: middle;
20
23
  white-space: nowrap;
21
24
 
22
- &:hover,
23
- &:focus {
24
- background-color: shade($action-color, 20%);
25
+ &:hover {
26
+ background-color: mix($black, $action-color, 20%);
25
27
  color: $white;
26
28
  }
27
29
 
30
+ &:focus {
31
+ outline: $focus-outline;
32
+ outline-offset: $focus-outline-offset;
33
+ }
34
+
28
35
  &:disabled {
29
36
  cursor: not-allowed;
30
37
  opacity: 0.5;
@@ -1,5 +1,5 @@
1
1
  .cell-label {
2
- @include data-label;
2
+ position: relative;
3
3
 
4
4
  &:hover {
5
5
  a {
@@ -13,10 +13,10 @@
13
13
  }
14
14
 
15
15
  a {
16
- @include fill-parent;
17
16
  color: inherit;
18
17
  display: inline-block;
19
18
  transition: color $base-duration $base-timing;
19
+ width: 100%;
20
20
  }
21
21
  }
22
22
 
@@ -33,9 +33,9 @@
33
33
  right: 0;
34
34
 
35
35
  svg {
36
+ fill: $hint-grey;
36
37
  height: 100%;
37
38
  transition: transform $base-duration $base-timing;
38
- fill: $hint-grey;
39
39
  }
40
40
  }
41
41
 
@@ -1,17 +1,21 @@
1
1
  .field-unit {
2
- @include clearfix;
3
- @include fill-parent;
2
+ @include administrate-clearfix;
4
3
  align-items: center;
5
4
  display: flex;
6
5
  margin-bottom: $base-spacing;
7
6
  position: relative;
7
+ width: 100%;
8
8
  }
9
9
 
10
10
  .field-unit__label {
11
- @include span-columns(2 of 12);
11
+ float: left;
12
+ margin-left: 1rem;
12
13
  text-align: right;
14
+ width: calc(15% - 1rem);
13
15
  }
14
16
 
15
17
  .field-unit__field {
16
- @include span-columns(5 of 12);
18
+ float: left;
19
+ margin-left: 2rem;
20
+ width: 45%;
17
21
  }
@@ -9,19 +9,19 @@ $flashes: (
9
9
  @each $flash-type, $color in $flashes {
10
10
  .flash-#{$flash-type} {
11
11
  background-color: $color;
12
- color: shade($color, 60%);
12
+ color: mix($black, $color, 60%);
13
13
  display: block;
14
14
  margin-bottom: $base-spacing / 2;
15
15
  padding: $base-spacing / 2;
16
16
  text-align: center;
17
17
 
18
18
  a {
19
- color: shade($color, 70%);
19
+ color: mix($black, $color, 70%);
20
20
  text-decoration: underline;
21
21
 
22
22
  &:focus,
23
23
  &:hover {
24
- color: shade($color, 90%);
24
+ color: mix($black, $color, 90%);
25
25
  }
26
26
  }
27
27
  }
@@ -1,4 +1,3 @@
1
1
  .form-actions {
2
- @include shift(2);
3
- margin-bottom: $base-spacing * 4;
2
+ margin-left: calc(15% + 2rem);
4
3
  }
@@ -1,6 +1,30 @@
1
1
  .main-content {
2
2
  background-color: $white;
3
- box-shadow: 0 2px 4px rgba($grey-7, 0.24), 0 2px 6px rgba($grey-7, 0.12);
4
- flex: 1;
5
- overflow-y: auto;
3
+ border-radius: $base-border-radius;
4
+ box-shadow: 0 0 6px 0 rgba($black, 0.12),
5
+ 0 2px 2px rgba($black, 0.2);
6
+ flex: 1 1 100%;
7
+ padding-bottom: 10vh;
8
+ }
9
+
10
+ .main-content__header,
11
+ .main-content__body {
12
+ padding: 1rem 2rem;
13
+ }
14
+
15
+ .main-content__body--flush {
16
+ padding-left: 0;
17
+ padding-right: 0;
18
+ }
19
+
20
+ .main-content__header {
21
+ align-items: center;
22
+ border-bottom: $base-border;
23
+ display: flex;
24
+ justify-content: space-between;
25
+ }
26
+
27
+ .main-content__page-title {
28
+ font-size: 1.6em;
29
+ margin-right: 1rem;
6
30
  }
@@ -0,0 +1,33 @@
1
+ $_navigation-link-padding: 0.6em;
2
+
3
+ .navigation {
4
+ flex: 1 0 10rem;
5
+ padding-bottom: $base-spacing;
6
+ padding-right: calc(#{$base-spacing} - #{$_navigation-link-padding});
7
+ padding-top: $base-spacing;
8
+ }
9
+
10
+ .navigation__link {
11
+ background-color: transparent;
12
+ color: $base-font-color;
13
+ display: block;
14
+ line-height: 1;
15
+ margin-left: -($_navigation-link-padding);
16
+ padding: $_navigation-link-padding;
17
+ transition: background-color $base-duration $base-timing,
18
+ color $base-duration $base-timing;
19
+
20
+ &:not(:last-of-type) {
21
+ margin-bottom: $small-spacing;
22
+ }
23
+
24
+ &:hover {
25
+ background-color: mix($black, $base-background-color, 5%);
26
+ border-radius: $base-border-radius;
27
+ color: $base-font-color;
28
+ }
29
+ }
30
+
31
+ .navigation__link--active {
32
+ font-weight: $bold-font-weight;
33
+ }
@@ -1,6 +1,7 @@
1
1
  .pagination {
2
- @include margin($base-spacing null ($base-spacing * 4));
3
- @include padding(null $base-spacing);
2
+ margin-top: $base-spacing;
3
+ padding-left: $base-spacing;
4
+ padding-right: $base-spacing;
4
5
  text-align: center;
5
6
 
6
7
  .first,
@@ -1,10 +1,11 @@
1
1
  .search {
2
- @include padding(null $base-spacing);
3
2
  align-items: center;
4
3
  border-bottom: $base-border;
5
4
  display: flex;
6
5
  flex-direction: row;
7
6
  justify-content: flex-start;
7
+ padding-left: $base-spacing;
8
+ padding-right: $base-spacing;
8
9
  position: relative;
9
10
  width: 100%;
10
11
  }
@@ -12,7 +13,8 @@
12
13
  .search__clear,
13
14
  .search__icon {
14
15
  svg {
15
- @include size(1em);
16
+ height: 1em;
17
+ width: 1em;
16
18
  }
17
19
  }
18
20
 
@@ -55,14 +57,17 @@
55
57
  }
56
58
 
57
59
  .search__hint {
58
- @include position(absolute, 1em 0 null null);
59
60
  color: $hint-grey;
61
+ left: 0;
60
62
  opacity: 0;
63
+ position: absolute;
64
+ top: 1em;
61
65
  transition: opacity $base-duration $base-timing;
62
66
  z-index: 1;
63
67
 
64
68
  svg {
65
- @include size(100%);
69
+ height: 100%;
70
+ width: 100%;
66
71
  }
67
72
 
68
73
  path,
@@ -0,0 +1,7 @@
1
+ @mixin administrate-clearfix {
2
+ &::after {
3
+ clear: both;
4
+ content: "";
5
+ display: block;
6
+ }
7
+ }
@@ -1,6 +1,6 @@
1
1
  @mixin data-label {
2
2
  color: $hint-grey;
3
- font-size: modular-scale(-1);
3
+ font-size: 0.8em;
4
4
  font-weight: 400;
5
5
  letter-spacing: 0.0357em;
6
6
  position: relative;
@@ -6,14 +6,13 @@ $heading-font-family: $base-font-family;
6
6
 
7
7
  $base-font-size: 1em;
8
8
 
9
- $bold-font-weight: 600;
9
+ $bold-font-weight: 700;
10
10
 
11
11
  $base-line-height: 1.5;
12
12
  $heading-line-height: 1.2;
13
13
 
14
14
  // Other Sizes
15
- $modular-scale-ratio: $minor-third;
16
- $base-border-radius: 3px;
15
+ $base-border-radius: 4px;
17
16
  $base-spacing: $base-line-height * 1em;
18
17
  $small-spacing: $base-spacing / 2;
19
18
 
@@ -21,8 +20,8 @@ $small-spacing: $base-spacing / 2;
21
20
  $white: #fff;
22
21
  $black: #000;
23
22
 
24
- $blue: #2a94d6;
25
- $light-red: #c77067;
23
+ $blue: #1976d2;
24
+ $red: #d32f2f;
26
25
  $light-yellow: #f0cd66;
27
26
  $light-green: #4ab471;
28
27
 
@@ -40,11 +39,17 @@ $action-color: $blue;
40
39
  // Background Colors
41
40
  $base-background-color: $grey-0;
42
41
 
42
+ // Focus
43
+ $focus-outline-color: transparentize($action-color, 0.4);
44
+ $focus-outline-width: 3px;
45
+ $focus-outline: $focus-outline-width solid $focus-outline-color;
46
+ $focus-outline-offset: 1px;
47
+
43
48
  // Flash Colors
44
49
  $flash-colors: (
45
50
  alert: $light-yellow,
46
- error: $light-red,
47
- notice: tint($blue, 50%),
51
+ error: $red,
52
+ notice: mix($white, $blue, 50%),
48
53
  success: $light-green
49
54
  );
50
55
 
@@ -54,4 +59,4 @@ $base-border: 1px solid $base-border-color;
54
59
 
55
60
  // Transitions
56
61
  $base-duration: 250ms;
57
- $base-timing: $ease-out-cubic;
62
+ $base-timing: ease-in-out;
@@ -0,0 +1,3 @@
1
+ .text-color-red {
2
+ color: $red;
3
+ }
@@ -18,7 +18,7 @@ to display a collection of resources in an HTML table.
18
18
  [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
19
19
  %>
20
20
 
21
- <table class="collection-data" aria-labelledby="page-title">
21
+ <table aria-labelledby="page-title">
22
22
  <thead>
23
23
  <tr>
24
24
  <% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
@@ -55,14 +55,14 @@ to display a collection of resources in an HTML table.
55
55
 
56
56
  <tbody>
57
57
  <% resources.each do |resource| %>
58
- <tr class="table__row"
58
+ <tr class="js-table-row"
59
59
  tabindex="0"
60
60
  <%= %(role=link data-url=#{polymorphic_path([namespace, resource])}) if valid_action? :show -%>
61
61
  >
62
62
  <% collection_presenter.attributes_for(resource).each do |attribute| %>
63
63
  <td class="cell-data cell-data--<%= attribute.html_class %>">
64
64
  <a href="<%= polymorphic_path([namespace, resource]) -%>"
65
- class="action-show table__link-plain"
65
+ class="action-show"
66
66
  >
67
67
  <%= render_field attribute %>
68
68
  </a>
@@ -81,7 +81,7 @@ to display a collection of resources in an HTML table.
81
81
  <td><%= link_to(
82
82
  t("administrate.actions.destroy"),
83
83
  [namespace, resource],
84
- class: "table__action--destroy",
84
+ class: "text-color-red",
85
85
  method: :delete,
86
86
  data: { confirm: t("administrate.actions.confirm") }
87
87
  ) %></td>
@@ -0,0 +1,18 @@
1
+ <%#
2
+ # Navigation
3
+
4
+ This partial is used to display the navigation in Administrate.
5
+ By default, the navigation contains navigation links
6
+ for all resources in the admin dashboard,
7
+ as defined by the routes in the `admin/` namespace
8
+ %>
9
+
10
+ <nav class="navigation" role="navigation">
11
+ <% Administrate::Namespace.new(namespace).resources.each do |resource| %>
12
+ <%= link_to(
13
+ display_resource_name(resource),
14
+ [namespace, resource.path],
15
+ class: "navigation__link navigation__link--#{nav_link_state(resource)}"
16
+ ) %>
17
+ <% end %>
18
+ </nav>
@@ -1,4 +1,4 @@
1
- <form class="search">
1
+ <form class="search" role="search">
2
2
  <span class="search__icon">
3
3
  <%= svg_tag "administrate/search.svg", "search", width: 16, height: 16 %>
4
4
  </span>
@@ -17,9 +17,12 @@ It displays a header, and renders the `_form` partial to do the heavy lifting.
17
17
 
18
18
  <% content_for(:title) { "#{t("administrate.actions.edit")} #{page.page_title}" } %>
19
19
 
20
- <header class="header">
21
- <h1 class="header__heading"><%= content_for(:title) %></h1>
22
- <div class="header__actions">
20
+ <header class="main-content__header" role="banner">
21
+ <h1 class="main-content__page-title">
22
+ <%= content_for(:title) %>
23
+ </h1>
24
+
25
+ <div>
23
26
  <%= link_to(
24
27
  "#{t("administrate.actions.show")} #{page.page_title}",
25
28
  [namespace, page.resource],
@@ -28,4 +31,6 @@ It displays a header, and renders the `_form` partial to do the heavy lifting.
28
31
  </div>
29
32
  </header>
30
33
 
31
- <%= render "form", page: page %>
34
+ <section class="main-content__body">
35
+ <%= render "form", page: page %>
36
+ </section>
@@ -33,9 +33,12 @@ It renders the `_table` partial to display details about the resources.
33
33
  <% end %>
34
34
  <% end %>
35
35
 
36
- <header class="header">
37
- <h1 class="header__heading" id="page-title"><%= content_for(:title) %></h1>
38
- <div class="header__actions">
36
+ <header class="main-content__header" role="banner">
37
+ <h1 class="main-content__page-title" id="page-title">
38
+ <%= content_for(:title) %>
39
+ </h1>
40
+
41
+ <div>
39
42
  <%= link_to(
40
43
  "#{t("administrate.actions.new")} #{page.resource_name.titleize.downcase}",
41
44
  [:new, namespace, page.resource_path],
@@ -44,6 +47,7 @@ It renders the `_table` partial to display details about the resources.
44
47
  </div>
45
48
  </header>
46
49
 
47
- <%= render "collection", collection_presenter: page, resources: resources %>
48
-
49
- <%= paginate resources %>
50
+ <section class="main-content__body main-content__body--flush">
51
+ <%= render "collection", collection_presenter: page, resources: resources %>
52
+ <%= paginate resources %>
53
+ </section>
@@ -17,11 +17,16 @@ to do the heavy lifting.
17
17
 
18
18
  <% content_for(:title) { "#{t("administrate.actions.new")} #{page.resource_name.titleize}" } %>
19
19
 
20
- <header class="header">
21
- <h1 class="header__heading"><%= content_for(:title) %></h1>
22
- <div class="header__actions">
20
+ <header class="main-content__header" role="banner">
21
+ <h1 class="main-content__page-title">
22
+ <%= content_for(:title) %>
23
+ </h1>
24
+
25
+ <div>
23
26
  <%= link_to t("administrate.actions.back"), :back, class: "button" %>
24
27
  </div>
25
28
  </header>
26
29
 
27
- <%= render 'form', page: page %>
30
+ <section class="main-content__body">
31
+ <%= render "form", page: page %>
32
+ </section>
@@ -18,9 +18,12 @@ as well as a link to its edit page.
18
18
 
19
19
  <% content_for(:title) { "#{t("administrate.actions.show")} #{page.page_title}" } %>
20
20
 
21
- <header class="header">
22
- <h1 class="header__heading"><%= content_for(:title) %></h1>
23
- <div class="header__actions">
21
+ <header class="main-content__header" role="banner">
22
+ <h1 class="main-content__page-title">
23
+ <%= content_for(:title) %>
24
+ </h1>
25
+
26
+ <div>
24
27
  <%= link_to(
25
28
  "#{t("administrate.actions.edit")} #{page.page_title}",
26
29
  [:edit, namespace, page.resource],
@@ -29,16 +32,18 @@ as well as a link to its edit page.
29
32
  </div>
30
33
  </header>
31
34
 
32
- <dl>
33
- <% page.attributes.each do |attribute| %>
34
- <dt class="attribute-label">
35
- <%= t(
36
- "helpers.label.#{resource_name}.#{attribute.name}",
37
- default: attribute.name.titleize,
38
- ) %>
39
- </dt>
40
-
41
- <dd class="attribute-data attribute-data--<%=attribute.html_class%>"
42
- ><%= render_field attribute %></dd>
43
- <% end %>
44
- </dl>
35
+ <section class="main-content__body">
36
+ <dl>
37
+ <% page.attributes.each do |attribute| %>
38
+ <dt class="attribute-label">
39
+ <%= t(
40
+ "helpers.label.#{resource_name}.#{attribute.name}",
41
+ default: attribute.name.titleize,
42
+ ) %>
43
+ </dt>
44
+
45
+ <dd class="attribute-data attribute-data--<%=attribute.html_class%>"
46
+ ><%= render_field attribute %></dd>
47
+ <% end %>
48
+ </dl>
49
+ </section>
@@ -17,5 +17,5 @@ as a localized date & time string.
17
17
  %>
18
18
 
19
19
  <% if field.data %>
20
- <%= l field.data.to_date %>
20
+ <%= field.date %>
21
21
  <% end %>
@@ -17,5 +17,5 @@ as a localized date & time string.
17
17
  %>
18
18
 
19
19
  <% if field.data %>
20
- <%= l(field.data, default: field.data) %>
20
+ <%= field.datetime %>
21
21
  <% end %>
@@ -21,4 +21,6 @@ so this partial renders a message to that effect.
21
21
  <%= f.label field.attribute %>
22
22
  </div>
23
23
 
24
- <%= t("administrate.fields.has_one.not_supported") %>
24
+ <div class="field-unit__field">
25
+ <%= t("administrate.fields.has_one.not_supported") %>
26
+ </div>
@@ -22,4 +22,6 @@ so this partial renders a message to that effect.
22
22
  <%= f.label field.name %>
23
23
  </div>
24
24
 
25
- <%= t("administrate.fields.polymorphic.not_supported") %>
25
+ <div class="field-unit__field">
26
+ <%= t("administrate.fields.polymorphic.not_supported") %>
27
+ </div>
@@ -5,38 +5,34 @@ This view template is used as the layout
5
5
  for every page that Administrate generates.
6
6
 
7
7
  By default, it renders:
8
- - Sidebar for navigation
8
+ - Navigation
9
9
  - Content for a search bar
10
10
  (if provided by a `content_for` block in a nested page)
11
11
  - Flashes
12
- - Links to stylesheets and Javascripts
12
+ - Links to stylesheets and JavaScripts
13
13
  %>
14
14
 
15
15
  <!DOCTYPE html>
16
16
  <html lang="<%= I18n.locale %>">
17
17
  <head>
18
- <meta charset="utf-8" />
19
- <meta name="ROBOTS" content="NOODP" />
20
- <meta name="viewport" content="initial-scale=1" />
21
- <title><%= content_for(:title) %> | <%= Rails.application.class.parent_name.titlecase %></title>
18
+ <meta charset="utf-8">
19
+ <meta name="ROBOTS" content="NOODP">
20
+ <meta name="viewport" content="initial-scale=1">
21
+ <title>
22
+ <%= content_for(:title) %> - <%= Rails.application.class.parent_name.titlecase %>
23
+ </title>
22
24
  <%= render "stylesheet" %>
23
25
  <%= csrf_meta_tags %>
24
26
  </head>
25
-
26
27
  <body>
27
-
28
28
  <div class="app-container">
29
-
30
- <div class="sidebar">
31
- <%= render "sidebar" -%>
32
- </div>
29
+ <%= render "navigation" -%>
33
30
 
34
31
  <main class="main-content" role="main">
35
32
  <%= content_for(:search) %>
36
33
  <%= render "flashes" -%>
37
34
  <%= yield %>
38
35
  </main>
39
-
40
36
  </div>
41
37
 
42
38
  <%= render "javascript" %>
@@ -61,6 +61,7 @@ specify, including:
61
61
  - `Field::Polymorphic`
62
62
  - `Field::Select`
63
63
  - `Field::String`
64
+ - `Field::Text`
64
65
 
65
66
  ## Customizing Fields
66
67
 
@@ -72,7 +72,7 @@ It's so easy that pass in the "layout" key word to the view generators.
72
72
  ```bash
73
73
  rails generate administrate:views:layout
74
74
  # -> app/views/layouts/admin/application.html.erb
75
- # -> app/views/admin/application/_sidebar.html.erb
75
+ # -> app/views/admin/application/_navigation.html.erb
76
76
  # -> app/views/admin/application/_javascript.html.erb
77
77
  # -> app/views/admin/application/_flashes.html.erb
78
78
  ```
@@ -1,9 +1,7 @@
1
- require "bourbon"
2
1
  require "datetime_picker_rails"
3
2
  require "jquery-rails"
4
3
  require "kaminari"
5
4
  require "momentjs-rails"
6
- require "neat"
7
5
  require "normalize-rails"
8
6
  require "sass-rails"
9
7
  require "selectize-rails"
@@ -3,6 +3,19 @@ require_relative "base"
3
3
  module Administrate
4
4
  module Field
5
5
  class DateTime < Base
6
+ def date
7
+ I18n.localize(data.to_date, format: format)
8
+ end
9
+
10
+ def datetime
11
+ I18n.localize(data, format: format, default: data)
12
+ end
13
+
14
+ private
15
+
16
+ def format
17
+ options.fetch(:format, :default)
18
+ end
6
19
  end
7
20
  end
8
21
  end
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.7.0".freeze
3
3
  end
@@ -12,7 +12,7 @@ module Administrate
12
12
  "app/views/layouts/admin/application.html.erb",
13
13
  )
14
14
 
15
- call_generator("administrate:views:sidebar")
15
+ call_generator("administrate:views:navigation")
16
16
  copy_resource_template("_javascript")
17
17
  copy_resource_template("_flashes")
18
18
  end
@@ -3,11 +3,11 @@ require "administrate/view_generator"
3
3
  module Administrate
4
4
  module Generators
5
5
  module Views
6
- class SidebarGenerator < Administrate::ViewGenerator
6
+ class NavigationGenerator < Administrate::ViewGenerator
7
7
  source_root template_source_path
8
8
 
9
- def copy_sidebar
10
- copy_resource_template("_sidebar")
9
+ def copy_navigation
10
+ copy_resource_template("_navigation")
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Charlton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-02 00:00:00.000000000 Z
12
+ date: 2017-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -85,20 +85,6 @@ dependencies:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
87
  version: '6.0'
88
- - !ruby/object:Gem::Dependency
89
- name: bourbon
90
- requirement: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: 5.0.0.beta.6
95
- type: :runtime
96
- prerelease: false
97
- version_requirements: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: 5.0.0.beta.6
102
88
  - !ruby/object:Gem::Dependency
103
89
  name: datetime_picker_rails
104
90
  requirement: !ruby/object:Gem::Requirement
@@ -155,20 +141,6 @@ dependencies:
155
141
  - - "~>"
156
142
  - !ruby/object:Gem::Version
157
143
  version: '2.8'
158
- - !ruby/object:Gem::Dependency
159
- name: neat
160
- requirement: !ruby/object:Gem::Requirement
161
- requirements:
162
- - - "~>"
163
- - !ruby/object:Gem::Version
164
- version: '1.1'
165
- type: :runtime
166
- prerelease: false
167
- version_requirements: !ruby/object:Gem::Requirement
168
- requirements:
169
- - - "~>"
170
- - !ruby/object:Gem::Version
171
- version: '1.1'
172
144
  - !ruby/object:Gem::Dependency
173
145
  name: normalize-rails
174
146
  requirement: !ruby/object:Gem::Requirement
@@ -254,14 +226,14 @@ files:
254
226
  - app/assets/stylesheets/administrate/components/_field-unit.scss
255
227
  - app/assets/stylesheets/administrate/components/_flashes.scss
256
228
  - app/assets/stylesheets/administrate/components/_form-actions.scss
257
- - app/assets/stylesheets/administrate/components/_header.scss
258
229
  - app/assets/stylesheets/administrate/components/_main-content.scss
230
+ - app/assets/stylesheets/administrate/components/_navigation.scss
259
231
  - app/assets/stylesheets/administrate/components/_pagination.scss
260
232
  - app/assets/stylesheets/administrate/components/_search.scss
261
- - app/assets/stylesheets/administrate/components/_sidebar.scss
262
- - app/assets/stylesheets/administrate/components/_table.scss
233
+ - app/assets/stylesheets/administrate/library/_clearfix.scss
263
234
  - app/assets/stylesheets/administrate/library/_data-label.scss
264
235
  - app/assets/stylesheets/administrate/library/_variables.scss
236
+ - app/assets/stylesheets/administrate/utilities/_text-color.scss
265
237
  - app/assets/stylesheets/docs.scss
266
238
  - app/controllers/administrate/application_controller.rb
267
239
  - app/helpers/administrate/application_helper.rb
@@ -269,8 +241,8 @@ files:
269
241
  - app/views/administrate/application/_flashes.html.erb
270
242
  - app/views/administrate/application/_form.html.erb
271
243
  - app/views/administrate/application/_javascript.html.erb
244
+ - app/views/administrate/application/_navigation.html.erb
272
245
  - app/views/administrate/application/_search.html.erb
273
- - app/views/administrate/application/_sidebar.html.erb
274
246
  - app/views/administrate/application/_stylesheet.html.erb
275
247
  - app/views/administrate/application/edit.html.erb
276
248
  - app/views/administrate/application/index.html.erb
@@ -392,9 +364,9 @@ files:
392
364
  - lib/generators/administrate/views/form_generator.rb
393
365
  - lib/generators/administrate/views/index_generator.rb
394
366
  - lib/generators/administrate/views/layout_generator.rb
367
+ - lib/generators/administrate/views/navigation_generator.rb
395
368
  - lib/generators/administrate/views/new_generator.rb
396
369
  - lib/generators/administrate/views/show_generator.rb
397
- - lib/generators/administrate/views/sidebar_generator.rb
398
370
  - lib/generators/administrate/views/views_generator.rb
399
371
  - lib/tasks/administrate_tasks.rake
400
372
  homepage: https://administrate-prototype.herokuapp.com/
@@ -1,15 +0,0 @@
1
- .header {
2
- align-items: flex-start;
3
- display: flex;
4
- justify-content: space-between;
5
- padding: $base-spacing;
6
- }
7
-
8
- .header__heading {
9
- font-size: modular-scale(3);
10
- margin-top: 0;
11
- }
12
-
13
- .header__actions {
14
- margin-left: $base-spacing;
15
- }
@@ -1,22 +0,0 @@
1
- .sidebar {
2
- flex: 0 0 auto;
3
- max-width: 12em;
4
- overflow-y: auto;
5
- padding: 0 $base-spacing $base-spacing;
6
- }
7
-
8
- .sidebar__link {
9
- color: $base-font-color;
10
- display: block;
11
- padding-top: $base-spacing;
12
- transition: color 0.05s linear;
13
-
14
- &:hover {
15
- color: $blue;
16
- }
17
- }
18
-
19
- .sidebar__link--active {
20
- color: $blue;
21
- font-weight: $bold-font-weight;
22
- }
@@ -1,31 +0,0 @@
1
- .collection-data {
2
- @include padding(null $base-spacing);
3
- }
4
-
5
- .table__row {
6
- background-color: $white;
7
- border-left: 2px solid transparent;
8
- transition: background-color $base-duration $base-timing;
9
-
10
- &:hover {
11
- background-color: $base-background-color;
12
- border-left-color: $blue;
13
- cursor: pointer;
14
- }
15
-
16
- img {
17
- max-height: 2em;
18
- }
19
- }
20
-
21
- .table__action--destroy {
22
- color: $light-red;
23
- }
24
-
25
- .table__link-plain {
26
- color: inherit;
27
-
28
- &:hover {
29
- color: inherit;
30
- }
31
- }
@@ -1,20 +0,0 @@
1
- <%#
2
- # Sidebar
3
-
4
- This partial is used to display the sidebar in Administrate.
5
- By default, the sidebar contains navigation links
6
- for all resources in the admin dashboard,
7
- as defined by the routes in the `admin/` namespace
8
- %>
9
-
10
- <ul class="sidebar__list">
11
- <% Administrate::Namespace.new(namespace).resources.each do |resource| %>
12
- <li>
13
- <%= link_to(
14
- display_resource_name(resource),
15
- [namespace, resource.path],
16
- class: "sidebar__link sidebar__link--#{nav_link_state(resource)}"
17
- ) %>
18
- </li>
19
- <% end %>
20
- </ul>