admin_data 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+
2
+ === 2010-10-12 v1.0.17
3
+ * use image for advance search add and remove link
4
+ * fix bug regarding "Destroy All"
5
+ * layout change
6
+ * have only one drop down in the homepage
7
+
8
+ === 2010-09-22 v1.0.11
9
+
1
10
  === 2010-10-12 v1.0.14
2
11
  * use the new way of routing. remove deprecation
3
12
 
@@ -1,11 +1,7 @@
1
1
  <div id="main">
2
2
  <div class="block" id="block-tables">
3
3
  <div class="content rounded select_box">
4
- <h2 style='margin-left:0;'>Select a model</h2>
5
- <p class='notice'>
6
- Note that this drop down is also available at top right corner of every page .
7
- </p>
8
- <%= render '/admin_data/shared/drop_down_klasses', :drop_down_for_klasses => @drop_down_for_klasses %>
4
+ <h2 style='margin-left:0;'>Select from the drop down menu above</h2>
9
5
  <div class="clear"></div>
10
6
  </div>
11
7
  </div>
@@ -1,13 +1,12 @@
1
1
  <div id="main">
2
- <%= admin_data_breadcrum do %>
3
- <%= link_to @klass, admin_data_search_path(:klass => @klass.name.underscore) %>
4
- >
5
- <%= link_to "ID #{@model.id}", ''%>
6
- <% end %>
7
-
8
- <h2 class="title">
9
- Editing <%=@model.class.name%> id <%=@model.id%>
10
- </h2>
2
+ <div>
3
+ <h1 style='float:left;font-weight:bold;font-size: 35px;'>
4
+ <%= link_to @klass, admin_data_search_path(:klass => @klass.name) %>
5
+ >
6
+ <%= link_to "ID #{@model.id}", ''%>
7
+ </h1>
8
+ <div class='clear'></div>
9
+ </div>
11
10
 
12
11
  <div class="block" id="block-tables">
13
12
 
@@ -1,12 +1,13 @@
1
1
  <div id="main">
2
2
 
3
- <%= admin_data_breadcrum do %>
4
- <%= link_to @klass, admin_data_search_path(:klass => @klass.name) %>
5
- >
6
- <%= link_to "ID #{@model.id}", ''%>
7
- <% end %>
8
-
9
- <h2 class="title"><%=@model.class.name%> ID <%=@model.id%></h2>
3
+ <div>
4
+ <h1 style='float:left;font-weight:bold;font-size: 35px;'>
5
+ <%= link_to @klass, admin_data_search_path(:klass => @klass.name) %>
6
+ >
7
+ <%= link_to "ID #{@model.id}", ''%>
8
+ </h1>
9
+ <div class='clear'></div>
10
+ </div>
10
11
 
11
12
  <%= render 'admin_data/shared/flash_message', :model => @model %>
12
13
 
@@ -15,7 +15,6 @@
15
15
  <h2 class="title"></h2>
16
16
  <div class="inner">
17
17
  <h1 class='table_name'>Table name : <%=@klass.send(:table_name)%></h1>
18
- <h2>Columns</h2>
19
18
  <table class="table colorize">
20
19
  <tr>
21
20
  <th>Column Name</th>
@@ -1,8 +1,12 @@
1
- <%= admin_data_breadcrum do %>
2
- <%= link_to klass.name, admin_data_search_path(:klass => klass.name.underscore) %>
3
- <% end %>
4
-
5
1
  <div class="block" id="block-text">
2
+
3
+ <div>
4
+ <h1 style='float:left;font-weight:bold;font-size: 35px;'> Listing <%=klass.name%></h1>
5
+ <h3 style='float:left;margin:22px 0 0 10px;color:gray;'><%=total_records_info(klass)%></h3>
6
+ <div class='clear'></div>
7
+ </div>
8
+
9
+
6
10
  <div class="secondary-navigation">
7
11
  <%= render 'admin_data/shared/secondary_navigation', :klass => klass %>
8
12
  <div class="clear"></div>
@@ -8,14 +8,15 @@
8
8
  </table>
9
9
 
10
10
  <div class='sortby_umbrella'>
11
- <input type="submit" value="Search" class='submit_search' />
12
- <div class='group'>
13
- <div class='sortby_text'>sort by</div>
11
+ <div class='group' style='padding-left:20px;'>
12
+ <div class='sortby_text' style='font-size:16px;'>Sort by</div>
14
13
  <select name='sortby' id='sortby'>
15
14
  <%= AdminData::Util.build_sort_options(klass,params[:sortby]).html_safe %>
16
15
  </select>
16
+ <br />
17
17
  </div>
18
18
  <div class='clear'></div>
19
+ <input type="submit" value="Search" class='submit_search' />
19
20
  </div>
20
21
  </div>
21
22
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div class='search_box'>
4
4
  <div id='quick_search'>
5
- <label class='label keyword_label'>search keyword</label>
5
+ <label class='label keyword_label'>Search keyword</label>
6
6
  <input type="text" id="quick_search_input" name="query" value="<%=params[:query]%>" />
7
7
  <%= render :partial => 'admin_data/search/search/sortby', :locals => {:klass => klass} %>
8
8
  <div class='clear'></div>
@@ -1,4 +1,4 @@
1
- <label class='label sortby_label'>sort by</label>
1
+ <label class='label sortby_label'>Sort by</label>
2
2
  <select name='sortby' id='sortby'>
3
3
  <%= AdminData::Util.build_sort_options(klass, params[:sortby]).html_safe %>
4
4
  </select>
@@ -1,4 +1,5 @@
1
1
  <select class='drop_down_value_klass' id='drop_down_klasses'>
2
2
  <option></option>
3
3
  <%= options_for_select(drop_down_for_klasses, @drop_down_url) %>
4
+ <option value="<%=admin_data_migration_information_path%>">Migration Information</option>
4
5
  </select>
@@ -1,17 +1,13 @@
1
1
  <div id="header">
2
- <h1>
3
- <%= link_to 'admin_data', admin_data_index_path %>
2
+ <h1> &nbsp;
4
3
  </h1>
5
4
 
6
5
  <ul id='subnav'>
7
- <li>
8
- <%= link_to 'Home', admin_data_index_path %>
6
+ <li>
7
+ <% label = "Back to Site " + image_tag('https://github.com/neerajdotname/admin_data/raw/rails3_gem/public/images/site.png', :width => '12') %>
8
+ <%= link_to label.html_safe, '/' %>
9
9
  </li>
10
-
11
- <li>
12
- <%= link_to 'Migration Information', admin_data_migration_information_path %>
13
- </li>
14
-
10
+ <li> <%= link_to AdminData::Config.setting[:app_name] , admin_data_index_path %> </li>
15
11
  </ul>
16
12
 
17
13
  <div id='model_drop_down'>
@@ -12,9 +12,7 @@
12
12
 
13
13
  <%= AdminData::Util.google_hosted_jquery(self).html_safe %>
14
14
 
15
- <!-- It is breaking the html markup and test is full of messages
16
- like ignoring attempt to close string with script Hence not including jquery.form in test -->
17
- <%= AdminData::Util.javascript_include_tag('vendor/jquery.form').html_safe unless Rails.env.test? %>
15
+ <%= AdminData::Util.javascript_include_tag('vendor/jquery.form').html_safe %>
18
16
 
19
17
  <%= AdminData::Util.javascript_include_tag('vendor/log',
20
18
  'vendor/rails',
@@ -23,9 +21,7 @@
23
21
  'advance_search/global_ajax_setting',
24
22
  'misc/js_util').html_safe %>
25
23
 
26
- <!-- assert_tag is throwing a lot of warning with these inline javascripts.
27
- no need of these javascripts in test mode -->
28
- <% if params[:action] == 'advance_search' && !Rails.env.test? %>
24
+ <% if params[:action] == 'advance_search' %>
29
25
  <%= AdminData::Util.javascript_include_tag(
30
26
  'advance_search/advance_search',
31
27
  'advance_search/advance_search_structure',
@@ -1,5 +1,9 @@
1
1
  module AdminData::Helpers
2
2
 
3
+ def total_records_info(klass)
4
+ '(Total ' + pluralize(klass.count, 'record') + ' )'
5
+ end
6
+
3
7
  def search_result_title(total_num_of_children, records)
4
8
  output = []
5
9
  if params[:base]
@@ -1,5 +1,4 @@
1
1
  require 'admin_data_date_validation'
2
- require 'admin_data/compatibility'
3
2
  require 'admin_data/settings'
4
3
  require 'admin_data/helpers'
5
4
  require 'admin_data/util'
@@ -5,6 +5,7 @@ class AdminData::Config
5
5
  def self.set=(input = {})
6
6
  valid_keys =
7
7
  %w(
8
+ app_name
8
9
  adapter_name
9
10
  find_conditions
10
11
  plugin_dir
@@ -36,6 +37,8 @@ class AdminData::Config
36
37
  def self.initialize_defaults
37
38
  self.setting = {
38
39
 
40
+ :app_name => "admin_data",
41
+ # TODO get rid of plugin_dir
39
42
  :plugin_dir => File.expand_path(File.join(File.dirname(__FILE__), '..', '..')),
40
43
 
41
44
  :will_paginate_per_page => 50,
@@ -1,3 +1,3 @@
1
1
  module AdminData
2
- VERSION = '1.0.16'
2
+ VERSION = '1.0.17'
3
3
  end
data/lib/admin_data.rb CHANGED
@@ -14,7 +14,6 @@ require 'admin_data_date_validation'
14
14
 
15
15
  require 'admin_data/helpers'
16
16
  require 'admin_data/chelper'
17
- require 'admin_data/compatibility'
18
17
  require 'admin_data/settings'
19
18
  require 'admin_data/util'
20
19
 
data/lib/css/base.css CHANGED
@@ -22,11 +22,18 @@ body {
22
22
  #container {
23
23
  min-width: 940px;
24
24
  margin: 0 10px;
25
+ background: #B3D8EF;
26
+ background: #0f61a1;
27
+ background: #e4e4e4;
25
28
  }
26
29
 
27
- #header, #wrapper {
30
+ #header {
28
31
  padding: 0 20px;
29
32
  }
33
+ #wrapper {
34
+ padding: 0 20px;
35
+ margin: 0;
36
+ }
30
37
 
31
38
  #header {
32
39
  position: relative;
@@ -64,6 +71,8 @@ body {
64
71
  #main {
65
72
  width: 70%;
66
73
  float: left;
74
+ background: #fff;
75
+ padding: 0 20px;
67
76
  }
68
77
 
69
78
  .actions-bar {
@@ -110,7 +119,7 @@ body {
110
119
  }
111
120
 
112
121
  #wrapper {
113
- padding-top: 20px;
122
+ padding-top: 10px;
114
123
  }
115
124
 
116
125
  #main .block {
@@ -406,6 +415,11 @@ a { -moz-outline: none; }
406
415
  body {
407
416
  color: #222;
408
417
  background: #ededec;
418
+ background: #0F61FF;
419
+ background: #0072bc;
420
+ background: #fff;
421
+ background: #0f61a1;
422
+ background: #e4e4e4;
409
423
  font-family: helvetica, arial, sans-serif;
410
424
  }
411
425
 
@@ -911,7 +925,7 @@ table#view_table tr:hover {
911
925
  #model_drop_down {
912
926
  position: absolute;
913
927
  top: 10px;
914
- right: 600px;
928
+ left: 100px;
915
929
  }
916
930
 
917
931
  .drop_down_value_klass {
@@ -1011,22 +1025,23 @@ table#missing_index tr td {
1011
1025
  }
1012
1026
 
1013
1027
  .submit_search {
1028
+ -moz-border-radius: 5px; /* Firefox */
1029
+ -webkit-border-radius: 5px; /* Safari */
1014
1030
  float: left;
1015
- border: 2px solid #127BC4;
1016
- color: #fff;
1017
- background: #4F8AFF;
1031
+ border: 1px solid #000;
1032
+ color: #000;
1033
+ /*background: #4F8AFF;*/
1018
1034
  padding: 3px;
1019
1035
  font-weight: bold;
1020
1036
  font-size: 16px;
1037
+ cursor: pointer;
1021
1038
  }
1022
1039
 
1023
1040
 
1024
1041
  .add_row_link, .remove_row {
1025
1042
  font-size: 30px;
1026
1043
  text-decoration: none;
1027
- border: 1px solid #127BC4;
1028
1044
  color: #fff;
1029
- background: #4F8AFF;
1030
1045
  padding: 0 3px;
1031
1046
  margin: 0;
1032
1047
  }
@@ -1069,3 +1084,8 @@ ul#subnav li a:hover {
1069
1084
  .col_box {
1070
1085
  border-top: 1px dotted #efefef;
1071
1086
  }
1087
+
1088
+ #main .block .content p.error {
1089
+ font-weight: bold;
1090
+ font-size: 18px;
1091
+ }
@@ -31,16 +31,16 @@ AdminData.actOnResult = {
31
31
  };
32
32
 
33
33
  $('#advance_search_delete_all').live('click', function() {
34
- if (window.confirm('Are you sure?')) {
34
+ if (window.confirm('Are you sure?')) {
35
35
  AdminData.actOnResult.action('delete');
36
- }
36
+ }
37
37
  return false;
38
38
  });
39
39
 
40
40
  $('#advance_search_destroy_all').live('click', function() {
41
- if (AdminData.jsUtil.confirm('Are you sure?')) {
41
+ if (window.confirm('Are you sure?')) {
42
42
  AdminData.actOnResult.action('destroy');
43
- }
43
+ }
44
44
  return false;
45
45
  });
46
46
 
@@ -2,59 +2,88 @@ var AdminData = AdminData || {};
2
2
 
3
3
  AdminData.advanceSearch = {
4
4
 
5
- buildFirstRow: function(){
6
- $('#advance_search_table')
7
- .append(this.buildRow())
8
- .find('tr td:last a')
9
- .text('+')
10
- .removeClass('remove_row')
11
- .addClass('add_row_link');
12
- },
13
-
14
- buildCol1: function() {
15
- var i,
16
- col = $('<select />', {className: 'col1' }).append($('<option />')),
17
- tableStructure = $('#advance_search_table').data('table_structure');
18
-
19
- for (i in tableStructure) {
20
- $('<option />', {text: i, value: i}).appendTo(col);
21
- }
22
- return $('<td />').append(col);
23
- },
24
-
25
- buildCol2: function() {
26
- return $('<td />')
27
- .append('<select />')
28
- .find('select')
29
- .append('<option />')
30
- .addClass('col2 disabled')
31
- .attr({ disabled: true }).
32
- end();
33
- },
34
-
35
- buildCol3: function() {
36
- return $('<td />').append($('<input />',{disabled: true, className: 'col3'}));
37
- },
38
-
39
- buildCol4: function() {
40
- return $('<td />').append($('<a />', {text: 'x', href: '#', className: 'remove_row'}));
41
- },
42
-
43
- buildRow: function() {
44
- var $tr = $('<tr />'),
45
- that = this,
46
- randomNumber = AdminData.jsUtil.randomNumber(),
47
- build_array = ['buildCol1', 'buildCol2', 'buildCol3', 'buildCol4'];
48
-
49
- $.each(build_array, function(index, value) {
50
- $tr.append(that[value]());
51
- });
52
-
53
- $tr.find('select.col1').attr({ name: 'adv_search[' + randomNumber + '_row][col1]'});
54
- $tr.find('select.col2').attr({ name: 'adv_search[' + randomNumber + '_row][col2]'});
55
- $tr.find('input.col3').attr({ name: 'adv_search[' + randomNumber + '_row][col3]'});
56
-
57
- return $tr;
58
- }
5
+ buildFirstRow: function() {
6
+
7
+ var img = $('<img />', {
8
+ src: 'https://github.com/neerajdotname/admin_data/raw/rails3_gem/public/images/add.png'
9
+ });
10
+
11
+ $('#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);
12
+ },
13
+
14
+ buildCol1: function() {
15
+ var i, col = $('<select />', {
16
+ className: 'col1'
17
+ }).append($('<option />')),
18
+ tableStructure = $('#advance_search_table').data('table_structure');
19
+
20
+ for (i in tableStructure) {
21
+ $('<option />', {
22
+ text: i,
23
+ value: i
24
+ }).appendTo(col);
25
+ }
26
+ return $('<td />').append(col);
27
+ },
28
+
29
+ buildCol2: function() {
30
+ var select = $('<select />', {
31
+ className: 'col2'
32
+ });
33
+ return $('<td />').append(select);
34
+ },
35
+
36
+ buildCol3: function() {
37
+ return $('<td />').append($('<input />', {
38
+ className: 'col3'
39
+ }));
40
+ },
41
+
42
+ buildCol4: function() {
43
+ var img = $('<img />', {
44
+ src: 'https://github.com/neerajdotname/admin_data/raw/rails3_gem/public/images/no.png'
45
+ });
46
+
47
+ return $('<td />').append($('<a />', {
48
+ text: '',
49
+ href: '#',
50
+ className: 'remove_row'
51
+ }).append(img));
52
+ },
53
+
54
+ buildRow: function() {
55
+
56
+ var $tr = $('<tr />'),
57
+ currentRowNumber = $(document).data('currentRowNumber'),
58
+ that = this,
59
+ build_array = ['buildCol1', 'buildCol2', 'buildCol3', 'buildCol4'];
60
+
61
+ if (currentRowNumber === undefined) {
62
+ currentRowNumber = 1;
63
+ $(document).data('currentRowNumber', currentRowNumber)
64
+ } else {
65
+ currentRowNumber = parseInt(currentRowNumber) + 1;
66
+ $(document).data('currentRowNumber', currentRowNumber)
67
+ }
68
+
69
+ $.each(build_array, function(index, value) {
70
+ $tr.append(that[value]());
71
+ });
72
+
73
+ $tr.find('select.col1').attr({
74
+ name: 'adv_search[' + currentRowNumber + '_row][col1]'
75
+ });
76
+ $tr.find('select.col2').attr({
77
+ name: 'adv_search[' + currentRowNumber + '_row][col2]'
78
+ });
79
+ $tr.find('input.col3').attr({
80
+ name: 'adv_search[' + currentRowNumber + '_row][col3]'
81
+ });
82
+
83
+ $tr.find('.remove_row').attr('id', 'remove_row_'+currentRowNumber);
84
+
85
+ return $tr;
86
+ }
59
87
 
60
88
  };
89
+
@@ -14,13 +14,9 @@ AdminData.bindings = {
14
14
  col1ColumnType = tableStructure[$col1.val()];
15
15
 
16
16
  if (value.length === 0 || ($.inArray(value, arrayList) > - 1)) {
17
- $col3.val('')
18
- .attr('disabled', true)
19
- .addClass('disabled');
17
+ $col3.val('');
20
18
 
21
19
  } else {
22
- $col3.attr('disabled', false)
23
- .removeClass('disabled');
24
20
 
25
21
  if (col1ColumnType === 'datetime' || col1ColumnType === 'date') {
26
22
  $col3.val(AdminData.jsUtil.dateToString(new Date())).addClass('datepicker');
@@ -45,20 +41,19 @@ AdminData.bindings = {
45
41
  $('#results').html(responseText);
46
42
  }});
47
43
 
48
-
49
44
  AdminData.jsUtil.colorizeRows();
50
45
  },
51
46
 
52
47
  col1_change: function(e) {
53
- var $col1 = $(e.target).closest('select'),
48
+ var col1 = $(e.target).closest('select'),
54
49
  tableStructure = $('#advance_search_table').data('table_structure'),
55
- columnType = tableStructure[$col1.val()],
56
- options = AdminData.mappings[columnType]['options'];
50
+ columnType = tableStructure[col1.val()],
51
+ options = AdminData.mappings[columnType]['options'],
52
+ col2 = col1.parents('tr').find('td select.col2');
57
53
 
58
- $col2 = $col1.parents('tr').find('td select.col2');
59
- $col2.html('');
60
- AdminData.jsUtil.buildOptionsFromArray(options, $col2);
61
- $col2.trigger('change');
54
+ col2.html('');
55
+ AdminData.jsUtil.buildOptionsFromArray(options, col2);
56
+ col2.trigger('change');
62
57
  }
63
58
  };
64
59
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_data
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 16
10
- version: 1.0.16
9
+ - 17
10
+ version: 1.0.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Neeraj Singh
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-23 00:00:00 -04:00
18
+ date: 2010-11-05 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -147,7 +147,6 @@ files:
147
147
  - config/routes.rb
148
148
  - lib/admin_data.rb
149
149
  - lib/admin_data/chelper.rb
150
- - lib/admin_data/compatibility.rb
151
150
  - lib/admin_data/helpers.rb
152
151
  - lib/admin_data/railtie.rb
153
152
  - lib/admin_data/search.rb
@@ -1,7 +0,0 @@
1
- class String
2
- unless method_defined?(:html_safe)
3
- def html_safe
4
- self
5
- end
6
- end
7
- end