kblog 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/MIT-LICENSE +20 -0
- data/README.rdoc +11 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/kblog/application.js +15 -0
- data/app/assets/javascripts/kblog/articles.js +2 -0
- data/app/assets/stylesheets/kblog/application.css +13 -0
- data/app/assets/stylesheets/kblog/articles.css.scss +63 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/kblog/application_controller.rb +9 -0
- data/app/controllers/kblog/articles_controller.rb +75 -0
- data/app/helpers/kblog/application_helper.rb +4 -0
- data/app/helpers/kblog/articles_helper.rb +9 -0
- data/app/models/kblog/article.rb +17 -0
- data/app/views/kblog/articles/_article.html.erb +17 -0
- data/app/views/kblog/articles/_form.html.erb +25 -0
- data/app/views/kblog/articles/edit.html.erb +10 -0
- data/app/views/kblog/articles/index.html.erb +11 -0
- data/app/views/kblog/articles/new.html.erb +9 -0
- data/app/views/kblog/articles/show.html.erb +3 -0
- data/app/views/layouts/kblog/application.html.erb +14 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20130303192309_create_kblog_articles.rb +10 -0
- data/lib/generators/kblog/USAGE +8 -0
- data/lib/generators/kblog/kblog_generator.rb +8 -0
- data/lib/generators/kblog/templates/initializer.rb +23 -0
- data/lib/kblog.rb +9 -0
- data/lib/kblog/engine.rb +9 -0
- data/lib/kblog/version.rb +3 -0
- data/lib/tasks/kblog_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/users.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/assets/stylesheets/users.css +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/users_controller.rb +83 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/users_helper.rb +2 -0
- data/test/dummy/app/models/user.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +18 -0
- data/test/dummy/app/views/users/_form.html.erb +21 -0
- data/test/dummy/app/views/users/edit.html.erb +6 -0
- data/test/dummy/app/views/users/index.html.erb +23 -0
- data/test/dummy/app/views/users/new.html.erb +5 -0
- data/test/dummy/app/views/users/show.html.erb +10 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/kblog_init.rb +22 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +7 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130304103354_create_users.rb +9 -0
- data/test/dummy/db/schema.rb +29 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +4864 -0
- data/test/dummy/log/test.log +637 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/users.yml +7 -0
- data/test/dummy/test/functional/users_controller_test.rb +49 -0
- data/test/dummy/test/unit/helpers/users_helper_test.rb +4 -0
- data/test/dummy/test/unit/user_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/C1F/920/sprockets%2F6470181da287432450dd3489f684b330 +0 -0
- data/test/dummy/tmp/cache/assets/C8B/460/sprockets%2F8499a931f096e078410273e1144ff9bc +0 -0
- data/test/dummy/tmp/cache/assets/C8C/B80/sprockets%2F371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/CAA/620/sprockets%2F87b209c0c9da28094a8d5581a21262c6 +0 -0
- data/test/dummy/tmp/cache/assets/CBA/3B0/sprockets%2F5d22e8d21995fc24f358b51f78a41644 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/B70/sprockets%2F4050a4e5062ab95c9f32e9b6940821ea +0 -0
- data/test/dummy/tmp/cache/assets/CE8/410/sprockets%2F5936641b8e8fe5b2e700bd20a54986e5 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/CFB/700/sprockets%2F9a5aa032a0d3f0640a9024f3a8e408e9 +0 -0
- data/test/dummy/tmp/cache/assets/D02/830/sprockets%2Fd57b03ae1c5dad82f11315b678c74702 +0 -0
- data/test/dummy/tmp/cache/assets/D2B/E70/sprockets%2F51eca8d078e9898519e97bc7e8d5311c +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D44/410/sprockets%2F9773f5b0d1d0fcdf89d22a1cc9719037 +0 -0
- data/test/dummy/tmp/cache/assets/D46/650/sprockets%2Ff56253b5f374fff1a33fbbc9881c9124 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D5D/650/sprockets%2F111ca3e1e3f6288db6ac4e585ba0c541 +0 -0
- data/test/dummy/tmp/cache/assets/D67/B60/sprockets%2F5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
- data/test/dummy/tmp/cache/assets/D9E/FF0/sprockets%2F93cdafd007a9cb71c05e58f3d57ec128 +0 -0
- data/test/dummy/tmp/cache/assets/DB3/5D0/sprockets%2F8b9338bdf730c9f47e771f4dda7dac58 +0 -0
- data/test/dummy/tmp/cache/assets/DB7/D70/sprockets%2Fa26d7b4e10cbda5a68c6020ffe44de00 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E0F/250/sprockets%2Fab2e9f1deb2dcd8968ea6d476747e8aa +0 -0
- data/test/dummy/tmp/cache/assets/E67/260/sprockets%2F88eea1ef8a12c4aded94f17d18fb9bbf +0 -0
- data/test/dummy/tmp/cache/assets/F00/CA0/sprockets%2Fdfaefdc96bffbdf1f087bdc61e994bef +0 -0
- data/test/fixtures/kblog/articles.yml +9 -0
- data/test/functional/kblog/articles_controller_test.rb +51 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/kblog_test.rb +7 -0
- data/test/test_helper.rb +36 -0
- data/test/unit/helpers/kblog/articles_helper_test.rb +6 -0
- data/test/unit/kblog/article_test.rb +16 -0
- metadata +325 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2013 YOURNAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
begin
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
6
|
+
end
|
|
7
|
+
begin
|
|
8
|
+
require 'rdoc/task'
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require 'rdoc/rdoc'
|
|
11
|
+
require 'rake/rdoctask'
|
|
12
|
+
RDoc::Task = Rake::RDocTask
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
17
|
+
rdoc.title = 'Kblog'
|
|
18
|
+
rdoc.options << '--line-numbers'
|
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
24
|
+
load 'rails/tasks/engine.rake'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Bundler::GemHelper.install_tasks
|
|
29
|
+
|
|
30
|
+
require 'rake/testtask'
|
|
31
|
+
|
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
|
33
|
+
t.libs << 'lib'
|
|
34
|
+
t.libs << 'test'
|
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
|
36
|
+
t.verbose = false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
task :default => :test
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
// the compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= 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,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Place all the styles related to the matching controller here.
|
|
3
|
+
They will automatically be included in application.css.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
$margin: 20px;
|
|
7
|
+
$bgcolor: #F8F8F8;
|
|
8
|
+
$border: #C0C0C0;
|
|
9
|
+
$shadow: $border / 1;
|
|
10
|
+
$smaller: 0.8em;
|
|
11
|
+
|
|
12
|
+
@mixin rounded-well {
|
|
13
|
+
padding: $margin;
|
|
14
|
+
margin: $margin 0 0 0;
|
|
15
|
+
background-color: $bgcolor;
|
|
16
|
+
border-radius: 5px;
|
|
17
|
+
-moz-border-radius: 5px;
|
|
18
|
+
-webkit-border-radius: 5px;
|
|
19
|
+
-moz-box-shadow: 2px 2px 2px 2px $shadow;
|
|
20
|
+
-webkit-box-shadow: 2px 2px 2px 2px $shadow;
|
|
21
|
+
box-shadow: 2px 2px 2px 2px $shadow;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.kblog {
|
|
25
|
+
font-family:Verdana, Arial, Helvetika;
|
|
26
|
+
padding: 0 50px 0 50px;
|
|
27
|
+
.pagination-links {
|
|
28
|
+
text-align: center;
|
|
29
|
+
margin-top: $margin;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.kblog-article {
|
|
34
|
+
h2 {
|
|
35
|
+
margin-top: -10px;
|
|
36
|
+
color: $border/3;
|
|
37
|
+
}
|
|
38
|
+
@include rounded-well;
|
|
39
|
+
|
|
40
|
+
.kblog-content {
|
|
41
|
+
text-align: justify;
|
|
42
|
+
text-indent:20px;
|
|
43
|
+
}
|
|
44
|
+
.kblog-created {
|
|
45
|
+
float:right;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
color: $border;
|
|
48
|
+
font-size: $smaller;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.kblog-links {
|
|
53
|
+
margin-top: 10px;
|
|
54
|
+
text-align:right;
|
|
55
|
+
clear:all;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.kblog-form {
|
|
59
|
+
@include rounded-well;
|
|
60
|
+
label { font-size: $smaller; }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
@@ -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,75 @@
|
|
|
1
|
+
require_dependency "kblog/application_controller"
|
|
2
|
+
|
|
3
|
+
module Kblog
|
|
4
|
+
class ArticlesController < ApplicationController
|
|
5
|
+
before_filter :set_blog_user
|
|
6
|
+
before_filter :set_article, only: [:show, :edit, :update, :destroy]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
if Kblog.authentication == 'basic'
|
|
10
|
+
http_basic_authenticate_with :name => Kblog.authname, :password => Kblog.authpassword, :except => [:index,:show]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /articles
|
|
14
|
+
def index
|
|
15
|
+
@articles = Article.order("created_at DESC").paginate(:page => params[:page], :per_page => 3)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# GET /articles/1
|
|
19
|
+
def show
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# GET /articles/new
|
|
23
|
+
def new
|
|
24
|
+
@article = Article.new
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# GET /articles/1/edit
|
|
28
|
+
def edit
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# POST /articles
|
|
32
|
+
def create
|
|
33
|
+
@article = Article.new(article_params)
|
|
34
|
+
|
|
35
|
+
if @article.save
|
|
36
|
+
redirect_to @article, notice: 'Article was successfully created.'
|
|
37
|
+
else
|
|
38
|
+
render action: 'new'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# PATCH/PUT /articles/1
|
|
43
|
+
def update
|
|
44
|
+
if @article.update_attributes(article_params)
|
|
45
|
+
redirect_to @article, notice: 'Article was successfully updated.'
|
|
46
|
+
else
|
|
47
|
+
render action: 'edit'
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# DELETE /articles/1
|
|
52
|
+
def destroy
|
|
53
|
+
@article.destroy
|
|
54
|
+
redirect_to articles_url, notice: 'Article was successfully destroyed.'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
59
|
+
def set_article
|
|
60
|
+
@article = Article.find(params[:id])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def set_blog_user
|
|
64
|
+
if current_user
|
|
65
|
+
@blog_user = current_user
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
|
70
|
+
def article_params
|
|
71
|
+
params[:article]
|
|
72
|
+
#params.require(:article).permit(:title, :content)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Kblog
|
|
2
|
+
class Article < ActiveRecord::Base
|
|
3
|
+
attr_accessible :content, :title
|
|
4
|
+
validates :title, :presence => true
|
|
5
|
+
|
|
6
|
+
def self.has_create_rights(user)
|
|
7
|
+
case Kblog.auth_type
|
|
8
|
+
when 'basic'
|
|
9
|
+
false
|
|
10
|
+
when 'role'
|
|
11
|
+
user.respond_to?(:roles) && user.roles.map { |r| r.name }.includes?( Kblog.auth_role )
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<article class="kblog-article">
|
|
2
|
+
<aside class="kblog-created">
|
|
3
|
+
<%= localize(article.created_at, format: :long) %>
|
|
4
|
+
</aside>
|
|
5
|
+
<h2><%= article.title %></h2>
|
|
6
|
+
|
|
7
|
+
<div class="kblog-content">
|
|
8
|
+
<%= textilize(article.content).html_safe %>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<% if @blog_user && Kblog::Article.has_create_rights(@blog_user) %>
|
|
12
|
+
<div class="kblog-links">
|
|
13
|
+
<%= link_to 'Edit', kblog.edit_article_path(article) %> |
|
|
14
|
+
<%= link_to 'Destroy', kblog.article_path(article), :confirm => 'Are you sure?', :method => :delete %>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
17
|
+
</article>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<%= form_for(@article) do |f| %>
|
|
2
|
+
<% if @article.errors.any? %>
|
|
3
|
+
<div id="error_explanation">
|
|
4
|
+
<h2><%= pluralize(@article.errors.count, "error") %> prohibited this article from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% @article.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, :size => 64 %>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="field">
|
|
19
|
+
<%= f.label :content %><br />
|
|
20
|
+
<%= f.text_area :content, :size => "72x5" %>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="actions">
|
|
23
|
+
<%= f.submit %>
|
|
24
|
+
</div>
|
|
25
|
+
<% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<section class="kblog">
|
|
2
|
+
<h1>KBlog</h1>
|
|
3
|
+
<%= render(:partial => 'article', :collection => @articles) %>
|
|
4
|
+
<div class="pagination-links">
|
|
5
|
+
<%= will_paginate(@articles) %>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="kblog-links">
|
|
8
|
+
<%= link_to 'New Article', new_article_path %>
|
|
9
|
+
</div>
|
|
10
|
+
</section>
|
|
11
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Kblog</title>
|
|
5
|
+
<%= stylesheet_link_tag "kblog/application", :media => "all" %>
|
|
6
|
+
<%= javascript_include_tag "kblog/application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|