apipie-rails 0.7.0 → 0.8.2
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 +4 -4
- data/.github/workflows/build.yml +3 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +43 -0
- data/README.rst +68 -0
- data/apipie-rails.gemspec +1 -0
- data/app/controllers/apipie/apipies_controller.rb +1 -1
- data/app/public/apipie/javascripts/bundled/bootstrap-collapse.js +70 -41
- data/app/public/apipie/javascripts/bundled/bootstrap.js +1033 -479
- data/app/public/apipie/javascripts/bundled/jquery.js +5 -5
- data/app/public/apipie/stylesheets/bundled/bootstrap-responsive.min.css +9 -12
- data/app/public/apipie/stylesheets/bundled/bootstrap.min.css +9 -689
- data/config/locales/ko.yml +31 -0
- data/gemfiles/Gemfile.rails70 +17 -0
- data/lib/apipie/application.rb +6 -4
- data/lib/apipie/configuration.rb +9 -3
- data/lib/apipie/dsl_definition.rb +13 -2
- data/lib/apipie/extractor/recorder.rb +1 -1
- data/lib/apipie/extractor.rb +2 -8
- data/lib/apipie/param_description.rb +8 -4
- data/lib/apipie/rspec/response_validation_helper.rb +2 -2
- data/lib/apipie/swagger_generator.rb +12 -2
- data/lib/apipie/validator.rb +9 -0
- data/lib/apipie/version.rb +1 -1
- data/spec/controllers/included_param_group_controller_spec.rb +13 -0
- data/spec/controllers/users_controller_spec.rb +23 -0
- data/spec/dummy/app/controllers/concerns_controller.rb +1 -1
- data/spec/dummy/app/controllers/{concerns/extending_concern.rb → extending_concern.rb} +0 -2
- data/spec/dummy/app/controllers/included_param_group_controller.rb +19 -0
- data/spec/dummy/app/controllers/overridden_concerns_controller.rb +2 -2
- data/spec/dummy/app/controllers/{concerns/sample_controller.rb → sample_controller.rb} +0 -2
- data/spec/dummy/app/helpers/random_param_group.rb +8 -0
- data/spec/dummy/config/application.rb +1 -1
- data/spec/lib/param_description_spec.rb +86 -0
- data/spec/spec_helper.rb +4 -32
- data/spec/support/custom_bool_validator.rb +17 -0
- metadata +25 -7
- data/Gemfile +0 -1
- data/spec/support/rails-42-ruby-26.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc951bacc1fe43a5e6959b51f722e5a63d37eac5b3b264603d64e93f039d7e34
|
4
|
+
data.tar.gz: 57ab01c41ef9a23b25ccc40f8f4686aace3c2a4601c35bc1c4492b918561e96a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be9da39bd717e0f74bfa1b603fcab4db662bc77139b9062c4f1397f7094c5d464c52462f4580017d8e16ffc13961383b0de8ec9d8841aa9606642ec9b633ceba
|
7
|
+
data.tar.gz: 3c72fb02a1bbed1103c98f3c9a906ee54e657a4bfd65d673c614c03525d43e66d4e8da0e06899c29c814f2a848612f2a342fc984a45b6492121f2fe4e2b27399
|
data/.github/workflows/build.yml
CHANGED
@@ -26,6 +26,7 @@ jobs:
|
|
26
26
|
- Gemfile.rails52 # Min ruby 2.2.2
|
27
27
|
- Gemfile.rails60 # Min ruby 2.5.0
|
28
28
|
- Gemfile.rails61 # Min ruby 2.5.0
|
29
|
+
- Gemfile.rails70 # Min ruby 2.7.0
|
29
30
|
exclude:
|
30
31
|
- gemfile: Gemfile.rails50
|
31
32
|
ruby: 2.7
|
@@ -45,6 +46,8 @@ jobs:
|
|
45
46
|
ruby: '3.0'
|
46
47
|
- gemfile: Gemfile.rails52
|
47
48
|
ruby: 3.1
|
49
|
+
- gemfile: Gemfile.rails70
|
50
|
+
ruby: 2.6
|
48
51
|
|
49
52
|
env:
|
50
53
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,49 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
3
|
|
4
|
+
Also deleted the `Gemfile` that was now a broken symlink.
|
5
|
+
please use `export BUNDLE_GEMFILE='gemfiles/Gemfile.rails61'; bundle exec rspec` to run the test suite
|
6
|
+
|
7
|
+
## [v0.8.2](https://github.com/Apipie/apipie-rails/tree/v0.8.2) (2022-09-03)
|
8
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.8.1...v0.8.2)
|
9
|
+
* Allow custom validators to opt out of allow_blank behavior [#762](https://github.com/Apipie/apipie-rails/pull/762). (Stephen Hanson)
|
10
|
+
* Enforce test coverage, set current 89% as minimum [#764](https://github.com/Apipie/apipie-rails/pull/764). (Mathieu Jobin)
|
11
|
+
* Add contributing instructions to readme [#763](https://github.com/Apipie/apipie-rails/pull/763). (Stephen Hanson)
|
12
|
+
* Fix readme formatting [#765](https://github.com/Apipie/apipie-rails/pull/765). (Stephen Hanson)
|
13
|
+
* Adds expected_type to IntegerValidator example [#769](https://github.com/Apipie/apipie-rails/pull/769). (Jeremy Liberman)
|
14
|
+
* Update readme with error handling example [#768](https://github.com/Apipie/apipie-rails/pull/768). (Jesse Eisenberg)
|
15
|
+
* Fix scope incorrectly set to nil when a param_group is used inside an array_of_hash and the param_group is in a different module / controller. [#693](https://github.com/Apipie/apipie-rails/pull/693) [#774](https://github.com/Apipie/apipie-rails/pull/774). (Omkar Joshi / Oliver Iyer)
|
16
|
+
|
17
|
+
## [v0.8.1](https://github.com/Apipie/apipie-rails/tree/v0.8.1) (2022-05-26)
|
18
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.8.0...v0.8.1)
|
19
|
+
* Remove warning that came back as of [#752](https://github.com/Apipie/apipie-rails/pull/752). [#761](https://github.com/Apipie/apipie-rails/pull/761) (Jorge Santos / Mathieu Jobin)
|
20
|
+
|
21
|
+
## [v0.8.0](https://github.com/Apipie/apipie-rails/tree/v0.8.0) (2022-05-24)
|
22
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.7.2...v0.8.0)
|
23
|
+
* Add support for scheme definition in Swagger docs. [#710](https://github.com/Apipie/apipie-rails/pull/710) (Dan Leyden)
|
24
|
+
* Add support for Rails 7 [#760](https://github.com/Apipie/apipie-rails/pull/760) (Mathieu Jobin)
|
25
|
+
* Clean up code base, removing all trace of unsupported Rails 4.x [#752](https://github.com/Apipie/apipie-rails/pull/752) (Mathieu Jobin)
|
26
|
+
* fix: Controller resource set before version [#744](https://github.com/Apipie/apipie-rails/pull/744) (LuukvH)
|
27
|
+
* fix: enable swagger generator to add referenced schema for an array of hashes param [#689](https://github.com/Apipie/apipie-rails/pull/689) (Francis San Juan)
|
28
|
+
|
29
|
+
## [v0.7.2](https://github.com/Apipie/apipie-rails/tree/v0.7.2) (2022-04-19)
|
30
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.7.1...v0.7.2)
|
31
|
+
* Added Korean locale. [#480](https://github.com/Apipie/apipie-rails/pull/480) (Jaehyun Shin ) [#757](https://github.com/Apipie/apipie-rails/pull/757) (Jorge Santos)
|
32
|
+
* `Security` Upgraded Bootstrap from 2.0.2 to 2.3.2, JQuery from 1.11.3 to 1.12.4 [#708](https://github.com/Apipie/apipie-rails/pull/708) (Nicolas Waissbluth)
|
33
|
+
* Fix ruby2 keyword argument warning [#756](https://github.com/Apipie/apipie-rails/pull/756) (Jorge Santos)
|
34
|
+
|
35
|
+
## [v0.7.1](https://github.com/Apipie/apipie-rails/tree/v0.7.1) (2022-04-06)
|
36
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.7.0...v0.7.1)
|
37
|
+
* Skip extra parameters while validating the keys. [#690](https://github.com/Apipie/apipie-rails/pull/690) (Omkar Joshi)
|
38
|
+
* Support defining security mechanisms for Swagger [#711](https://github.com/Apipie/apipie-rails/pull/711) (Dan Leyden)
|
39
|
+
* Update boolean handling of false [#749](https://github.com/Apipie/apipie-rails/pull/749) (Colin Bruce)
|
40
|
+
|
41
|
+
Note: Up until and including v0.6.x, apipie-rails was silently ignoring allow_blank == false on String validation.
|
42
|
+
when allow_blank is not specified, it default to false. to allow blank strings, you must specify it as a parameter.
|
43
|
+
|
44
|
+
Alternatively, if you want to revert to the previous behavior, you can set this configuration option:
|
45
|
+
`Apipie.configuration.ignore_allow_blank_false = true`.
|
46
|
+
|
4
47
|
## [v0.7.0](https://github.com/Apipie/apipie-rails/tree/v0.7.0) (2022-03-30)
|
5
48
|
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.6.0...v0.7.0)
|
6
49
|
* ArgumentError (invalid byte sequence in UTF-8) [#746](https://github.com/Apipie/apipie-rails/pull/746) (David Milanese)
|
data/README.rst
CHANGED
@@ -966,6 +966,9 @@ validate_presence
|
|
966
966
|
validate_key
|
967
967
|
Check the received params to ensure they are defined in the API. (false by default)
|
968
968
|
|
969
|
+
action_on_non_validated_keys
|
970
|
+
Either `:raise` or `:skip`. If `validate_key` fails, raise error or delete the non-validated key from the params and log the key (`:raise` by default)
|
971
|
+
|
969
972
|
process_params
|
970
973
|
Process and extract the parameter defined from the params of the request
|
971
974
|
to the api_params variable
|
@@ -1021,6 +1024,10 @@ authorize
|
|
1021
1024
|
show_all_examples
|
1022
1025
|
Set this to true to set show_in_doc=1 in all recorded examples
|
1023
1026
|
|
1027
|
+
ignore_allow_blank_false
|
1028
|
+
`allow_blank: false` was incorrectly ignored up until version 0.6.0, this bug was fixed in 0.7.0
|
1029
|
+
if you need the old behavior, set this to true
|
1030
|
+
|
1024
1031
|
link_extension
|
1025
1032
|
The extension to use for API pages ('.html' by default). Link extensions
|
1026
1033
|
in static API docs cannot be changed from '.html'.
|
@@ -1149,6 +1156,21 @@ is raised and can be rescued and processed. It contains a description
|
|
1149
1156
|
of the parameter value expectations. Validations can be turned off
|
1150
1157
|
in the configuration file.
|
1151
1158
|
|
1159
|
+
Here is an example of how to rescue and process a +ParamMissing+ or
|
1160
|
+
+ParamInvalid+ error from within the ApplicationController.
|
1161
|
+
|
1162
|
+
.. code:: ruby
|
1163
|
+
|
1164
|
+
class ApplicationController < ActionController::Base
|
1165
|
+
|
1166
|
+
# ParamError is superclass of ParamMissing, ParamInvalid
|
1167
|
+
rescue_from Apipie::ParamError do |e|
|
1168
|
+
render text: e.message, status: :unprocessable_entity
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
# ...
|
1172
|
+
end
|
1173
|
+
|
1152
1174
|
Parameter validation normally happens after before_actions, just before
|
1153
1175
|
your controller method is invoked. If you prefer to control when parameter
|
1154
1176
|
validation occurs, set the configuration parameter ``validate`` to ``:explicitly``.
|
@@ -1361,6 +1383,10 @@ So we create apipie_validators.rb initializer with this content:
|
|
1361
1383
|
def description
|
1362
1384
|
"Must be #{@type}."
|
1363
1385
|
end
|
1386
|
+
|
1387
|
+
def expected_type
|
1388
|
+
'numeric'
|
1389
|
+
end
|
1364
1390
|
end
|
1365
1391
|
|
1366
1392
|
Parameters of the build method:
|
@@ -1378,6 +1404,16 @@ options
|
|
1378
1404
|
block
|
1379
1405
|
Block converted into Proc, use it as you desire. In this example nil.
|
1380
1406
|
|
1407
|
+
If your validator includes valid values that respond true to `.blank?`, you
|
1408
|
+
should also define:
|
1409
|
+
|
1410
|
+
.. code:: ruby
|
1411
|
+
|
1412
|
+
def ignore_allow_blank?
|
1413
|
+
true
|
1414
|
+
end
|
1415
|
+
|
1416
|
+
so that the validation does not fail for valid values.
|
1381
1417
|
|
1382
1418
|
============
|
1383
1419
|
Versioning
|
@@ -1653,6 +1689,23 @@ There are several configuration parameters that determine the structure of the g
|
|
1653
1689
|
|
1654
1690
|
If ``true``: the ``additional-properties: false`` field will not be included in response object descriptions
|
1655
1691
|
|
1692
|
+
``config.swagger_schemes``
|
1693
|
+
An array of transport schemes that the API supports.
|
1694
|
+
This can include any combination of ``http``, ``https``, ``ws`` and ``wss``.
|
1695
|
+
By default to encourage good security practices, ``['https']`` is specified.
|
1696
|
+
|
1697
|
+
|
1698
|
+
``config:swagger_security_definitions``
|
1699
|
+
If the API requires authentication, you can specify details of the authentication mechanisms supported as a (Hash) value here.
|
1700
|
+
See [https://swagger.io/docs/specification/2-0/authentication/] for details of what values can be specified
|
1701
|
+
By default, no security is defined.
|
1702
|
+
|
1703
|
+
``config.swagger_global_security``
|
1704
|
+
If the API requires authentication, you can specify which of the authentication mechanisms are supported by all API operations as an Array of hashes here.
|
1705
|
+
This should be used in conjunction with the mechanisms defined by ``swagger_security_definitions``.
|
1706
|
+
See [https://swagger.io/docs/specification/2-0/authentication/] for details of what values can be specified
|
1707
|
+
By default, no security is defined.
|
1708
|
+
|
1656
1709
|
|
1657
1710
|
Known limitations of the current implementation
|
1658
1711
|
-------------------------------------------------
|
@@ -1663,6 +1716,7 @@ Known limitations of the current implementation
|
|
1663
1716
|
* It is not possible to leverage all of the parameter type/format capabilities of swagger
|
1664
1717
|
* Only OpenAPI 2.0 is supported
|
1665
1718
|
* Responses are defined inline and not as a $ref
|
1719
|
+
* It is not possible to specify per-operation security requirements (only global)
|
1666
1720
|
|
1667
1721
|
====================================
|
1668
1722
|
Dynamic Swagger generation
|
@@ -1847,6 +1901,20 @@ provided it uses Apipie as a backend.
|
|
1847
1901
|
|
1848
1902
|
And if you write one on your own, don't hesitate to share it with us!
|
1849
1903
|
|
1904
|
+
====================
|
1905
|
+
Contributing
|
1906
|
+
====================
|
1907
|
+
|
1908
|
+
Since this gem does not have a Gemfile, you need to specify it in your shell with:
|
1909
|
+
|
1910
|
+
.. code:: shell
|
1911
|
+
BUNDLE_GEMFILE='gemfiles/Gemfile.rails61'
|
1912
|
+
|
1913
|
+
Then, you can install dependencies and run the test suite:
|
1914
|
+
|
1915
|
+
.. code:: shell
|
1916
|
+
> bundle install
|
1917
|
+
> bundle exec rspec
|
1850
1918
|
|
1851
1919
|
====================
|
1852
1920
|
Disqus Integration
|
data/apipie-rails.gemspec
CHANGED
@@ -34,7 +34,7 @@ module Apipie
|
|
34
34
|
|
35
35
|
@language = get_language
|
36
36
|
|
37
|
-
Apipie.load_documentation if Apipie.configuration.reload_controllers? ||
|
37
|
+
Apipie.load_documentation if Apipie.configuration.reload_controllers? || !Rails.application.config.eager_load
|
38
38
|
|
39
39
|
I18n.locale = @language
|
40
40
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* =============================================================
|
2
|
-
* bootstrap-collapse.js v2.
|
3
|
-
* http://
|
2
|
+
* bootstrap-collapse.js v2.3.2
|
3
|
+
* http://getbootstrap.com/2.3.2/javascript.html#collapse
|
4
4
|
* =============================================================
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2013 Twitter, Inc.
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -17,16 +17,21 @@
|
|
17
17
|
* limitations under the License.
|
18
18
|
* ============================================================ */
|
19
19
|
|
20
|
-
!function( $ ){
|
21
20
|
|
22
|
-
|
21
|
+
!function ($) {
|
23
22
|
|
24
|
-
|
25
|
-
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* COLLAPSE PUBLIC CLASS DEFINITION
|
27
|
+
* ================================ */
|
28
|
+
|
29
|
+
var Collapse = function (element, options) {
|
30
|
+
this.$element = $(element)
|
26
31
|
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
27
32
|
|
28
|
-
if (this.options
|
29
|
-
this.$parent = $(this.options
|
33
|
+
if (this.options.parent) {
|
34
|
+
this.$parent = $(this.options.parent)
|
30
35
|
}
|
31
36
|
|
32
37
|
this.options.toggle && this.toggle()
|
@@ -42,31 +47,39 @@
|
|
42
47
|
}
|
43
48
|
|
44
49
|
, show: function () {
|
45
|
-
var dimension
|
46
|
-
, scroll
|
47
|
-
, actives
|
50
|
+
var dimension
|
51
|
+
, scroll
|
52
|
+
, actives
|
48
53
|
, hasData
|
49
54
|
|
55
|
+
if (this.transitioning || this.$element.hasClass('in')) return
|
56
|
+
|
57
|
+
dimension = this.dimension()
|
58
|
+
scroll = $.camelCase(['scroll', dimension].join('-'))
|
59
|
+
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
60
|
+
|
50
61
|
if (actives && actives.length) {
|
51
62
|
hasData = actives.data('collapse')
|
63
|
+
if (hasData && hasData.transitioning) return
|
52
64
|
actives.collapse('hide')
|
53
65
|
hasData || actives.data('collapse', null)
|
54
66
|
}
|
55
67
|
|
56
68
|
this.$element[dimension](0)
|
57
|
-
this.transition('addClass', 'show', 'shown')
|
58
|
-
this.$element[dimension](this.$element[0][scroll])
|
59
|
-
|
69
|
+
this.transition('addClass', $.Event('show'), 'shown')
|
70
|
+
$.support.transition && this.$element[dimension](this.$element[0][scroll])
|
60
71
|
}
|
61
72
|
|
62
73
|
, hide: function () {
|
63
|
-
var dimension
|
74
|
+
var dimension
|
75
|
+
if (this.transitioning || !this.$element.hasClass('in')) return
|
76
|
+
dimension = this.dimension()
|
64
77
|
this.reset(this.$element[dimension]())
|
65
|
-
this.transition('removeClass', 'hide', 'hidden')
|
78
|
+
this.transition('removeClass', $.Event('hide'), 'hidden')
|
66
79
|
this.$element[dimension](0)
|
67
80
|
}
|
68
81
|
|
69
|
-
, reset: function (
|
82
|
+
, reset: function (size) {
|
70
83
|
var dimension = this.dimension()
|
71
84
|
|
72
85
|
this.$element
|
@@ -74,41 +87,49 @@
|
|
74
87
|
[dimension](size || 'auto')
|
75
88
|
[0].offsetWidth
|
76
89
|
|
77
|
-
this.$element[size ? 'addClass' : 'removeClass']('collapse')
|
90
|
+
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
78
91
|
|
79
92
|
return this
|
80
93
|
}
|
81
94
|
|
82
|
-
, transition: function (
|
95
|
+
, transition: function (method, startEvent, completeEvent) {
|
83
96
|
var that = this
|
84
97
|
, complete = function () {
|
85
|
-
if (startEvent == 'show') that.reset()
|
98
|
+
if (startEvent.type == 'show') that.reset()
|
99
|
+
that.transitioning = 0
|
86
100
|
that.$element.trigger(completeEvent)
|
87
101
|
}
|
88
102
|
|
89
|
-
this.$element
|
90
|
-
|
91
|
-
|
103
|
+
this.$element.trigger(startEvent)
|
104
|
+
|
105
|
+
if (startEvent.isDefaultPrevented()) return
|
106
|
+
|
107
|
+
this.transitioning = 1
|
108
|
+
|
109
|
+
this.$element[method]('in')
|
92
110
|
|
93
111
|
$.support.transition && this.$element.hasClass('collapse') ?
|
94
112
|
this.$element.one($.support.transition.end, complete) :
|
95
113
|
complete()
|
96
|
-
|
114
|
+
}
|
97
115
|
|
98
116
|
, toggle: function () {
|
99
117
|
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
100
|
-
|
118
|
+
}
|
101
119
|
|
102
120
|
}
|
103
121
|
|
104
|
-
/* COLLAPSIBLE PLUGIN DEFINITION
|
105
|
-
* ============================== */
|
106
122
|
|
107
|
-
|
123
|
+
/* COLLAPSE PLUGIN DEFINITION
|
124
|
+
* ========================== */
|
125
|
+
|
126
|
+
var old = $.fn.collapse
|
127
|
+
|
128
|
+
$.fn.collapse = function (option) {
|
108
129
|
return this.each(function () {
|
109
130
|
var $this = $(this)
|
110
131
|
, data = $this.data('collapse')
|
111
|
-
, options = typeof option == 'object' && option
|
132
|
+
, options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option)
|
112
133
|
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
|
113
134
|
if (typeof option == 'string') data[option]()
|
114
135
|
})
|
@@ -121,18 +142,26 @@
|
|
121
142
|
$.fn.collapse.Constructor = Collapse
|
122
143
|
|
123
144
|
|
124
|
-
/*
|
145
|
+
/* COLLAPSE NO CONFLICT
|
125
146
|
* ==================== */
|
126
147
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
148
|
+
$.fn.collapse.noConflict = function () {
|
149
|
+
$.fn.collapse = old
|
150
|
+
return this
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
/* COLLAPSE DATA-API
|
155
|
+
* ================= */
|
156
|
+
|
157
|
+
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
158
|
+
var $this = $(this), href
|
159
|
+
, target = $this.attr('data-target')
|
160
|
+
|| e.preventDefault()
|
161
|
+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
162
|
+
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
163
|
+
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
|
164
|
+
$(target).collapse(option)
|
136
165
|
})
|
137
166
|
|
138
|
-
}(
|
167
|
+
}(window.jQuery);
|