para 0.9.4 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/para/admin/src/_alert.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_base.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_breadcrumb.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_common.sass +53 -54
- data/app/assets/stylesheets/para/admin/src/_dropdown.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_form.sass +17 -15
- data/app/assets/stylesheets/para/admin/src/_list.sass +8 -6
- data/app/assets/stylesheets/para/admin/src/_mixins.sass +13 -13
- data/app/assets/stylesheets/para/admin/src/_multi-select.sass +2 -2
- data/app/assets/stylesheets/para/admin/src/_navigation.sass +4 -6
- data/app/assets/stylesheets/para/admin/src/_navtabs.sass +2 -2
- data/app/assets/stylesheets/para/admin/src/_nested-many.sass +3 -3
- data/app/assets/stylesheets/para/admin/src/_orderable.sass +2 -2
- data/app/assets/stylesheets/para/admin/src/_pagination.sass +5 -5
- data/app/assets/stylesheets/para/admin/src/_panel.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_statcard.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_table.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_tree.sass +1 -1
- data/app/assets/stylesheets/para/admin/src/_variables.sass +1 -10
- data/app/assets/stylesheets/para/admin/src/_well.sass +2 -2
- data/app/assets/stylesheets/para/lib/compass/_support.scss +447 -0
- data/app/assets/stylesheets/para/lib/compass/css3/_box-shadow.scss +88 -0
- data/app/assets/stylesheets/para/lib/compass/css3/_images.scss +152 -0
- data/app/assets/stylesheets/para/lib/compass/css3/_inline-block.scss +31 -0
- data/app/assets/stylesheets/para/lib/compass/css3/_text-shadow.scss +82 -0
- data/app/assets/stylesheets/para/lib/compass/css3/_transform.scss +590 -0
- data/app/assets/stylesheets/para/lib/compass/css3/_transition.scss +190 -0
- data/app/assets/stylesheets/para/lib/compass/css3/_user-interface.scss +71 -0
- data/app/assets/stylesheets/para/lib/compass/utilities/general/_hacks.scss +65 -0
- data/app/assets/stylesheets/para/lib/datetimepicker.sass +1 -1
- data/app/assets/stylesheets/para/lib/fuelux.sass +2 -2
- data/app/assets/stylesheets/para/lib/redactor.sass +5 -5
- data/app/assets/stylesheets/para/lib/selectize.sass +6 -7
- data/app/controllers/para/admin/resources_controller.rb +9 -9
- data/app/helpers/para/admin/base_helper.rb +3 -3
- data/app/helpers/para/admin/nested_inputs_helper.rb +1 -1
- data/app/helpers/para/translations_helper.rb +1 -1
- data/app/models/para/application_record.rb +5 -3
- data/app/models/para/component/base.rb +6 -6
- data/app/models/para/component_section.rb +3 -3
- data/app/models/para/library/file.rb +2 -2
- data/app/models/para/page/section.rb +6 -7
- data/app/views/para/admin/main/index.html.haml +1 -1
- data/app/views/para/inputs/nested_many/_container.html.haml +1 -1
- data/lib/para/active_storage_downloader.rb +13 -7
- data/lib/para/cloneable/attachments_cloner.rb +5 -4
- data/lib/para/component.rb +0 -7
- data/lib/para/components_configuration.rb +18 -23
- data/lib/para/inputs/nested_one_input.rb +3 -3
- data/lib/para/version.rb +1 -1
- data/lib/para.rb +0 -2
- metadata +99 -104
@@ -0,0 +1,190 @@
|
|
1
|
+
@import "para/lib/compass/support";
|
2
|
+
|
3
|
+
// The the user threshold for transition support. Defaults to `$graceful-usage-threshold`
|
4
|
+
$transition-support-threshold: $graceful-usage-threshold !default;
|
5
|
+
|
6
|
+
|
7
|
+
// CSS Transitions
|
8
|
+
// Currently only works in Webkit.
|
9
|
+
//
|
10
|
+
// * expected in CSS3, FireFox 3.6/7 and Opera Presto 2.3
|
11
|
+
// * We'll be prepared.
|
12
|
+
//
|
13
|
+
// Including this submodule sets following defaults for the mixins:
|
14
|
+
//
|
15
|
+
// $default-transition-property : all
|
16
|
+
// $default-transition-duration : 1s
|
17
|
+
// $default-transition-function : false
|
18
|
+
// $default-transition-delay : false
|
19
|
+
//
|
20
|
+
// Override them if you like. Timing-function and delay are set to false for browser defaults (ease, 0s).
|
21
|
+
|
22
|
+
$default-transition-property: all !default;
|
23
|
+
|
24
|
+
$default-transition-duration: 1s !default;
|
25
|
+
|
26
|
+
$default-transition-function: null !default;
|
27
|
+
|
28
|
+
$default-transition-delay: null !default;
|
29
|
+
|
30
|
+
$transitionable-prefixed-values: transform, transform-origin !default;
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
// Checks if the value given is a unit of time.
|
35
|
+
@function is-time($value) {
|
36
|
+
@return if(type-of($value) == number, not not index(s ms, unit($value)), false);
|
37
|
+
}
|
38
|
+
|
39
|
+
// Returns `$property` with the given prefix if it is found in `$transitionable-prefixed-values`.
|
40
|
+
@function prefixed-for-transition($prefix, $property) {
|
41
|
+
@if not $prefix {
|
42
|
+
@return $property;
|
43
|
+
}
|
44
|
+
@if type-of($property) == list or type-of($property) == arglist {
|
45
|
+
$new-list: comma-list();
|
46
|
+
@each $v in $property {
|
47
|
+
$new-list: append($new-list, prefixed-for-transition($prefix, $v));
|
48
|
+
}
|
49
|
+
@return $new-list;
|
50
|
+
} @else {
|
51
|
+
@if index($transitionable-prefixed-values, $property) {
|
52
|
+
@return #{$prefix}-#{$property};
|
53
|
+
} @else {
|
54
|
+
@return $property;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
// Returns $transition-map which includes key and values that map to a transition declaration
|
60
|
+
@function transition-map($transition) {
|
61
|
+
$transition-map: ();
|
62
|
+
|
63
|
+
@each $item in $transition {
|
64
|
+
@if is-time($item) {
|
65
|
+
@if map-has-key($transition-map, duration) {
|
66
|
+
$transition-map: map-merge($transition-map, (delay: $item));
|
67
|
+
} @else {
|
68
|
+
$transition-map: map-merge($transition-map, (duration: $item));
|
69
|
+
}
|
70
|
+
} @else if map-has-key($transition-map, property) {
|
71
|
+
$transition-map: map-merge($transition-map, (timing-function: $item));
|
72
|
+
} @else {
|
73
|
+
$transition-map: map-merge($transition-map, (property: $item));
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
@return $transition-map;
|
78
|
+
}
|
79
|
+
|
80
|
+
// One or more properties to transition
|
81
|
+
//
|
82
|
+
// * for multiple, use a comma-delimited list
|
83
|
+
// * also accepts "all" or "none"
|
84
|
+
|
85
|
+
@mixin transition-property($properties...) {
|
86
|
+
$properties: set-arglist-default($properties, $default-transition-property);
|
87
|
+
@include with-each-prefix(css-transitions, $transition-support-threshold) {
|
88
|
+
$props: if($current-prefix, prefixed-for-transition($current-prefix, $properties), $properties);
|
89
|
+
@include prefix-prop(transition-property, $props);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
// One or more durations in seconds
|
94
|
+
//
|
95
|
+
// * for multiple, use a comma-delimited list
|
96
|
+
// * these durations will affect the properties in the same list position
|
97
|
+
|
98
|
+
@mixin transition-duration($durations...) {
|
99
|
+
$durations: set-arglist-default($durations, $default-transition-duration);
|
100
|
+
@include prefixed-properties(css-transitions, $transition-support-threshold, (
|
101
|
+
transition-duration: $durations
|
102
|
+
));
|
103
|
+
}
|
104
|
+
|
105
|
+
// One or more timing functions
|
106
|
+
//
|
107
|
+
// * [ ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier(x1, y1, x2, y2)]
|
108
|
+
// * For multiple, use a comma-delimited list
|
109
|
+
// * These functions will effect the properties in the same list position
|
110
|
+
|
111
|
+
@mixin transition-timing-function($functions...) {
|
112
|
+
$functions: set-arglist-default($functions, $default-transition-function);
|
113
|
+
@include prefixed-properties(css-transitions, $transition-support-threshold, (
|
114
|
+
transition-timing-function: $functions
|
115
|
+
));
|
116
|
+
}
|
117
|
+
|
118
|
+
// One or more transition-delays in seconds
|
119
|
+
//
|
120
|
+
// * for multiple, use a comma-delimited list
|
121
|
+
// * these delays will effect the properties in the same list position
|
122
|
+
|
123
|
+
@mixin transition-delay($delays...) {
|
124
|
+
$delays: set-arglist-default($delays, $default-transition-delay);
|
125
|
+
@include prefixed-properties(css-transitions, $transition-support-threshold, (
|
126
|
+
transition-delay: $delays
|
127
|
+
));
|
128
|
+
}
|
129
|
+
|
130
|
+
// Transition all-in-one shorthand
|
131
|
+
|
132
|
+
@mixin single-transition(
|
133
|
+
$property: $default-transition-property,
|
134
|
+
$duration: $default-transition-duration,
|
135
|
+
$function: $default-transition-function,
|
136
|
+
$delay: $default-transition-delay
|
137
|
+
) {
|
138
|
+
@include transition(compact($property $duration $function $delay));
|
139
|
+
}
|
140
|
+
|
141
|
+
@mixin transition($transitions...) {
|
142
|
+
$default: (compact($default-transition-property $default-transition-duration $default-transition-function $default-transition-delay),);
|
143
|
+
$transitions: if(length($transitions) == 1 and type-of(nth($transitions, 1)) == list and list-separator(nth($transitions, 1)) == comma, nth($transitions, 1), $transitions);
|
144
|
+
$transitions: set-arglist-default($transitions, $default);
|
145
|
+
|
146
|
+
|
147
|
+
@include with-each-prefix(css-transitions, $transition-support-threshold) {
|
148
|
+
$delays: comma-list();
|
149
|
+
$transitions-without-delays: comma-list();
|
150
|
+
$transitions-with-delays: comma-list();
|
151
|
+
$has-delays: false;
|
152
|
+
|
153
|
+
|
154
|
+
// This block can be made considerably simpler at the point in time that
|
155
|
+
// we no longer need to deal with the differences in how delays are treated.
|
156
|
+
@each $transition in $transitions {
|
157
|
+
// Declare initial values for transition
|
158
|
+
$transition: transition-map($transition);
|
159
|
+
|
160
|
+
$property: map-get($transition, property);
|
161
|
+
$duration: map-get($transition, duration);
|
162
|
+
$timing-function: map-get($transition, timing-function);
|
163
|
+
$delay: map-get($transition, delay);
|
164
|
+
|
165
|
+
// Parse transition string to assign values into correct variables
|
166
|
+
$has-delays: $has-delays or $delay;
|
167
|
+
|
168
|
+
@if $current-prefix == -webkit {
|
169
|
+
// Keep a list of delays in case one is specified
|
170
|
+
$delays: append($delays, if($delay, $delay, 0s));
|
171
|
+
$transitions-without-delays: append($transitions-without-delays,
|
172
|
+
prefixed-for-transition($current-prefix, $property) $duration $timing-function);
|
173
|
+
} @else {
|
174
|
+
$transitions-with-delays: append($transitions-with-delays,
|
175
|
+
prefixed-for-transition($current-prefix, $property) $duration $timing-function $delay);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
@if $current-prefix == -webkit {
|
180
|
+
@include prefix-prop(transition, $transitions-without-delays);
|
181
|
+
@if $has-delays {
|
182
|
+
@include prefix-prop(transition-delay, $delays);
|
183
|
+
}
|
184
|
+
} @else if $current-prefix {
|
185
|
+
@include prefix-prop(transition, $transitions-with-delays);
|
186
|
+
} @else {
|
187
|
+
transition: $transitions-with-delays;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
// User Interface
|
2
|
+
// This file can be expanded to handle all the user interface properties as
|
3
|
+
// they become available in browsers:
|
4
|
+
// http://www.w3.org/TR/2000/WD-css3-userint-20000216
|
5
|
+
|
6
|
+
@import "para/lib/compass/support";
|
7
|
+
|
8
|
+
// The prefixed support threshold for user-select.
|
9
|
+
// Defaults to the $graceful-usage-threshold.
|
10
|
+
$userselect-support-threshold: $graceful-usage-threshold !default;
|
11
|
+
|
12
|
+
// This property controls the selection model and granularity of an element.
|
13
|
+
//
|
14
|
+
// @param $select
|
15
|
+
// [ none | text | toggle | element | elements | all | inherit ]
|
16
|
+
@mixin user-select($select) {
|
17
|
+
$select: unquote($select);
|
18
|
+
|
19
|
+
@include with-each-prefix(user-select-none, $userselect-support-threshold) {
|
20
|
+
// old Firefox used a proprietary `-moz-none` value, starting with Firefox 21 `none` behaves like `-moz-none`
|
21
|
+
// @link https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
|
22
|
+
@include prefix-prop(user-select, if($current-prefix == -moz and $select == 'none', -moz-none, $select));
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
// The prefixed support threshold for input-placeholder.
|
27
|
+
// Defaults to the $graceful-usage-threshold.
|
28
|
+
$input-placeholder-support-threshold: $graceful-usage-threshold !default;
|
29
|
+
|
30
|
+
// Style the html5 input placeholder in browsers that support it.
|
31
|
+
//
|
32
|
+
// The styles for the input placeholder are passed as mixin content
|
33
|
+
// and the selector comes from the mixin's context.
|
34
|
+
//
|
35
|
+
// For example:
|
36
|
+
//
|
37
|
+
// #{elements-of-type(text-input)} {
|
38
|
+
// @include input-placeholder {
|
39
|
+
// color: #bfbfbf;
|
40
|
+
// font-style: italic;
|
41
|
+
// }
|
42
|
+
// }
|
43
|
+
//
|
44
|
+
// if you want to apply the placeholder styles to all elements supporting
|
45
|
+
// the `input-placeholder` pseudo class (beware of performance impacts):
|
46
|
+
//
|
47
|
+
// * {
|
48
|
+
// @include input-placeholder {
|
49
|
+
// color: #bfbfbf;
|
50
|
+
// font-style: italic;
|
51
|
+
// }
|
52
|
+
// }
|
53
|
+
@mixin input-placeholder {
|
54
|
+
@include with-each-prefix(css-placeholder, $input-placeholder-support-threshold) {
|
55
|
+
@if $current-prefix == -webkit {
|
56
|
+
&::-webkit-input-placeholder { @content; }
|
57
|
+
}
|
58
|
+
@elseif $current-prefix == -moz {
|
59
|
+
// for Firefox 19 and below
|
60
|
+
@if support-legacy-browser("firefox", "4", "19", $threshold: $input-placeholder-support-threshold) {
|
61
|
+
&:-moz-placeholder { @content; }
|
62
|
+
}
|
63
|
+
// for Firefox 20 and above
|
64
|
+
&::-moz-placeholder { @content; }
|
65
|
+
}
|
66
|
+
@elseif $current-prefix == -ms {
|
67
|
+
&:-ms-input-placeholder { @content; }
|
68
|
+
}
|
69
|
+
}
|
70
|
+
// This is not standardized yet so no official selector is generated.
|
71
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
@import "para/lib/compass/support";
|
2
|
+
|
3
|
+
// The legacy support threshold for has-layout.
|
4
|
+
// Defaults to the $critical-usage-threshold.
|
5
|
+
$has-layout-support-threshold: $critical-usage-threshold !default;
|
6
|
+
|
7
|
+
// The `zoom` approach generates less CSS but does not validate.
|
8
|
+
// Set this to `block` to use the display-property to hack the
|
9
|
+
// element to gain layout.
|
10
|
+
$default-has-layout-approach: zoom !default;
|
11
|
+
|
12
|
+
// This mixin causes an element matching the selector
|
13
|
+
// to gain the "hasLayout" property in internet explorer.
|
14
|
+
// More information on [hasLayout](http://reference.sitepoint.com/css/haslayout).
|
15
|
+
@mixin has-layout($approach: $default-has-layout-approach) {
|
16
|
+
@if support-legacy-browser("ie", "7", $threshold: $has-layout-support-threshold) {
|
17
|
+
@if $approach == zoom {
|
18
|
+
@include has-layout-zoom;
|
19
|
+
} @else if $approach == block {
|
20
|
+
@include has-layout-block;
|
21
|
+
} @else {
|
22
|
+
@warn "Unknown has-layout approach: #{$approach}";
|
23
|
+
@include has-layout-zoom;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
@mixin has-layout-zoom {
|
29
|
+
@if support-legacy-browser("ie", "7", $threshold: $has-layout-support-threshold) {
|
30
|
+
*zoom: 1;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
@mixin has-layout-block {
|
35
|
+
@if support-legacy-browser("ie", "7", $threshold: $has-layout-support-threshold) {
|
36
|
+
// This makes ie6 get layout
|
37
|
+
display: inline-block;
|
38
|
+
// and this puts it back to block
|
39
|
+
& { display: block; }
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
// The legacy support threshold for IE6 attribute hack.
|
45
|
+
// Defaults to the $critical-usage-threshold.
|
46
|
+
$ie6-attribute-hack-support-threshold: $critical-usage-threshold !default;
|
47
|
+
|
48
|
+
// A hack to supply IE6 (and below) with a different property value.
|
49
|
+
// [Read more](http://www.cssportal.com/css-hacks/#in_css-important).
|
50
|
+
@mixin bang-hack($property, $value, $ie6-value) {
|
51
|
+
@if support-legacy-browser("ie", "6", $threshold: $ie6-attribute-hack-support-threshold) {
|
52
|
+
@warn "it's recommended to use the underscore-hack() mixin instead of bang-hack()";
|
53
|
+
#{$property}: #{$value} !important;
|
54
|
+
#{$property}: #{$ie6-value};
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
// A hack to supply IE6 (and below) with a different property value.
|
59
|
+
// [Read more](http://www.paulirish.com/2009/browser-specific-css-hacks/)
|
60
|
+
@mixin underscore-hack($property, $value, $ie6-value) {
|
61
|
+
@if support-legacy-browser("ie", "6", $threshold: $ie6-attribute-hack-support-threshold) {
|
62
|
+
#{$property}: #{$value};
|
63
|
+
_#{$property}: #{$ie6-value};
|
64
|
+
}
|
65
|
+
}
|
@@ -7,7 +7,7 @@
|
|
7
7
|
.xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current,
|
8
8
|
.xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current
|
9
9
|
background: $brand-primary
|
10
|
-
|
10
|
+
box-shadow: darken($brand-primary, 10%) 0px 1px 3px 0px inset
|
11
11
|
|
12
12
|
.xdsoft_calendar td:hover,
|
13
13
|
.xdsoft_timepicker .xdsoft_time_box >div >div:hover,
|
@@ -19,7 +19,7 @@ input[type=number]::-webkit-outer-spin-button
|
|
19
19
|
top: 0px
|
20
20
|
margin-left: -1px !important
|
21
21
|
border-color: $input-border
|
22
|
-
|
22
|
+
box-shadow: none
|
23
23
|
z-index: 2
|
24
24
|
.fa
|
25
25
|
font-size: 1em
|
@@ -29,7 +29,7 @@ input[type=number]::-webkit-outer-spin-button
|
|
29
29
|
cursor: not-allowed
|
30
30
|
&:hover,
|
31
31
|
&:focus
|
32
|
-
|
32
|
+
box-shadow: none
|
33
33
|
.spinner-up,
|
34
34
|
.spinbox-up
|
35
35
|
border-top-left-radius: 0 !important
|
@@ -19,8 +19,8 @@
|
|
19
19
|
/* Override z-index because we don't whant */
|
20
20
|
/* redactor_toolbar fixed somewhere or on top of everythink ..*/
|
21
21
|
z-index: 1 !important
|
22
|
-
|
23
|
-
|
22
|
+
box-shadow: none
|
23
|
+
border-radius: $input-border-radius $input-border-radius 0 0
|
24
24
|
border: 1px solid $input-border
|
25
25
|
li a
|
26
26
|
&:hover,
|
@@ -32,7 +32,7 @@
|
|
32
32
|
background-color: $input-bg
|
33
33
|
border: 1px solid $input-border
|
34
34
|
border-top-width: 0px
|
35
|
-
|
35
|
+
border-radius: 0 0 $input-border-radius $input-border-radius
|
36
36
|
&:focus
|
37
37
|
border-color: $input-border-focus
|
38
38
|
background: #FFF
|
@@ -71,11 +71,11 @@
|
|
71
71
|
border-color: $input-border
|
72
72
|
background-color: $input-bg
|
73
73
|
color: $input-color
|
74
|
-
|
74
|
+
box-shadow: none
|
75
75
|
&:focus
|
76
76
|
background-color: #fff
|
77
77
|
border-color: $input-border-focus
|
78
|
-
|
78
|
+
box-shadow: none
|
79
79
|
|
80
80
|
footer
|
81
81
|
button.redactor-modal-action-btn
|
@@ -1,7 +1,6 @@
|
|
1
1
|
//
|
2
2
|
// Selectize
|
3
3
|
// --------------------------------------------------
|
4
|
-
@import "compass/css3/user-interface"
|
5
4
|
@import "para/admin/src/variables"
|
6
5
|
@import "para/admin/src/mixins"
|
7
6
|
|
@@ -27,7 +26,7 @@
|
|
27
26
|
border: none
|
28
27
|
margin-top: -6px
|
29
28
|
color: $gray
|
30
|
-
|
29
|
+
|
31
30
|
//** Dropdown
|
32
31
|
|
33
32
|
//** Active system
|
@@ -37,14 +36,14 @@
|
|
37
36
|
.selectize-input,
|
38
37
|
.selectize-input.full
|
39
38
|
border-color: $input-border
|
40
|
-
|
39
|
+
border-radius: $input-border-radius
|
41
40
|
&.focus
|
42
41
|
border-color: $input-border-focus
|
43
42
|
&.dropdown-active
|
44
|
-
|
43
|
+
border-radius: $input-border-radius
|
45
44
|
&:after
|
46
45
|
border: none
|
47
|
-
|
46
|
+
transform: rotate(180deg)
|
48
47
|
margin-top: -6px
|
49
48
|
|
50
49
|
.selectize-control.single .selectize-input
|
@@ -67,7 +66,7 @@
|
|
67
66
|
background: $input-bg
|
68
67
|
|
69
68
|
.selectize-input.not-full input
|
70
|
-
|
69
|
+
::placeholder
|
71
70
|
color: $input-color-placeholder
|
72
71
|
font-size: 0.9em
|
73
72
|
|
@@ -84,7 +83,7 @@
|
|
84
83
|
|
85
84
|
.selectize-control.multi .selectize-input > div
|
86
85
|
background-color: $gray-light
|
87
|
-
|
86
|
+
border-radius: 2px
|
88
87
|
color: $text-color
|
89
88
|
&:hover,
|
90
89
|
&:focus,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_dependency
|
1
|
+
require_dependency 'para/application_controller'
|
2
2
|
|
3
3
|
module Para
|
4
4
|
module Admin
|
@@ -37,7 +37,7 @@ module Para
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def update
|
40
|
-
if resource.
|
40
|
+
if resource.update(resource_params)
|
41
41
|
flash_message(:success, resource)
|
42
42
|
redirect_to after_form_submit_path
|
43
43
|
else
|
@@ -109,7 +109,7 @@ module Para
|
|
109
109
|
def resource
|
110
110
|
@resource ||= begin
|
111
111
|
self.class.ensure_resource_name_defined!
|
112
|
-
instance_variable_get(:"@#{
|
112
|
+
instance_variable_get(:"@#{self.class.resource_name}")
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -161,10 +161,10 @@ module Para
|
|
161
161
|
|
162
162
|
def self.ensure_resource_name_defined!
|
163
163
|
unless resource_name.presence
|
164
|
-
raise
|
165
|
-
|
166
|
-
|
167
|
-
|
164
|
+
raise 'Resource not defined in your controller. ' \
|
165
|
+
'You can define the resource of your controller with the ' \
|
166
|
+
'`resource :resource_name` macro when subclassing ' \
|
167
|
+
'Para::Admin::ResourcesController'
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
@@ -185,8 +185,8 @@ module Para
|
|
185
185
|
|
186
186
|
def current_anchor
|
187
187
|
@current_anchor ||= if (current_anchor = params[:_current_anchor]).presence
|
188
|
-
|
189
|
-
|
188
|
+
current_anchor.gsub(/^\#/, '')
|
189
|
+
end
|
190
190
|
end
|
191
191
|
end
|
192
192
|
end
|
@@ -23,8 +23,8 @@ module Para
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def find_relation_name_for(relation, partial, options
|
27
|
-
return relation if partial_exists?(relation, partial, options)
|
26
|
+
def find_relation_name_for(relation, partial, **options)
|
27
|
+
return relation if partial_exists?(relation, partial, **options)
|
28
28
|
return nil unless options[:relation_class]
|
29
29
|
|
30
30
|
relation = options[:relation_class].ancestors.find do |ancestor|
|
@@ -32,7 +32,7 @@ module Para
|
|
32
32
|
break if ancestor == ActiveRecord::Base
|
33
33
|
|
34
34
|
ancestor_name = plural_file_path_for(ancestor.name)
|
35
|
-
partial_exists?(ancestor_name, partial, options)
|
35
|
+
partial_exists?(ancestor_name, partial, **options)
|
36
36
|
end
|
37
37
|
|
38
38
|
plural_file_path_for(relation) if relation
|
@@ -9,7 +9,7 @@ module Para
|
|
9
9
|
association_name = parent_resource.association(attribute_name).options[:inverse_of]
|
10
10
|
return resource unless association_name
|
11
11
|
|
12
|
-
resource.association(association_name).replace
|
12
|
+
resource.association(association_name).send(:replace, parent_resource)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -4,13 +4,15 @@ module Para
|
|
4
4
|
class ApplicationRecord < ActiveRecord::Base
|
5
5
|
self.abstract_class = true
|
6
6
|
|
7
|
-
private
|
8
|
-
|
9
7
|
# Adds the `optional: true` option to the belongs_to calls inside the provided block,
|
10
8
|
# but only for Rails 5.1+
|
11
9
|
#
|
12
10
|
def self.with_belongs_to_optional_option_if_needed(&block)
|
13
|
-
|
11
|
+
belongs_to_accepts_optional = ActiveRecord::Associations::Builder::BelongsTo
|
12
|
+
.send(:valid_options, {})
|
13
|
+
.include?(:optional)
|
14
|
+
|
15
|
+
if belongs_to_accepts_optional
|
14
16
|
with_options(optional: true, &block)
|
15
17
|
else
|
16
18
|
block.call
|
@@ -10,7 +10,7 @@ module Para
|
|
10
10
|
Para::Component.registered_components[name] = component
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.configurable_on(key,
|
13
|
+
def self.configurable_on(key, _options = {})
|
14
14
|
store_accessor(:configuration, key)
|
15
15
|
end
|
16
16
|
|
@@ -22,8 +22,8 @@ module Para
|
|
22
22
|
end
|
23
23
|
|
24
24
|
has_many :child_components, -> { ordered },
|
25
|
-
|
26
|
-
|
25
|
+
class_name: 'Para::Component::Base',
|
26
|
+
foreign_key: 'parent_component_id'
|
27
27
|
|
28
28
|
validates :identifier, :type, presence: true
|
29
29
|
|
@@ -33,14 +33,14 @@ module Para
|
|
33
33
|
|
34
34
|
def name
|
35
35
|
read_attribute(:name) || ::I18n.t(
|
36
|
-
"components.component.#{
|
36
|
+
"components.component.#{identifier}",
|
37
37
|
default: identifier.humanize
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
41
41
|
def main_navigation_name
|
42
42
|
::I18n.t(
|
43
|
-
"components.main_navigation.#{
|
43
|
+
"components.main_navigation.#{identifier}",
|
44
44
|
default: name
|
45
45
|
)
|
46
46
|
end
|
@@ -62,7 +62,7 @@ module Para
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def default_form_actions
|
65
|
-
[
|
65
|
+
%i[submit submit_and_edit submit_and_add_another cancel]
|
66
66
|
end
|
67
67
|
|
68
68
|
def to_param
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Para
|
2
2
|
class ComponentSection < Para::ApplicationRecord
|
3
3
|
has_many :components, -> { ordered }, class_name: 'Para::Component::Base',
|
4
|
-
|
5
|
-
|
4
|
+
autosave: true, foreign_key: :component_section_id,
|
5
|
+
dependent: :destroy
|
6
6
|
|
7
7
|
scope :ordered, -> { order(position: :asc) }
|
8
8
|
|
@@ -10,7 +10,7 @@ module Para
|
|
10
10
|
|
11
11
|
def name
|
12
12
|
read_attribute(:name) || ::I18n.t(
|
13
|
-
"components.section.#{
|
13
|
+
"components.section.#{identifier}",
|
14
14
|
default: identifier.humanize
|
15
15
|
)
|
16
16
|
end
|
@@ -11,10 +11,10 @@ module Para
|
|
11
11
|
def attachment_path
|
12
12
|
return unless attachment.attached?
|
13
13
|
|
14
|
-
attachment.
|
14
|
+
attachment.url
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
alias attachment_url attachment_path
|
18
18
|
|
19
19
|
def attachment_ext
|
20
20
|
::File.extname(attachment.filename.to_s) if attachment.attached?
|
@@ -14,7 +14,6 @@ module Para
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class << self
|
17
|
-
|
18
17
|
# This method is a shortcut to create a has_one through relation
|
19
18
|
def section_resource(*args, &block)
|
20
19
|
_ensure_section_resource_relation
|
@@ -47,10 +46,10 @@ module Para
|
|
47
46
|
return if @section_resources_already_initialized
|
48
47
|
|
49
48
|
has_many :section_resources, -> { ordered },
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
foreign_key: 'section_id',
|
50
|
+
class_name: '::Para::Page::SectionResource',
|
51
|
+
inverse_of: :section,
|
52
|
+
dependent: :destroy
|
54
53
|
|
55
54
|
accepts_nested_attributes_for :section_resources, allow_destroy: true
|
56
55
|
|
@@ -74,7 +73,7 @@ module Para
|
|
74
73
|
source_type: target_class_name
|
75
74
|
)
|
76
75
|
|
77
|
-
has_one(*args, options, &block)
|
76
|
+
has_one(*args, **options, &block)
|
78
77
|
end
|
79
78
|
|
80
79
|
def _create_section_resource_has_many_relation_for(*args, &block)
|
@@ -94,7 +93,7 @@ module Para
|
|
94
93
|
source_type: target_class_name
|
95
94
|
)
|
96
95
|
|
97
|
-
has_many(*args, options, &block)
|
96
|
+
has_many(*args, **options, &block)
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
@@ -1 +1 @@
|
|
1
|
-
= render
|
1
|
+
= render template: template_path_lookup('admin/dashboard', 'para/admin/dashboard')
|