sofa_blog 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +83 -0
- data/LICENSE +20 -0
- data/README.md +66 -0
- data/Rakefile +19 -0
- data/VERSION +1 -0
- data/app/.DS_Store +0 -0
- data/app/controllers/cms_admin/blog_comments_controller.rb +66 -0
- data/app/controllers/cms_admin/blog_posts_controller.rb +48 -0
- data/app/models/blog_comment.rb +45 -0
- data/app/models/blog_post.rb +62 -0
- data/app/models/blog_tag.rb +22 -0
- data/app/models/blog_tagging.rb +8 -0
- data/app/views/.DS_Store +0 -0
- data/app/views/cms_admin/blog_comments/_blog_comment.html.erb +22 -0
- data/app/views/cms_admin/blog_comments/_form.html.erb +24 -0
- data/app/views/cms_admin/blog_comments/_status.html.erb +7 -0
- data/app/views/cms_admin/blog_comments/approve.rjs +1 -0
- data/app/views/cms_admin/blog_comments/disapprove.rjs +1 -0
- data/app/views/cms_admin/blog_comments/edit.html.erb +7 -0
- data/app/views/cms_admin/blog_comments/index.html.erb +7 -0
- data/app/views/cms_admin/blog_comments/new.html.erb +6 -0
- data/app/views/cms_admin/blog_posts/_blog_post.html.erb +21 -0
- data/app/views/cms_admin/blog_posts/_form.html.erb +33 -0
- data/app/views/cms_admin/blog_posts/edit.html.erb +7 -0
- data/app/views/cms_admin/blog_posts/index.html.erb +8 -0
- data/app/views/cms_admin/blog_posts/new.html.erb +5 -0
- data/app/views/sofa_blog/_head.html.erb +1 -0
- data/app/views/sofa_blog/_nav.html.erb +1 -0
- data/config/.DS_Store +0 -0
- data/config/routes.rb +14 -0
- data/db/migrate/01_create_sofa_blog.rb +50 -0
- data/doc/sofa.png +0 -0
- data/lib/generators/README +12 -0
- data/lib/generators/blog_generator.rb +33 -0
- data/lib/sofa_blog/engine.rb +17 -0
- data/lib/sofa_blog.rb +3 -0
- data/public/javascripts/jquery.autocomplete.pack.js +12 -0
- data/public/stylesheets/content.css +53 -0
- data/sofa_blog.gemspec +88 -0
- data/tmp/application.rb +15 -0
- data/tmp/boot.rb +13 -0
- data/tmp/environment.rb +6 -0
- data/tmp/initializers/formatted_form_builder.rb +141 -0
- data/tmp/initializers/wristband.rb +1 -0
- metadata +145 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
class CreateSofaBlog < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :blog_posts do |t|
|
4
|
+
t.string :title
|
5
|
+
t.text :content
|
6
|
+
t.string :author
|
7
|
+
t.boolean :published, :null => false, :default => false
|
8
|
+
t.integer :comments_count, :null => false, :default => 0
|
9
|
+
t.integer :approved_comments_count, :null => false, :default => 0
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
add_index :blog_posts, [:published, :title]
|
13
|
+
add_index :blog_posts, [:title, :published]
|
14
|
+
|
15
|
+
|
16
|
+
create_table :blog_comments do |t|
|
17
|
+
t.integer :blog_post_id
|
18
|
+
t.string :name
|
19
|
+
t.string :email
|
20
|
+
t.text :content
|
21
|
+
t.boolean :approved, :null => false, :default => false
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
add_index :blog_comments, :blog_post_id
|
25
|
+
|
26
|
+
|
27
|
+
create_table :blog_tags do |t|
|
28
|
+
t.string :name
|
29
|
+
t.integer :blog_taggings_count
|
30
|
+
end
|
31
|
+
add_index :blog_tags, [:name, :blog_taggings_count], :unique => true
|
32
|
+
add_index :blog_tags, :blog_taggings_count
|
33
|
+
|
34
|
+
|
35
|
+
create_table :blog_taggings do |t|
|
36
|
+
t.integer :blog_post_id
|
37
|
+
t.integer :blog_tag_id
|
38
|
+
t.datetime :created_at
|
39
|
+
end
|
40
|
+
add_index :blog_taggings, [:blog_post_id, :blog_tag_id, :created_at], :unique => true, :name => 'index_blog_taggings_on_post_id_tag_id_created_at'
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.down
|
45
|
+
drop_table :blog_posts
|
46
|
+
drop_table :blog_comments
|
47
|
+
drop_table :blog_tags
|
48
|
+
drop_table :blog_taggings
|
49
|
+
end
|
50
|
+
end
|
data/doc/sofa.png
ADDED
Binary file
|
@@ -0,0 +1,12 @@
|
|
1
|
+
____ __ ____ _
|
2
|
+
/ ___| ___ / _| __ _ | __ )| | ___ __ _
|
3
|
+
\___ \ / _ \| |_ / _` | | _ \| |/ _ \ / _` |
|
4
|
+
___) | (_) | _| (_| | | |_) | | (_) | (_| |
|
5
|
+
|____/ \___/|_| \__,_| |____/|_|\___/ \__, |
|
6
|
+
|___/
|
7
|
+
|
8
|
+
Hey! Everything is almost done. Please don't forget to
|
9
|
+
|
10
|
+
* run migrations -> `rake db:migrate`
|
11
|
+
|
12
|
+
After that go to http://your-awesome-app/cms-admin to start populating content.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class BlogGenerator < Rails::Generators::Base
|
2
|
+
include Rails::Generators::Migration
|
3
|
+
|
4
|
+
source_root File.expand_path('../../..', __FILE__)
|
5
|
+
|
6
|
+
def generate_migration
|
7
|
+
destination = File.expand_path('db/migrate/01_create_sofa_blog.rb', self.destination_root)
|
8
|
+
migration_dir = File.dirname(destination)
|
9
|
+
destination = self.class.migration_exists?(migration_dir, 'create_sofa_blog')
|
10
|
+
|
11
|
+
if destination
|
12
|
+
puts "\e[0m\e[31mFound existing create_sofa_blog.rb migration. Remove it if you want to regenerate.\e[0m"
|
13
|
+
else
|
14
|
+
migration_template 'db/migrate/01_create_sofa_blog.rb', 'db/migrate/create_sofa_blog.rb'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_public_assets
|
19
|
+
directory 'public/javascripts/', 'public/javascripts/comfortable_mexican_sofa/blog'
|
20
|
+
directory 'public/stylesheets/', 'public/stylesheets/comfortable_mexican_sofa/blog'
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def show_readme
|
25
|
+
readme 'lib/generators/README'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.next_migration_number(dirname)
|
29
|
+
orm = Rails.configuration.generators.options[:rails][:orm]
|
30
|
+
require "rails/generators/#{orm}"
|
31
|
+
"#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'comfortable_mexican_sofa'
|
3
|
+
require "sofa_blog"
|
4
|
+
require "rails"
|
5
|
+
|
6
|
+
module SofaBlog
|
7
|
+
class Engine < Rails::Engine
|
8
|
+
initializer 'sofa_blog' do |app|
|
9
|
+
ComfortableMexicanSofa::ViewHooks.add(:navigation, 'sofa_blog/nav')
|
10
|
+
ComfortableMexicanSofa::ViewHooks.add(:html_head, 'sofa_blog/head')
|
11
|
+
|
12
|
+
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :blog => [
|
13
|
+
'comfortable_mexican_sofa/blog/content'
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/sofa_blog.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Autocomplete plugin 1.1
|
3
|
+
*
|
4
|
+
* Copyright (c) 2009 Jörn Zaefferer
|
5
|
+
*
|
6
|
+
* Dual licensed under the MIT and GPL licenses:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
* http://www.gnu.org/licenses/gpl.html
|
9
|
+
*
|
10
|
+
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
|
11
|
+
*/
|
12
|
+
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(3($){$.2e.1u({19:3(b,d){5 c=W b=="1B";d=$.1u({},$.M.1T,{Y:c?b:P,y:c?P:b,1J:c?$.M.1T.1J:10,X:d&&!d.1D?10:48},d);d.1y=d.1y||3(a){6 a};d.1v=d.1v||d.1R;6 A.I(3(){1M $.M(A,d)})},L:3(a){6 A.11("L",a)},1k:3(a){6 A.14("1k",[a])},2b:3(){6 A.14("2b")},28:3(a){6 A.14("28",[a])},24:3(){6 A.14("24")}});$.M=3(o,r){5 t={2Y:38,2S:40,2N:46,2I:9,2E:13,2B:27,2x:3I,2v:33,2p:34,2n:8};5 u=$(o).3r("19","3o").Q(r.2Q);5 p;5 m="";5 n=$.M.3c(r);5 s=0;5 k;5 h={1F:C};5 l=$.M.32(r,o,1Z,h);5 j;$.1Y.2X&&$(o.2U).11("45.19",3(){4(j){j=C;6 C}});u.11(($.1Y.2X?"43":"42")+".19",3(a){s=1;k=a.2M;3V(a.2M){O t.2Y:a.1d();4(l.N()){l.30()}w{12(0,D)}R;O t.2S:a.1d();4(l.N()){l.2D()}w{12(0,D)}R;O t.2v:a.1d();4(l.N()){l.2C()}w{12(0,D)}R;O t.2p:a.1d();4(l.N()){l.2A()}w{12(0,D)}R;O r.17&&$.1c(r.S)==","&&t.2x:O t.2I:O t.2E:4(1Z()){a.1d();j=D;6 C}R;O t.2B:l.Z();R;3J:1P(p);p=1O(12,r.1J);R}}).2t(3(){s++}).3E(3(){s=0;4(!h.1F){2r()}}).2q(3(){4(s++>1&&!l.N()){12(0,D)}}).11("1k",3(){5 c=(1r.7>1)?1r[1]:P;3 1N(q,a){5 b;4(a&&a.7){16(5 i=0;i<a.7;i++){4(a[i].L.J()==q.J()){b=a[i];R}}}4(W c=="3")c(b);w u.14("L",b&&[b.y,b.F])}$.I(15(u.K()),3(i,a){21(a,1N,1N)})}).11("2b",3(){n.1o()}).11("28",3(){$.1u(r,1r[1]);4("y"2h 1r[1])n.1e()}).11("24",3(){l.1p();u.1p();$(o.2U).1p(".19")});3 1Z(){5 e=l.2g();4(!e)6 C;5 v=e.L;m=v;4(r.17){5 b=15(u.K());4(b.7>1){5 f=r.S.7;5 c=$(o).18().1I;5 d,1H=0;$.I(b,3(i,a){1H+=a.7;4(c<=1H){d=i;6 C}1H+=f});b[d]=v;v=b.3f(r.S)}v+=r.S}u.K(v);1l();u.14("L",[e.y,e.F]);6 D}3 12(b,c){4(k==t.2N){l.Z();6}5 a=u.K();4(!c&&a==m)6;m=a;a=1m(a);4(a.7>=r.29){u.Q(r.26);4(!r.1s)a=a.J();21(a,3a,1l)}w{1q();l.Z()}};3 15(b){4(!b)6[""];4(!r.17)6[$.1c(b)];6 $.4h(b.23(r.S),3(a){6 $.1c(b).7?$.1c(a):P})}3 1m(a){4(!r.17)6 a;5 c=15(a);4(c.7==1)6 c[0];5 b=$(o).18().1I;4(b==a.7){c=15(a)}w{c=15(a.22(a.37(b),""))}6 c[c.7-1]}3 1G(q,a){4(r.1G&&(1m(u.K()).J()==q.J())&&k!=t.2n){u.K(u.K()+a.37(1m(m).7));$(o).18(m.7,m.7+a.7)}};3 2r(){1P(p);p=1O(1l,4g)};3 1l(){5 c=l.N();l.Z();1P(p);1q();4(r.36){u.1k(3(a){4(!a){4(r.17){5 b=15(u.K()).1n(0,-1);u.K(b.3f(r.S)+(b.7?r.S:""))}w{u.K("");u.14("L",P)}}})}};3 3a(q,a){4(a&&a.7&&s){1q();l.35(a,q);1G(q,a[0].F);l.20()}w{1l()}};3 21(f,d,g){4(!r.1s)f=f.J();5 e=n.31(f);4(e&&e.7){d(f,e)}w 4((W r.Y=="1B")&&(r.Y.7>0)){5 c={4f:+1M 4e()};$.I(r.2Z,3(a,b){c[a]=W b=="3"?b():b});$.4d({4c:"4b",4a:"19"+o.49,2V:r.2V,Y:r.Y,y:$.1u({q:1m(f),47:r.X},c),44:3(a){5 b=r.1A&&r.1A(a)||1A(a);n.1i(f,b);d(f,b)}})}w{l.2T();g(f)}};3 1A(c){5 d=[];5 b=c.23("\\n");16(5 i=0;i<b.7;i++){5 a=$.1c(b[i]);4(a){a=a.23("|");d[d.7]={y:a,F:a[0],L:r.1z&&r.1z(a,a[0])||a[0]}}}6 d};3 1q(){u.1h(r.26)}};$.M.1T={2Q:"41",2P:"3Z",26:"3Y",29:1,1J:3W,1s:C,1f:D,1w:C,1g:10,X:3U,36:C,2Z:{},1X:D,1R:3(a){6 a[0]},1v:P,1G:C,E:0,17:C,S:", ",1y:3(b,a){6 b.22(1M 3T("(?![^&;]+;)(?!<[^<>]*)("+a.22(/([\\^\\$\\(\\)\\[\\]\\{\\}\\*\\.\\+\\?\\|\\\\])/2K,"\\\\$1")+")(?![^<>]*>)(?![^&;]+;)","2K"),"<2J>$1</2J>")},1D:D,1E:3S};$.M.3c=3(g){5 h={};5 j=0;3 1f(s,a){4(!g.1s)s=s.J();5 i=s.2H(a);4(g.1w=="3R"){i=s.J().1k("\\\\b"+a.J())}4(i==-1)6 C;6 i==0||g.1w};3 1i(q,a){4(j>g.1g){1o()}4(!h[q]){j++}h[q]=a}3 1e(){4(!g.y)6 C;5 f={},2G=0;4(!g.Y)g.1g=1;f[""]=[];16(5 i=0,2F=g.y.7;i<2F;i++){5 c=g.y[i];c=(W c=="1B")?[c]:c;5 d=g.1v(c,i+1,g.y.7);4(d===C)1V;5 e=d.3Q(0).J();4(!f[e])f[e]=[];5 b={F:d,y:c,L:g.1z&&g.1z(c)||d};f[e].1U(b);4(2G++<g.X){f[""].1U(b)}};$.I(f,3(i,a){g.1g++;1i(i,a)})}1O(1e,25);3 1o(){h={};j=0}6{1o:1o,1i:1i,1e:1e,31:3(q){4(!g.1g||!j)6 P;4(!g.Y&&g.1w){5 a=[];16(5 k 2h h){4(k.7>0){5 c=h[k];$.I(c,3(i,x){4(1f(x.F,q)){a.1U(x)}})}}6 a}w 4(h[q]){6 h[q]}w 4(g.1f){16(5 i=q.7-1;i>=g.29;i--){5 c=h[q.3O(0,i)];4(c){5 a=[];$.I(c,3(i,x){4(1f(x.F,q)){a[a.7]=x}});6 a}}}6 P}}};$.M.32=3(e,g,f,k){5 h={H:"3N"};5 j,z=-1,y,1t="",1S=D,G,B;3 2y(){4(!1S)6;G=$("<3M/>").Z().Q(e.2P).T("3L","3K").1Q(1K.2w);B=$("<3H/>").1Q(G).3G(3(a){4(U(a).2u&&U(a).2u.3F()==\'2s\'){z=$("1L",B).1h(h.H).3D(U(a));$(U(a)).Q(h.H)}}).2q(3(a){$(U(a)).Q(h.H);f();g.2t();6 C}).3C(3(){k.1F=D}).3B(3(){k.1F=C});4(e.E>0)G.T("E",e.E);1S=C}3 U(a){5 b=a.U;3A(b&&b.3z!="2s")b=b.3y;4(!b)6[];6 b}3 V(b){j.1n(z,z+1).1h(h.H);2o(b);5 a=j.1n(z,z+1).Q(h.H);4(e.1D){5 c=0;j.1n(0,z).I(3(){c+=A.1a});4((c+a[0].1a-B.1b())>B[0].3x){B.1b(c+a[0].1a-B.3w())}w 4(c<B.1b()){B.1b(c)}}};3 2o(a){z+=a;4(z<0){z=j.1j()-1}w 4(z>=j.1j()){z=0}}3 2m(a){6 e.X&&e.X<a?e.X:a}3 2l(){B.2z();5 b=2m(y.7);16(5 i=0;i<b;i++){4(!y[i])1V;5 a=e.1R(y[i].y,i+1,b,y[i].F,1t);4(a===C)1V;5 c=$("<1L/>").3v(e.1y(a,1t)).Q(i%2==0?"3u":"3P").1Q(B)[0];$.y(c,"2k",y[i])}j=B.3t("1L");4(e.1X){j.1n(0,1).Q(h.H);z=0}4($.2e.2W)B.2W()}6{35:3(d,q){2y();y=d;1t=q;2l()},2D:3(){V(1)},30:3(){V(-1)},2C:3(){4(z!=0&&z-8<0){V(-z)}w{V(-8)}},2A:3(){4(z!=j.1j()-1&&z+8>j.1j()){V(j.1j()-1-z)}w{V(8)}},Z:3(){G&&G.Z();j&&j.1h(h.H);z=-1},N:3(){6 G&&G.3s(":N")},3q:3(){6 A.N()&&(j.2j("."+h.H)[0]||e.1X&&j[0])},20:3(){5 a=$(g).3p();G.T({E:W e.E=="1B"||e.E>0?e.E:$(g).E(),2i:a.2i+g.1a,1W:a.1W}).20();4(e.1D){B.1b(0);B.T({2L:e.1E,3n:\'3X\'});4($.1Y.3m&&W 1K.2w.3l.2L==="1x"){5 c=0;j.I(3(){c+=A.1a});5 b=c>e.1E;B.T(\'3k\',b?e.1E:c);4(!b){j.E(B.E()-2R(j.T("2O-1W"))-2R(j.T("2O-3j")))}}}},2g:3(){5 a=j&&j.2j("."+h.H).1h(h.H);6 a&&a.7&&$.y(a[0],"2k")},2T:3(){B&&B.2z()},1p:3(){G&&G.3i()}}};$.2e.18=3(b,f){4(b!==1x){6 A.I(3(){4(A.2d){5 a=A.2d();4(f===1x||b==f){a.4n("2c",b);a.3h()}w{a.4m(D);a.4l("2c",b);a.4k("2c",f);a.3h()}}w 4(A.3g){A.3g(b,f)}w 4(A.1C){A.1C=b;A.3e=f}})}5 c=A[0];4(c.2d){5 e=1K.18.4j(),3d=c.F,2a="<->",2f=e.3b.7;e.3b=2a;5 d=c.F.2H(2a);c.F=3d;A.18(d,d+2f);6{1I:d,39:d+2f}}w 4(c.1C!==1x){6{1I:c.1C,39:c.3e}}}})(4i);',62,272,'|||function|if|var|return|length|||||||||||||||||||||||||else||data|active|this|list|false|true|width|value|element|ACTIVE|each|toLowerCase|val|result|Autocompleter|visible|case|null|addClass|break|multipleSeparator|css|target|moveSelect|typeof|max|url|hide||bind|onChange||trigger|trimWords|for|multiple|selection|autocomplete|offsetHeight|scrollTop|trim|preventDefault|populate|matchSubset|cacheLength|removeClass|add|size|search|hideResultsNow|lastWord|slice|flush|unbind|stopLoading|arguments|matchCase|term|extend|formatMatch|matchContains|undefined|highlight|formatResult|parse|string|selectionStart|scroll|scrollHeight|mouseDownOnSelect|autoFill|progress|start|delay|document|li|new|findValueCallback|setTimeout|clearTimeout|appendTo|formatItem|needsInit|defaults|push|continue|left|selectFirst|browser|selectCurrent|show|request|replace|split|unautocomplete||loadingClass||setOptions|minChars|teststring|flushCache|character|createTextRange|fn|textLength|selected|in|top|filter|ac_data|fillList|limitNumberOfItems|BACKSPACE|movePosition|PAGEDOWN|click|hideResults|LI|focus|nodeName|PAGEUP|body|COMMA|init|empty|pageDown|ESC|pageUp|next|RETURN|ol|nullData|indexOf|TAB|strong|gi|maxHeight|keyCode|DEL|padding|resultsClass|inputClass|parseInt|DOWN|emptyList|form|dataType|bgiframe|opera|UP|extraParams|prev|load|Select|||display|mustMatch|substring||end|receiveData|text|Cache|orig|selectionEnd|join|setSelectionRange|select|remove|right|height|style|msie|overflow|off|offset|current|attr|is|find|ac_even|html|innerHeight|clientHeight|parentNode|tagName|while|mouseup|mousedown|index|blur|toUpperCase|mouseover|ul|188|default|absolute|position|div|ac_over|substr|ac_odd|charAt|word|180|RegExp|100|switch|400|auto|ac_loading|ac_results||ac_input|keydown|keypress|success|submit||limit|150|name|port|abort|mode|ajax|Date|timestamp|200|map|jQuery|createRange|moveEnd|moveStart|collapse|move'.split('|'),0,{}))
|
@@ -0,0 +1,53 @@
|
|
1
|
+
.c_cms_admin_blog_posts.a_index ul.list li .item .label,
|
2
|
+
.c_cms_admin_blog_comments.a_index ul.list li .item .label {
|
3
|
+
margin-left: 32px;
|
4
|
+
}
|
5
|
+
.c_cms_admin_blog_comments.a_index ul.list li .item .content {
|
6
|
+
font-size: 11px;
|
7
|
+
font-weight: normal;
|
8
|
+
margin: 5px 0px 0 32px;
|
9
|
+
}
|
10
|
+
|
11
|
+
/* === Tags === */
|
12
|
+
span.tag {
|
13
|
+
padding: 1px 5px;
|
14
|
+
background-color: #d5d5d5;
|
15
|
+
border-radius: 2px;
|
16
|
+
-moz-border-radius: 2px;
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
/* === Autocomplete === */
|
21
|
+
.ac_results {
|
22
|
+
padding: 0px;
|
23
|
+
border: 1px solid #999;
|
24
|
+
background-color: white;
|
25
|
+
overflow: hidden;
|
26
|
+
z-index: 99999;
|
27
|
+
color: #666;
|
28
|
+
} ul {
|
29
|
+
width: 100%;
|
30
|
+
list-style-position: outside;
|
31
|
+
list-style: none;
|
32
|
+
padding: 0;
|
33
|
+
margin: 0;
|
34
|
+
} li {
|
35
|
+
margin: 0px;
|
36
|
+
padding: 2px 5px;
|
37
|
+
cursor: default;
|
38
|
+
display: block;
|
39
|
+
font-size: 12px;
|
40
|
+
line-height: 16px;
|
41
|
+
overflow: hidden;
|
42
|
+
}
|
43
|
+
|
44
|
+
.ac_loading {
|
45
|
+
background: white url('/images/ajax_loader.gif') right center no-repeat;
|
46
|
+
}
|
47
|
+
.ac_odd {
|
48
|
+
background-color: #eee;
|
49
|
+
}
|
50
|
+
.ac_over {
|
51
|
+
background-color: #C4EAF6;
|
52
|
+
color: #000;
|
53
|
+
}
|
data/sofa_blog.gemspec
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sofa_blog}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jack Neto", "The Working Group Inc"]
|
12
|
+
s.date = %q{2011-02-27}
|
13
|
+
s.description = %q{}
|
14
|
+
s.email = %q{jack@theworkinggroup.ca}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".DS_Store",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"app/.DS_Store",
|
28
|
+
"app/controllers/cms_admin/blog_comments_controller.rb",
|
29
|
+
"app/controllers/cms_admin/blog_posts_controller.rb",
|
30
|
+
"app/models/blog_comment.rb",
|
31
|
+
"app/models/blog_post.rb",
|
32
|
+
"app/models/blog_tag.rb",
|
33
|
+
"app/models/blog_tagging.rb",
|
34
|
+
"app/views/.DS_Store",
|
35
|
+
"app/views/cms_admin/blog_comments/_blog_comment.html.erb",
|
36
|
+
"app/views/cms_admin/blog_comments/_form.html.erb",
|
37
|
+
"app/views/cms_admin/blog_comments/_status.html.erb",
|
38
|
+
"app/views/cms_admin/blog_comments/approve.rjs",
|
39
|
+
"app/views/cms_admin/blog_comments/disapprove.rjs",
|
40
|
+
"app/views/cms_admin/blog_comments/edit.html.erb",
|
41
|
+
"app/views/cms_admin/blog_comments/index.html.erb",
|
42
|
+
"app/views/cms_admin/blog_comments/new.html.erb",
|
43
|
+
"app/views/cms_admin/blog_posts/_blog_post.html.erb",
|
44
|
+
"app/views/cms_admin/blog_posts/_form.html.erb",
|
45
|
+
"app/views/cms_admin/blog_posts/edit.html.erb",
|
46
|
+
"app/views/cms_admin/blog_posts/index.html.erb",
|
47
|
+
"app/views/cms_admin/blog_posts/new.html.erb",
|
48
|
+
"app/views/sofa_blog/_head.html.erb",
|
49
|
+
"app/views/sofa_blog/_nav.html.erb",
|
50
|
+
"config/.DS_Store",
|
51
|
+
"config/routes.rb",
|
52
|
+
"db/migrate/01_create_sofa_blog.rb",
|
53
|
+
"doc/sofa.png",
|
54
|
+
"lib/generators/README",
|
55
|
+
"lib/generators/blog_generator.rb",
|
56
|
+
"lib/sofa_blog.rb",
|
57
|
+
"lib/sofa_blog/engine.rb",
|
58
|
+
"public/javascripts/jquery.autocomplete.pack.js",
|
59
|
+
"public/stylesheets/content.css",
|
60
|
+
"sofa_blog.gemspec",
|
61
|
+
"tmp/application.rb",
|
62
|
+
"tmp/boot.rb",
|
63
|
+
"tmp/environment.rb",
|
64
|
+
"tmp/initializers/formatted_form_builder.rb",
|
65
|
+
"tmp/initializers/wristband.rb"
|
66
|
+
]
|
67
|
+
s.homepage = %q{http://github.com/twg/sofa-blog}
|
68
|
+
s.require_paths = ["lib"]
|
69
|
+
s.rubygems_version = %q{1.3.7}
|
70
|
+
s.summary = %q{A blog extension for Comfortable Mexican Sofa}
|
71
|
+
|
72
|
+
if s.respond_to? :specification_version then
|
73
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
74
|
+
s.specification_version = 3
|
75
|
+
|
76
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
77
|
+
s.add_runtime_dependency(%q<comfortable_mexican_sofa>, [">= 1.0.46"])
|
78
|
+
s.add_runtime_dependency(%q<comfortable_mexican_sofa>, [">= 1.0.46"])
|
79
|
+
else
|
80
|
+
s.add_dependency(%q<comfortable_mexican_sofa>, [">= 1.0.46"])
|
81
|
+
s.add_dependency(%q<comfortable_mexican_sofa>, [">= 1.0.46"])
|
82
|
+
end
|
83
|
+
else
|
84
|
+
s.add_dependency(%q<comfortable_mexican_sofa>, [">= 1.0.46"])
|
85
|
+
s.add_dependency(%q<comfortable_mexican_sofa>, [">= 1.0.46"])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
data/tmp/application.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
module SofaBlog
|
10
|
+
class Application < Rails::Application
|
11
|
+
config.encoding = "utf-8"
|
12
|
+
|
13
|
+
config.filter_parameters += [:password]
|
14
|
+
end
|
15
|
+
end
|
data/tmp/boot.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
begin
|
6
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
+
require 'bundler'
|
8
|
+
Bundler.setup
|
9
|
+
rescue Bundler::GemNotFound => e
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Try running `bundle install`."
|
12
|
+
exit!
|
13
|
+
end if File.exist?(gemfile)
|
data/tmp/environment.rb
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
class FormattedFormBuilder < ActionView::Helpers::FormBuilder
|
2
|
+
|
3
|
+
%w[ date_select text_field password_field text_area file_field datetime_select ].each do |selector|
|
4
|
+
src = <<-end_src
|
5
|
+
def #{selector}(method, options = {})
|
6
|
+
if (options[:simple] == true)
|
7
|
+
super(method, options)
|
8
|
+
else
|
9
|
+
options.merge!(:size=> '') if #{%w{text_field password_field}.include?(selector)}
|
10
|
+
standard_field('#{selector}', method, options) { super(method, options) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end_src
|
14
|
+
class_eval src, __FILE__, __LINE__
|
15
|
+
end
|
16
|
+
|
17
|
+
def standard_field(type, method, options={}, &block)
|
18
|
+
description = options.delete(:desc)
|
19
|
+
content = options.delete(:content)
|
20
|
+
prev_content = options.delete(:prev_content)
|
21
|
+
label = label_for(method, options)
|
22
|
+
required = options.delete(:required)
|
23
|
+
check_box_details = options.delete(:check_box_details)
|
24
|
+
text_snippet = options.delete(:text_snippet)
|
25
|
+
%{
|
26
|
+
<div class='form_element #{type}_element'>
|
27
|
+
#{"<div class='text_snippet'>"+text_snippet+"</div>" if text_snippet}
|
28
|
+
<div class='label'>
|
29
|
+
#{description(description) || ' ' if type == 'check_box' }
|
30
|
+
#{label if type != 'check_box' }
|
31
|
+
#{@template.content_tag(:span, '*', :class => 'required_ind') if required }
|
32
|
+
</div>
|
33
|
+
<div class='value'>
|
34
|
+
#{prev_content}#{yield}#{content}
|
35
|
+
#{error_messages_for(method)}
|
36
|
+
#{description(description) if type != 'check_box'}
|
37
|
+
#{description(check_box_details) if type == 'check_box'}
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
}.html_safe
|
41
|
+
end
|
42
|
+
|
43
|
+
# generic container for all things form
|
44
|
+
def element(label = ' ', value = '', type = 'text_field', &block)
|
45
|
+
value += @template.capture(&block) if block_given?
|
46
|
+
%{
|
47
|
+
<div class='form_element #{type}_element'>
|
48
|
+
<div class='label'>
|
49
|
+
#{label}
|
50
|
+
</div>
|
51
|
+
<div class='value'>
|
52
|
+
#{value}
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
}.html_safe
|
56
|
+
end
|
57
|
+
|
58
|
+
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
59
|
+
options[:content] = label_for(method, options)
|
60
|
+
options[:label] = ''
|
61
|
+
standard_field('check_box', method, options) { super(method, options, checked_value, unchecked_value) }
|
62
|
+
end
|
63
|
+
|
64
|
+
def radio_button(method, tag_value, options = {})
|
65
|
+
if options && options[:choices]
|
66
|
+
radios = options.delete(:choices).collect{|choice| %{<div class="radio_button">}+super(method, choice[0], options) + %{<label for="#{object_name.to_s.gsub(']', '').gsub('[', '_')}_#{method}_#{choice[0]}">#{choice[1]}</label></div>}}.join.html_safe
|
67
|
+
standard_field('radio_button', method, options) { radios }
|
68
|
+
elsif options && options[:value_name]
|
69
|
+
standard_field('radio_button', method, options) { super(method, tag_value) + %{<label for="#{object_name}_#{method}_#{tag_value}">#{options[:value_name]}</label><div class="clearfloat"></div>}.html_safe}
|
70
|
+
else
|
71
|
+
standard_field('radio_button', method, options) { super(method, tag_value, options = {}) }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def select(method, choices, options = {}, html_options = {})
|
76
|
+
standard_field('select', method, options) { super(method, choices, options, html_options) }
|
77
|
+
end
|
78
|
+
|
79
|
+
def hidden_field(method, options = {}, html_options = {})
|
80
|
+
super(method, options)
|
81
|
+
end
|
82
|
+
|
83
|
+
def submit(value, options={}, &block)
|
84
|
+
cancel_link = @template.capture(&block) if block_given?
|
85
|
+
cancel_link ||= options[:cancel_url] ? ' or ' + options.delete(:cancel_url) : ''
|
86
|
+
if options[:show_ajax_loader]
|
87
|
+
options[:onclick] = "$(this).parent().next().css('display', 'block');$(this).parent().hide();"
|
88
|
+
end
|
89
|
+
if options[:image_button] == true
|
90
|
+
submit_id = Time.now.usec
|
91
|
+
out = @template.content_tag(:div,
|
92
|
+
%{
|
93
|
+
#{super(value, options.merge(:style=>'visibility:hidden;position: absolute', :id => submit_id)).html_safe}
|
94
|
+
<a class="red_button" href="" onclick="$('##{submit_id}').closest('form').submit();return false"><span>#{value}</span></a>
|
95
|
+
#{cancel_link.html_safe}
|
96
|
+
}.html_safe, :class => 'form_element submit_element').html_safe
|
97
|
+
|
98
|
+
else
|
99
|
+
out = @template.content_tag(:div, super(value, options) + cancel_link.html_safe, :class => 'form_element submit_element').html_safe
|
100
|
+
end
|
101
|
+
|
102
|
+
if options[:show_ajax_loader]
|
103
|
+
out << %{
|
104
|
+
<div class="form_element submit_element" style="display:none">
|
105
|
+
<div class="submit_ajax_loader">#{options[:show_ajax_loader]}</div>
|
106
|
+
</div>
|
107
|
+
}.html_safe
|
108
|
+
end
|
109
|
+
out.html_safe
|
110
|
+
end
|
111
|
+
|
112
|
+
def label_for(method, options)
|
113
|
+
label = options.delete(:label) || method.to_s.titleize.capitalize
|
114
|
+
"<label for=\"#{object_name}_#{method}\">#{label}</label>"
|
115
|
+
end
|
116
|
+
|
117
|
+
def description(description)
|
118
|
+
"<div class='description'>#{description}</div>" unless description.nil?
|
119
|
+
end
|
120
|
+
|
121
|
+
def error_messages
|
122
|
+
if object && !object.errors.empty?
|
123
|
+
message = object.errors[:base].present? ? object.errors[:base]: 'There were some problems submitting this form. Please correct all the highlighted fields and try again'
|
124
|
+
@template.content_tag(:div, message, :class => 'form_error')
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def error_messages_for(method)
|
129
|
+
if (object and object.respond_to?(:errors) and errors = object.errors[method])
|
130
|
+
"<div class='errors'>#{errors.is_a?(Array) ? errors.first : errors}</div>"
|
131
|
+
else
|
132
|
+
''
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def formatted_fields_for(record_or_name_or_array, *args, &block)
|
137
|
+
options = args.extract_options!
|
138
|
+
options.merge!(:builder => FormattedFormBuilder)
|
139
|
+
fields_for(record_or_name_or_array, *(args << options), &block)
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'wristband'
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sofa_blog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jack Neto
|
14
|
+
- The Working Group Inc
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-02-27 00:00:00 -05:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 75
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
- 46
|
33
|
+
version: 1.0.46
|
34
|
+
type: :runtime
|
35
|
+
name: comfortable_mexican_sofa
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 75
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 0
|
48
|
+
- 46
|
49
|
+
version: 1.0.46
|
50
|
+
type: :runtime
|
51
|
+
name: comfortable_mexican_sofa
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: *id002
|
54
|
+
description: ""
|
55
|
+
email: jack@theworkinggroup.ca
|
56
|
+
executables: []
|
57
|
+
|
58
|
+
extensions: []
|
59
|
+
|
60
|
+
extra_rdoc_files:
|
61
|
+
- LICENSE
|
62
|
+
- README.md
|
63
|
+
files:
|
64
|
+
- .DS_Store
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- VERSION
|
71
|
+
- app/.DS_Store
|
72
|
+
- app/controllers/cms_admin/blog_comments_controller.rb
|
73
|
+
- app/controllers/cms_admin/blog_posts_controller.rb
|
74
|
+
- app/models/blog_comment.rb
|
75
|
+
- app/models/blog_post.rb
|
76
|
+
- app/models/blog_tag.rb
|
77
|
+
- app/models/blog_tagging.rb
|
78
|
+
- app/views/.DS_Store
|
79
|
+
- app/views/cms_admin/blog_comments/_blog_comment.html.erb
|
80
|
+
- app/views/cms_admin/blog_comments/_form.html.erb
|
81
|
+
- app/views/cms_admin/blog_comments/_status.html.erb
|
82
|
+
- app/views/cms_admin/blog_comments/approve.rjs
|
83
|
+
- app/views/cms_admin/blog_comments/disapprove.rjs
|
84
|
+
- app/views/cms_admin/blog_comments/edit.html.erb
|
85
|
+
- app/views/cms_admin/blog_comments/index.html.erb
|
86
|
+
- app/views/cms_admin/blog_comments/new.html.erb
|
87
|
+
- app/views/cms_admin/blog_posts/_blog_post.html.erb
|
88
|
+
- app/views/cms_admin/blog_posts/_form.html.erb
|
89
|
+
- app/views/cms_admin/blog_posts/edit.html.erb
|
90
|
+
- app/views/cms_admin/blog_posts/index.html.erb
|
91
|
+
- app/views/cms_admin/blog_posts/new.html.erb
|
92
|
+
- app/views/sofa_blog/_head.html.erb
|
93
|
+
- app/views/sofa_blog/_nav.html.erb
|
94
|
+
- config/.DS_Store
|
95
|
+
- config/routes.rb
|
96
|
+
- db/migrate/01_create_sofa_blog.rb
|
97
|
+
- doc/sofa.png
|
98
|
+
- lib/generators/README
|
99
|
+
- lib/generators/blog_generator.rb
|
100
|
+
- lib/sofa_blog.rb
|
101
|
+
- lib/sofa_blog/engine.rb
|
102
|
+
- public/javascripts/jquery.autocomplete.pack.js
|
103
|
+
- public/stylesheets/content.css
|
104
|
+
- sofa_blog.gemspec
|
105
|
+
- tmp/application.rb
|
106
|
+
- tmp/boot.rb
|
107
|
+
- tmp/environment.rb
|
108
|
+
- tmp/initializers/formatted_form_builder.rb
|
109
|
+
- tmp/initializers/wristband.rb
|
110
|
+
has_rdoc: true
|
111
|
+
homepage: http://github.com/twg/sofa-blog
|
112
|
+
licenses: []
|
113
|
+
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
hash: 3
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
version: "0"
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 3
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
version: "0"
|
137
|
+
requirements: []
|
138
|
+
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 1.3.7
|
141
|
+
signing_key:
|
142
|
+
specification_version: 3
|
143
|
+
summary: A blog extension for Comfortable Mexican Sofa
|
144
|
+
test_files: []
|
145
|
+
|