Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
59748b2
feat: initial stages of Paperclip-based AssetFieldType system rebuild…
toastercup Apr 17, 2017
ef3a60e
feat: versions in AssetFieldType data hash
toastercup Apr 17, 2017
dc016a7
feat: set metadata context for validation, do not destroy files upon …
toastercup Apr 19, 2017
0b84fa5
refactor: extract versions_data from AssetFieldType data method
toastercup Apr 19, 2017
69e399a
feat: index, edit partials for new AssetFieldType backend
toastercup Apr 19, 2017
2043085
fix: asset URL copy functionality
toastercup Apr 19, 2017
15c0324
refactor: extract logic from AssetFieldType data setter, prepare for …
toastercup Apr 19, 2017
e786706
feat: configurable AssetFieldType storage (S3 + Filesystem), non-imag…
toastercup Apr 21, 2017
7ccd5a6
feat: AssetFieldType CDN support, S3 access control support, styling …
toastercup Apr 21, 2017
bd48fb6
feat: dynamic AssetFieldType versions
toastercup Apr 23, 2017
aa2dd70
feat: AssetFieldType dynamic validations
toastercup Apr 24, 2017
91df5ea
feat: preliminary AssetFieldType dynamic path generation
toastercup Apr 24, 2017
fc79a15
feat: dynamic AssetFieldType paths
toastercup Apr 25, 2017
cc5f334
fix: correctly generate hash of versions during non-image AssetFieldT…
toastercup Apr 25, 2017
233f7fa
fix: associated ContentItem issues with new AssetFieldType
toastercup Apr 26, 2017
dc23296
chore: update a todo comment to reflect latest plans
toastercup Apr 26, 2017
34c9ad2
feat: drop in variables from cortex (to eventually be abstracted to s…
toastercup Apr 26, 2017
81d6919
chore: bump to v0.12.0
toastercup Apr 26, 2017
5fec220
Merge branch 'develop' into topic/COR-704-Rebuild-AssetFieldType
Apr 26, 2017
52f03cc
refactor: loosen gemspec version requirements, bump to v0.12.1
toastercup Apr 26, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/assets/stylesheets/cortex-plugins-core/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// TODO: These two files should be removed once we abstract Cortex styles to a cortex-style-base lib
@import 'variables/colors';
@import 'variables/typography';

@import 'components/thumbnail-placeholder';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.thumbnail-placeholder {
background-color: $color-grey-evenlighter;
display: flex;
height: 50px;
width: 50px;

.h4 {
text-transform: uppercase;
align-self: center;
text-align: center;
width: 100%;
}
}
47 changes: 47 additions & 0 deletions app/assets/stylesheets/cortex-plugins-core/variables/_colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Color Definitions

$color-teal: #63C0B9;
$color-teal-dark: #54A1A1;
$color-teal-light: #A1D9D5;

$color-orange: #F79C25;
$color-orange-dark: #E78523;
$color-orange-light: #FED473;

$color-anchor-blue-light: #747D8E;

$color-green: #009b74;

$color-slate-grey: #6E788F;
$color-grey: #BBB; // Type
$color-grey-dark: #333; // Type, Sidebar background, Login page background
$color-grey-light: #D4D4D4; // Content background color
$color-grey-lightest: #DDD; // Disabled and flat button background color
$color-grey-evenlighter: #E4E4E4;
$color-grey-reallylight: #F2F2F2;
$color-grey-extralight: #F4F4F4; // Wizard Instruction Panel background color

$color-red: #d85252;

$color-white: white; // Header
$color-black: #000000;


// Color Semantics

$employer-color: $color-teal;
$employer-color-dark: $color-teal-dark;
$employer-color-light: $color-teal-light;

$flash-error-background: $color-red;
$flash-success-background: $color-green;

$ar-color: $color-orange;
$ar-color-dark: $color-orange-dark;
$ar-color-light: $color-orange-light;

$notes-text: #6E788F;

$jumbo-button-text: #6E788F;
$jumbo-button-hover-background: $color-grey-evenlighter;
$jumbo-button-active-background: $color-grey-reallylight;
114 changes: 114 additions & 0 deletions app/assets/stylesheets/cortex-plugins-core/variables/_typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
@font-face {
font-family: Montserrat;
font-style: normal;
font-weight: normal;
src: url(asset_path('Montserrat-Regular.otf')) format("opentype");
}

@font-face {
font-family: Montserrat;
font-style: normal;
font-weight: bold;
src: url(asset_path('Montserrat-Medium.otf')) format("opentype");
}

@font-face {
font-family: Montserrat;
font-style: normal;
font-weight: bolder;
src: url(asset_path('Montserrat-SemiBold.otf')) format("opentype");
}

@font-face {
font-family: Montserrat;
font-style: normal;
font-weight: lighter;
src: url(asset_path('Montserrat-Light.otf')) format("opentype");
}

$cortex-font-stack: Montserrat, sans-serif;
$base-font-size: 1rem;

%display-text { // Cortex Logo
color: $color-grey-dark;
font-family: $cortex-font-stack;
font-weight: normal;
font-size: 2.1775rem;
}

h1, h2, h3, h4, h5, h6 {
line-height: 1.5;
}

h1,
.text-style-1 { // Bread Crumbs and Page Headers
color: $color-teal;
font-family: $cortex-font-stack;
font-weight: bold;
font-size: 1.17rem;
text-decoration: none;
}

h2,
.text-style-2 {
color: $color-grey;
font-family: $cortex-font-stack;
font-weight: lighter;
font-size: 1.17rem;
}

h3,
.text-style-3 {
color: $color-grey;
font-family: $cortex-font-stack;
font-weight: bold;
font-size: 1.17rem;
}

h4,
.text-style-4 { // Section Headers, Dropdowns, Button Text
color: $color-grey-dark;
font-family: $cortex-font-stack;
font-size: 0.83rem;
}

h5,
.text-style-5 { // Field Text
color: $color-grey;
font-family: $cortex-font-stack;
font-weight: lighter;
font-size: $base-font-size;
}

h6,
.text-style-6 { // Field Text Filled
color: $color-anchor-blue-light;
font-family: $cortex-font-stack;
font-size: $base-font-size;
}

.text-style-7 { // Help Notes
color: $color-anchor-blue-light;
font-family: $cortex-font-stack;
font-weight: lighter;
font-size: 0.67rem;
}

%sidebar-nav { // Side Nav
color: $color-grey;
font-family: $cortex-font-stack;
font-weight: lighter;
font-size: 0.875rem;
text-transform: uppercase;

&.active { // Side Nav Selected
font-weight: bold;
color: $color-teal;
}
}

p {
color: $color-anchor-blue-light;
font-family: $cortex-font-stack;
font-size: $base-font-size;
}
11 changes: 8 additions & 3 deletions app/cells/plugins/core/asset_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ def render_allowed_asset_extensions
field.validations['allowed_extensions']&.join(', ')
end

def allowed_asset_extensions_for_form
'.' + field.validations['allowed_extensions']&.join(',.')
end

def render_max_asset_size
number_to_human_size(field.validations['size']&.[]('less_than'))
number_to_human_size(field.validations['max_size'])
end

def input_classes
Expand All @@ -36,15 +40,16 @@ def render_label
end

def render_input
@options[:form].file_field 'data[asset]'
@options[:form].file_field 'data[asset]', accept: allowed_asset_extensions_for_form
end

def render_tooltip
@options[:tooltip]
end

def associated_content_item_thumb_url
data['asset']['style_urls']['mini']
# TODO: The thumb version needs to be configurable
data['asset']['versions']['mini']['url']
end

def render_associated_content_item_thumb
Expand Down
8 changes: 6 additions & 2 deletions app/cells/plugins/core/asset_info/index.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
- if asset
= image_tag(asset['style_urls'][config[:thumbnail_style]], height: '50px')
- if asset && asset['versions'][config[:thumbnail_style]]
= image_tag(asset['versions'][config[:thumbnail_style]]['url'], height: '50px')
- else
.thumbnail-placeholder
.h4
= asset['versions']['original']['extension']
28 changes: 15 additions & 13 deletions app/cells/plugins/core/asset_info/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@
new Clipboard('#copy-asset-url');
});

.asset-info.mdl-card.mdl-shadow--2dp
.mdl-card__title
%h2.mdl-card__title-text
= image_tag(asset['url'], style: 'max-height: 200px;')
.asset-info.mdl-card
- if asset_is_image?
.mdl-card__title
%h2.mdl-card__title-text
= image_tag(asset['versions']['original']['url'], style: 'max-height: 200px;')
.mdl-card__supporting-text
%dl
%dt Original Filename
%dd
= asset['file_name']
%dt File Type
= asset['original_filename']
%dt Original File Type
%dd
= asset['content_type']
%dt File Size
= asset['versions']['original']['mime_type']
%dt Original File Size
%dd
= number_to_human_size(asset['file_size'])
%dt Dimensions
%dd
= dimensions
= number_to_human_size(asset['versions']['original']['file_size'])
- if asset_is_image?
%dt Original Dimensions
%dd
= dimensions
%dt Creator
%dd
= creator.fullname
Expand All @@ -35,7 +37,7 @@
%dd
= link_to_asset
.mdl-card__menu
.mdl-button.mdl-button--icon.mdl-js-button.mdl-js-ripple-effect#copy-asset-url{data: {'clipboard-text': asset['url']}}
.mdl-button.mdl-button--icon.mdl-js-button.mdl-js-ripple-effect#copy-asset-url{data: {'clipboard-text': asset['versions']['original']['url']}}
%i.material-icons content_copy
.mdl-tooltip{for: 'copy-asset-url'}
Copy Asset URL
14 changes: 11 additions & 3 deletions app/cells/plugins/core/asset_info_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def asset
end

def dimensions
"#{asset['dimensions']['width']} x #{asset['dimensions']['width']}"
"#{asset['versions']['original']['dimensions']['width']} x #{asset['versions']['original']['dimensions']['width']}"
end

def creator
Expand All @@ -37,11 +37,19 @@ def created_at
end

def updated_at
DateTime.parse(asset['updated_at']).to_formatted_s(:long_ordinal)
content_item.updated_at.to_formatted_s(:long_ordinal)
end

def link_to_asset
link_to asset['url'], asset['url'], target: '_blank'
link_to asset['versions']['original']['url'], asset['versions']['original']['url'], target: '_blank'
end

def asset_type
MimeMagic.new(asset['versions']['original']['mime_type']).mediatype
end

def asset_is_image?
asset_type == 'image'
end
end
end
Expand Down
Loading