vapid 0.1.1 → 0.1.2
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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/vapid/assets/images/vapid/favicon.ico +0 -0
- data/lib/vapid/assets/images/vapid/logo.png +0 -0
- data/lib/vapid/assets/images/vapid/logo_inverse.png +0 -0
- data/lib/vapid/assets/javascripts/vapid/{admin.coffee → dashboard.coffee} +0 -0
- data/lib/vapid/assets/stylesheets/vapid/dashboard.scss +25 -0
- data/lib/vapid/assets/stylesheets/vapid/dashboard/_base.scss +36 -0
- data/lib/vapid/assets/stylesheets/vapid/dashboard/_fonts.scss +14 -0
- data/lib/vapid/assets/stylesheets/vapid/dashboard/_modal.scss +53 -0
- data/lib/vapid/assets/stylesheets/vapid/dashboard/_sidebar.scss +22 -0
- data/lib/vapid/assets/stylesheets/vapid/dashboard/_variables.scss +6 -0
- data/lib/vapid/cli.rb +45 -13
- data/lib/vapid/controllers/{admin_controller.rb → dashboard_controller.rb} +60 -64
- data/lib/vapid/generator_template/Gemfile.tt +1 -7
- data/lib/vapid/generator_template/assets/javascripts/site.js +0 -0
- data/lib/vapid/generator_template/assets/stylesheets/site.css +0 -0
- data/lib/vapid/generator_template/templates/index.html.erb +84 -24
- data/lib/vapid/generator_template/templates/layouts/default.html.erb +3 -14
- data/lib/vapid/models/record.rb +22 -0
- data/lib/vapid/models/user.rb +7 -2
- data/lib/vapid/server.rb +5 -5
- data/lib/vapid/version.rb +1 -1
- data/lib/vapid/views/{admin → dashboard}/install.html.erb +3 -3
- data/lib/vapid/views/{admin → dashboard}/login.html.erb +2 -2
- data/lib/vapid/views/dashboard/overview/index.html.erb +3 -0
- data/lib/vapid/views/dashboard/records/_form_fields.erb +5 -0
- data/lib/vapid/views/dashboard/records/edit.html.erb +10 -0
- data/lib/vapid/views/{admin → dashboard}/records/index.html.erb +6 -8
- data/lib/vapid/views/dashboard/records/new.html.erb +6 -0
- data/lib/vapid/views/dashboard/settings/edit.html.erb +22 -0
- data/lib/vapid/views/errors/404.html.erb +4 -1
- data/lib/vapid/views/errors/500.html.erb +4 -1
- data/lib/vapid/views/layouts/dashboard.html.erb +47 -0
- data/lib/vapid/views/layouts/modal.html.erb +21 -0
- data/lib/vapid/views/shared/_flash.html.erb +5 -0
- metadata +27 -16
- data/lib/vapid/assets/stylesheets/vapid/admin.scss +0 -72
- data/lib/vapid/generator_template/assets/stylesheets/application.css +0 -120
- data/lib/vapid/views/admin/overview/index.html.erb +0 -1
- data/lib/vapid/views/admin/records/_form.erb +0 -9
- data/lib/vapid/views/admin/records/edit.html.erb +0 -5
- data/lib/vapid/views/admin/records/new.html.erb +0 -3
- data/lib/vapid/views/layouts/admin.html.erb +0 -41
- data/lib/vapid/views/layouts/admin_form.html.erb +0 -22
- data/lib/vapid/views/layouts/error.html.erb +0 -11
File without changes
|
File without changes
|
@@ -1,25 +1,85 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<!--
|
2
|
+
Note: This page is an example only. Feel free to delete everything, and
|
3
|
+
start fresh. Also, be sure to checkout the layouts/default template.
|
4
|
+
-->
|
5
|
+
|
6
|
+
<main>
|
7
|
+
<div>
|
8
|
+
<img src="https://cdn.vapid.com/logo.png" class="logo" alt="Vapid logo" onerror="this.style.display='none'">
|
9
|
+
<p>Welcome to Vapid. This is an example page, to help you get started and understand the basics.</p>
|
10
|
+
<p>To begin, create two tags anywhere in the HTML of this page:</p>
|
11
|
+
<pre><code><h1 vp-text="title"></h1>
|
12
|
+
<div vp-richtext="body"></div>
|
13
|
+
</code></pre>
|
14
|
+
<p>The <code>vp-</code> attributes you see tell Vapid two things: 1) what type of content you'd like placed inside of the tag (e.g. <code>vp-richtext</code>); and 2) what you'd like to name the variable (e.g. <code>body</code>).</p>
|
15
|
+
<p>Now visit <a href="/dashboard" target="_blank">the dashboard</a> to see how you can edit content.</p>
|
5
16
|
</div>
|
6
|
-
</
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
</main>
|
18
|
+
|
19
|
+
<!-- In-page tag for convenience of deleting only. Use assets/stylesheets/site.css for your styles. -->
|
20
|
+
<style>
|
21
|
+
* {
|
22
|
+
padding: 0;
|
23
|
+
margin: 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
html, body {
|
27
|
+
height: 100%;
|
28
|
+
font-family: "Helvetica Neue", Helvetica, sans-serif;
|
29
|
+
line-height: 1.33em;
|
30
|
+
color: #c3c3c3;
|
31
|
+
background: #1b1c1d;
|
32
|
+
}
|
33
|
+
|
34
|
+
a {
|
35
|
+
color: white;
|
36
|
+
text-decoration: underline;
|
37
|
+
}
|
38
|
+
|
39
|
+
main {
|
40
|
+
display: flex;
|
41
|
+
height: 100%;
|
42
|
+
align-items: center;
|
43
|
+
justify-content: center;
|
44
|
+
}
|
45
|
+
|
46
|
+
main div {
|
47
|
+
width: 500px;
|
48
|
+
max-width: 100%;
|
49
|
+
}
|
50
|
+
|
51
|
+
code {
|
52
|
+
display: inline-block;
|
53
|
+
background: #333;
|
54
|
+
padding: 0 0.25em;
|
55
|
+
margin: 0 0.25em;
|
56
|
+
vertical-align: bottom;
|
57
|
+
}
|
58
|
+
|
59
|
+
pre > code {
|
60
|
+
display: block;
|
61
|
+
margin: 2em 0;
|
62
|
+
padding: 1em;
|
63
|
+
}
|
64
|
+
|
65
|
+
p {
|
66
|
+
margin-bottom: 1em;
|
67
|
+
line-height: 1.3em;
|
68
|
+
}
|
69
|
+
|
70
|
+
.logo {
|
71
|
+
display: block;
|
72
|
+
max-width: 10em;
|
73
|
+
margin: 0 auto 3em;
|
74
|
+
}
|
75
|
+
|
76
|
+
@media (max-width: 768px) {
|
77
|
+
main div {
|
78
|
+
padding: 0 2em;
|
79
|
+
}
|
80
|
+
|
81
|
+
h1 {
|
82
|
+
text-align: center;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
</style>
|
@@ -2,21 +2,10 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Vapid</title>
|
5
|
-
<%= stylesheet_link_tag "
|
5
|
+
<%= stylesheet_link_tag "site" %>
|
6
6
|
</head>
|
7
7
|
<body>
|
8
|
-
|
9
|
-
|
10
|
-
<%= link_to "Vapid", "/", class: "vapid" %>
|
11
|
-
|
12
|
-
<ul>
|
13
|
-
<li><%= link_to "Admin Login", "/admin" %></li>
|
14
|
-
</ul>
|
15
|
-
</div>
|
16
|
-
</nav>
|
17
|
-
|
18
|
-
<main>
|
19
|
-
<%= yield %>
|
20
|
-
</main>
|
8
|
+
<%= yield %>
|
9
|
+
<%= javascript_include_tag "site" %>
|
21
10
|
</body>
|
22
11
|
</html>
|
data/lib/vapid/models/record.rb
CHANGED
@@ -25,6 +25,28 @@ module Vapid
|
|
25
25
|
def content_summary
|
26
26
|
group.text_fields.any? ? content.values_at(*group.text_fields).join(", ") : content.to_json
|
27
27
|
end
|
28
|
+
|
29
|
+
def update_content(content, remove = {})
|
30
|
+
content.each do |key, val|
|
31
|
+
# TODO: File uploads?
|
32
|
+
# if val.is_a?(Hash) && val[:tempfile]
|
33
|
+
# FileUtils.mkdir_p(settings.project_uploads)
|
34
|
+
# File.open File.join(settings.project_uploads, val[:filename]), "wb" do |file|
|
35
|
+
# file.write val[:tempfile].read
|
36
|
+
# end
|
37
|
+
# val = "/uploads/#{val[:filename]}"
|
38
|
+
# end
|
39
|
+
|
40
|
+
content_type = group.fields[key]
|
41
|
+
self.content[key] = Directives[content_type].serialize_input(val)
|
42
|
+
end
|
43
|
+
|
44
|
+
remove.each do |key, _val|
|
45
|
+
self.content[key] = nil
|
46
|
+
end if remove
|
47
|
+
|
48
|
+
save
|
49
|
+
end
|
28
50
|
end
|
29
51
|
end
|
30
52
|
end
|
data/lib/vapid/models/user.rb
CHANGED
@@ -4,8 +4,13 @@ module Vapid
|
|
4
4
|
class User < ActiveRecord::Base
|
5
5
|
has_secure_password
|
6
6
|
|
7
|
-
validates :email,
|
8
|
-
|
7
|
+
validates :email,
|
8
|
+
presence: true,
|
9
|
+
format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i },
|
10
|
+
uniqueness: { case_sensitive: false, message: "is already taken" }
|
11
|
+
validates :password,
|
12
|
+
length: { minimum: 6 },
|
13
|
+
allow_nil: false
|
9
14
|
|
10
15
|
def self.authenticate(email, password)
|
11
16
|
user = find_by("lower(email) = ?", email.downcase)
|
data/lib/vapid/server.rb
CHANGED
@@ -9,7 +9,7 @@ require "sass"
|
|
9
9
|
require "sprockets"
|
10
10
|
require "uglifier"
|
11
11
|
require "rack-livereload"
|
12
|
-
require_relative "controllers/
|
12
|
+
require_relative "controllers/dashboard_controller"
|
13
13
|
require_relative "controllers/project_controller"
|
14
14
|
|
15
15
|
module Vapid
|
@@ -52,7 +52,7 @@ module Vapid
|
|
52
52
|
configure :development do
|
53
53
|
set :show_exceptions, :after_handler
|
54
54
|
use Rack::LiveReload, no_swf: true,
|
55
|
-
ignore: [%r{^/(
|
55
|
+
ignore: [%r{^/(dashboard)}]
|
56
56
|
FileUtils.touch settings.reload
|
57
57
|
end
|
58
58
|
|
@@ -76,19 +76,19 @@ module Vapid
|
|
76
76
|
|
77
77
|
error Padrino::Rendering::TemplateNotFound do
|
78
78
|
status 404
|
79
|
-
render "errors/404", layout: :
|
79
|
+
render "errors/404", layout: :modal
|
80
80
|
end
|
81
81
|
|
82
82
|
error do
|
83
83
|
status 500
|
84
|
-
render "errors/500", layout: :
|
84
|
+
render "errors/500", layout: :modal
|
85
85
|
end
|
86
86
|
|
87
87
|
register Sinatra::Flash
|
88
88
|
register Sinatra::Namespace
|
89
89
|
register Padrino::Helpers
|
90
90
|
|
91
|
-
register Controllers::
|
91
|
+
register Controllers::DashboardController
|
92
92
|
register Controllers::ProjectController
|
93
93
|
end
|
94
94
|
end
|
data/lib/vapid/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
<% form_tag "", class: "ui
|
1
|
+
<% form_tag "", class: "ui form" do |f| %>
|
2
2
|
<div class="field">
|
3
|
-
<p>
|
3
|
+
<p>Before we get started, we need to create a dashboard login account for you.</p>
|
4
4
|
<p>Check to make sure your <code>config/database.yml</code> settings are correct, and then fill out the form below:</p>
|
5
5
|
</div>
|
6
6
|
<div class="field">
|
@@ -15,5 +15,5 @@
|
|
15
15
|
<%= text_field_tag :code, value: params[:code], placeholder: "Install code (found in config/settings.yml)" if @code %>
|
16
16
|
</div>
|
17
17
|
|
18
|
-
<%= submit_tag "Create
|
18
|
+
<%= submit_tag "Create Login", class: "ui fluid button" %>
|
19
19
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% form_for @user, "", class: "ui
|
1
|
+
<% form_for @user, "", class: "ui form" do |f| %>
|
2
2
|
<div class="field">
|
3
3
|
<%= f.email_field :email, placeholder: "Email" %>
|
4
4
|
</div>
|
@@ -7,5 +7,5 @@
|
|
7
7
|
<%= f.password_field :password, placeholder: "Password" %>
|
8
8
|
</div>
|
9
9
|
|
10
|
-
<%= f.submit "
|
10
|
+
<%= f.submit "Log in", class: "ui fluid button" %>
|
11
11
|
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<h1>Edit <%= @group.display_name.singularize %></h1>
|
2
|
+
|
3
|
+
<% record_form_for @record, "/dashboard/groups/#{@group.id}/records/#{@record.id}", multipart: true, class: "ui form" do |f| %>
|
4
|
+
<%= dashboard_partial "records/form_fields", locals: { f: f } %>
|
5
|
+
<%= f.submit "Update #{@group.display_name.singularize}", class: "ui button" %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<%= button_to "Delete #{@group.display_name.singularize}", "/dashboard/groups/#{@group.id}/records/#{@record.id}", method: :delete, data: { delete: true, confirm: "Are you sure you want to delete this #{@record.group.display_name.singularize.downcase}?" } if @group.repeating? %>
|
10
|
+
</p>
|
@@ -1,10 +1,8 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<% end %>
|
7
|
-
</p>
|
1
|
+
<div class="ui basic clearing vertical segment header-group">
|
2
|
+
<h1 class="ui left floated header"><%= @group.display_name %></h1>
|
3
|
+
|
4
|
+
<%= link_to "New #{@group.display_name.singularize}", "/dashboard/groups/#{@group.id}/records/new", class: "ui right floated small button" %>
|
5
|
+
</div>
|
8
6
|
|
9
7
|
<table class="ui single line table">
|
10
8
|
<thead>
|
@@ -28,7 +26,7 @@
|
|
28
26
|
<td><%= record.content_summary %></td>
|
29
27
|
<% end %>
|
30
28
|
<td class="right aligned">
|
31
|
-
<% link_to "/
|
29
|
+
<% link_to "/dashboard/groups/#{@group.id}/records/#{record.id}/edit" do %>
|
32
30
|
<i class="icon edit"></i>Edit
|
33
31
|
<% end %>
|
34
32
|
</td>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<h1><%= @group.repeating? ? "New #{@group.display_name}" : @group.display_name %></h1>
|
2
|
+
|
3
|
+
<% record_form_for @record, "/dashboard/groups/#{@group.id}/records", multipart: true, class: "ui form" do |f| %>
|
4
|
+
<%= dashboard_partial "records/form_fields", locals: { f: f } %>
|
5
|
+
<%= f.submit "Create New #{@group.display_name.singularize}", class: "ui button" %>
|
6
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h1>Edit Your Account</h1>
|
2
|
+
|
3
|
+
<form method="POST" class="ui form">
|
4
|
+
<div class="field">
|
5
|
+
<label>Email</label>
|
6
|
+
<input type="email" name="email" value="<%= current_user.email %>">
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="field">
|
10
|
+
<label>New Password</label>
|
11
|
+
<input type="password" name="password">
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<label>Confirm New Password</label>
|
16
|
+
<input type="password" name="password_confirmation" autocomplete="off">
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<input type="submit" class="ui button" value="Update Settings">
|
21
|
+
</div>
|
22
|
+
</form>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Vapid</title>
|
5
|
+
<%= stylesheet_link_tag "vapid/dashboard" %>
|
6
|
+
<%= javascript_include_tag "vapid/dashboard" %>
|
7
|
+
<%= favicon_tag "vapid/favicon.ico" %>
|
8
|
+
<%= csrf_meta_tags %>
|
9
|
+
</head>
|
10
|
+
<body class="dashboard">
|
11
|
+
<div class="ui bottom attached segment pushable">
|
12
|
+
<div class="ui visible inverted left vertical sidebar menu">
|
13
|
+
<div class="item">
|
14
|
+
<% link_to "/dashboard" do %>
|
15
|
+
<%= image_tag "vapid/logo.png", class: "logo", alt: "Vapid logo" %>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="item">
|
20
|
+
<div class="header">Content</div>
|
21
|
+
<div class="menu">
|
22
|
+
<% @groups.each do |group| %>
|
23
|
+
<%= link_to group.display_name, group_or_records_path(group), class: "item" %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="item">
|
29
|
+
<div class="header">Settings</div>
|
30
|
+
<div class="menu">
|
31
|
+
<%= link_to "Build Site", "/dashboard/build", class: "item" %>
|
32
|
+
<%= link_to "Edit Account", "/dashboard/settings", class: "item" %>
|
33
|
+
<%= link_to "Log out", "/dashboard/logout", class: "item" %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="pusher">
|
39
|
+
<main class="ui basic segment">
|
40
|
+
<%= partial "shared/flash" %>
|
41
|
+
|
42
|
+
<%= yield %>
|
43
|
+
</main>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</body>
|
47
|
+
</html>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Vapid</title>
|
5
|
+
<%= stylesheet_link_tag "vapid/dashboard" %>
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
</head>
|
8
|
+
<body class="modal">
|
9
|
+
<div class="ui middle aligned center aligned grid">
|
10
|
+
<div class="column">
|
11
|
+
<%= image_tag "vapid/logo_inverse.png", class: "logo", alt: "Vapid logo" %>
|
12
|
+
|
13
|
+
<div class="ui left aligned basic padded segment">
|
14
|
+
<%= partial "shared/flash" %>
|
15
|
+
|
16
|
+
<%= yield %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</body>
|
21
|
+
</html>
|