chr 0.3.5 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +2 -0
- data/.gitignore +6 -1
- data/.ruby-version +1 -0
- data/.travis.yml +18 -0
- data/README.md +4 -0
- data/Rakefile +17 -2
- data/app/assets/javascripts/chr.coffee +13 -26
- data/app/assets/javascripts/chr/{core/chr.coffee → chr.coffee} +4 -1
- data/app/assets/javascripts/chr/{core/chr_router.coffee → chr_router.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/item.coffee → item.coffee} +2 -1
- data/app/assets/javascripts/chr/{core/list.coffee → list.coffee} +1 -1
- data/app/assets/javascripts/chr/{core/list_config.coffee → list_config.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/list_pagination.coffee → list_pagination.coffee} +15 -4
- data/app/assets/javascripts/chr/{core/list_reorder.coffee → list_reorder.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/list_search.coffee → list_search.coffee} +1 -1
- data/app/assets/javascripts/chr/{core/module.coffee → module.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/utils.coffee → utils.coffee} +0 -0
- data/app/assets/javascripts/chr/{core/view.coffee → view.coffee} +21 -9
- data/app/assets/javascripts/chr/{core/view_local-storage.coffee → view_local-storage.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/array-store.coffee → stores/array.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/object-store.coffee → stores/object.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/rails-array-store.coffee → stores/rails-array.coffee} +0 -0
- data/app/assets/javascripts/{chr/store → stores}/rails-form-object-parser.coffee +4 -1
- data/app/assets/javascripts/{chr/store/rails-object-store.coffee → stores/rails-object.coffee} +0 -0
- data/app/assets/javascripts/{chr/store/rest-array-store.coffee → stores/rest-array.coffee} +5 -2
- data/app/assets/javascripts/{chr/store/rest-object-store.coffee → stores/rest-object.coffee} +0 -0
- data/app/assets/stylesheets/{_chr.scss → chr.scss} +2 -7
- data/app/assets/stylesheets/chr/{_icons.scss → icons.scss} +0 -0
- data/app/assets/stylesheets/chr/{_main.scss → main.scss} +10 -3
- data/app/assets/stylesheets/chr/{_mixins.scss → mixins.scss} +0 -77
- data/app/assets/stylesheets/chr/{_settings.scss → settings.scss} +1 -1
- data/bin/chr +13 -0
- data/bin/rake +16 -0
- data/bin/setup +13 -0
- data/chr.gemspec +41 -21
- data/docs/tests.md +64 -0
- data/lib/chr.rb +10 -2
- data/lib/chr/app_builder.rb +385 -0
- data/lib/chr/generators/app_generator.rb +213 -0
- data/lib/chr/version.rb +3 -1
- data/lib/generators/chr/controller_generator.rb +18 -0
- data/templates/Gemfile.erb +38 -0
- data/templates/Procfile +1 -0
- data/templates/README.md.erb +45 -0
- data/templates/_analytics.html.erb +9 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +12 -0
- data/templates/application.coffee +2 -0
- data/templates/application.scss +1 -0
- data/templates/application.yml +6 -0
- data/templates/application_gitignore +14 -0
- data/templates/application_layout.html.erb.erb +29 -0
- data/templates/asset_sync.rb +28 -0
- data/templates/bin_setup.erb +36 -0
- data/templates/body_class_helper.rb +19 -0
- data/templates/bundler_audit.rake +12 -0
- data/templates/carrierwave.rb +23 -0
- data/templates/character_admin.coffee.erb +28 -0
- data/templates/character_admin.scss +3 -0
- data/templates/character_admin_index.html.erb +2 -0
- data/templates/character_admin_layout.html.erb +21 -0
- data/templates/character_base_controller.rb +16 -0
- data/templates/development_seeds.rb +12 -0
- data/templates/devise_overrides_passwords_controller.rb +10 -0
- data/templates/devise_overrides_passwords_edit.html.erb +30 -0
- data/templates/devise_overrides_passwords_new.html.erb +21 -0
- data/templates/devise_overrides_sessions_controller.rb +12 -0
- data/templates/devise_overrides_sessions_new.html.erb +31 -0
- data/templates/errors.rb +34 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/newrelic.yml.erb +34 -0
- data/templates/puma.rb +18 -0
- data/templates/routes.rb +90 -0
- data/templates/sample.env +6 -0
- data/templates/secrets.yml +14 -0
- data/templates/smtp.rb +9 -0
- data/templates/staging.rb +5 -0
- data/test/factories/article_factory.rb +19 -0
- data/test/files/test.jpg +0 -0
- data/test/integration/article_fullsize_test.rb +33 -0
- data/test/integration/article_test.rb +33 -0
- data/test/integration/magazine_article_test.rb +33 -0
- data/test/integration/restricted_article_test.rb +33 -0
- data/test/integration/sport_article_test.rb +34 -0
- data/test/rails_app/Rakefile +6 -0
- data/test/rails_app/app/assets/javascripts/admin.coffee +137 -0
- data/test/rails_app/app/assets/javascripts/application.js +1 -0
- data/test/rails_app/app/assets/stylesheets/admin.scss +1 -0
- data/test/rails_app/app/assets/stylesheets/application.css +1 -0
- data/test/rails_app/app/controllers/admin/articles_controller.rb +7 -0
- data/test/rails_app/app/controllers/admin/base_controller.rb +8 -0
- data/test/rails_app/app/controllers/application_controller.rb +5 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/models/article.rb +46 -0
- data/test/rails_app/app/uploaders/article_image_uploader.rb +16 -0
- data/test/rails_app/app/views/admin/index.html.erb +4 -0
- data/test/rails_app/app/views/layouts/admin.html.erb +17 -0
- data/test/rails_app/app/views/layouts/application.html.erb +14 -0
- data/test/rails_app/bin/bundle +3 -0
- data/test/rails_app/bin/rails +8 -0
- data/test/rails_app/bin/rake +8 -0
- data/test/rails_app/bin/setup +29 -0
- data/test/rails_app/bin/spring +15 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +36 -0
- data/test/rails_app/config/boot.rb +3 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +38 -0
- data/test/rails_app/config/environments/production.rb +76 -0
- data/test/rails_app/config/environments/test.rb +46 -0
- data/test/rails_app/config/initializers/assets.rb +12 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/carrierwave.rb +5 -0
- data/test/rails_app/config/initializers/cookies_serializer.rb +3 -0
- data/test/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/rails_app/config/initializers/inflections.rb +16 -0
- data/test/rails_app/config/initializers/mime_types.rb +4 -0
- data/test/rails_app/config/initializers/session_store.rb +3 -0
- data/test/rails_app/config/initializers/wrap_parameters.rb +9 -0
- data/test/rails_app/config/locales/en.yml +23 -0
- data/test/rails_app/config/mongoid.yml +9 -0
- data/test/rails_app/config/routes.rb +8 -0
- data/test/rails_app/config/secrets.yml +22 -0
- data/test/rails_app/db/seeds.rb +7 -0
- data/test/rails_app/public/404.html +67 -0
- data/test/rails_app/public/422.html +67 -0
- data/test/rails_app/public/500.html +66 -0
- data/{app/assets/javascripts/form/input-date.coffee → test/rails_app/public/favicon.ico} +0 -0
- data/test/rails_app/public/robots.txt +5 -0
- data/test/support/character_front_end.rb +196 -0
- data/test/support/chr/item.rb +32 -0
- data/test/support/chr/list.rb +31 -0
- data/test/support/chr/list_pagination.rb +163 -0
- data/test/support/chr/list_reorder.rb +46 -0
- data/test/support/chr/list_search.rb +41 -0
- data/test/support/chr/view.rb +112 -0
- data/test/support/stores/array.rb +20 -0
- data/test/support/stores/rest-array.rb +34 -0
- data/test/test_helper.rb +68 -0
- metadata +373 -80
- data/Gruntfile.coffee +0 -101
- data/app/assets/javascripts/form/expandable-group.coffee +0 -30
- data/app/assets/javascripts/form/form.coffee +0 -221
- data/app/assets/javascripts/form/input-checkbox.coffee +0 -83
- data/app/assets/javascripts/form/input-color.coffee +0 -55
- data/app/assets/javascripts/form/input-file.coffee +0 -144
- data/app/assets/javascripts/form/input-form.coffee +0 -171
- data/app/assets/javascripts/form/input-form_reorder.coffee +0 -67
- data/app/assets/javascripts/form/input-hidden.coffee +0 -57
- data/app/assets/javascripts/form/input-list.coffee +0 -154
- data/app/assets/javascripts/form/input-list_reorder.coffee +0 -39
- data/app/assets/javascripts/form/input-list_typeahead.coffee +0 -55
- data/app/assets/javascripts/form/input-password.coffee +0 -32
- data/app/assets/javascripts/form/input-select.coffee +0 -84
- data/app/assets/javascripts/form/input-select2.coffee +0 -33
- data/app/assets/javascripts/form/input-string.coffee +0 -160
- data/app/assets/javascripts/form/input-text.coffee +0 -43
- data/app/assets/javascripts/input-html.coffee +0 -81
- data/app/assets/javascripts/input-markdown.coffee +0 -93
- data/app/assets/javascripts/input-redactor.coffee +0 -1
- data/app/assets/javascripts/redactor/input-redactor.coffee +0 -53
- data/app/assets/javascripts/redactor/input-redactor_character.coffee +0 -83
- data/app/assets/javascripts/redactor/input-redactor_images.coffee +0 -166
- data/app/assets/javascripts/vendor/ace.js +0 -18280
- data/app/assets/javascripts/vendor/jquery.scrollparent.js +0 -14
- data/app/assets/javascripts/vendor/jquery.textarea_autosize.js +0 -55
- data/app/assets/javascripts/vendor/jquery.typeahead.js +0 -1782
- data/app/assets/javascripts/vendor/marked.js +0 -1272
- data/app/assets/javascripts/vendor/mode-html.js +0 -2436
- data/app/assets/javascripts/vendor/mode-markdown.js +0 -2820
- data/app/assets/javascripts/vendor/redactor.fixedtoolbar.js +0 -107
- data/app/assets/javascripts/vendor/select2.js +0 -5274
- data/app/assets/stylesheets/_input-redactor.scss +0 -35
- data/app/assets/stylesheets/form/_expandable-group.scss +0 -16
- data/app/assets/stylesheets/form/_input-select2.scss +0 -94
- data/app/assets/stylesheets/form/_main.scss +0 -180
- data/app/assets/stylesheets/vendor/select2.css +0 -258
- data/bower.json +0 -38
- data/dist/chr.js +0 -5949
- data/dist/input-ace.js +0 -24946
- data/dist/input-redactor.js +0 -1
- data/lib/mongoid/character.rb +0 -30
- data/package.json +0 -10
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: 76a38e5baef0e30f98596606c852231f513fe819a4c0047e96e8358854cb3dbdb1e48c467f5e66ad44bc5aae3f23e2b8d7dac1a2c8f4e3f0205852b06ccc7a21
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: 78638665c878ebebd67037541aa327d44450338cc839a6ee965df76b0420f1ac89ace2007914c1638011bc9ef38405cc67b9f1c7eaa8926060bc85c049812683
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
@@ -0,0 +1,67 @@
|
|
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>
|
@@ -0,0 +1,67 @@
|
|
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>
|
@@ -0,0 +1,66 @@
|
|
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
|
@@ -0,0 +1,196 @@
|
|
1
|
+
#---------------------------------------------------------------------------------
|
2
|
+
## List of functions
|
3
|
+
|
4
|
+
# show_item(factory_name, list_of_modules)
|
5
|
+
# chage_title(factory_name, class_name, list_of_modules)
|
6
|
+
# add_item(factory_name, class_name, list_of_modules)
|
7
|
+
# delete_item(factory_name, class_name, list_of_modules)
|
8
|
+
# open_item_and_close(factory_name, list_of_modules)
|
9
|
+
# search(factory_name, list_of_modules)
|
10
|
+
# search_and_close(factory_name, class_name, list_of_modules)
|
11
|
+
# reorder(factory_name, class_name, list_of_modules)
|
12
|
+
# show_with_parent(factory_name, list_of_modules)
|
13
|
+
# disable_new_item(factory_name, list_of_modules)
|
14
|
+
# disable_delete(factory_name, list_of_modules)
|
15
|
+
# disable_save(factory_name, list_of_modules)
|
16
|
+
# fullsize_view(factory_name, list_of_modules)
|
17
|
+
# add_class_active(factory_name, list_of_modules)
|
18
|
+
# pagination(factory_name, class_name, list_of_modules)
|
19
|
+
# pagination_and_reorder(factory_name, class_name, list_of_modules)
|
20
|
+
# click_back(factory_name, list_of_modules)
|
21
|
+
# chage_position_to_end_and_check_pagination(factory_name, class_name, list_of_modules)
|
22
|
+
# chage_position_to_begin_and_check_pagination(factory_name, class_name, list_of_modules)
|
23
|
+
# chage_position_to_middle_and_check_pagination(factory_name, class_name, list_of_modules)
|
24
|
+
# create_first_item_and_check_pagination(factory_name, class_name, list_of_modules)
|
25
|
+
# create_last_item_on_page_and_check_pagination(factory_name, class_name, list_of_modules)
|
26
|
+
# urlParams(factory_name, class_name, list_of_modules, config)
|
27
|
+
# remove_from_scope(factory_name, class_name, list_of_modules, config)
|
28
|
+
# sortReverse_by_position(factory_name, class_name, list_of_modules)
|
29
|
+
# add_image(factory_name, list_of_modules)
|
30
|
+
# remove_image(factory_name, list_of_modules)
|
31
|
+
|
32
|
+
|
33
|
+
#---------------------------------------------------------------------------------
|
34
|
+
|
35
|
+
Dir[Rails.root.join("../support/**/*.rb")].each{ |f| require f }
|
36
|
+
module CharacterFrontEnd
|
37
|
+
include CharacterListTest
|
38
|
+
include CharacterViewTest
|
39
|
+
include CharacterSearchTest
|
40
|
+
include CharacterReorderTest
|
41
|
+
include CharacterPaginationTest
|
42
|
+
include CharacterRestArrayTest
|
43
|
+
include CharacterArrayTest
|
44
|
+
include CharacterUploaderTest
|
45
|
+
|
46
|
+
def character_front_end(factory_name, class_name, list_of_modules, config)
|
47
|
+
|
48
|
+
show_item(factory_name, list_of_modules)
|
49
|
+
open_item_and_close(factory_name, list_of_modules)
|
50
|
+
add_class_active(factory_name, list_of_modules)
|
51
|
+
|
52
|
+
if config[:disableNewItems]
|
53
|
+
disable_new_item(factory_name, list_of_modules)
|
54
|
+
else
|
55
|
+
if config[:pagination]
|
56
|
+
create_first_item_and_check_pagination(factory_name, class_name, list_of_modules)
|
57
|
+
create_last_item_on_page_and_check_pagination(factory_name, class_name, list_of_modules)
|
58
|
+
end
|
59
|
+
add_item(factory_name, class_name, list_of_modules)
|
60
|
+
end
|
61
|
+
|
62
|
+
if config[:showWithParent]
|
63
|
+
show_with_parent(factory_name, list_of_modules)
|
64
|
+
end
|
65
|
+
|
66
|
+
if config[:searchable]
|
67
|
+
search(factory_name, list_of_modules)
|
68
|
+
search_and_close(factory_name, class_name, list_of_modules)
|
69
|
+
end
|
70
|
+
|
71
|
+
if config[:reorderable]
|
72
|
+
reorder(factory_name, class_name, list_of_modules)
|
73
|
+
if config[:pagination]
|
74
|
+
pagination_and_reorder(factory_name, class_name, list_of_modules)
|
75
|
+
reorder_to_begin_of_list(factory_name, class_name, list_of_modules)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
if config[:disableDelete]
|
80
|
+
disable_delete(factory_name, list_of_modules)
|
81
|
+
else
|
82
|
+
delete_item(factory_name, class_name, list_of_modules)
|
83
|
+
end
|
84
|
+
|
85
|
+
if config[:disableSave]
|
86
|
+
disable_save(factory_name, list_of_modules)
|
87
|
+
else
|
88
|
+
if config[:pagination]
|
89
|
+
chage_position_to_end_and_check_pagination(factory_name, class_name, list_of_modules)
|
90
|
+
chage_position_to_begin_and_check_pagination(factory_name, class_name, list_of_modules)
|
91
|
+
chage_position_to_middle_and_check_pagination(factory_name, class_name, list_of_modules)
|
92
|
+
end
|
93
|
+
chage_title(factory_name, class_name, list_of_modules)
|
94
|
+
end
|
95
|
+
|
96
|
+
if config[:fullsizeView]
|
97
|
+
fullsize_view(factory_name, list_of_modules)
|
98
|
+
end
|
99
|
+
|
100
|
+
if config[:compoundModule]
|
101
|
+
click_back(factory_name, list_of_modules)
|
102
|
+
end
|
103
|
+
|
104
|
+
if config[:pagination]
|
105
|
+
pagination(factory_name, class_name, list_of_modules)
|
106
|
+
end
|
107
|
+
|
108
|
+
if config[:urlParams]
|
109
|
+
urlParams(factory_name, class_name, list_of_modules, config)
|
110
|
+
remove_from_scope(factory_name, class_name, list_of_modules, config)
|
111
|
+
end
|
112
|
+
|
113
|
+
if config[:sortReverse]
|
114
|
+
#TODO -> Double check, for correct work with reorderable and pagination
|
115
|
+
sortReverse_by_position(factory_name, class_name, list_of_modules)
|
116
|
+
end
|
117
|
+
|
118
|
+
if config[:uploaderImage]
|
119
|
+
add_image(factory_name, list_of_modules)
|
120
|
+
remove_image(factory_name, list_of_modules)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
# save_and_open_screenshot
|
126
|
+
|
127
|
+
protected
|
128
|
+
|
129
|
+
def get_path_from_modules_list(list_of_modules)
|
130
|
+
@path = ''
|
131
|
+
list_of_modules.each do |module_name|
|
132
|
+
@path += '/' + module_name
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
def show_form_of_item(list_of_modules, item_id)
|
138
|
+
get_path_from_modules_list(list_of_modules)
|
139
|
+
visit("/admin##{@path}/view/#{item_id}")
|
140
|
+
wait_for_ajax
|
141
|
+
end
|
142
|
+
|
143
|
+
|
144
|
+
def select_last_module_from_list(list_of_modules)
|
145
|
+
path = ''
|
146
|
+
list_of_modules.each do |module_name|
|
147
|
+
path += '/' + module_name
|
148
|
+
find("a[href='##{path}']").click
|
149
|
+
wait_for_ajax
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
def create_n_objects(count, factory_name)
|
155
|
+
@instances_of_class = []
|
156
|
+
n = 0
|
157
|
+
count.times do
|
158
|
+
@instances_of_class[n] = FactoryGirl.create(factory_name)
|
159
|
+
n += 1
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
|
164
|
+
def create_per_page_plus_n_objects(n, factory_name)
|
165
|
+
y = current_window.size[1]
|
166
|
+
@items_per_page = ((y+50)/60)*2
|
167
|
+
@loaded_items = @items_per_page
|
168
|
+
create_n_objects(@items_per_page+n, factory_name)
|
169
|
+
@first_item = @instances_of_class.first
|
170
|
+
@last_item = @instances_of_class.last
|
171
|
+
@last_item_on_first_page = @instances_of_class[@items_per_page-1]
|
172
|
+
@middle_item = @instances_of_class[@items_per_page/2]
|
173
|
+
@before_middle_item = @instances_of_class[(@items_per_page/2)-1]
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
def scroll_to_bottom
|
178
|
+
page.execute_script(%Q{$("div.items").prop("scrollTop", 10000000).trigger('scroll')})
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
def drag_item(from, to)
|
183
|
+
source = find("a[data-id='#{from.id}']").find("div.icon-reorder")
|
184
|
+
target = find("a[data-id='#{to.id}']").find("div.icon-reorder")
|
185
|
+
source.drag_to(target)
|
186
|
+
wait_for_ajax
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
def upload_test_image_and_save
|
191
|
+
page.attach_file('[image]', Rails.root + '../files/test.jpg')
|
192
|
+
find_link('Save').click
|
193
|
+
wait_for_ajax
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|