crowdai_admin 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENCE.txt +22 -0
- data/Readme.md +84 -0
- data/app/assets/fonts/Lato-Bold.eot +0 -0
- data/app/assets/fonts/Lato-Bold.ttf +0 -0
- data/app/assets/fonts/Lato-Bold.woff +0 -0
- data/app/assets/fonts/Lato-Bold.woff2 +0 -0
- data/app/assets/fonts/Lato-BoldItalic.eot +0 -0
- data/app/assets/fonts/Lato-BoldItalic.ttf +0 -0
- data/app/assets/fonts/Lato-BoldItalic.woff +0 -0
- data/app/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/Lato-Italic.eot +0 -0
- data/app/assets/fonts/Lato-Italic.ttf +0 -0
- data/app/assets/fonts/Lato-Italic.woff +0 -0
- data/app/assets/fonts/Lato-Italic.woff2 +0 -0
- data/app/assets/fonts/Lato-Regular.eot +0 -0
- data/app/assets/fonts/Lato-Regular.ttf +0 -0
- data/app/assets/fonts/Lato-Regular.woff +0 -0
- data/app/assets/fonts/Lato-Regular.woff2 +0 -0
- data/app/assets/javascripts/crowdai_admin/base.js +79 -0
- data/app/assets/stylesheets/crowdai_admin/_base.scss +42 -0
- data/app/assets/stylesheets/crowdai_admin/_common.scss +27 -0
- data/app/assets/stylesheets/crowdai_admin/_grid.scss +4 -0
- data/app/assets/stylesheets/crowdai_admin/_reset.scss +41 -0
- data/app/assets/stylesheets/crowdai_admin/components/_columns.scss +4 -0
- data/app/assets/stylesheets/crowdai_admin/components/_comments.scss +54 -0
- data/app/assets/stylesheets/crowdai_admin/components/_components.scss +13 -0
- data/app/assets/stylesheets/crowdai_admin/components/_date_picker.scss +38 -0
- data/app/assets/stylesheets/crowdai_admin/components/_dialogs.scss +23 -0
- data/app/assets/stylesheets/crowdai_admin/components/_flash.scss +27 -0
- data/app/assets/stylesheets/crowdai_admin/components/_form.scss +65 -0
- data/app/assets/stylesheets/crowdai_admin/components/_iframes.scss +27 -0
- data/app/assets/stylesheets/crowdai_admin/components/_inputs.scss +109 -0
- data/app/assets/stylesheets/crowdai_admin/components/_pagination.scss +25 -0
- data/app/assets/stylesheets/crowdai_admin/components/_panel_contents.scss +14 -0
- data/app/assets/stylesheets/crowdai_admin/components/_status_tag.scss +17 -0
- data/app/assets/stylesheets/crowdai_admin/components/_tables.scss +65 -0
- data/app/assets/stylesheets/crowdai_admin/components/_tabs.scss +33 -0
- data/app/assets/stylesheets/crowdai_admin/layouts/_filter.scss +64 -0
- data/app/assets/stylesheets/crowdai_admin/layouts/_footer.scss +4 -0
- data/app/assets/stylesheets/crowdai_admin/layouts/_header.scss +237 -0
- data/app/assets/stylesheets/crowdai_admin/layouts/_main_content.scss +44 -0
- data/app/assets/stylesheets/crowdai_admin/layouts/_sidebar.scss +104 -0
- data/app/assets/stylesheets/crowdai_admin/layouts/_wrapper.scss +8 -0
- data/app/assets/stylesheets/crowdai_admin/mixins/_buttons_mixins.scss +120 -0
- data/app/assets/stylesheets/crowdai_admin/mixins/_mixins.scss +3 -0
- data/app/assets/stylesheets/crowdai_admin/mixins/_prefix_mixins.scss +63 -0
- data/app/assets/stylesheets/crowdai_admin/mixins/_sidebar_mixins.scss +24 -0
- data/app/assets/stylesheets/crowdai_admin/pages/_form.scss +116 -0
- data/app/assets/stylesheets/crowdai_admin/pages/_index.scss +116 -0
- data/app/assets/stylesheets/crowdai_admin/pages/_login.scss +65 -0
- data/app/assets/stylesheets/crowdai_admin/pages/_show.scss +3 -0
- data/app/assets/stylesheets/crowdai_admin/variables/_colors.scss +49 -0
- data/app/assets/stylesheets/crowdai_admin/variables/_media_queries.scss +10 -0
- data/app/assets/stylesheets/crowdai_admin/variables/_size.scss +9 -0
- data/app/assets/stylesheets/crowdai_admin/variables/_variables.scss +5 -0
- data/lib/crowdai_admin/custom_builder.rb +65 -0
- data/lib/crowdai_admin/toggle_booleans.rb +41 -0
- data/lib/crowdai_admin/version.rb +3 -0
- data/lib/crowdai_admin.rb +11 -0
- metadata +178 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
@mixin button() {
|
2
|
+
border-radius: $border-radius;
|
3
|
+
display: inline-block;
|
4
|
+
@include transition-button();
|
5
|
+
cursor: pointer;
|
6
|
+
|
7
|
+
&:active, &:focus {
|
8
|
+
outline: 0;
|
9
|
+
}
|
10
|
+
|
11
|
+
&.disabled, &:disabled {
|
12
|
+
opacity: 0.6;
|
13
|
+
cursor: no-drop;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
@mixin primary-button($background-color, $color) {
|
18
|
+
background-color: $background-color;
|
19
|
+
color: $color;
|
20
|
+
border: none;
|
21
|
+
@include button();
|
22
|
+
|
23
|
+
&:hover {
|
24
|
+
background-color: lighten($background-color, 10%);
|
25
|
+
}
|
26
|
+
|
27
|
+
&:active, &:focus {
|
28
|
+
background-color: darken($background-color, 10%);
|
29
|
+
}
|
30
|
+
|
31
|
+
&:disabled {
|
32
|
+
background-color: $background-color;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
@mixin secondary-button($color) {
|
37
|
+
background-color: #fff;
|
38
|
+
color: $color;
|
39
|
+
border: 1px solid $color;
|
40
|
+
@include button();
|
41
|
+
|
42
|
+
&:hover {
|
43
|
+
color: #fff;
|
44
|
+
background-color: $color;
|
45
|
+
}
|
46
|
+
|
47
|
+
&:active, &:focus {
|
48
|
+
background-color: darken($color, 10%);
|
49
|
+
color: #fff;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
@mixin secondary-dropdown($color) {
|
54
|
+
@include secondary-button($color);
|
55
|
+
padding: 6px 25px 6px 10px;
|
56
|
+
position: relative;
|
57
|
+
|
58
|
+
&:after {
|
59
|
+
@include icon("\f0dd");
|
60
|
+
position: absolute;
|
61
|
+
right: 8px;
|
62
|
+
}
|
63
|
+
|
64
|
+
&:active, &:focus {
|
65
|
+
background-color: darken($color, 10%);
|
66
|
+
color: #fff;
|
67
|
+
}
|
68
|
+
|
69
|
+
&.disabled, &:disabled {
|
70
|
+
color: $grey;
|
71
|
+
background-color: #f3f7f9;
|
72
|
+
border-color: #f3f7f9;
|
73
|
+
@include box-shadow(none);
|
74
|
+
opacity: .65;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
@mixin group-button($color) {
|
79
|
+
a {
|
80
|
+
display: inline-block;
|
81
|
+
color: $color;
|
82
|
+
border-top: 1px solid $color;
|
83
|
+
border-bottom: 1px solid $color;
|
84
|
+
float: left;
|
85
|
+
padding: 6px 10px;
|
86
|
+
border-right: 1px solid $color;
|
87
|
+
@include transition-button();
|
88
|
+
}
|
89
|
+
|
90
|
+
&:first-child a {
|
91
|
+
border-left: 1px solid $color;
|
92
|
+
border-top-left-radius: $border-radius;
|
93
|
+
border-bottom-left-radius: $border-radius;
|
94
|
+
}
|
95
|
+
|
96
|
+
&:last-child a {
|
97
|
+
border-top-right-radius: $border-radius;
|
98
|
+
border-bottom-right-radius: $border-radius;
|
99
|
+
}
|
100
|
+
|
101
|
+
&:hover {
|
102
|
+
a {
|
103
|
+
background-color: lighten($color, 10%);
|
104
|
+
border-color: lighten($color, 10%);
|
105
|
+
color: #fff;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
&:active, &:focus, &.selected {
|
110
|
+
a {
|
111
|
+
background-color: darken($color, 10%);
|
112
|
+
border-color: darken($color, 10%);
|
113
|
+
color: #fff;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
@mixin little-button() {
|
119
|
+
padding: 6px 12px;
|
120
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
@mixin transform($var) {
|
2
|
+
-webkit-transform: $var;
|
3
|
+
-moz-transform: $var;
|
4
|
+
-ms-transform: $var;
|
5
|
+
-o-transform: $var;
|
6
|
+
transform: $var;
|
7
|
+
}
|
8
|
+
|
9
|
+
@mixin appearance($effect:none) {
|
10
|
+
-webkit-appearance: $effect;
|
11
|
+
-moz-appearance: $effect;
|
12
|
+
-ms-appearance: $effect;
|
13
|
+
-o-appearance: $effect;
|
14
|
+
appearance: $effect;
|
15
|
+
}
|
16
|
+
|
17
|
+
@mixin transition($args...) {
|
18
|
+
-webkit-transition: $args;
|
19
|
+
-o-transition: $args;
|
20
|
+
transition: $args;
|
21
|
+
}
|
22
|
+
|
23
|
+
@mixin transition-button() {
|
24
|
+
@include transition(border .2s linear,color .2s linear,width .2s linear,background-color .2s linear);
|
25
|
+
}
|
26
|
+
|
27
|
+
@mixin box-shadow($args...) {
|
28
|
+
-webkit-box-shadow: $args;
|
29
|
+
-moz-box-shadow: $args;
|
30
|
+
box-shadow: $args;
|
31
|
+
}
|
32
|
+
|
33
|
+
@mixin disable-user-select() {
|
34
|
+
-webkit-touch-callout: none;
|
35
|
+
-webkit-user-select: none;
|
36
|
+
-khtml-user-select: none;
|
37
|
+
-moz-user-select: none;
|
38
|
+
-ms-user-select: none;
|
39
|
+
user-select: none;
|
40
|
+
}
|
41
|
+
|
42
|
+
@mixin clear-fix() {
|
43
|
+
&:after {
|
44
|
+
content: '';
|
45
|
+
display: block;
|
46
|
+
clear: both;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
@mixin outline() {
|
51
|
+
&:focus {
|
52
|
+
outline: 0;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
@mixin icon($code-icon) {
|
57
|
+
font-size: inherit;
|
58
|
+
text-rendering: auto;
|
59
|
+
-webkit-font-smoothing: antialiased;
|
60
|
+
-moz-osx-font-smoothing: grayscale;
|
61
|
+
font: normal normal normal 14px/1 FontAwesome;
|
62
|
+
content: $code-icon;
|
63
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@mixin sidebar-container() {
|
2
|
+
#active_admin_content.with_sidebar {
|
3
|
+
#main_content_wrapper {
|
4
|
+
width: $screen-filter-width;
|
5
|
+
|
6
|
+
@media screen and (min-width: $sm-width) {
|
7
|
+
padding-right: 10px;
|
8
|
+
}
|
9
|
+
|
10
|
+
@media screen and (min-width: $lg-width) {
|
11
|
+
padding-right: 0;
|
12
|
+
width: $lg-screen-filter-width;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
#sidebar {
|
17
|
+
display: inline-block;
|
18
|
+
|
19
|
+
tr:hover {
|
20
|
+
background: rgba(243, 247, 249, 0.3);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
body.logged_in {
|
2
|
+
&.new, &.edit, &.create, &.update {
|
3
|
+
@include sidebar-container();
|
4
|
+
|
5
|
+
.formtastic legend {
|
6
|
+
font-weight: normal;
|
7
|
+
}
|
8
|
+
|
9
|
+
fieldset.inputs {
|
10
|
+
margin-bottom: 20px;
|
11
|
+
}
|
12
|
+
|
13
|
+
.input {
|
14
|
+
.label {
|
15
|
+
padding-bottom: 5px;
|
16
|
+
text-align: left;
|
17
|
+
margin: auto 0;
|
18
|
+
padding-top: 8px;
|
19
|
+
text-align: right;
|
20
|
+
font-size: 14px;
|
21
|
+
|
22
|
+
@media screen and (min-width: $sm-width) {
|
23
|
+
padding-bottom: 0;
|
24
|
+
height: 25px;
|
25
|
+
width: 25%;
|
26
|
+
float: left;
|
27
|
+
padding-right: 20px;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
input, textarea {
|
31
|
+
@media screen and (min-width: $sm-width) {
|
32
|
+
width: 50%;
|
33
|
+
}
|
34
|
+
|
35
|
+
&[type='radio'] {
|
36
|
+
width: 15px;
|
37
|
+
float: left;
|
38
|
+
margin-top: 3px;
|
39
|
+
}
|
40
|
+
|
41
|
+
&[type='checkbox'] {
|
42
|
+
width: 15px;
|
43
|
+
margin: 0 5px -2px 0;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
.select2-container {
|
48
|
+
@media screen and (min-width: $sm-width) {
|
49
|
+
width: 50% !important;
|
50
|
+
}
|
51
|
+
|
52
|
+
a {
|
53
|
+
height: 30px;
|
54
|
+
line-height: 30px;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
select {
|
59
|
+
min-width: 50%;
|
60
|
+
height: 30px;
|
61
|
+
}
|
62
|
+
|
63
|
+
.fragment {
|
64
|
+
margin-right: 10px;
|
65
|
+
|
66
|
+
label {
|
67
|
+
padding-right: 5px;
|
68
|
+
}
|
69
|
+
|
70
|
+
select {
|
71
|
+
min-width: auto;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
&.boolean {
|
76
|
+
margin-left: 25%;
|
77
|
+
@include disable-user-select();
|
78
|
+
|
79
|
+
input {
|
80
|
+
width: auto;
|
81
|
+
}
|
82
|
+
|
83
|
+
label {
|
84
|
+
font-size: 14px;
|
85
|
+
cursor: pointer;
|
86
|
+
padding: 5px 5px 5px 0;
|
87
|
+
}
|
88
|
+
|
89
|
+
input[type='checkbox'] {
|
90
|
+
width: 15px;
|
91
|
+
margin: 0 5px -2px 0;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
li.fragment {
|
96
|
+
display: inline;
|
97
|
+
}
|
98
|
+
|
99
|
+
li.choice {
|
100
|
+
margin-left: 25%;
|
101
|
+
|
102
|
+
.field_with_errors {
|
103
|
+
float: left;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
.inline-errors {
|
108
|
+
padding-left: 25%;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
.actions {
|
113
|
+
padding-left: 25%;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
body.index {
|
2
|
+
|
3
|
+
.resource_selection_toggle_cell, .resource_selection_cell {
|
4
|
+
display: flex;
|
5
|
+
}
|
6
|
+
|
7
|
+
.table_tools {
|
8
|
+
margin-bottom: 20px;
|
9
|
+
font-size: 14px;
|
10
|
+
|
11
|
+
&:after {
|
12
|
+
content: '';
|
13
|
+
display: block;
|
14
|
+
clear: both;
|
15
|
+
}
|
16
|
+
|
17
|
+
input[type='checkbox'] {
|
18
|
+
display: flex;
|
19
|
+
}
|
20
|
+
|
21
|
+
.collection_selection_toggle_all {
|
22
|
+
display: flex !important;
|
23
|
+
}
|
24
|
+
|
25
|
+
.batch_actions_selector {
|
26
|
+
display: inline-block;
|
27
|
+
}
|
28
|
+
|
29
|
+
.dropdown_menu_button{
|
30
|
+
@include secondary-dropdown($primary-color);
|
31
|
+
}
|
32
|
+
|
33
|
+
.dropdown_menu_list {
|
34
|
+
background-color: #fff;
|
35
|
+
padding: 10px 15px;
|
36
|
+
border-radius: $border-radius;
|
37
|
+
@include box-shadow($box-shadow);
|
38
|
+
display: inline-block;
|
39
|
+
position: absolute;
|
40
|
+
z-index: 1;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
.paginated_collection_contents {
|
45
|
+
margin-bottom: 20px;
|
46
|
+
overflow-x: auto;
|
47
|
+
}
|
48
|
+
|
49
|
+
#index_footer {
|
50
|
+
font-size: 14px;
|
51
|
+
}
|
52
|
+
|
53
|
+
.sortable {
|
54
|
+
position: relative;
|
55
|
+
|
56
|
+
&:after {
|
57
|
+
@include icon("\f0dc");
|
58
|
+
font-size: 12px;
|
59
|
+
position: absolute;
|
60
|
+
top: 50%;
|
61
|
+
right: 5px;
|
62
|
+
@include transform(translateY(-50%));
|
63
|
+
|
64
|
+
@media screen and (min-width: $md-width) {
|
65
|
+
font-size: 14px/1;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
&.sorted-desc:after {
|
70
|
+
content: "\f0dd";
|
71
|
+
}
|
72
|
+
|
73
|
+
&.sorted-asc:after {
|
74
|
+
content: "\f0de";
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
.table_actions {
|
79
|
+
.member_link {
|
80
|
+
@include primary-button($primary-color, white);
|
81
|
+
padding: 2px 9px;
|
82
|
+
margin-right: 4px;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
.scopes {
|
87
|
+
.scope {
|
88
|
+
@include group-button($primary-color);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
#sidebar {
|
93
|
+
position: fixed;
|
94
|
+
right: - $filter-width;
|
95
|
+
|
96
|
+
@media screen and (min-width: $x-lg-width) {
|
97
|
+
right: - $lg-filter-width;
|
98
|
+
}
|
99
|
+
|
100
|
+
&:before {
|
101
|
+
cursor: pointer;
|
102
|
+
position: absolute;
|
103
|
+
top: 30px;
|
104
|
+
left: -40px;
|
105
|
+
width: 40px;
|
106
|
+
height: 50px;
|
107
|
+
background-color: #fff;
|
108
|
+
@include box-shadow(-1px 0 4px 0 rgba(0,0,0,.04));
|
109
|
+
border-top-left-radius: $border-radius;
|
110
|
+
border-bottom-left-radius: $border-radius;
|
111
|
+
@include icon("\f0b0");
|
112
|
+
font-size: 20px;
|
113
|
+
padding: 15px 10px;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
body.logged_out {
|
2
|
+
.flash {
|
3
|
+
position: fixed;
|
4
|
+
}
|
5
|
+
|
6
|
+
#active_admin_content {
|
7
|
+
height: 100vh;
|
8
|
+
width: 100%;
|
9
|
+
display: flex;
|
10
|
+
align-items: center;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
#login {
|
15
|
+
width: 100%;
|
16
|
+
margin: auto;
|
17
|
+
background-color: white;
|
18
|
+
border-top: $border-radius solid $primary-color;
|
19
|
+
@include box-shadow($box-shadow);
|
20
|
+
color: $text-color;
|
21
|
+
padding: 20px;
|
22
|
+
|
23
|
+
@media screen and (min-width: 400px) {
|
24
|
+
border-radius: $border-radius;
|
25
|
+
width: 400px;
|
26
|
+
padding: 30px;
|
27
|
+
}
|
28
|
+
|
29
|
+
h2 {
|
30
|
+
text-align: center;
|
31
|
+
}
|
32
|
+
|
33
|
+
.label {
|
34
|
+
display: inline-block;
|
35
|
+
max-width: 100%;
|
36
|
+
margin-bottom: 5px;
|
37
|
+
}
|
38
|
+
|
39
|
+
.input.boolean {
|
40
|
+
@include disable-user-select();
|
41
|
+
label {
|
42
|
+
font-size: 15px;
|
43
|
+
cursor: pointer;
|
44
|
+
padding: 5px 5px 5px 0;
|
45
|
+
}
|
46
|
+
|
47
|
+
input[type='checkbox'] {
|
48
|
+
width: 15px;
|
49
|
+
margin: 0 5px -2px 0;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
a {
|
54
|
+
margin-top: 10px;
|
55
|
+
display: inline-block;
|
56
|
+
}
|
57
|
+
|
58
|
+
.input_action {
|
59
|
+
min-width: 50%;
|
60
|
+
}
|
61
|
+
|
62
|
+
input[type="submit"] {
|
63
|
+
line-height: 43px;
|
64
|
+
}
|
65
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
// BASIC COLOR
|
2
|
+
$red: #f0524d;
|
3
|
+
$green: #00897B;
|
4
|
+
$blue: #4bacfe;
|
5
|
+
$black: #36393D;
|
6
|
+
$grey: #76838f;
|
7
|
+
|
8
|
+
// flash
|
9
|
+
$error: #dc4747 !default;
|
10
|
+
$warning: #f2a654 !default;
|
11
|
+
$success: #46be8a !default;
|
12
|
+
$info: #57c7d4 !default;
|
13
|
+
$flash-text-color: #fff !default;
|
14
|
+
$flash-background-color: $grey !default;
|
15
|
+
|
16
|
+
// status_tag
|
17
|
+
$status-tag-text-color: #fff !default;
|
18
|
+
$status-tag-background-color: #cacaca !default;
|
19
|
+
$status-tag-background-valid-color: $success !default;
|
20
|
+
$status-tag-background-error-color: $error !default;
|
21
|
+
|
22
|
+
$border-color: #e4eaec;
|
23
|
+
|
24
|
+
|
25
|
+
// body
|
26
|
+
$body-background: #eee !default;
|
27
|
+
|
28
|
+
// header
|
29
|
+
$header-border-color: #e6e6e6 !default;
|
30
|
+
$header-background: #fff !default;
|
31
|
+
|
32
|
+
// nav action
|
33
|
+
$header-nav-action-hover-background: #f5f5f5 !default;
|
34
|
+
$header-nav-action-active-background: #f0f0f0 !default;
|
35
|
+
|
36
|
+
//sidebar
|
37
|
+
$sidebar-border-color: $header-border-color !default;
|
38
|
+
$sidebar-background: #f5f5f5 !default;
|
39
|
+
|
40
|
+
$sidebar-item-hover-background: #f0f0f0 !default;
|
41
|
+
$sidebar-nested-item-hover-background: #e7e7e7 !default;
|
42
|
+
|
43
|
+
// text
|
44
|
+
$text-color: #5a5a5a !default;
|
45
|
+
$text-color-important: #526069 !default;
|
46
|
+
|
47
|
+
$box-shadow: 0 0 4px 0 rgba(0,0,0,0.1) !default;
|
48
|
+
|
49
|
+
$primary-color: $red !default;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
$header-width: 200px !default;
|
2
|
+
$screen-header-width: calc(100% - 200px) !default;
|
3
|
+
$lg-header-width: 250px !default;
|
4
|
+
$lg-screen-header-width: calc(100% - 250px) !default;
|
5
|
+
|
6
|
+
$filter-width: 230px !default;
|
7
|
+
$screen-filter-width: calc(100% - 230px) !default;
|
8
|
+
$lg-filter-width: 270px !default;
|
9
|
+
$lg-screen-filter-width: calc(100% - 270px) !default;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module CrowdaiAdmin
|
2
|
+
class CustomBuilder
|
3
|
+
attr_accessor :context, :model, :args, :block
|
4
|
+
|
5
|
+
def initialize(context, model, *args, &block)
|
6
|
+
@context = context
|
7
|
+
@model = model
|
8
|
+
@args = *args
|
9
|
+
@block = block
|
10
|
+
end
|
11
|
+
|
12
|
+
def render
|
13
|
+
raise NotImplementedError
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.create_view_methods
|
17
|
+
builder_class = self
|
18
|
+
builder_name = builder_method_name
|
19
|
+
|
20
|
+
::ActiveAdmin::Views::TableFor.class_eval do
|
21
|
+
define_method("#{builder_name}_column") do |*args, &block|
|
22
|
+
column(*args) { |model| builder_class.new(self, model, *args, &block).render }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
::ActiveAdmin::Views::AttributesTable.class_eval do
|
27
|
+
define_method("#{builder_name}_row") do |*args, &block|
|
28
|
+
row(*args) { |model| builder_class.new(self, model, *args, &block).render }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.builder_method_name
|
34
|
+
name.underscore.to_s.split("/").last.chomp("_builder")
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def data
|
40
|
+
@data ||= block ? block.call(model) : model.send(attribute)
|
41
|
+
end
|
42
|
+
|
43
|
+
def options
|
44
|
+
@options ||= has_opts? ? args.last : {}
|
45
|
+
end
|
46
|
+
|
47
|
+
def class_name
|
48
|
+
model.class.name.demodulize.underscore
|
49
|
+
end
|
50
|
+
|
51
|
+
def attribute
|
52
|
+
@attribute ||= has_label? ? args[1] : args[0]
|
53
|
+
end
|
54
|
+
|
55
|
+
def has_label?
|
56
|
+
has_opts? ? args.length == 3 : args.length == 2
|
57
|
+
end
|
58
|
+
|
59
|
+
def has_opts?
|
60
|
+
@has_opts ||= args.last.is_a?(Hash)
|
61
|
+
end
|
62
|
+
|
63
|
+
create_view_methods
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module CrowdaiAdmin
|
2
|
+
class ToggleBooleans < CustomBuilder
|
3
|
+
def render
|
4
|
+
raise ArgumentError, 'Block should not be used in toggle bool columns' if block
|
5
|
+
return if conditional_eval_hide?
|
6
|
+
context.div class: 'toggle-bool-switches-container' do
|
7
|
+
context.span toggle
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def toggle
|
12
|
+
toggle_classes = 'toggle-bool-switch'
|
13
|
+
toggle_classes += ' on' if data
|
14
|
+
toggle_classes += ' notify-success' if options[:success_message]
|
15
|
+
|
16
|
+
context.span(
|
17
|
+
'',
|
18
|
+
id: "toggle-#{class_name}-#{model.id}-#{attribute}",
|
19
|
+
class: toggle_classes,
|
20
|
+
'data-model' => class_name,
|
21
|
+
'data-object_id' => model.id,
|
22
|
+
'data-field' => attribute,
|
23
|
+
'data-value' => data,
|
24
|
+
'data-url' => context.auto_url_for(model),
|
25
|
+
'data-success_message' => options[:success_message]
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def conditional_eval_hide?
|
30
|
+
[:if, :unless].any? do |cond|
|
31
|
+
if options[cond]
|
32
|
+
raise ArgumentError, "'#{cond}' option should be a proc" unless options[cond].is_a?(Proc)
|
33
|
+
result = options[cond].call(model)
|
34
|
+
cond == :if ? !result : result
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
CrowdaiAdmin::ToggleBooleans.create_view_methods
|