Skip to content

Commit fe6d0d7

Browse files
committed
Merge branch 'develop'
2 parents 634a1f5 + a917240 commit fe6d0d7

File tree

16 files changed

+417
-135
lines changed

16 files changed

+417
-135
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// TODO: These two files should be removed once we abstract Cortex styles to a cortex-style-base lib
2+
@import 'variables/colors';
3+
@import 'variables/typography';
4+
5+
@import 'components/thumbnail-placeholder';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.thumbnail-placeholder {
2+
background-color: $color-grey-evenlighter;
3+
display: flex;
4+
height: 50px;
5+
width: 50px;
6+
7+
.h4 {
8+
text-transform: uppercase;
9+
align-self: center;
10+
text-align: center;
11+
width: 100%;
12+
}
13+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Color Definitions
2+
3+
$color-teal: #63C0B9;
4+
$color-teal-dark: #54A1A1;
5+
$color-teal-light: #A1D9D5;
6+
7+
$color-orange: #F79C25;
8+
$color-orange-dark: #E78523;
9+
$color-orange-light: #FED473;
10+
11+
$color-anchor-blue-light: #747D8E;
12+
13+
$color-green: #009b74;
14+
15+
$color-slate-grey: #6E788F;
16+
$color-grey: #BBB; // Type
17+
$color-grey-dark: #333; // Type, Sidebar background, Login page background
18+
$color-grey-light: #D4D4D4; // Content background color
19+
$color-grey-lightest: #DDD; // Disabled and flat button background color
20+
$color-grey-evenlighter: #E4E4E4;
21+
$color-grey-reallylight: #F2F2F2;
22+
$color-grey-extralight: #F4F4F4; // Wizard Instruction Panel background color
23+
24+
$color-red: #d85252;
25+
26+
$color-white: white; // Header
27+
$color-black: #000000;
28+
29+
30+
// Color Semantics
31+
32+
$employer-color: $color-teal;
33+
$employer-color-dark: $color-teal-dark;
34+
$employer-color-light: $color-teal-light;
35+
36+
$flash-error-background: $color-red;
37+
$flash-success-background: $color-green;
38+
39+
$ar-color: $color-orange;
40+
$ar-color-dark: $color-orange-dark;
41+
$ar-color-light: $color-orange-light;
42+
43+
$notes-text: #6E788F;
44+
45+
$jumbo-button-text: #6E788F;
46+
$jumbo-button-hover-background: $color-grey-evenlighter;
47+
$jumbo-button-active-background: $color-grey-reallylight;
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
@font-face {
2+
font-family: Montserrat;
3+
font-style: normal;
4+
font-weight: normal;
5+
src: url(asset_path('Montserrat-Regular.otf')) format("opentype");
6+
}
7+
8+
@font-face {
9+
font-family: Montserrat;
10+
font-style: normal;
11+
font-weight: bold;
12+
src: url(asset_path('Montserrat-Medium.otf')) format("opentype");
13+
}
14+
15+
@font-face {
16+
font-family: Montserrat;
17+
font-style: normal;
18+
font-weight: bolder;
19+
src: url(asset_path('Montserrat-SemiBold.otf')) format("opentype");
20+
}
21+
22+
@font-face {
23+
font-family: Montserrat;
24+
font-style: normal;
25+
font-weight: lighter;
26+
src: url(asset_path('Montserrat-Light.otf')) format("opentype");
27+
}
28+
29+
$cortex-font-stack: Montserrat, sans-serif;
30+
$base-font-size: 1rem;
31+
32+
%display-text { // Cortex Logo
33+
color: $color-grey-dark;
34+
font-family: $cortex-font-stack;
35+
font-weight: normal;
36+
font-size: 2.1775rem;
37+
}
38+
39+
h1, h2, h3, h4, h5, h6 {
40+
line-height: 1.5;
41+
}
42+
43+
h1,
44+
.text-style-1 { // Bread Crumbs and Page Headers
45+
color: $color-teal;
46+
font-family: $cortex-font-stack;
47+
font-weight: bold;
48+
font-size: 1.17rem;
49+
text-decoration: none;
50+
}
51+
52+
h2,
53+
.text-style-2 {
54+
color: $color-grey;
55+
font-family: $cortex-font-stack;
56+
font-weight: lighter;
57+
font-size: 1.17rem;
58+
}
59+
60+
h3,
61+
.text-style-3 {
62+
color: $color-grey;
63+
font-family: $cortex-font-stack;
64+
font-weight: bold;
65+
font-size: 1.17rem;
66+
}
67+
68+
h4,
69+
.text-style-4 { // Section Headers, Dropdowns, Button Text
70+
color: $color-grey-dark;
71+
font-family: $cortex-font-stack;
72+
font-size: 0.83rem;
73+
}
74+
75+
h5,
76+
.text-style-5 { // Field Text
77+
color: $color-grey;
78+
font-family: $cortex-font-stack;
79+
font-weight: lighter;
80+
font-size: $base-font-size;
81+
}
82+
83+
h6,
84+
.text-style-6 { // Field Text Filled
85+
color: $color-anchor-blue-light;
86+
font-family: $cortex-font-stack;
87+
font-size: $base-font-size;
88+
}
89+
90+
.text-style-7 { // Help Notes
91+
color: $color-anchor-blue-light;
92+
font-family: $cortex-font-stack;
93+
font-weight: lighter;
94+
font-size: 0.67rem;
95+
}
96+
97+
%sidebar-nav { // Side Nav
98+
color: $color-grey;
99+
font-family: $cortex-font-stack;
100+
font-weight: lighter;
101+
font-size: 0.875rem;
102+
text-transform: uppercase;
103+
104+
&.active { // Side Nav Selected
105+
font-weight: bold;
106+
color: $color-teal;
107+
}
108+
}
109+
110+
p {
111+
color: $color-anchor-blue-light;
112+
font-family: $cortex-font-stack;
113+
font-size: $base-font-size;
114+
}

app/cells/plugins/core/asset_cell.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ def render_allowed_asset_extensions
1919
field.validations['allowed_extensions']&.join(', ')
2020
end
2121

22+
def allowed_asset_extensions_for_form
23+
'.' + field.validations['allowed_extensions']&.join(',.')
24+
end
25+
2226
def render_max_asset_size
23-
number_to_human_size(field.validations['size']&.[]('less_than'))
27+
number_to_human_size(field.validations['max_size'])
2428
end
2529

2630
def input_classes
@@ -36,15 +40,16 @@ def render_label
3640
end
3741

3842
def render_input
39-
@options[:form].file_field 'data[asset]'
43+
@options[:form].file_field 'data[asset]', accept: allowed_asset_extensions_for_form
4044
end
4145

4246
def render_tooltip
4347
@options[:tooltip]
4448
end
4549

4650
def associated_content_item_thumb_url
47-
data['asset']['style_urls']['mini']
51+
# TODO: The thumb version needs to be configurable
52+
data['asset']['versions']['mini']['url']
4853
end
4954

5055
def render_associated_content_item_thumb
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
- if asset
2-
= image_tag(asset['style_urls'][config[:thumbnail_style]], height: '50px')
1+
- if asset && asset['versions'][config[:thumbnail_style]]
2+
= image_tag(asset['versions'][config[:thumbnail_style]]['url'], height: '50px')
3+
- else
4+
.thumbnail-placeholder
5+
.h4
6+
= asset['versions']['original']['extension']

app/cells/plugins/core/asset_info/show.haml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,26 @@
44
new Clipboard('#copy-asset-url');
55
});
66

7-
.asset-info.mdl-card.mdl-shadow--2dp
8-
.mdl-card__title
9-
%h2.mdl-card__title-text
10-
= image_tag(asset['url'], style: 'max-height: 200px;')
7+
.asset-info.mdl-card
8+
- if asset_is_image?
9+
.mdl-card__title
10+
%h2.mdl-card__title-text
11+
= image_tag(asset['versions']['original']['url'], style: 'max-height: 200px;')
1112
.mdl-card__supporting-text
1213
%dl
1314
%dt Original Filename
1415
%dd
15-
= asset['file_name']
16-
%dt File Type
16+
= asset['original_filename']
17+
%dt Original File Type
1718
%dd
18-
= asset['content_type']
19-
%dt File Size
19+
= asset['versions']['original']['mime_type']
20+
%dt Original File Size
2021
%dd
21-
= number_to_human_size(asset['file_size'])
22-
%dt Dimensions
23-
%dd
24-
= dimensions
22+
= number_to_human_size(asset['versions']['original']['file_size'])
23+
- if asset_is_image?
24+
%dt Original Dimensions
25+
%dd
26+
= dimensions
2527
%dt Creator
2628
%dd
2729
= creator.fullname
@@ -35,7 +37,7 @@
3537
%dd
3638
= link_to_asset
3739
.mdl-card__menu
38-
.mdl-button.mdl-button--icon.mdl-js-button.mdl-js-ripple-effect#copy-asset-url{data: {'clipboard-text': asset['url']}}
40+
.mdl-button.mdl-button--icon.mdl-js-button.mdl-js-ripple-effect#copy-asset-url{data: {'clipboard-text': asset['versions']['original']['url']}}
3941
%i.material-icons content_copy
4042
.mdl-tooltip{for: 'copy-asset-url'}
4143
Copy Asset URL

app/cells/plugins/core/asset_info_cell.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def asset
2525
end
2626

2727
def dimensions
28-
"#{asset['dimensions']['width']} x #{asset['dimensions']['width']}"
28+
"#{asset['versions']['original']['dimensions']['width']} x #{asset['versions']['original']['dimensions']['width']}"
2929
end
3030

3131
def creator
@@ -37,11 +37,19 @@ def created_at
3737
end
3838

3939
def updated_at
40-
DateTime.parse(asset['updated_at']).to_formatted_s(:long_ordinal)
40+
content_item.updated_at.to_formatted_s(:long_ordinal)
4141
end
4242

4343
def link_to_asset
44-
link_to asset['url'], asset['url'], target: '_blank'
44+
link_to asset['versions']['original']['url'], asset['versions']['original']['url'], target: '_blank'
45+
end
46+
47+
def asset_type
48+
MimeMagic.new(asset['versions']['original']['mime_type']).mediatype
49+
end
50+
51+
def asset_is_image?
52+
asset_type == 'image'
4553
end
4654
end
4755
end

0 commit comments

Comments
 (0)