whurl_engine 2.0.0.rc1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/whurl_engine/application.js +141 -0
- data/app/assets/javascripts/whurl_engine/{jquery-1.7.1.min.js → jquery-1-7-1-min.js} +0 -0
- data/app/assets/javascripts/whurl_engine/{jquery.livequery.js → jquery-livequery.js} +0 -0
- data/app/assets/javascripts/whurl_engine/{jquery-ui-1.8.16.min.js → jquery-ui-1-8-16-min.js} +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/ios-style-checkboxes/off.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/ios-style-checkboxes/on.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/ios-style-checkboxes/slider.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/ios-style-checkboxes/slider_center.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/ios-style-checkboxes/slider_left.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/ios-style-checkboxes/slider_right.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/iphone-style-checkboxes/off.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/iphone-style-checkboxes/on.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/iphone-style-checkboxes/slider.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/iphone-style-checkboxes/slider_center.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/iphone-style-checkboxes/slider_left.png +0 -0
- data/app/assets/stylesheets/whurl_engine/iphone-style-checkboxes/images/iphone-style-checkboxes/slider_right.png +0 -0
- data/app/controllers/whurl_engine/application_controller.rb +20 -1
- data/app/controllers/whurl_engine/categories_controller.rb +1 -1
- data/app/controllers/whurl_engine/header_definitions_controller.rb +32 -0
- data/app/controllers/whurl_engine/parameter_definitions_controller.rb +12 -12
- data/app/controllers/whurl_engine/resources_controller.rb +1 -1
- data/app/controllers/whurl_engine/whurls_controller.rb +1 -1
- data/app/helpers/whurl_engine/application_helper.rb +4 -0
- data/app/models/whurl_engine/header_definition.rb +7 -0
- data/app/models/whurl_engine/resource.rb +1 -0
- data/app/models/whurl_engine/whurl.rb +3 -14
- data/app/views/layouts/whurl_engine/application.html.haml +0 -7
- data/app/views/whurl_engine/categories/_category.html.haml +4 -3
- data/app/views/whurl_engine/categories/index.html.haml +2 -1
- data/app/views/whurl_engine/header_definitions/_form.html.haml +31 -0
- data/app/views/whurl_engine/header_definitions/_header_definition.html.haml +15 -0
- data/app/views/whurl_engine/header_definitions/create.js.haml +5 -0
- data/app/views/whurl_engine/header_definitions/destroy.js.haml +1 -0
- data/app/views/whurl_engine/header_definitions/edit.js.haml +3 -0
- data/app/views/whurl_engine/header_definitions/new.js.haml +3 -0
- data/app/views/whurl_engine/header_definitions/update.js.haml +6 -0
- data/app/views/whurl_engine/parameter_definitions/_form.html.haml +1 -1
- data/app/views/whurl_engine/parameter_definitions/_parameter_definition.html.haml +3 -2
- data/app/views/whurl_engine/parameter_definitions/update.js.haml +2 -2
- data/app/views/whurl_engine/resources/_resource.html.haml +3 -2
- data/app/views/whurl_engine/resources/show.html.haml +15 -3
- data/app/views/whurl_engine/whurls/_response.html.haml +3 -1
- data/app/views/whurl_engine/whurls/_whurl.html.haml +0 -5
- data/app/views/whurl_engine/whurls/show.html.haml +3 -2
- data/config/routes.rb +2 -1
- data/db/migrate/20120212182833_create_schema.rb +57 -0
- data/db/migrate/20120214074332_add_message_to_whurls.rb +5 -0
- data/lib/whurl_engine/config.rb +66 -0
- data/lib/whurl_engine/engine.rb +2 -0
- data/lib/whurl_engine/extension.rb +13 -0
- data/lib/whurl_engine/extensions/cancan/authorization_adapter.rb +73 -0
- data/lib/whurl_engine/extensions/cancan.rb +3 -0
- data/lib/whurl_engine/version.rb +1 -1
- data/lib/whurl_engine.rb +10 -1
- metadata +59 -50
- data/app/assets/flash/whurl_engine/ZeroClipboard.swf +0 -0
- data/app/assets/flash/whurl_engine/ZeroClipboard10.swf +0 -0
- data/app/assets/flash/whurl_engine/clippy.swf +0 -0
- data/app/assets/javascripts/whurl_engine/ZeroClipboard.js +0 -311
- data/app/assets/javascripts/whurl_engine/whurl.js +0 -136
- data/app/views/whurl_engine/whurls/edit.html.haml +0 -28
- data/db/migrate/20110209054322_create_whurls_table.rb +0 -14
- data/db/migrate/20111210192724_add_description_to_whurl.rb +0 -9
- data/db/migrate/20111210201607_add_custom_url_to_whurl.rb +0 -9
- data/db/migrate/20111211030904_rename_whurls_to_requests.rb +0 -8
- data/db/migrate/20111220233800_create_fields_for_whurl_requests.rb +0 -18
- data/db/migrate/20120106033416_create_responses.rb +0 -11
- data/db/migrate/20120106190508_create_categories_table.rb +0 -9
- data/db/migrate/20120107011500_create_resources_table.rb +0 -15
- data/db/migrate/20120107065652_create_parameters_table.rb +0 -12
- data/db/migrate/20120110205837_rename_parameters_to_parameter_definitions.rb +0 -5
- data/db/migrate/20120110205853_rename_requests_to_whurls.rb +0 -19
- data/db/migrate/20120111014928_add_raw_request_to_whurls.rb +0 -5
@@ -1,311 +0,0 @@
|
|
1
|
-
// Simple Set Clipboard System
|
2
|
-
// Author: Joseph Huckaby
|
3
|
-
|
4
|
-
var ZeroClipboard = {
|
5
|
-
|
6
|
-
version: "1.0.7",
|
7
|
-
clients: {}, // registered upload clients on page, indexed by id
|
8
|
-
moviePath: 'ZeroClipboard.swf', // URL to movie
|
9
|
-
nextId: 1, // ID of next movie
|
10
|
-
|
11
|
-
$: function(thingy) {
|
12
|
-
// simple DOM lookup utility function
|
13
|
-
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
|
14
|
-
if (!thingy.addClass) {
|
15
|
-
// extend element with a few useful methods
|
16
|
-
thingy.hide = function() { this.style.display = 'none'; };
|
17
|
-
thingy.show = function() { this.style.display = ''; };
|
18
|
-
thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
|
19
|
-
thingy.removeClass = function(name) {
|
20
|
-
var classes = this.className.split(/\s+/);
|
21
|
-
var idx = -1;
|
22
|
-
for (var k = 0; k < classes.length; k++) {
|
23
|
-
if (classes[k] == name) { idx = k; k = classes.length; }
|
24
|
-
}
|
25
|
-
if (idx > -1) {
|
26
|
-
classes.splice( idx, 1 );
|
27
|
-
this.className = classes.join(' ');
|
28
|
-
}
|
29
|
-
return this;
|
30
|
-
};
|
31
|
-
thingy.hasClass = function(name) {
|
32
|
-
return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
|
33
|
-
};
|
34
|
-
}
|
35
|
-
return thingy;
|
36
|
-
},
|
37
|
-
|
38
|
-
setMoviePath: function(path) {
|
39
|
-
// set path to ZeroClipboard.swf
|
40
|
-
this.moviePath = path;
|
41
|
-
},
|
42
|
-
|
43
|
-
dispatch: function(id, eventName, args) {
|
44
|
-
// receive event from flash movie, send to client
|
45
|
-
var client = this.clients[id];
|
46
|
-
if (client) {
|
47
|
-
client.receiveEvent(eventName, args);
|
48
|
-
}
|
49
|
-
},
|
50
|
-
|
51
|
-
register: function(id, client) {
|
52
|
-
// register new client to receive events
|
53
|
-
this.clients[id] = client;
|
54
|
-
},
|
55
|
-
|
56
|
-
getDOMObjectPosition: function(obj, stopObj) {
|
57
|
-
// get absolute coordinates for dom element
|
58
|
-
var info = {
|
59
|
-
left: 0,
|
60
|
-
top: 0,
|
61
|
-
width: obj.width ? obj.width : obj.offsetWidth,
|
62
|
-
height: obj.height ? obj.height : obj.offsetHeight
|
63
|
-
};
|
64
|
-
|
65
|
-
while (obj && (obj != stopObj)) {
|
66
|
-
info.left += obj.offsetLeft;
|
67
|
-
info.top += obj.offsetTop;
|
68
|
-
obj = obj.offsetParent;
|
69
|
-
}
|
70
|
-
|
71
|
-
return info;
|
72
|
-
},
|
73
|
-
|
74
|
-
Client: function(elem) {
|
75
|
-
// constructor for new simple upload client
|
76
|
-
this.handlers = {};
|
77
|
-
|
78
|
-
// unique ID
|
79
|
-
this.id = ZeroClipboard.nextId++;
|
80
|
-
this.movieId = 'ZeroClipboardMovie_' + this.id;
|
81
|
-
|
82
|
-
// register client with singleton to receive flash events
|
83
|
-
ZeroClipboard.register(this.id, this);
|
84
|
-
|
85
|
-
// create movie
|
86
|
-
if (elem) this.glue(elem);
|
87
|
-
}
|
88
|
-
};
|
89
|
-
|
90
|
-
ZeroClipboard.Client.prototype = {
|
91
|
-
|
92
|
-
id: 0, // unique ID for us
|
93
|
-
ready: false, // whether movie is ready to receive events or not
|
94
|
-
movie: null, // reference to movie object
|
95
|
-
clipText: '', // text to copy to clipboard
|
96
|
-
handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
|
97
|
-
cssEffects: true, // enable CSS mouse effects on dom container
|
98
|
-
handlers: null, // user event handlers
|
99
|
-
|
100
|
-
glue: function(elem, appendElem, stylesToAdd) {
|
101
|
-
// glue to DOM element
|
102
|
-
// elem can be ID or actual DOM element object
|
103
|
-
this.domElement = ZeroClipboard.$(elem);
|
104
|
-
|
105
|
-
// float just above object, or zIndex 99 if dom element isn't set
|
106
|
-
var zIndex = 99;
|
107
|
-
if (this.domElement.style.zIndex) {
|
108
|
-
zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
|
109
|
-
}
|
110
|
-
|
111
|
-
if (typeof(appendElem) == 'string') {
|
112
|
-
appendElem = ZeroClipboard.$(appendElem);
|
113
|
-
}
|
114
|
-
else if (typeof(appendElem) == 'undefined') {
|
115
|
-
appendElem = document.getElementsByTagName('body')[0];
|
116
|
-
}
|
117
|
-
|
118
|
-
// find X/Y position of domElement
|
119
|
-
var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
|
120
|
-
|
121
|
-
// create floating DIV above element
|
122
|
-
this.div = document.createElement('div');
|
123
|
-
var style = this.div.style;
|
124
|
-
style.position = 'absolute';
|
125
|
-
style.left = '' + box.left + 'px';
|
126
|
-
style.top = '' + box.top + 'px';
|
127
|
-
style.width = '' + box.width + 'px';
|
128
|
-
style.height = '' + box.height + 'px';
|
129
|
-
style.zIndex = zIndex;
|
130
|
-
|
131
|
-
if (typeof(stylesToAdd) == 'object') {
|
132
|
-
for (addedStyle in stylesToAdd) {
|
133
|
-
style[addedStyle] = stylesToAdd[addedStyle];
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
// style.backgroundColor = '#f00'; // debug
|
138
|
-
|
139
|
-
appendElem.appendChild(this.div);
|
140
|
-
|
141
|
-
this.div.innerHTML = this.getHTML( box.width, box.height );
|
142
|
-
},
|
143
|
-
|
144
|
-
getHTML: function(width, height) {
|
145
|
-
// return HTML for movie
|
146
|
-
var html = '';
|
147
|
-
var flashvars = 'id=' + this.id +
|
148
|
-
'&width=' + width +
|
149
|
-
'&height=' + height;
|
150
|
-
|
151
|
-
if (navigator.userAgent.match(/MSIE/)) {
|
152
|
-
// IE gets an OBJECT tag
|
153
|
-
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
|
154
|
-
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
|
155
|
-
}
|
156
|
-
else {
|
157
|
-
// all other browsers get an EMBED tag
|
158
|
-
html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
|
159
|
-
}
|
160
|
-
return html;
|
161
|
-
},
|
162
|
-
|
163
|
-
hide: function() {
|
164
|
-
// temporarily hide floater offscreen
|
165
|
-
if (this.div) {
|
166
|
-
this.div.style.left = '-2000px';
|
167
|
-
}
|
168
|
-
},
|
169
|
-
|
170
|
-
show: function() {
|
171
|
-
// show ourselves after a call to hide()
|
172
|
-
this.reposition();
|
173
|
-
},
|
174
|
-
|
175
|
-
destroy: function() {
|
176
|
-
// destroy control and floater
|
177
|
-
if (this.domElement && this.div) {
|
178
|
-
this.hide();
|
179
|
-
this.div.innerHTML = '';
|
180
|
-
|
181
|
-
var body = document.getElementsByTagName('body')[0];
|
182
|
-
try { body.removeChild( this.div ); } catch(e) {;}
|
183
|
-
|
184
|
-
this.domElement = null;
|
185
|
-
this.div = null;
|
186
|
-
}
|
187
|
-
},
|
188
|
-
|
189
|
-
reposition: function(elem) {
|
190
|
-
// reposition our floating div, optionally to new container
|
191
|
-
// warning: container CANNOT change size, only position
|
192
|
-
if (elem) {
|
193
|
-
this.domElement = ZeroClipboard.$(elem);
|
194
|
-
if (!this.domElement) this.hide();
|
195
|
-
}
|
196
|
-
|
197
|
-
if (this.domElement && this.div) {
|
198
|
-
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
|
199
|
-
var style = this.div.style;
|
200
|
-
style.left = '' + box.left + 'px';
|
201
|
-
style.top = '' + box.top + 'px';
|
202
|
-
}
|
203
|
-
},
|
204
|
-
|
205
|
-
setText: function(newText) {
|
206
|
-
// set text to be copied to clipboard
|
207
|
-
this.clipText = newText;
|
208
|
-
if (this.ready) this.movie.setText(newText);
|
209
|
-
},
|
210
|
-
|
211
|
-
addEventListener: function(eventName, func) {
|
212
|
-
// add user event listener for event
|
213
|
-
// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
|
214
|
-
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
|
215
|
-
if (!this.handlers[eventName]) this.handlers[eventName] = [];
|
216
|
-
this.handlers[eventName].push(func);
|
217
|
-
},
|
218
|
-
|
219
|
-
setHandCursor: function(enabled) {
|
220
|
-
// enable hand cursor (true), or default arrow cursor (false)
|
221
|
-
this.handCursorEnabled = enabled;
|
222
|
-
if (this.ready) this.movie.setHandCursor(enabled);
|
223
|
-
},
|
224
|
-
|
225
|
-
setCSSEffects: function(enabled) {
|
226
|
-
// enable or disable CSS effects on DOM container
|
227
|
-
this.cssEffects = !!enabled;
|
228
|
-
},
|
229
|
-
|
230
|
-
receiveEvent: function(eventName, args) {
|
231
|
-
// receive event from flash
|
232
|
-
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
|
233
|
-
|
234
|
-
// special behavior for certain events
|
235
|
-
switch (eventName) {
|
236
|
-
case 'load':
|
237
|
-
// movie claims it is ready, but in IE this isn't always the case...
|
238
|
-
// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
|
239
|
-
this.movie = document.getElementById(this.movieId);
|
240
|
-
if (!this.movie) {
|
241
|
-
var self = this;
|
242
|
-
setTimeout( function() { self.receiveEvent('load', null); }, 1 );
|
243
|
-
return;
|
244
|
-
}
|
245
|
-
|
246
|
-
// firefox on pc needs a "kick" in order to set these in certain cases
|
247
|
-
if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
|
248
|
-
var self = this;
|
249
|
-
setTimeout( function() { self.receiveEvent('load', null); }, 100 );
|
250
|
-
this.ready = true;
|
251
|
-
return;
|
252
|
-
}
|
253
|
-
|
254
|
-
this.ready = true;
|
255
|
-
this.movie.setText( this.clipText );
|
256
|
-
this.movie.setHandCursor( this.handCursorEnabled );
|
257
|
-
break;
|
258
|
-
|
259
|
-
case 'mouseover':
|
260
|
-
if (this.domElement && this.cssEffects) {
|
261
|
-
this.domElement.addClass('hover');
|
262
|
-
if (this.recoverActive) this.domElement.addClass('active');
|
263
|
-
}
|
264
|
-
break;
|
265
|
-
|
266
|
-
case 'mouseout':
|
267
|
-
if (this.domElement && this.cssEffects) {
|
268
|
-
this.recoverActive = false;
|
269
|
-
if (this.domElement.hasClass('active')) {
|
270
|
-
this.domElement.removeClass('active');
|
271
|
-
this.recoverActive = true;
|
272
|
-
}
|
273
|
-
this.domElement.removeClass('hover');
|
274
|
-
}
|
275
|
-
break;
|
276
|
-
|
277
|
-
case 'mousedown':
|
278
|
-
if (this.domElement && this.cssEffects) {
|
279
|
-
this.domElement.addClass('active');
|
280
|
-
}
|
281
|
-
break;
|
282
|
-
|
283
|
-
case 'mouseup':
|
284
|
-
if (this.domElement && this.cssEffects) {
|
285
|
-
this.domElement.removeClass('active');
|
286
|
-
this.recoverActive = false;
|
287
|
-
}
|
288
|
-
break;
|
289
|
-
} // switch eventName
|
290
|
-
|
291
|
-
if (this.handlers[eventName]) {
|
292
|
-
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
|
293
|
-
var func = this.handlers[eventName][idx];
|
294
|
-
|
295
|
-
if (typeof(func) == 'function') {
|
296
|
-
// actual function reference
|
297
|
-
func(this, args);
|
298
|
-
}
|
299
|
-
else if ((typeof(func) == 'object') && (func.length == 2)) {
|
300
|
-
// PHP style object + method, i.e. [myObject, 'myMethod']
|
301
|
-
func[0][ func[1] ](this, args);
|
302
|
-
}
|
303
|
-
else if (typeof(func) == 'string') {
|
304
|
-
// name of function
|
305
|
-
window[func](this, args);
|
306
|
-
}
|
307
|
-
} // foreach event handler defined
|
308
|
-
} // user defined handler for event
|
309
|
-
}
|
310
|
-
|
311
|
-
};
|
@@ -1,136 +0,0 @@
|
|
1
|
-
var headers = ["Accept",
|
2
|
-
"Accept-Charset",
|
3
|
-
"Accept-Encoding",
|
4
|
-
"Accept-Language",
|
5
|
-
"Authorization",
|
6
|
-
"Cache-Control",
|
7
|
-
"Connection",
|
8
|
-
"Cookie",
|
9
|
-
"Content-Length",
|
10
|
-
"Content-MD5",
|
11
|
-
"Content-Type",
|
12
|
-
"Date",
|
13
|
-
"Expect",
|
14
|
-
"From",
|
15
|
-
"Host",
|
16
|
-
"If-Match",
|
17
|
-
"If-Modified-Since",
|
18
|
-
"If-None-Match",
|
19
|
-
"If-Range",
|
20
|
-
"If-Unmodified-Since",
|
21
|
-
"Max-Forwards",
|
22
|
-
"Pragma",
|
23
|
-
"Proxy-Authorization",
|
24
|
-
"Range",
|
25
|
-
"Referer",
|
26
|
-
"TE",
|
27
|
-
"Upgrade",
|
28
|
-
"User-Agent",
|
29
|
-
"Via",
|
30
|
-
"Warning"];
|
31
|
-
|
32
|
-
|
33
|
-
function Whurl($whurlForm) {
|
34
|
-
this.$whurlForm = $whurlForm;
|
35
|
-
var self = this;
|
36
|
-
|
37
|
-
$('.add_header', this.$whurlForm).click(function () {
|
38
|
-
self.addInputs('header');
|
39
|
-
});
|
40
|
-
|
41
|
-
$('.add_param', this.$whurlForm).click(function () {
|
42
|
-
self.addInputs('param');
|
43
|
-
});
|
44
|
-
|
45
|
-
$('.delete_header', this.$whurlForm).live('click', function (e) {
|
46
|
-
//e.currentTarget
|
47
|
-
self.deleteHeader(this);
|
48
|
-
});
|
49
|
-
|
50
|
-
$('.delete_param', this.$whurlForm).live('click', function (e) {
|
51
|
-
//e.currentTarget
|
52
|
-
self.deleteParam(this);
|
53
|
-
});
|
54
|
-
|
55
|
-
$(".trash_headers", this.$whurlForm).click(function () {
|
56
|
-
self.trashHeaders();
|
57
|
-
});
|
58
|
-
|
59
|
-
$(".trash_queries", self.$whurlForm).click(function () {
|
60
|
-
self.trashQueries();
|
61
|
-
});
|
62
|
-
|
63
|
-
$('.header_pair input.value', this.$whurlForm).live('focusin', (function () {
|
64
|
-
if ($('.header_pair:last input', self.$whurlForm).val() != "") {
|
65
|
-
self.addInputs('header');
|
66
|
-
}
|
67
|
-
}));
|
68
|
-
|
69
|
-
$('.param_pair input.value', this.$whurlForm).live('focusin', (function () {
|
70
|
-
if ($('.param_pair:last input', self.$whurlForm).val() != "") {
|
71
|
-
self.addInputs('param');
|
72
|
-
}
|
73
|
-
}));
|
74
|
-
|
75
|
-
$('.url select', this.$whurlForm).change(function () {
|
76
|
-
self.updateBodyInput();
|
77
|
-
});
|
78
|
-
|
79
|
-
$(".header_pair input.key", this.$whurlForm).livequery(function() {
|
80
|
-
$(this).autocomplete({source:headers});
|
81
|
-
});
|
82
|
-
|
83
|
-
$(".clear_fields", this.$whurlForm).click(function () {
|
84
|
-
$("input[type=text], textarea", self.$whurlForm).val("");
|
85
|
-
self.trashHeaders();
|
86
|
-
self.trashQueries();
|
87
|
-
});
|
88
|
-
|
89
|
-
this.addInputs = function (type) {
|
90
|
-
var $fields = $('.' + type + '_pair', this.$whurlForm).first().clone();
|
91
|
-
$fields.children('input').val("").attr('disabled', false);
|
92
|
-
$fields.hide().appendTo(this.$whurlForm.find('.' + type + 's')).slideDown('fast');
|
93
|
-
};
|
94
|
-
|
95
|
-
this.deleteHeader = function (element) {
|
96
|
-
var $fields = $(element).closest(".header_pair");
|
97
|
-
$fields.slideUp(function () {
|
98
|
-
$fields.remove();
|
99
|
-
});
|
100
|
-
};
|
101
|
-
|
102
|
-
this.deleteParam = function (element) {
|
103
|
-
var $fields = $(element).closest(".param_pair");
|
104
|
-
$fields.slideUp(function () {
|
105
|
-
$paramFields.remove();
|
106
|
-
});
|
107
|
-
};
|
108
|
-
|
109
|
-
this.trashHeaders = function () {
|
110
|
-
$(".header_pair:visible", self.$whurlForm).each(function (i, element) {
|
111
|
-
$(element).slideUp(function () {
|
112
|
-
$(element).remove();
|
113
|
-
});
|
114
|
-
});
|
115
|
-
this.addInputs('header');
|
116
|
-
};
|
117
|
-
|
118
|
-
this.trashQueries = function () {
|
119
|
-
$(".param_pair:visible", self.$whurlForm).each(function (i, element) {
|
120
|
-
$(element).slideUp(function () {
|
121
|
-
$(element).remove();
|
122
|
-
});
|
123
|
-
});
|
124
|
-
this.addInputs('param');
|
125
|
-
};
|
126
|
-
|
127
|
-
this.updateBodyInput = function () {
|
128
|
-
var method = $('.url select', self.$whurlForm).val();
|
129
|
-
if ($.inArray(method, ["PUT", "POST"]) > -1) {
|
130
|
-
$('#whurl_request_body', self.$whurlForm).attr('disabled', false).removeClass('textarea_disabled');
|
131
|
-
} else {
|
132
|
-
$('#whurl_request_body', self.$whurlForm).attr('disabled', true).addClass('textarea_disabled');
|
133
|
-
}
|
134
|
-
};
|
135
|
-
this.updateBodyInput();
|
136
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
= javascript_include_tag("whurl_engine/ZeroClipboard")
|
2
|
-
- unless request.description.blank?
|
3
|
-
.response_section
|
4
|
-
.response_section_title Description
|
5
|
-
#edit_description
|
6
|
-
= request.description
|
7
|
-
.response_section
|
8
|
-
.response_section_title Response Headers
|
9
|
-
#response_header
|
10
|
-
= find_and_preserve(@response_headers)
|
11
|
-
.response_section
|
12
|
-
.response_section_title
|
13
|
-
Response Body #{image_tag("whurl_engine/clipboard.png", :id => "copy_to_clipboard")}
|
14
|
-
.response_container
|
15
|
-
= find_and_preserve(@response_body)
|
16
|
-
= render :partial => 'form'
|
17
|
-
#permalink_container
|
18
|
-
Share this Whurl:
|
19
|
-
%input#permalink_text_box{:type => "text", :value => request.url, :readonly => true}
|
20
|
-
=clippy(request.url, "#F7E391")
|
21
|
-
:javascript
|
22
|
-
$(function() {
|
23
|
-
ZeroClipboard.setMoviePath('#{asset_path('whurl_engine/ZeroClipboard10.swf')}' );
|
24
|
-
var clip = new ZeroClipboard.Client();
|
25
|
-
clip.setHandCursor(true);
|
26
|
-
clip.setText($('.CodeRay td.code').text());
|
27
|
-
clip.glue('copy_to_clipboard');
|
28
|
-
});
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class CreateWhurlsTable < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :whurls do |t|
|
4
|
-
t.string :hash_key, :limit => 6, :null => false
|
5
|
-
t.text :data
|
6
|
-
t.timestamps
|
7
|
-
end
|
8
|
-
add_index :whurls, :hash_key, :unique => true
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.down
|
12
|
-
drop_table :whurls
|
13
|
-
end
|
14
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class CreateFieldsForWhurlRequests < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :whurl_engine_requests, :http_method, :string, :limit => 10
|
4
|
-
add_column :whurl_engine_requests, :body, :text
|
5
|
-
add_column :whurl_engine_requests, :query, :text
|
6
|
-
add_column :whurl_engine_requests, :headers, :text
|
7
|
-
add_column :whurl_engine_requests, :url, :text
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.down
|
12
|
-
remove_column :whurl_engine_requests, :http_method
|
13
|
-
remove_column :whurl_engine_requests, :body
|
14
|
-
remove_column :whurl_engine_requests, :query
|
15
|
-
remove_column :whurl_engine_requests, :headers
|
16
|
-
remove_column :whurl_engine_requests, :url
|
17
|
-
end
|
18
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreateResourcesTable < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :whurl_engine_resources do |t|
|
4
|
-
t.integer :category_id
|
5
|
-
t.string :base_uri
|
6
|
-
t.string :relative_path
|
7
|
-
t.string :http_method
|
8
|
-
t.text :description
|
9
|
-
t.boolean :rate_limited
|
10
|
-
t.boolean :requires_authentication
|
11
|
-
t.text :response_formats
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class CreateParametersTable < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :whurl_engine_parameters do |t|
|
4
|
-
t.integer :resource_id
|
5
|
-
t.string :name
|
6
|
-
t.string :example_value
|
7
|
-
t.text :description
|
8
|
-
t.boolean :required
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class RenameRequestsToWhurls < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
rename_table :whurl_engine_requests, :whurl_engine_whurls
|
4
|
-
drop_table :whurl_engine_responses
|
5
|
-
rename_column :whurl_engine_whurls, :custom_url, :name
|
6
|
-
rename_column :whurl_engine_whurls, :query, :request_parameters
|
7
|
-
rename_column :whurl_engine_whurls, :body, :request_body
|
8
|
-
rename_column :whurl_engine_whurls, :headers, :request_headers
|
9
|
-
rename_column :whurl_engine_whurls, :http_method, :request_method
|
10
|
-
rename_column :whurl_engine_whurls, :url, :request_url
|
11
|
-
add_column :whurl_engine_whurls, :resource_id, :integer
|
12
|
-
add_column :whurl_engine_whurls, :response_body, :text
|
13
|
-
add_column :whurl_engine_whurls, :response_content_type, :string
|
14
|
-
add_column :whurl_engine_whurls, :response_headers, :text
|
15
|
-
end
|
16
|
-
|
17
|
-
def down
|
18
|
-
end
|
19
|
-
end
|