netzke-basepack 0.7.7 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +15 -10
- data/{CHANGELOG.rdoc → CHANGELOG.md} +146 -110
- data/LICENSE +7 -1
- data/README.md +47 -56
- data/Rakefile +5 -5
- data/config/before-travis.sh +10 -0
- data/javascripts/basepack.js +0 -130
- data/javascripts/netzkeremotecombo.js +59 -0
- data/lib/netzke/basepack.rb +9 -14
- data/lib/netzke/basepack/accordion.rb +45 -0
- data/lib/netzke/basepack/active_record.rb +12 -0
- data/lib/netzke/basepack/active_record/relation_extensions.rb +27 -0
- data/lib/netzke/basepack/columns.rb +309 -0
- data/lib/netzke/basepack/data_accessor.rb +22 -12
- data/lib/netzke/basepack/data_adapters/abstract_adapter.rb +75 -11
- data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +154 -49
- data/lib/netzke/basepack/fields.rb +162 -0
- data/lib/netzke/basepack/form.rb +136 -0
- data/lib/netzke/basepack/{form_panel → form}/javascripts/comma_list_cbg.js +0 -1
- data/lib/netzke/basepack/{form_panel/javascripts/form_panel.js → form/javascripts/form.js} +20 -26
- data/lib/netzke/basepack/{form_panel → form}/javascripts/n_radio_group.js +0 -1
- data/lib/netzke/basepack/{form_panel → form}/javascripts/readonly_mode.js +0 -0
- data/lib/netzke/basepack/form/services.rb +115 -0
- data/lib/netzke/basepack/{form_panel → form}/stylesheets/readonly_mode.css +0 -0
- data/lib/netzke/basepack/grid.rb +355 -0
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/advanced_search.js +1 -1
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/check_column_fix.js +0 -0
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/edit_in_form.js +3 -3
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/event_handling.js +5 -2
- data/lib/netzke/basepack/{grid_panel/javascripts/grid_panel.js → grid/javascripts/grid.js} +120 -132
- data/lib/netzke/basepack/{grid_panel → grid}/javascripts/misc.js +0 -0
- data/lib/netzke/basepack/grid/services.rb +216 -0
- data/lib/netzke/basepack/item_persistence.rb +44 -0
- data/lib/netzke/basepack/item_persistence/events_plugin.rb +47 -0
- data/lib/netzke/basepack/{paging_form_panel.rb → paging_form.rb} +24 -30
- data/lib/netzke/basepack/{paging_form_panel/javascripts/paging_form_panel.js → paging_form/javascripts/paging_form.js} +2 -4
- data/lib/netzke/basepack/query_builder.rb +44 -73
- data/lib/netzke/basepack/query_builder/javascripts/query_builder.js +16 -2
- data/lib/netzke/basepack/record_form_window.rb +67 -0
- data/lib/netzke/basepack/search_panel.rb +22 -24
- data/lib/netzke/basepack/search_panel/javascripts/condition_field.js +2 -2
- data/lib/netzke/basepack/search_window.rb +47 -53
- data/lib/netzke/basepack/simple_app.rb +10 -13
- data/lib/netzke/basepack/simple_app/javascripts/simple_app.js +2 -8
- data/lib/netzke/basepack/tab_panel.rb +5 -4
- data/lib/netzke/basepack/tab_panel/javascripts/tab_panel.js +5 -5
- data/lib/netzke/basepack/version.rb +2 -2
- data/lib/netzke/basepack/viewport.rb +16 -0
- data/lib/netzke/basepack/window.rb +27 -18
- data/lib/netzke/basepack/window/javascripts/window.js +7 -1
- data/lib/netzke/basepack/wrap_lazy_loaded.rb +18 -18
- data/locales/en.yml +40 -24
- data/netzke-basepack.gemspec +51 -82
- data/stylesheets/basepack.css +0 -41
- data/test/basepack_test_app/Gemfile +9 -46
- data/test/basepack_test_app/Gemfile.lock +61 -96
- data/test/basepack_test_app/app/components/author_form.rb +8 -5
- data/test/basepack_test_app/app/components/author_grid.rb +2 -2
- data/test/basepack_test_app/app/components/book_form.rb +34 -31
- data/test/basepack_test_app/app/components/book_form_with_defaults.rb +6 -7
- data/test/basepack_test_app/app/components/book_form_with_file_upload.rb +10 -0
- data/test/basepack_test_app/app/components/book_form_with_nested_attributes.rb +5 -6
- data/test/basepack_test_app/app/components/book_grid.rb +19 -8
- data/test/basepack_test_app/app/components/book_grid_filtering.rb +4 -7
- data/test/basepack_test_app/app/components/book_grid_loader.rb +28 -15
- data/test/basepack_test_app/app/components/book_grid_with_custom_columns.rb +45 -21
- data/test/basepack_test_app/app/components/book_grid_with_default_values.rb +26 -8
- data/test/basepack_test_app/app/components/book_grid_with_excluded_columns.rb +11 -0
- data/test/basepack_test_app/app/components/book_grid_with_extra_feedback.rb +2 -2
- data/test/basepack_test_app/app/components/book_grid_with_extra_filters.rb +7 -6
- data/test/basepack_test_app/app/components/book_grid_with_mass_assignment_security.rb +9 -0
- data/test/basepack_test_app/app/components/book_grid_with_nested_attributes.rb +9 -9
- data/test/basepack_test_app/app/components/book_grid_with_overridden_columns.rb +5 -3
- data/test/basepack_test_app/app/components/book_grid_with_paging.rb +6 -8
- data/test/basepack_test_app/app/components/book_grid_with_persistence.rb +6 -4
- data/test/basepack_test_app/app/components/book_grid_with_scope.rb +6 -0
- data/test/basepack_test_app/app/components/book_grid_with_scoped_authors.rb +10 -7
- data/test/basepack_test_app/app/components/book_grid_with_virtual_attributes.rb +21 -13
- data/test/basepack_test_app/app/components/book_paging_form.rb +21 -0
- data/test/basepack_test_app/app/components/book_query_builder.rb +7 -6
- data/test/basepack_test_app/app/components/book_with_custom_primary_key_grid.rb +6 -7
- data/test/basepack_test_app/app/components/books_bound_to_author.rb +9 -7
- data/test/basepack_test_app/app/components/border_layout_panel_with_persistence.rb +12 -0
- data/test/basepack_test_app/app/components/double_book_grid.rb +19 -14
- data/test/basepack_test_app/app/components/form_without_model.rb +15 -16
- data/test/basepack_test_app/app/components/grid_with_initial_sorting.rb +7 -0
- data/test/basepack_test_app/app/components/grid_with_inline_data.rb +7 -0
- data/test/basepack_test_app/app/components/paging_form_with_search.rb +2 -2
- data/test/basepack_test_app/app/components/panel_with_persistent_regions.rb +35 -0
- data/test/basepack_test_app/app/components/query_builder.rb +7 -0
- data/test/basepack_test_app/app/components/simple_panel.rb +16 -11
- data/test/basepack_test_app/app/components/simple_window.rb +7 -6
- data/test/basepack_test_app/app/components/some_accordion.rb +18 -0
- data/test/basepack_test_app/app/components/some_auth_app.rb +5 -5
- data/test/basepack_test_app/app/components/some_border_layout.rb +20 -20
- data/test/basepack_test_app/app/components/some_search_panel.rb +6 -0
- data/test/basepack_test_app/app/components/some_simple_app.rb +30 -16
- data/test/basepack_test_app/app/components/some_tab_panel.rb +18 -15
- data/test/basepack_test_app/app/components/user_form.rb +18 -16
- data/test/basepack_test_app/app/components/user_form_with_default_fields.rb +5 -6
- data/test/basepack_test_app/app/components/user_grid.rb +11 -6
- data/test/basepack_test_app/app/components/user_grid_with_customized_form_fields.rb +5 -3
- data/test/basepack_test_app/app/components/window_component_loader.rb +25 -21
- data/test/basepack_test_app/app/models/address.rb +0 -26
- data/test/basepack_test_app/app/models/author.rb +0 -31
- data/test/basepack_test_app/app/models/book.rb +1 -42
- data/test/basepack_test_app/app/models/book_with_custom_primary_key.rb +1 -23
- data/test/basepack_test_app/app/models/role.rb +0 -21
- data/test/basepack_test_app/app/models/user.rb +0 -24
- data/test/basepack_test_app/app/views/layouts/components.html.erb +1 -1
- data/test/basepack_test_app/config/application.rb +1 -1
- data/test/basepack_test_app/config/database.yml.travis +2 -6
- data/test/basepack_test_app/config/initializers/netzke.rb +1 -6
- data/test/basepack_test_app/db/schema.rb +14 -14
- data/test/basepack_test_app/features/accordion_panel.feature +2 -2
- data/test/basepack_test_app/features/form_panel.feature +7 -7
- data/test/basepack_test_app/features/grid_panel.feature +93 -39
- data/test/basepack_test_app/features/grid_panel_with_custom_primary_key.feature +2 -1
- data/test/basepack_test_app/features/grid_sorting.feature +30 -6
- data/test/basepack_test_app/features/paging_form_panel.feature +7 -7
- data/test/basepack_test_app/features/persistent_regions.feature +30 -0
- data/test/basepack_test_app/features/search_in_grid.feature +5 -5
- data/test/basepack_test_app/features/simple_app.feature +6 -7
- data/test/basepack_test_app/features/step_definitions/form_panel_steps.rb +1 -1
- data/test/basepack_test_app/features/step_definitions/generic_steps.rb +109 -4
- data/test/basepack_test_app/features/step_definitions/grid_panel_steps.rb +8 -10
- data/test/basepack_test_app/features/step_definitions/window_steps.rb +27 -0
- data/test/basepack_test_app/features/tab_panel.feature +1 -1
- data/test/basepack_test_app/features/window.feature +17 -0
- data/test/unit/accordion_panel_test.rb +2 -2
- data/test/unit/grid_panel_test.rb +4 -4
- metadata +57 -83
- data/TODO.rdoc +0 -8
- data/lib/generators/netzke/basepack_generator.rb +0 -10
- data/lib/generators/netzke/templates/assets/ts-checkbox.gif +0 -0
- data/lib/generators/netzke/templates/create_netzke_field_lists.rb +0 -18
- data/lib/netzke/active_record.rb +0 -20
- data/lib/netzke/active_record/attributes.rb +0 -259
- data/lib/netzke/active_record/combobox_options.rb +0 -16
- data/lib/netzke/active_record/relation_extensions.rb +0 -37
- data/lib/netzke/basepack/accordion_panel.rb +0 -39
- data/lib/netzke/basepack/action_column.rb +0 -68
- data/lib/netzke/basepack/action_column/javascripts/action_column.js +0 -61
- data/lib/netzke/basepack/auth_app.rb +0 -159
- data/lib/netzke/basepack/basic_app.rb +0 -7
- data/lib/netzke/basepack/border_layout_panel.rb +0 -53
- data/lib/netzke/basepack/border_layout_panel/javascripts/border_layout_panel.js +0 -40
- data/lib/netzke/basepack/data_adapters/data_mapper_adapter.rb +0 -264
- data/lib/netzke/basepack/data_adapters/sequel_adapter.rb +0 -260
- data/lib/netzke/basepack/form_panel.rb +0 -144
- data/lib/netzke/basepack/form_panel/fields.rb +0 -208
- data/lib/netzke/basepack/form_panel/javascripts/misc.js +0 -4
- data/lib/netzke/basepack/form_panel/services.rb +0 -142
- data/lib/netzke/basepack/grid_panel.rb +0 -441
- data/lib/netzke/basepack/grid_panel/columns.rb +0 -400
- data/lib/netzke/basepack/grid_panel/javascripts/rows-dd.js +0 -281
- data/lib/netzke/basepack/grid_panel/record_form_window.rb +0 -41
- data/lib/netzke/basepack/grid_panel/services.rb +0 -235
- data/lib/netzke/basepack/panel.rb +0 -11
- data/lib/netzke/basepack/wrapper.rb +0 -28
- data/lib/netzke/data_mapper.rb +0 -18
- data/lib/netzke/data_mapper/attributes.rb +0 -273
- data/lib/netzke/data_mapper/combobox_options.rb +0 -11
- data/lib/netzke/data_mapper/relation_extensions.rb +0 -38
- data/lib/netzke/sequel.rb +0 -18
- data/lib/netzke/sequel/attributes.rb +0 -274
- data/lib/netzke/sequel/combobox_options.rb +0 -10
- data/lib/netzke/sequel/relation_extensions.rb +0 -40
- data/locales/zh-cn.yml +0 -79
- data/test/basepack_test_app/app/components/book_form_with_custom_fields.rb +0 -21
- data/test/basepack_test_app/app/components/book_grid_with_column_actions.rb +0 -15
- data/test/basepack_test_app/app/components/book_grid_with_defaults.rb +0 -6
- data/test/basepack_test_app/app/components/book_paging_form_panel.rb +0 -22
- data/test/basepack_test_app/app/components/generic_user_form.rb +0 -12
- data/test/basepack_test_app/app/components/simple_accordion.rb +0 -11
- data/test/basepack_test_app/app/components/simple_tab_panel.rb +0 -11
- data/test/basepack_test_app/app/components/simple_wrapper.rb +0 -7
- data/test/basepack_test_app/app/components/some_accordion_panel.rb +0 -22
- data/test/basepack_test_app/app/presenters/forms/generic_user.rb +0 -6
- data/test/basepack_test_app/app/views/components/loadable_window.html.erb +0 -9
- data/test/basepack_test_app/app/views/components/simple_panel.html.erb +0 -1
- data/test/basepack_test_app/features/components_in_view.feature +0 -11
- data/test/basepack_test_app/features/simple_panel.feature +0 -11
- data/test/basepack_test_app/features/validations_in_grid.feature +0 -13
- data/test/basepack_test_app/features/virtual_attributes.feature +0 -16
- data/test/basepack_test_app/spec/components/form_panel_spec.rb +0 -53
- data/test/basepack_test_app/spec/components/grid_panel_spec.rb +0 -10
- data/test/basepack_test_app/spec/data_adapter/adapter_spec.rb +0 -68
- data/test/basepack_test_app/spec/data_adapter/attributes_spec.rb +0 -56
- data/test/basepack_test_app/spec/data_adapter/relation_extensions_spec.rb +0 -125
- data/test/basepack_test_app/spec/factories.rb +0 -28
- data/test/basepack_test_app/spec/spec_helper.rb +0 -39
@@ -1,8 +1,7 @@
|
|
1
|
-
class UserFormWithDefaultFields < Netzke::Basepack::
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
}
|
1
|
+
class UserFormWithDefaultFields < Netzke::Basepack::Form
|
2
|
+
def configure(c)
|
3
|
+
c.model = "User"
|
4
|
+
c.record = User.first
|
5
|
+
super
|
7
6
|
end
|
8
7
|
end
|
@@ -1,8 +1,13 @@
|
|
1
|
-
class UserGrid < Netzke::Basepack::
|
2
|
-
|
3
|
-
|
1
|
+
class UserGrid < Netzke::Basepack::Grid
|
2
|
+
def configure(c)
|
3
|
+
c.model = "User"
|
4
|
+
c.title = "Users"
|
5
|
+
super
|
6
|
+
end
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
# The way to make the grid use a custom form
|
9
|
+
def preconfigure_record_window(c)
|
10
|
+
super
|
11
|
+
c.form_config.klass = UserForm
|
12
|
+
end
|
8
13
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
-
class UserGridWithCustomizedFormFields < Netzke::Basepack::
|
2
|
-
|
3
|
-
|
1
|
+
class UserGridWithCustomizedFormFields < Netzke::Basepack::Grid
|
2
|
+
def configure(c)
|
3
|
+
c.title = "Users"
|
4
|
+
c.model = "User"
|
5
|
+
end
|
4
6
|
|
5
7
|
def default_fields_for_forms
|
6
8
|
[
|
@@ -1,27 +1,31 @@
|
|
1
1
|
class WindowComponentLoader < Netzke::Base
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}]
|
14
|
-
}
|
2
|
+
|
3
|
+
component :some_window do |c|
|
4
|
+
c.persistence = true
|
5
|
+
c.klass = Netzke::Basepack::Window
|
6
|
+
c.title = "Some Window Component"
|
7
|
+
c.width = 300
|
8
|
+
c.height = 200
|
9
|
+
c.x = 100
|
10
|
+
c.y = 80
|
11
|
+
c.modal = true
|
12
|
+
end
|
15
13
|
|
16
14
|
action :load_window
|
17
15
|
|
18
|
-
|
16
|
+
def configure(c)
|
17
|
+
super
|
18
|
+
c.bbar = [:load_window]
|
19
|
+
end
|
20
|
+
|
21
|
+
js_configure do |c|
|
22
|
+
c.on_load_window = <<-JS
|
23
|
+
function(params){
|
24
|
+
this.netzkeLoadComponent("some_window", {callback: function(w){
|
25
|
+
w.show();
|
26
|
+
}});
|
27
|
+
}
|
28
|
+
JS
|
29
|
+
end
|
19
30
|
|
20
|
-
js_method :on_load_window, <<-JS
|
21
|
-
function(params){
|
22
|
-
this.loadNetzkeComponent({name: "some_window", callback: function(w){
|
23
|
-
w.show();
|
24
|
-
}});
|
25
|
-
}
|
26
|
-
JS
|
27
31
|
end
|
@@ -1,29 +1,3 @@
|
|
1
|
-
if defined? DataMapper::Resource
|
2
|
-
|
3
|
-
class Address
|
4
|
-
include DataMapper::Resource
|
5
|
-
property :id, Serial
|
6
|
-
belongs_to :user
|
7
|
-
property :street, String
|
8
|
-
property :city, String
|
9
|
-
property :postcode, String
|
10
|
-
property :created_at, DateTime
|
11
|
-
property :updated_at, DateTime
|
12
|
-
end
|
13
|
-
|
14
|
-
elsif defined? Sequel::Model
|
15
|
-
|
16
|
-
class Address < Sequel::Model
|
17
|
-
# although this is one_to_one, according to Sequel docs,
|
18
|
-
# the model containing the foreign key should have many_to_one
|
19
|
-
# and the other model should have one_to_one
|
20
|
-
many_to_one :user
|
21
|
-
end
|
22
|
-
|
23
|
-
else
|
24
|
-
|
25
1
|
class Address < ActiveRecord::Base
|
26
2
|
belongs_to :user
|
27
3
|
end
|
28
|
-
|
29
|
-
end
|
@@ -1,38 +1,7 @@
|
|
1
|
-
if defined? DataMapper::Resource
|
2
|
-
|
3
|
-
class Author
|
4
|
-
include DataMapper::Resource
|
5
|
-
property :id, Serial
|
6
|
-
property :first_name, String
|
7
|
-
property :last_name, String
|
8
|
-
property :created_at, DateTime
|
9
|
-
property :updated_at, DateTime
|
10
|
-
has n, :books
|
11
|
-
end
|
12
|
-
|
13
|
-
|
14
|
-
elsif defined? Sequel::Model
|
15
|
-
|
16
|
-
class Author < Sequel::Model
|
17
|
-
one_to_many :books
|
18
|
-
end
|
19
|
-
|
20
|
-
else
|
21
|
-
|
22
1
|
class Author < ActiveRecord::Base
|
23
2
|
has_many :books
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
# ORM-agnostic bits
|
29
|
-
class Author
|
30
|
-
|
31
3
|
# virtual attribute
|
32
4
|
def name
|
33
5
|
"#{last_name}, #{first_name}"
|
34
6
|
end
|
35
|
-
|
36
|
-
netzke_attribute :name
|
37
|
-
|
38
7
|
end
|
@@ -1,49 +1,8 @@
|
|
1
|
-
if defined? DataMapper::Resource
|
2
|
-
|
3
|
-
class Book
|
4
|
-
include DataMapper::Resource
|
5
|
-
property :id, Serial
|
6
|
-
belongs_to :author, :required => false
|
7
|
-
validates_presence_of :title, :message => "Title can't be blank"
|
8
|
-
property :title, String
|
9
|
-
property :exemplars, Integer
|
10
|
-
property :digitized, Boolean
|
11
|
-
property :notes, Text
|
12
|
-
property :tags, String
|
13
|
-
property :rating, Integer
|
14
|
-
property :created_at, DateTime
|
15
|
-
property :updated_at, DateTime
|
16
|
-
property :last_read_at, DateTime
|
17
|
-
property :published_on, Date
|
18
|
-
|
19
|
-
def self.sorted_by_author_name dir
|
20
|
-
all :order => [ author.last_name.send(dir), author.first_name.send(dir) ], :links => [ relationships[:author].inverse ]
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
elsif defined? Sequel::Model
|
26
|
-
|
27
|
-
class Book < Sequel::Model
|
28
|
-
many_to_one :author
|
29
|
-
|
30
|
-
def_dataset_method(:sorted_by_author_name) do |dir|
|
31
|
-
eager_graph(:author).order_append(:author__last_name.send(dir), :author__first_name.send(dir))
|
32
|
-
end
|
33
|
-
|
34
|
-
def validate
|
35
|
-
validates_presence :title, :message => "can't be blank"
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
else
|
41
|
-
|
42
1
|
class Book < ActiveRecord::Base
|
43
2
|
belongs_to :author
|
44
3
|
validates_presence_of :title
|
45
4
|
|
46
5
|
scope :sorted_by_author_name, lambda { |dir| joins(:author).order("authors.last_name #{dir}, authors.first_name #{dir}") }
|
47
|
-
end
|
48
6
|
|
7
|
+
attr_protected :exemplars, :author_id, :as => :user
|
49
8
|
end
|
@@ -1,26 +1,4 @@
|
|
1
|
-
if defined? DataMapper::Resource
|
2
|
-
|
3
|
-
class BookWithCustomPrimaryKey
|
4
|
-
include DataMapper::Resource
|
5
|
-
property :uid, Serial
|
6
|
-
belongs_to :author
|
7
|
-
property :title, String
|
8
|
-
property :created_at, DateTime
|
9
|
-
property :updated_at, DateTime
|
10
|
-
end
|
11
|
-
|
12
|
-
elsif defined? Sequel::Model
|
13
|
-
|
14
|
-
class BookWithCustomPrimaryKey < Sequel::Model
|
15
|
-
set_primary_key :uid
|
16
|
-
many_to_one :author
|
17
|
-
end
|
18
|
-
|
19
|
-
else
|
20
|
-
|
21
1
|
class BookWithCustomPrimaryKey < ActiveRecord::Base
|
22
|
-
|
2
|
+
self.primary_key = 'uid'
|
23
3
|
belongs_to :author
|
24
4
|
end
|
25
|
-
|
26
|
-
end
|
@@ -1,24 +1,3 @@
|
|
1
|
-
if defined? DataMapper::Resource
|
2
|
-
|
3
|
-
class Role
|
4
|
-
include DataMapper::Resource
|
5
|
-
property :id, Serial
|
6
|
-
property :name, String
|
7
|
-
has n, :users
|
8
|
-
property :created_at, DateTime
|
9
|
-
property :updated_at, DateTime
|
10
|
-
end
|
11
|
-
|
12
|
-
elsif defined? Sequel::Model
|
13
|
-
|
14
|
-
class Role < Sequel::Model
|
15
|
-
one_to_many :users
|
16
|
-
end
|
17
|
-
|
18
|
-
else
|
19
|
-
|
20
1
|
class Role < ActiveRecord::Base
|
21
2
|
has_many :users
|
22
3
|
end
|
23
|
-
|
24
|
-
end
|
@@ -1,29 +1,5 @@
|
|
1
|
-
if defined? DataMapper::Resource
|
2
|
-
|
3
|
-
class User
|
4
|
-
include DataMapper::Resource
|
5
|
-
property :id, Serial
|
6
|
-
property :first_name, String
|
7
|
-
property :last_name, String
|
8
|
-
belongs_to :role, :required => false
|
9
|
-
has 1, :address
|
10
|
-
property :created_at, DateTime
|
11
|
-
property :updated_at, DateTime
|
12
|
-
end
|
13
|
-
|
14
|
-
elsif defined? Sequel::Model
|
15
|
-
|
16
|
-
class User < Sequel::Model
|
17
|
-
many_to_one :role
|
18
|
-
one_to_one :address
|
19
|
-
end
|
20
|
-
|
21
|
-
else
|
22
|
-
|
23
1
|
class User < ActiveRecord::Base
|
24
2
|
# scope :latest, lambda {|param| where(:created_at.gt => param)}
|
25
3
|
belongs_to :role
|
26
4
|
has_one :address
|
27
5
|
end
|
28
|
-
|
29
|
-
end
|
@@ -48,7 +48,7 @@ module RailsApp
|
|
48
48
|
# config.netzke.basepack.grid_panel.extended_search_available = false
|
49
49
|
|
50
50
|
# to build links to the code on github
|
51
|
-
config.repo_root = "https://github.com/
|
51
|
+
config.repo_root = "https://github.com/netzke/netzke-basepack/blob/master/test/basepack_test_app"
|
52
52
|
|
53
53
|
# Enable the asset pipeline
|
54
54
|
config.assets.enabled = true
|
@@ -3,13 +3,9 @@
|
|
3
3
|
# Do not set this db to the same as development or production.
|
4
4
|
test: &test
|
5
5
|
adapter: mysql2
|
6
|
-
|
7
|
-
reconnect: false
|
8
|
-
database: nbt_test
|
6
|
+
database: basepack_test_app_test
|
9
7
|
pool: 5
|
10
|
-
|
11
|
-
# DM
|
12
|
-
uri: mysql://127.0.0.1/nbt_test?user=&encoding=UTF-8
|
8
|
+
timeout: 5000
|
13
9
|
|
14
10
|
cucumber:
|
15
11
|
<<: *test
|
@@ -19,22 +19,22 @@ ActiveRecord::Schema.define(:version => 20110909071740) do
|
|
19
19
|
t.string "city"
|
20
20
|
t.string "postcode"
|
21
21
|
t.integer "country_id"
|
22
|
-
t.datetime "created_at"
|
23
|
-
t.datetime "updated_at"
|
22
|
+
t.datetime "created_at", :null => false
|
23
|
+
t.datetime "updated_at", :null => false
|
24
24
|
end
|
25
25
|
|
26
26
|
create_table "authors", :force => true do |t|
|
27
27
|
t.string "first_name"
|
28
28
|
t.string "last_name"
|
29
|
-
t.datetime "created_at"
|
30
|
-
t.datetime "updated_at"
|
29
|
+
t.datetime "created_at", :null => false
|
30
|
+
t.datetime "updated_at", :null => false
|
31
31
|
end
|
32
32
|
|
33
33
|
create_table "book_with_custom_primary_keys", :primary_key => "uid", :force => true do |t|
|
34
34
|
t.string "title"
|
35
35
|
t.integer "author_id"
|
36
|
-
t.datetime "created_at"
|
37
|
-
t.datetime "updated_at"
|
36
|
+
t.datetime "created_at", :null => false
|
37
|
+
t.datetime "updated_at", :null => false
|
38
38
|
end
|
39
39
|
|
40
40
|
create_table "books", :force => true do |t|
|
@@ -45,8 +45,8 @@ ActiveRecord::Schema.define(:version => 20110909071740) do
|
|
45
45
|
t.text "notes"
|
46
46
|
t.string "tags"
|
47
47
|
t.integer "rating"
|
48
|
-
t.datetime "created_at"
|
49
|
-
t.datetime "updated_at"
|
48
|
+
t.datetime "created_at", :null => false
|
49
|
+
t.datetime "updated_at", :null => false
|
50
50
|
t.datetime "last_read_at"
|
51
51
|
t.date "published_on"
|
52
52
|
end
|
@@ -56,8 +56,8 @@ ActiveRecord::Schema.define(:version => 20110909071740) do
|
|
56
56
|
t.integer "user_id"
|
57
57
|
t.integer "role_id"
|
58
58
|
t.text "value"
|
59
|
-
t.datetime "created_at"
|
60
|
-
t.datetime "updated_at"
|
59
|
+
t.datetime "created_at", :null => false
|
60
|
+
t.datetime "updated_at", :null => false
|
61
61
|
end
|
62
62
|
|
63
63
|
add_index "netzke_component_states", ["component"], :name => "index_netzke_component_states_on_component"
|
@@ -66,16 +66,16 @@ ActiveRecord::Schema.define(:version => 20110909071740) do
|
|
66
66
|
|
67
67
|
create_table "roles", :force => true do |t|
|
68
68
|
t.string "name"
|
69
|
-
t.datetime "created_at"
|
70
|
-
t.datetime "updated_at"
|
69
|
+
t.datetime "created_at", :null => false
|
70
|
+
t.datetime "updated_at", :null => false
|
71
71
|
end
|
72
72
|
|
73
73
|
create_table "users", :force => true do |t|
|
74
74
|
t.string "first_name"
|
75
75
|
t.string "last_name"
|
76
76
|
t.integer "role_id"
|
77
|
-
t.datetime "created_at"
|
78
|
-
t.datetime "updated_at"
|
77
|
+
t.datetime "created_at", :null => false
|
78
|
+
t.datetime "updated_at", :null => false
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
@@ -5,8 +5,8 @@ Feature: Accordion panel
|
|
5
5
|
|
6
6
|
@javascript
|
7
7
|
Scenario: Lazy loading of a component into a panel when the latter gets expanded
|
8
|
-
Given I am on the
|
8
|
+
Given I am on the SomeAccordion test page
|
9
9
|
When I expand "Panel Two"
|
10
10
|
Then I should see "Original HTML"
|
11
11
|
When I press "Update html"
|
12
|
-
Then I should see "Update for Panel Two"
|
12
|
+
Then I should see "Update for Panel Two"
|
@@ -58,7 +58,7 @@ Scenario: UserFormWithDefaultFields should render properly
|
|
58
58
|
And I should see "writer"
|
59
59
|
|
60
60
|
@javascript
|
61
|
-
Scenario:
|
61
|
+
Scenario: Form should be functional without model provided
|
62
62
|
Given I am on the FormWithoutModel test page
|
63
63
|
When I fill in "Text field:" with "Some text"
|
64
64
|
And I fill in "Number field:" with "42"
|
@@ -92,7 +92,7 @@ Scenario: Editing and immediately submitting the form
|
|
92
92
|
Then the form should show author__name: "Castaneda, Carlos"
|
93
93
|
|
94
94
|
When I press "Apply"
|
95
|
-
And I wait for
|
95
|
+
And I wait for response from server
|
96
96
|
Then the form should show author__name: "Castaneda, Carlos"
|
97
97
|
|
98
98
|
# @javascript
|
@@ -102,7 +102,7 @@ Scenario: Editing and immediately submitting the form
|
|
102
102
|
# And I check ext checkbox "recommend"
|
103
103
|
# And I check ext checkbox "cool"
|
104
104
|
# And I press "Apply"
|
105
|
-
# And I wait for
|
105
|
+
# And I wait for response from server
|
106
106
|
# Then ext "cool" checkbox should be checked
|
107
107
|
# And ext "recommend" checkbox should be checked
|
108
108
|
# But ext "read" checkbox should not be checked
|
@@ -114,12 +114,12 @@ Scenario: Editing and immediately submitting the form
|
|
114
114
|
When I go to the BookForm test page
|
115
115
|
And I fill in "Title:" with ""
|
116
116
|
And I press "Apply"
|
117
|
-
And I wait for
|
117
|
+
And I wait for response from server
|
118
118
|
Then I should see "Title can't be blank"
|
119
119
|
But I should not see "Success!"
|
120
120
|
When I fill in "Title:" with "Not Blank"
|
121
121
|
And I press "Apply"
|
122
|
-
And I wait for
|
122
|
+
And I wait for response from server
|
123
123
|
Then I should not see "Title can't be blank"
|
124
124
|
But I should see "Success!"
|
125
125
|
|
@@ -129,7 +129,7 @@ Scenario: Editing and immediately submitting the form
|
|
129
129
|
When I go to the BookFormWithDefaults test page
|
130
130
|
Then I fill in "Published on" with "2005-01-23"
|
131
131
|
And I press "Apply"
|
132
|
-
And I wait for
|
132
|
+
And I wait for response from server
|
133
133
|
Then a book should exist with published_on: "2005-01-23"
|
134
134
|
|
135
135
|
@javascript
|
@@ -138,5 +138,5 @@ Scenario: Editing and immediately submitting the form
|
|
138
138
|
When I go to the BookFormWithDefaults test page
|
139
139
|
Then I fill in Ext field "Last read at" with "2005-01-23 11:12:13"
|
140
140
|
And I press "Apply"
|
141
|
-
And I wait for
|
141
|
+
And I wait for response from server
|
142
142
|
Then a book should exist with last_read_at: "2005-01-23 11:12:13"
|