yodel_production_environment 0.0.1
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.
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/lib/layouts/common.html +23 -0
- data/lib/layouts/common/site.html +79 -0
- data/lib/layouts/common/sites.html +13 -0
- data/lib/layouts/common/user.html +10 -0
- data/lib/layouts/common/users.html +30 -0
- data/lib/layouts/home.html +49 -0
- data/lib/layouts/production_login_page.html +131 -0
- data/lib/migrations/site/01_users_model.rb +23 -0
- data/lib/migrations/site/02_page_structure.rb +58 -0
- data/lib/migrations/site/03_security_and_home_page.rb +103 -0
- data/lib/migrations/yodel/01_record_model.rb +29 -0
- data/lib/migrations/yodel/02_page_model.rb +45 -0
- data/lib/migrations/yodel/03_layout_model.rb +38 -0
- data/lib/migrations/yodel/04_group_model.rb +61 -0
- data/lib/migrations/yodel/05_user_model.rb +23 -0
- data/lib/migrations/yodel/06_snippet_model.rb +13 -0
- data/lib/migrations/yodel/07_search_page_model.rb +32 -0
- data/lib/migrations/yodel/08_default_site_options.rb +21 -0
- data/lib/migrations/yodel/09_security_page_models.rb +36 -0
- data/lib/migrations/yodel/10_record_proxy_page_model.rb +17 -0
- data/lib/migrations/yodel/11_email_model.rb +28 -0
- data/lib/migrations/yodel/12_api_call_model.rb +23 -0
- data/lib/migrations/yodel/13_redirect_page_model.rb +13 -0
- data/lib/migrations/yodel/14_menu_model.rb +20 -0
- data/lib/models/git_http.rb +326 -0
- data/lib/models/git_page.rb +38 -0
- data/lib/models/production_login_page.rb +13 -0
- data/lib/models/production_sites_page.rb +127 -0
- data/lib/models/production_user.rb +17 -0
- data/lib/public/css/screen.css +64 -0
- data/lib/yodel_production_environment.rb +3 -0
- data/yodel_production_environment.gemspec +22 -0
- metadata +80 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" href="/core/css/reset.css" type="text/css">
|
5
|
+
<link rel="stylesheet" href="/core/css/core.css" type="text/css">
|
6
|
+
<link rel="stylesheet" href="/css/screen.css" type="text/css">
|
7
|
+
<script src="/core/js/jquery.min.js"></script>
|
8
|
+
<script src="/core/js/json2.js"></script>
|
9
|
+
<script src="/core/js/yodel_jquery.js"></script>
|
10
|
+
<script src="/js/app.js"></script>
|
11
|
+
<title>Yodel</title>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<article>
|
15
|
+
<header>
|
16
|
+
<div id="lip"></div>
|
17
|
+
<h1>yodel</h1>
|
18
|
+
<%= menu :nav %>
|
19
|
+
</header>
|
20
|
+
<%= content %>
|
21
|
+
</article>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<h1>Site: <%= record.name %></h1>
|
2
|
+
<dl>
|
3
|
+
<dt>Created:</dt>
|
4
|
+
<dd><%= record.created_at %></dd>
|
5
|
+
<dt>Latest Revision:</dt>
|
6
|
+
<dd><%= record.latest_revision_date %> (#<%= record.latest_revision %>)</dd>
|
7
|
+
</dl>
|
8
|
+
|
9
|
+
<h2>Domains</h2>
|
10
|
+
<ul>
|
11
|
+
<% record.domains.each do |domain| %>
|
12
|
+
<li><a href="http://<%= domain %>/"><%= domain %></a></li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<h2>Users</h2>
|
17
|
+
<ul>
|
18
|
+
<% site.users.where(sites: record.id).all.each do |user| %>
|
19
|
+
<li>
|
20
|
+
<%= user.name %> (<%= user.email %>)
|
21
|
+
<a href="#" class="action remove_user" data-user-id="<%= user.id %>">Remove</a>
|
22
|
+
</li>
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
|
26
|
+
<% non_site_users = site.users.all.reject {|user| user.sites.include?(record)} %>
|
27
|
+
|
28
|
+
<% unless non_site_users.empty? %>
|
29
|
+
<a href="#" class="action" id="add_user">Add</a>
|
30
|
+
<div id="new_user" style="display: none">
|
31
|
+
<select id="new_user_id">
|
32
|
+
<% non_site_users.each do |user| %>
|
33
|
+
<option value="<%= user.id %>"><%= user.name %> (<%= user.email %>)</option>
|
34
|
+
<% end %>
|
35
|
+
</select>
|
36
|
+
<input type="submit" value='Add' id="add_user_btn">
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
|
41
|
+
<script>
|
42
|
+
$('#add_user').click(function(event) {
|
43
|
+
$('#new_user').slideToggle();
|
44
|
+
event.preventDefault();
|
45
|
+
});
|
46
|
+
|
47
|
+
$('#add_user_btn').click(function(event) {
|
48
|
+
var request = jQuery.post('/sites.json', {'_method': 'PUT', id: '<%= record.id %>', user_id: $('#new_user_id').val(), action: 'add'}, 'json');
|
49
|
+
event.preventDefault();
|
50
|
+
|
51
|
+
request.success(function(data, textStatus, jqXHR) {
|
52
|
+
if(data.success)
|
53
|
+
window.location.reload();
|
54
|
+
else
|
55
|
+
alert(data.reason);
|
56
|
+
});
|
57
|
+
request.error(function(jqXHR, textStatus, errorThrown) {
|
58
|
+
alert('A connection error occurred while adding this user');
|
59
|
+
});
|
60
|
+
});
|
61
|
+
|
62
|
+
$('.remove_user').click(function(event) {
|
63
|
+
event.preventDefault();
|
64
|
+
|
65
|
+
if(!confirm('Are you sure you want to delete this user?'))
|
66
|
+
return;
|
67
|
+
|
68
|
+
var request = jQuery.post('/sites.json', {'_method': 'PUT', id: '<%= record.id %>', user_id: $(this).attr('data-user-id'), action: 'remove'}, 'json');
|
69
|
+
request.success(function(data, textStatus, jqXHR) {
|
70
|
+
if(data.success)
|
71
|
+
window.location.reload();
|
72
|
+
else
|
73
|
+
alert(data.reason);
|
74
|
+
});
|
75
|
+
request.error(function(jqXHR, textStatus, errorThrown) {
|
76
|
+
alert('A connection error occurred while removing this user');
|
77
|
+
});
|
78
|
+
});
|
79
|
+
</script>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<h1>Sites</h1>
|
2
|
+
<ul>
|
3
|
+
<% if records.count > 0 %>
|
4
|
+
<% records.each do |site| %>
|
5
|
+
<li>
|
6
|
+
<a href="<%= site.path %>"><%= site.name %></a>
|
7
|
+
<%= site.delete_link 'Delete', confirm: 'Are you sure you want to delete this site?', class: 'action' %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
<% else %>
|
11
|
+
<li>No Sites</li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<h1>User: <%= page.name %></h1>
|
2
|
+
<% form_for_page remote: true do |form| %>
|
3
|
+
<%= form.field_row :name %>
|
4
|
+
<%= form.field_row :username %>
|
5
|
+
<%= form.field_row :password %>
|
6
|
+
<input type="submit" value="Save">
|
7
|
+
<% form.success do %>
|
8
|
+
window.location = '/users';
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<h1>Users</h1>
|
2
|
+
<ul>
|
3
|
+
<% if site.users.count > 0 %>
|
4
|
+
<% site.users.all.each do |user| %>
|
5
|
+
<li>
|
6
|
+
<a href="<%= user.path %>"><%= user.name %> (<%= user.email %>)</a>
|
7
|
+
<%= user.delete_link 'Delete', confirm: 'Are you sure you want to delete this user?', class: 'action' %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
<% else %>
|
11
|
+
<li>No Users</li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
<a class="action" href="#" id="add_user">Add User</a>
|
15
|
+
|
16
|
+
<div id="new_user" style="display: none">
|
17
|
+
<% form_for site.users.new, path, remote: true do |form| %>
|
18
|
+
<%= form.field_row :name %>
|
19
|
+
<%= form.field_row :username %>
|
20
|
+
<%= form.field_row :password %>
|
21
|
+
<input type="submit" value='Add'>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<script>
|
26
|
+
$('#add_user').click(function(event) {
|
27
|
+
$('#new_user').slideToggle();
|
28
|
+
event.preventDefault();
|
29
|
+
})
|
30
|
+
</script>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" href="/core/css/reset.css" type="text/css">
|
5
|
+
<link rel="stylesheet" href="/core/css/core.css" type="text/css">
|
6
|
+
<link rel="stylesheet" href="/css/screen.css" type="text/css">
|
7
|
+
<title>Yodel</title>
|
8
|
+
<style>
|
9
|
+
li, ul {
|
10
|
+
border: none !important;
|
11
|
+
color: #444;
|
12
|
+
}
|
13
|
+
|
14
|
+
ul {
|
15
|
+
padding-top: 20px;
|
16
|
+
}
|
17
|
+
|
18
|
+
a {
|
19
|
+
color: #777;
|
20
|
+
}
|
21
|
+
|
22
|
+
p {
|
23
|
+
font-size: 15px;
|
24
|
+
color: #444;
|
25
|
+
line-height: 18px;
|
26
|
+
}
|
27
|
+
|
28
|
+
article {
|
29
|
+
padding-bottom: 20px;
|
30
|
+
}
|
31
|
+
</style>
|
32
|
+
</head>
|
33
|
+
<body>
|
34
|
+
<article>
|
35
|
+
<header>
|
36
|
+
<div id="lip"></div>
|
37
|
+
<h1>yodel</h1>
|
38
|
+
</header>
|
39
|
+
<p>Yodel is a Ruby CMS and web development environment. You may be looking for one of the sites hosted on this server:</p>
|
40
|
+
<ul>
|
41
|
+
<% Site.all.each do |site| %>
|
42
|
+
<% unless site.name == 'yodel' %>
|
43
|
+
<li><%= site.name %> - <a href="<%= site.domains.first %>"><%= site.domains.first %></a></li>
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
46
|
+
</ul>
|
47
|
+
</article>
|
48
|
+
</body>
|
49
|
+
</html>
|
@@ -0,0 +1,131 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Yodel - Login</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body {
|
7
|
+
background-color: #F3F3F3;
|
8
|
+
font-family: HelveticaNeue, Helvetica, sans-serif;
|
9
|
+
}
|
10
|
+
|
11
|
+
#modal {
|
12
|
+
width: 620px;
|
13
|
+
background-color: white;
|
14
|
+
border-bottom: 1px solid #e0e0e0;
|
15
|
+
border-radius: 5px;
|
16
|
+
-moz-border-radius: 5px;
|
17
|
+
position: relative;
|
18
|
+
margin: 200px auto 0px auto;
|
19
|
+
padding: 81px 33px 35px 33px;
|
20
|
+
}
|
21
|
+
|
22
|
+
h2 {
|
23
|
+
color: #333;
|
24
|
+
font-size: 25px;
|
25
|
+
font-weight: normal;
|
26
|
+
padding: 0px;
|
27
|
+
margin: 0px 0px 14px 0px;
|
28
|
+
}
|
29
|
+
|
30
|
+
p {
|
31
|
+
color: #777;
|
32
|
+
font-size: 16px;
|
33
|
+
margin: 0px;
|
34
|
+
padding: 0px;
|
35
|
+
}
|
36
|
+
|
37
|
+
a {
|
38
|
+
color: #777;
|
39
|
+
}
|
40
|
+
|
41
|
+
#lip {
|
42
|
+
position: absolute;
|
43
|
+
top: 60px;
|
44
|
+
left: -16px;
|
45
|
+
width: 0px;
|
46
|
+
height: 0px;
|
47
|
+
border: 8px solid transparent;
|
48
|
+
border-top-color: #E5A700;
|
49
|
+
border-right-color: #E5A700;
|
50
|
+
padding: 0px;
|
51
|
+
margin: 0px;
|
52
|
+
}
|
53
|
+
|
54
|
+
h1 {
|
55
|
+
position: absolute;
|
56
|
+
background-color: #FFC900;
|
57
|
+
height: 53px;
|
58
|
+
width: 170px;
|
59
|
+
left: -16px;
|
60
|
+
top: 8px;
|
61
|
+
padding: 0px;
|
62
|
+
margin: 0px;
|
63
|
+
color: transparent;
|
64
|
+
background-repeat: no-repeat;
|
65
|
+
background-position: center 10px;
|
66
|
+
background-image: url(/admin/images/yodel.png);
|
67
|
+
}
|
68
|
+
|
69
|
+
p.error {
|
70
|
+
background-color: #D6362E;
|
71
|
+
-moz-border-radius: 4px;
|
72
|
+
border-radius: 4px;
|
73
|
+
color: white;
|
74
|
+
padding: 7px 15px;
|
75
|
+
margin-bottom: 18px;
|
76
|
+
line-height: 18px;
|
77
|
+
font-size: 13px;
|
78
|
+
}
|
79
|
+
|
80
|
+
label {
|
81
|
+
display: inline-block;
|
82
|
+
margin-bottom: 10px;
|
83
|
+
width: 80px;
|
84
|
+
font-size: 13px;
|
85
|
+
vertical-align: middle;
|
86
|
+
}
|
87
|
+
|
88
|
+
input[type=text], input[type=password] {
|
89
|
+
display: inline-block;
|
90
|
+
margin-bottom: 10px;
|
91
|
+
-webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.08) inset;
|
92
|
+
-moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.08) inset;
|
93
|
+
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.08) inset;
|
94
|
+
border-radius: 3px;
|
95
|
+
-moz-border-radius: 3px;
|
96
|
+
border: 1px solid #bbb;
|
97
|
+
height: 20px;
|
98
|
+
width: 300px;
|
99
|
+
outline: none;
|
100
|
+
font-size: 11px;
|
101
|
+
vertical-align: middle;
|
102
|
+
padding: 3px 5px;
|
103
|
+
}
|
104
|
+
</style>
|
105
|
+
</head>
|
106
|
+
<body>
|
107
|
+
<div id="modal">
|
108
|
+
<div id="lip"></div>
|
109
|
+
<h1>yodel</h1>
|
110
|
+
<h2>Login</h2>
|
111
|
+
<% if flash[:permission_denied] %>
|
112
|
+
<p class="error">Please login to continue</p>
|
113
|
+
<% end %>
|
114
|
+
<% if flash[:login_failed] %>
|
115
|
+
<p class="error">Sorry, your username or password were incorrect</p>
|
116
|
+
<% end %>
|
117
|
+
|
118
|
+
<form action="<%= page.path %>" method="post">
|
119
|
+
<p>
|
120
|
+
<label for="name">Username</label>
|
121
|
+
<input type="text" id="username" name="username" value="<%= params['username'] %>">
|
122
|
+
</p>
|
123
|
+
<p>
|
124
|
+
<label for="password">Password</label>
|
125
|
+
<input type="password" name="password" id="password" <% if flash[:login_failed] %>class="error"<% end %>>
|
126
|
+
</p>
|
127
|
+
<input type="submit" value="Login">
|
128
|
+
</form>
|
129
|
+
</div>
|
130
|
+
</body>
|
131
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class UsersMigration < Migration
|
2
|
+
def self.up(site)
|
3
|
+
site.users.modify do |users|
|
4
|
+
remove_field :email
|
5
|
+
add_field :email, :alias, of: :username
|
6
|
+
|
7
|
+
remove_field :first_name
|
8
|
+
remove_field :last_name
|
9
|
+
remove_field :name
|
10
|
+
add_field :name, :string
|
11
|
+
|
12
|
+
add_field :title, :alias, of: :name
|
13
|
+
users.add_mixin site.pages
|
14
|
+
|
15
|
+
add_many :sites
|
16
|
+
|
17
|
+
users.record_class_name = 'ProductionUser'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down(site)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class PageStructureMigration < Migration
|
2
|
+
def self.up(site)
|
3
|
+
# remove the default home page
|
4
|
+
home = site.pages.where(path: '/').first
|
5
|
+
home.destroy
|
6
|
+
|
7
|
+
# home redirects to users
|
8
|
+
home = site.redirect_pages.new
|
9
|
+
home.title = 'Home'
|
10
|
+
home.url = '/users'
|
11
|
+
home.save
|
12
|
+
|
13
|
+
# sites
|
14
|
+
# work around eigenmodel/record_class_name bug
|
15
|
+
site.record_proxy_pages.create_model :sites_page do |sites_pages|
|
16
|
+
sites_pages.record_class_name = 'ProductionSitesPage'
|
17
|
+
end
|
18
|
+
sites = site.sites_pages.new
|
19
|
+
sites.title = 'Sites'
|
20
|
+
sites.parent = home
|
21
|
+
sites.page_layout = 'sites'
|
22
|
+
sites.show_record_layout = 'site'
|
23
|
+
sites.save
|
24
|
+
|
25
|
+
# users
|
26
|
+
users = site.pages.new
|
27
|
+
users.title = 'Users'
|
28
|
+
users.parent = home
|
29
|
+
users.page_layout = 'users'
|
30
|
+
users.save
|
31
|
+
users.create_eigenmodel
|
32
|
+
users.model.default_child_model = site.users
|
33
|
+
users.model.save
|
34
|
+
|
35
|
+
# git
|
36
|
+
site.glob_pages.create_model :git_page do |git_pages|
|
37
|
+
git_pages.record_class_name = 'GitPage'
|
38
|
+
end
|
39
|
+
git = site.git_pages.new
|
40
|
+
git.title = "git"
|
41
|
+
git.parent = home
|
42
|
+
git.save
|
43
|
+
|
44
|
+
# menu
|
45
|
+
nav = site.menus.new
|
46
|
+
nav.name = 'nav'
|
47
|
+
nav.root = home
|
48
|
+
ge = nav.exceptions.new
|
49
|
+
ge.page = git
|
50
|
+
ge.show = false
|
51
|
+
ge.save
|
52
|
+
nav.save
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.down(site)
|
56
|
+
site.pages.all.each(&:destroy)
|
57
|
+
end
|
58
|
+
end
|