sufia 0.0.2 → 0.0.3
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.
- data/README.md +3 -0
- data/app/assets/javascripts/sufia.js +11 -0
- data/app/assets/stylesheets/sufia.css +1 -0
- data/app/controllers/batch_edits_controller.rb +1 -1
- data/app/controllers/downloads_controller.rb +1 -65
- data/app/controllers/generic_files_controller.rb +1 -296
- data/app/models/datastreams/generic_file_rdf_datastream.rb +0 -4
- data/app/views/_ga.html.erb +2 -2
- data/app/views/batch/edit.html.erb +1 -13
- data/app/views/batch_edits/edit.html.erb +0 -8
- data/app/views/catalog/index.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +0 -19
- data/app/views/generic_files/_media_display.html.erb +6 -6
- data/app/views/generic_files/_show_actions.html.erb +37 -0
- data/app/views/generic_files/_show_descriptions.html.erb +118 -0
- data/app/views/generic_files/_show_details.html.erb +67 -0
- data/app/views/generic_files/edit.html.erb +6 -19
- data/app/views/generic_files/show.html.erb +3 -236
- data/app/views/users/edit.html.erb +0 -6
- data/lib/generators/sufia/templates/catalog_controller.rb +2 -2
- data/lib/generators/sufia/templates/config/sufia.rb +3 -0
- data/lib/sufia.rb +10 -8
- data/lib/sufia/downloads_controller_behavior.rb +77 -0
- data/lib/sufia/files_controller_behavior.rb +245 -0
- data/lib/sufia/generic_file.rb +9 -15
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/generic_files_controller_spec.rb +9 -19
- data/spec/models/generic_file_spec.rb +2 -3
- metadata +7 -7
- data/app/assets/javascripts/batch.js +0 -26
- data/app/assets/javascripts/bootstrap-button.js +0 -96
- data/app/assets/javascripts/bootstrap-dropdown.js +0 -100
- data/app/assets/javascripts/bootstrap-modal.js +0 -218
- data/app/assets/javascripts/dashboard.js +0 -40
@@ -111,7 +111,6 @@ describe GenericFile do
|
|
111
111
|
@file.should respond_to(:language)
|
112
112
|
@file.should respond_to(:rights)
|
113
113
|
@file.should respond_to(:resource_type)
|
114
|
-
@file.should respond_to(:format)
|
115
114
|
@file.should respond_to(:identifier)
|
116
115
|
end
|
117
116
|
it "should delegate methods to characterization metadata" do
|
@@ -191,11 +190,11 @@ describe GenericFile do
|
|
191
190
|
@file.language = "Arabic"
|
192
191
|
@file.rights = "Wide open, buddy."
|
193
192
|
@file.resource_type = "Book"
|
194
|
-
@file.format = "application/pdf"
|
195
193
|
@file.identifier = "urn:isbn:1234567890"
|
196
194
|
@file.based_near = "Medina, Saudi Arabia"
|
197
195
|
@file.related_url = "http://example.org/TheWork/"
|
198
196
|
@file.mime_type = "image/jpeg"
|
197
|
+
@file.format_label = "JPEG Image"
|
199
198
|
local = @file.to_solr
|
200
199
|
local.should_not be_nil
|
201
200
|
local["generic_file__part_of_t"].should be_nil
|
@@ -212,7 +211,7 @@ describe GenericFile do
|
|
212
211
|
local["generic_file__language_t"].should == ["Arabic"]
|
213
212
|
local["generic_file__date_created_t"].should == ["1200"]
|
214
213
|
local["generic_file__resource_type_t"].should == ["Book"]
|
215
|
-
local["
|
214
|
+
local["file_format_t"].should == "jpeg (JPEG Image)"
|
216
215
|
local["generic_file__identifier_t"].should == ["urn:isbn:1234567890"]
|
217
216
|
local["generic_file__based_near_t"].should == ["Medina, Saudi Arabia"]
|
218
217
|
local["mime_type_t"].should == ["image/jpeg"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sufia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -486,12 +486,7 @@ files:
|
|
486
486
|
- app/assets/images/ui-icons_ffd27a_256x240.png
|
487
487
|
- app/assets/images/ui-icons_ffffff_256x240.png
|
488
488
|
- app/assets/images/video-still.png
|
489
|
-
- app/assets/javascripts/batch.js
|
490
|
-
- app/assets/javascripts/bootstrap-button.js
|
491
|
-
- app/assets/javascripts/bootstrap-dropdown.js
|
492
|
-
- app/assets/javascripts/bootstrap-modal.js
|
493
489
|
- app/assets/javascripts/contact_form.js
|
494
|
-
- app/assets/javascripts/dashboard.js
|
495
490
|
- app/assets/javascripts/sufia.js
|
496
491
|
- app/assets/javascripts/terms_of_service.js
|
497
492
|
- app/assets/stylesheets/blacklight_more_facets.css
|
@@ -663,6 +658,9 @@ files:
|
|
663
658
|
- app/views/generic_files/_media_display.html.erb
|
664
659
|
- app/views/generic_files/_permission.html.erb
|
665
660
|
- app/views/generic_files/_rights_modal.html.erb
|
661
|
+
- app/views/generic_files/_show_actions.html.erb
|
662
|
+
- app/views/generic_files/_show_descriptions.html.erb
|
663
|
+
- app/views/generic_files/_show_details.html.erb
|
666
664
|
- app/views/generic_files/_versioning.html.erb
|
667
665
|
- app/views/generic_files/citation.html.erb
|
668
666
|
- app/views/generic_files/edit.html.erb
|
@@ -752,6 +750,8 @@ files:
|
|
752
750
|
- lib/sufia/active_fedora/redis.rb
|
753
751
|
- lib/sufia/active_record/redis.rb
|
754
752
|
- lib/sufia/controller.rb
|
753
|
+
- lib/sufia/downloads_controller_behavior.rb
|
754
|
+
- lib/sufia/files_controller_behavior.rb
|
755
755
|
- lib/sufia/generic_file.rb
|
756
756
|
- lib/sufia/generic_file/audit.rb
|
757
757
|
- lib/sufia/generic_file/characterization.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright © 2012 The Pennsylvania State University
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
/*
|
18
|
-
* function to get some metadata about each file that is being given a title
|
19
|
-
function getThumbnail() {
|
20
|
-
$.ajax({
|
21
|
-
//url: "/downloads/scholarsphere:v979v304g?datastream_id=thumbnail",
|
22
|
-
success: function(data) { },
|
23
|
-
statusCode: function (data) { }
|
24
|
-
});
|
25
|
-
}
|
26
|
-
*/
|
@@ -1,96 +0,0 @@
|
|
1
|
-
/* ============================================================
|
2
|
-
* bootstrap-button.js v2.0.4
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#buttons
|
4
|
-
* ============================================================
|
5
|
-
* Copyright 2012 Twitter, Inc.
|
6
|
-
*
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
* you may not use this file except in compliance with the License.
|
9
|
-
* You may obtain a copy of the License at
|
10
|
-
*
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
*
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
* See the License for the specific language governing permissions and
|
17
|
-
* limitations under the License.
|
18
|
-
* ============================================================ */
|
19
|
-
|
20
|
-
|
21
|
-
!function ($) {
|
22
|
-
|
23
|
-
"use strict"; // jshint ;_;
|
24
|
-
|
25
|
-
|
26
|
-
/* BUTTON PUBLIC CLASS DEFINITION
|
27
|
-
* ============================== */
|
28
|
-
|
29
|
-
var Button = function (element, options) {
|
30
|
-
this.$element = $(element)
|
31
|
-
this.options = $.extend({}, $.fn.button.defaults, options)
|
32
|
-
}
|
33
|
-
|
34
|
-
Button.prototype.setState = function (state) {
|
35
|
-
var d = 'disabled'
|
36
|
-
, $el = this.$element
|
37
|
-
, data = $el.data()
|
38
|
-
, val = $el.is('input') ? 'val' : 'html'
|
39
|
-
|
40
|
-
state = state + 'Text'
|
41
|
-
data.resetText || $el.data('resetText', $el[val]())
|
42
|
-
|
43
|
-
$el[val](data[state] || this.options[state])
|
44
|
-
|
45
|
-
// push to event loop to allow forms to submit
|
46
|
-
setTimeout(function () {
|
47
|
-
state == 'loadingText' ?
|
48
|
-
$el.addClass(d).attr(d, d) :
|
49
|
-
$el.removeClass(d).removeAttr(d)
|
50
|
-
}, 0)
|
51
|
-
}
|
52
|
-
|
53
|
-
Button.prototype.toggle = function () {
|
54
|
-
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
55
|
-
|
56
|
-
$parent && $parent
|
57
|
-
.find('.active')
|
58
|
-
.removeClass('active')
|
59
|
-
|
60
|
-
this.$element.toggleClass('active')
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
/* BUTTON PLUGIN DEFINITION
|
65
|
-
* ======================== */
|
66
|
-
|
67
|
-
$.fn.button = function (option) {
|
68
|
-
return this.each(function () {
|
69
|
-
var $this = $(this)
|
70
|
-
, data = $this.data('button')
|
71
|
-
, options = typeof option == 'object' && option
|
72
|
-
if (!data) $this.data('button', (data = new Button(this, options)))
|
73
|
-
if (option == 'toggle') data.toggle()
|
74
|
-
else if (option) data.setState(option)
|
75
|
-
})
|
76
|
-
}
|
77
|
-
|
78
|
-
$.fn.button.defaults = {
|
79
|
-
loadingText: 'loading...'
|
80
|
-
}
|
81
|
-
|
82
|
-
$.fn.button.Constructor = Button
|
83
|
-
|
84
|
-
|
85
|
-
/* BUTTON DATA-API
|
86
|
-
* =============== */
|
87
|
-
|
88
|
-
$(function () {
|
89
|
-
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
|
90
|
-
var $btn = $(e.target)
|
91
|
-
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
92
|
-
$btn.button('toggle')
|
93
|
-
})
|
94
|
-
})
|
95
|
-
|
96
|
-
}(window.jQuery);
|
@@ -1,100 +0,0 @@
|
|
1
|
-
/* ============================================================
|
2
|
-
* bootstrap-dropdown.js v2.0.4
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
4
|
-
* ============================================================
|
5
|
-
* Copyright 2012 Twitter, Inc.
|
6
|
-
*
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
* you may not use this file except in compliance with the License.
|
9
|
-
* You may obtain a copy of the License at
|
10
|
-
*
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
*
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
* See the License for the specific language governing permissions and
|
17
|
-
* limitations under the License.
|
18
|
-
* ============================================================ */
|
19
|
-
|
20
|
-
|
21
|
-
!function ($) {
|
22
|
-
|
23
|
-
"use strict"; // jshint ;_;
|
24
|
-
|
25
|
-
|
26
|
-
/* DROPDOWN CLASS DEFINITION
|
27
|
-
* ========================= */
|
28
|
-
|
29
|
-
var toggle = '[data-toggle="dropdown"]'
|
30
|
-
, Dropdown = function (element) {
|
31
|
-
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
32
|
-
$('html').on('click.dropdown.data-api', function () {
|
33
|
-
$el.parent().removeClass('open')
|
34
|
-
})
|
35
|
-
}
|
36
|
-
|
37
|
-
Dropdown.prototype = {
|
38
|
-
|
39
|
-
constructor: Dropdown
|
40
|
-
|
41
|
-
, toggle: function (e) {
|
42
|
-
var $this = $(this)
|
43
|
-
, $parent
|
44
|
-
, selector
|
45
|
-
, isActive
|
46
|
-
|
47
|
-
if ($this.is('.disabled, :disabled')) return
|
48
|
-
|
49
|
-
selector = $this.attr('data-target')
|
50
|
-
|
51
|
-
if (!selector) {
|
52
|
-
selector = $this.attr('href')
|
53
|
-
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
54
|
-
}
|
55
|
-
|
56
|
-
$parent = $(selector)
|
57
|
-
$parent.length || ($parent = $this.parent())
|
58
|
-
|
59
|
-
isActive = $parent.hasClass('open')
|
60
|
-
|
61
|
-
clearMenus()
|
62
|
-
|
63
|
-
if (!isActive) $parent.toggleClass('open')
|
64
|
-
|
65
|
-
return false
|
66
|
-
}
|
67
|
-
|
68
|
-
}
|
69
|
-
|
70
|
-
function clearMenus() {
|
71
|
-
$(toggle).parent().removeClass('open')
|
72
|
-
}
|
73
|
-
|
74
|
-
|
75
|
-
/* DROPDOWN PLUGIN DEFINITION
|
76
|
-
* ========================== */
|
77
|
-
|
78
|
-
$.fn.dropdown = function (option) {
|
79
|
-
return this.each(function () {
|
80
|
-
var $this = $(this)
|
81
|
-
, data = $this.data('dropdown')
|
82
|
-
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
83
|
-
if (typeof option == 'string') data[option].call($this)
|
84
|
-
})
|
85
|
-
}
|
86
|
-
|
87
|
-
$.fn.dropdown.Constructor = Dropdown
|
88
|
-
|
89
|
-
|
90
|
-
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
91
|
-
* =================================== */
|
92
|
-
|
93
|
-
$(function () {
|
94
|
-
$('html').on('click.dropdown.data-api', clearMenus)
|
95
|
-
$('body')
|
96
|
-
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
|
97
|
-
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
98
|
-
})
|
99
|
-
|
100
|
-
}(window.jQuery);
|
@@ -1,218 +0,0 @@
|
|
1
|
-
/* =========================================================
|
2
|
-
* bootstrap-modal.js v2.0.4
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#modals
|
4
|
-
* =========================================================
|
5
|
-
* Copyright 2012 Twitter, Inc.
|
6
|
-
*
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
* you may not use this file except in compliance with the License.
|
9
|
-
* You may obtain a copy of the License at
|
10
|
-
*
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
*
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
* See the License for the specific language governing permissions and
|
17
|
-
* limitations under the License.
|
18
|
-
* ========================================================= */
|
19
|
-
|
20
|
-
|
21
|
-
!function ($) {
|
22
|
-
|
23
|
-
"use strict"; // jshint ;_;
|
24
|
-
|
25
|
-
|
26
|
-
/* MODAL CLASS DEFINITION
|
27
|
-
* ====================== */
|
28
|
-
|
29
|
-
var Modal = function (content, options) {
|
30
|
-
this.options = options
|
31
|
-
this.$element = $(content)
|
32
|
-
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
|
33
|
-
}
|
34
|
-
|
35
|
-
Modal.prototype = {
|
36
|
-
|
37
|
-
constructor: Modal
|
38
|
-
|
39
|
-
, toggle: function () {
|
40
|
-
return this[!this.isShown ? 'show' : 'hide']()
|
41
|
-
}
|
42
|
-
|
43
|
-
, show: function () {
|
44
|
-
var that = this
|
45
|
-
, e = $.Event('show')
|
46
|
-
|
47
|
-
this.$element.trigger(e)
|
48
|
-
|
49
|
-
if (this.isShown || e.isDefaultPrevented()) return
|
50
|
-
|
51
|
-
$('body').addClass('modal-open')
|
52
|
-
|
53
|
-
this.isShown = true
|
54
|
-
|
55
|
-
escape.call(this)
|
56
|
-
backdrop.call(this, function () {
|
57
|
-
var transition = $.support.transition && that.$element.hasClass('fade')
|
58
|
-
|
59
|
-
if (!that.$element.parent().length) {
|
60
|
-
that.$element.appendTo(document.body) //don't move modals dom position
|
61
|
-
}
|
62
|
-
|
63
|
-
that.$element
|
64
|
-
.show()
|
65
|
-
|
66
|
-
if (transition) {
|
67
|
-
that.$element[0].offsetWidth // force reflow
|
68
|
-
}
|
69
|
-
|
70
|
-
that.$element.addClass('in')
|
71
|
-
|
72
|
-
transition ?
|
73
|
-
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
|
74
|
-
that.$element.trigger('shown')
|
75
|
-
|
76
|
-
})
|
77
|
-
}
|
78
|
-
|
79
|
-
, hide: function (e) {
|
80
|
-
e && e.preventDefault()
|
81
|
-
|
82
|
-
var that = this
|
83
|
-
|
84
|
-
e = $.Event('hide')
|
85
|
-
|
86
|
-
this.$element.trigger(e)
|
87
|
-
|
88
|
-
if (!this.isShown || e.isDefaultPrevented()) return
|
89
|
-
|
90
|
-
this.isShown = false
|
91
|
-
|
92
|
-
$('body').removeClass('modal-open')
|
93
|
-
|
94
|
-
escape.call(this)
|
95
|
-
|
96
|
-
this.$element.removeClass('in')
|
97
|
-
|
98
|
-
$.support.transition && this.$element.hasClass('fade') ?
|
99
|
-
hideWithTransition.call(this) :
|
100
|
-
hideModal.call(this)
|
101
|
-
}
|
102
|
-
|
103
|
-
}
|
104
|
-
|
105
|
-
|
106
|
-
/* MODAL PRIVATE METHODS
|
107
|
-
* ===================== */
|
108
|
-
|
109
|
-
function hideWithTransition() {
|
110
|
-
var that = this
|
111
|
-
, timeout = setTimeout(function () {
|
112
|
-
that.$element.off($.support.transition.end)
|
113
|
-
hideModal.call(that)
|
114
|
-
}, 500)
|
115
|
-
|
116
|
-
this.$element.one($.support.transition.end, function () {
|
117
|
-
clearTimeout(timeout)
|
118
|
-
hideModal.call(that)
|
119
|
-
})
|
120
|
-
}
|
121
|
-
|
122
|
-
function hideModal(that) {
|
123
|
-
this.$element
|
124
|
-
.hide()
|
125
|
-
.trigger('hidden')
|
126
|
-
|
127
|
-
backdrop.call(this)
|
128
|
-
}
|
129
|
-
|
130
|
-
function backdrop(callback) {
|
131
|
-
var that = this
|
132
|
-
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
133
|
-
|
134
|
-
if (this.isShown && this.options.backdrop) {
|
135
|
-
var doAnimate = $.support.transition && animate
|
136
|
-
|
137
|
-
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
138
|
-
.appendTo(document.body)
|
139
|
-
|
140
|
-
if (this.options.backdrop != 'static') {
|
141
|
-
this.$backdrop.click($.proxy(this.hide, this))
|
142
|
-
}
|
143
|
-
|
144
|
-
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
145
|
-
|
146
|
-
this.$backdrop.addClass('in')
|
147
|
-
|
148
|
-
doAnimate ?
|
149
|
-
this.$backdrop.one($.support.transition.end, callback) :
|
150
|
-
callback()
|
151
|
-
|
152
|
-
} else if (!this.isShown && this.$backdrop) {
|
153
|
-
this.$backdrop.removeClass('in')
|
154
|
-
|
155
|
-
$.support.transition && this.$element.hasClass('fade')?
|
156
|
-
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
|
157
|
-
removeBackdrop.call(this)
|
158
|
-
|
159
|
-
} else if (callback) {
|
160
|
-
callback()
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
function removeBackdrop() {
|
165
|
-
this.$backdrop.remove()
|
166
|
-
this.$backdrop = null
|
167
|
-
}
|
168
|
-
|
169
|
-
function escape() {
|
170
|
-
var that = this
|
171
|
-
if (this.isShown && this.options.keyboard) {
|
172
|
-
$(document).on('keyup.dismiss.modal', function ( e ) {
|
173
|
-
e.which == 27 && that.hide()
|
174
|
-
})
|
175
|
-
} else if (!this.isShown) {
|
176
|
-
$(document).off('keyup.dismiss.modal')
|
177
|
-
}
|
178
|
-
}
|
179
|
-
|
180
|
-
|
181
|
-
/* MODAL PLUGIN DEFINITION
|
182
|
-
* ======================= */
|
183
|
-
|
184
|
-
$.fn.modal = function (option) {
|
185
|
-
return this.each(function () {
|
186
|
-
var $this = $(this)
|
187
|
-
, data = $this.data('modal')
|
188
|
-
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
|
189
|
-
if (!data) $this.data('modal', (data = new Modal(this, options)))
|
190
|
-
if (typeof option == 'string') data[option]()
|
191
|
-
else if (options.show) data.show()
|
192
|
-
})
|
193
|
-
}
|
194
|
-
|
195
|
-
$.fn.modal.defaults = {
|
196
|
-
backdrop: true
|
197
|
-
, keyboard: true
|
198
|
-
, show: true
|
199
|
-
}
|
200
|
-
|
201
|
-
$.fn.modal.Constructor = Modal
|
202
|
-
|
203
|
-
|
204
|
-
/* MODAL DATA-API
|
205
|
-
* ============== */
|
206
|
-
|
207
|
-
$(function () {
|
208
|
-
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
|
209
|
-
var $this = $(this), href
|
210
|
-
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
211
|
-
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
|
212
|
-
|
213
|
-
e.preventDefault()
|
214
|
-
$target.modal(option)
|
215
|
-
})
|
216
|
-
})
|
217
|
-
|
218
|
-
}(window.jQuery);
|