carnival 0.2.8 → 0.3.0

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.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/javascripts/carnival/vizir_admin.js.erb +7 -3
  3. data/app/controllers/carnival/base_admin_controller.rb +2 -7
  4. data/app/helpers/carnival/base_admin_helper.rb +1 -4
  5. data/app/helpers/carnival/field_renderers/field_renderer.rb +11 -1
  6. data/app/helpers/carnival/field_renderers/many_relation_renderer.rb +0 -7
  7. data/app/helpers/carnival/field_renderers/single_relation_renderer.rb +5 -8
  8. data/app/models/carnival/field.rb +4 -0
  9. data/app/presenters/carnival/base_admin_presenter.rb +55 -38
  10. data/app/presenters/carnival/dsl.rb +1 -1
  11. data/lib/carnival/version.rb +1 -1
  12. metadata +218 -382
  13. data/spec/dummy/README.rdoc +0 -28
  14. data/spec/dummy/Rakefile +0 -6
  15. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  16. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  17. data/spec/dummy/app/controllers/admin/todo_lists_controller.rb +0 -7
  18. data/spec/dummy/app/controllers/admin/todos_controller.rb +0 -7
  19. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  20. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  21. data/spec/dummy/app/models/todo.rb +0 -7
  22. data/spec/dummy/app/models/todo_list.rb +0 -4
  23. data/spec/dummy/app/presenters/admin/todo_list_presenter.rb +0 -13
  24. data/spec/dummy/app/presenters/admin/todo_presenter.rb +0 -32
  25. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  26. data/spec/dummy/bin/bundle +0 -3
  27. data/spec/dummy/bin/rails +0 -4
  28. data/spec/dummy/bin/rake +0 -4
  29. data/spec/dummy/bin/setup +0 -29
  30. data/spec/dummy/config.ru +0 -4
  31. data/spec/dummy/config/application.rb +0 -15
  32. data/spec/dummy/config/boot.rb +0 -5
  33. data/spec/dummy/config/database.yml +0 -25
  34. data/spec/dummy/config/environment.rb +0 -5
  35. data/spec/dummy/config/environments/development.rb +0 -43
  36. data/spec/dummy/config/environments/production.rb +0 -79
  37. data/spec/dummy/config/environments/test.rb +0 -42
  38. data/spec/dummy/config/initializers/assets.rb +0 -11
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  40. data/spec/dummy/config/initializers/carnival_initializer.rb +0 -25
  41. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  42. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  43. data/spec/dummy/config/initializers/inflections.rb +0 -16
  44. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  45. data/spec/dummy/config/initializers/session_store.rb +0 -3
  46. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  47. data/spec/dummy/config/locales/carnival.en.yml +0 -28
  48. data/spec/dummy/config/locales/carnival.pt-br.yml +0 -259
  49. data/spec/dummy/config/locales/en.yml +0 -23
  50. data/spec/dummy/config/routes.rb +0 -11
  51. data/spec/dummy/config/secrets.yml +0 -22
  52. data/spec/dummy/db/migrate/20150316021645_create_todos.rb +0 -10
  53. data/spec/dummy/db/migrate/20150408165317_create_todo_lists.rb +0 -8
  54. data/spec/dummy/db/migrate/20150408165333_add_todo_list_relation_to_todos.rb +0 -5
  55. data/spec/dummy/db/schema.rb +0 -32
  56. data/spec/dummy/public/404.html +0 -67
  57. data/spec/dummy/public/422.html +0 -67
  58. data/spec/dummy/public/500.html +0 -66
  59. data/spec/dummy/public/favicon.ico +0 -0
  60. data/spec/factories/todo_lists_factory.rb +0 -5
  61. data/spec/factories/todos_factory.rb +0 -18
  62. data/spec/features/create_spec.rb +0 -28
  63. data/spec/features/destroy_spec.rb +0 -11
  64. data/spec/features/index/basic_index_spec.rb +0 -14
  65. data/spec/features/index/pagination_spec.rb +0 -19
  66. data/spec/features/index/scope_spec.rb +0 -29
  67. data/spec/features/index/search_spec.rb +0 -28
  68. data/spec/features/show_spec.rb +0 -15
  69. data/spec/features/update_spec.rb +0 -26
  70. data/spec/rails_helper.rb +0 -33
  71. data/spec/spec_helper.rb +0 -9
  72. data/spec/support/features/index_helpers.rb +0 -15
@@ -1,10 +0,0 @@
1
- class CreateTodos < ActiveRecord::Migration
2
- def change
3
- create_table :todos do |t|
4
- t.string :title
5
- t.integer :status, default: 0
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- class CreateTodoLists < ActiveRecord::Migration
2
- def change
3
- create_table :todo_lists do |t|
4
- t.string :name
5
- t.timestamps null: false
6
- end
7
- end
8
- end
@@ -1,5 +0,0 @@
1
- class AddTodoListRelationToTodos < ActiveRecord::Migration
2
- def change
3
- add_reference :todos, :todo_list, index: true
4
- end
5
- end
@@ -1,32 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20150408165333) do
15
-
16
- create_table "todo_lists", force: :cascade do |t|
17
- t.string "name"
18
- t.datetime "created_at", null: false
19
- t.datetime "updated_at", null: false
20
- end
21
-
22
- create_table "todos", force: :cascade do |t|
23
- t.string "title"
24
- t.integer "status", default: 0
25
- t.datetime "created_at"
26
- t.datetime "updated_at"
27
- t.integer "todo_list_id"
28
- end
29
-
30
- add_index "todos", ["todo_list_id"], name: "index_todos_on_todo_list_id"
31
-
32
- end
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/404.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The page you were looking for doesn't exist.</h1>
62
- <p>You may have mistyped the address or the page may have moved.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/422.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The change you wanted was rejected.</h1>
62
- <p>Maybe you tried to change something you didn't have access to.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/500.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>We're sorry, but something went wrong.</h1>
62
- </div>
63
- <p>If you are the application owner check the logs for more information.</p>
64
- </div>
65
- </body>
66
- </html>
File without changes
@@ -1,5 +0,0 @@
1
- FactoryGirl.define do
2
- factory :todo_list do
3
- sequence(:name) { |n| "Name #{n}" }
4
- end
5
- end
@@ -1,18 +0,0 @@
1
- FactoryGirl.define do
2
- factory :todo do
3
- sequence(:title) { |n| "Titlte #{n}" }
4
- todo_list
5
-
6
- trait :todo do
7
- status :todo
8
- end
9
-
10
- trait :doing do
11
- status :doing
12
- end
13
-
14
- trait :done do
15
- status :done
16
- end
17
- end
18
- end
@@ -1,28 +0,0 @@
1
- require 'rails_helper'
2
-
3
- feature 'User creates a new model' do
4
- scenario 'successfully' do
5
- visit admin_todos_path
6
- todo_title = 'Refactor Carnival'
7
- todo_status = 'todo'
8
-
9
- within('.empty-result') { click_on 'New' }
10
- fill_in 'todo_title', with: todo_title
11
- select todo_status, from: 'todo_status'
12
-
13
- expect { click_on 'Create' }.to change { Todo.count }.from(0).to(1)
14
- expect(page).to have_text(todo_title)
15
- expect(page).to have_text(todo_status)
16
- end
17
-
18
- scenario 'incompletely' do
19
- visit admin_todos_path
20
-
21
- within('.empty-result') { click_on 'New' }
22
- fill_in 'todo_title', with: ''
23
-
24
- expect { click_on 'Create' }.to_not change { Todo.count }
25
- expect(current_path).to eq(admin_todos_path)
26
- expect(page).to have_text('Title can\'t be blank')
27
- end
28
- end
@@ -1,11 +0,0 @@
1
- require 'rails_helper'
2
-
3
- feature 'User creates a new model' do
4
- before { create(:todo) }
5
-
6
- scenario 'successfully' do
7
- visit admin_todos_path
8
-
9
- expect { click_on 'Delete' }.to change { Todo.count }.from(1).to(0)
10
- end
11
- end
@@ -1,14 +0,0 @@
1
- require 'rails_helper'
2
-
3
- feature 'User sees existing todos' do
4
- let!(:todos) { create_pair(:todo) }
5
-
6
- scenario 'successfully' do
7
- visit admin_todos_path
8
-
9
- todos.each do |todo|
10
- expect(page).to have_selector('td', text: todo.id)
11
- expect(page).to have_selector('td', text: todo.title)
12
- end
13
- end
14
- end
@@ -1,19 +0,0 @@
1
- require 'rails_helper'
2
-
3
- feature 'User paginates existing todos', js: true do
4
- let!(:todo_count) { 51 }
5
- let!(:todos) { create_list(:todo, todo_count) }
6
- let!(:last_todo) { todos.last }
7
-
8
- scenario 'successfully' do
9
- visit admin_todos_path
10
-
11
- expect(page).to have_text("Total: #{todo_count}")
12
-
13
- find('a', text: 'Next »').click
14
-
15
- expect(page).to have_selector('td', text: last_todo.id)
16
- expect(page).to have_selector('td', text: last_todo.title)
17
- expect(page).to have_selector('span.carnival-selected-page-button', text: '2')
18
- end
19
- end
@@ -1,29 +0,0 @@
1
- require 'rails_helper'
2
-
3
- feature 'User sees scoped data' do
4
- let!(:todo_todos) { create_pair(:todo, :todo) }
5
- let!(:doing_todos) { create_list(:todo, 3, :doing) }
6
- let!(:done_todos) { create_pair(:todo, :done) }
7
-
8
- scenario 'successfully', js: true do
9
- visit admin_todos_path
10
-
11
- find('a', text: 'Todo (2)').click
12
-
13
- page_should_have_todos todo_todos
14
- page_should_not_have_todos doing_todos
15
- page_should_not_have_todos done_todos
16
-
17
- find('a', text: 'Doing (3)').click
18
-
19
- page_should_have_todos doing_todos
20
- page_should_not_have_todos todo_todos
21
- page_should_not_have_todos done_todos
22
-
23
- find('a', text: 'Done (2)').click
24
-
25
- page_should_have_todos done_todos
26
- page_should_not_have_todos todo_todos
27
- page_should_not_have_todos doing_todos
28
- end
29
- end
@@ -1,28 +0,0 @@
1
- require 'rails_helper'
2
-
3
- feature 'User filters existing todos', js: true do
4
- let!(:search_todo) { create(:todo) }
5
- let!(:missing_todo) { create(:todo) }
6
-
7
- scenario 'successfully' do
8
- visit admin_todos_path
9
-
10
- click_on 'Advanced Search'
11
- fill_in 'advanced_search[title]', with: search_todo.title
12
- click_on 'Search'
13
-
14
- expect(page).to have_text(search_todo.title)
15
- expect(page).to have_no_text(missing_todo.title)
16
- end
17
-
18
- scenario 'User filter by todo_list name' do
19
- visit admin_todos_path
20
-
21
- click_on 'Advanced Search'
22
- fill_in 'advanced_search[todo_list.name]', with: search_todo.todo_list.name
23
- click_on 'Search'
24
-
25
- expect(page).to have_text(search_todo.title)
26
- expect(page).to have_no_text(missing_todo.title)
27
- end
28
- end
@@ -1,15 +0,0 @@
1
- require 'rails_helper'
2
-
3
- feature 'User sees a specific todos' do
4
- let!(:todo) { create(:todo) }
5
-
6
- scenario 'successfully' do
7
- visit admin_todos_path
8
-
9
- click_on 'View'
10
-
11
- expect(current_path).to eq(admin_todo_path(todo.id))
12
- expect(page).to have_text(todo.id)
13
- expect(page).to have_text(todo.title)
14
- end
15
- end