caboose-cms 0.9.211 → 0.9.212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebf95156a9451146070c1fd0c9270f8a9a678fbe489177eff05eea787500aa96
|
4
|
+
data.tar.gz: '081ee5186a8f791d6f11d8a11791d7810ecfad5f907d633fac541422e9023ee5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c64905c5afe01079ef6ff6711cf556f57a681622b56efd5b23d2da9958eb4be3e7e2fca6579b20b963f2deacbc758b226f856f7cc1710b5209cc05f4046458
|
7
|
+
data.tar.gz: 3f70ab15d866127fa9caa2a738c6c9b62924c7edb33c95215c4b468761ac2857e5806f0078df546a6aa4adc6013c6001d3fba8a244a0acdfad2a90f4572d5197
|
@@ -99,12 +99,13 @@ module Caboose
|
|
99
99
|
render :json => false
|
100
100
|
return
|
101
101
|
end
|
102
|
-
|
103
|
-
top_cat = PostCategory.
|
104
|
-
top_cat = PostCategory.create(:site_id => @site.id, :name => 'General News')
|
102
|
+
top_cat = PostCategory.where(:site_id => @site.id, :name => 'General News').first
|
103
|
+
top_cat = PostCategory.create(:site_id => @site.id, :name => 'General News') if top_cat.nil?
|
105
104
|
arr = PostCategory.where(:site_id => @site.id).reorder(:name).all
|
106
|
-
|
107
|
-
|
105
|
+
options = [ {'value'=>'','text'=>'All'} ]
|
106
|
+
arr.collect{ |pc| { 'value' => pc.id, 'text' => pc.name }}.each do |c|
|
107
|
+
options << c
|
108
|
+
end
|
108
109
|
render :json => options
|
109
110
|
end
|
110
111
|
|
@@ -200,6 +200,19 @@ module Caboose
|
|
200
200
|
resp.attributes = { 'image' => { 'value' => post.image.url(:thumb) }}
|
201
201
|
render :text => resp.to_json
|
202
202
|
end
|
203
|
+
|
204
|
+
# @route POST /admin/posts/:id/remove-image
|
205
|
+
def admin_remove_image
|
206
|
+
return unless user_is_allowed("posts", 'edit')
|
207
|
+
resp = Caboose::StdClass.new
|
208
|
+
b = Post.find(params[:id])
|
209
|
+
b.image_file_name = nil
|
210
|
+
b.image_file_size = nil
|
211
|
+
b.image_content_type = nil
|
212
|
+
b.image_updated_at = nil
|
213
|
+
resp.success = b.save
|
214
|
+
render :json => resp
|
215
|
+
end
|
203
216
|
|
204
217
|
# @route_priority 1
|
205
218
|
# @route GET /admin/posts/new
|
@@ -224,7 +237,9 @@ module Caboose
|
|
224
237
|
resp.error = 'A title is required.'
|
225
238
|
else
|
226
239
|
post.save
|
227
|
-
post.set_slug_and_uri(post.title)
|
240
|
+
post.set_slug_and_uri(post.title)
|
241
|
+
bt = BlockType.where(:id => @site.default_layout_id).first
|
242
|
+
Block.create(:post_id => post.id, :block_type_id => bt.id, :name => bt.name) if post && bt
|
228
243
|
resp.redirect = "/admin/posts/#{post.id}"
|
229
244
|
end
|
230
245
|
render :json => resp
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
<%= render :partial => 'caboose/posts/admin_header' %>
|
3
3
|
|
4
|
-
<p>
|
4
|
+
<p>Post URL: <span id='uri'><a target="_blank" href="<%= raw @post.uri %>"><%= raw @post.uri %></a></span></p>
|
5
5
|
<p><div id='post_<%= @post.id %>_slug' ></div></p>
|
6
6
|
<p><div id='post_<%= @post.id %>_title' ></div></p>
|
7
7
|
<p><div id='post_<%= @post.id %>_subtitle' ></div></p>
|
@@ -13,14 +13,38 @@
|
|
13
13
|
<% end %>
|
14
14
|
<p><div id='post_<%= @post.id %>_created_at'></div></p>
|
15
15
|
<p><div id='post_<%= @post.id %>_published' ></div></p>
|
16
|
-
<p><div id='post_<%= @post.id %>_image' ></div
|
16
|
+
<p><div id='post_<%= @post.id %>_image' ></div>
|
17
|
+
<a href="#" onclick="remove_image();return false;" class="caboose-btn remove">Remove Image</a>
|
18
|
+
</p>
|
19
|
+
|
17
20
|
|
18
21
|
<%= render :partial => 'caboose/posts/admin_footer' %>
|
19
22
|
|
23
|
+
<% content_for :caboose_css do %>
|
24
|
+
<style>
|
25
|
+
.caboose-btn.remove {
|
26
|
+
margin-top: 10px;
|
27
|
+
font-size: 13px;
|
28
|
+
padding: 1px 10px;
|
29
|
+
line-height: 25px;
|
30
|
+
}
|
31
|
+
</style>
|
32
|
+
<% end %>
|
33
|
+
|
20
34
|
<% content_for :caboose_js do %>
|
21
35
|
<%= javascript_include_tag "caboose/model/all" %>
|
22
36
|
<script type='text/javascript'>
|
23
37
|
|
38
|
+
function remove_image() {
|
39
|
+
$.ajax({
|
40
|
+
url: '/admin/posts/<%= @post.id %>/remove-image',
|
41
|
+
type: 'POST',
|
42
|
+
success: function(post) {
|
43
|
+
$(".img-holder img").attr('src','https://placehold.it/300x300');
|
44
|
+
}
|
45
|
+
});
|
46
|
+
}
|
47
|
+
|
24
48
|
$(document).ready(function() {
|
25
49
|
m = new ModelBinder({
|
26
50
|
name: 'Post',
|
@@ -66,7 +90,7 @@ function refresh_uri()
|
|
66
90
|
url: '/admin/posts/<%= @post.id %>/json',
|
67
91
|
type: 'get',
|
68
92
|
success: function(post) {
|
69
|
-
$('#uri').empty().append($('<a/>').attr('href', post.uri).html(post.uri));
|
93
|
+
$('#uri').empty().append($('<a/>').attr('target','_blank').attr('href', post.uri).html(post.uri));
|
70
94
|
}
|
71
95
|
});
|
72
96
|
}
|
data/lib/caboose/version.rb
CHANGED