express_admin 1.6.0 → 1.6.1

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/express_admin/scrollTableBody.js +24 -24
  3. data/app/assets/javascripts/express_admin.js +1 -0
  4. data/app/components/express_admin/smart_table.rb +2 -1
  5. data/lib/express_admin/engine.rb +1 -0
  6. data/lib/express_admin/version.rb +1 -1
  7. data/test/dummy/db/test.sqlite3 +0 -0
  8. data/test/dummy/test/components/icon_link_test.rb +0 -1
  9. data/vendor/gems/express_templates/Gemfile.lock +2 -2
  10. data/vendor/gems/express_templates/express_templates-0.11.0.gem +0 -0
  11. data/vendor/gems/express_templates/lib/arbre/patches.rb +2 -2
  12. data/vendor/gems/express_templates/lib/express_templates/compiler.rb +1 -1
  13. data/vendor/gems/express_templates/lib/express_templates/components/all.rb +1 -1
  14. data/vendor/gems/express_templates/lib/express_templates/components/base.rb +0 -4
  15. data/vendor/gems/express_templates/lib/express_templates/components/configurable.rb +3 -1
  16. data/vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb +7 -0
  17. data/vendor/gems/express_templates/lib/express_templates/components/forms/express_form.rb +6 -0
  18. data/vendor/gems/express_templates/lib/express_templates/version.rb +1 -1
  19. data/vendor/gems/express_templates/test/components/forms/basic_fields_test.rb +1 -1
  20. data/vendor/gems/express_templates/test/dummy/log/test.log +3210 -0
  21. metadata +17 -16
  22. data/vendor/gems/express_templates/express_templates-0.10.0.gem +0 -0
  23. data/vendor/gems/express_templates/express_templates-0.10.1.gem +0 -0
  24. data/vendor/gems/express_templates/express_templates-0.7.0.gem +0 -0
  25. data/vendor/gems/express_templates/express_templates-0.7.1.gem +0 -0
  26. data/vendor/gems/express_templates/express_templates-0.8.0.gem +0 -0
  27. data/vendor/gems/express_templates/express_templates-0.9.0.gem +0 -0
  28. data/vendor/gems/express_templates/express_templates-0.9.1.gem +0 -0
  29. data/vendor/gems/express_templates/express_templates-0.9.2.gem +0 -0
  30. data/vendor/gems/express_templates/express_templates-0.9.3.gem +0 -0
  31. data/vendor/gems/express_templates/express_templates-0.9.4.gem +0 -0
  32. data/vendor/gems/express_templates/express_templates-0.9.5.gem +0 -0
  33. data/vendor/gems/express_templates/express_templates-0.9.6.gem +0 -0
  34. data/vendor/gems/express_templates/express_templates-0.9.7.gem +0 -0
  35. data/vendor/gems/express_templates/express_templates-0.9.8.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8701e68cc4e8e5e09d5625f132370a27c4d2aedc
4
- data.tar.gz: a0754bf8a6bb4cf4b3654483dc0fe14e93066a74
3
+ metadata.gz: b7506c6470c547440b995022d7e43a0870e104c3
4
+ data.tar.gz: 5af377c17f7a68e8b803a2f0abbc1b01d04f6606
5
5
  SHA512:
6
- metadata.gz: f459c1f910e6cc6c005bce1931c847f05b2bf1851d27b38c1098b2a8c6bdc4e76174c62c2b2e9a830d0cc6c610a3911ea6129895e7a9a15e4ef7060741470a17
7
- data.tar.gz: 6c5bdd36bdc945659a4b7417d75e1752bf00e3ae9c6b7806170c875a1d10eb2fa2474079b80fc9fd83fff7057f6f5d2b5cf6d403dd05d1441f5e6f9f2b5af728
6
+ metadata.gz: 0811310b3ad2e10e76b0e2d72f9d6e8d9698880fbec890a4f90018a700d4b7a49016163528c707956202274ca572f99b1611b830f4a29438581dfaf8711a3211
7
+ data.tar.gz: e69ee46045156ce056db8438deb34489984e9a5b52a9bb6988ebb308ab4026d9e68998f5a480a714c13470bc8d658598a7caef0e102724ac1548aafd248b5c3d
@@ -2,14 +2,14 @@
2
2
  var defaults = {
3
3
  rowsToDisplay: 10
4
4
  };
5
-
5
+
6
6
  var scrollBarWidth = 15, fixedTableWidth;
7
-
7
+
8
8
  $.fn.scrollTableBody = function(options) {
9
9
  options = $.extend(defaults, options);
10
-
10
+
11
11
  var table = this;
12
-
12
+
13
13
  wrapTable(table, options);
14
14
  alignColumns(table);
15
15
 
@@ -18,52 +18,52 @@
18
18
  if (canDebounce) resizeAlignFunction = _.debounce(resizeAlignFunction, 150);
19
19
  $(window).resize(resizeAlignFunction);
20
20
  };
21
-
21
+
22
22
  function wrapTable(table, options) {
23
23
  var existingClasses = table.attr('class');
24
24
  var existingMarginBottom = table.css('margin-bottom');
25
25
  table.css('margin-bottom', 0);
26
26
  var rowHeight = table.find('tbody tr:first').outerHeight();
27
27
  var tableHeight = rowHeight * options.rowsToDisplay;
28
-
28
+
29
29
  var headerTable = $('<table style="table-layout:fixed;width:auto;margin-bottom:0;" class="jqstb-header-table ' + existingClasses + '"><thead><tr><td></td></tr></thead></table>'),
30
30
  footerTable = $('<table style="table-layout:fixed;width:auto;margin-bottom:' + existingMarginBottom + ';" class="jqstb-footer-table ' + existingClasses + '"><tfoot><tr><td></td></tr></tfoot></table>'),
31
31
  scrollDiv = '<div class="jqstb-scroll" style="height:' + tableHeight + 'px;overflow-y:auto"></div>';
32
-
32
+
33
33
  // Insert the table that will hold the fixed header and footer, and insert the div that will get scrolled
34
34
  table.before(headerTable).before(scrollDiv).after(footerTable);
35
35
  }
36
-
36
+
37
37
  function alignColumns(table) {
38
38
  table.each(function (index) {
39
39
  // To minimize "Flash of Unstyled Content" (FOUC), set the relevant variables before manipulating the DOM
40
40
  var $dataTable = $(this);
41
41
  var $headerTable = $('table.jqstb-header-table').eq(index);
42
42
  var $footerTable = $('table.jqstb-footer-table').eq(index);
43
-
43
+
44
44
  // Place main table data inside of relevant scrollable div (using jQuery eq() and index)
45
45
  var $scrollDiv = $('div.jqstb-scroll').eq(index);
46
46
  $scrollDiv.prepend($dataTable);
47
47
  var scrollEl = $scrollDiv[0];
48
-
48
+
49
49
  var hasHorizontalScroll = scrollEl.clientWidth < scrollEl.scrollWidth;
50
50
  $scrollDiv.outerWidth(fixedTableWidth + scrollBarWidth + 2);
51
-
51
+
52
52
  if (hasHorizontalScroll) {
53
53
  var dataTableWidth = $dataTable.outerWidth();
54
54
  $headerTable.width(dataTableWidth);
55
55
  $footerTable.width(dataTableWidth);
56
56
  $scrollDiv.outerWidth(scrollEl.clientWidth);
57
57
  var scrollDivWidth = $scrollDiv.outerWidth();
58
-
58
+
59
59
  var width = scrollDivWidth - scrollBarWidth;
60
-
60
+
61
61
  var $headerScrollDiv = $('<div style="overflow:hidden;width:' + width + 'px" class="jqstb-header-scroll"></div>');
62
62
  $headerTable.wrap($headerScrollDiv);
63
-
63
+
64
64
  var $footerScrollDiv = $('<div style="overflow:hidden;width:' + width + 'px" class="jqstb-footer-scroll"></div>');
65
65
  $footerTable.wrap($footerScrollDiv);
66
-
66
+
67
67
  $scrollDiv.on('scroll', function() {
68
68
  $('div.jqstb-header-scroll').scrollLeft($(this).scrollLeft());
69
69
  $('div.jqstb-footer-scroll').scrollLeft($(this).scrollLeft());
@@ -74,7 +74,7 @@
74
74
  $dataTable.find('thead tr:first th, tbody tr:first td').each(function () {
75
75
  $(this).outerWidth($(this).outerWidth());
76
76
  });
77
-
77
+
78
78
  // Insert header data into fixed header table
79
79
  $headerTable.find('thead').replaceWith($dataTable.children('caption, thead').clone());
80
80
 
@@ -82,15 +82,15 @@
82
82
  $dataTable.find('tfoot tr:first td').each(function () {
83
83
  $(this).outerWidth($(this).outerWidth());
84
84
  });
85
-
85
+
86
86
  // Insert footer data into fixed footer table
87
87
  $footerTable.find('tfoot').replaceWith($dataTable.children('tfoot').clone());
88
-
88
+
89
89
  // Hide original caption, header, and footer
90
90
  $dataTable.children('caption, thead, tfoot').hide();
91
91
  });
92
92
  }
93
-
93
+
94
94
  function alignOnResize(table) {
95
95
  table.each(function (index) {
96
96
  var $dataTable = $(this);
@@ -99,7 +99,7 @@
99
99
 
100
100
  // Temporarily show the inner table's header and footer since the dom calculates width based on them being visible
101
101
  $dataTable.children('thead, tfoot').show();
102
-
102
+
103
103
  var scrollEl = $('div.jqstb-scroll')[0];
104
104
  var hasHorizontalScroll = scrollEl.clientWidth < scrollEl.scrollWidth;
105
105
  if (hasHorizontalScroll) {
@@ -107,7 +107,7 @@
107
107
  $('div.jqstb-header-scroll').outerWidth(scrollDivWidth - scrollBarWidth);
108
108
  $('div.jqstb-footer-scroll').outerWidth(scrollDivWidth - scrollBarWidth);
109
109
  }
110
-
110
+
111
111
  // Force column widths to be set for each header column
112
112
  var $headerColumns = $headerTable.find('thead tr:first th');
113
113
  $dataTable.find('thead tr:first th').each(function (i) {
@@ -119,9 +119,9 @@
119
119
  $dataTable.find('tfoot tr:first td').each(function (i) {
120
120
  $footerColumns.eq(i).outerWidth($(this).outerWidth());
121
121
  });
122
-
123
- // Hide the inner table's header and footer when we're done
122
+
123
+ // Hide the inner table's header and footer when we're done
124
124
  $dataTable.children('thead, tfoot').hide();
125
125
  });
126
126
  }
127
- })(jQuery);
127
+ })(jQuery);
@@ -4,6 +4,7 @@
4
4
  //= require jquery.loadingdotdotdot
5
5
  //= require tinymce-jquery
6
6
  //= require select2
7
+ //= require dropzone
7
8
  //= require ace/ace
8
9
  //= require ace/worker-html
9
10
  //= require ace/mode-ruby
@@ -44,6 +44,7 @@ module ExpressAdmin
44
44
  }
45
45
  }
46
46
  tbody {
47
+ stored_member_assigns = assigns[collection_member_name.to_sym]
47
48
  collection.each do |item|
48
49
  assigns[collection_member_name.to_sym] = item
49
50
  tr(id: row_id(item), class: row_class(item)) {
@@ -55,7 +56,7 @@ module ExpressAdmin
55
56
  actions_column(item) if should_show_actions?
56
57
  hidden_column_cell if columns_hidden?
57
58
  }
58
- assigns[collection_member_name.to_sym] = nil
59
+ assigns[collection_member_name.to_sym] = stored_member_assigns
59
60
  end ; nil
60
61
  }
61
62
 
@@ -5,6 +5,7 @@ require 'express_templates'
5
5
  require 'jquery-rails'
6
6
  require 'jquery-ui-rails'
7
7
  require 'select2-rails'
8
+ require 'dropzonejs-rails'
8
9
  require 'foundation_apps_styles'
9
10
  require 'bourbon'
10
11
  require 'gravatar_image_tag'
@@ -1,3 +1,3 @@
1
1
  module ExpressAdmin
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
Binary file
@@ -39,7 +39,6 @@ module ExpressAdmin
39
39
  end
40
40
 
41
41
  test "icon-link target set to blank" do
42
- # binding.pry
43
42
  assert_match /target="_blank"/, rendered_icon_link(target: "#{resource[:target]}")
44
43
  end
45
44
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- express_templates (0.10.0)
4
+ express_templates (0.10.1)
5
5
  activesupport (~> 4.2)
6
6
  arbre (~> 1.0)
7
7
  parslet (~> 1.6)
@@ -88,7 +88,7 @@ GEM
88
88
  ruby-progressbar
89
89
  nokogiri (1.6.6.2)
90
90
  mini_portile (~> 0.6.0)
91
- parslet (1.7.0)
91
+ parslet (1.7.1)
92
92
  blankslate (>= 2.0, <= 4.0)
93
93
  pry (0.10.1)
94
94
  coderay (~> 1.1.0)
@@ -46,8 +46,8 @@ module Arbre
46
46
  def method_missing(name, *args, &block)
47
47
  if current_arbre_element.respond_to?(name)
48
48
  current_arbre_element.send name, *args, &block
49
- elsif assigns && assigns.has_key?(name)
50
- assigns[name]
49
+ elsif assigns && assigns.has_key?(name.to_sym)
50
+ assigns[name.to_sym]
51
51
  elsif helpers.respond_to?(name)
52
52
  helper_method(name, *args, &block)
53
53
  elsif route_proxy = possible_route_proxy(name)
@@ -4,7 +4,7 @@ module ExpressTemplates
4
4
 
5
5
  template, src = _normalize(template_or_src)
6
6
 
7
- %Q[Arbre::Context.new(assigns.merge(template_virtual_path: @virtual_path), self) { #{src || block.source_body} }.to_s]
7
+ %Q[assigns.merge!(template_virtual_path: @virtual_path) ; Arbre::Context.new(assigns, self) { #{src || block.source_body} }.to_s]
8
8
  end
9
9
 
10
10
  private
@@ -7,7 +7,7 @@ module ExpressTemplates
7
7
  contains -> (&block) {
8
8
  prepended
9
9
  collection.each do |item|
10
- assigns[member_name] = item
10
+ assigns[member_name.to_sym] = item
11
11
  block.call(self) if block
12
12
  end
13
13
  appended
@@ -32,10 +32,6 @@ module ExpressTemplates
32
32
  add_class _default_classes
33
33
  end
34
34
 
35
- def assigns
36
- @assigns_with_indifferent_access ||= super.merge(helpers.assigns.with_indifferent_access)
37
- end
38
-
39
35
  def self.contains(proc = nil, &block)
40
36
  define_method(:_build_body, &(proc || block))
41
37
  end
@@ -86,7 +86,9 @@ module ExpressTemplates
86
86
  if !!value[:attribute]
87
87
  set_attribute key, value[:default]
88
88
  else
89
- config[key] ||= value[:default]
89
+ if config[key].nil?
90
+ config[key] = value[:default]
91
+ end
90
92
  end
91
93
  end
92
94
  end
@@ -28,6 +28,13 @@ RUBY
28
28
  # }
29
29
  # end
30
30
 
31
+ class File < FormComponent
32
+ contains {
33
+ label_tag(label_name, label_text)
34
+ file_field_tag field_name_attribute, field_helper_options
35
+ }
36
+ end
37
+
31
38
  class Textarea < FormComponent
32
39
  contains {
33
40
  label_tag(label_name, label_text)
@@ -10,6 +10,7 @@ module ExpressTemplates
10
10
  has_option :action, 'The form action containing the resource path or url.'
11
11
  has_option :on_success, 'Pass a form value indicating where to go on a successful submission.'
12
12
  has_option :on_failure, 'Pass a form value indicating where to go on a failed submission.'
13
+ has_option :enctype, 'The enctype attribute specifies how the form-data should be encoded when submitting it to the server.'
13
14
 
14
15
  prepends -> {
15
16
  div(style: 'display:none') {
@@ -24,6 +25,7 @@ module ExpressTemplates
24
25
  before_build -> {
25
26
  set_attribute(:id, form_id)
26
27
  set_attribute(:action, form_action)
28
+ set_attribute(:enctype, form_enctype) if form_enctype
27
29
  add_class(config[:id])
28
30
  }
29
31
 
@@ -35,6 +37,10 @@ module ExpressTemplates
35
37
  config[:action] || (resource.try(:persisted?) ? resource_path(resource) : collection_path)
36
38
  end
37
39
 
40
+ def form_enctype
41
+ config[:enctype]
42
+ end
43
+
38
44
  end
39
45
  end
40
46
  end
@@ -1,3 +1,3 @@
1
1
  module ExpressTemplates
2
- VERSION = "0.10.1"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -3,7 +3,7 @@ require 'active_model'
3
3
 
4
4
  class BasicFieldsTest < ActiveSupport::TestCase
5
5
 
6
- BASIC_FIELDS = %w(email phone text password color date datetime
6
+ BASIC_FIELDS = %w(email phone text password color file date datetime
7
7
  datetime_local number range
8
8
  search telephone time url week)
9
9