themes_on_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +110 -0
- data/Rakefile +60 -0
- data/lib/generators/themes_on_rails/templates/all.css +9 -0
- data/lib/generators/themes_on_rails/templates/all.js +7 -0
- data/lib/generators/themes_on_rails/templates/layout.html.erb +14 -0
- data/lib/generators/themes_on_rails/templates/layout.html.haml +9 -0
- data/lib/generators/themes_on_rails/theme_generator.rb +52 -0
- data/lib/themes_on_rails/action_controller.rb +61 -0
- data/lib/themes_on_rails/controller_additions.rb +13 -0
- data/lib/themes_on_rails/engine.rb +6 -0
- data/lib/themes_on_rails/railtie.rb +17 -0
- data/lib/themes_on_rails/version.rb +3 -0
- data/lib/themes_on_rails.rb +9 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/posts.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/posts.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +9 -0
- data/spec/dummy/app/controllers/posts_controller.rb +68 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/themes/basic_blue/assets/javascripts/basic_blue/all.js +7 -0
- data/spec/dummy/app/themes/basic_blue/assets/stylesheets/basic_blue/all.css +9 -0
- data/spec/dummy/app/themes/basic_blue/views/layouts/basic_blue.html.haml +9 -0
- data/spec/dummy/app/themes/basic_blue/views/posts/_form.html.erb +25 -0
- data/spec/dummy/app/themes/basic_blue/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/themes/basic_blue/views/posts/index.html.erb +29 -0
- data/spec/dummy/app/themes/basic_blue/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/themes/basic_blue/views/posts/show.html.erb +15 -0
- data/spec/dummy/app/themes/professional_blue/assets/javascripts/professional_blue/all.js +7 -0
- data/spec/dummy/app/themes/professional_blue/assets/stylesheets/professional_blue/all.css +9 -0
- data/spec/dummy/app/themes/professional_blue/views/layouts/professional_blue.html.haml +9 -0
- data/spec/dummy/app/themes/professional_blue/views/posts/_form.html.erb +25 -0
- data/spec/dummy/app/themes/professional_blue/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/themes/professional_blue/views/posts/index.html.erb +29 -0
- data/spec/dummy/app/themes/professional_blue/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/themes/professional_blue/views/posts/show.html.erb +15 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/posts/_form.html.erb +25 -0
- data/spec/dummy/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/posts/index.html.erb +29 -0
- data/spec/dummy/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/views/posts/show.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +22 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20131120082307_create_posts.rb +10 -0
- data/spec/dummy/db/schema.rb +23 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1581 -0
- data/spec/dummy/log/test.log +4042 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/controllers/posts_controller_spec.rb +47 -0
- data/spec/dummy/spec/spec_helper.rb +44 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0cfcea8e64323f692964ade04baf71bf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1b2584b22e1970da0ea00056c0149492 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/301390a2f715e632e51eaceadc864bd8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3059f09ecb35a9d6a17cc629cf142cad +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3773504c128301fa4ae43322c265863c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8b1b55ee928fcc1ca79651b5a54d12b1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/97b428fb2be48bdef1c2edc6895007e6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a144f874a0fbcfbf57e914e54950b2b8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a6505a19f1ef24ad643489939529b237 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/aea240771414d6f51f0eeffa97de34c0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c6062fc388a3fcd36f0407b7de58b073 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fbce05c1fbdc18388ed134c8e4100ac8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0cfcea8e64323f692964ade04baf71bf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1b2584b22e1970da0ea00056c0149492 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/301390a2f715e632e51eaceadc864bd8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3059f09ecb35a9d6a17cc629cf142cad +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3773504c128301fa4ae43322c265863c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8b1b55ee928fcc1ca79651b5a54d12b1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/97b428fb2be48bdef1c2edc6895007e6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a144f874a0fbcfbf57e914e54950b2b8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a6505a19f1ef24ad643489939529b237 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/aea240771414d6f51f0eeffa97de34c0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c6062fc388a3fcd36f0407b7de58b073 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fbce05c1fbdc18388ed134c8e4100ac8 +0 -0
- data/spec/generators/themes_on_rails/theme_generator_spec.rb +67 -0
- data/spec/lib/action_controller_spec.rb +45 -0
- data/spec/lib/assets_path_spec.rb +15 -0
- data/spec/lib/controller_additions_spec.rb +22 -0
- data/spec/spec_helper.rb +22 -0
- metadata +330 -0
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
# Prevent CSRF attacks by raising an exception.
|
3
|
+
# For APIs, you may want to use :null_session instead.
|
4
|
+
protect_from_forgery with: :exception
|
5
|
+
|
6
|
+
def default_url_options
|
7
|
+
{ theme: params[:theme] }.merge(super)
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
theme :theme_resolver, except: [:new]
|
3
|
+
|
4
|
+
if Rails::VERSION::MAJOR == 4
|
5
|
+
before_action :set_post, only: [:show, :edit, :update, :destroy]
|
6
|
+
else
|
7
|
+
before_filter :set_post, only: [:show, :edit, :update, :destroy]
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /posts
|
11
|
+
def index
|
12
|
+
@posts = Post.all
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /posts/1
|
16
|
+
def show
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /posts/new
|
20
|
+
def new
|
21
|
+
@post = Post.new
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /posts/1/edit
|
25
|
+
def edit
|
26
|
+
end
|
27
|
+
|
28
|
+
# POST /posts
|
29
|
+
def create
|
30
|
+
@post = Post.new(post_params)
|
31
|
+
|
32
|
+
if @post.save
|
33
|
+
redirect_to @post, notice: 'Post was successfully created.'
|
34
|
+
else
|
35
|
+
render action: 'new'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# PATCH/PUT /posts/1
|
40
|
+
def update
|
41
|
+
if @post.update(post_params)
|
42
|
+
redirect_to @post, notice: 'Post was successfully updated.'
|
43
|
+
else
|
44
|
+
render action: 'edit'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# DELETE /posts/1
|
49
|
+
def destroy
|
50
|
+
@post.destroy
|
51
|
+
redirect_to posts_url, notice: 'Post was successfully destroyed.'
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
# Use callbacks to share common setup or constraints between actions.
|
56
|
+
def set_post
|
57
|
+
@post = Post.find(params[:id])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Only allow a trusted parameter "white list" through.
|
61
|
+
def post_params
|
62
|
+
params.require(:post).permit(:title, :description)
|
63
|
+
end
|
64
|
+
|
65
|
+
def theme_resolver
|
66
|
+
params[:theme].presence || "basic_blue"
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require_tree .
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*
|
6
|
+
|
7
|
+
*= require_self
|
8
|
+
*= require_tree .
|
9
|
+
*/
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@post) do |f| %>
|
2
|
+
<% if @post.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br>
|
16
|
+
<%= f.text_field :title %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :description %><br>
|
20
|
+
<%= f.text_area :description %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1>Listing posts: basic_blue</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Title</th>
|
7
|
+
<th>Description</th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<tbody>
|
15
|
+
<% @posts.each do |post| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= post.title %></td>
|
18
|
+
<td><%= post.description %></td>
|
19
|
+
<td><%= link_to 'Show', post %></td>
|
20
|
+
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
21
|
+
<td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br>
|
28
|
+
|
29
|
+
<%= link_to 'New Post', new_post_path %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
<h1>Post: <%= @post.id %> basic_blue</h1>
|
3
|
+
|
4
|
+
<p>
|
5
|
+
<strong>Title:</strong>
|
6
|
+
<%= @post.title %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p>
|
10
|
+
<strong>Description:</strong>
|
11
|
+
<%= @post.description %>
|
12
|
+
</p>
|
13
|
+
|
14
|
+
<%= link_to 'Edit', edit_post_path(@post) %> |
|
15
|
+
<%= link_to 'Back', posts_path %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require_tree .
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*
|
6
|
+
|
7
|
+
*= require_self
|
8
|
+
*= require_tree .
|
9
|
+
*/
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@post) do |f| %>
|
2
|
+
<% if @post.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br>
|
16
|
+
<%= f.text_field :title %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :description %><br>
|
20
|
+
<%= f.text_area :description %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1>Listing posts: professional_blue</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Title</th>
|
7
|
+
<th>Description</th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<tbody>
|
15
|
+
<% @posts.each do |post| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= post.title %></td>
|
18
|
+
<td><%= post.description %></td>
|
19
|
+
<td><%= link_to 'Show', post %></td>
|
20
|
+
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
21
|
+
<td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br>
|
28
|
+
|
29
|
+
<%= link_to 'New Post', new_post_path %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
<h1>Post: <%= @post.id %> professional_blue</h1>
|
3
|
+
|
4
|
+
<p>
|
5
|
+
<strong>Title:</strong>
|
6
|
+
<%= @post.title %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p>
|
10
|
+
<strong>Description:</strong>
|
11
|
+
<%= @post.description %>
|
12
|
+
</p>
|
13
|
+
|
14
|
+
<%= link_to 'Edit', edit_post_path(@post) %> |
|
15
|
+
<%= link_to 'Back', posts_path %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|