From ee04728d1c26d11b0bdad5ee9a122442dc6e3da2 Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Tue, 17 May 2011 21:40:54 +0800 Subject: [PATCH 1/2] Added content type fields with dates (both string and date types in database.yml). --- spec/fixtures/themes/default.zip | Bin 410691 -> 409953 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/spec/fixtures/themes/default.zip b/spec/fixtures/themes/default.zip index 9bf39d8ffecbd0827d8105fc353b99884dc8c0b8..404afe890f792a42033c35962a9b1b6363a02df1 100644 GIT binary patch delta 4530 zcmZuz2UJwY8lJm%cj!y6OW9Qx*p)6-c9*5tVnZ~jNKqjcVkbtEhzRCMjD~=#jN!xt z5sfV>qAr3Gnh;x}@?tbbOrpdVu||yr-aq%^Ro{D@a}VdvSLQD>``?yNTz@ZgElG4n z$P}I4Rjo^^x5`Oj5&FauA$R0nI@vRSycuFAe0X*geHJaTK#cfr1|hKnLg@B{IrBP# zZF(9q7nl!|REOX8iyzsBCG=)|7l7V^wBt z@|uTDjuR^*$8K5pJSINnmuF}8f|KRC<@Fy ze7kIa=9a>Xq6Yy{JpDwW=FQ zb*SYqx~;PkzJ{FYoVnbPDFyeTK}@swkZ@BA^-ZAyivZnm`4QyP5i z>j~FqSuGr}dy~uC%8xOfb;k})Q6;CuI=0?8zXboP7LArX zxNKXw=hJBN^=B@#4ppkh9jo0C^HZ_Km(25tPjm7b@>6e2{_)a{oXzuw29EPlmd8GN zoYV1a^0T9c=Ay27+9YX{(~f0>L>Cmfj+d54Zy2xI@gRCf=fV*`*KO*ov>eu@KNgW` zvTH$`dgM~(2gQ>Yu8${Ny*a-o-s*{A!uST&rSQOuGVSgD2GQ!kl_~$E-kNEyo3mlY z)93N7{sr$&UjJVHfFGvid5*GN`B(gG*8^eu7g)=T&DjSsIcdY=;fypey?~t^W!te1EBo}?plKV?C&1{EQC(K)yJn+Jr(jx(7-yOajb7gTxaI$5= zsqGEhcWowBHx_l5Po4Soq}4Abe;atcSA44a>hC9->sB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ZE7h{RkEg-;)SQx*+umd9;@*pt}P+eq8MC2wMZ2S4Ef^IpAH z+MFHl#4nCBMj&o%!w^X!;4o(bdq;5KswUbRE{q_?%-mC24Q4=mNE|%|)V}yp$nhcZ z^iIw1MjsMQ|HA%u1!rHZp3oLnvkQFSOWx#_b1w>7RN;q4A8>Ep>^L`y3C(3RMaUKr zj(Uc0(vJi)>t5OxfwMmsooIjb>cK0gie~~NNXunRAWjz{yiQ;0G=W`35NFmh2*q|~V;`}EW&{xlVvE?#NzY%#ejh}}FuVZ) z9DXK{!Cf~_!Q_!Bo37cEvcr!Yy(L3dD}p(VF2N|3r?Wpa>KMWDU`|mPE0RPLR=X7X z2QYvWLk45_2YdFmP^(r0eLb&@u9Ex$e%CtS;z%q;Uu1MF&(7M$(l!Sva$%|zD(!D8#A^Q zH+fUdbQIu-;fe=LBr9#M)x(VrX3!hK1$`+V^QKu0;kY@$0ddz@T!A%*lL3DIS!JeH z#2T`qu-GQqXdtmx7>fZM4!9EE7lojQ_Jg3uQFzCjm6pn8}OHtL`LXDfOa5$aNQNJPPLTSzy&!GGdY_5Xs}msa9;(&&pE+31(|^~ z53{fJ&Kfhl3KD>OE-^@L?C?Q-_$jslag3(!oQSnp`>onj6ebxWXb7!N#2jMfgg}1` zF-AoPoiPT^vDn75T?VyHizV)OQWT43Q(QG*bu8C~T@sY;W2IGYgJJQHBc6tz;nbj% I;=fbsf31SNBLDyZ From c7109af0b8a3fcf3706cd047d1dfeafe2cbc6228 Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Tue, 17 May 2011 21:42:47 +0800 Subject: [PATCH 2/2] Importer now supports date content type fields as strings or date objects. --- lib/locomotive/import/content_types.rb | 2 +- spec/lib/locomotive/import_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/locomotive/import/content_types.rb b/lib/locomotive/import/content_types.rb index f610ec16..0665671e 100644 --- a/lib/locomotive/import/content_types.rb +++ b/lib/locomotive/import/content_types.rb @@ -79,7 +79,7 @@ module Locomotive value = (case field.kind.downcase when 'file' then self.open_sample_asset(value) when 'boolean' then Boolean.set(value) - when 'date' then Date.parse(value) + when 'date' then value.is_a?(Date) ? value : Date.parse(value) when 'category' if field.category_items.detect { |item| item.name == value }.nil? field.category_items.build :name => value diff --git a/spec/lib/locomotive/import_spec.rb b/spec/lib/locomotive/import_spec.rb index 485fc379..5935e0dd 100644 --- a/spec/lib/locomotive/import_spec.rb +++ b/spec/lib/locomotive/import_spec.rb @@ -22,7 +22,7 @@ describe Locomotive::Import::Job do it 'adds content types' do @site.content_types.count.should == 2 content_type = @site.content_types.where(:slug => 'projects').first - content_type.content_custom_fields.size.should == 6 + content_type.content_custom_fields.size.should == 7 end it 'converts correctly the order_by option for content types' do