cartoonist-blog 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/admin/blog.js.coffee +20 -0
- data/app/assets/stylesheets/admin/blog.css.scss +3 -0
- data/app/controllers/admin/blog_controller.rb +1 -3
- data/app/models/blog_post.rb +4 -0
- data/app/views/admin/blog/edit.html.erb +0 -30
- data/app/views/admin/blog/new.html.erb +0 -27
- data/cartoonist-blog.gemspec +2 -0
- data/lib/cartoonist-blog/engine.rb +4 -2
- data/lib/cartoonist-blog/version.rb +9 -0
- data/lib/cartoonist-blog.rb +1 -0
- metadata +30 -5
@@ -0,0 +1,20 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery.ui.datepicker
|
3
|
+
$ ->
|
4
|
+
$("input[name='posted_at_date']").datepicker dateFormat: "yy-mm-dd"
|
5
|
+
$(".preview-content").click ->
|
6
|
+
$this = $(@).attr "disabled", "disabled"
|
7
|
+
$.ajax
|
8
|
+
url: "/admin/blog/preview_content"
|
9
|
+
type: "post"
|
10
|
+
data:
|
11
|
+
authenticity_token: $("form input[name='authenticity_token']").val()
|
12
|
+
content: $("textarea[name='content']").val()
|
13
|
+
dataType: "text"
|
14
|
+
success: (text) ->
|
15
|
+
$(".preview-content").html text
|
16
|
+
$this.removeAttr "disabled"
|
17
|
+
error: ->
|
18
|
+
$(".preview-content").html '<div style="color: red;">There was an error.</div>'
|
19
|
+
$this.removeAttr "disabled"
|
20
|
+
false
|
@@ -1,8 +1,6 @@
|
|
1
|
-
class Admin::BlogController <
|
1
|
+
class Admin::BlogController < AdminCartoonistController
|
2
2
|
helper :blog
|
3
3
|
before_filter :preview!, :only => [:preview, :archives]
|
4
|
-
before_filter :ensure_ssl!
|
5
|
-
before_filter :check_admin!
|
6
4
|
|
7
5
|
def archives
|
8
6
|
@posts = BlogPost.archives true
|
data/app/models/blog_post.rb
CHANGED
@@ -114,6 +114,10 @@ class BlogPost < ActiveRecord::Base
|
|
114
114
|
end
|
115
115
|
|
116
116
|
class << self
|
117
|
+
def search(query)
|
118
|
+
reverse_chronological.where "LOWER(title) LIKE :query OR LOWER(url_title) LIKE :query OR LOWER(content) LIKE :query OR LOWER(author) LIKE :query", :query => "%#{query.downcase}%"
|
119
|
+
end
|
120
|
+
|
117
121
|
def create_post(current_user, params)
|
118
122
|
url_title = url_titlize params[:title]
|
119
123
|
create :title => params[:title], :url_title => url_title, :content => params[:content], :author => current_user.name, :locked => true
|
@@ -70,36 +70,6 @@
|
|
70
70
|
<div class="preview-content">
|
71
71
|
</div>
|
72
72
|
|
73
|
-
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" %>
|
74
|
-
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" %>
|
75
|
-
<%= stylesheet_link_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css" %>
|
76
|
-
<%= javascript_tag do %>
|
77
|
-
$(function() {
|
78
|
-
$("input[name='posted_at_date']").datepicker({ dateFormat: "yy-mm-dd" });
|
79
|
-
$(".preview-content").click(function() {
|
80
|
-
var $this = $(this).attr("disabled", "disabled");
|
81
|
-
$.ajax({
|
82
|
-
url: "/admin/blog/preview_content",
|
83
|
-
type: "post",
|
84
|
-
data: {
|
85
|
-
authenticity_token: $("form input[name='authenticity_token']").val(),
|
86
|
-
content: $("textarea[name='content']").val()
|
87
|
-
},
|
88
|
-
dataType: "text",
|
89
|
-
success: function(text) {
|
90
|
-
$(".preview-content").html(text);
|
91
|
-
$this.removeAttr("disabled");
|
92
|
-
},
|
93
|
-
error: function() {
|
94
|
-
$(".preview-content").html('<div style="color: red;">There was an error.</div>');
|
95
|
-
$this.removeAttr("disabled");
|
96
|
-
}
|
97
|
-
});
|
98
|
-
return false;
|
99
|
-
});
|
100
|
-
});
|
101
|
-
<% end %>
|
102
|
-
|
103
73
|
<% Cartoonist::Entity.hooks_with(:edit_entity_after_partial).each do |hook| %>
|
104
74
|
<hr />
|
105
75
|
<%= render :partial => hook.edit_entity_after_partial, :locals => { :entity => @post } %>
|
@@ -18,30 +18,3 @@
|
|
18
18
|
|
19
19
|
<div class="preview-content">
|
20
20
|
</div>
|
21
|
-
|
22
|
-
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" %>
|
23
|
-
<%= javascript_tag do %>
|
24
|
-
$(function() {
|
25
|
-
$(".preview-content").click(function() {
|
26
|
-
var $this = $(this).attr("disabled", "disabled");
|
27
|
-
$.ajax({
|
28
|
-
url: "/admin/blog/preview_content",
|
29
|
-
type: "post",
|
30
|
-
data: {
|
31
|
-
authenticity_token: $("form input[name='authenticity_token']").val(),
|
32
|
-
content: $("textarea[name='content']").val()
|
33
|
-
},
|
34
|
-
dataType: "text",
|
35
|
-
success: function(text) {
|
36
|
-
$(".preview-content").html(text);
|
37
|
-
$this.removeAttr("disabled");
|
38
|
-
},
|
39
|
-
error: function() {
|
40
|
-
$(".preview-content").html('<div style="color: red;">There was an error.</div>');
|
41
|
-
$this.removeAttr("disabled");
|
42
|
-
}
|
43
|
-
});
|
44
|
-
return false;
|
45
|
-
});
|
46
|
-
});
|
47
|
-
<% end %>
|
data/cartoonist-blog.gemspec
CHANGED
@@ -11,5 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.homepage = "http://reasonnumber.com/cartoonist"
|
14
|
+
s.add_dependency "jquery-rails", "~> 2.1.3"
|
15
|
+
s.add_dependency "jquery-ui-rails", "~> 2.0.2"
|
14
16
|
s.add_dependency "cartoonist", cartoonist_version
|
15
17
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module CartoonistBlog
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
Cartoonist::Asset.add "admin/blog.css"
|
4
|
+
Cartoonist::Asset.add "admin/blog.js"
|
3
5
|
Cartoonist::Entity.add :blog, "BlogPost"
|
4
6
|
Cartoonist::Admin::Tab.add :blog, :url => "/admin/blog", :order => 1
|
5
7
|
Cartoonist::RootPath.add :blog, "blog#index"
|
@@ -26,7 +28,7 @@ module CartoonistBlog
|
|
26
28
|
end
|
27
29
|
|
28
30
|
Cartoonist::Routes.add do
|
29
|
-
resources :blog do
|
31
|
+
resources :blog, :only => [:index, :show] do
|
30
32
|
collection do
|
31
33
|
get "archives"
|
32
34
|
get "feed", :defaults => { :format => "rss" }
|
@@ -34,7 +36,7 @@ module CartoonistBlog
|
|
34
36
|
end
|
35
37
|
|
36
38
|
namespace :admin do
|
37
|
-
resources :blog do
|
39
|
+
resources :blog, :only => [:create, :edit, :index, :new, :update] do
|
38
40
|
member do
|
39
41
|
post "lock"
|
40
42
|
get "preview"
|
data/lib/cartoonist-blog.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartoonist-blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,25 +9,49 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: jquery-rails
|
16
|
+
requirement: &20397060 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.1.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *20397060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jquery-ui-rails
|
27
|
+
requirement: &20778840 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.2
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *20778840
|
14
36
|
- !ruby/object:Gem::Dependency
|
15
37
|
name: cartoonist
|
16
|
-
requirement: &
|
38
|
+
requirement: &20777460 !ruby/object:Gem::Requirement
|
17
39
|
none: false
|
18
40
|
requirements:
|
19
41
|
- - =
|
20
42
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0.
|
43
|
+
version: 0.0.13
|
22
44
|
type: :runtime
|
23
45
|
prerelease: false
|
24
|
-
version_requirements: *
|
46
|
+
version_requirements: *20777460
|
25
47
|
description: This core plugin for Cartoonist adds a simple blog.
|
26
48
|
email: reasonnumber@gmail.com
|
27
49
|
executables: []
|
28
50
|
extensions: []
|
29
51
|
extra_rdoc_files: []
|
30
52
|
files:
|
53
|
+
- app/assets/javascripts/admin/blog.js.coffee
|
54
|
+
- app/assets/stylesheets/admin/blog.css.scss
|
31
55
|
- app/controllers/admin/blog_controller.rb
|
32
56
|
- app/controllers/blog_controller.rb
|
33
57
|
- app/helpers/admin/blog_helper.rb
|
@@ -48,6 +72,7 @@ files:
|
|
48
72
|
- db/migrate/20120308064117_create_blog_posts.rb
|
49
73
|
- lib/cartoonist-blog.rb
|
50
74
|
- lib/cartoonist-blog/engine.rb
|
75
|
+
- lib/cartoonist-blog/version.rb
|
51
76
|
homepage: http://reasonnumber.com/cartoonist
|
52
77
|
licenses: []
|
53
78
|
post_install_message:
|