jabe 0.5.9 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE.txt → MIT-LICENSE} +1 -1
- data/README.textile +46 -31
- data/Rakefile +30 -47
- data/app/assets/images/jabe/delete.png +0 -0
- data/{public/images → app/assets/images/jabe}/delete_page.png +0 -0
- data/{public/images → app/assets/images/jabe}/full_page.png +0 -0
- data/{public/images → app/assets/images/jabe}/gravatar.gif +0 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/application.js +15 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/libs/dd_belatedpng.js +0 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/libs/modernizr-1.6.min.js +0 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/plugins.js +0 -0
- data/app/assets/stylesheets/jabe/application.css +3 -0
- data/app/{stylesheets → assets/stylesheets/jabe}/boilerplate.scss +0 -0
- data/app/{stylesheets → assets/stylesheets/jabe}/jabe.scss +47 -8
- data/app/controllers/jabe/admin/base_controller.rb +7 -0
- data/app/controllers/jabe/admin/entries_controller.rb +49 -0
- data/app/controllers/jabe/admin/settings_controller.rb +13 -0
- data/app/controllers/jabe/application_controller.rb +5 -0
- data/app/controllers/jabe/comments_controller.rb +34 -0
- data/app/controllers/jabe/entries_controller.rb +30 -0
- data/app/controllers/jabe/feed_controller.rb +8 -0
- data/app/controllers/jabe/sessions_controller.rb +4 -0
- data/app/helpers/jabe/application_helper.rb +25 -0
- data/app/mailers/jabe/comment_mailer.rb +12 -0
- data/app/models/jabe/admin.rb +11 -0
- data/app/models/jabe/comment.rb +35 -0
- data/app/models/jabe/entry.rb +22 -0
- data/app/models/jabe/settings.rb +14 -0
- data/app/views/{admin → jabe/admin}/entries/_form.html.haml +1 -1
- data/app/views/{admin → jabe/admin}/entries/edit.html.haml +0 -0
- data/app/views/{admin → jabe/admin}/entries/index.html.haml +9 -7
- data/app/views/{admin → jabe/admin}/entries/new.html.haml +0 -0
- data/app/views/{admin → jabe/admin}/settings/edit.html.haml +2 -1
- data/app/views/jabe/comment_mailer/notification.html.erb +19 -0
- data/app/views/jabe/confirmations/new.html.erb +15 -0
- data/app/views/{entries → jabe/entries}/index.html.haml +4 -3
- data/app/views/jabe/entries/show.html.haml +49 -0
- data/app/views/{feed → jabe/feed}/index.xml.builder +3 -3
- data/app/views/jabe/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/jabe/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/jabe/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/jabe/passwords/edit.html.erb +19 -0
- data/app/views/jabe/passwords/new.html.erb +15 -0
- data/app/views/jabe/registrations/edit.html.erb +22 -0
- data/app/views/jabe/registrations/new.html.erb +17 -0
- data/app/views/jabe/sessions/new.html.erb +15 -0
- data/app/views/jabe/shared/_links.erb +25 -0
- data/app/views/jabe/unlocks/new.html.erb +15 -0
- data/app/views/layouts/jabe/_flashes.html.haml +3 -0
- data/app/views/layouts/{_footer.html.haml → jabe/_footer.html.haml} +0 -0
- data/app/views/layouts/jabe/_header.html.haml +4 -0
- data/app/views/layouts/jabe/_sidebar.html.haml +21 -0
- data/app/views/layouts/jabe/application.html.haml +63 -0
- data/{test/dummy/vendor/plugins/acts_as_textiled/init.rb → config/initializers/acts_as_textiled.rb} +2 -1
- data/config/initializers/devise.rb +3 -0
- data/config/initializers/settings.rb +5 -5
- data/config/initializers/simple_form.rb +93 -0
- data/config/initializers/time_formats.rb +1 -2
- data/config/locales/simple_form.en.yml +24 -0
- data/config/routes.rb +10 -5
- data/{test/dummy/db/migrate/20101229224027_create_settings.rb → db/migrate/20101230010434_create_settings.rb} +7 -2
- data/{lib/generators/jabe/templates/migrations/devise_create_admins.rb → db/migrate/20101230010436_devise_create_admins.rb} +6 -6
- data/{test/dummy/db/migrate/20101229224030_create_entries.rb → db/migrate/20101230010437_create_entries.rb} +2 -2
- data/{test/dummy/db/migrate/20101229224031_create_comments.rb → db/migrate/20101230010438_create_comments.rb} +3 -4
- data/{test/dummy/vendor/plugins/acts_as_textiled/lib/acts_as_textiled.rb → lib/acts_as_textiled/base.rb} +0 -0
- data/lib/jabe.rb +7 -15
- data/lib/jabe/engine.rb +5 -0
- data/lib/jabe/version.rb +3 -0
- data/lib/tasks/jabe_tasks.rake +4 -0
- metadata +187 -601
- data/Gemfile +0 -35
- data/Gemfile.lock +0 -214
- data/VERSION +0 -1
- data/app/controllers/admin/base_controller.rb +0 -3
- data/app/controllers/admin/entries_controller.rb +0 -42
- data/app/controllers/admin/settings_controller.rb +0 -11
- data/app/controllers/comments_controller.rb +0 -25
- data/app/controllers/entries_controller.rb +0 -26
- data/app/controllers/feed_controller.rb +0 -8
- data/app/helpers/jabe_helper.rb +0 -13
- data/app/models/admin.rb +0 -9
- data/app/models/comment.rb +0 -22
- data/app/models/entry.rb +0 -17
- data/app/models/settings.rb +0 -7
- data/app/stylesheets/_will_paginate.scss +0 -102
- data/app/stylesheets/handheld.scss +0 -7
- data/app/views/entries/_comment_form.html.haml +0 -3
- data/app/views/entries/show.html.haml +0 -38
- data/app/views/layouts/_header.html.haml +0 -4
- data/app/views/layouts/_sidebar.html.haml +0 -21
- data/app/views/layouts/application.html.haml +0 -59
- data/config/initializers/sass.rb +0 -5
- data/lib/generators/jabe/migrations/migrations_generator.rb +0 -38
- data/lib/generators/jabe/stylesheets/stylesheets_generator.rb +0 -9
- data/lib/generators/jabe/templates/migrations/add_new_settings.rb +0 -17
- data/lib/generators/jabe/templates/migrations/create_comments.rb +0 -20
- data/lib/generators/jabe/templates/migrations/create_entries.rb +0 -16
- data/lib/generators/jabe/templates/migrations/create_settings.rb +0 -21
- data/lib/generators/jabe/templates/migrations/create_slugs.rb +0 -18
- data/public/.htaccess +0 -220
- data/public/apple-touch-icon.png +0 -0
- data/public/blackbird/blackbird.css +0 -80
- data/public/blackbird/blackbird.js +0 -365
- data/public/blackbird/blackbird.png +0 -0
- data/public/crossdomain.xml +0 -25
- data/public/javascripts/jquery-ui.js +0 -11511
- data/public/javascripts/jquery-ui.min.js +0 -404
- data/public/javascripts/jquery.js +0 -7179
- data/public/javascripts/jquery.min.js +0 -167
- data/public/javascripts/libs/profiling/charts.swf +0 -0
- data/public/javascripts/libs/profiling/config.js +0 -59
- data/public/javascripts/libs/profiling/yahoo-profiling.css +0 -7
- data/public/javascripts/libs/profiling/yahoo-profiling.min.js +0 -39
- data/public/javascripts/rails.js +0 -154
- data/public/nginx.conf +0 -108
- data/public/robots.txt +0 -5
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/config/application.rb +0 -52
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -26
- data/test/dummy/config/environments/production.rb +0 -49
- data/test/dummy/config/environments/test.rb +0 -35
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/devise.rb +0 -142
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/migrate/20101229224028_create_slugs.rb +0 -18
- data/test/dummy/db/migrate/20101229224029_devise_create_admins.rb +0 -26
- data/test/dummy/db/migrate/20110104004400_add_new_settings.rb +0 -17
- data/test/dummy/db/schema.rb +0 -110
- data/test/dummy/features/step_definitions/admin_steps.rb +0 -14
- data/test/dummy/features/step_definitions/email_steps.rb +0 -194
- data/test/dummy/features/step_definitions/entry_steps.rb +0 -54
- data/test/dummy/features/step_definitions/support_steps.rb +0 -3
- data/test/dummy/features/step_definitions/web_steps.rb +0 -219
- data/test/dummy/features/support/blueprints.rb +0 -37
- data/test/dummy/features/support/env.rb +0 -59
- data/test/dummy/features/support/paths.rb +0 -39
- data/test/dummy/spec/spec_helper.rb +0 -0
- data/test/dummy/spec/support/blueprints.rb +0 -9
- data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/author.rb +0 -4
- data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/story.rb +0 -4
- data/test/dummy/vendor/plugins/acts_as_textiled/test/helper.rb +0 -87
- data/test/dummy/vendor/plugins/acts_as_textiled/test/textiled_test.rb +0 -145
data/{LICENSE.txt → MIT-LICENSE}
RENAMED
data/README.textile
CHANGED
@@ -2,51 +2,66 @@ h1. Just Another Blog Engine
|
|
2
2
|
|
3
3
|
h3. What is this?
|
4
4
|
|
5
|
-
|
5
|
+
JABE is a bare bones blogging engine that is installed as a gem. It will grow as its needs do.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
* Comment notifications
|
7
|
+
This version is for Rails 3.1+
|
10
8
|
|
11
9
|
h2. Installing
|
12
10
|
|
13
11
|
Edit your Gemfile and add the required gems
|
14
12
|
|
15
|
-
<pre><code>gem 'devise'
|
16
|
-
gem 'friendly_id', '
|
17
|
-
gem '
|
18
|
-
gem '
|
19
|
-
gem '
|
20
|
-
gem 'haml-rails'
|
21
|
-
gem 'jabe'
|
22
|
-
gem 'jquery-rails'
|
23
|
-
gem 'RedCloth'
|
24
|
-
gem 'sass', '>= 3.1.0.alpha.206'
|
25
|
-
gem 'will_paginate', '>= 3.0.pre2'
|
13
|
+
<pre><code>gem 'devise', '>= 2.0.0'
|
14
|
+
gem 'friendly_id', '>= 4.0.0'
|
15
|
+
gem 'haml-rails', '>= 0.3.4'
|
16
|
+
gem 'kaminari', '>= 0.13.0'
|
17
|
+
gem 'simple_form', '>= 1.5.2'
|
26
18
|
</code></pre>
|
27
19
|
|
28
20
|
From your rails root
|
29
21
|
|
30
22
|
<pre><code>bundle install
|
31
|
-
rails plugin install http://github.com/defunkt/acts_as_textiled.git
|
32
23
|
rails g devise:install
|
33
|
-
|
24
|
+
</code></pre>
|
25
|
+
|
26
|
+
Follow Devise install directions.
|
27
|
+
|
28
|
+
Edit your Gemfile and add JABE
|
29
|
+
|
30
|
+
<pre><code>gem 'jabe'
|
31
|
+
</code></pre>
|
32
|
+
|
33
|
+
JABE is now mountable, so you can put it wherever you want. Edit routes.rb
|
34
|
+
|
35
|
+
<pre><code>mount Jabe::Engine => "/jabe"
|
36
|
+
</code></pre>
|
37
|
+
|
38
|
+
From your rails root
|
39
|
+
|
40
|
+
<pre><code>rake jabe:install:migrations
|
34
41
|
rake db:migrate
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
edit settings
|
42
|
+
|
43
|
+
rails runner "Jabe::Admin.create!(
|
44
|
+
:email => 'you@example.com',
|
45
|
+
:password => 'password',
|
46
|
+
:password_confirmation => 'password'
|
47
|
+
)"
|
42
48
|
</code></pre>
|
43
49
|
|
44
|
-
h2.
|
50
|
+
h2. Upgrading from 0.5.*
|
51
|
+
|
52
|
+
Create a new migration to handle the database changes.
|
53
|
+
|
54
|
+
<pre><code>
|
55
|
+
def change
|
56
|
+
rename_table :settings, :jabe_settings
|
57
|
+
rename_table :admins, :jabe_admins
|
58
|
+
rename_table :entries, :jabe_entries
|
59
|
+
rename_table :comments, :jabe_comments
|
60
|
+
rename_column :jabe_entries, :cached_slug, :slug
|
61
|
+
end
|
62
|
+
</code></pre>
|
45
63
|
|
46
|
-
|
64
|
+
h2. TODO
|
47
65
|
|
48
|
-
|
49
|
-
|
50
|
-
<code>Sass::Plugin.options[:never_update] = true</code>
|
51
|
-
* Generate the stylesheets
|
52
|
-
<code>rails g jabe:stylesheets</code>
|
66
|
+
* Migrate generators
|
67
|
+
* Switch from boilerplate to Twitter Bootstrap?
|
data/Rakefile
CHANGED
@@ -1,57 +1,40 @@
|
|
1
|
-
|
2
|
-
require 'bundler'
|
1
|
+
#!/usr/bin/env rake
|
3
2
|
begin
|
4
|
-
|
5
|
-
rescue
|
6
|
-
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
9
6
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
gem.homepage = "http://github.com/pixels-and-bits/jabe"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = "Just Another Blog Engine"
|
19
|
-
gem.description = "Blog engine for Rails 3+"
|
20
|
-
gem.email = "michael@pixels-and-bits.com"
|
21
|
-
gem.authors = ['Michael Moen a.k.a. UnderpantsGnome', 'Neil Heinrich']
|
22
|
-
gem.files.exclude 'test/dummy'
|
23
|
-
gem.files.exclude 'spec'
|
24
|
-
gem.files.exclude 'features'
|
25
|
-
gem.test_files += Dir.glob('features/**/*')
|
26
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
27
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
28
|
-
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
29
|
-
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
30
13
|
end
|
31
|
-
Jeweler::RubygemsDotOrgTasks.new
|
32
14
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Jabe'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
38
21
|
end
|
39
22
|
|
40
|
-
|
41
|
-
|
42
|
-
test.libs << 'test'
|
43
|
-
test.pattern = 'test/**/test_*.rb'
|
44
|
-
test.verbose = true
|
45
|
-
end
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
46
25
|
|
47
|
-
task :default => :test
|
48
26
|
|
49
|
-
require 'rake/rdoctask'
|
50
|
-
Rake::RDocTask.new do |rdoc|
|
51
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
52
27
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
57
37
|
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,3 +1,18 @@
|
|
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_tree .
|
14
|
+
//= require_tree ./libs
|
15
|
+
|
1
16
|
$(function() {
|
2
17
|
if($('#first-focus').length > 0) {
|
3
18
|
$('#first-focus').focus();
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
@import "will_paginate";
|
2
1
|
|
3
2
|
@mixin gradients {
|
4
3
|
background-image: -webkit-gradient(
|
@@ -72,8 +71,8 @@ h1#site-tagline {
|
|
72
71
|
}
|
73
72
|
}
|
74
73
|
}
|
75
|
-
|
76
74
|
}
|
75
|
+
|
77
76
|
.entry {
|
78
77
|
margin: 0 0 30px 0;
|
79
78
|
padding:0 0 30px 0;
|
@@ -101,6 +100,14 @@ h1#site-tagline {
|
|
101
100
|
color:#eee;
|
102
101
|
}
|
103
102
|
}
|
103
|
+
|
104
|
+
.content {
|
105
|
+
p {
|
106
|
+
font-size:1.1em;
|
107
|
+
line-height:1.4em;
|
108
|
+
padding:.5em;
|
109
|
+
}
|
110
|
+
}
|
104
111
|
}
|
105
112
|
|
106
113
|
.last {
|
@@ -119,6 +126,11 @@ h1#site-tagline {
|
|
119
126
|
.comment {
|
120
127
|
clear:both;
|
121
128
|
|
129
|
+
.delete {
|
130
|
+
float:right;
|
131
|
+
padding-top:2px;
|
132
|
+
}
|
133
|
+
|
122
134
|
.gravatar {
|
123
135
|
margin:10px 10px 10px 0;
|
124
136
|
float:left;
|
@@ -157,6 +169,15 @@ h1#site-tagline {
|
|
157
169
|
}
|
158
170
|
}
|
159
171
|
|
172
|
+
code {
|
173
|
+
background-color: #222222;
|
174
|
+
color: #EEEEEE;
|
175
|
+
padding:2px 5px;
|
176
|
+
-webkit-border-radius: 5px;
|
177
|
+
-moz-border-radius: 5px;
|
178
|
+
border-radius: 5px;
|
179
|
+
}
|
180
|
+
|
160
181
|
pre {
|
161
182
|
color:#eee;
|
162
183
|
background-color:#222;
|
@@ -165,6 +186,10 @@ pre {
|
|
165
186
|
border-top:solid #777 2px;
|
166
187
|
border-bottom:solid #777 2px;
|
167
188
|
overflow-x:auto;
|
189
|
+
|
190
|
+
code {
|
191
|
+
padding:0 !important;
|
192
|
+
}
|
168
193
|
}
|
169
194
|
|
170
195
|
label {
|
@@ -180,7 +205,7 @@ label {
|
|
180
205
|
color:red;
|
181
206
|
}
|
182
207
|
|
183
|
-
#
|
208
|
+
#comment_nickname, label[for=comment_nickname] {
|
184
209
|
display:none;
|
185
210
|
}
|
186
211
|
|
@@ -230,17 +255,18 @@ table.entries {
|
|
230
255
|
font-size:1.1em;
|
231
256
|
height:32px;
|
232
257
|
line-height:32px;
|
233
|
-
padding:0 10px;
|
258
|
+
padding:0 10px 10px 0;
|
259
|
+
|
260
|
+
.when {
|
261
|
+
font-size:.8em;
|
262
|
+
line-height:1em;
|
263
|
+
}
|
234
264
|
}
|
235
265
|
|
236
266
|
td.icons {
|
237
267
|
width:64px;
|
238
268
|
white-space:nowrap;
|
239
269
|
}
|
240
|
-
|
241
|
-
td.when {
|
242
|
-
text-align:right;
|
243
|
-
}
|
244
270
|
}
|
245
271
|
|
246
272
|
footer {
|
@@ -250,6 +276,19 @@ footer {
|
|
250
276
|
clear:both;
|
251
277
|
}
|
252
278
|
|
279
|
+
.flash-notice, .flash-error {
|
280
|
+
color:green;
|
281
|
+
font-size:1.2em;
|
282
|
+
border:solid 3px green;
|
283
|
+
padding:15px;
|
284
|
+
margin-bottom:10px;
|
285
|
+
}
|
286
|
+
|
287
|
+
.flash-error {
|
288
|
+
color:red;
|
289
|
+
border-color:red;
|
290
|
+
}
|
291
|
+
|
253
292
|
form {
|
254
293
|
label {
|
255
294
|
padding-top:10px;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Jabe
|
2
|
+
class Admin::EntriesController < Admin::BaseController
|
3
|
+
helper_method :entry
|
4
|
+
before_filter :set_is_draft, :only => [:create, :update]
|
5
|
+
|
6
|
+
def index
|
7
|
+
@drafts = Entry.drafts
|
8
|
+
@published = Entry.published.page(params[:page])
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
if entry.save
|
13
|
+
redirect_to(admin_entries_path, :notice => message)
|
14
|
+
else
|
15
|
+
render :new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def update
|
20
|
+
if entry.update_attributes(params[:entry])
|
21
|
+
redirect_to(admin_entries_path, :notice => message)
|
22
|
+
else
|
23
|
+
render :edit
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def destroy
|
28
|
+
entry.destroy
|
29
|
+
redirect_to admin_entries_path
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def entry
|
35
|
+
@entry ||= params[:id].blank? ?
|
36
|
+
Entry.new(params[:entry]) :
|
37
|
+
Entry.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_is_draft
|
41
|
+
params[:entry][:draft] = (params[:commit] =~ /draft/i).present?
|
42
|
+
end
|
43
|
+
|
44
|
+
def message
|
45
|
+
entry.draft ? "Entry was saved as a draft." : "Entry was published."
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Jabe
|
2
|
+
class Admin::SettingsController < Admin::BaseController
|
3
|
+
|
4
|
+
def update
|
5
|
+
if Jabe::SETTINGS.update_attributes(params[:settings])
|
6
|
+
Jabe::SETTINGS.do_updates
|
7
|
+
redirect_to admin_root_path, :notice => 'Settings updated.'
|
8
|
+
else
|
9
|
+
render :edit
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Jabe
|
2
|
+
class CommentsController < Admin::BaseController
|
3
|
+
layout 'application'
|
4
|
+
skip_before_filter :authenticate_admin!, :only => [ :create, :new ]
|
5
|
+
helper_method :entry, :comment
|
6
|
+
|
7
|
+
def create
|
8
|
+
if comment.save
|
9
|
+
comment.send_notification(request)
|
10
|
+
redirect_to entry_path(entry), :notice => 'Your comment was submitted.'
|
11
|
+
else
|
12
|
+
flash[:error] = 'Unable to submit your comment.'
|
13
|
+
render 'entries/show'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def destroy
|
18
|
+
comment.destroy
|
19
|
+
redirect_to entry_path(entry), :notice => 'Comment was deleted.'
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def entry
|
25
|
+
@entry ||= Entry.find(params[:entry_id])
|
26
|
+
end
|
27
|
+
|
28
|
+
def comment
|
29
|
+
@comment ||= params[:id].blank? ?
|
30
|
+
entry.comments.new(params[:comment]) :
|
31
|
+
Comment.find(params[:id])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|