fe 2.0.6 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/fe/spinner.gif +0 -0
- data/app/assets/javascripts/fe/fe.admin.js +29 -29
- data/app/assets/javascripts/fe/fe.common.js.erb +7 -7
- data/app/assets/javascripts/fe/fe.public.nojquery.js.erb +48 -43
- data/app/assets/javascripts/fe/jquery.html5_upload.js +15 -15
- data/app/assets/javascripts/fe/jquery.metadata.js +6 -6
- data/app/assets/javascripts/fe/jquery.uploadify.v2.1.0.js +27 -26
- data/app/helpers/fe/application_helper.rb +1 -1
- data/app/models/fe/question_set.rb +2 -5
- data/app/views/fe/admin/question_sheets/show.html.erb +1 -1
- data/app/views/fe/questions/fe/_attachment_field.html.erb +2 -2
- data/app/views/layouts/fe/application.html.erb +1 -1
- data/lib/fe/version.rb +1 -1
- metadata +5 -7
- data/spec/dummy/log/test.log +0 -129409
@@ -28,7 +28,7 @@ if(jQuery)(
|
|
28
28
|
jQuery.extend(jQuery.fn,{
|
29
29
|
uploadify:function(options) {
|
30
30
|
jQuery(this).each(function(){
|
31
|
-
settings = jQuery.extend({
|
31
|
+
let settings = jQuery.extend({
|
32
32
|
id : jQuery(this).attr('id'), // The ID of the object being Uploadified
|
33
33
|
uploader : 'uploadify.swf', // The path to the uploadify swf file
|
34
34
|
script : 'uploadify.php', // The path to the uploadify backend upload script
|
@@ -55,11 +55,11 @@ if(jQuery)(
|
|
55
55
|
onComplete : function() {}, // Function to run when an upload is completed
|
56
56
|
onAllComplete : function() {} // Functino to run when all uploads are completed
|
57
57
|
}, options);
|
58
|
-
|
58
|
+
let pagePath = location.pathname;
|
59
59
|
pagePath = pagePath.split('/');
|
60
60
|
pagePath.pop();
|
61
61
|
pagePath = pagePath.join('/') + '/';
|
62
|
-
|
62
|
+
let data = {};
|
63
63
|
data.uploadifyID = settings.id;
|
64
64
|
data.pagepath = pagePath;
|
65
65
|
if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg);
|
@@ -68,8 +68,8 @@ if(jQuery)(
|
|
68
68
|
data.script = settings.script;
|
69
69
|
data.folder = escape(settings.folder);
|
70
70
|
if (settings.scriptData) {
|
71
|
-
|
72
|
-
for (
|
71
|
+
let scriptDataString = '';
|
72
|
+
for (let name in settings.scriptData) {
|
73
73
|
scriptDataString += '&' + name + '=' + settings.scriptData[name];
|
74
74
|
}
|
75
75
|
data.scriptData = escape(scriptDataString.substr(1));
|
@@ -102,24 +102,25 @@ if(jQuery)(
|
|
102
102
|
}
|
103
103
|
jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) {
|
104
104
|
if (event.data.action(event, ID, fileObj) !== false) {
|
105
|
-
|
106
|
-
|
105
|
+
let byteSize = Math.round(fileObj.size / 1024 * 100) * .01;
|
106
|
+
let suffix = 'KB';
|
107
107
|
if (byteSize > 1000) {
|
108
108
|
byteSize = Math.round(byteSize *.001 * 100) * .01;
|
109
109
|
suffix = 'MB';
|
110
110
|
}
|
111
|
-
|
111
|
+
let sizeParts = byteSize.toString().split('.');
|
112
112
|
if (sizeParts.length > 1) {
|
113
113
|
byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2);
|
114
114
|
} else {
|
115
115
|
byteSize = sizeParts[0];
|
116
116
|
}
|
117
|
+
let fileName;
|
117
118
|
if (fileObj.name.length > 20) {
|
118
119
|
fileName = fileObj.name.substr(0,20) + '...';
|
119
120
|
} else {
|
120
121
|
fileName = fileObj.name;
|
121
122
|
}
|
122
|
-
queue = '#' + jQuery(this).attr('id') + 'Queue';
|
123
|
+
let queue = '#' + jQuery(this).attr('id') + 'Queue';
|
123
124
|
if (event.data.queueID) {
|
124
125
|
queue = '#' + event.data.queueID;
|
125
126
|
}
|
@@ -143,18 +144,18 @@ if(jQuery)(
|
|
143
144
|
}
|
144
145
|
});
|
145
146
|
jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) {
|
146
|
-
|
147
|
+
let postData = new Object();
|
147
148
|
postData = fileQueueObj;
|
148
149
|
postData.folder = pagePath + folder;
|
149
150
|
if (single) {
|
150
|
-
for (
|
151
|
-
|
151
|
+
for (let ID in fileQueueObj) {
|
152
|
+
let singleFileID = ID;
|
152
153
|
}
|
153
154
|
}
|
154
155
|
jQuery.post(checkScript, postData, function(data) {
|
155
|
-
for(
|
156
|
+
for(let key in data) {
|
156
157
|
if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) {
|
157
|
-
|
158
|
+
let replaceFile = confirm("Do you want to replace the file " + data[key] + "?");
|
158
159
|
if (!replaceFile) {
|
159
160
|
document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true,true);
|
160
161
|
}
|
@@ -169,17 +170,17 @@ if(jQuery)(
|
|
169
170
|
});
|
170
171
|
jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, clearFast) {
|
171
172
|
if (event.data.action(event, ID, fileObj, data, clearFast) !== false) {
|
172
|
-
|
173
|
+
let fadeSpeed = (clearFast == true) ? 0 : 250;
|
173
174
|
jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() });
|
174
175
|
}
|
175
176
|
});
|
176
177
|
if (typeof(settings.onClearQueue) == 'function') {
|
177
178
|
jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue);
|
178
179
|
}
|
179
|
-
|
180
|
+
let errorArray = [];
|
180
181
|
jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) {
|
181
182
|
if (event.data.action(event, ID, fileObj, errorObj) !== false) {
|
182
|
-
|
183
|
+
let fileArray = new Array(ID, fileObj, errorObj);
|
183
184
|
errorArray.push(fileArray);
|
184
185
|
jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error");
|
185
186
|
jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError');
|
@@ -210,16 +211,16 @@ if(jQuery)(
|
|
210
211
|
});
|
211
212
|
},
|
212
213
|
uploadifySettings:function(settingName, settingValue, resetObject) {
|
213
|
-
|
214
|
+
let returnValue = false;
|
214
215
|
jQuery(this).each(function() {
|
215
216
|
if (settingName == 'scriptData' && settingValue != null) {
|
216
217
|
if (resetObject) {
|
217
|
-
|
218
|
+
let scriptData = settingValue;
|
218
219
|
} else {
|
219
|
-
|
220
|
+
let scriptData = jQuery.extend(settings.scriptData, settingValue);
|
220
221
|
}
|
221
|
-
|
222
|
-
for (
|
222
|
+
let scriptDataString = '';
|
223
|
+
for (let name in scriptData) {
|
223
224
|
scriptDataString += '&' + name + '=' + escape(scriptData[name]);
|
224
225
|
}
|
225
226
|
settingValue = scriptDataString.substr(1);
|
@@ -228,10 +229,10 @@ if(jQuery)(
|
|
228
229
|
});
|
229
230
|
if (settingValue == null) {
|
230
231
|
if (settingName == 'scriptData') {
|
231
|
-
|
232
|
-
|
233
|
-
for (
|
234
|
-
|
232
|
+
let returnSplit = unescape(returnValue).split('&');
|
233
|
+
let returnObj = new Object();
|
234
|
+
for (let i = 0; i < returnSplit.length; i++) {
|
235
|
+
let iSplit = returnSplit[i].split('=');
|
235
236
|
returnObj[iSplit[0]] = iSplit[1];
|
236
237
|
}
|
237
238
|
returnValue = returnObj;
|
@@ -42,7 +42,7 @@ module Fe
|
|
42
42
|
|
43
43
|
def spinner(extra = nil)
|
44
44
|
e = extra ? "spinner_#{extra}" : 'spinner'
|
45
|
-
image_tag('spinner.gif', id: e, style: 'display:none', class: 'spinner')
|
45
|
+
image_tag('fe/spinner.gif', id: e, style: 'display:none', class: 'spinner')
|
46
46
|
end
|
47
47
|
|
48
48
|
def link_to_function(name, *args, &block)
|
@@ -107,12 +107,9 @@ module Fe
|
|
107
107
|
values = [Date.new(year.to_i, month.to_i, 1).strftime('%Y-%m-%d')] # for mm/yy drop downs
|
108
108
|
end
|
109
109
|
elsif param.kind_of?(Hash)
|
110
|
-
|
111
|
-
# If value is also a hash, use the value hash without escaping or anything,
|
112
|
-
# so that custom elements can be implemented by handling set_response.
|
113
|
-
values = param.values.map {|v| v.is_a?(Hash) ? v : CGI.unescape(v)}
|
110
|
+
values = param.values
|
114
111
|
elsif param.kind_of?(String)
|
115
|
-
values = [
|
112
|
+
values = [param]
|
116
113
|
end
|
117
114
|
|
118
115
|
# Hash may contain empty string to force post for no checkboxes
|
@@ -96,7 +96,7 @@
|
|
96
96
|
<script type="text/javascript">
|
97
97
|
$(function() {
|
98
98
|
|
99
|
-
|
99
|
+
let $input = $("<%= base_element %> .upload_field").html5_upload({
|
100
100
|
url: function(number) {
|
101
101
|
return "<%= save_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: element_id, answer_sheet_type: @answer_sheet.class.name) %>";
|
102
102
|
},
|
@@ -143,7 +143,7 @@
|
|
143
143
|
$.event.props.push('dataTransfer');
|
144
144
|
}
|
145
145
|
|
146
|
-
|
146
|
+
let $drop = $('<%= base_element %> .drop_area');
|
147
147
|
$drop.on('dragover dragenter', function(e) {
|
148
148
|
$drop.addClass('file_hover');
|
149
149
|
return false;
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<%= stylesheet_link_tag "base" %>
|
9
9
|
|
10
10
|
<script type="text/javascript" charset="utf-8">
|
11
|
-
|
11
|
+
let answer_sheet_type = "<%= @answer_sheet.class %>"
|
12
12
|
</script>
|
13
13
|
<%= csrf_meta_tag %>
|
14
14
|
<%= stylesheet_link_tag asset_path("fe/fe.screen.css") %>
|
data/lib/fe/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CruGlobal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -228,7 +228,7 @@ dependencies:
|
|
228
228
|
version: '0'
|
229
229
|
description: A rails engine that facilitates question/answer stuff
|
230
230
|
email:
|
231
|
-
-
|
231
|
+
- andrewroth@gmail.com
|
232
232
|
executables: []
|
233
233
|
extensions: []
|
234
234
|
extra_rdoc_files: []
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- app/assets/images/fe/indent.png
|
277
277
|
- app/assets/images/fe/overlay.png
|
278
278
|
- app/assets/images/fe/selected_bg.jpg
|
279
|
+
- app/assets/images/fe/spinner.gif
|
279
280
|
- app/assets/images/fe/status.gif
|
280
281
|
- app/assets/images/fe/tooltip/black.png
|
281
282
|
- app/assets/images/fe/tooltip/black_arrow.png
|
@@ -589,7 +590,6 @@ files:
|
|
589
590
|
- spec/dummy/db/migrate/20160204164613_add_visible_and_visibility_cache_key_to_reference_sheets.fe_engine.rb
|
590
591
|
- spec/dummy/db/migrate/20181108201746_create_versions.rb
|
591
592
|
- spec/dummy/db/schema.rb
|
592
|
-
- spec/dummy/log/test.log
|
593
593
|
- spec/dummy/public/404.html
|
594
594
|
- spec/dummy/public/422.html
|
595
595
|
- spec/dummy/public/500.html
|
@@ -664,8 +664,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
664
664
|
- !ruby/object:Gem::Version
|
665
665
|
version: '0'
|
666
666
|
requirements: []
|
667
|
-
|
668
|
-
rubygems_version: 2.7.3
|
667
|
+
rubygems_version: 3.5.9
|
669
668
|
signing_key:
|
670
669
|
specification_version: 4
|
671
670
|
summary: Form Engine
|
@@ -743,7 +742,6 @@ test_files:
|
|
743
742
|
- spec/dummy/db/migrate/20160204164613_add_visible_and_visibility_cache_key_to_reference_sheets.fe_engine.rb
|
744
743
|
- spec/dummy/db/migrate/20181108201746_create_versions.rb
|
745
744
|
- spec/dummy/db/schema.rb
|
746
|
-
- spec/dummy/log/test.log
|
747
745
|
- spec/dummy/public/404.html
|
748
746
|
- spec/dummy/public/422.html
|
749
747
|
- spec/dummy/public/500.html
|