Permalink
Browse files

move assets to assets dir

  • Loading branch information...
1 parent 4e3ce0d commit fcd8e84cf62a813fc792b59e8d1d201369259211 Neeraj Singh committed Oct 18, 2011
Showing with 10,290 additions and 1 deletion.
  1. BIN app/assets/images/add.png
  2. BIN app/assets/images/no.png
  3. BIN app/assets/images/site.png
  4. BIN app/assets/images/sort_by_asc.jpg
  5. BIN app/assets/images/sort_by_desc.jpg
  6. BIN app/assets/images/sort_by_nothing.jpg
  7. +45 −0 app/assets/javascripts/advance_search/act_on_result.js
  8. +83 −0 app/assets/javascripts/advance_search/advance_search.js
  9. +79 −0 app/assets/javascripts/advance_search/advance_search_structure.js
  10. +28 −0 app/assets/javascripts/advance_search/ajaxify_advance_search.js
  11. +8 −0 app/assets/javascripts/advance_search/build_first_row.js
  12. +76 −0 app/assets/javascripts/advance_search/event_bindings.js
  13. +10 −0 app/assets/javascripts/advance_search/global_ajax_setting.js
  14. +14 −0 app/assets/javascripts/advance_search/sortby.js
  15. +6 −0 app/assets/javascripts/advance_search/trigger_submit_on_domready.js
  16. +7 −0 app/assets/javascripts/analytics/report.js
  17. +8 −0 app/assets/javascripts/misc/drop_down_change.js
  18. +58 −0 app/assets/javascripts/misc/js_util.js
  19. +6 −0 app/assets/javascripts/misc/quick_search_input_focus.js
  20. +120 −0 app/assets/javascripts/test/act_on_result.js
  21. +80 −0 app/assets/javascripts/test/advance_search.js
  22. +29 −0 app/assets/javascripts/test/ajaxify_advance_search.js
  23. +10 −0 app/assets/javascripts/test/build_first_row.js
  24. +100 −0 app/assets/javascripts/test/event_bindings.js
  25. +903 −0 app/assets/javascripts/vendor/jack.js
  26. +6,240 −0 app/assets/javascripts/vendor/jquery-1.4.2.js
  27. +298 −0 app/assets/javascripts/vendor/jquery-ui-1.7.2.custom.min.js
  28. +21 −0 app/assets/javascripts/vendor/jquery.ba-isjquery.js
  29. +814 −0 app/assets/javascripts/vendor/jquery_form.js
  30. +9 −0 app/assets/javascripts/vendor/log.js
  31. +1,043 −0 app/assets/javascripts/vendor/qunit.js
  32. +132 −0 app/assets/javascripts/vendor/rails.js
  33. +63 −1 app/views/layouts/search.html.erb
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,45 @@
+var AdminData = AdminData || {};
+
+AdminData.actOnResult = {
+
+ action: function(action_type) {
+ var formData = $('#advance_search_form').data('admin_data_form_array'),
+ parameterizedData;
+
+ formData.push({
+ 'name': 'admin_data_advance_search_action_type',
+ 'value': action_type
+ });
+
+ parameterizedData = $.param(formData);
+
+ $.ajax({
+ url: $('#advance_search_form').attr('action'),
+ type: 'post',
+ dataType: 'json',
+ data: parameterizedData,
+ success: function(json) {
+ AdminData.actOnResult.successCallback(json);
+ }
+ });
+ },
+
+ successCallback: function(json) {
+ $('#results').text(json.success);
+ }
+
+};
+
+$('#advance_search_delete_all').live('click', function() {
+ if (window.confirm('Are you sure?')) {
+ AdminData.actOnResult.action('delete');
+ }
+ return false;
+});
+
+$('#advance_search_destroy_all').live('click', function() {
+ if (window.confirm('Are you sure?')) {
+ AdminData.actOnResult.action('destroy');
+ }
+ return false;
+});
@@ -0,0 +1,83 @@
+var AdminData = AdminData || {};
+
+AdminData.advanceSearch = {
+
+ buildFirstRow: function() {
+
+ var img = $('<img />', {
+ src: '/admin_data/public/images/add.png'
+ });
+
+ $('#advance_search_table').append(this.buildRow())
+ .find('tr td:last a')
+ .attr('id','add_row_link_1')
+ .removeClass('remove_row')
+ .addClass('add_row_link')
+ .html('')
+ .append(img);
+ },
+
+ buildCol1: function() {
+ var i, col = $('<select />', { className: 'col1' }).append($('<option />')),
+ tableStructure = $('#advance_search_table').data('table_structure');
+
+ for (i in tableStructure) {
+ $('<option />', {
+ text: i,
+ value: i
+ }).appendTo(col);
+ }
+ return $('<td />').append(col);
+ },
+
+ buildCol2: function() {
+ var select = $('<select />', { className: 'col2', disabled: 'disabled' });
+ return $('<td />').append(select);
+ },
+
+ buildCol3: function() {
+ var select = $('<input />', { className: 'col3' });
+ return $('<td />').append($('<input />', { className: 'col3', disabled: 'disabled' }));
+ },
+
+ buildCol4: function() {
+ var img = $('<img />', {
+ src: '/admin_data/public/images/no.png'
+ });
+
+ return $('<td />').append($('<a />', {
+ text: '',
+ href: '#',
+ className: 'remove_row'
+ }).append(img));
+ },
+
+ buildRow: function() {
+
+ var $tr = $('<tr />'),
+ currentRowNumber = $(document).data('currentRowNumber'),
+ that = this,
+ build_array = ['buildCol1', 'buildCol2', 'buildCol3', 'buildCol4'];
+
+ if (currentRowNumber === undefined) {
+ currentRowNumber = 1;
+ $(document).data('currentRowNumber', currentRowNumber);
+ } else {
+ currentRowNumber = parseInt(currentRowNumber, 10) + 1;
+ $(document).data('currentRowNumber', currentRowNumber);
+ }
+
+ $.each(build_array, function(index, value) {
+ $tr.append(that[value]());
+ });
+
+ $tr.find('select.col1').attr({ name: 'adv_search[' + currentRowNumber + '_row][col1]' });
+ $tr.find('select.col2').attr({ name: 'adv_search[' + currentRowNumber + '_row][col2]' });
+ $tr.find('input.col3').attr({ name: 'adv_search[' + currentRowNumber + '_row][col3]' });
+
+ $tr.find('.remove_row').attr('id', 'remove_row_'+currentRowNumber);
+
+ return $tr;
+ }
+
+};
@@ -0,0 +1,79 @@
+AdminData = AdminData || {};
+
+AdminData.mappings = {
+
+ //JSLint complains if a hash has key named boolean. So I am changing the key to booleant
+ booleant: {
+ options: [
+ ["is null", "is_null"],
+ ["is not null", "is_not_null"],
+ ["is true", "is_true"],
+ ["is false", "is_false"]
+ ]
+ },
+
+ string: {
+ options: [
+ ["is null", "is_null"],
+ ["is not null", "is_not_null"],
+ ["contains", "contains"],
+ ["is exactly", "is_exactly"],
+ ["doesn't contain", "does_not_contain"]
+ ]
+ },
+
+ text: {
+ options: [
+ ["is null", "is_null"],
+ ["is not null", "is_not_null"],
+ ["Contains", "contains"],
+ ["Doesn't Contain", "does_not_contain"]
+ ]
+ },
+
+ datetime: {
+ options: [
+ ["is null", "is_null"],
+ ["is not null", "is_not_null"],
+ ['on', "is_on"],
+ ['on or before', "is_on_or_before_date"],
+ ['on or after', "is_on_or_after_date"]
+ ]
+ },
+
+ date: {
+ options: [
+ ["is null", "is_null"],
+ ["is not null", "is_not_null"],
+ ['on', "is_on"],
+ ['on or before', "is_on_or_before_date"],
+ ['on or after', "is_on_or_after_date"]
+ ]
+ },
+
+ time: {
+ options: [
+ ["is null", "is_null"],
+ ["is not null", "is_not_null"],
+ ["is exactly", "is_exactly"]
+ ]
+ },
+
+ decimal: {
+ options: [
+ ['is equal to', "is_equal_to"],
+ ['is less than', "less_than"],
+ ['is greater than', "greater_than"]
+ ]
+ },
+
+ integer: {
+ options: [
+ ['is equal to', "is_equal_to"],
+ ['is less than', "less_than"],
+ ['is greater than', "greater_than"]
+ ]
+ }
+};
+
+
@@ -0,0 +1,28 @@
+var AdminData = AdminData || {};
+
+AdminData.ajaxifyAdvanceSearch = {
+ successCallback: function(responseText) {
+ $('#results').html(responseText);
+ },
+
+ beforeSubmitCallback: function(formArray, jqForm) {
+ $('#results').html('<span class="searching_message">searching...</span>');
+ $('#advance_search_form').data('admin_data_form_array', formArray);
+ }
+};
+
+$(function() {
+
+ var options = {
+ success: function(responseText) {
+ AdminData.ajaxifyAdvanceSearch.successCallback(responseText);
+ },
+ beforeSubmit: function(formArray, jqForm) {
+ AdminData.ajaxifyAdvanceSearch.beforeSubmitCallback(formArray, jqForm);
+ }
+ };
+
+ $('#advance_search_form').ajaxForm(options);
+
+});
+
@@ -0,0 +1,8 @@
+$(function() {
+
+ var json = $.parseJSON( $('#primary_column_type_info').html());
+ $('#advance_search_table').data('table_structure', json);
+ AdminData.advanceSearch.buildFirstRow();
+
+});
+
@@ -0,0 +1,76 @@
+var AdminData = AdminData || {};
+
+AdminData.bindings = {
+
+ col2_change: function(e) {
+ var arrayList = ['is_false', 'is_true', 'is_null', 'is_not_null'],
+ $col2 = $(e.target).closest('select'),
+ value = $col2.val(),
+ tableStructure = $('#advance_search_table').data('table_structure'),
+ $col3 = $col2.parents('tr').find('td input.col3'),
+ $col1 = $col2.parents('tr').find('td select.col1'),
+ col1ColumnType = tableStructure[$col1.val()];
+
+
+ if (value.length === 0 || ($.inArray(value, arrayList) > - 1)) {
+ $col3.val('').attr('disabled','disabled');
+
+ } else {
+ $col3.removeAttr('disabled');
+ if (col1ColumnType === 'datetime' || col1ColumnType === 'date') {
+ $col3.val(AdminData.jsUtil.dateToString(new Date())).addClass('datepicker');
+
+ $('.datepicker').datepicker({ dateFormat: 'dd-MM-yy', changeYear: true, changeMonth: true });
+
+ } else {
+ $('.datepicker').datepicker('destroy');
+ $col3.removeClass('datepicker').focus(); // do not create focus for date pickers
+ }
+ }
+ },
+
+ pagination_click: function(e) {
+ var href = $(e.target).closest('a').attr('href');
+
+ $.ajax({ url: href, dataType: "text", success: function(responseText){
+ $('#results').html(responseText);
+ }});
+
+ AdminData.jsUtil.colorizeRows();
+ },
+
+ col1_change: function(e) {
+ var col1 = $(e.target).closest('select'),
+ tableStructure = $('#advance_search_table').data('table_structure'),
+ columnType = tableStructure[col1.val()],
+ options = AdminData.mappings[columnType]['options'],
+ col2 = col1.parents('tr').find('td select.col2');
+
+ col2.html('');
+ AdminData.jsUtil.buildOptionsFromArray(options, col2);
+ col2.trigger('change').removeAttr('disabled');
+ }
+};
+
+$('.pagination a').live('click', function(e) {
+ AdminData.bindings.pagination_click(e);
+ return false;
+});
+
+$('#advance_search_table a.add_row_link').live('click', function() {
+ $('#advance_search_table').append(AdminData.advanceSearch.buildRow());
+ return false;
+});
+
+$('#advance_search_table a.remove_row').live('click', function(e) {
+ $(e.target).closest('tr').remove();
+ return false;
+});
+
+$('#advance_search_table select.col1').live('change', function(e) {
+ AdminData.bindings.col1_change(e);
+});
+
+$('#advance_search_table select.col2').live('change', function(e) {
+ AdminData.bindings.col2_change(e);
+});
@@ -0,0 +1,10 @@
+$(function() {
+
+ $.ajaxSetup({
+ 'beforeSend': function(xhr) {
+ xhr.setRequestHeader("Accept", "text/javascript");
+ }
+ });
+
+});
+
@@ -0,0 +1,14 @@
+$(function(){
+
+ var form = $('#advance_search_form');
+
+ if (form.length === 0) return;
+
+ $('#view_table tr.thead').live('click', function(e){
+ var value = $(e.target).closest('.sortable').attr('data-sortby');
+ $('#advance_search_sortby').val(value);
+ form.submit();
+ return false;
+ });
+
+});
@@ -0,0 +1,6 @@
+$(function() {
+
+ $('#advance_search_form').trigger('submit');
+
+});
+
@@ -0,0 +1,7 @@
+$(function(){
+
+ $('input[name=report_type]').change(function(){
+ window.location = $(this).val();
+ });
+
+});
@@ -0,0 +1,8 @@
+$(function() {
+
+ $('.drop_down_value_klass').change(function() {
+ window.location = $(this).val();
+ });
+
+});
+
Oops, something went wrong.

0 comments on commit fcd8e84

Please sign in to comment.