active_scaffold 3.4.32 → 3.4.33

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6004a079b687a908646771e73d99729c021c96ee
4
- data.tar.gz: eac7053cc13b120de1dc2103238b30244c591cde
3
+ metadata.gz: 60cdf903df7b52febfb72af4ada25aa1dde35832
4
+ data.tar.gz: f91b93961a06dc90b8f637a377e0e1c766086b8b
5
5
  SHA512:
6
- metadata.gz: 825c92099164fb09b36c7bc96a949658b189bd53a135767b17e12051f35eeb7ac5ab5683aa3f6f82394d98e29778d5fc6dfa3862263fff5418e18d76268f1b21
7
- data.tar.gz: 5bced1d19c67d2c2b6d9d7eb0abe8c41445ff82acc5932a35e6b58ade664b401a94d4844a7e250a2bd0ce4233b35193647f216cf3895b7e1b19585113f85cc79
6
+ metadata.gz: 3fbd34b94bbf32f7bce0acf7473eebe3a95969a184eb6a5144c0962edc13dd36466f7de6ef10a089b9bc12e7b57314b059eea4eb28e5c88994109f0ffa60626c
7
+ data.tar.gz: 0f831be90516eb337de6f593dd8ae7fa0bebdbdf9ae525ca10afd2c7d2b3a190f5d1f7fdb4b2cf758c75a936f3710ec2e684e9b22fe3b6e975465c2955c2246c
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ = 3.4.33
2
+ - Fix _base_form when used with actions, so :multipart and :persistent can set to false instead of getting them from action config
3
+ - Copy update.columns from create.columns, if not defined
4
+ - Ensure ajax:complete is called to enable form after render_form_field request, even if element is removed
5
+
6
+ = 3.4.32
1
7
  - Add ActiveScaffold.reload_embedded JS method, to reload an embedded scaffold
2
8
  - Fix nested on composite primary key associations
3
9
  - Fix render :super on partials rendered with :collection (like _list_record)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2015 Richard White, Sergio Cambra and contributors
1
+ Copyright © 2006—2016 Richard White, Sergio Cambra and contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -5,6 +5,7 @@ Overview
5
5
  [![Test Coverage](https://codeclimate.com/github/activescaffold/active_scaffold/badges/coverage.svg)](https://codeclimate.com/github/activescaffold/active_scaffold)
6
6
  [![Dependency Status](https://gemnasium.com/activescaffold/active_scaffold.svg)](https://gemnasium.com/activescaffold/active_scaffold)
7
7
  [![Gem Version](https://badge.fury.io/rb/active_scaffold.svg)](https://badge.fury.io/rb/active_scaffold)
8
+ [![Inline docs](https://inch-ci.org/github/activescaffold/active_scaffold.svg?branch=master)](https://inch-ci.org/github/activescaffold/active_scaffold)
8
9
 
9
10
  ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control. Rails 3.2 and 4.x are supported, ruby >= 1.9 required. For rails 4 is recommended >= 4.0.5.
10
11
 
@@ -984,7 +984,8 @@ var ActiveScaffold = {
984
984
  complete: function(xhr, status) {
985
985
  element = as_form.find('#'+element.attr('id'));
986
986
  element.nextAll('img.loading-indicator').css('visibility','hidden');
987
- element.trigger('ajax:complete', [xhr, status]);
987
+ var complete_element = element.length ? element : as_form;
988
+ complete_element.trigger('ajax:complete', [xhr, status]);
988
989
  if (ActiveScaffold.last_focus) {
989
990
  var item = jQuery(ActiveScaffold.last_focus);
990
991
  if (item.closest('body').length == 0 && item.attr('id')) item = jQuery('#' + item.attr('id'));
@@ -3,9 +3,10 @@
3
3
  url_options ||= params_for(:action => form_action)
4
4
  xhr = request.xhr? if xhr.nil?
5
5
  if active_scaffold_config.actions.include? form_action
6
- multipart ||= active_scaffold_config.send(form_action).multipart?
7
- columns ||= active_scaffold_config.send(form_action).columns
8
- persistent ||= active_scaffold_config.send(form_action).persistent
6
+ action_config = active_scaffold_config.send(form_action)
7
+ multipart ||= action_config.multipart? unless local_assigns.has_key? :multipart
8
+ columns ||= action_config.columns unless local_assigns.has_key? :columns
9
+ persistent ||= action_config.persistent unless local_assigns.has_key? :persistent
9
10
  else
10
11
  multipart ||= false
11
12
  columns ||= nil
@@ -81,11 +81,15 @@ module ActiveScaffold::Config
81
81
  private
82
82
 
83
83
  def build_action_columns(val)
84
- ActiveScaffold::DataStructures::ActionColumns.new(*val).tap do |columns|
85
- columns.action = self
86
- columns.set_columns(@core.columns)
87
- columns
88
- end
84
+ columns =
85
+ if val.is_a?(ActiveScaffold::DataStructures::ActionColumns)
86
+ val.dup
87
+ else
88
+ ActiveScaffold::DataStructures::ActionColumns.new(*val)
89
+ end
90
+ columns.action = self
91
+ columns.set_columns(@core.columns)
92
+ columns
89
93
  end
90
94
 
91
95
  def self.columns_accessor(*names, &block)
@@ -161,7 +161,7 @@ module ActiveScaffold::Config
161
161
  content_columns = Set.new(model.content_columns.map(&:name))
162
162
  @columns.exclude(*self.class.ignore_columns)
163
163
  @columns.exclude(*@columns.find_all { |c| c.column && content_columns.exclude?(c.column.name) }.collect(&:name))
164
- @columns.exclude(*model.reflect_on_all_associations.collect { |a| :"#{a.name}_type" if a.options[:polymorphic] }.compact)
164
+ @columns.exclude(*model.reflect_on_all_associations.collect { |a| a.foreign_type.to_sym if a.options[:polymorphic] }.compact)
165
165
 
166
166
  # inherit the global frontend
167
167
  @frontend = self.class.frontend
@@ -17,6 +17,8 @@ module ActiveScaffold::Config
17
17
  end
18
18
  @@link = ActiveScaffold::DataStructures::ActionLink.new('edit', :label => :edit, :type => :member, :security_method => :update_authorized?, :ignore_method => :update_ignore?)
19
19
 
20
+ columns_accessor :columns, :copy => :create
21
+
20
22
  # instance-level configuration
21
23
  # ----------------------------
22
24
 
@@ -153,7 +153,7 @@ module ActiveScaffold
153
153
 
154
154
  def render_action_link(link, record = nil, options = {})
155
155
  if link.action.nil? || link.column.try(:polymorphic_association?)
156
- link = action_link_to_inline_form(link, record)
156
+ link = action_link_to_inline_form(link, record) if link.column.try(:association)
157
157
  options[:authorized] = false if link.action.nil? || link.controller.nil?
158
158
  options.delete :link if link.crud_type == :create
159
159
  end
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 32
5
+ PATCH = 33
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -11,6 +11,10 @@ module Config
11
11
  @config.create.link = @default_link
12
12
  end
13
13
 
14
+ def test_default_columns
15
+ assert_equal [:a, :d, :other_model, :other_models], @config.create.columns.names
16
+ end
17
+
14
18
  def test_default_options
15
19
  refute @config.create.persistent
16
20
  assert @config.create.action_after_create.nil?
@@ -6,6 +6,14 @@ module Config
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  end
8
8
 
9
+ def test_copy_columns_from_create
10
+ @config.create.columns = [:a, :c, :d]
11
+ assert_equal [:a, :d], @config.create.columns.names
12
+ @config.update.columns = @config.create.columns
13
+ @config._load_action_columns
14
+ assert_equal [:a, :c, :d], @config.update.columns.names
15
+ end
16
+
9
17
  def test__params_for_columns__returns_all_params
10
18
  @config._load_action_columns
11
19
  @config.columns[:a].params.add :keep_a, :a_temp
@@ -4,8 +4,9 @@ class ModelStub < ActiveRecord::Base
4
4
  has_many :other_models, :class_name => 'ModelStub'
5
5
 
6
6
  cattr_accessor :stubbed_columns
7
- self.stubbed_columns = [:a, :b, :c, :d, :id]
7
+ self.stubbed_columns = [:a, :b, :c, :d, :id, :created_at]
8
8
  attr_accessor *stubbed_columns
9
+ self.primary_key = :id
9
10
 
10
11
  @@nested_scope_calls = []
11
12
  cattr_accessor :nested_scope_calls
@@ -34,7 +35,11 @@ class ModelStub < ActiveRecord::Base
34
35
  end
35
36
 
36
37
  def self.columns
37
- @columns ||= stubbed_columns.map { |c| ColumnMock.new(c.to_s, '', 'varchar(255)') }
38
+ @columns ||= stubbed_columns.map do |c|
39
+ column = ColumnMock.new(c.to_s, '', 'varchar(255)')
40
+ column.primary = true if c.to_s == self.primary_key.to_s && column.respond_to?(:primary=)
41
+ column
42
+ end
38
43
  end
39
44
 
40
45
  def self.columns_hash
@@ -42,10 +47,13 @@ class ModelStub < ActiveRecord::Base
42
47
  end
43
48
 
44
49
  # column-level security methods, used for testing
45
- def self.a_authorized_for_bar?(user)
50
+ def self.a_authorized_for_bar?
46
51
  true
47
52
  end
48
- def self.b_authorized?(user)
53
+ def self.b_authorized?
54
+ false
55
+ end
56
+ def self.c_authorized_for_create?
49
57
  false
50
58
  end
51
59
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.32
4
+ version: 3.4.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: brakeman
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement