whurl_engine 1.2.2 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/README.markdown +2 -0
  2. data/Rakefile +2 -12
  3. data/app/assets/javascripts/whurl_engine/application.js +0 -159
  4. data/app/assets/javascripts/whurl_engine/jquery-ujs.js +315 -0
  5. data/app/assets/javascripts/whurl_engine/jquery.livequery.js +226 -0
  6. data/app/assets/javascripts/whurl_engine/whurl.js +136 -0
  7. data/app/assets/stylesheets/whurl_engine/application.css.scss +88 -1
  8. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_flat_100_ffffff_40x100.png +0 -0
  9. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_flat_10_000000_40x100.png +0 -0
  10. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_flat_18_f6ecd5_40x100.png +0 -0
  11. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_flat_20_666666_40x100.png +0 -0
  12. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  13. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_highlight-hard_100_dddddd_1x100.png +0 -0
  14. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_highlight-hard_100_eeeeee_1x100.png +0 -0
  15. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_highlight-hard_40_f6a828_1x100.png +0 -0
  16. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-bg_highlight-soft_75_f1fbe5_1x100.png +0 -0
  17. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-icons_1c94c4_256x240.png +0 -0
  18. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-icons_222222_256x240.png +0 -0
  19. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-icons_8cce3b_256x240.png +0 -0
  20. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
  21. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-icons_ef8c08_256x240.png +0 -0
  22. data/app/assets/stylesheets/whurl_engine/custom-theme/images/ui-icons_ffffff_256x240.png +0 -0
  23. data/app/assets/stylesheets/whurl_engine/custom-theme/jquery-ui-1.8.16.custom.css +562 -0
  24. data/app/assets/stylesheets/whurl_engine/whurl.css.scss +128 -0
  25. data/app/controllers/whurl_engine/application_controller.rb +2 -0
  26. data/app/controllers/whurl_engine/categories_controller.rb +36 -0
  27. data/app/controllers/whurl_engine/parameter_definitions_controller.rb +32 -0
  28. data/app/controllers/whurl_engine/resources_controller.rb +36 -0
  29. data/app/controllers/whurl_engine/whurls_controller.rb +42 -0
  30. data/app/models/whurl_engine/category.rb +7 -0
  31. data/app/models/whurl_engine/parameter_definition.rb +7 -0
  32. data/app/models/whurl_engine/resource.rb +12 -0
  33. data/app/models/whurl_engine/whurl.rb +66 -0
  34. data/app/views/layouts/whurl_engine/application.html.haml +41 -44
  35. data/app/views/whurl_engine/categories/_category.html.haml +15 -0
  36. data/app/views/whurl_engine/categories/_form.html.haml +24 -0
  37. data/app/views/whurl_engine/categories/create.js.haml +5 -0
  38. data/app/views/whurl_engine/categories/destroy.js.haml +1 -0
  39. data/app/views/whurl_engine/categories/edit.js.haml +3 -0
  40. data/app/views/whurl_engine/categories/index.html.haml +6 -0
  41. data/app/views/whurl_engine/categories/new.js.haml +3 -0
  42. data/app/views/whurl_engine/categories/update.js.haml +6 -0
  43. data/app/views/whurl_engine/parameter_definitions/_form.html.haml +31 -0
  44. data/app/views/whurl_engine/parameter_definitions/_parameter_definition.html.haml +14 -0
  45. data/app/views/whurl_engine/parameter_definitions/create.js.haml +5 -0
  46. data/app/views/whurl_engine/parameter_definitions/destroy.js.haml +1 -0
  47. data/app/views/whurl_engine/parameter_definitions/edit.js.haml +3 -0
  48. data/app/views/whurl_engine/parameter_definitions/new.js.haml +3 -0
  49. data/app/views/whurl_engine/parameter_definitions/update.js.haml +6 -0
  50. data/app/views/whurl_engine/resources/_form.html.haml +40 -0
  51. data/app/views/whurl_engine/resources/_resource.html.haml +6 -0
  52. data/app/views/whurl_engine/resources/create.js.haml +5 -0
  53. data/app/views/whurl_engine/resources/destroy.js.haml +1 -0
  54. data/app/views/whurl_engine/resources/edit.js.haml +3 -0
  55. data/app/views/whurl_engine/resources/new.js.haml +3 -0
  56. data/app/views/whurl_engine/resources/show.html.haml +29 -0
  57. data/app/views/whurl_engine/resources/update.js.haml +6 -0
  58. data/app/views/whurl_engine/shared/_error.js.haml +2 -0
  59. data/app/views/whurl_engine/whurls/_edit_form.html.haml +29 -0
  60. data/app/views/whurl_engine/whurls/_form.html.haml +42 -0
  61. data/app/views/whurl_engine/{whurl_requests → whurls}/_input_set.html.haml +1 -1
  62. data/app/views/whurl_engine/whurls/_response.html.haml +5 -0
  63. data/app/views/whurl_engine/whurls/_whurl.html.haml +18 -0
  64. data/app/views/whurl_engine/whurls/destroy.js.haml +2 -0
  65. data/app/views/whurl_engine/{whurl_requests → whurls}/edit.html.haml +3 -4
  66. data/app/views/whurl_engine/whurls/edit.js.haml +3 -0
  67. data/app/views/whurl_engine/whurls/show.html.haml +4 -0
  68. data/config/initializers/httparty/request.rb +9 -0
  69. data/config/initializers/httparty/response.rb +7 -25
  70. data/config/initializers/net/http_generic_request.rb +9 -0
  71. data/config/initializers/nilclass.rb +5 -0
  72. data/config/initializers/string.rb +32 -0
  73. data/config/routes.rb +6 -3
  74. data/db/migrate/20110209054322_create_whurls_table.rb +14 -0
  75. data/db/migrate/20111210192724_add_description_to_whurl.rb +9 -0
  76. data/db/migrate/20111210201607_add_custom_url_to_whurl.rb +9 -0
  77. data/db/migrate/20111211030904_rename_whurls_to_requests.rb +8 -0
  78. data/db/migrate/20111220233800_create_fields_for_whurl_requests.rb +10 -10
  79. data/db/migrate/20120106033416_create_responses.rb +11 -0
  80. data/db/migrate/20120106190508_create_categories_table.rb +9 -0
  81. data/db/migrate/20120107011500_create_resources_table.rb +15 -0
  82. data/db/migrate/20120107065652_create_parameters_table.rb +12 -0
  83. data/db/migrate/20120110205837_rename_parameters_to_parameter_definitions.rb +5 -0
  84. data/db/migrate/20120110205853_rename_requests_to_whurls.rb +19 -0
  85. data/db/migrate/20120111014928_add_raw_request_to_whurls.rb +5 -0
  86. data/lib/whurl_engine/version.rb +1 -1
  87. metadata +140 -177
  88. data/app/assets/stylesheets/whurl_engine/code.css.scss +0 -13
  89. data/app/assets/stylesheets/whurl_engine/jquery.ui.autocomplete.css.scss +0 -55
  90. data/app/assets/stylesheets/whurl_engine/whurls.css.scss +0 -358
  91. data/app/controllers/whurl_engine/whurl_requests_controller.rb +0 -52
  92. data/app/models/whurl_engine/any_client.rb +0 -7
  93. data/app/models/whurl_engine/whurl_request.rb +0 -37
  94. data/app/views/whurl_engine/whurl_requests/_form.html.haml +0 -51
  95. data/app/views/whurl_engine/whurl_requests/show.html.haml +0 -1
  96. data/db/migrate/20110209054322_create_whurl_requests_table.rb +0 -14
  97. data/db/migrate/20111210192724_add_description_to_whurl_requests.rb +0 -9
  98. data/db/migrate/20111210201607_add_custom_url_to_whurl_requests.rb +0 -9
  99. data/db/migrate/20111221010348_copy_data_to_new_fields.rb +0 -39
  100. data/db/migrate/20111221011145_drop_data_from_whurl_requestss.rb +0 -9
  101. data/test/dummy/Rakefile +0 -7
  102. data/test/dummy/app/assets/javascripts/application.js +0 -9
  103. data/test/dummy/app/assets/stylesheets/application.css +0 -7
  104. data/test/dummy/app/controllers/application_controller.rb +0 -3
  105. data/test/dummy/app/helpers/application_helper.rb +0 -2
  106. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  107. data/test/dummy/app/views/layouts/whurl_engine/application.html.haml +0 -56
  108. data/test/dummy/config/application.rb +0 -45
  109. data/test/dummy/config/boot.rb +0 -10
  110. data/test/dummy/config/database.sample.yml +0 -17
  111. data/test/dummy/config/database.yml +0 -17
  112. data/test/dummy/config/environment.rb +0 -5
  113. data/test/dummy/config/environments/development.rb +0 -30
  114. data/test/dummy/config/environments/production.rb +0 -60
  115. data/test/dummy/config/environments/test.rb +0 -39
  116. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  117. data/test/dummy/config/initializers/inflections.rb +0 -10
  118. data/test/dummy/config/initializers/mime_types.rb +0 -5
  119. data/test/dummy/config/initializers/secret_token.rb +0 -7
  120. data/test/dummy/config/initializers/session_store.rb +0 -8
  121. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  122. data/test/dummy/config/locales/en.yml +0 -5
  123. data/test/dummy/config/routes.rb +0 -4
  124. data/test/dummy/config.ru +0 -4
  125. data/test/dummy/db/schema.rb +0 -31
  126. data/test/dummy/log/development.log +0 -80
  127. data/test/dummy/public/404.html +0 -26
  128. data/test/dummy/public/422.html +0 -26
  129. data/test/dummy/public/500.html +0 -26
  130. data/test/dummy/public/favicon.ico +0 -0
  131. data/test/dummy/script/rails +0 -6
  132. data/test/dummy/tmp/cache/assets/C6D/500/sprockets%2Fa60a126c749b135b047d47c9116f7010 +0 -0
  133. data/test/dummy/tmp/cache/assets/C85/760/sprockets%2F67d86b8948de011684953a4b2d30c280 +0 -0
  134. data/test/dummy/tmp/cache/assets/CB8/FF0/sprockets%2F789d641670bfe15510034f63eb635ff8 +0 -0
  135. data/test/dummy/tmp/cache/assets/CB9/340/sprockets%2Fc383855f31a6f96cfad737d462029019 +0 -0
  136. data/test/dummy/tmp/cache/assets/CBD/A60/sprockets%2F8e7fec8543052565b343a93c7b174d78 +0 -0
  137. data/test/dummy/tmp/cache/assets/CE6/140/sprockets%2F97da5e07430aa9249a9633e88c5073ea +0 -0
  138. data/test/dummy/tmp/cache/assets/D01/6E0/sprockets%2F3974f4fd239fc76f2d9700899609da7e +0 -0
  139. data/test/dummy/tmp/cache/assets/D09/700/sprockets%2F68ca75710cc64126df7d1a6638ca16d1 +0 -0
  140. data/test/dummy/tmp/cache/assets/D18/6A0/sprockets%2Fdf8266a6da92a42ce29b771318176dc9 +0 -0
  141. data/test/dummy/tmp/cache/assets/D1C/440/sprockets%2Fd5f5cd99df7e614581ec5f2256403e33 +0 -0
  142. data/test/dummy/tmp/cache/assets/D2C/DB0/sprockets%2F802a914bb4d275c8c34a3aa5ec134d54 +0 -0
  143. data/test/dummy/tmp/cache/assets/D39/780/sprockets%2F0da3fdc5af08e2938cc21829334b1d48 +0 -0
  144. data/test/dummy/tmp/cache/assets/D3D/010/sprockets%2F389924c72fa75b369a0e61aacfa230e8 +0 -0
  145. data/test/dummy/tmp/cache/assets/D4C/8D0/sprockets%2F024e6456c9877ae45cdb28d7d16e06fe +0 -0
  146. data/test/dummy/tmp/cache/assets/D66/D70/sprockets%2Ffdf1533f584b1ba62ce0ca92848b14d3 +0 -0
  147. data/test/dummy/tmp/cache/assets/D6F/A10/sprockets%2F3fa8ede522a279bfc12817267d1ca57e +0 -0
  148. data/test/dummy/tmp/cache/assets/D9D/AC0/sprockets%2F082b6d491d42f3a4febe3cb4d0983e6d +0 -0
  149. data/test/dummy/tmp/cache/assets/DA4/180/sprockets%2F118a85fd98ac4bda49f6485fd41aca44 +0 -0
  150. data/test/dummy/tmp/cache/assets/DB4/C60/sprockets%2F6ee1d0983f6518ba5dc089797bfc6ffa +0 -0
  151. data/test/dummy/tmp/cache/assets/DBD/7A0/sprockets%2F872f84e976ebe7654383dfdc7cfec1c6 +0 -0
  152. data/test/dummy/tmp/cache/assets/DD7/420/sprockets%2F11c951f1c4e2bfc0d7c1b10e0bb1b2be +0 -0
  153. data/test/dummy/tmp/cache/assets/E29/F00/sprockets%2F5b6ee8619eacc15eaf00c329cedff60a +0 -0
  154. data/test/dummy/tmp/cache/assets/E5D/680/sprockets%2F5ef33ecefc8e09aafd4d2725c0ef0a9c +0 -0
  155. data/test/fixtures/whurl_engine/whurl_requests.yml +0 -11
  156. data/test/functional/whurl_engine/api_call_controller_test.rb +0 -21
  157. data/test/integration/navigation_test.rb +0 -10
  158. data/test/test_helper.rb +0 -10
  159. data/test/unit/helpers/whurl_engine/api_call_helper_test.rb +0 -6
  160. data/test/unit/whurl_engine/whurl_request_test.rb +0 -9
  161. data/test/whurl_engine_test.rb +0 -7
  162. /data/app/views/whurl_engine/{whurl_requests → whurls}/new.html.haml +0 -0
@@ -0,0 +1,226 @@
1
+ /*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
2
+ * Dual licensed under the MIT (MIT_LICENSE.txt)
3
+ * and GPL Version 2 (GPL_LICENSE.txt) licenses.
4
+ *
5
+ * Version: 1.1.1
6
+ * Requires jQuery 1.3+
7
+ * Docs: http://docs.jquery.com/Plugins/livequery
8
+ */
9
+
10
+ (function($) {
11
+
12
+ $.extend($.fn, {
13
+ livequery: function(type, fn, fn2) {
14
+ var self = this, q;
15
+
16
+ // Handle different call patterns
17
+ if ($.isFunction(type))
18
+ fn2 = fn, fn = type, type = undefined;
19
+
20
+ // See if Live Query already exists
21
+ $.each( $.livequery.queries, function(i, query) {
22
+ if ( self.selector == query.selector && self.context == query.context &&
23
+ type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) )
24
+ // Found the query, exit the each loop
25
+ return (q = query) && false;
26
+ });
27
+
28
+ // Create new Live Query if it wasn't found
29
+ q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
30
+
31
+ // Make sure it is running
32
+ q.stopped = false;
33
+
34
+ // Run it immediately for the first time
35
+ q.run();
36
+
37
+ // Contnue the chain
38
+ return this;
39
+ },
40
+
41
+ expire: function(type, fn, fn2) {
42
+ var self = this;
43
+
44
+ // Handle different call patterns
45
+ if ($.isFunction(type))
46
+ fn2 = fn, fn = type, type = undefined;
47
+
48
+ // Find the Live Query based on arguments and stop it
49
+ $.each( $.livequery.queries, function(i, query) {
50
+ if ( self.selector == query.selector && self.context == query.context &&
51
+ (!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
52
+ $.livequery.stop(query.id);
53
+ });
54
+
55
+ // Continue the chain
56
+ return this;
57
+ }
58
+ });
59
+
60
+ $.livequery = function(selector, context, type, fn, fn2) {
61
+ this.selector = selector;
62
+ this.context = context;
63
+ this.type = type;
64
+ this.fn = fn;
65
+ this.fn2 = fn2;
66
+ this.elements = [];
67
+ this.stopped = false;
68
+
69
+ // The id is the index of the Live Query in $.livequery.queries
70
+ this.id = $.livequery.queries.push(this)-1;
71
+
72
+ // Mark the functions for matching later on
73
+ fn.$lqguid = fn.$lqguid || $.livequery.guid++;
74
+ if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
75
+
76
+ // Return the Live Query
77
+ return this;
78
+ };
79
+
80
+ $.livequery.prototype = {
81
+ stop: function() {
82
+ var query = this;
83
+
84
+ if ( this.type )
85
+ // Unbind all bound events
86
+ this.elements.unbind(this.type, this.fn);
87
+ else if (this.fn2)
88
+ // Call the second function for all matched elements
89
+ this.elements.each(function(i, el) {
90
+ query.fn2.apply(el);
91
+ });
92
+
93
+ // Clear out matched elements
94
+ this.elements = [];
95
+
96
+ // Stop the Live Query from running until restarted
97
+ this.stopped = true;
98
+ },
99
+
100
+ run: function() {
101
+ // Short-circuit if stopped
102
+ if ( this.stopped ) return;
103
+ var query = this;
104
+
105
+ var oEls = this.elements,
106
+ els = $(this.selector, this.context),
107
+ nEls = els.not(oEls);
108
+
109
+ // Set elements to the latest set of matched elements
110
+ this.elements = els;
111
+
112
+ if (this.type) {
113
+ // Bind events to newly matched elements
114
+ nEls.bind(this.type, this.fn);
115
+
116
+ // Unbind events to elements no longer matched
117
+ if (oEls.length > 0)
118
+ $.each(oEls, function(i, el) {
119
+ if ( $.inArray(el, els) < 0 )
120
+ $.event.remove(el, query.type, query.fn);
121
+ });
122
+ }
123
+ else {
124
+ // Call the first function for newly matched elements
125
+ nEls.each(function() {
126
+ query.fn.apply(this);
127
+ });
128
+
129
+ // Call the second function for elements no longer matched
130
+ if ( this.fn2 && oEls.length > 0 )
131
+ $.each(oEls, function(i, el) {
132
+ if ( $.inArray(el, els) < 0 )
133
+ query.fn2.apply(el);
134
+ });
135
+ }
136
+ }
137
+ };
138
+
139
+ $.extend($.livequery, {
140
+ guid: 0,
141
+ queries: [],
142
+ queue: [],
143
+ running: false,
144
+ timeout: null,
145
+
146
+ checkQueue: function() {
147
+ if ( $.livequery.running && $.livequery.queue.length ) {
148
+ var length = $.livequery.queue.length;
149
+ // Run each Live Query currently in the queue
150
+ while ( length-- )
151
+ $.livequery.queries[ $.livequery.queue.shift() ].run();
152
+ }
153
+ },
154
+
155
+ pause: function() {
156
+ // Don't run anymore Live Queries until restarted
157
+ $.livequery.running = false;
158
+ },
159
+
160
+ play: function() {
161
+ // Restart Live Queries
162
+ $.livequery.running = true;
163
+ // Request a run of the Live Queries
164
+ $.livequery.run();
165
+ },
166
+
167
+ registerPlugin: function() {
168
+ $.each( arguments, function(i,n) {
169
+ // Short-circuit if the method doesn't exist
170
+ if (!$.fn[n]) return;
171
+
172
+ // Save a reference to the original method
173
+ var old = $.fn[n];
174
+
175
+ // Create a new method
176
+ $.fn[n] = function() {
177
+ // Call the original method
178
+ var r = old.apply(this, arguments);
179
+
180
+ // Request a run of the Live Queries
181
+ $.livequery.run();
182
+
183
+ // Return the original methods result
184
+ return r;
185
+ }
186
+ });
187
+ },
188
+
189
+ run: function(id) {
190
+ if (id != undefined) {
191
+ // Put the particular Live Query in the queue if it doesn't already exist
192
+ if ( $.inArray(id, $.livequery.queue) < 0 )
193
+ $.livequery.queue.push( id );
194
+ }
195
+ else
196
+ // Put each Live Query in the queue if it doesn't already exist
197
+ $.each( $.livequery.queries, function(id) {
198
+ if ( $.inArray(id, $.livequery.queue) < 0 )
199
+ $.livequery.queue.push( id );
200
+ });
201
+
202
+ // Clear timeout if it already exists
203
+ if ($.livequery.timeout) clearTimeout($.livequery.timeout);
204
+ // Create a timeout to check the queue and actually run the Live Queries
205
+ $.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
206
+ },
207
+
208
+ stop: function(id) {
209
+ if (id != undefined)
210
+ // Stop are particular Live Query
211
+ $.livequery.queries[ id ].stop();
212
+ else
213
+ // Stop all Live Queries
214
+ $.each( $.livequery.queries, function(id) {
215
+ $.livequery.queries[ id ].stop();
216
+ });
217
+ }
218
+ });
219
+
220
+ // Register core DOM manipulation methods
221
+ $.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove', 'html');
222
+
223
+ // Run Live Queries when the Document is ready
224
+ $(function() { $.livequery.play(); });
225
+
226
+ })(jQuery);
@@ -0,0 +1,136 @@
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
+ }
@@ -4,4 +4,91 @@
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
  *= require_self
6
6
  *= require_tree
7
- */
7
+ */
8
+ $primary: #1c94c4;
9
+ $secondary: #eb8f00;
10
+ body {
11
+ font-family: Arial, sans-serif;
12
+ font-size: 14px;
13
+ background-color: white;
14
+ }
15
+
16
+ h1, h2, h3 {
17
+ font-weight: 300;
18
+ }
19
+
20
+ h3.ui-accordion-header {
21
+ font-size:12px;
22
+ }
23
+
24
+ pre {
25
+ margin: 0;
26
+ }
27
+
28
+ table {
29
+ width: 100%;
30
+ border-top: 1px solid #EEE;
31
+ border-collapse: collapse;
32
+ border-spacing: 0;
33
+ margin-bottom: 15px;
34
+
35
+ th, td{
36
+ text-align: left;
37
+ border-bottom: 1px solid #EEE;
38
+ }
39
+ }
40
+
41
+ a {
42
+ color: $primary;
43
+ &:hover {
44
+ color: lighten($primary, 10%);
45
+ }
46
+ &:active {
47
+ color: $secondary;
48
+ }
49
+ }
50
+
51
+ input[type=text] {
52
+ border-radius: 5px;
53
+ line-height: 20px;
54
+ font-size: 14px;
55
+ }
56
+
57
+ textarea {
58
+ border-radius: 5px;
59
+ border-color: #999;
60
+ width: 100%;
61
+ }
62
+
63
+ select {
64
+ line-height: 18px;
65
+ font-size: 18px;
66
+ }
67
+
68
+ .container {
69
+ width: 950px;
70
+ margin: 0;
71
+ overflow: auto;
72
+ background-color: white;
73
+ }
74
+
75
+ .accordion .container {
76
+ width: auto;
77
+ }
78
+
79
+ .content {
80
+ width: 950px;
81
+ margin: 0 auto;
82
+ }
83
+
84
+ .button {
85
+ display: inline-block;
86
+ margin: 0 4px;
87
+ }
88
+
89
+ .ui-button-icon-only {
90
+ height: 24px;
91
+ width: 24px;
92
+ vertical-align: middle;
93
+ }
94
+