miniblog 1.0.0.beta → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 126730742ab39e8cf2d51ba95ce24582a4561201
4
- data.tar.gz: 6d53653058c0cf6d21cdb75bb3c185857aaa12ee
3
+ metadata.gz: 0de00bc2b3a06487a4deb34c9bff19200bc36a6a
4
+ data.tar.gz: 01d10d1d7ded2925a6ff1f50f034f67e63d1c902
5
5
  SHA512:
6
- metadata.gz: 60b5e143ae016cc4e6d2b0833d0c8e75a322ebfe89de18661de17b42a6be9051d61b1fb13eb70d71e3bdb50cc52fb1f628b5d5df44b8eeac3792e12ea9c5b18c
7
- data.tar.gz: cba34bbf7f90417680cc5bf87b694baff27c62089cf87600c7992ae9c4b9517b2aa01b750f0b446567cdf6904a865e2a5fa33ea3ce584813534a06ffa7965b1c
6
+ metadata.gz: 6a9ab784dffac907b0ff05df85b6604e3154245a6f4b9ef90866faf103bac937c0c38b47d050e9cc08cd4b3eed6c04ca5afe5c96b2847e9c6266611fc0bb4d72
7
+ data.tar.gz: 62d5a647e2f4da72001f882c25619db82759029014dd1ac3ffd17e1cbc22d1789701a819f00f8dfb12ebb9fe52dbee5aa1ccecfb0872907c342633367418750a
@@ -6,6 +6,7 @@ gem "jquery-rails"
6
6
  gem 'nokogiri', '= 1.6.3'
7
7
 
8
8
  gem "rails", "~> 4.1.0"
9
+ gem 'bootstrap-sass'
9
10
 
10
11
  group :assets do
11
12
  gem 'coffee-rails', '~> 4.0.0'
@@ -2,6 +2,9 @@ module Miniblog
2
2
  module Admin
3
3
  class BaseController < Miniblog::ApplicationController
4
4
  before_filter :authenticate_user!
5
+
6
+ def after_post_is_saved
7
+ end
5
8
  end
6
9
  end
7
10
  end
@@ -21,6 +21,7 @@ module Miniblog
21
21
  @post.author = current_user
22
22
  @post.regenerate_permalink
23
23
  if @post.save
24
+ after_post_is_saved
24
25
  redirect_to miniblog.edit_admin_post_path(@post), notice: "Post created succesfully"
25
26
  else
26
27
  render action: :new
@@ -45,6 +46,7 @@ module Miniblog
45
46
  @post.regenerate_permalink
46
47
  @post.save!
47
48
  end
49
+ after_post_is_saved
48
50
  flash[:notice] = "Post updated succesfully"
49
51
  end
50
52
  render action: :edit
@@ -3,8 +3,10 @@ class Miniblog::Admin::StatesController < Miniblog::Admin::BaseController
3
3
  @post = Miniblog::Post.find(params[:post_id])
4
4
  if @post.published?
5
5
  @post.draft
6
+ after_post_is_saved
6
7
  else
7
8
  @post.publish
9
+ after_post_is_saved
8
10
  end
9
11
  redirect_to admin_posts_path
10
12
  end
@@ -0,0 +1,5 @@
1
+ class Miniblog::SitemapController < ApplicationController
2
+ def show
3
+ @posts = Miniblog::Post.published_and_ordered
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ <% if flash[:notice] %>
2
+ <div class="alert alert-success">
3
+ <%= flash[:notice] %>
4
+ </div>
5
+ <% end %>
6
+ <% if flash[:alert] %>
7
+ <div class="alert">
8
+ <%= flash[:alert] %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <%= div_for post, :class => "span12" do %>
2
+ <h1><%= post.title %></h1>
3
+ <h2><%= post.author_email %>
4
+ <div class="body"><%= post.html_body %></div>
5
+ <% end %>
6
+
@@ -0,0 +1 @@
1
+ <%= render @posts %>
@@ -0,0 +1 @@
1
+ <%= render @post %>
@@ -0,0 +1,9 @@
1
+ xml.instruct!
2
+ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
3
+ @posts.each do |post|
4
+ xml.url do
5
+ xml.loc miniblog.post_url(id: post.to_param)
6
+ xml.lastmod post.updated_at.to_s(:miniblog_sitemap)
7
+ end
8
+ end
9
+ end
@@ -1 +1,2 @@
1
- Time::DATE_FORMATS[:miniblog_short] = '%Y-%m-%d'
1
+ Time::DATE_FORMATS[:miniblog_short] = '%Y-%m-%d'
2
+ Time::DATE_FORMATS[:miniblog_sitemap] = '%Y-%m-%dT%H:%M%:z'
@@ -1,6 +1,9 @@
1
1
  Miniblog::Engine.routes.draw do
2
2
  root :to => 'posts#index'
3
3
 
4
+ resources :posts, only: :show
5
+ get 'sitemap.(:format)', to: 'sitemap#show'
6
+
4
7
  namespace :admin do
5
8
  resources :authors, only: :index
6
9
 
@@ -22,5 +25,6 @@ Miniblog::Engine.routes.draw do
22
25
  resources :preview, only: :show
23
26
 
24
27
  root :to => 'posts#index'
28
+
25
29
  end
26
30
  end
@@ -4,7 +4,6 @@ require "carrierwave"
4
4
  require "gravtastic"
5
5
  require "jbuilder"
6
6
  require "redcarpet"
7
- require "slim"
8
7
  require "state_machine"
9
8
 
10
9
  require "generators/miniblog/views_generator"
@@ -5,5 +5,11 @@ module Miniblog
5
5
  initializer :assets do |config|
6
6
  Rails.application.config.assets.precompile += %w(miniblog.css miniblog.js)
7
7
  end
8
+
9
+ config.to_prepare do
10
+ Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
11
+ require_dependency(c)
12
+ end
13
+ end
8
14
  end
9
15
  end
@@ -51,6 +51,16 @@ shared_examples_for "a miniblog", :type => :feature do
51
51
  expect(post.reload.title).to eq 'A NEW post title'
52
52
  end
53
53
 
54
+ it "previews a post" do
55
+ visit admin_posts_path
56
+ within "#post_#{post.id}" do
57
+ click_link 'Edit', match: :first
58
+ end
59
+
60
+ click_link 'Preview'
61
+ expect(page.current_path).to eq admin_preview_path(post)
62
+ end
63
+
54
64
  it "deletes a post" do
55
65
  visit admin_posts_path
56
66
 
@@ -1,3 +1,3 @@
1
1
  module Miniblog
2
- VERSION = '1.0.0.beta'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -25,7 +25,6 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'jquery-rails'
26
26
  s.add_dependency 'jbuilder'
27
27
  s.add_dependency 'redcarpet', '~> 3.2.2'
28
- s.add_dependency 'slim'
29
28
  s.add_dependency 'state_machine', '~> 1.2.0'
30
29
 
31
30
  s.add_development_dependency 'capybara-webkit', '~> 1.5.0'
@@ -0,0 +1,8 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :email
5
+ t.string :name
6
+ end
7
+ end
8
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20140501164642) do
14
+ ActiveRecord::Schema.define(version: 20120219071614) do
15
15
 
16
16
  create_table "miniblog_assets", force: :cascade do |t|
17
17
  t.integer "post_id"
@@ -34,14 +34,6 @@ ActiveRecord::Schema.define(version: 20140501164642) do
34
34
  t.datetime "updated_at"
35
35
  end
36
36
 
37
- create_table "miniblog_status_change_records", force: :cascade do |t|
38
- t.integer "user_id"
39
- t.integer "post_id"
40
- t.string "state"
41
- t.datetime "created_at"
42
- t.datetime "updated_at"
43
- end
44
-
45
37
  create_table "users", force: :cascade do |t|
46
38
  t.string "email"
47
39
  t.string "name"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miniblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Padilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-29 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 3.2.2
111
- - !ruby/object:Gem::Dependency
112
- name: slim
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: state_machine
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -297,6 +283,7 @@ files:
297
283
  - app/controllers/miniblog/admin/transitions_controller.rb
298
284
  - app/controllers/miniblog/application_controller.rb
299
285
  - app/controllers/miniblog/posts_controller.rb
286
+ - app/controllers/miniblog/sitemap_controller.rb
300
287
  - app/helpers/miniblog/admin/posts_helper.rb
301
288
  - app/helpers/miniblog/application_helper.rb
302
289
  - app/models/miniblog/asset.rb
@@ -316,9 +303,11 @@ files:
316
303
  - app/views/miniblog/admin/posts/new.html.erb
317
304
  - app/views/miniblog/admin/posts/new.html.slim
318
305
  - app/views/miniblog/application/_navbar.html.erb
319
- - app/views/miniblog/application/_notices.html.slim
320
- - app/views/miniblog/posts/_post.html.slim
321
- - app/views/miniblog/posts/index.html.slim
306
+ - app/views/miniblog/application/_notices.html.erb
307
+ - app/views/miniblog/posts/_post.html.erb
308
+ - app/views/miniblog/posts/index.html.erb
309
+ - app/views/miniblog/posts/show.html.erb
310
+ - app/views/miniblog/sitemap/show.xml.builder
322
311
  - config/cucumber.yml
323
312
  - config/initializers/date_formats.rb
324
313
  - config/initializers/state_machine.rb
@@ -372,6 +361,7 @@ files:
372
361
  - spec/dummy/config/locales/en.yml
373
362
  - spec/dummy/config/routes.rb
374
363
  - spec/dummy/config/secrets.yml
364
+ - spec/dummy/db/migrate/01_create_users.rb
375
365
  - spec/dummy/db/schema.rb
376
366
  - spec/dummy/db/seed.rb
377
367
  - spec/dummy/lib/assets/.gitkeep
@@ -403,9 +393,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
403
393
  version: '0'
404
394
  required_rubygems_version: !ruby/object:Gem::Requirement
405
395
  requirements:
406
- - - ">"
396
+ - - ">="
407
397
  - !ruby/object:Gem::Version
408
- version: 1.3.1
398
+ version: '0'
409
399
  requirements: []
410
400
  rubyforge_project:
411
401
  rubygems_version: 2.2.2
@@ -449,6 +439,7 @@ test_files:
449
439
  - spec/dummy/config/locales/en.yml
450
440
  - spec/dummy/config/routes.rb
451
441
  - spec/dummy/config/secrets.yml
442
+ - spec/dummy/db/migrate/01_create_users.rb
452
443
  - spec/dummy/db/schema.rb
453
444
  - spec/dummy/db/seed.rb
454
445
  - spec/dummy/lib/assets/.gitkeep
@@ -1,6 +0,0 @@
1
- - if flash[:notice]
2
- .alert.alert-success
3
- = flash[:notice]
4
- - if flash[:alert]
5
- .alert
6
- = flash[:alert]
@@ -1,4 +0,0 @@
1
- = div_for post, :class => "span12" do
2
- h1= post.title
3
- h2= post.author_email
4
- .body= post.html_body
@@ -1 +0,0 @@
1
- = render @posts