caboose-cms 0.2.8 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE
CHANGED
@@ -94,9 +94,9 @@ module Caboose
|
|
94
94
|
# GET /pages/new
|
95
95
|
def new
|
96
96
|
return if !user_is_allowed('pages', 'add')
|
97
|
-
@
|
98
|
-
@
|
99
|
-
render :layout => 'caboose/
|
97
|
+
@parent_id = params[:parent_id].nil? ? params[:parent_id] : 1
|
98
|
+
@parent = Page.find(@parent_id)
|
99
|
+
render :layout => 'caboose/modal'
|
100
100
|
end
|
101
101
|
|
102
102
|
# GET /pages/1/redirect
|
@@ -21,7 +21,7 @@ class Caboose::PagePlugin < Caboose::CaboosePlugin
|
|
21
21
|
#item['children'] << { 'id' => 'use_redirect_urls', 'href' => '#', 'text' => '' + (uru ? 'Disable' : 'Enable') + ' Redirect Urls' }
|
22
22
|
end
|
23
23
|
if (user.is_allowed('pages', 'add') || is_admin)
|
24
|
-
item['children'] << { 'href' => "/pages/new?parent_id=#{page.id}" , 'text' => 'New Page' }
|
24
|
+
item['children'] << { 'href' => "/pages/new?parent_id=#{page.id}" , 'text' => 'New Page', 'modal' => true }
|
25
25
|
end
|
26
26
|
nav << item
|
27
27
|
return nav
|
@@ -1,23 +1,37 @@
|
|
1
1
|
|
2
2
|
<h1>New Page</h1>
|
3
|
-
<
|
3
|
+
<p>Parent: <%= @parent ? @parent.title : "Home" %></p>
|
4
|
+
<input type='hidden' id='parent_id' name='parent_id' value='<%= @parent_id %>' />
|
5
|
+
<p><input type='text' id='title' name='title' placeholder='Title' style="width: 400px;" /></p>
|
6
|
+
<p><input type='submit' value='Add Page' onclick='add_page();' /></p>
|
4
7
|
|
5
8
|
<% content_for :caboose_js do %>
|
9
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
6
10
|
<script type='text/javascript'>
|
7
11
|
|
8
|
-
var
|
12
|
+
var modal = false;
|
9
13
|
$(document).ready(function() {
|
14
|
+
modal = new CabooseModal(420);
|
15
|
+
});
|
10
16
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
function add_page()
|
18
|
+
{
|
19
|
+
modal.autosize("<p class='loading'>Adding page...</p>");
|
20
|
+
$.ajax({
|
21
|
+
url: '/pages',
|
22
|
+
type: 'post',
|
23
|
+
data: {
|
24
|
+
parent_id: $('#parent_id').val(),
|
25
|
+
title: $('#title').val()
|
26
|
+
},
|
27
|
+
success: function(resp) {
|
28
|
+
if (resp.error)
|
29
|
+
modal.autosize("<p class='note error'>" + resp.error + "</p>");
|
30
|
+
if (resp.redirect)
|
31
|
+
parent.window.location = resp.redirect
|
32
|
+
}
|
18
33
|
});
|
19
|
-
|
20
|
-
});
|
34
|
+
}
|
21
35
|
|
22
36
|
</script>
|
23
37
|
<% end %>
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|