@@ -7,11 +7,11 @@ namespace :cortex do
77 task seed : :environment do
88 puts "Creating Media ContentType..."
99 media = ContentType . new ( {
10- name : "Media" ,
11- description : "Media for Cortex" ,
12- icon : "collections" ,
13- creator_id : 1 ,
14- contract_id : 1
10+ name : "Media" ,
11+ description : "Media for Cortex" ,
12+ icon : "collections" ,
13+ creator_id : 1 ,
14+ contract_id : 1
1515 } )
1616 media . save
1717
@@ -20,28 +20,28 @@ namespace :cortex do
2020 allowed_asset_content_types = %w( txt pdf doc docx xls xlsx png jpg gif bmp )
2121 media . fields . new ( name : 'Asset' , field_type : 'asset_field_type' ,
2222 validations :
23- {
24- presence : true ,
25- allowed_extensions : allowed_asset_content_types ,
26- size : {
27- less_than : 50 . megabytes
28- }
29- } ,
23+ {
24+ presence : true ,
25+ allowed_extensions : allowed_asset_content_types ,
26+ size : {
27+ less_than : 50 . megabytes
28+ }
29+ } ,
3030 metadata :
31- {
32- styles : {
33- large : { geometry : '1800x1800>' , format : :jpg } ,
34- medium : { geometry : '800x800>' , format : :jpg } ,
35- default : { geometry : '300x300>' , format : :jpg } ,
36- mini : { geometry : '100x100>' , format : :jpg } ,
37- micro : { geometry : '50x50>' , format : :jpg } ,
38- post_tile : { geometry : '1140x' , format : :jpg }
39- } ,
40- processors : [ :thumbnail , :paperclip_optimizer ] ,
41- preserve_files : true ,
42- path : ':class/:attachment/careerbuilder-:style-:id.:extension' ,
43- s3_headers : { 'Cache-Control' : 'public, max-age=315576000' }
44- } )
31+ {
32+ styles : {
33+ large : { geometry : '1800x1800>' , format : :jpg } ,
34+ medium : { geometry : '800x800>' , format : :jpg } ,
35+ default : { geometry : '300x300>' , format : :jpg } ,
36+ mini : { geometry : '100x100>' , format : :jpg } ,
37+ micro : { geometry : '50x50>' , format : :jpg } ,
38+ post_tile : { geometry : '1140x' , format : :jpg }
39+ } ,
40+ processors : [ :thumbnail , :paperclip_optimizer ] ,
41+ preserve_files : true ,
42+ path : ':class/:attachment/careerbuilder-:style-:id.:extension' ,
43+ s3_headers : { 'Cache-Control' : 'public, max-age=315576000' }
44+ } )
4545 media . fields . new ( name : 'Title' , field_type : 'text_field_type' , validations : { presence : true } )
4646 media . fields . new ( name : 'Description' , field_type : 'text_field_type' , validations : { presence : true } )
4747 media . fields . new ( name : 'Tags' , field_type : 'tag_field_type' )
@@ -51,138 +51,138 @@ namespace :cortex do
5151
5252 puts "Creating Wizard Decorators..."
5353 wizard_hash = {
54- "steps" : [
54+ "steps" : [
55+ {
56+ "name" : "Upload" ,
57+ "heading" : "First thing's first.." ,
58+ "description" : "Add your media asset." ,
59+ "columns" : [
5560 {
56- "name " : "Upload" ,
57- "heading " : "First thing's first.." ,
58- "description" : "Add your media asset." ,
59- "columns " : [
60- {
61- "grid_width" : 12 ,
62- "fields" : [
63- {
64- "id" : media . fields [ 0 ] . id
65- }
66- ]
67- }
68- ]
69- } ,
61+ "grid_width " : 12 ,
62+ "fields " : [
63+ {
64+ "id " : media . fields [ 0 ] . id
65+ }
66+ ]
67+ }
68+ ]
69+ } ,
70+ {
71+ "name" : "Metadata" ,
72+ "heading" : "Let's talk about your asset.." ,
73+ "description" : "Provide details and metadata that will enhance search or inform end-users." ,
74+ "columns" : [
7075 {
71- "name" : "Metadata" ,
72- "heading" : "Let's talk about your asset.." ,
73- "description" : "Provide details and metadata that will enhance search or inform end-users." ,
74- "columns" : [
75- {
76- "grid_width" : 12 ,
77- "fields" : [
78- {
79- "id" : media . fields [ 1 ] . id
80- } ,
81- {
82- "id" : media . fields [ 2 ] . id
83- } ,
84- {
85- "id" : media . fields [ 3 ] . id
86- } ,
87- {
88- "id" : media . fields [ 4 ] . id
89- } ,
90- {
91- "id" : media . fields [ 5 ] . id
92- }
93- ]
94- }
95- ]
76+ "grid_width" : 12 ,
77+ "fields" : [
78+ {
79+ "id" : media . fields [ 1 ] . id
80+ } ,
81+ {
82+ "id" : media . fields [ 2 ] . id
83+ } ,
84+ {
85+ "id" : media . fields [ 3 ] . id
86+ } ,
87+ {
88+ "id" : media . fields [ 4 ] . id
89+ } ,
90+ {
91+ "id" : media . fields [ 5 ] . id
92+ }
93+ ]
9694 }
97- ]
95+ ]
96+ }
97+ ]
9898 }
9999
100100 media_wizard_decorator = Decorator . new ( name : "Wizard" , data : wizard_hash )
101101 media_wizard_decorator . save
102102
103103 ContentableDecorator . create ( {
104- decorator_id : media_wizard_decorator . id ,
105- contentable_id : media . id ,
106- contentable_type : 'ContentType'
104+ decorator_id : media_wizard_decorator . id ,
105+ contentable_id : media . id ,
106+ contentable_type : 'ContentType'
107107 } )
108108
109109 puts "Creating Index Decorators..."
110110 index_hash = {
111- "columns" :
112- [
113- {
114- "name" : "Thumbnail" ,
115- "cells" : [ {
116- "field" : {
117- "method" : "author_image"
118- } ,
119- "display" : {
120- "classes" : [
121- "circular"
122- ]
123- }
124- } ]
125- } ,
126- {
127- "name" : "Creator" ,
128- "cells" : [ {
129- "field" : {
130- "method" : "author_image"
131- } ,
132- "display" : {
133- "classes" : [
134- "circular"
135- ]
136- }
137- } ]
138- } ,
139- {
140- "name" : "Details" ,
141- "cells" : [
142- {
143- "field" : {
144- "id" : media . fields [ 1 ] . id
145- } ,
146- "display" : {
147- "classes" : [
148- "bold" ,
149- "upcase"
150- ]
151- }
111+ "columns" :
112+ [
113+ {
114+ "name" : "Thumbnail" ,
115+ "cells" : [ {
116+ "field" : {
117+ "method" : "author_image"
152118 } ,
153- {
154- "field " : {
155- "id" : media . fields [ 2 ] . id
156- }
119+ "display" : {
120+ "classes " : [
121+ "circular"
122+ ]
157123 }
158- ]
159- } ,
160- {
161- "name" : "Tags" ,
162- "cells" : [
163- {
164- "field" : {
165- "id" : media . fields [ 3 ] . id
166- } ,
167- "display" : {
168- "classes" : [
169- "tag" ,
170- "rounded"
171- ]
172- }
124+ } ]
125+ } ,
126+ {
127+ "name" : "Creator" ,
128+ "cells" : [ {
129+ "field" : {
130+ "method" : "author_image"
131+ } ,
132+ "display" : {
133+ "classes" : [
134+ "circular"
135+ ]
173136 }
174- ]
137+ } ]
138+ } ,
139+ {
140+ "name" : "Details" ,
141+ "cells" : [
142+ {
143+ "field" : {
144+ "id" : media . fields [ 1 ] . id
145+ } ,
146+ "display" : {
147+ "classes" : [
148+ "bold" ,
149+ "upcase"
150+ ]
175151 }
152+ } ,
153+ {
154+ "field" : {
155+ "id" : media . fields [ 2 ] . id
156+ }
157+ }
176158 ]
159+ } ,
160+ {
161+ "name" : "Tags" ,
162+ "cells" : [
163+ {
164+ "field" : {
165+ "id" : media . fields [ 3 ] . id
166+ } ,
167+ "display" : {
168+ "classes" : [
169+ "tag" ,
170+ "rounded"
171+ ]
172+ }
173+ }
174+ ]
175+ }
176+ ]
177177 }
178178
179179 media_index_decorator = Decorator . new ( name : "Index" , data : index_hash )
180180 media_index_decorator . save
181181
182182 ContentableDecorator . create ( {
183- decorator_id : media_index_decorator . id ,
184- contentable_id : media . id ,
185- contentable_type : 'ContentType'
183+ decorator_id : media_index_decorator . id ,
184+ contentable_id : media . id ,
185+ contentable_type : 'ContentType'
186186 } )
187187 end
188188 end
0 commit comments