activeadmin 0.2.2 → 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.
- data/.gitignore +34 -0
- data/.travis.yml +4 -0
- data/.yardopts +8 -0
- data/CHANGELOG.md +177 -0
- data/Gemfile +21 -32
- data/Guardfile +8 -0
- data/README.rdoc +75 -14
- data/Rakefile +7 -100
- data/activeadmin.gemspec +21 -353
- data/{lib/generators/active_admin/install/templates/images → app/assets/images/active_admin}/admin_notes_icon.png +0 -0
- data/app/assets/images/active_admin/datepicker/datepicker-header-bg.png +0 -0
- data/app/assets/images/active_admin/datepicker/datepicker-input-icon.png +0 -0
- data/app/assets/images/active_admin/datepicker/datepicker-next-link-icon.png +0 -0
- data/app/assets/images/active_admin/datepicker/datepicker-nipple.png +0 -0
- data/app/assets/images/active_admin/datepicker/datepicker-prev-link-icon.png +0 -0
- data/{lib/generators/active_admin/install/templates/images → app/assets/images/active_admin}/loading.gif +0 -0
- data/{lib/generators/active_admin/install/templates/images → app/assets/images/active_admin}/nested_menu_arrow.gif +0 -0
- data/{lib/generators/active_admin/install/templates/images → app/assets/images/active_admin}/nested_menu_arrow_dark.gif +0 -0
- data/{lib/generators/active_admin/install/templates/images → app/assets/images/active_admin}/orderable.png +0 -0
- data/app/assets/javascripts/active_admin/base.js +12 -0
- data/{lib/generators/active_admin/install/templates/active_admin_vendor.js → app/assets/javascripts/active_admin/vendor.js} +0 -0
- data/{lib/active_admin/stylesheets/active_admin.scss → app/assets/stylesheets/active_admin/_base.css.scss} +58 -82
- data/{lib/active_admin/stylesheets/active_admin/_forms.scss → app/assets/stylesheets/active_admin/_forms.css.scss} +94 -5
- data/{lib/active_admin/stylesheets/active_admin/_header.scss → app/assets/stylesheets/active_admin/_header.css.scss} +13 -11
- data/app/assets/stylesheets/active_admin/_mixins.css.scss +1 -0
- data/{lib/active_admin/stylesheets/active_admin/_typography.scss → app/assets/stylesheets/active_admin/_typography.css.scss} +0 -0
- data/{lib/active_admin/stylesheets/active_admin/_comments.scss → app/assets/stylesheets/active_admin/components/_comments.css.scss} +0 -0
- data/app/assets/stylesheets/active_admin/components/_date_picker.css.scss +123 -0
- data/app/assets/stylesheets/active_admin/components/_flash_messages.css.scss +38 -0
- data/{lib/active_admin/stylesheets/active_admin/mixins/_all.scss → app/assets/stylesheets/active_admin/mixins/_all.css.scss} +0 -0
- data/{lib/active_admin/stylesheets/active_admin/mixins/_buttons.scss → app/assets/stylesheets/active_admin/mixins/_buttons.css.scss} +0 -0
- data/{lib/active_admin/stylesheets/active_admin/mixins/_gradients.scss → app/assets/stylesheets/active_admin/mixins/_gradients.css.scss} +8 -0
- data/{lib/active_admin/stylesheets/active_admin/mixins/_icons.scss → app/assets/stylesheets/active_admin/mixins/_icons.css.scss} +0 -0
- data/{lib/active_admin/stylesheets/active_admin/mixins/_reset.scss → app/assets/stylesheets/active_admin/mixins/_reset.css.scss} +0 -0
- data/{lib/active_admin/stylesheets/active_admin/mixins/_rounded.scss → app/assets/stylesheets/active_admin/mixins/_rounded.css.scss} +0 -0
- data/{lib/active_admin/stylesheets/active_admin/mixins/_sections.scss → app/assets/stylesheets/active_admin/mixins/_sections.css.scss} +9 -2
- data/{lib/active_admin/stylesheets/active_admin/mixins/_shadows.scss → app/assets/stylesheets/active_admin/mixins/_shadows.css.scss} +1 -1
- data/{lib/active_admin/stylesheets/active_admin/mixins/_variables.scss → app/assets/stylesheets/active_admin/mixins/_variables.css.scss} +12 -3
- data/{lib/active_admin/views/templates/active_admin_dashboard → app/views/active_admin/dashboard}/index.html.arb +0 -0
- data/{lib/active_admin/views/templates → app/views}/active_admin/devise/mailer/reset_password_instructions.html.erb +0 -0
- data/{lib/active_admin/views/templates → app/views}/active_admin/devise/mailer/unlock_instructions.html.erb +0 -0
- data/{lib/active_admin/views/templates → app/views}/active_admin/devise/passwords/edit.html.erb +0 -0
- data/{lib/active_admin/views/templates → app/views}/active_admin/devise/passwords/new.html.erb +0 -0
- data/{lib/active_admin/views/templates → app/views}/active_admin/devise/sessions/new.html.erb +1 -1
- data/{lib/active_admin/views/templates → app/views}/active_admin/devise/shared/_links.erb +0 -0
- data/{lib/active_admin/views/templates → app/views}/active_admin/devise/unlocks/new.html.erb +0 -0
- data/{lib/active_admin/views/templates/active_admin_default → app/views/active_admin/resource}/edit.html.arb +0 -0
- data/app/views/active_admin/resource/index.csv.erb +20 -0
- data/{lib/active_admin/views/templates/active_admin_default → app/views/active_admin/resource}/index.html.arb +0 -0
- data/{lib/active_admin/views/templates/active_admin_default → app/views/active_admin/resource}/new.html.arb +0 -0
- data/{lib/active_admin/views/templates/active_admin_default → app/views/active_admin/resource}/show.html.arb +0 -0
- data/app/views/layouts/active_admin.html.arb +1 -0
- data/{lib/active_admin/views/templates → app/views}/layouts/active_admin_logged_out.html.erb +8 -4
- data/docs/0-installation.md +50 -0
- data/docs/1-general-configuration.md +43 -0
- data/docs/2-resource-customization.md +35 -0
- data/docs/3-index-pages.md +55 -0
- data/docs/3-index-pages/index-as-block.md +16 -0
- data/docs/3-index-pages/index-as-blog.md +61 -0
- data/docs/3-index-pages/index-as-grid.md +21 -0
- data/docs/3-index-pages/index-as-table.md +90 -0
- data/docs/4-csv-format.md +14 -0
- data/docs/5-forms.md +39 -0
- data/docs/6-show-screens.md +22 -0
- data/docs/7-sidebars.md +35 -0
- data/docs/8-custom-actions.md +123 -0
- data/features/comments/commenting.feature +31 -4
- data/features/edit_page.feature +30 -1
- data/features/index/filters.feature +35 -0
- data/features/index/format_as_csv.feature +46 -0
- data/features/index/formats.feature +2 -0
- data/features/index/index_as_block.feature +1 -1
- data/features/index/index_as_grid.feature +1 -1
- data/features/index/index_as_table.feature +2 -0
- data/features/index/index_blank_slate.feature +56 -0
- data/features/index/pagination.feature +0 -6
- data/features/registering_assets.feature +2 -2
- data/features/sidebar_sections.feature +7 -8
- data/features/specifying_actions.feature +72 -1
- data/features/step_definitions/action_item_steps.rb +2 -2
- data/features/step_definitions/additional_web_steps.rb +26 -16
- data/features/step_definitions/attribute_steps.rb +5 -7
- data/features/step_definitions/configuration_steps.rb +9 -9
- data/features/step_definitions/factory_steps.rb +4 -3
- data/features/step_definitions/format_steps.rb +29 -1
- data/features/step_definitions/layout_steps.rb +3 -0
- data/features/step_definitions/menu_steps.rb +2 -2
- data/features/step_definitions/sidebar_steps.rb +1 -5
- data/features/step_definitions/user_steps.rb +8 -2
- data/features/step_definitions/web_steps.rb +82 -90
- data/features/sti_resource.feature +12 -0
- data/features/support/env.rb +12 -10
- data/features/support/paths.rb +2 -0
- data/features/support/selectors.rb +45 -0
- data/lib/active_admin.rb +33 -263
- data/lib/active_admin/application.rb +228 -0
- data/lib/active_admin/arbre.rb +10 -10
- data/lib/active_admin/arbre/{html.rb → builder.rb} +29 -2
- data/lib/active_admin/arbre/context.rb +8 -0
- data/lib/active_admin/arbre/{attributes.rb → html/attributes.rb} +0 -0
- data/lib/active_admin/arbre/{class_list.rb → html/class_list.rb} +0 -0
- data/lib/active_admin/arbre/{collection.rb → html/collection.rb} +0 -0
- data/lib/active_admin/arbre/{document.rb → html/document.rb} +0 -0
- data/lib/active_admin/arbre/{element.rb → html/element.rb} +6 -6
- data/lib/active_admin/arbre/{html5_elements.rb → html/html5_elements.rb} +0 -0
- data/lib/active_admin/arbre/{tag.rb → html/tag.rb} +0 -0
- data/lib/active_admin/arbre/{text_node.rb → html/text_node.rb} +0 -0
- data/lib/active_admin/asset_registration.rb +1 -1
- data/lib/active_admin/callbacks.rb +5 -3
- data/lib/active_admin/comments.rb +3 -3
- data/lib/active_admin/comments/comment.rb +6 -0
- data/lib/active_admin/comments/configuration.rb +8 -6
- data/lib/active_admin/comments/namespace_helper.rb +1 -1
- data/lib/active_admin/comments/views/active_admin_comments.rb +1 -1
- data/lib/active_admin/csv_builder.rb +45 -0
- data/lib/active_admin/dashboards.rb +1 -1
- data/lib/active_admin/dashboards/dashboard_controller.rb +3 -10
- data/lib/active_admin/dependency_checker.rb +28 -0
- data/lib/active_admin/deprecation.rb +36 -0
- data/lib/active_admin/devise.rb +14 -3
- data/lib/active_admin/dsl.rb +26 -4
- data/lib/active_admin/engine.rb +4 -0
- data/lib/active_admin/form_builder.rb +18 -9
- data/lib/active_admin/helpers/scope_chain.rb +23 -0
- data/lib/active_admin/helpers/settings.rb +70 -0
- data/lib/active_admin/locales/cs.yml +34 -0
- data/lib/active_admin/locales/da.yml +28 -0
- data/lib/active_admin/locales/en.yml +40 -0
- data/lib/active_admin/locales/es.yml +40 -0
- data/lib/active_admin/locales/fr.yml +40 -0
- data/lib/active_admin/locales/it.yml +39 -0
- data/lib/active_admin/locales/pl.yml +34 -0
- data/lib/active_admin/locales/pt-BR.yml +41 -0
- data/lib/active_admin/locales/ru.yml +40 -0
- data/lib/active_admin/locales/zh_cn.yml +40 -0
- data/lib/active_admin/menu_item.rb +6 -0
- data/lib/active_admin/namespace.rb +14 -5
- data/lib/active_admin/reloader.rb +30 -0
- data/lib/active_admin/renderer.rb +1 -1
- data/lib/active_admin/resource.rb +45 -88
- data/lib/active_admin/resource/action_items.rb +88 -0
- data/lib/active_admin/resource/menu.rb +45 -0
- data/lib/active_admin/resource/naming.rb +46 -0
- data/lib/active_admin/resource/scopes.rb +33 -0
- data/lib/active_admin/resource/sidebars.rb +36 -0
- data/lib/active_admin/resource_controller.rb +32 -37
- data/lib/active_admin/resource_controller/action_builder.rb +1 -1
- data/lib/active_admin/resource_controller/actions.rb +66 -40
- data/lib/active_admin/resource_controller/callbacks.rb +1 -1
- data/lib/active_admin/resource_controller/collection.rb +9 -14
- data/lib/active_admin/resource_controller/filters.rb +1 -1
- data/lib/active_admin/resource_controller/form.rb +1 -1
- data/lib/active_admin/resource_controller/menu.rb +1 -1
- data/lib/active_admin/resource_controller/page_configurations.rb +2 -2
- data/lib/active_admin/resource_controller/scoping.rb +1 -1
- data/lib/active_admin/resource_controller/sidebars.rb +1 -21
- data/lib/active_admin/router.rb +85 -0
- data/lib/active_admin/sass/active_admin.scss +3 -0
- data/lib/active_admin/sass/css_loader.rb +16 -0
- data/lib/active_admin/sass/helpers.rb +45 -0
- data/lib/active_admin/scope.rb +16 -2
- data/lib/active_admin/sidebar_section.rb +41 -0
- data/lib/active_admin/stylesheets/active_admin/mixins/_utilities.scss +0 -0
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_factory.rb +5 -3
- data/lib/active_admin/view_helpers.rb +1 -2
- data/lib/active_admin/view_helpers/active_admin_application_helper.rb +12 -0
- data/lib/active_admin/view_helpers/auto_link_helper.rb +2 -1
- data/lib/active_admin/view_helpers/display_helper.rb +1 -1
- data/lib/active_admin/view_helpers/filter_form_helper.rb +26 -14
- data/lib/active_admin/view_helpers/form_helper.rb +1 -0
- data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -1
- data/lib/active_admin/views/components/attributes_table.rb +2 -2
- data/lib/active_admin/views/components/blank_slate.rb +17 -0
- data/lib/active_admin/views/components/columns.rb +1 -3
- data/lib/active_admin/views/components/paginated_collection.rb +26 -8
- data/lib/active_admin/views/components/scopes.rb +13 -8
- data/lib/active_admin/views/components/sidebar_section.rb +1 -3
- data/lib/active_admin/views/components/status_tag.rb +55 -0
- data/lib/active_admin/views/components/table_for.rb +25 -6
- data/lib/active_admin/views/header_renderer.rb +20 -4
- data/lib/active_admin/views/index_as_block.rb +12 -7
- data/lib/active_admin/views/index_as_blog.rb +61 -21
- data/lib/active_admin/views/index_as_grid.rb +22 -1
- data/lib/active_admin/views/index_as_table.rb +97 -6
- data/lib/active_admin/views/pages/base.rb +20 -9
- data/lib/active_admin/views/pages/dashboard.rb +7 -4
- data/lib/active_admin/views/pages/edit.rb +3 -2
- data/lib/active_admin/views/pages/index.rb +30 -5
- data/lib/active_admin/views/pages/layout.rb +26 -0
- data/lib/active_admin/views/pages/new.rb +3 -2
- data/lib/active_admin/views/pages/show.rb +1 -1
- data/lib/active_admin/views/tabbed_navigation.rb +94 -0
- data/lib/generators/active_admin/assets/assets_generator.rb +21 -0
- data/lib/generators/active_admin/assets/templates/3.0/active_admin.js +427 -0
- data/lib/generators/active_admin/assets/templates/3.1/active_admin.css.scss +6 -0
- data/lib/generators/active_admin/assets/templates/3.1/active_admin.js +1 -0
- data/lib/generators/active_admin/assets/templates/dashboards.rb +36 -0
- data/lib/generators/active_admin/install/install_generator.rb +2 -4
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +26 -4
- data/lib/generators/active_admin/install/templates/dashboards.rb +4 -2
- data/lib/generators/active_admin/install/templates/migrations/2_move_admin_notes_to_comments.rb +2 -2
- data/script/local +44 -0
- data/script/use_rails +46 -0
- data/spec/integration/belongs_to_spec.rb +1 -1
- data/spec/integration/default_namespace.rb +77 -0
- data/spec/integration/javascript_spec.rb +20 -0
- data/spec/integration/stylesheets_spec.rb +41 -0
- data/spec/spec_helper.rb +21 -11
- data/spec/support/detect_rails_version.rb +10 -0
- data/spec/support/integration_example_group.rb +1 -1
- data/spec/support/jslint.yml +80 -0
- data/spec/support/rails_template.rb +1 -1
- data/spec/support/rails_template_with_data.rb +2 -1
- data/spec/support/templates/cucumber.rb +0 -4
- data/spec/unit/active_admin_spec.rb +8 -44
- data/spec/unit/application_spec.rb +78 -0
- data/spec/unit/arbre/context_spec.rb +22 -0
- data/spec/unit/arbre/html/element_finder_methods_spec.rb +2 -2
- data/spec/unit/arbre/html/element_spec.rb +2 -3
- data/spec/unit/arbre/html/tag_attributes_spec.rb +2 -2
- data/spec/unit/arbre/html/tag_spec.rb +2 -2
- data/spec/unit/arbre/html_spec.rb +2 -3
- data/spec/unit/auto_link_spec.rb +2 -1
- data/spec/unit/belongs_to_spec.rb +2 -1
- data/spec/unit/comments_spec.rb +43 -39
- data/spec/unit/controller_filters_spec.rb +11 -3
- data/spec/unit/csv_builder_spec.rb +83 -0
- data/spec/unit/devise_spec.rb +66 -0
- data/spec/unit/display_name_spec.rb +2 -2
- data/spec/unit/filter_form_builder_spec.rb +6 -3
- data/spec/unit/form_builder_spec.rb +20 -2
- data/spec/unit/generators/install_rails_3_1_spec.rb +16 -0
- data/spec/unit/helpers/scope_chain_spec.rb +36 -0
- data/spec/unit/helpers/settings_spec.rb +30 -0
- data/spec/unit/menu_item_spec.rb +6 -0
- data/spec/unit/namespace_spec.rb +68 -19
- data/spec/unit/rails_spec.rb +43 -0
- data/spec/unit/registration_spec.rb +18 -27
- data/spec/unit/reloader_spec.rb +28 -0
- data/spec/unit/resource/action_items_spec.rb +62 -0
- data/spec/unit/resource/menu_spec.rb +80 -0
- data/spec/unit/resource/naming_spec.rb +64 -0
- data/spec/unit/resource/scopes_spec.rb +30 -0
- data/spec/unit/resource/sidebars_spec.rb +50 -0
- data/spec/unit/resource_controller/collection_spec.rb +1 -1
- data/spec/unit/resource_controller_spec.rb +29 -24
- data/spec/unit/resource_spec.rb +78 -94
- data/spec/unit/sass/helpers_spec.rb +47 -0
- data/spec/unit/scope_spec.rb +11 -1
- data/spec/unit/view_factory_spec.rb +4 -1
- data/spec/unit/{components → views/components}/attributes_table_spec.rb +2 -2
- data/spec/unit/views/components/blank_slate_spec.rb +15 -0
- data/spec/unit/{components → views/components}/columns_spec.rb +2 -2
- data/spec/unit/{components → views/components}/panel_spec.rb +1 -3
- data/spec/unit/{components → views/components}/sidebar_section_spec.rb +3 -3
- data/spec/unit/views/components/status_tag_spec.rb +79 -0
- data/spec/unit/{components → views/components}/table_for_spec.rb +2 -1
- data/spec/unit/views/pages/layout_spec.rb +22 -0
- data/spec/unit/views/tabbed_navigation_spec.rb +125 -0
- data/tasks/docs.rake +39 -0
- data/tasks/test.rake +55 -0
- data/tasks/yard.rake +6 -0
- metadata +310 -189
- data/CHANGELOG.rdoc +0 -76
- data/lib/active_admin/action_items.rb +0 -37
- data/lib/active_admin/sidebar.rb +0 -39
- data/lib/active_admin/stylesheets/active_admin/_flash_messages.scss +0 -13
- data/lib/active_admin/view_helpers/status_tag_helper.rb +0 -13
- data/lib/active_admin/view_helpers/table_helper.rb +0 -12
- data/lib/active_admin/views/tabs_renderer.rb +0 -52
- data/lib/active_admin/views/templates/active_admin_default/index.csv.erb +0 -2
- data/lib/active_admin/views/templates/layouts/active_admin.html.erb +0 -39
- data/lib/generators/active_admin/install/templates/active_admin.js +0 -51
- data/spec/controllers/index_as_csv_spec.rb +0 -35
- data/spec/unit/action_items_spec.rb +0 -27
- data/spec/unit/tabs_renderer_spec.rb +0 -56
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Detects the current version of Rails that is being used
|
|
2
|
+
#
|
|
3
|
+
# You can pass it in as an ENV variable or it will use
|
|
4
|
+
# the current Gemfile.lock to find it
|
|
5
|
+
def detect_rails_version
|
|
6
|
+
return nil unless (File.exists?("Gemfile.lock") || File.symlink?("Gemfile.lock"))
|
|
7
|
+
|
|
8
|
+
File.read("Gemfile.lock").match(/^\W*rails \(([a-z\d.]*)\)/)
|
|
9
|
+
return $1
|
|
10
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# ------------ rake task options ------------
|
|
2
|
+
|
|
3
|
+
# JS files to check by default, if no parameters are passed to rake jslint
|
|
4
|
+
# (you may want to limit this only to your own scripts and exclude any external scripts and frameworks)
|
|
5
|
+
|
|
6
|
+
# this can be overridden by adding 'paths' and 'exclude_paths' parameter to rake command:
|
|
7
|
+
# rake jslint paths=path1,path2,... exclude_paths=library1,library2,...
|
|
8
|
+
|
|
9
|
+
paths:
|
|
10
|
+
- app/assets/javascripts/active_admin/**/*.js
|
|
11
|
+
|
|
12
|
+
exclude_paths:
|
|
13
|
+
- app/assets/javascripts/active_admin/vendor.js
|
|
14
|
+
|
|
15
|
+
# ------------ jslint options ------------
|
|
16
|
+
# see http://www.jslint.com/lint.html#options for more detailed explanations
|
|
17
|
+
|
|
18
|
+
# "enforce" type options (true means potentially more warnings)
|
|
19
|
+
|
|
20
|
+
adsafe: false # true if ADsafe rules should be enforced. See http://www.ADsafe.org/
|
|
21
|
+
bitwise: true # true if bitwise operators should not be allowed
|
|
22
|
+
newcap: true # true if Initial Caps must be used with constructor functions
|
|
23
|
+
eqeqeq: false # true if === should be required (for ALL equality comparisons)
|
|
24
|
+
immed: false # true if immediate function invocations must be wrapped in parens
|
|
25
|
+
nomen: false # true if initial or trailing underscore in identifiers should be forbidden
|
|
26
|
+
onevar: false # true if only one var statement per function should be allowed
|
|
27
|
+
plusplus: false # true if ++ and -- should not be allowed
|
|
28
|
+
regexp: false # true if . and [^...] should not be allowed in RegExp literals
|
|
29
|
+
safe: false # true if the safe subset rules are enforced (used by ADsafe)
|
|
30
|
+
strict: false # true if the ES5 "use strict"; pragma is required
|
|
31
|
+
undef: false # true if variables must be declared before used
|
|
32
|
+
white: false # true if strict whitespace rules apply (see also 'indent' option)
|
|
33
|
+
|
|
34
|
+
# "allow" type options (false means potentially more warnings)
|
|
35
|
+
|
|
36
|
+
cap: false # true if upper case HTML should be allowed
|
|
37
|
+
css: true # true if CSS workarounds should be tolerated
|
|
38
|
+
debug: false # true if debugger statements should be allowed (set to false before going into production)
|
|
39
|
+
es5: false # true if ECMAScript 5 syntax should be allowed
|
|
40
|
+
evil: false # true if eval should be allowed
|
|
41
|
+
forin: true # true if unfiltered 'for in' statements should be allowed
|
|
42
|
+
fragment: true # true if HTML fragments should be allowed
|
|
43
|
+
laxbreak: false # true if statement breaks should not be checked
|
|
44
|
+
on: false # true if HTML event handlers (e.g. onclick="...") should be allowed
|
|
45
|
+
sub: false # true if subscript notation may be used for expressions better expressed in dot notation
|
|
46
|
+
|
|
47
|
+
# other options
|
|
48
|
+
|
|
49
|
+
maxlen: 300 # Maximum line length
|
|
50
|
+
indent: 2 # Number of spaces that should be used for indentation - used only if 'white' option is set
|
|
51
|
+
maxerr: 50 # The maximum number of warnings reported (per file)
|
|
52
|
+
passfail: false # true if the scan should stop on first error (per file)
|
|
53
|
+
# following are relevant only if undef = true
|
|
54
|
+
predef: '' # Names of predefined global variables - comma-separated string or a YAML array
|
|
55
|
+
browser: true # true if the standard browser globals should be predefined
|
|
56
|
+
rhino: false # true if the Rhino environment globals should be predefined
|
|
57
|
+
windows: false # true if Windows-specific globals should be predefined
|
|
58
|
+
widget: false # true if the Yahoo Widgets globals should be predefined
|
|
59
|
+
devel: true # true if functions like alert, confirm, console, prompt etc. are predefined
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# ------------ jslint_on_rails custom lint options (switch to true to disable some annoying warnings) ------------
|
|
63
|
+
|
|
64
|
+
# ignores "missing semicolon" warning at the end of a function; this lets you write one-liners
|
|
65
|
+
# like: x.map(function(i) { return i + 1 }); without having to put a second semicolon inside the function
|
|
66
|
+
lastsemic: false
|
|
67
|
+
|
|
68
|
+
# allows you to use the 'new' expression as a statement (without assignment)
|
|
69
|
+
# so you can call e.g. new Ajax.Request(...), new Effect.Highlight(...) without assigning to a dummy variable
|
|
70
|
+
newstat: false
|
|
71
|
+
|
|
72
|
+
# ignores the "Expected an assignment or function call and instead saw an expression" warning,
|
|
73
|
+
# if the expression contains a proper statement and makes sense; this lets you write things like:
|
|
74
|
+
# element && element.show();
|
|
75
|
+
# valid || other || lastChance || alert('OMG!');
|
|
76
|
+
# selected ? show() : hide();
|
|
77
|
+
# although these will still cause a warning:
|
|
78
|
+
# element && link;
|
|
79
|
+
# selected ? 5 : 10;
|
|
80
|
+
statinexp: false
|
|
@@ -8,7 +8,7 @@ gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *test\n database: db
|
|
|
8
8
|
# Generate some test models
|
|
9
9
|
generate :model, "post title:string body:text published_at:datetime author_id:integer category_id:integer"
|
|
10
10
|
inject_into_file 'app/models/post.rb', " belongs_to :author, :class_name => 'User'\n belongs_to :category\n accepts_nested_attributes_for :author\n", :after => "class Post < ActiveRecord::Base\n"
|
|
11
|
-
generate :model, "user type:string first_name:string last_name:string username:string"
|
|
11
|
+
generate :model, "user type:string first_name:string last_name:string username:string age:integer"
|
|
12
12
|
inject_into_file 'app/models/user.rb', " has_many :posts, :foreign_key => 'author_id'\n", :after => "class User < ActiveRecord::Base\n"
|
|
13
13
|
generate :model, "publisher --migration=false --parent=User"
|
|
14
14
|
generate :model, 'category name:string description:text'
|
|
@@ -12,7 +12,8 @@ append_file "db/seeds.rb", <<-EOF
|
|
|
12
12
|
first, last = name.split(" ")
|
|
13
13
|
User.create! :first_name => first,
|
|
14
14
|
:last_name => last,
|
|
15
|
-
:username => [first,last].join('-').downcase
|
|
15
|
+
:username => [first,last].join('-').downcase,
|
|
16
|
+
:age => rand(80)
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
categories = ["Rock", "Pop Rock", "Alt-Country", "Blues", "Dub-Step"].collect do |name|
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
require File.expand_path('config/environments/test', Rails.root)
|
|
2
2
|
|
|
3
|
-
Rails.application.class.configure do
|
|
4
|
-
config.cache_classes = false
|
|
5
|
-
end
|
|
6
|
-
|
|
7
3
|
# rails/railties/lib/rails/test_help.rb aborts if the environment is not 'test'. (Rails 3.0.0.beta3)
|
|
8
4
|
# We can't run Cucumber/RSpec/Test_Unit tests in different environments then.
|
|
9
5
|
#
|
|
@@ -1,53 +1,17 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
|
-
require 'fileutils'
|
|
3
2
|
|
|
4
3
|
describe ActiveAdmin do
|
|
4
|
+
describe "#default_namespace" do
|
|
5
|
+
it "should delegate to ActiveAdmin.application" do
|
|
6
|
+
ActiveAdmin.application.should_receive(:default_namespace)
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "should remove app/admin from the autoload path to remove the possibility of conflicts" do
|
|
11
|
-
ActiveSupport::Dependencies.autoload_paths.should_not include(File.join(Rails.root, "app/admin"))
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should remove app/admin from the eager load paths (Active Admin deals with loading)" do
|
|
15
|
-
Rails.application.config.eager_load_paths.should_not include(File.join(Rails.root, "app/admin"))
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should default the application name" do
|
|
19
|
-
ActiveAdmin.site_title.should == Rails.application.class.to_s.split('::').first
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "should set the site title" do
|
|
23
|
-
old_title = ActiveAdmin.site_title.dup
|
|
24
|
-
ActiveAdmin.site_title = "New Title"
|
|
25
|
-
ActiveAdmin.site_title.should == "New Title"
|
|
26
|
-
ActiveAdmin.site_title = old_title
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "should have a view factory" do
|
|
30
|
-
ActiveAdmin.view_factory.should be_an_instance_of(ActiveAdmin::ViewFactory)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it "should have admin notes by default" do
|
|
34
|
-
ActiveAdmin.admin_notes.should be_true
|
|
35
|
-
end
|
|
8
|
+
ActiveAdmin.default_namespace
|
|
9
|
+
end
|
|
36
10
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
11
|
+
it "should be deprecated" do
|
|
12
|
+
ActiveAdmin::Deprecation.should_receive(:warn)
|
|
40
13
|
|
|
41
|
-
|
|
42
|
-
it "should load files in the first level directory" do
|
|
43
|
-
ActiveAdmin.files_in_load_path.should include(File.expand_path("app/admin/dashboards.rb", Rails.root))
|
|
44
|
-
end
|
|
45
|
-
it "should load files from subdirectories" do
|
|
46
|
-
FileUtils.mkdir_p(File.expand_path("app/admin/public", Rails.root))
|
|
47
|
-
test_file = File.expand_path("app/admin/public/posts.rb", Rails.root)
|
|
48
|
-
FileUtils.touch(test_file)
|
|
49
|
-
ActiveAdmin.files_in_load_path.should include(test_file)
|
|
14
|
+
ActiveAdmin.default_namespace
|
|
50
15
|
end
|
|
51
16
|
end
|
|
52
|
-
|
|
53
17
|
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
|
|
4
|
+
describe ActiveAdmin::Application do
|
|
5
|
+
|
|
6
|
+
let(:application) do
|
|
7
|
+
ActiveAdmin::Application.new.tap do |app|
|
|
8
|
+
# Manually override the load paths becuase RSpec messes these up
|
|
9
|
+
app.load_paths = [File.expand_path('app/admin', Rails.root)]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should have a default load path of ['app/admin']" do
|
|
14
|
+
application.load_paths.should == [File.expand_path('app/admin', Rails.root)]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should remove app/admin from the autoload path to remove the possibility of conflicts" do
|
|
18
|
+
ActiveSupport::Dependencies.autoload_paths.should_not include(File.join(Rails.root, "app/admin"))
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should remove app/admin from the eager load paths (Active Admin deals with loading)" do
|
|
22
|
+
Rails.application.config.eager_load_paths.should_not include(File.join(Rails.root, "app/admin"))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should store the site's title" do
|
|
26
|
+
application.site_title.should == ""
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should set the site title" do
|
|
30
|
+
application.site_title = "New Title"
|
|
31
|
+
application.site_title.should == "New Title"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should have a view factory" do
|
|
35
|
+
application.view_factory.should be_an_instance_of(ActiveAdmin::ViewFactory)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should have deprecated admin notes by default" do
|
|
39
|
+
application.admin_notes.should be_nil
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should have admin notes in admin namespace by default" do
|
|
43
|
+
application.allow_comments_in.should == [:admin]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe "authentication settings" do
|
|
47
|
+
|
|
48
|
+
it "should have no default current_user_method" do
|
|
49
|
+
application.current_user_method.should == false
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should have no default authentication method" do
|
|
53
|
+
application.authentication_method.should == false
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "should have a logout link path (Devise's default)" do
|
|
57
|
+
application.logout_link_path.should == :destroy_admin_user_session_path
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should have a logout link method (Devise's default)" do
|
|
61
|
+
application.logout_link_method.should == :get
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe "files in load path" do
|
|
66
|
+
it "should load files in the first level directory" do
|
|
67
|
+
application.files_in_load_path.should include(File.expand_path("app/admin/dashboards.rb", Rails.root))
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "should load files from subdirectories" do
|
|
71
|
+
FileUtils.mkdir_p(File.expand_path("app/admin/public", Rails.root))
|
|
72
|
+
test_file = File.expand_path("app/admin/public/posts.rb", Rails.root)
|
|
73
|
+
FileUtils.touch(test_file)
|
|
74
|
+
application.files_in_load_path.should include(test_file)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Arbre::Context do
|
|
4
|
+
|
|
5
|
+
setup_arbre_context!
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
h1 # Add some HTML to the context
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should return a bytesize" do
|
|
12
|
+
current_dom_context.bytesize.should == 10
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should return a length" do
|
|
16
|
+
current_dom_context.length.should == 10
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should not increment the indent_level" do
|
|
20
|
+
current_dom_context.indent_level.should == -1
|
|
21
|
+
end
|
|
22
|
+
end
|
data/spec/unit/auto_link_spec.rb
CHANGED
|
@@ -8,11 +8,12 @@ class AutoLinkMockResource
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe "auto linking resources" do
|
|
11
|
+
include ActiveAdmin::ViewHelpers::ActiveAdminApplicationHelper
|
|
11
12
|
include ActiveAdmin::ViewHelpers::AutoLinkHelper
|
|
12
13
|
include ActiveAdmin::ViewHelpers::DisplayHelper
|
|
13
14
|
|
|
14
15
|
let(:active_admin_config) { AutoLinkMockResource.new(namespace) }
|
|
15
|
-
let(:namespace){ ActiveAdmin::Namespace.new(:admin) }
|
|
16
|
+
let(:namespace){ ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) }
|
|
16
17
|
let(:post){ Post.create! :title => "Hello World" }
|
|
17
18
|
|
|
18
19
|
def admin_post_path(post)
|
|
@@ -4,7 +4,8 @@ module ActiveAdmin
|
|
|
4
4
|
class Resource
|
|
5
5
|
describe BelongsTo do
|
|
6
6
|
|
|
7
|
-
let(:
|
|
7
|
+
let(:application){ ActiveAdmin::Application.new }
|
|
8
|
+
let(:namespace){ Namespace.new(application, :admin) }
|
|
8
9
|
let(:post){ namespace.register(Post) }
|
|
9
10
|
let(:belongs_to){ BelongsTo.new(post, :user) }
|
|
10
11
|
|
data/spec/unit/comments_spec.rb
CHANGED
|
@@ -1,53 +1,57 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
describe "Comments" do
|
|
4
|
+
let(:application){ ActiveAdmin::Application.new }
|
|
5
|
+
|
|
6
|
+
describe "Configuration" do
|
|
7
|
+
it "should have an array of namespaces which allow comments" do
|
|
8
|
+
application.allow_comments_in.should be_an_instance_of(Array)
|
|
9
|
+
end
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
it "should allow comments in the default namespace by default" do
|
|
12
|
+
application.allow_comments_in.should include(application.default_namespace)
|
|
13
|
+
end
|
|
10
14
|
end
|
|
11
|
-
end
|
|
12
15
|
|
|
13
|
-
describe ActiveAdmin::Comment do
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
describe ActiveAdmin::Comment do
|
|
17
|
+
describe "Associations and Validations" do
|
|
18
|
+
it { should belong_to :resource }
|
|
19
|
+
it { should belong_to :author }
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
it { should validate_presence_of :resource_id }
|
|
22
|
+
it { should validate_presence_of :resource_type }
|
|
23
|
+
it { should validate_presence_of :body }
|
|
24
|
+
it { should validate_presence_of :namespace }
|
|
25
|
+
end
|
|
22
26
|
end
|
|
23
|
-
end
|
|
24
27
|
|
|
25
|
-
describe ActiveAdmin::Comments::NamespaceHelper do
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
describe ActiveAdmin::Comments::NamespaceHelper do
|
|
29
|
+
describe "#comments?" do
|
|
30
|
+
it "should have comments if the namespace is in the settings" do
|
|
31
|
+
ns = ActiveAdmin::Namespace.new(application, :admin)
|
|
32
|
+
ns.comments?.should be_true
|
|
33
|
+
end
|
|
34
|
+
it "should not have comments if the namespace is not in the settings" do
|
|
35
|
+
ns = ActiveAdmin::Namespace.new(application, :not_in_comments)
|
|
36
|
+
ns.comments?.should be_false
|
|
37
|
+
end
|
|
34
38
|
end
|
|
35
39
|
end
|
|
36
|
-
end
|
|
37
40
|
|
|
38
|
-
describe ActiveAdmin::Comments::ResourceHelper do
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
describe ActiveAdmin::Comments::ResourceHelper do
|
|
42
|
+
it "should add an attr_accessor :comments to ActiveAdmin::Resource" do
|
|
43
|
+
ns = ActiveAdmin::Namespace.new(application, :admin)
|
|
44
|
+
resource = ActiveAdmin::Resource.new(ns, Post)
|
|
45
|
+
resource.comments.should be_nil
|
|
46
|
+
resource.comments = true
|
|
47
|
+
resource.comments.should be_true
|
|
48
|
+
end
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
it "should not have comment if set to false by in allow_comments_in" do
|
|
51
|
+
ns = ActiveAdmin::Namespace.new(application, application.default_namespace)
|
|
52
|
+
resource = ActiveAdmin::Resource.new(ns, Post)
|
|
53
|
+
resource.comments = false
|
|
54
|
+
resource.comments?.should be_false
|
|
55
|
+
end
|
|
52
56
|
end
|
|
53
57
|
end
|