blog_basic 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +24 -0
- data/MIT-LICENSE +20 -0
- data/Manifest +0 -0
- data/README.md +186 -0
- data/Rakefile +47 -0
- data/app/admin/blog_basic_blog_posts.rb +9 -0
- data/app/admin/dashboards.rb +38 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/javascripts/active_admin.js +1 -0
- data/app/assets/javascripts/application.js +9 -0
- data/app/assets/stylesheets/active_admin.css.scss +6 -0
- data/app/assets/stylesheets/application.css +7 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/blog_basic/app_controller.rb +27 -0
- data/app/controllers/blog_basic/application_controller.rb +4 -0
- data/app/controllers/blog_basic/blog_comments_controller.rb +69 -0
- data/app/controllers/blog_basic/blog_posts_controller.rb +149 -0
- data/app/controllers/blog_basic/sessions_controller.rb +32 -0
- data/app/controllers/blog_basic/tags_controller.rb +11 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/blog_basic/application_helper.rb +21 -0
- data/app/helpers/blog_basic/blog_posts_helper.rb +17 -0
- data/app/helpers/blog_basic/shared_helper.rb +36 -0
- data/app/helpers/blog_basic/tags_helper.rb +5 -0
- data/app/models/admin_user.rb +9 -0
- data/app/models/blog_basic/blog_comment.rb +78 -0
- data/app/models/blog_basic/blog_content.rb +4 -0
- data/app/models/blog_basic/blog_image.rb +23 -0
- data/app/models/blog_basic/blog_post.rb +104 -0
- data/app/models/blog_basic/session.rb +5 -0
- data/app/models/blog_basic/user.rb +22 -0
- data/app/views/blog_basic/blog_comments/_new_blog_comment.html.erb +43 -0
- data/app/views/blog_basic/blog_posts/_admin_links.html.erb +9 -0
- data/app/views/blog_basic/blog_posts/_blog_post.html.erb +62 -0
- data/app/views/blog_basic/blog_posts/_comment.html.erb +18 -0
- data/app/views/blog_basic/blog_posts/_comments.html.erb +6 -0
- data/app/views/blog_basic/blog_posts/_form.html.erb +133 -0
- data/app/views/blog_basic/blog_posts/_image.html.erb +20 -0
- data/app/views/blog_basic/blog_posts/drafts.html.erb +21 -0
- data/app/views/blog_basic/blog_posts/edit.html.erb +6 -0
- data/app/views/blog_basic/blog_posts/index.atom.builder +12 -0
- data/app/views/blog_basic/blog_posts/index.html.erb +31 -0
- data/app/views/blog_basic/blog_posts/new.html.erb +6 -0
- data/app/views/blog_basic/blog_posts/show.html.erb +8 -0
- data/app/views/blog_basic/shared/_footer.html.erb +15 -0
- data/app/views/blog_basic/shared/_index_top.html.erb +12 -0
- data/app/views/blog_basic/shared/_topbar.html.erb +24 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/blog_basic.gemspec +57 -0
- data/config/routes.rb +21 -0
- data/db/migrate/1_blog_tables.rb +86 -0
- data/init.rb +9 -0
- data/lib/akismetor.rb +77 -0
- data/lib/blog_basic/active_admin.rb +103 -0
- data/lib/blog_basic/blog_basic_model_helper.rb +85 -0
- data/lib/blog_basic/blog_conf.rb +36 -0
- data/lib/blog_basic/engine.rb +13 -0
- data/lib/blog_basic/engine.rb.backup +80 -0
- data/lib/blog_basic.rb +16 -0
- data/lib/generators/blog_basic/create_assets/blog_assets_generator.rb +49 -0
- data/lib/generators/blog_basic/create_assets/templates/blog_comments_migration.rb +23 -0
- data/lib/generators/blog_basic/create_assets/templates/blog_images_migration.rb +19 -0
- data/lib/generators/blog_basic/create_assets/templates/blog_posts_migration.rb +17 -0
- data/lib/generators/blog_basic/create_assets/templates/config/blog_basic.yml +52 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/active4d.css +114 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/all_hallows_eve.css +72 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/amy.css +147 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/blackboard.css +88 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/brilliance_black.css +605 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/brilliance_dull.css +599 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/cobalt.css +149 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/dawn.css +121 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/eiffel.css +121 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/espresso_libre.css +109 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/idle.css +62 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/iplastic.css +80 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/lazy.css +73 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/mac_classic.css +123 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/magicwb_amiga.css +104 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/pastels_on_dark.css +188 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/slush_poppies.css +85 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/spacecadet.css +51 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/sunburst.css +180 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/twilight.css +137 -0
- data/lib/generators/blog_basic/create_assets/templates/syntax/zenburnesque.css +91 -0
- data/lib/generators/blog_basic/install/install_generator.rb +53 -0
- data/lib/generators/blog_basic/install/templates/active_admin.rb +103 -0
- data/lib/generators/blog_basic/install/templates/blog_basic.yml +52 -0
- data/lib/generators/blog_basic/install/templates/blog_kit.css +75 -0
- data/lib/generators/blog_basic/install/templates/devise.en.yml +58 -0
- data/lib/generators/blog_basic/install/templates/devise.rb +209 -0
- data/lib/generators/blog_basic/install/templates/migrations/1_blog_tables.rb +86 -0
- data/lib/generators/blog_basic/install/templates/migrations/20111213104240_devise_create_admin_users.rb +28 -0
- data/lib/generators/blog_basic/install/templates/migrations/20111213114257_create_admin_notes.rb +16 -0
- data/lib/generators/blog_basic/install/templates/migrations/20111213114258_move_admin_notes_to_comments.rb +25 -0
- data/lib/generators/blog_basic/install/templates/omniauth.rb.erb +10 -0
- data/lib/tasks/blog_basic_tasks.rake +0 -0
- data/lib/url_validator.rb +24 -0
- data/test/database.yml +4 -0
- data/test/fixtures/admin_users.yml +11 -0
- data/test/functional/blog_assets_generator_test.rb +35 -0
- data/test/functional/blog_comments_controller_test.rb +0 -0
- data/test/functional/blog_posts_controller_test.rb +84 -0
- data/test/performance/browsing_test.rb +12 -0
- data/test/schema.rb +61 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/admin_user_test.rb +7 -0
- data/uninstall.rb +1 -0
- metadata +310 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
<% self.respond_to?(:title) && title(@index_title) -%>
|
2
|
+
<% @show_title = false -%>
|
3
|
+
<%= stylesheet_link_tag 'blog_kit' %>
|
4
|
+
<%= stylesheet_link_tag 'syntax/' + (BlogBasic::BlogConf.data['theme'] || 'mac_classic') %>
|
5
|
+
<%
|
6
|
+
#auto_discovery_link_tag :atom, blog_posts_path(:format => :atom)
|
7
|
+
%>
|
8
|
+
|
9
|
+
<% if @blog_posts.size != 0 -%>
|
10
|
+
<%= render :partial => 'blog_basic/shared/index_top' %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= render :partial => 'blog_basic/blog_posts/admin_links' %>
|
14
|
+
|
15
|
+
<% if @blog_posts.size == 0 && !params[:page] %>
|
16
|
+
<div class="blogPost">
|
17
|
+
<h1>No Blog Posts</h1>
|
18
|
+
<p>There are currently no blog posts, please check back shortly.</p><%= link_to "test", blog_posts_path %>
|
19
|
+
</div>
|
20
|
+
<% else %>
|
21
|
+
<% if @tag %>
|
22
|
+
<h1>Tag: <%= @tag %></h1>
|
23
|
+
<% end %>
|
24
|
+
<%= render :collection => @blog_posts, :partial => 'blog_basic/blog_posts/blog_post' %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<div class="blogPages">
|
28
|
+
<%= will_paginate @blog_posts %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<%= render :partial => 'blog_basic/blog_posts/admin_links' %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% self.respond_to?(:title) && title(@blog_post.title) %>
|
2
|
+
<% @show_title = false -%>
|
3
|
+
<%= stylesheet_link_tag 'blog_kit' %>
|
4
|
+
<%= stylesheet_link_tag 'syntax/' + (BlogBasic::BlogConf.data['theme'] || 'mac_classic') %>
|
5
|
+
|
6
|
+
<%= render :object => @blog_post, :partial => 'blog_post', :locals => {:show_comments => true} %>
|
7
|
+
|
8
|
+
<%= render :partial => 'blog_basic/blog_posts/admin_links' %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<script type="text/javascript">
|
2
|
+
|
3
|
+
var _gaq = _gaq || [];
|
4
|
+
_gaq.push(['_setAccount', 'UA-374017-8']);
|
5
|
+
_gaq.push(['_setDomainName', 'none']);
|
6
|
+
_gaq.push(['_setAllowLinker', true]);
|
7
|
+
_gaq.push(['_trackPageview']);
|
8
|
+
|
9
|
+
(function() {
|
10
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
11
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
12
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
13
|
+
})();
|
14
|
+
|
15
|
+
</script>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div style="margin-top: -80px;">
|
2
|
+
<form action="http://www.google.com/cse" id="cse-search-box">
|
3
|
+
<div>
|
4
|
+
<input type="hidden" name="cx" value="partner-pub-7596400770583233:3656901059" />
|
5
|
+
<input type="hidden" name="ie" value="UTF-8" />
|
6
|
+
<input type="text" name="q" size="80" />
|
7
|
+
<input type="submit" name="sa" value="Search" />
|
8
|
+
</div>
|
9
|
+
</form>
|
10
|
+
|
11
|
+
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
|
12
|
+
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div style="width: 100%; height: 30px; background-color: #EEE; border-bottom: 1px solid #AAA">
|
2
|
+
<div style="float: left; padding-top: 3px; margin-left: 20px;">
|
3
|
+
<a href="http://bottiger.org/" >Home</a>
|
4
|
+
</div>
|
5
|
+
<div style="float: right;">
|
6
|
+
|
7
|
+
<div style="float: right; padding-top: 6px;">
|
8
|
+
<g:plusone size="small"></g:plusone>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div style="float: right; padding-right: 10px; margin-top: 5px;">
|
12
|
+
<a href="http://twitter.com/share?via=arvidbottiger" class="twitter-share-button" data-related="bottiger" data-count="none">Tweet</a>
|
13
|
+
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
|
17
|
+
<div style="float: right; margin-top: 5px; margin-right: 10px;">
|
18
|
+
<a href="http://feeds.feedburner.com/BottigerOrgWrote" data-g-action='share sitefeed' expr:data-g-label='data:post.title'>
|
19
|
+
<img alt="Site Feed" src="http://www.google.com/images/feed-icon.gif" />
|
20
|
+
</a>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
</div>
|
data/blog_basic.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "blog_basic"
|
5
|
+
s.version = "0.1.6"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Arvid Boettiger"]
|
9
|
+
s.date = "2012-01-27"
|
10
|
+
s.description = "Sets up a basic but functional blogging platform."
|
11
|
+
s.email = "bottiger@gmail.com"
|
12
|
+
s.extra_rdoc_files = ["README.md", "lib/akismetor.rb", "lib/blog_basic.rb", "lib/blog_basic/active_admin.rb", "lib/blog_basic/blog_basic_model_helper.rb", "lib/blog_basic/blog_conf.rb", "lib/blog_basic/engine.rb", "lib/blog_basic/engine.rb.backup", "lib/generators/blog_basic/create_assets/blog_assets_generator.rb", "lib/generators/blog_basic/create_assets/templates/blog_comments_migration.rb", "lib/generators/blog_basic/create_assets/templates/blog_images_migration.rb", "lib/generators/blog_basic/create_assets/templates/blog_posts_migration.rb", "lib/generators/blog_basic/create_assets/templates/config/blog_basic.yml", "lib/generators/blog_basic/create_assets/templates/syntax/active4d.css", "lib/generators/blog_basic/create_assets/templates/syntax/all_hallows_eve.css", "lib/generators/blog_basic/create_assets/templates/syntax/amy.css", "lib/generators/blog_basic/create_assets/templates/syntax/blackboard.css", "lib/generators/blog_basic/create_assets/templates/syntax/brilliance_black.css", "lib/generators/blog_basic/create_assets/templates/syntax/brilliance_dull.css", "lib/generators/blog_basic/create_assets/templates/syntax/cobalt.css", "lib/generators/blog_basic/create_assets/templates/syntax/dawn.css", "lib/generators/blog_basic/create_assets/templates/syntax/eiffel.css", "lib/generators/blog_basic/create_assets/templates/syntax/espresso_libre.css", "lib/generators/blog_basic/create_assets/templates/syntax/idle.css", "lib/generators/blog_basic/create_assets/templates/syntax/iplastic.css", "lib/generators/blog_basic/create_assets/templates/syntax/lazy.css", "lib/generators/blog_basic/create_assets/templates/syntax/mac_classic.css", "lib/generators/blog_basic/create_assets/templates/syntax/magicwb_amiga.css", "lib/generators/blog_basic/create_assets/templates/syntax/pastels_on_dark.css", "lib/generators/blog_basic/create_assets/templates/syntax/slush_poppies.css", "lib/generators/blog_basic/create_assets/templates/syntax/spacecadet.css", "lib/generators/blog_basic/create_assets/templates/syntax/sunburst.css", "lib/generators/blog_basic/create_assets/templates/syntax/twilight.css", "lib/generators/blog_basic/create_assets/templates/syntax/zenburnesque.css", "lib/generators/blog_basic/install/install_generator.rb", "lib/generators/blog_basic/install/templates/active_admin.rb", "lib/generators/blog_basic/install/templates/blog_basic.yml", "lib/generators/blog_basic/install/templates/blog_kit.css", "lib/generators/blog_basic/install/templates/devise.en.yml", "lib/generators/blog_basic/install/templates/devise.rb", "lib/generators/blog_basic/install/templates/migrations/1_blog_tables.rb", "lib/generators/blog_basic/install/templates/migrations/20111213104240_devise_create_admin_users.rb", "lib/generators/blog_basic/install/templates/migrations/20111213114257_create_admin_notes.rb", "lib/generators/blog_basic/install/templates/migrations/20111213114258_move_admin_notes_to_comments.rb", "lib/generators/blog_basic/install/templates/omniauth.rb.erb", "lib/tasks/blog_basic_tasks.rake", "lib/url_validator.rb"]
|
13
|
+
s.files = ["Gemfile", "MIT-LICENSE", "Manifest", "README.md", "Rakefile", "app/admin/blog_basic_blog_posts.rb", "app/admin/dashboards.rb", "app/assets/images/rails.png", "app/assets/javascripts/active_admin.js", "app/assets/javascripts/application.js", "app/assets/stylesheets/active_admin.css.scss", "app/assets/stylesheets/application.css", "app/controllers/application_controller.rb", "app/controllers/blog_basic/app_controller.rb", "app/controllers/blog_basic/application_controller.rb", "app/controllers/blog_basic/blog_comments_controller.rb", "app/controllers/blog_basic/blog_posts_controller.rb", "app/controllers/blog_basic/sessions_controller.rb", "app/controllers/blog_basic/tags_controller.rb", "app/helpers/application_helper.rb", "app/helpers/blog_basic/application_helper.rb", "app/helpers/blog_basic/blog_posts_helper.rb", "app/helpers/blog_basic/shared_helper.rb", "app/helpers/blog_basic/tags_helper.rb", "app/models/admin_user.rb", "app/models/blog_basic/blog_comment.rb", "app/models/blog_basic/blog_content.rb", "app/models/blog_basic/blog_image.rb", "app/models/blog_basic/blog_post.rb", "app/models/blog_basic/session.rb", "app/models/blog_basic/user.rb", "app/views/blog_basic/blog_comments/_new_blog_comment.html.erb", "app/views/blog_basic/blog_posts/_admin_links.html.erb", "app/views/blog_basic/blog_posts/_blog_post.html.erb", "app/views/blog_basic/blog_posts/_comment.html.erb", "app/views/blog_basic/blog_posts/_comments.html.erb", "app/views/blog_basic/blog_posts/_form.html.erb", "app/views/blog_basic/blog_posts/_image.html.erb", "app/views/blog_basic/blog_posts/drafts.html.erb", "app/views/blog_basic/blog_posts/edit.html.erb", "app/views/blog_basic/blog_posts/index.atom.builder", "app/views/blog_basic/blog_posts/index.html.erb", "app/views/blog_basic/blog_posts/new.html.erb", "app/views/blog_basic/blog_posts/show.html.erb", "app/views/blog_basic/shared/_footer.html.erb", "app/views/blog_basic/shared/_index_top.html.erb", "app/views/blog_basic/shared/_topbar.html.erb", "app/views/layouts/application.html.erb", "blog_basic.gemspec", "config/routes.rb", "db/migrate/1_blog_tables.rb", "init.rb", "lib/akismetor.rb", "lib/blog_basic.rb", "lib/blog_basic/active_admin.rb", "lib/blog_basic/blog_basic_model_helper.rb", "lib/blog_basic/blog_conf.rb", "lib/blog_basic/engine.rb", "lib/blog_basic/engine.rb.backup", "lib/generators/blog_basic/create_assets/blog_assets_generator.rb", "lib/generators/blog_basic/create_assets/templates/blog_comments_migration.rb", "lib/generators/blog_basic/create_assets/templates/blog_images_migration.rb", "lib/generators/blog_basic/create_assets/templates/blog_posts_migration.rb", "lib/generators/blog_basic/create_assets/templates/config/blog_basic.yml", "lib/generators/blog_basic/create_assets/templates/syntax/active4d.css", "lib/generators/blog_basic/create_assets/templates/syntax/all_hallows_eve.css", "lib/generators/blog_basic/create_assets/templates/syntax/amy.css", "lib/generators/blog_basic/create_assets/templates/syntax/blackboard.css", "lib/generators/blog_basic/create_assets/templates/syntax/brilliance_black.css", "lib/generators/blog_basic/create_assets/templates/syntax/brilliance_dull.css", "lib/generators/blog_basic/create_assets/templates/syntax/cobalt.css", "lib/generators/blog_basic/create_assets/templates/syntax/dawn.css", "lib/generators/blog_basic/create_assets/templates/syntax/eiffel.css", "lib/generators/blog_basic/create_assets/templates/syntax/espresso_libre.css", "lib/generators/blog_basic/create_assets/templates/syntax/idle.css", "lib/generators/blog_basic/create_assets/templates/syntax/iplastic.css", "lib/generators/blog_basic/create_assets/templates/syntax/lazy.css", "lib/generators/blog_basic/create_assets/templates/syntax/mac_classic.css", "lib/generators/blog_basic/create_assets/templates/syntax/magicwb_amiga.css", "lib/generators/blog_basic/create_assets/templates/syntax/pastels_on_dark.css", "lib/generators/blog_basic/create_assets/templates/syntax/slush_poppies.css", "lib/generators/blog_basic/create_assets/templates/syntax/spacecadet.css", "lib/generators/blog_basic/create_assets/templates/syntax/sunburst.css", "lib/generators/blog_basic/create_assets/templates/syntax/twilight.css", "lib/generators/blog_basic/create_assets/templates/syntax/zenburnesque.css", "lib/generators/blog_basic/install/install_generator.rb", "lib/generators/blog_basic/install/templates/active_admin.rb", "lib/generators/blog_basic/install/templates/blog_basic.yml", "lib/generators/blog_basic/install/templates/blog_kit.css", "lib/generators/blog_basic/install/templates/devise.en.yml", "lib/generators/blog_basic/install/templates/devise.rb", "lib/generators/blog_basic/install/templates/migrations/1_blog_tables.rb", "lib/generators/blog_basic/install/templates/migrations/20111213104240_devise_create_admin_users.rb", "lib/generators/blog_basic/install/templates/migrations/20111213114257_create_admin_notes.rb", "lib/generators/blog_basic/install/templates/migrations/20111213114258_move_admin_notes_to_comments.rb", "lib/generators/blog_basic/install/templates/omniauth.rb.erb", "lib/tasks/blog_basic_tasks.rake", "lib/url_validator.rb", "test/database.yml", "test/fixtures/admin_users.yml", "test/functional/blog_assets_generator_test.rb", "test/functional/blog_comments_controller_test.rb", "test/functional/blog_posts_controller_test.rb", "test/performance/browsing_test.rb", "test/schema.rb", "test/test_helper.rb", "test/unit/admin_user_test.rb", "uninstall.rb"]
|
14
|
+
s.homepage = "http://bottiger.org/made/blog_basic"
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Blog_basic", "--main", "README.md"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = "blog_basic"
|
18
|
+
s.rubygems_version = "1.8.15"
|
19
|
+
s.summary = "Sets up a basic but functional blogging platform."
|
20
|
+
s.test_files = ["test/functional/blog_assets_generator_test.rb", "test/functional/blog_comments_controller_test.rb", "test/functional/blog_posts_controller_test.rb", "test/test_helper.rb", "test/unit/admin_user_test.rb", "test/performance/browsing_test.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<bluecloth>, ["~> 2.2.0"])
|
27
|
+
s.add_runtime_dependency(%q<will_paginate>, [">= 0"])
|
28
|
+
s.add_runtime_dependency(%q<paperclip>, [">= 2.3"])
|
29
|
+
s.add_runtime_dependency(%q<sass-rails>, [">= 0"])
|
30
|
+
s.add_runtime_dependency(%q<meta_search>, ["~> 1.1.1"])
|
31
|
+
s.add_runtime_dependency(%q<acts-as-taggable-on>, ["~> 2.1.1"])
|
32
|
+
s.add_runtime_dependency(%q<omniauth>, ["~> 1.0.0"])
|
33
|
+
s.add_runtime_dependency(%q<omniauth-openid>, ["~> 1.0.0"])
|
34
|
+
s.add_runtime_dependency(%q<omniauth-github>, ["~> 1.0.0"])
|
35
|
+
else
|
36
|
+
s.add_dependency(%q<bluecloth>, ["~> 2.2.0"])
|
37
|
+
s.add_dependency(%q<will_paginate>, [">= 0"])
|
38
|
+
s.add_dependency(%q<paperclip>, [">= 2.3"])
|
39
|
+
s.add_dependency(%q<sass-rails>, [">= 0"])
|
40
|
+
s.add_dependency(%q<meta_search>, ["~> 1.1.1"])
|
41
|
+
s.add_dependency(%q<acts-as-taggable-on>, ["~> 2.1.1"])
|
42
|
+
s.add_dependency(%q<omniauth>, ["~> 1.0.0"])
|
43
|
+
s.add_dependency(%q<omniauth-openid>, ["~> 1.0.0"])
|
44
|
+
s.add_dependency(%q<omniauth-github>, ["~> 1.0.0"])
|
45
|
+
end
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<bluecloth>, ["~> 2.2.0"])
|
48
|
+
s.add_dependency(%q<will_paginate>, [">= 0"])
|
49
|
+
s.add_dependency(%q<paperclip>, [">= 2.3"])
|
50
|
+
s.add_dependency(%q<sass-rails>, [">= 0"])
|
51
|
+
s.add_dependency(%q<meta_search>, ["~> 1.1.1"])
|
52
|
+
s.add_dependency(%q<acts-as-taggable-on>, ["~> 2.1.1"])
|
53
|
+
s.add_dependency(%q<omniauth>, ["~> 1.0.0"])
|
54
|
+
s.add_dependency(%q<omniauth-openid>, ["~> 1.0.0"])
|
55
|
+
s.add_dependency(%q<omniauth-github>, ["~> 1.0.0"])
|
56
|
+
end
|
57
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
BlogBasic::Engine.routes.draw do
|
2
|
+
|
3
|
+
# ActiveAdmin.routes(self)
|
4
|
+
## devise_for :admin_users, ActiveAdmin::Devise.config
|
5
|
+
|
6
|
+
resources :blog_posts, :path => '' do
|
7
|
+
resources :blog_comments
|
8
|
+
resources :blog_images
|
9
|
+
|
10
|
+
collection do
|
11
|
+
get :drafts
|
12
|
+
end
|
13
|
+
end
|
14
|
+
resources :tags
|
15
|
+
|
16
|
+
#fix - include in namespace
|
17
|
+
match "/auth/:provider/callback" => "sessions#create"
|
18
|
+
|
19
|
+
match '/signin' => 'session#create', :defaults => { :provider => "github" }
|
20
|
+
match "/signout" => "sessions#destroy", :as => :signout
|
21
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
class BlogTables < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def up
|
4
|
+
create_table "blog_basic_blog_comments", :force => true do |t|
|
5
|
+
t.integer "blog_post_id"
|
6
|
+
t.integer "user_id"
|
7
|
+
t.string "user_ip"
|
8
|
+
t.string "user_agent"
|
9
|
+
t.string "referrer"
|
10
|
+
t.string "name"
|
11
|
+
t.string "site_url"
|
12
|
+
t.string "email"
|
13
|
+
t.text "body"
|
14
|
+
t.datetime "created_at"
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index "blog_basic_blog_comments", ["blog_post_id"], :name => "index_blog_comments_on_blog_post_id"
|
18
|
+
|
19
|
+
create_table "blog_basic_blog_contents", :force => true do |t|
|
20
|
+
t.string "title"
|
21
|
+
t.text "content"
|
22
|
+
t.integer "blog_post_id"
|
23
|
+
t.datetime "created_at"
|
24
|
+
t.datetime "updated_at"
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table "blog_basic_blog_images", :force => true do |t|
|
28
|
+
t.string "image_file_name"
|
29
|
+
t.string "image_content_type"
|
30
|
+
t.integer "image_file_size"
|
31
|
+
t.datetime "image_updated_at"
|
32
|
+
t.integer "blog_post_id"
|
33
|
+
t.datetime "created_at"
|
34
|
+
t.datetime "updated_at"
|
35
|
+
end
|
36
|
+
|
37
|
+
add_index "blog_basic_blog_images", ["blog_post_id"], :name => "index_blog_images_on_blog_post_id"
|
38
|
+
|
39
|
+
create_table "blog_basic_blog_posts", :force => true do |t|
|
40
|
+
t.string "title", :null => false
|
41
|
+
t.text "body"
|
42
|
+
t.datetime "created_at"
|
43
|
+
t.datetime "updated_at"
|
44
|
+
t.integer "user_id"
|
45
|
+
t.datetime "published_at"
|
46
|
+
t.integer "published", :default => 0, :null => false
|
47
|
+
t.integer "parent_id"
|
48
|
+
end
|
49
|
+
|
50
|
+
create_table "blog_basic_sessions", :force => true do |t|
|
51
|
+
t.datetime "created_at"
|
52
|
+
t.datetime "updated_at"
|
53
|
+
end
|
54
|
+
|
55
|
+
create_table "taggings", :force => true do |t|
|
56
|
+
t.integer "tag_id"
|
57
|
+
t.integer "taggable_id"
|
58
|
+
t.string "taggable_type"
|
59
|
+
t.integer "tagger_id"
|
60
|
+
t.string "tagger_type"
|
61
|
+
t.string "context"
|
62
|
+
t.datetime "created_at"
|
63
|
+
end
|
64
|
+
|
65
|
+
add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
|
66
|
+
add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
|
67
|
+
|
68
|
+
create_table "tags", :force => true do |t|
|
69
|
+
t.string "name"
|
70
|
+
end
|
71
|
+
|
72
|
+
create_table "blog_basic_users", :force => true do |t|
|
73
|
+
t.string "email"
|
74
|
+
t.string "first_name"
|
75
|
+
t.string "last_name"
|
76
|
+
t.string "identifier_url"
|
77
|
+
t.datetime "created_at"
|
78
|
+
t.datetime "updated_at"
|
79
|
+
end
|
80
|
+
|
81
|
+
add_index "blog_basic_users", ["identifier_url"], :name => "index_users_on_identifier_url", :unique => true
|
82
|
+
end
|
83
|
+
|
84
|
+
def down
|
85
|
+
end
|
86
|
+
end
|
data/init.rb
ADDED
data/lib/akismetor.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Included from http://github.com/levycarneiro/akismetor.git
|
2
|
+
#
|
3
|
+
# Copyright (c) 2008 Michael Hale
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
class Akismetor
|
26
|
+
attr_accessor :attributes
|
27
|
+
|
28
|
+
require 'net/http'
|
29
|
+
|
30
|
+
# Does a key-check on Akismet so you know you can actually use a specific key.
|
31
|
+
# Returns "valid" or "invalid" depending on response.
|
32
|
+
def self.valid_key?(attributes)
|
33
|
+
self.new(attributes).execute('verify-key')
|
34
|
+
end
|
35
|
+
|
36
|
+
# Does a comment-check on Akismet with the submitted hash.
|
37
|
+
# Returns true or false depending on response.
|
38
|
+
def self.spam?(attributes)
|
39
|
+
self.new(attributes).execute('comment-check') != "false"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Does a submit-spam on Akismet with the submitted hash.
|
43
|
+
# Use this when Akismet incorrectly approves a spam comment.
|
44
|
+
def self.submit_spam(attributes)
|
45
|
+
self.new(attributes).execute('submit-spam')
|
46
|
+
end
|
47
|
+
|
48
|
+
# Does a submit-ham on Akismet with the submitted hash.
|
49
|
+
# Use this for a false positive, when Akismet incorrectly rejects a normal comment.
|
50
|
+
def self.submit_ham(attributes)
|
51
|
+
self.new(attributes).execute('submit-ham')
|
52
|
+
end
|
53
|
+
|
54
|
+
def initialize(attributes)
|
55
|
+
@attributes = attributes
|
56
|
+
end
|
57
|
+
|
58
|
+
def execute(command)
|
59
|
+
host = "#{@attributes[:key]}." if attributes[:key] && command != 'verify-key'
|
60
|
+
http = Net::HTTP.new("#{host}rest.akismet.com", 80)
|
61
|
+
http.post("/1.1/#{command}", attributes_for_post, http_headers).body
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def http_headers
|
67
|
+
{
|
68
|
+
'User-Agent' => 'Akismetor Rails Plugin/1.1',
|
69
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def attributes_for_post
|
74
|
+
result = attributes.map { |k, v| "#{k}=#{v}" }.join('&')
|
75
|
+
URI.escape(result)
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
ActiveAdmin.setup do |config|
|
2
|
+
|
3
|
+
# == Site Title
|
4
|
+
#
|
5
|
+
# Set the title that is displayed on the main layout
|
6
|
+
# for each of the active admin pages.
|
7
|
+
#
|
8
|
+
config.site_title = "Blog Basics Administration panel"
|
9
|
+
|
10
|
+
# Set the link url for the title. For example, to take
|
11
|
+
# users to your main site. Defaults to no link.
|
12
|
+
#
|
13
|
+
# config.site_title_link = "/"
|
14
|
+
|
15
|
+
# == Default Namespace
|
16
|
+
#
|
17
|
+
# Set the default namespace each administration resource
|
18
|
+
# will be added to.
|
19
|
+
#
|
20
|
+
# eg:
|
21
|
+
# config.default_namespace = :hello_world
|
22
|
+
#
|
23
|
+
# This will create resources in the HelloWorld module and
|
24
|
+
# will namespace routes to /hello_world/*
|
25
|
+
#
|
26
|
+
# To set no namespace by default, use:
|
27
|
+
# config.default_namespace = false
|
28
|
+
#
|
29
|
+
# Default:
|
30
|
+
# config.default_namespace = :admin
|
31
|
+
|
32
|
+
# == User Authentication
|
33
|
+
#
|
34
|
+
# Active Admin will automatically call an authentication
|
35
|
+
# method in a before filter of all controller actions to
|
36
|
+
# ensure that there is a currently logged in admin user.
|
37
|
+
#
|
38
|
+
# This setting changes the method which Active Admin calls
|
39
|
+
# within the controller.
|
40
|
+
#config.authentication_method = :authenticate_admin_user!
|
41
|
+
config.authentication_method = :signed_in?
|
42
|
+
|
43
|
+
# == Current User
|
44
|
+
#
|
45
|
+
# Active Admin will associate actions with the current
|
46
|
+
# user performing them.
|
47
|
+
#
|
48
|
+
# This setting changes the method which Active Admin calls
|
49
|
+
# to return the currently logged in user.
|
50
|
+
config.current_user_method = :current_user
|
51
|
+
|
52
|
+
|
53
|
+
# == Logging Out
|
54
|
+
#
|
55
|
+
# Active Admin displays a logout link on each screen. These
|
56
|
+
# settings configure the location and method used for the link.
|
57
|
+
#
|
58
|
+
# This setting changes the path where the link points to. If it's
|
59
|
+
# a string, the strings is used as the path. If it's a Symbol, we
|
60
|
+
# will call the method to return the path.
|
61
|
+
#
|
62
|
+
# Default:
|
63
|
+
# config.logout_link_path = :destroy_admin_user_session_path
|
64
|
+
|
65
|
+
# This setting changes the http method used when rendering the
|
66
|
+
# link. For example :get, :delete, :put, etc..
|
67
|
+
#
|
68
|
+
# Default:
|
69
|
+
# config.logout_link_method = :get
|
70
|
+
|
71
|
+
|
72
|
+
# == Admin Comments
|
73
|
+
#
|
74
|
+
# Admin comments allow you to add comments to any model for admin use
|
75
|
+
#
|
76
|
+
# Admin comments are enabled by default in the default
|
77
|
+
# namespace only. You can turn them on in a namesapce
|
78
|
+
# by adding them to the comments array.
|
79
|
+
#
|
80
|
+
# Default:
|
81
|
+
# config.allow_comments_in = [:admin]
|
82
|
+
|
83
|
+
|
84
|
+
# == Controller Filters
|
85
|
+
#
|
86
|
+
# You can add before, after and around filters to all of your
|
87
|
+
# Active Admin resources from here.
|
88
|
+
#
|
89
|
+
# config.before_filter :do_something_awesome
|
90
|
+
|
91
|
+
|
92
|
+
# == Register Stylesheets & Javascripts
|
93
|
+
#
|
94
|
+
# We recommend using the built in Active Admin layout and loading
|
95
|
+
# up your own stylesheets / javascripts to customize the look
|
96
|
+
# and feel.
|
97
|
+
#
|
98
|
+
# To load a stylesheet:
|
99
|
+
# config.register_stylesheet 'my_stylesheet.css'
|
100
|
+
#
|
101
|
+
# To load a javascript file:
|
102
|
+
# config.register_javascript 'my_javascript.js'
|
103
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#module BlogBasic
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
begin
|
6
|
+
#require 'maruku'
|
7
|
+
require 'bluecloth'
|
8
|
+
rescue Exception => e
|
9
|
+
require 'erb'
|
10
|
+
puts "Could not load bluecloth #{e.inspect}"
|
11
|
+
end
|
12
|
+
begin
|
13
|
+
require 'uv'
|
14
|
+
rescue Exception => e
|
15
|
+
require 'erb'
|
16
|
+
puts "Could not load UltraViolet"
|
17
|
+
end
|
18
|
+
|
19
|
+
module BlogBasic
|
20
|
+
|
21
|
+
module BlogBasicModelHelper
|
22
|
+
def code_highlight_and_markdown(text, markdown_options = {})
|
23
|
+
text_pieces = text.split(/(<code>|<code lang="[A-Za-z0-9_-]+">|
|
24
|
+
<code lang='[A-Za-z0-9_-]+'>|<\/code>)/)
|
25
|
+
in_pre = false
|
26
|
+
language = nil
|
27
|
+
post = text_pieces.collect do |piece|
|
28
|
+
if piece =~ /^<code( lang=(["'])?(.*)\2)?>$/
|
29
|
+
language = $3
|
30
|
+
in_pre = true
|
31
|
+
nil
|
32
|
+
elsif piece == "</code>"
|
33
|
+
in_pre = false
|
34
|
+
language = nil
|
35
|
+
nil
|
36
|
+
elsif in_pre
|
37
|
+
lang = language ? language : "ruby"
|
38
|
+
if defined?(Uv)
|
39
|
+
"<div class=\"blogKitCode\">" + Uv.parse( piece.strip, "xhtml", lang, BlogConf.data['show_line_numbers'] || false, BlogConf.data['theme'] || 'mac_classic') + "</div>"
|
40
|
+
else
|
41
|
+
"<code>#{ERB::Util.html_escape(piece)}</code>"
|
42
|
+
end
|
43
|
+
else
|
44
|
+
if defined?(BlueCloth)
|
45
|
+
BlueCloth.new(piece, markdown_options).to_html
|
46
|
+
#Maruku.new(piece).to_html
|
47
|
+
else
|
48
|
+
ERB::Util.html_escape(piece)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end.join('')
|
52
|
+
|
53
|
+
return post.html_safe if post.respond_to?(:html_safe)
|
54
|
+
return post
|
55
|
+
end
|
56
|
+
|
57
|
+
def user_image_tag
|
58
|
+
if self.user && self.user.respond_to?(:blog_image_url) && self.user.blog_image_url
|
59
|
+
# Load image from model
|
60
|
+
ret = "<img src=\"#{self.user.blog_image_url}\" />"
|
61
|
+
elsif BlogConf.data['gravatar']
|
62
|
+
# Gravatar
|
63
|
+
require 'digest/md5'
|
64
|
+
if self.respond_to?(:email) && !self.email.blank?
|
65
|
+
email = self.email
|
66
|
+
elsif self.user && self.user.respond_to?(:email) && !self.user.email.blank?
|
67
|
+
email = self.user.email
|
68
|
+
else
|
69
|
+
return ''
|
70
|
+
end
|
71
|
+
|
72
|
+
hash = Digest::MD5.hexdigest(email.downcase)
|
73
|
+
ret = "<img src=\"http://www.gravatar.com/avatar/#{hash}.jpg\" />"
|
74
|
+
else
|
75
|
+
# No Image
|
76
|
+
return ''
|
77
|
+
end
|
78
|
+
|
79
|
+
return ret.html_safe if ret.respond_to?(:html_safe)
|
80
|
+
return ret
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module BlogBasic
|
2
|
+
class BlogConf
|
3
|
+
#include Singleton
|
4
|
+
|
5
|
+
#def initialize
|
6
|
+
def self.data
|
7
|
+
#@data = YAML.load_file("#{rails_root}/config/" + "blog_basic.yml")
|
8
|
+
config_filename = "blog_basic.yml"
|
9
|
+
|
10
|
+
if defined?(Rails)
|
11
|
+
rails_root = Rails.root
|
12
|
+
elsif defined?(RAILS_ROOT)
|
13
|
+
rails_root = RAILS_ROOT
|
14
|
+
else
|
15
|
+
puts "Unable to load rails"
|
16
|
+
return
|
17
|
+
end
|
18
|
+
file_name = "#{rails_root}/config/" + config_filename
|
19
|
+
if File.exists?(file_name)
|
20
|
+
begin
|
21
|
+
@settings = YAML::load(File.open(file_name).read)
|
22
|
+
rescue Exception => e
|
23
|
+
puts config_filename + "config file is invalid"
|
24
|
+
end
|
25
|
+
else
|
26
|
+
puts 'No ' + config_filename + ' config file'
|
27
|
+
end
|
28
|
+
#file_name
|
29
|
+
@settings
|
30
|
+
end
|
31
|
+
|
32
|
+
#def self.data
|
33
|
+
# @settings
|
34
|
+
#end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module BlogBasic
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
isolate_namespace BlogBasic
|
4
|
+
|
5
|
+
# initializer 'setup active_admin' do |app|
|
6
|
+
# ActiveAdmin.setup do |config|
|
7
|
+
# config.site_title = "Blog Basics Administration panel"
|
8
|
+
# config.authentication_method = :signed_in?
|
9
|
+
# config.current_user_method = :current_user
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
end
|
13
|
+
end
|