trusty-clipped-extension 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/admin/assets_admin.js +16 -0
- data/app/views/admin/assets/index.html.haml +1 -1
- data/app/views/admin/pages/_assets.html.haml +1 -4
- data/app/views/admin/removed/_assets_container.html.haml +1 -5
- data/lib/clipped/engine.rb +5 -0
- data/lib/trusty-clipped-extension.rb +1 -1
- metadata +3 -3
- data/app/assets/javascripts/admin/prototype_assets.js +0 -166
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into admin.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery.ui.widget
|
14
|
+
//= require jquery.iframe-transport
|
15
|
+
//= require jquery.fileupload
|
16
|
+
//= require assets
|
@@ -1,8 +1,5 @@
|
|
1
1
|
= stylesheet_link_tag 'admin/assets'
|
2
|
-
= javascript_include_tag 'admin/
|
3
|
-
= javascript_include_tag 'admin/jquery.iframe-transport'
|
4
|
-
= javascript_include_tag 'admin/jquery.fileupload'
|
5
|
-
= javascript_include_tag 'admin/assets'
|
2
|
+
= javascript_include_tag 'admin/assets_admin'
|
6
3
|
|
7
4
|
#attachment_list.assets
|
8
5
|
%ul#attachment_fields{:class => @page.page_attachments.empty? ? 'empty' : ''}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
- @stylesheets << 'admin/assets'
|
2
|
-
= javascript_include_tag '
|
3
|
-
= javascript_include_tag 'admin/assets'
|
4
|
-
= javascript_include_tag 'admin/dragdrop'
|
2
|
+
= javascript_include_tag 'admin/assets_admin'
|
5
3
|
|
6
4
|
#assets-container
|
7
5
|
#asset-tabs
|
@@ -23,7 +21,6 @@
|
|
23
21
|
- asset_tabs.bucket_tab do
|
24
22
|
%a.asset-tab.here{ :href => "#" }
|
25
23
|
= t("clipped_extension.bucket")
|
26
|
-
|
27
24
|
- if @page && !@page.new_record?
|
28
25
|
- render_region :asset_panes do |asset_panes|
|
29
26
|
|
@@ -43,7 +40,6 @@
|
|
43
40
|
!= t("clipped_extension.asset_page_upload_note")
|
44
41
|
= render :partial => "admin/assets/upload_to_page"
|
45
42
|
.clear
|
46
|
-
|
47
43
|
- asset_panes.search do
|
48
44
|
#search-assets.pane
|
49
45
|
- form_tag do
|
data/lib/clipped/engine.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-clipped-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2014-12-
|
17
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: acts_as_list
|
@@ -140,10 +140,10 @@ files:
|
|
140
140
|
- app/assets/images/admin/xml_icon.png
|
141
141
|
- app/assets/images/admin/zip_icon.png
|
142
142
|
- app/assets/javascripts/admin/assets.js
|
143
|
+
- app/assets/javascripts/admin/assets_admin.js
|
143
144
|
- app/assets/javascripts/admin/jquery.fileupload.js
|
144
145
|
- app/assets/javascripts/admin/jquery.iframe-transport.js
|
145
146
|
- app/assets/javascripts/admin/jquery.ui.widget.js
|
146
|
-
- app/assets/javascripts/admin/prototype_assets.js
|
147
147
|
- app/assets/stylesheets/admin/assets.sass
|
148
148
|
- app/assets/stylesheets/application.scss
|
149
149
|
- app/controllers/admin/assets_controller.rb
|
@@ -1,166 +0,0 @@
|
|
1
|
-
var Asset = {};
|
2
|
-
|
3
|
-
Asset.Upload = Behavior.create({
|
4
|
-
onsubmit: function (e) {
|
5
|
-
if (e) e.stop();
|
6
|
-
var uuid = Asset.GenerateUUID();
|
7
|
-
var ulframe = document.createElement('iframe');
|
8
|
-
ulframe.setAttribute('name', uuid); // this doesn't work on ie7: will need bodging
|
9
|
-
$('upload_holders').insert(ulframe);
|
10
|
-
|
11
|
-
var form = this.element;
|
12
|
-
var title = form.down('input.textbox').value || form.down('input.file').value;
|
13
|
-
var placeholder = Asset.AddPlaceholder(title);
|
14
|
-
|
15
|
-
form.setAttribute('target', uuid);
|
16
|
-
ulframe.observe('load', function (e) {
|
17
|
-
if (e) e.stop();
|
18
|
-
var response = ulframe.contentDocument.body.innerHTML;
|
19
|
-
if (response && response != "") {
|
20
|
-
placeholder.remove();
|
21
|
-
Asset.AddToList(response);
|
22
|
-
ulframe.remove();
|
23
|
-
}
|
24
|
-
});
|
25
|
-
|
26
|
-
form.submit();
|
27
|
-
$('upload_asset').closePopup();
|
28
|
-
|
29
|
-
// Small delay is required here to let safari assemble the payload
|
30
|
-
// form.down('input').clear().defer();
|
31
|
-
// form.down('input.file').clear().defer();
|
32
|
-
}
|
33
|
-
});
|
34
|
-
|
35
|
-
|
36
|
-
// this local attachment method works and is much quicker, but it's fragile and doesn't notice Trusty configuration changes
|
37
|
-
// better to bounce off the server, provided it can be made responsive enough.
|
38
|
-
|
39
|
-
// Asset.Attach = Behavior.create({
|
40
|
-
// onclick: function (e) {
|
41
|
-
// if (e) e.stop();
|
42
|
-
// var container = this.element.up('li.asset');
|
43
|
-
// container.addClassName('waiting');
|
44
|
-
// var title = container.down('div.title').innerHTML;
|
45
|
-
// var image = container.down('img');
|
46
|
-
// var uuid = Asset.GenerateUUID();
|
47
|
-
// var asset_id = this.element.getAttribute('rel').split('_').last();
|
48
|
-
// var attachment_field = document.createElement('input');
|
49
|
-
// attachment_field.setAttribute('type', 'hidden');
|
50
|
-
// attachment_field.setAttribute('id', 'page_page_attachments_attributes_' + uuid + '_asset_id');
|
51
|
-
// attachment_field.setAttribute('name', 'page[page_attachments_attributes][' + uuid + '][asset_id]');
|
52
|
-
// attachment_field.value = asset_id;
|
53
|
-
// var placeholder = Asset.AddPlaceholder(title, image, attachment_field);
|
54
|
-
// container.removeClassName('waiting');
|
55
|
-
// placeholder.removeClassName('waiting');
|
56
|
-
// }
|
57
|
-
// });
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
Asset.Sortable = Behavior.create({
|
65
|
-
initialize: function (e) {
|
66
|
-
this.sorter = Asset.MakeSortable(this.element);
|
67
|
-
}
|
68
|
-
});
|
69
|
-
|
70
|
-
// Asset-filter and search functions are available wherever the asset_table partial is displayed
|
71
|
-
|
72
|
-
Asset.SearchForm = Behavior.create({
|
73
|
-
initialize: function () {
|
74
|
-
this.observer = new Form.Element.Observer(this.element.down('input.search'), 2, Asset.UpdateTable);
|
75
|
-
},
|
76
|
-
onsubmit: function (e) {
|
77
|
-
if (e) e.stop();
|
78
|
-
Asset.UpdateTable(true);
|
79
|
-
}
|
80
|
-
});
|
81
|
-
|
82
|
-
Asset.MakeSortable = function (element) {
|
83
|
-
var sorter = Sortable.create(element, {
|
84
|
-
overlap: 'horizontal',
|
85
|
-
constraint: false,
|
86
|
-
handle: 'back',
|
87
|
-
onChange: function (e) {
|
88
|
-
Asset.SetPositions();
|
89
|
-
Asset.Notify('Assets reordered. Save page to commit changes.');
|
90
|
-
}
|
91
|
-
});
|
92
|
-
element.addClassName('sortable');
|
93
|
-
Asset.SetPositions();
|
94
|
-
return sorter;
|
95
|
-
}
|
96
|
-
|
97
|
-
Asset.SetPositions = function () {
|
98
|
-
$('attachment_fields').select('input.pos').each(function (input, index) {
|
99
|
-
input.value = index;
|
100
|
-
});
|
101
|
-
}
|
102
|
-
|
103
|
-
// originally taken from phpMyAdmin
|
104
|
-
Asset.InsertAtCursor = function(field, insertion) {
|
105
|
-
if (document.selection) { // ie
|
106
|
-
field.focus();
|
107
|
-
var sel = document.selection.createRange();
|
108
|
-
sel.text = insertion;
|
109
|
-
}
|
110
|
-
else if (field.selectionStart || field.selectionStart == '0') { // moz
|
111
|
-
var startPos = field.selectionStart;
|
112
|
-
var endPos = field.selectionEnd;
|
113
|
-
field.value = field.value.substring(0, startPos) + insertion + field.value.substring(endPos, field.value.length);
|
114
|
-
field.selectionStart = field.selectionEnd = startPos + insertion.length;
|
115
|
-
} else {
|
116
|
-
field.value += value;
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
Asset.GenerateUUID = function () {
|
121
|
-
// http://www.ietf.org/rfc/rfc4122.txt
|
122
|
-
var s = [];
|
123
|
-
var hexDigits = "0123456789ABCDEF";
|
124
|
-
for (var i = 0; i < 32; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); }
|
125
|
-
s[12] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
|
126
|
-
s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
127
|
-
return s.join('');
|
128
|
-
};
|
129
|
-
|
130
|
-
Asset.AddPlaceholder = function (title, image, contents) {
|
131
|
-
var placeholder = document.createElement('li').addClassName('asset').addClassName('waiting');
|
132
|
-
if (contents) placeholder.insert(contents);
|
133
|
-
var front = document.createElement('div').addClassName('front');
|
134
|
-
if (image) front.insert(document.createElement('div').addClassName('thumbnail').insert(image.clone()));
|
135
|
-
placeholder.insert(front);
|
136
|
-
if (!title) title = 'please wait';
|
137
|
-
var back = document.createElement('div').addClassName('back').insert(document.createElement('div').addClassName('title').update(title));
|
138
|
-
placeholder.insert(back);
|
139
|
-
$('attachment_fields').insert(placeholder);
|
140
|
-
Asset.ShowListIfHidden();
|
141
|
-
return placeholder;
|
142
|
-
}
|
143
|
-
|
144
|
-
Asset.AllWaiting = function (container) {
|
145
|
-
if (!container) container = $('assets_table');
|
146
|
-
container.select('li.asset').each(function (el) { el.addClassName('waiting'); });
|
147
|
-
}
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
Asset.HideListIfEmpty = function () {
|
152
|
-
var list = $('attachment_fields');
|
153
|
-
if (!list.down('li.asset:not(.detached)')) {
|
154
|
-
list.addClassName('empty');
|
155
|
-
// list.slideUp();
|
156
|
-
Asset.Notify('All assets detached. Save page to commit changes');
|
157
|
-
} else {
|
158
|
-
Asset.Notify('Assets detached. Save page to commit changes');
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
Event.addBehavior({
|
163
|
-
'ul#attachment_fields': Asset.Sortable,
|
164
|
-
'form.upload_asset': Asset.Upload,
|
165
|
-
'a.insert_asset': Asset.Insert
|
166
|
-
});
|