the_jobbook_admin_data 1.3.0a
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/CHANGELOG.rdoc +284 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +121 -0
- data/Guardfile +14 -0
- data/MIT-LICENSE +20 -0
- data/README.md +37 -0
- data/README.rdoc +3 -0
- data/Rakefile +40 -0
- data/admin_data.gemspec +23 -0
- data/app/assets/images/add.png +0 -0
- data/app/assets/images/admin_data/.gitkeep +0 -0
- data/app/assets/images/no.png +0 -0
- data/app/assets/images/site.png +0 -0
- data/app/assets/images/sort_by_asc.jpg +0 -0
- data/app/assets/images/sort_by_desc.jpg +0 -0
- data/app/assets/images/sort_by_nothing.jpg +0 -0
- data/app/assets/javascripts/admin_data.js +18 -0
- data/app/assets/javascripts/admin_data/application.js +15 -0
- data/app/assets/javascripts/advance_search/act_on_result.js +45 -0
- data/app/assets/javascripts/advance_search/advance_search.js +83 -0
- data/app/assets/javascripts/advance_search/advance_search_structure.js +79 -0
- data/app/assets/javascripts/advance_search/ajaxify_advance_search.js +28 -0
- data/app/assets/javascripts/advance_search/build_first_row.js +8 -0
- data/app/assets/javascripts/advance_search/event_bindings.js +76 -0
- data/app/assets/javascripts/advance_search/global_ajax_setting.js +10 -0
- data/app/assets/javascripts/advance_search/sortby.js +14 -0
- data/app/assets/javascripts/advance_search/trigger_submit_on_domready.js +6 -0
- data/app/assets/javascripts/analytics/report.js +7 -0
- data/app/assets/javascripts/misc/drop_down_change.js +8 -0
- data/app/assets/javascripts/misc/js_util.js +58 -0
- data/app/assets/javascripts/misc/quick_search_input_focus.js +6 -0
- data/app/assets/javascripts/vendor/jquery-1.4.2.js +6240 -0
- data/app/assets/javascripts/vendor/jquery-ui-1.7.2.custom.min.js +298 -0
- data/app/assets/javascripts/vendor/jquery.ba-isjquery.js +21 -0
- data/app/assets/javascripts/vendor/jquery_form.js +814 -0
- data/app/assets/javascripts/vendor/log.js +9 -0
- data/app/assets/javascripts/vendor/rails.js +132 -0
- data/app/assets/stylesheets/admin_data.css +1141 -0
- data/app/assets/stylesheets/admin_data/application.css +13 -0
- data/app/assets/stylesheets/vendor/jquery-ui-1.7.2.custom.css +406 -0
- data/app/controllers/admin_data/application_controller.rb +107 -0
- data/app/controllers/admin_data/crud_controller.rb +100 -0
- data/app/controllers/admin_data/feed_controller.rb +48 -0
- data/app/controllers/admin_data/home_controller.rb +8 -0
- data/app/controllers/admin_data/migration_controller.rb +18 -0
- data/app/controllers/admin_data/public_controller.rb +28 -0
- data/app/controllers/admin_data/search_controller.rb +143 -0
- data/app/controllers/admin_data/table_structure_controller.rb +25 -0
- data/app/helpers/admin_data/application_helper.rb +320 -0
- data/app/views/admin_data/crud/association/_association_info.html.erb +11 -0
- data/app/views/admin_data/crud/association/_belongs_to_info.html.erb +7 -0
- data/app/views/admin_data/crud/association/_habtm_info.html.erb +7 -0
- data/app/views/admin_data/crud/association/_has_many_info.html.erb +7 -0
- data/app/views/admin_data/crud/association/_has_one_info.html.erb +6 -0
- data/app/views/admin_data/crud/edit.html.erb +36 -0
- data/app/views/admin_data/crud/misc/_form.html.erb +38 -0
- data/app/views/admin_data/crud/misc/_modify_record.html.erb +18 -0
- data/app/views/admin_data/crud/new.html.erb +25 -0
- data/app/views/admin_data/crud/show.html.erb +42 -0
- data/app/views/admin_data/feed/index.rss.builder +25 -0
- data/app/views/admin_data/home/index.html.erb +21 -0
- data/app/views/admin_data/migration/index.html.erb +18 -0
- data/app/views/admin_data/migration/jstest.html.erb +51 -0
- data/app/views/admin_data/search/advance_search.html.erb +1 -0
- data/app/views/admin_data/search/quick_search.html.erb +1 -0
- data/app/views/admin_data/search/search/_advance_search_form.html.erb +52 -0
- data/app/views/admin_data/search/search/_errors.html.erb +5 -0
- data/app/views/admin_data/search/search/_listing.html.erb +43 -0
- data/app/views/admin_data/search/search/_search_form.html.erb +27 -0
- data/app/views/admin_data/search/search/_title.html.erb +34 -0
- data/app/views/admin_data/shared/_breadcrum.html.erb +16 -0
- data/app/views/admin_data/shared/_drop_down_klasses.html.erb +4 -0
- data/app/views/admin_data/shared/_flash_message.html.erb +13 -0
- data/app/views/admin_data/shared/_header.html.erb +20 -0
- data/app/views/admin_data/shared/_powered_by.html.erb +6 -0
- data/app/views/admin_data/shared/_secondary_navigation.html.erb +26 -0
- data/app/views/admin_data/table_structure/index.html.erb +54 -0
- data/app/views/layouts/admin_data.html.erb +34 -0
- data/app/views/layouts/admin_data/application.html.erb +14 -0
- data/app/views/layouts/search.html.erb +71 -0
- data/config/routes.rb +32 -0
- data/lib/admin_data.rb +27 -0
- data/lib/admin_data/active_record_util.rb +102 -0
- data/lib/admin_data/analytics.rb +176 -0
- data/lib/admin_data/authenticator.rb +15 -0
- data/lib/admin_data/config.rb +38 -0
- data/lib/admin_data/configuration.rb +127 -0
- data/lib/admin_data/date_util.rb +58 -0
- data/lib/admin_data/engine.rb +17 -0
- data/lib/admin_data/model_finder.rb +15 -0
- data/lib/admin_data/rails_version_check.rb +8 -0
- data/lib/admin_data/search.rb +188 -0
- data/lib/admin_data/setup_config.rb +24 -0
- data/lib/admin_data/util.rb +102 -0
- data/lib/admin_data/version.rb +3 -0
- data/lib/tasks/admin_data_tasks.rake +4 -0
- data/script/rails +8 -0
- data/test/admin_data_test.rb +7 -0
- data/test/dummy/README.md +19 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +5 -0
- data/test/dummy/app/models/user.rb +3 -0
- data/test/dummy/app/models/user/student.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +15 -0
- data/test/dummy/config/boot.rb +13 -0
- data/test/dummy/config/cucumber.yml +9 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/database.yml.mysql +22 -0
- data/test/dummy/config/database.yml.pg +15 -0
- data/test/dummy/config/database.yml.sqlite3 +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +22 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/admin_data.rb +15 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/empty_spaces_to_nil.rb +10 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +9 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20091030202259_create_tables.rb +72 -0
- data/test/dummy/db/production.sqlite3 +1 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/db/seeds.rb +40 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/features/advance_search/boolean.feature +74 -0
- data/test/dummy/features/advance_search/datetime.feature +101 -0
- data/test/dummy/features/advance_search/delete_all.feature +20 -0
- data/test/dummy/features/advance_search/destroy_all.feature +20 -0
- data/test/dummy/features/advance_search/integer.feature +69 -0
- data/test/dummy/features/advance_search/multiple_rows.feature +87 -0
- data/test/dummy/features/advance_search/string.feature +130 -0
- data/test/dummy/features/crud.feature +50 -0
- data/test/dummy/features/crud_show.feature +56 -0
- data/test/dummy/features/feed.feature +13 -0
- data/test/dummy/features/home.feature +42 -0
- data/test/dummy/features/migration.feature +7 -0
- data/test/dummy/features/quick_search.feature +113 -0
- data/test/dummy/features/step_definitions/advance_search_steps.rb +13 -0
- data/test/dummy/features/step_definitions/app_steps.rb +36 -0
- data/test/dummy/features/step_definitions/async.rb +18 -0
- data/test/dummy/features/step_definitions/configuration_steps.rb +61 -0
- data/test/dummy/features/step_definitions/crud_show_steps.rb +37 -0
- data/test/dummy/features/step_definitions/feed_steps.rb +24 -0
- data/test/dummy/features/step_definitions/quick_search_steps.rb +68 -0
- data/test/dummy/features/step_definitions/util.rb +90 -0
- data/test/dummy/features/step_definitions/web_steps.rb +219 -0
- data/test/dummy/features/support/env.rb +66 -0
- data/test/dummy/features/support/hooks.rb +9 -0
- data/test/dummy/features/support/paths.rb +33 -0
- data/test/dummy/features/table_structure.feature +18 -0
- data/test/dummy/lib/tasks/.gitkeep +0 -0
- data/test/dummy/lib/tasks/cucumber.rake +53 -0
- data/test/dummy/lib/tasks/dbs.rake +30 -0
- data/test/dummy/lib/tasks/sample_cars.rake +18 -0
- data/test/dummy/public/.gitkeep +0 -0
- data/test/dummy/script/cucumber +10 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/factories.rb +30 -0
- data/test/dummy/test/test_helper.rb +7 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/admin_data/model_finder_test.rb +16 -0
- data/test/unit/car_test.rb +96 -0
- data/test/unit/user_phone_test.rb +19 -0
- metadata +253 -0
data/Guardfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :test do
|
5
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
6
|
+
watch(%r{^test/.+_test\.rb$})
|
7
|
+
watch('test/test_helper.rb') { "test" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/models/(.+)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
11
|
+
watch(%r{^app/controllers/(.+)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
12
|
+
watch(%r{^app/views/.+\.rb$}) { "test/integration" }
|
13
|
+
watch('app/controllers/application_controller.rb') { ["test/functional", "test/integration"] }
|
14
|
+
end
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# admin_data
|
2
|
+
|
3
|
+
## Rails 3.0.x
|
4
|
+
|
5
|
+
If you are using Rails 3.0.x then use
|
6
|
+
|
7
|
+
gem 'admin_data', '= 1.1.14'
|
8
|
+
|
9
|
+
## Rails 3.1.x
|
10
|
+
|
11
|
+
If you are using Rails 3.1.x then use
|
12
|
+
|
13
|
+
gem 'admin_data', '= 1.2.1'
|
14
|
+
|
15
|
+
Also add following lines to config/application.rb just below the line that says <tt>config.assets.enabled = true</tt> .
|
16
|
+
|
17
|
+
config.assets.precompile += ['admin_data.css', 'admin_data.js']
|
18
|
+
|
19
|
+
Before deploying the code to production execute
|
20
|
+
|
21
|
+
bundle exec rake assets:precompile
|
22
|
+
|
23
|
+
## Live Demo
|
24
|
+
|
25
|
+
Live demo is available at http://admin-data-demo.heroku.com/admin_data (read only version)
|
26
|
+
|
27
|
+
## Docs
|
28
|
+
|
29
|
+
Documentation is available at https://github.com/bigbinary/admin_data/wiki
|
30
|
+
|
31
|
+
## Tests
|
32
|
+
|
33
|
+
To execute tests for this gem <tt>cd test/rails_root</tt> and read the instructions mentioned at README.md there.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
Released under [MIT](http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) License
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'AdminData'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
data/admin_data.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "admin_data/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "the_jobbook_admin_data"
|
7
|
+
s.version = AdminData::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Noah Chaimowicz"]
|
10
|
+
s.email = ["noah@jobbook.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Manage data as if you own it}
|
13
|
+
s.description = %q{Manage data as if you own it}
|
14
|
+
|
15
|
+
s.rubyforge_project = "thejobbook_admin_data"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_dependency("will_paginate", ">= 3.0.0")
|
22
|
+
s.add_dependency("rails", "~> 3.1")
|
23
|
+
end
|
Binary file
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//= require ./vendor/jquery-1.4.2.js
|
2
|
+
//= require ./vendor/jquery-ui-1.7.2.custom.min.js
|
3
|
+
//= require ./vendor/jquery_form
|
4
|
+
//= require ./vendor/log
|
5
|
+
//= require ./vendor/rails
|
6
|
+
//= require ./misc/drop_down_change
|
7
|
+
//= require ./misc/quick_search_input_focus
|
8
|
+
//= require ./advance_search/global_ajax_setting
|
9
|
+
//= require ./misc/js_util
|
10
|
+
//= require ./analytics/report
|
11
|
+
//= require ./advance_search/advance_search
|
12
|
+
//= require ./advance_search/advance_search_structure
|
13
|
+
//= require ./advance_search/ajaxify_advance_search
|
14
|
+
//= require ./advance_search/act_on_result
|
15
|
+
//= require ./advance_search/build_first_row
|
16
|
+
//= require ./advance_search/event_bindings
|
17
|
+
//= require ./advance_search/trigger_submit_on_domready
|
18
|
+
//= require ./advance_search/sortby
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var AdminData = AdminData || {};
|
2
|
+
|
3
|
+
AdminData.actOnResult = {
|
4
|
+
|
5
|
+
action: function(action_type) {
|
6
|
+
var formData = $('#advance_search_form').data('admin_data_form_array'),
|
7
|
+
parameterizedData;
|
8
|
+
|
9
|
+
formData.push({
|
10
|
+
'name': 'admin_data_advance_search_action_type',
|
11
|
+
'value': action_type
|
12
|
+
});
|
13
|
+
|
14
|
+
parameterizedData = $.param(formData);
|
15
|
+
|
16
|
+
$.ajax({
|
17
|
+
url: $('#advance_search_form').attr('action'),
|
18
|
+
type: 'post',
|
19
|
+
dataType: 'json',
|
20
|
+
data: parameterizedData,
|
21
|
+
success: function(json) {
|
22
|
+
AdminData.actOnResult.successCallback(json);
|
23
|
+
}
|
24
|
+
});
|
25
|
+
},
|
26
|
+
|
27
|
+
successCallback: function(json) {
|
28
|
+
$('#results').text(json.success);
|
29
|
+
}
|
30
|
+
|
31
|
+
};
|
32
|
+
|
33
|
+
$('#advance_search_delete_all').live('click', function() {
|
34
|
+
if (window.confirm('Are you sure?')) {
|
35
|
+
AdminData.actOnResult.action('delete');
|
36
|
+
}
|
37
|
+
return false;
|
38
|
+
});
|
39
|
+
|
40
|
+
$('#advance_search_destroy_all').live('click', function() {
|
41
|
+
if (window.confirm('Are you sure?')) {
|
42
|
+
AdminData.actOnResult.action('destroy');
|
43
|
+
}
|
44
|
+
return false;
|
45
|
+
});
|
@@ -0,0 +1,83 @@
|
|
1
|
+
var AdminData = AdminData || {};
|
2
|
+
|
3
|
+
AdminData.advanceSearch = {
|
4
|
+
|
5
|
+
buildFirstRow: function() {
|
6
|
+
|
7
|
+
var img = $('<img />', {
|
8
|
+
src: '/admin_data/public/images/add.png'
|
9
|
+
});
|
10
|
+
|
11
|
+
$('#advance_search_table').append(this.buildRow())
|
12
|
+
.find('tr td:last a')
|
13
|
+
.attr('id','add_row_link_1')
|
14
|
+
.removeClass('remove_row')
|
15
|
+
.addClass('add_row_link')
|
16
|
+
.html('')
|
17
|
+
.append(img);
|
18
|
+
},
|
19
|
+
|
20
|
+
buildCol1: function() {
|
21
|
+
var i, col = $('<select />', { className: 'col1' }).append($('<option />')),
|
22
|
+
tableStructure = $('#advance_search_table').data('table_structure');
|
23
|
+
|
24
|
+
for (i in tableStructure) {
|
25
|
+
$('<option />', {
|
26
|
+
text: i,
|
27
|
+
value: i
|
28
|
+
}).appendTo(col);
|
29
|
+
}
|
30
|
+
return $('<td />').append(col);
|
31
|
+
},
|
32
|
+
|
33
|
+
buildCol2: function() {
|
34
|
+
var select = $('<select />', { className: 'col2', disabled: 'disabled' });
|
35
|
+
return $('<td />').append(select);
|
36
|
+
},
|
37
|
+
|
38
|
+
buildCol3: function() {
|
39
|
+
var select = $('<input />', { className: 'col3' });
|
40
|
+
return $('<td />').append($('<input />', { className: 'col3', disabled: 'disabled' }));
|
41
|
+
},
|
42
|
+
|
43
|
+
buildCol4: function() {
|
44
|
+
var img = $('<img />', {
|
45
|
+
src: '/admin_data/public/images/no.png'
|
46
|
+
});
|
47
|
+
|
48
|
+
return $('<td />').append($('<a />', {
|
49
|
+
text: '',
|
50
|
+
href: '#',
|
51
|
+
className: 'remove_row'
|
52
|
+
}).append(img));
|
53
|
+
},
|
54
|
+
|
55
|
+
buildRow: function() {
|
56
|
+
|
57
|
+
var $tr = $('<tr />'),
|
58
|
+
currentRowNumber = $(document).data('currentRowNumber'),
|
59
|
+
that = this,
|
60
|
+
build_array = ['buildCol1', 'buildCol2', 'buildCol3', 'buildCol4'];
|
61
|
+
|
62
|
+
if (currentRowNumber === undefined) {
|
63
|
+
currentRowNumber = 1;
|
64
|
+
$(document).data('currentRowNumber', currentRowNumber);
|
65
|
+
} else {
|
66
|
+
currentRowNumber = parseInt(currentRowNumber, 10) + 1;
|
67
|
+
$(document).data('currentRowNumber', currentRowNumber);
|
68
|
+
}
|
69
|
+
|
70
|
+
$.each(build_array, function(index, value) {
|
71
|
+
$tr.append(that[value]());
|
72
|
+
});
|
73
|
+
|
74
|
+
$tr.find('select.col1').attr({ name: 'adv_search[' + currentRowNumber + '_row][col1]' });
|
75
|
+
$tr.find('select.col2').attr({ name: 'adv_search[' + currentRowNumber + '_row][col2]' });
|
76
|
+
$tr.find('input.col3').attr({ name: 'adv_search[' + currentRowNumber + '_row][col3]' });
|
77
|
+
|
78
|
+
$tr.find('.remove_row').attr('id', 'remove_row_'+currentRowNumber);
|
79
|
+
|
80
|
+
return $tr;
|
81
|
+
}
|
82
|
+
|
83
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
AdminData = AdminData || {};
|
2
|
+
|
3
|
+
AdminData.mappings = {
|
4
|
+
|
5
|
+
//JSLint complains if a hash has key named boolean. So I am changing the key to booleant
|
6
|
+
booleant: {
|
7
|
+
options: [
|
8
|
+
["is null", "is_null"],
|
9
|
+
["is not null", "is_not_null"],
|
10
|
+
["is true", "is_true"],
|
11
|
+
["is false", "is_false"]
|
12
|
+
]
|
13
|
+
},
|
14
|
+
|
15
|
+
string: {
|
16
|
+
options: [
|
17
|
+
["is null", "is_null"],
|
18
|
+
["is not null", "is_not_null"],
|
19
|
+
["contains", "contains"],
|
20
|
+
["is exactly", "is_exactly"],
|
21
|
+
["doesn't contain", "does_not_contain"]
|
22
|
+
]
|
23
|
+
},
|
24
|
+
|
25
|
+
text: {
|
26
|
+
options: [
|
27
|
+
["is null", "is_null"],
|
28
|
+
["is not null", "is_not_null"],
|
29
|
+
["Contains", "contains"],
|
30
|
+
["Doesn't Contain", "does_not_contain"]
|
31
|
+
]
|
32
|
+
},
|
33
|
+
|
34
|
+
datetime: {
|
35
|
+
options: [
|
36
|
+
["is null", "is_null"],
|
37
|
+
["is not null", "is_not_null"],
|
38
|
+
['on', "is_on"],
|
39
|
+
['on or before', "is_on_or_before_date"],
|
40
|
+
['on or after', "is_on_or_after_date"]
|
41
|
+
]
|
42
|
+
},
|
43
|
+
|
44
|
+
date: {
|
45
|
+
options: [
|
46
|
+
["is null", "is_null"],
|
47
|
+
["is not null", "is_not_null"],
|
48
|
+
['on', "is_on"],
|
49
|
+
['on or before', "is_on_or_before_date"],
|
50
|
+
['on or after', "is_on_or_after_date"]
|
51
|
+
]
|
52
|
+
},
|
53
|
+
|
54
|
+
time: {
|
55
|
+
options: [
|
56
|
+
["is null", "is_null"],
|
57
|
+
["is not null", "is_not_null"],
|
58
|
+
["is exactly", "is_exactly"]
|
59
|
+
]
|
60
|
+
},
|
61
|
+
|
62
|
+
decimal: {
|
63
|
+
options: [
|
64
|
+
['is equal to', "is_equal_to"],
|
65
|
+
['is less than', "less_than"],
|
66
|
+
['is greater than', "greater_than"]
|
67
|
+
]
|
68
|
+
},
|
69
|
+
|
70
|
+
integer: {
|
71
|
+
options: [
|
72
|
+
['is equal to', "is_equal_to"],
|
73
|
+
['is less than', "less_than"],
|
74
|
+
['is greater than', "greater_than"]
|
75
|
+
]
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
var AdminData = AdminData || {};
|
2
|
+
|
3
|
+
AdminData.ajaxifyAdvanceSearch = {
|
4
|
+
successCallback: function(responseText) {
|
5
|
+
$('#results').html(responseText);
|
6
|
+
},
|
7
|
+
|
8
|
+
beforeSubmitCallback: function(formArray, jqForm) {
|
9
|
+
$('#results').html('<span class="searching_message">searching...</span>');
|
10
|
+
$('#advance_search_form').data('admin_data_form_array', formArray);
|
11
|
+
}
|
12
|
+
};
|
13
|
+
|
14
|
+
$(function() {
|
15
|
+
|
16
|
+
var options = {
|
17
|
+
success: function(responseText) {
|
18
|
+
AdminData.ajaxifyAdvanceSearch.successCallback(responseText);
|
19
|
+
},
|
20
|
+
beforeSubmit: function(formArray, jqForm) {
|
21
|
+
AdminData.ajaxifyAdvanceSearch.beforeSubmitCallback(formArray, jqForm);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
|
25
|
+
$('#advance_search_form').ajaxForm(options);
|
26
|
+
|
27
|
+
});
|
28
|
+
|