activeadmin_materialize_theme 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73d91734349b706cb684ac0196aff67e7ceb0ab8791d9714f314b71e478b8ef3
4
- data.tar.gz: 83f097a8dc60379bc077fd22f22d7c28fc0ad3870583ae19e2a3ef7c9c7e5962
3
+ metadata.gz: aa0196437fae5e331eb7f3fe534cc27505fa1589312d6f8c341ed51d638d3cd8
4
+ data.tar.gz: d4b25e2d9494610de3c62f7044a4f7778d29e83c9582aa429293efe60ca387b2
5
5
  SHA512:
6
- metadata.gz: 1eca31457583662f4f0fbdf63901a36caa28129471d7b7b3abec6418e0fa0513e73ac62bd21b4abe53a0c5d995845b1f929d22a867a2338fb0120d10a84cfd4e
7
- data.tar.gz: c96c3b708fa7b57ec49d0b3e875f2f40cce03b3155b2adfa035e7e1ae715cb7c1f21f2957aebfc6fdb5d6bd27caa072a19542fa680e898d6ad2336713f853202
6
+ metadata.gz: ad3aa1a0605f1ebbb306c4ec3071578e09ed10b06fd7df628e05a9c87e9e8208afd2a255d562543a9e2702bc0163d7dde391a2733b09eb3ee679d4a36f987693
7
+ data.tar.gz: 9eb0ef5a98080ddb0ef059c128eb7dc90874e8dc7fd5d725421b66209da4f73b2aa8f253904f972a205caf182f989281b9c7d06ec40e194f409c69ba9e4ee90f
@@ -2,9 +2,9 @@
2
2
 
3
3
  (function () {
4
4
  // --- functions -------------------------------------------------------------
5
- function addClassToElements(class_name, elements) {
5
+ function addClassToElements(elements, class_name) {
6
6
  document.querySelectorAll(elements).forEach(
7
- (el) => el.className += ' ' + class_name
7
+ (el) => el.classList.add(class_name)
8
8
  )
9
9
  }
10
10
 
@@ -13,10 +13,13 @@
13
13
  const checkbox = el.querySelector('[type="checkbox"]')
14
14
  const label = document.createElement('label')
15
15
  const span = document.createElement('span')
16
+ span.className = 'aa_mt_checkbox'
16
17
  label.appendChild(span)
17
18
  el.appendChild(label)
18
19
  label.insertBefore(checkbox, span)
19
20
  })
21
+ const selector = 'body.active_admin .resource_selection_toggle_cell >label, body.active_admin .choices >label'
22
+ document.querySelectorAll(selector).forEach((el) => prepareCheckbox(el))
20
23
  }
21
24
 
22
25
  function initDropdowns() {
@@ -34,21 +37,14 @@
34
37
  }
35
38
 
36
39
  function initFormFields() {
37
- addClassToElements('input-field', 'body.active_admin .formtastic .input')
38
- addClassToElements('materialize-textarea', 'body.active_admin .formtastic textarea')
39
- document.querySelectorAll('body.active_admin .input-field.boolean > label').forEach((el) => {
40
- const text = el.lastChild
41
- if (text.nodeType == Node.TEXT_NODE) {
42
- const span = document.createElement('span')
43
- span.innerHTML = text.textContent
44
- text.replaceWith(span)
45
- }
46
- })
40
+ addClassToElements('body.active_admin .formtastic .input', 'input-field')
41
+ addClassToElements('body.active_admin .formtastic textarea', 'materialize-textarea')
42
+ document.querySelectorAll('body.active_admin .input-field.boolean > label').forEach((el) => prepareCheckbox(el))
47
43
  }
48
44
 
49
45
  function initNestedMenu() {
50
46
  let nested_menu_cnt = 0
51
- addClassToElements('dropdown-content', '.menu_item.has_nested >ul')
47
+ addClassToElements('body.active_admin .menu_item.has_nested >ul', 'dropdown-content')
52
48
  document.querySelectorAll('.menu_item.has_nested').forEach((el) => {
53
49
  nested_menu_cnt += 1
54
50
  el.childNodes.forEach((node) => {
@@ -63,12 +59,31 @@
63
59
  })
64
60
  }
65
61
 
62
+ function initTabs() {
63
+ document.querySelectorAll('body.active_admin .formtastic >.tabs').forEach(
64
+ (el) => el.classList.remove('tabs')
65
+ )
66
+ addClassToElements('body.active_admin .formtastic .nav-tabs', 'tabs')
67
+ addClassToElements('body.active_admin .formtastic .nav-tabs >li', 'tab')
68
+ }
69
+
70
+ function prepareCheckbox(el) {
71
+ const text = el.lastChild
72
+ if (text.nodeType == Node.TEXT_NODE) {
73
+ const span = document.createElement('span')
74
+ span.innerHTML = text.textContent
75
+ span.className = 'aa_mt_checkbox'
76
+ text.replaceWith(span)
77
+ }
78
+ }
79
+
66
80
  function setup() {
67
- addClassToElements('no-autoinit', 'body.active_admin #header >.tabs')
81
+ addClassToElements('body.active_admin #header >.tabs', 'no-autoinit')
68
82
  initCheckboxes()
69
83
  initDropdowns()
70
84
  initFormFields()
71
85
  initNestedMenu()
86
+ initTabs()
72
87
  M.AutoInit()
73
88
  }
74
89
 
@@ -10,6 +10,12 @@ body.active_admin {
10
10
  @extend .btn;
11
11
  }
12
12
 
13
+ .aa_mt_checkbox {
14
+ padding-left: 2.5rem;
15
+ padding-right: 1.5rem;
16
+ vertical-align: middle;
17
+ }
18
+
13
19
  .col-selectable {
14
20
  text-align: center;
15
21
  }
@@ -90,11 +96,6 @@ body.active_admin {
90
96
  content: ' ↓';
91
97
  }
92
98
 
93
- .resource_selection_cell span {
94
- padding: 0 1rem;
95
- vertical-align: middle;
96
- }
97
-
98
99
  .ui-dialog {
99
100
  @extend .modal;
100
101
 
@@ -14,6 +14,11 @@ body.active_admin {
14
14
  padding: 0;
15
15
  }
16
16
 
17
+ h3 {
18
+ font-size: 2.2rem;
19
+ margin: 0.4rem 0 0 0;
20
+ }
21
+
17
22
  .actions ol, .inputs ol {
18
23
  list-style-type: none;
19
24
  margin: 0;
@@ -21,7 +26,7 @@ body.active_admin {
21
26
  }
22
27
 
23
28
  .actions {
24
- margin: 3rem 0 0.5rem 0 !important;
29
+ margin: 2rem 0 0.5rem 0 !important;
25
30
 
26
31
  a {
27
32
  @extend .btn;
@@ -55,6 +60,15 @@ body.active_admin {
55
60
  }
56
61
  }
57
62
 
63
+ >.errors {
64
+ @extend .z-depth-2;
65
+
66
+ background: color('red', 'base');
67
+ color: #fff;
68
+ margin: 0.7rem 0;
69
+ padding: 1rem;
70
+ }
71
+
58
72
  .field_with_errors {
59
73
  >input {
60
74
  border-bottom: 1px solid color('materialize-red', 'base');
@@ -70,9 +84,9 @@ body.active_admin {
70
84
  margin: 0;
71
85
  }
72
86
 
73
- >.inputs {
87
+ .inputs {
74
88
  position: relative;
75
- margin-bottom: 3rem;
89
+ margin-bottom: 2rem;
76
90
 
77
91
  >legend {
78
92
  display: block;
@@ -109,11 +123,6 @@ body.active_admin {
109
123
  padding: 2rem;
110
124
  position: relative;
111
125
 
112
- >h3 {
113
- font-size: 2.2rem;
114
- margin: 0.4rem 0 0 0;
115
- }
116
-
117
126
  >.has_many_add {
118
127
  background-color: color('cyan', 'base');
119
128
  margin-top: 0.4rem;
@@ -127,5 +136,11 @@ body.active_admin {
127
136
  margin-bottom: 2rem;
128
137
  }
129
138
  }
139
+
140
+ .nav-tabs {
141
+ @extend .z-depth-1;
142
+
143
+ margin-bottom: 2rem;
144
+ }
130
145
  }
131
146
  }
@@ -22,6 +22,28 @@ body.active_admin.index {
22
22
  padding-bottom: 0.3rem !important;
23
23
  padding-top: 0.3rem !important;
24
24
  }
25
+
26
+ .aa_mt_checkbox {
27
+ padding: 0 1rem !important;
28
+ }
29
+ }
30
+
31
+ .index_as_grid {
32
+ >table {
33
+ display: block;
34
+
35
+ tbody {
36
+ display: block;
37
+ }
38
+
39
+ tr {
40
+ display: flex;
41
+ }
42
+
43
+ img {
44
+ width: 100%;
45
+ }
46
+ }
25
47
  }
26
48
 
27
49
  .paginated_collection {
@@ -40,16 +62,17 @@ body.active_admin.index {
40
62
  }
41
63
 
42
64
  >.scopes {
65
+ display: inline-block;
66
+ }
67
+
68
+ .table_tools_segmented_control {
43
69
  border: 1px solid #ddd;
44
70
  border-radius: 0.5rem;
45
71
  display: inline-block;
72
+ margin: 0 0 0 2rem;
46
73
  vertical-align: middle;
47
74
 
48
- >ul {
49
- margin: 0;
50
- }
51
-
52
- .scope {
75
+ >li {
53
76
  display: inline-block;
54
77
  padding: 0.2rem 1rem;
55
78
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveadminMaterializeTheme
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_materialize_theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Roccoberton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-12 00:00:00.000000000 Z
11
+ date: 2020-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin