blog_basic 0.1.6 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -0,0 +1,102 @@
1
+ Gemfile
2
+ MIT-LICENSE
3
+ Manifest
4
+ README.md
5
+ Rakefile
6
+ app/admin/blog_basic_blog_posts.rb
7
+ app/admin/dashboards.rb
8
+ app/assets/images/rails.png
9
+ app/assets/javascripts/active_admin.js
10
+ app/assets/javascripts/application.js
11
+ app/assets/stylesheets/active_admin.css.scss
12
+ app/assets/stylesheets/application.css
13
+ app/controllers/application_controller.rb
14
+ app/controllers/blog_basic/app_controller.rb
15
+ app/controllers/blog_basic/application_controller.rb
16
+ app/controllers/blog_basic/blog_comments_controller.rb
17
+ app/controllers/blog_basic/blog_posts_controller.rb
18
+ app/controllers/blog_basic/sessions_controller.rb
19
+ app/controllers/blog_basic/tags_controller.rb
20
+ app/helpers/application_helper.rb
21
+ app/helpers/blog_basic/application_helper.rb
22
+ app/helpers/blog_basic/blog_posts_helper.rb
23
+ app/helpers/blog_basic/shared_helper.rb
24
+ app/helpers/blog_basic/tags_helper.rb
25
+ app/models/blog_basic/blog_comment.rb
26
+ app/models/blog_basic/blog_content.rb
27
+ app/models/blog_basic/blog_image.rb
28
+ app/models/blog_basic/blog_post.rb
29
+ app/models/blog_basic/session.rb
30
+ app/models/blog_basic/user.rb
31
+ app/views/blog_basic/blog_comments/_new_blog_comment.html.erb
32
+ app/views/blog_basic/blog_posts/_admin_links.html.erb
33
+ app/views/blog_basic/blog_posts/_blog_post.html.erb
34
+ app/views/blog_basic/blog_posts/_comment.html.erb
35
+ app/views/blog_basic/blog_posts/_comments.html.erb
36
+ app/views/blog_basic/blog_posts/_form.html.erb
37
+ app/views/blog_basic/blog_posts/_image.html.erb
38
+ app/views/blog_basic/blog_posts/drafts.html.erb
39
+ app/views/blog_basic/blog_posts/edit.html.erb
40
+ app/views/blog_basic/blog_posts/index.atom.builder
41
+ app/views/blog_basic/blog_posts/index.html.erb
42
+ app/views/blog_basic/blog_posts/new.html.erb
43
+ app/views/blog_basic/blog_posts/show.html.erb
44
+ app/views/blog_basic/shared/_footer.html.erb
45
+ app/views/blog_basic/shared/_index_top.html.erb
46
+ app/views/blog_basic/shared/_topbar.html.erb
47
+ app/views/layouts/application.html.erb
48
+ blog_basic.gemspec
49
+ config/routes.rb
50
+ db/migrate/1_blog_tables.rb
51
+ init.rb
52
+ lib/akismetor.rb
53
+ lib/blog_basic.rb
54
+ lib/blog_basic/blog_conf.rb
55
+ lib/blog_basic/engine.rb
56
+ lib/blog_basic/engine.rb.backup
57
+ lib/generators/blog_basic/create_assets/blog_assets_generator.rb
58
+ lib/generators/blog_basic/create_assets/templates/blog_comments_migration.rb
59
+ lib/generators/blog_basic/create_assets/templates/blog_images_migration.rb
60
+ lib/generators/blog_basic/create_assets/templates/blog_posts_migration.rb
61
+ lib/generators/blog_basic/create_assets/templates/config/blog_basic.yml
62
+ lib/generators/blog_basic/create_assets/templates/syntax/active4d.css
63
+ lib/generators/blog_basic/create_assets/templates/syntax/all_hallows_eve.css
64
+ lib/generators/blog_basic/create_assets/templates/syntax/amy.css
65
+ lib/generators/blog_basic/create_assets/templates/syntax/blackboard.css
66
+ lib/generators/blog_basic/create_assets/templates/syntax/brilliance_black.css
67
+ lib/generators/blog_basic/create_assets/templates/syntax/brilliance_dull.css
68
+ lib/generators/blog_basic/create_assets/templates/syntax/cobalt.css
69
+ lib/generators/blog_basic/create_assets/templates/syntax/dawn.css
70
+ lib/generators/blog_basic/create_assets/templates/syntax/eiffel.css
71
+ lib/generators/blog_basic/create_assets/templates/syntax/espresso_libre.css
72
+ lib/generators/blog_basic/create_assets/templates/syntax/idle.css
73
+ lib/generators/blog_basic/create_assets/templates/syntax/iplastic.css
74
+ lib/generators/blog_basic/create_assets/templates/syntax/lazy.css
75
+ lib/generators/blog_basic/create_assets/templates/syntax/mac_classic.css
76
+ lib/generators/blog_basic/create_assets/templates/syntax/magicwb_amiga.css
77
+ lib/generators/blog_basic/create_assets/templates/syntax/pastels_on_dark.css
78
+ lib/generators/blog_basic/create_assets/templates/syntax/slush_poppies.css
79
+ lib/generators/blog_basic/create_assets/templates/syntax/spacecadet.css
80
+ lib/generators/blog_basic/create_assets/templates/syntax/sunburst.css
81
+ lib/generators/blog_basic/create_assets/templates/syntax/twilight.css
82
+ lib/generators/blog_basic/create_assets/templates/syntax/zenburnesque.css
83
+ lib/generators/blog_basic/install/install_generator.rb
84
+ lib/generators/blog_basic/install/templates/active_admin.rb
85
+ lib/generators/blog_basic/install/templates/blog_basic.yml
86
+ lib/generators/blog_basic/install/templates/blog_kit.css
87
+ lib/generators/blog_basic/install/templates/devise.en.yml
88
+ lib/generators/blog_basic/install/templates/devise.rb
89
+ lib/generators/blog_basic/install/templates/migrations/1_blog_tables.rb
90
+ lib/generators/blog_basic/install/templates/omniauth.rb.erb
91
+ lib/tasks/blog_basic_tasks.rake
92
+ lib/url_validator.rb
93
+ test/database.yml
94
+ test/fixtures/admin_users.yml
95
+ test/functional/blog_assets_generator_test.rb
96
+ test/functional/blog_comments_controller_test.rb
97
+ test/functional/blog_posts_controller_test.rb
98
+ test/performance/browsing_test.rb
99
+ test/schema.rb
100
+ test/test_helper.rb
101
+ test/unit/admin_user_test.rb
102
+ uninstall.rb
data/README.md CHANGED
@@ -3,10 +3,6 @@ blog_basic
3
3
 
4
4
  blog_basic is a fork of the rails plugin BlogKit (https://github.com/ryanstout/blog_kit)
5
5
 
6
- While I really liked the idea if BlogKit it was unmaintained, lacked some essential features and had a few
7
- security vurnabilities which has not been adressed yet.
8
-
9
-
10
6
  blog_basic
11
7
  ========
12
8
 
@@ -45,12 +41,15 @@ and migrate your database
45
41
 
46
42
  rake db:migrate
47
43
 
44
+ edit config/initializers/blog_omniauth.rb
45
+ and config/blog_basic.yml
46
+
48
47
  Now adjust config/routes.rb for your desired path and config/blog_basic.yml for the rest of the configuration
49
48
 
50
49
  Assumptions
51
50
  ===========
52
51
 
53
- BlogKit makes the following assumptions
52
+ Blog_basic makes the following assumptions
54
53
 
55
54
  + flash messages displaying is handled via the layout
56
55
 
data/Rakefile CHANGED
@@ -8,13 +8,13 @@ require 'rake/testtask'
8
8
  require 'rubygems'
9
9
  require 'echoe'
10
10
 
11
- Echoe.new('blog_basic', '0.1.6') do |p|
11
+ Echoe.new('blog_basic', '0.1.9') do |p|
12
12
  p.description = "Sets up a basic but functional blogging platform."
13
13
  p.url = "http://bottiger.org/made/blog_basic"
14
14
  p.author = "Arvid Boettiger"
15
15
  p.email = "bottiger@gmail.com"
16
16
  p.ignore_pattern = ["tmp/*", "script/*"]
17
- p.runtime_dependencies = ['bluecloth ~>2.2.0', 'will_paginate', "paperclip >=2.3", "sass-rails", "meta_search ~>1.1.1", "acts-as-taggable-on ~>2.1.1", "omniauth ~>1.0.0", "omniauth-openid ~>1.0.0", "omniauth-github ~>1.0.0"]
17
+ p.runtime_dependencies = ['bluecloth ~>2.2.0', 'will_paginate', "paperclip >=2.3", "sass-rails", "meta_search ~>1.1.1", "acts-as-taggable-on ~>2.1.1", "omniauth ~>1.0.0", "omniauth-openid ~>1.0.0", "omniauth-github ~>1.0.0", "coderay"]
18
18
  end
19
19
 
20
20
  Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -10,7 +10,10 @@ module BlogBasic
10
10
  end
11
11
 
12
12
  def carnonical_link(post)
13
- "<link rel=\"canonical\" href=\"/".html_safe + post.id.to_s + "\" />".html_safe
13
+ prefix=""
14
+ url_parts = blog_post_path.split("/") # FIXME: pretty solution is welcome
15
+ url_parts.each { |part| prefix = prefix + part + "/" unless part == url_parts.last }
16
+ "<link rel=\"canonical\" href=\"".html_safe + prefix + post.id.to_s + "\" />".html_safe
14
17
  end
15
18
 
16
19
  end
@@ -5,6 +5,8 @@ module BlogBasic
5
5
 
6
6
  unloadable
7
7
 
8
+ attr_accessible :title, :body, :tag_list, :published
9
+
8
10
  belongs_to :user
9
11
 
10
12
  has_many :blog_comments, :dependent => :destroy
@@ -26,6 +28,20 @@ module BlogBasic
26
28
 
27
29
  acts_as_taggable
28
30
 
31
+ def markdown(text, markdown_options = {})
32
+ BlueCloth.new(text, markdown_options).to_html
33
+ end
34
+
35
+ def code_highlight(text)
36
+ text.gsub(/\<code( lang="(.+?)")?\>(.+?)\<\/code\>/m) do
37
+ CodeRay.scan($3, $2).div(:css => :class)
38
+ end
39
+ end
40
+
41
+ def render_text(text, markdown_options = {})
42
+ markdown(code_highlight(text), markdown_options)
43
+ end
44
+
29
45
  def not_resaving?
30
46
  !@resaving
31
47
  end
@@ -89,7 +105,7 @@ module BlogBasic
89
105
  if length > 0
90
106
  image_parsed_body = truncate(image_parsed_body, :length => length, :separator => ' ')
91
107
  end
92
- return code_highlight_and_markdown(image_parsed_body)
108
+ return render_text(image_parsed_body)
93
109
  end
94
110
 
95
111
  def formatted_updated_at
@@ -100,5 +116,31 @@ module BlogBasic
100
116
  def to_param
101
117
  "#{id}-#{title.gsub(/[^a-z0-9]+/i, '-')}"
102
118
  end
119
+
120
+ def user_image_tag
121
+ if self.user && self.user.respond_to?(:blog_image_url) && self.user.blog_image_url
122
+ # Load image from model
123
+ ret = "<img src=\"#{self.user.blog_image_url}\" />"
124
+ elsif BlogConf.data['gravatar']
125
+ # Gravatar
126
+ require 'digest/md5'
127
+ if self.respond_to?(:email) && !self.email.blank?
128
+ email = self.email
129
+ elsif self.user && self.user.respond_to?(:email) && !self.user.email.blank?
130
+ email = self.user.email
131
+ else
132
+ return ''
133
+ end
134
+
135
+ hash = Digest::MD5.hexdigest(email.downcase)
136
+ ret = "<img src=\"http://www.gravatar.com/avatar/#{hash}.jpg\" />"
137
+ else
138
+ # No Image
139
+ return ''
140
+ end
141
+
142
+ return ret.html_safe if ret.respond_to?(:html_safe)
143
+ return ret
144
+ end
103
145
  end
104
- end
146
+ end
@@ -1,6 +1,14 @@
1
1
  module BlogBasic
2
2
  class User < ActiveRecord::Base
3
3
 
4
+ attr_accessible :identifier_url
5
+ before_save :default_values
6
+
7
+
8
+ def default_values
9
+ self.status ||= BlogBasic::BlogConf.data['fallback_name']
10
+ end
11
+
4
12
  def self.create_with_omniauth(auth)
5
13
  create! do |user|
6
14
  user.provider = auth["provider"]
@@ -10,12 +18,11 @@ module BlogBasic
10
18
  end
11
19
 
12
20
  def admin?
13
- #self.email == "bottiger@gmail.com"
14
21
  !self.identifier_url.nil?
15
22
  end
16
23
 
17
24
  def name
18
- "Arvid Bottiger"
25
+ self.name
19
26
  end
20
27
 
21
28
  end
@@ -15,9 +15,9 @@
15
15
 
16
16
  <div class="blogPostBody">
17
17
  <% if defined?(show_comments) %>
18
- <%= blog_post.parsed_body %>
18
+ <%= raw(blog_post.parsed_body) %>
19
19
  <% else %>
20
- <%= blog_post.parsed_body(1000) %>
20
+ <%= raw(blog_post.parsed_body(1000)) %>
21
21
  <% end %>
22
22
  </div>
23
23
 
@@ -48,7 +48,7 @@
48
48
 
49
49
  <% if current_user && current_user.admin? %>
50
50
  <li><%= link_to('Edit Post', edit_blog_post_path(blog_post))%></li>
51
- <li><%= link_to('Delete', blog_post_path(blog_post), :method => :delete, :confirm => "Are you sure you want to destroy the post: #{blog_post.title}") %></li>
51
+ <li><%= link_to('Delete', blog_post_path(blog_post), :method => :delete, :confirm => "Are you sure you want to delete the post: #{blog_post.title}") %></li>
52
52
  <% end %>
53
53
  </ul>
54
54
  </p>
data/blog_basic.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "blog_basic"
5
- s.version = "0.1.6"
5
+ s.version = "0.1.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Arvid Boettiger"]
9
- s.date = "2012-01-27"
9
+ s.date = "2012-05-26"
10
10
  s.description = "Sets up a basic but functional blogging platform."
11
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"]
12
+ s.extra_rdoc_files = ["README.md", "lib/akismetor.rb", "lib/blog_basic.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/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/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/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/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
14
  s.homepage = "http://bottiger.org/made/blog_basic"
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Blog_basic", "--main", "README.md"]
16
16
  s.require_paths = ["lib"]
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_runtime_dependency(%q<omniauth>, ["~> 1.0.0"])
33
33
  s.add_runtime_dependency(%q<omniauth-openid>, ["~> 1.0.0"])
34
34
  s.add_runtime_dependency(%q<omniauth-github>, ["~> 1.0.0"])
35
+ s.add_runtime_dependency(%q<coderay>, [">= 0"])
35
36
  else
36
37
  s.add_dependency(%q<bluecloth>, ["~> 2.2.0"])
37
38
  s.add_dependency(%q<will_paginate>, [">= 0"])
@@ -42,6 +43,7 @@ Gem::Specification.new do |s|
42
43
  s.add_dependency(%q<omniauth>, ["~> 1.0.0"])
43
44
  s.add_dependency(%q<omniauth-openid>, ["~> 1.0.0"])
44
45
  s.add_dependency(%q<omniauth-github>, ["~> 1.0.0"])
46
+ s.add_dependency(%q<coderay>, [">= 0"])
45
47
  end
46
48
  else
47
49
  s.add_dependency(%q<bluecloth>, ["~> 2.2.0"])
@@ -53,5 +55,6 @@ Gem::Specification.new do |s|
53
55
  s.add_dependency(%q<omniauth>, ["~> 1.0.0"])
54
56
  s.add_dependency(%q<omniauth-openid>, ["~> 1.0.0"])
55
57
  s.add_dependency(%q<omniauth-github>, ["~> 1.0.0"])
58
+ s.add_dependency(%q<coderay>, [">= 0"])
56
59
  end
57
60
  end
@@ -26,6 +26,9 @@ module BlogBasic
26
26
 
27
27
  def setup_routes
28
28
  route "mount BlogBasic::Engine => \"/blog\""
29
+ route "match '/signin' => redirect('/auth/github')"
30
+ route "match '/auth/:provider/callback', to: 'blog_basic/sessions#create'"
31
+ route "match '/signout' => 'blog_basic/sessions#destroy', :as => :signout"
29
32
  end
30
33
 
31
34
  def create_assets
@@ -3,11 +3,14 @@
3
3
 
4
4
  # ================ Visual settings ================
5
5
 
6
- blog_name: 'Bottiger.org wrote'
6
+ blog_name: 'My Blog'
7
7
 
8
8
  # Show "Published By ..."
9
9
  show_user_who_published: true
10
10
 
11
+ # Used as Author name in case your auth-provider does not have one.
12
+ fallback_name: "Your Name"
13
+
11
14
  post_date_format: '%d/%m/%Y at %I:%M%p' # strftime format
12
15
 
13
16
  # Enable gravatar support next to comments and posts
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blog_basic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-27 00:00:00.000000000Z
12
+ date: 2012-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bluecloth
16
- requirement: &12487460 !ruby/object:Gem::Requirement
16
+ requirement: &18941000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *12487460
24
+ version_requirements: *18941000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: will_paginate
27
- requirement: &12486860 !ruby/object:Gem::Requirement
27
+ requirement: &18940540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *12486860
35
+ version_requirements: *18940540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: paperclip
38
- requirement: &12436440 !ruby/object:Gem::Requirement
38
+ requirement: &18939940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *12436440
46
+ version_requirements: *18939940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sass-rails
49
- requirement: &12435960 !ruby/object:Gem::Requirement
49
+ requirement: &18939480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *12435960
57
+ version_requirements: *18939480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: meta_search
60
- requirement: &12435480 !ruby/object:Gem::Requirement
60
+ requirement: &18938880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.1.1
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *12435480
68
+ version_requirements: *18938880
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: acts-as-taggable-on
71
- requirement: &12434940 !ruby/object:Gem::Requirement
71
+ requirement: &18938340 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 2.1.1
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *12434940
79
+ version_requirements: *18938340
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: omniauth
82
- requirement: &12434440 !ruby/object:Gem::Requirement
82
+ requirement: &18937800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.0.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *12434440
90
+ version_requirements: *18937800
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: omniauth-openid
93
- requirement: &12433960 !ruby/object:Gem::Requirement
93
+ requirement: &18937280 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.0.0
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *12433960
101
+ version_requirements: *18937280
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: omniauth-github
104
- requirement: &12433480 !ruby/object:Gem::Requirement
104
+ requirement: &18936760 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,7 +109,18 @@ dependencies:
109
109
  version: 1.0.0
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *12433480
112
+ version_requirements: *18936760
113
+ - !ruby/object:Gem::Dependency
114
+ name: coderay
115
+ requirement: &18936340 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: *18936340
113
124
  description: Sets up a basic but functional blogging platform.
114
125
  email: bottiger@gmail.com
115
126
  executables: []
@@ -118,8 +129,6 @@ extra_rdoc_files:
118
129
  - README.md
119
130
  - lib/akismetor.rb
120
131
  - lib/blog_basic.rb
121
- - lib/blog_basic/active_admin.rb
122
- - lib/blog_basic/blog_basic_model_helper.rb
123
132
  - lib/blog_basic/blog_conf.rb
124
133
  - lib/blog_basic/engine.rb
125
134
  - lib/blog_basic/engine.rb.backup
@@ -156,9 +165,6 @@ extra_rdoc_files:
156
165
  - lib/generators/blog_basic/install/templates/devise.en.yml
157
166
  - lib/generators/blog_basic/install/templates/devise.rb
158
167
  - lib/generators/blog_basic/install/templates/migrations/1_blog_tables.rb
159
- - lib/generators/blog_basic/install/templates/migrations/20111213104240_devise_create_admin_users.rb
160
- - lib/generators/blog_basic/install/templates/migrations/20111213114257_create_admin_notes.rb
161
- - lib/generators/blog_basic/install/templates/migrations/20111213114258_move_admin_notes_to_comments.rb
162
168
  - lib/generators/blog_basic/install/templates/omniauth.rb.erb
163
169
  - lib/tasks/blog_basic_tasks.rake
164
170
  - lib/url_validator.rb
@@ -187,7 +193,6 @@ files:
187
193
  - app/helpers/blog_basic/blog_posts_helper.rb
188
194
  - app/helpers/blog_basic/shared_helper.rb
189
195
  - app/helpers/blog_basic/tags_helper.rb
190
- - app/models/admin_user.rb
191
196
  - app/models/blog_basic/blog_comment.rb
192
197
  - app/models/blog_basic/blog_content.rb
193
198
  - app/models/blog_basic/blog_image.rb
@@ -217,8 +222,6 @@ files:
217
222
  - init.rb
218
223
  - lib/akismetor.rb
219
224
  - lib/blog_basic.rb
220
- - lib/blog_basic/active_admin.rb
221
- - lib/blog_basic/blog_basic_model_helper.rb
222
225
  - lib/blog_basic/blog_conf.rb
223
226
  - lib/blog_basic/engine.rb
224
227
  - lib/blog_basic/engine.rb.backup
@@ -255,9 +258,6 @@ files:
255
258
  - lib/generators/blog_basic/install/templates/devise.en.yml
256
259
  - lib/generators/blog_basic/install/templates/devise.rb
257
260
  - lib/generators/blog_basic/install/templates/migrations/1_blog_tables.rb
258
- - lib/generators/blog_basic/install/templates/migrations/20111213104240_devise_create_admin_users.rb
259
- - lib/generators/blog_basic/install/templates/migrations/20111213114257_create_admin_notes.rb
260
- - lib/generators/blog_basic/install/templates/migrations/20111213114258_move_admin_notes_to_comments.rb
261
261
  - lib/generators/blog_basic/install/templates/omniauth.rb.erb
262
262
  - lib/tasks/blog_basic_tasks.rake
263
263
  - lib/url_validator.rb
@@ -1,9 +0,0 @@
1
- #class AdminUser < ActiveRecord::Base
2
- # Include default devise modules. Others available are:
3
- # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4
- # devise :database_authenticatable,
5
- # :recoverable, :rememberable, :trackable, :validatable
6
-
7
- # Setup accessible (or protected) attributes for your model
8
- # attr_accessible :email, :password, :password_confirmation, :remember_me
9
- #end
@@ -1,103 +0,0 @@
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
@@ -1,85 +0,0 @@
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
@@ -1,28 +0,0 @@
1
- class DeviseCreateAdminUsers < ActiveRecord::Migration
2
- def change
3
- create_table(:admin_users) do |t|
4
- t.database_authenticatable :null => false
5
- t.recoverable
6
- t.rememberable
7
- t.trackable
8
-
9
- # t.encryptable
10
- # t.confirmable
11
- # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
12
- # t.token_authenticatable
13
-
14
-
15
- t.timestamps
16
- end
17
-
18
- # Create a default user
19
- AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')
20
-
21
- add_index :admin_users, :email, :unique => true
22
- add_index :admin_users, :reset_password_token, :unique => true
23
- # add_index :admin_users, :confirmation_token, :unique => true
24
- # add_index :admin_users, :unlock_token, :unique => true
25
- # add_index :admin_users, :authentication_token, :unique => true
26
- end
27
-
28
- end
@@ -1,16 +0,0 @@
1
- class CreateAdminNotes < ActiveRecord::Migration
2
- def self.up
3
- create_table :admin_notes do |t|
4
- t.references :resource, :polymorphic => true, :null => false
5
- t.references :admin_user, :polymorphic => true
6
- t.text :body
7
- t.timestamps
8
- end
9
- add_index :admin_notes, [:resource_type, :resource_id]
10
- add_index :admin_notes, [:admin_user_type, :admin_user_id]
11
- end
12
-
13
- def self.down
14
- drop_table :admin_notes
15
- end
16
- end
@@ -1,25 +0,0 @@
1
- class MoveAdminNotesToComments < ActiveRecord::Migration
2
- def self.up
3
- remove_index :admin_notes, [:admin_user_type, :admin_user_id]
4
- rename_table :admin_notes, :active_admin_comments
5
- rename_column :active_admin_comments, :admin_user_type, :author_type
6
- rename_column :active_admin_comments, :admin_user_id, :author_id
7
- add_column :active_admin_comments, :namespace, :string
8
- add_index :active_admin_comments, [:namespace]
9
- add_index :active_admin_comments, [:author_type, :author_id]
10
-
11
- # Update all the existing comments to the default namespace
12
- say "Updating any existing comments to the #{ActiveAdmin.application.default_namespace} namespace."
13
- execute "UPDATE active_admin_comments SET namespace='#{ActiveAdmin.application.default_namespace}'"
14
- end
15
-
16
- def self.down
17
- remove_index :active_admin_comments, :column => [:author_type, :author_id]
18
- remove_index :active_admin_comments, :column => [:namespace]
19
- remove_column :active_admin_comments, :namespace
20
- rename_column :active_admin_comments, :author_id, :admin_user_id
21
- rename_column :active_admin_comments, :author_type, :admin_user_type
22
- rename_table :active_admin_comments, :admin_notes
23
- add_index :admin_notes, [:admin_user_type, :admin_user_id]
24
- end
25
- end