cartoonist-pages 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/page.js.coffee +18 -0
- data/app/controllers/admin/page_controller.rb +1 -3
- data/app/models/page.rb +4 -0
- data/app/views/admin/page/edit.html.erb +0 -29
- data/app/views/admin/page/new.html.erb +0 -27
- data/cartoonist-pages.gemspec +1 -0
- data/lib/cartoonist-pages/engine.rb +2 -1
- data/lib/cartoonist-pages/version.rb +9 -0
- data/lib/cartoonist-pages.rb +1 -0
- metadata +18 -5
@@ -0,0 +1,18 @@
|
|
1
|
+
//= require jquery
|
2
|
+
$ ->
|
3
|
+
$(".preview-content").click ->
|
4
|
+
$this = $(@).attr "disabled", "disabled"
|
5
|
+
$.ajax
|
6
|
+
url: "/admin/page/preview_content"
|
7
|
+
type: "post"
|
8
|
+
data:
|
9
|
+
authenticity_token: $("form input[name='authenticity_token']").val()
|
10
|
+
content: $("textarea[name='content']").val()
|
11
|
+
dataType: "text"
|
12
|
+
success: (text) ->
|
13
|
+
$(".preview-content").html text
|
14
|
+
$this.removeAttr "disabled"
|
15
|
+
error: ->
|
16
|
+
$(".preview-content").html '<div style="color: red;">There was an error.</div>'
|
17
|
+
$this.removeAttr "disabled"
|
18
|
+
false
|
@@ -1,7 +1,5 @@
|
|
1
|
-
class Admin::PageController <
|
1
|
+
class Admin::PageController < AdminCartoonistController
|
2
2
|
before_filter :preview!, :only => [:preview]
|
3
|
-
before_filter :ensure_ssl!
|
4
|
-
before_filter :check_admin!
|
5
3
|
|
6
4
|
def preview
|
7
5
|
@page = Page.preview_from_path params[:id]
|
data/app/models/page.rb
CHANGED
@@ -35,6 +35,10 @@ class Page < ActiveRecord::Base
|
|
35
35
|
end
|
36
36
|
|
37
37
|
class << self
|
38
|
+
def search(query)
|
39
|
+
ordered.where "LOWER(title) LIKE :query OR LOWER(path) LIKE :query OR LOWER(content) LIKE :query", :query => "%#{query.downcase}%"
|
40
|
+
end
|
41
|
+
|
38
42
|
def sitemap
|
39
43
|
posted.in_sitemap
|
40
44
|
end
|
@@ -62,35 +62,6 @@
|
|
62
62
|
<div class="preview-content">
|
63
63
|
</div>
|
64
64
|
|
65
|
-
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" %>
|
66
|
-
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" %>
|
67
|
-
<%= stylesheet_link_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css" %>
|
68
|
-
<%= javascript_tag do %>
|
69
|
-
$(function() {
|
70
|
-
$(".preview-content").click(function() {
|
71
|
-
var $this = $(this).attr("disabled", "disabled");
|
72
|
-
$.ajax({
|
73
|
-
url: "/admin/page/preview_content",
|
74
|
-
type: "post",
|
75
|
-
data: {
|
76
|
-
authenticity_token: $("form input[name='authenticity_token']").val(),
|
77
|
-
content: $("textarea[name='content']").val()
|
78
|
-
},
|
79
|
-
dataType: "text",
|
80
|
-
success: function(text) {
|
81
|
-
$(".preview-content").html(text);
|
82
|
-
$this.removeAttr("disabled");
|
83
|
-
},
|
84
|
-
error: function() {
|
85
|
-
$(".preview-content").html('<div style="color: red;">There was an error.</div>');
|
86
|
-
$this.removeAttr("disabled");
|
87
|
-
}
|
88
|
-
});
|
89
|
-
return false;
|
90
|
-
});
|
91
|
-
});
|
92
|
-
<% end %>
|
93
|
-
|
94
65
|
<% Cartoonist::Entity.hooks_with(:edit_entity_after_partial).each do |hook| %>
|
95
66
|
<hr />
|
96
67
|
<%= render :partial => hook.edit_entity_after_partial, :locals => { :entity => @page } %>
|
@@ -22,30 +22,3 @@
|
|
22
22
|
|
23
23
|
<div class="preview-content">
|
24
24
|
</div>
|
25
|
-
|
26
|
-
<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" %>
|
27
|
-
<%= javascript_tag do %>
|
28
|
-
$(function() {
|
29
|
-
$(".preview-content").click(function() {
|
30
|
-
var $this = $(this).attr("disabled", "disabled");
|
31
|
-
$.ajax({
|
32
|
-
url: "/admin/page/preview_content",
|
33
|
-
type: "post",
|
34
|
-
data: {
|
35
|
-
authenticity_token: $("form input[name='authenticity_token']").val(),
|
36
|
-
content: $("textarea[name='content']").val()
|
37
|
-
},
|
38
|
-
dataType: "text",
|
39
|
-
success: function(text) {
|
40
|
-
$(".preview-content").html(text);
|
41
|
-
$this.removeAttr("disabled");
|
42
|
-
},
|
43
|
-
error: function() {
|
44
|
-
$(".preview-content").html('<div style="color: red;">There was an error.</div>');
|
45
|
-
$this.removeAttr("disabled");
|
46
|
-
}
|
47
|
-
});
|
48
|
-
return false;
|
49
|
-
});
|
50
|
-
});
|
51
|
-
<% end %>
|
data/cartoonist-pages.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module CartoonistPages
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
Cartoonist::Asset.add "admin/page.js"
|
3
4
|
Cartoonist::Entity.add :page, "Page"
|
4
5
|
Cartoonist::Admin::Tab.add :pages, :url => "/admin/page", :order => 2
|
5
6
|
Cartoonist::Migration.add_for self
|
@@ -20,7 +21,7 @@ module CartoonistPages
|
|
20
21
|
|
21
22
|
Cartoonist::Routes.add do
|
22
23
|
namespace :admin do
|
23
|
-
resources :page do
|
24
|
+
resources :page, :only => [:create, :edit, :index, :new, :update] do
|
24
25
|
member do
|
25
26
|
post "lock"
|
26
27
|
post "post"
|
data/lib/cartoonist-pages.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartoonist-pages
|
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,37 @@ 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: &9462600 !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: *9462600
|
14
25
|
- !ruby/object:Gem::Dependency
|
15
26
|
name: cartoonist
|
16
|
-
requirement: &
|
27
|
+
requirement: &9460900 !ruby/object:Gem::Requirement
|
17
28
|
none: false
|
18
29
|
requirements:
|
19
30
|
- - =
|
20
31
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0.
|
32
|
+
version: 0.0.13
|
22
33
|
type: :runtime
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *9460900
|
25
36
|
description: This core plugin for Cartoonist adds arbitrary pages.
|
26
37
|
email: reasonnumber@gmail.com
|
27
38
|
executables: []
|
28
39
|
extensions: []
|
29
40
|
extra_rdoc_files: []
|
30
41
|
files:
|
42
|
+
- app/assets/javascripts/admin/page.js.coffee
|
31
43
|
- app/controllers/admin/page_controller.rb
|
32
44
|
- app/controllers/page_controller.rb
|
33
45
|
- app/helpers/admin/page_helper.rb
|
@@ -43,6 +55,7 @@ files:
|
|
43
55
|
- db/migrate/20120316072549_create_pages.rb
|
44
56
|
- lib/cartoonist-pages.rb
|
45
57
|
- lib/cartoonist-pages/engine.rb
|
58
|
+
- lib/cartoonist-pages/version.rb
|
46
59
|
homepage: http://reasonnumber.com/cartoonist
|
47
60
|
licenses: []
|
48
61
|
post_install_message:
|