godmin 0.12.1 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b77a64dfd0387ecd63d1b0dc2259a977cefcb664
4
- data.tar.gz: a97772f66980a9d1d9def89509f1d24868337bf0
3
+ metadata.gz: 3bb2915931cb75703a3b3bffc12bb57a9b29cc97
4
+ data.tar.gz: 6c7247808002572bd0fe122615c82dde755be974
5
5
  SHA512:
6
- metadata.gz: 5baf4c943138e0fc2195ca47c710ac0d4a7d4892564ae6a9c3bfedaca6fa7a650a892b12a14e7ba021d4a34db73e4b458fca4c1f5612bf84d83c3a46a48c5e32
7
- data.tar.gz: 924ead99ee3ff13a41c58d10f5dc5bf5b5c2857e8144c28643461e1ff271841e2f770d56fd4b2665d1b32ed5033c243bc4c86fed7a6811dc54a544deaaef66d4
6
+ metadata.gz: 93690b6ab331b871865ebd7a9af79626e7bec7d4f066476c6118c42769855e10da4d83ddaf3d38bc89b10c34f2cc6798231d0c5b6b9d8769271cdc7aee9239d9
7
+ data.tar.gz: 9f7fe59b58bc5032c4734cf9f0e734e4b9b301c76edf9ad0b52b92e55943b98b44c427ce0ba41624a88a8e01431a56a788197744726597dd1c47e55e7ea71b15
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 0.12.2 - 2015-09-07
4
+ Bug fixes
5
+ - Fixes broken sign in page
6
+
3
7
  ### 0.12.1 - 2015-09-07
4
8
  Bug fixes
5
9
  - Fixes issue where column ordering on index table didn't work (https://github.com/varvet/godmin/issues/124)
@@ -30,8 +30,8 @@ module Godmin
30
30
  def template_paths(prefix)
31
31
  [
32
32
  File.join(@engine_wrapper.root, "app/views", resource_path_for_engine(prefix)),
33
- File.join(Godmin::Engine.root, "app/views/godmin", resource_path_for_godmin(prefix)),
34
- File.join(Godmin::Engine.root, "app/views/godmin", default_path_for_godmin(prefix))
33
+ File.join(Godmin::Engine.root, "app/views/godmin", default_path_for_godmin(prefix)),
34
+ File.join(Godmin::Engine.root, "app/views/godmin", resource_path_for_godmin(prefix))
35
35
  ]
36
36
  end
37
37
 
@@ -1,3 +1,3 @@
1
1
  module Godmin
2
- VERSION = "0.12.1"
2
+ VERSION = "0.12.2"
3
3
  end
@@ -0,0 +1,3 @@
1
+ class SecretArticlesController < SecretController
2
+ include Godmin::Resources::ResourceController
3
+ end
@@ -0,0 +1,7 @@
1
+ class SecretController < ApplicationController
2
+ include Godmin::Authentication
3
+
4
+ def admin_user_class
5
+ AdminUser
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ class SessionsController < SecretController
2
+ include Godmin::Authentication::SessionsController
3
+ end
@@ -0,0 +1,7 @@
1
+ class AdminUser < ActiveRecord::Base
2
+ include Godmin::Authentication::User
3
+
4
+ def self.login_column
5
+ :email
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ class SecretArticle < Article
2
+ end
@@ -0,0 +1,9 @@
1
+ class SecretArticleService < ArticleService
2
+ include Godmin::Resources::ResourceService
3
+
4
+ attrs_for_index :id, :title, :published, :created_at
5
+ attrs_for_show :id, :title, :body, :published
6
+ attrs_for_form :title, :body, :published
7
+
8
+ filter :title
9
+ end
@@ -1,5 +1,7 @@
1
1
  Rails.application.routes.draw do
2
2
  resources :articles
3
+ resources :secret_articles
4
+ resource :session, only: [:new, :create, :destroy]
3
5
  root to: "application#welcome"
4
6
  mount Admin::Engine, at: "admin"
5
7
  end
@@ -0,0 +1,10 @@
1
+ class CreateAdminUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :admin_users do |t|
4
+ t.string :email
5
+ t.text :password_digest
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -11,7 +11,14 @@
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: 20150717121532) do
14
+ ActiveRecord::Schema.define(version: 20150907133753) do
15
+
16
+ create_table "admin_users", force: :cascade do |t|
17
+ t.string "email"
18
+ t.text "password_digest"
19
+ t.datetime "created_at", null: false
20
+ t.datetime "updated_at", null: false
21
+ end
15
22
 
16
23
  create_table "articles", force: :cascade do |t|
17
24
  t.string "title"
@@ -0,0 +1,17 @@
1
+ require "test_helper"
2
+
3
+ class SignInTest < ActionDispatch::IntegrationTest
4
+ def test_sign_in_and_out
5
+ AdminUser.create!(email: "admin@example.com", password: "password")
6
+ visit secret_articles_path
7
+ assert_not_equal secret_articles_path, current_path
8
+ fill_in "Email", with: "admin@example.com"
9
+ fill_in "Password", with: "password"
10
+ click_button "Sign in"
11
+ visit secret_articles_path
12
+ assert_equal secret_articles_path, current_path
13
+ click_link "Sign out"
14
+ visit secret_articles_path
15
+ assert_not_equal secret_articles_path, current_path
16
+ end
17
+ end
@@ -22,8 +22,8 @@ module Godmin
22
22
 
23
23
  assert_equal [
24
24
  File.join(@engine_wrapper_1.root, "app/views/resource"),
25
- File.join(Godmin::Engine.root, "app/views/godmin/resource"),
26
- File.join(Godmin::Engine.root, "app/views/godmin/articles")
25
+ File.join(Godmin::Engine.root, "app/views/godmin/articles"),
26
+ File.join(Godmin::Engine.root, "app/views/godmin/resource")
27
27
  ], resolver.template_paths("articles")
28
28
  end
29
29
 
@@ -32,8 +32,8 @@ module Godmin
32
32
 
33
33
  assert_equal [
34
34
  File.join(@engine_wrapper_2.root, "app/views/godmin/resolver_test/admin/resource"),
35
- File.join(Godmin::Engine.root, "app/views/godmin/resource"),
36
- File.join(Godmin::Engine.root, "app/views/godmin/articles")
35
+ File.join(Godmin::Engine.root, "app/views/godmin/articles"),
36
+ File.join(Godmin::Engine.root, "app/views/godmin/resource")
37
37
  ], resolver.template_paths("godmin/resolver_test/admin/articles")
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: godmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Ljungblad
@@ -361,11 +361,17 @@ files:
361
361
  - test/dummy/app/controllers/application_controller.rb
362
362
  - test/dummy/app/controllers/articles_controller.rb
363
363
  - test/dummy/app/controllers/concerns/.keep
364
+ - test/dummy/app/controllers/secret_articles_controller.rb
365
+ - test/dummy/app/controllers/secret_controller.rb
366
+ - test/dummy/app/controllers/sessions_controller.rb
364
367
  - test/dummy/app/helpers/application_helper.rb
365
368
  - test/dummy/app/models/.keep
369
+ - test/dummy/app/models/admin_user.rb
366
370
  - test/dummy/app/models/article.rb
367
371
  - test/dummy/app/models/concerns/.keep
372
+ - test/dummy/app/models/secret_article.rb
368
373
  - test/dummy/app/services/article_service.rb
374
+ - test/dummy/app/services/secret_article_service.rb
369
375
  - test/dummy/app/views/articles/.keep
370
376
  - test/dummy/app/views/articles/columns/.keep
371
377
  - test/dummy/app/views/articles/filters/.keep
@@ -392,6 +398,7 @@ files:
392
398
  - test/dummy/config/initializers/wrap_parameters.rb
393
399
  - test/dummy/config/routes.rb
394
400
  - test/dummy/db/migrate/20150717121532_create_articles.rb
401
+ - test/dummy/db/migrate/20150907133753_create_admin_users.rb
395
402
  - test/dummy/db/schema.rb
396
403
  - test/dummy/lib/assets/.keep
397
404
  - test/dummy/log/.keep
@@ -405,6 +412,7 @@ files:
405
412
  - test/integration/column_overriding_test.rb
406
413
  - test/integration/filter_overriding_test.rb
407
414
  - test/integration/partial_overriding_test.rb
415
+ - test/integration/sign_in_test.rb
408
416
  - test/integration/template_overriding_test.rb
409
417
  - test/integration/welcome_test.rb
410
418
  - test/lib/godmin/engine_wrapper_test.rb
@@ -472,11 +480,17 @@ test_files:
472
480
  - test/dummy/app/controllers/application_controller.rb
473
481
  - test/dummy/app/controllers/articles_controller.rb
474
482
  - test/dummy/app/controllers/concerns/.keep
483
+ - test/dummy/app/controllers/secret_articles_controller.rb
484
+ - test/dummy/app/controllers/secret_controller.rb
485
+ - test/dummy/app/controllers/sessions_controller.rb
475
486
  - test/dummy/app/helpers/application_helper.rb
476
487
  - test/dummy/app/models/.keep
488
+ - test/dummy/app/models/admin_user.rb
477
489
  - test/dummy/app/models/article.rb
478
490
  - test/dummy/app/models/concerns/.keep
491
+ - test/dummy/app/models/secret_article.rb
479
492
  - test/dummy/app/services/article_service.rb
493
+ - test/dummy/app/services/secret_article_service.rb
480
494
  - test/dummy/app/views/articles/.keep
481
495
  - test/dummy/app/views/articles/columns/.keep
482
496
  - test/dummy/app/views/articles/filters/.keep
@@ -503,6 +517,7 @@ test_files:
503
517
  - test/dummy/config/initializers/wrap_parameters.rb
504
518
  - test/dummy/config/routes.rb
505
519
  - test/dummy/db/migrate/20150717121532_create_articles.rb
520
+ - test/dummy/db/migrate/20150907133753_create_admin_users.rb
506
521
  - test/dummy/db/schema.rb
507
522
  - test/dummy/lib/assets/.keep
508
523
  - test/dummy/log/.keep
@@ -516,6 +531,7 @@ test_files:
516
531
  - test/integration/column_overriding_test.rb
517
532
  - test/integration/filter_overriding_test.rb
518
533
  - test/integration/partial_overriding_test.rb
534
+ - test/integration/sign_in_test.rb
519
535
  - test/integration/template_overriding_test.rb
520
536
  - test/integration/welcome_test.rb
521
537
  - test/lib/godmin/engine_wrapper_test.rb