padma-assets 0.1.32 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/abilities/general_ability.rb +2 -1
  3. data/app/assets/javascripts/bootstrap-multiselect.js +1401 -0
  4. data/app/assets/javascripts/bootstrap.min.js +12 -0
  5. data/app/assets/javascripts/jquery-2.1.4.min.js +4 -0
  6. data/app/assets/javascripts/jquery-iframe-transport.js +156 -0
  7. data/app/assets/javascripts/jquery-tmpl-min.js +1 -0
  8. data/app/assets/javascripts/jquery.common.js +12 -0
  9. data/app/assets/javascripts/jquery.iframe-transport.js +156 -0
  10. data/app/assets/javascripts/jquery.postmessage-transport.js +108 -0
  11. data/app/assets/javascripts/jquery.rest_in_place.js +233 -0
  12. data/app/assets/javascripts/jquery.stickyheader.js +7 -5
  13. data/app/assets/javascripts/jquery.tipsy.js +243 -0
  14. data/app/assets/javascripts/jquery.xdr-transport.js +76 -0
  15. data/app/assets/javascripts/padma-assets.js +14 -2
  16. data/app/assets/stylesheets/bootstrap-multiselect.css +1 -0
  17. data/app/assets/stylesheets/common/custom.scss +1611 -0
  18. data/app/assets/stylesheets/common/ui.css.scss +488 -0
  19. data/app/assets/stylesheets/common/variables.scss +68 -0
  20. data/app/assets/stylesheets/custom/colors.css.scss +13 -0
  21. data/app/assets/stylesheets/custom/form.css.scss +37 -0
  22. data/app/assets/stylesheets/custom/tabs.scss +7 -0
  23. data/app/assets/stylesheets/header.css.erb +8 -148
  24. data/app/assets/stylesheets/header.scss +364 -0
  25. data/app/assets/stylesheets/layout_application.css +0 -5
  26. data/app/assets/stylesheets/layout_users.css +29 -28
  27. data/app/assets/stylesheets/pm-modal.scss +15 -9
  28. data/app/views/layouts/_header.html.erb +24 -20
  29. data/app/views/layouts/_lists_list.html.erb +39 -25
  30. data/app/views/layouts/_module_box.html.erb +70 -58
  31. metadata +21 -7
  32. data/app/assets/stylesheets/button.css.scss +0 -344
  33. data/app/assets/stylesheets/padma-accounts.scss +0 -3
  34. data/app/assets/stylesheets/reset.css +0 -102
  35. data/app/assets/stylesheets/tables.css.scss +0 -154
  36. data/app/views/layouts/_alpha_lists_list.html.erb +0 -46
@@ -0,0 +1,156 @@
1
+ /*
2
+ * jQuery Iframe Transport Plugin 1.2.4
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2011, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://creativecommons.org/licenses/MIT/
10
+ */
11
+
12
+ /*jslint unparam: true, nomen: true */
13
+ /*global jQuery, document */
14
+
15
+ (function ($) {
16
+ 'use strict';
17
+
18
+ // Helper variable to create unique names for the transport iframes:
19
+ var counter = 0;
20
+
21
+ // The iframe transport accepts three additional options:
22
+ // options.fileInput: a jQuery collection of file input fields
23
+ // options.paramName: the parameter name for the file form data,
24
+ // overrides the name property of the file input field(s)
25
+ // options.formData: an array of objects with name and value properties,
26
+ // equivalent to the return data of .serializeArray(), e.g.:
27
+ // [{name: 'a', value: 1}, {name: 'b', value: 2}]
28
+ $.ajaxTransport('iframe', function (options) {
29
+ if (options.async && (options.type === 'POST' || options.type === 'GET')) {
30
+ var form,
31
+ iframe;
32
+ return {
33
+ send: function (_, completeCallback) {
34
+ form = $('<form style="display:none;"></form>');
35
+ // javascript:false as initial iframe src
36
+ // prevents warning popups on HTTPS in IE6.
37
+ // IE versions below IE8 cannot set the name property of
38
+ // elements that have already been added to the DOM,
39
+ // so we set the name along with the iframe HTML markup:
40
+ iframe = $(
41
+ '<iframe src="javascript:false;" name="iframe-transport-' +
42
+ (counter += 1) + '"></iframe>'
43
+ ).bind('load', function () {
44
+ var fileInputClones;
45
+ iframe
46
+ .unbind('load')
47
+ .bind('load', function () {
48
+ var response;
49
+ // Wrap in a try/catch block to catch exceptions thrown
50
+ // when trying to access cross-domain iframe contents:
51
+ try {
52
+ response = iframe.contents();
53
+ // Google Chrome and Firefox do not throw an
54
+ // exception when calling iframe.contents() on
55
+ // cross-domain requests, so we unify the response:
56
+ if (!response.length || !response[0].firstChild) {
57
+ throw new Error();
58
+ }
59
+ } catch (e) {
60
+ response = undefined;
61
+ }
62
+ // The complete callback returns the
63
+ // iframe content document as response object:
64
+ completeCallback(
65
+ 200,
66
+ 'success',
67
+ {'iframe': response}
68
+ );
69
+ // Fix for IE endless progress bar activity bug
70
+ // (happens on form submits to iframe targets):
71
+ $('<iframe src="javascript:false;"></iframe>')
72
+ .appendTo(form);
73
+ form.remove();
74
+ });
75
+ form
76
+ .prop('target', iframe.prop('name'))
77
+ .prop('action', options.url)
78
+ .prop('method', options.type);
79
+ if (options.formData) {
80
+ $.each(options.formData, function (index, field) {
81
+ $('<input type="hidden"/>')
82
+ .prop('name', field.name)
83
+ .val(field.value)
84
+ .appendTo(form);
85
+ });
86
+ }
87
+ if (options.fileInput && options.fileInput.length &&
88
+ options.type === 'POST') {
89
+ fileInputClones = options.fileInput.clone();
90
+ // Insert a clone for each file input field:
91
+ options.fileInput.after(function (index) {
92
+ return fileInputClones[index];
93
+ });
94
+ if (options.paramName) {
95
+ options.fileInput.each(function () {
96
+ $(this).prop('name', options.paramName);
97
+ });
98
+ }
99
+ // Appending the file input fields to the hidden form
100
+ // removes them from their original location:
101
+ form
102
+ .append(options.fileInput)
103
+ .prop('enctype', 'multipart/form-data')
104
+ // enctype must be set as encoding for IE:
105
+ .prop('encoding', 'multipart/form-data');
106
+ }
107
+ form.submit();
108
+ // Insert the file input fields at their original location
109
+ // by replacing the clones with the originals:
110
+ if (fileInputClones && fileInputClones.length) {
111
+ options.fileInput.each(function (index, input) {
112
+ var clone = $(fileInputClones[index]);
113
+ $(input).prop('name', clone.prop('name'));
114
+ clone.replaceWith(input);
115
+ });
116
+ }
117
+ });
118
+ form.append(iframe).appendTo(document.body);
119
+ },
120
+ abort: function () {
121
+ if (iframe) {
122
+ // javascript:false as iframe src aborts the request
123
+ // and prevents warning popups on HTTPS in IE6.
124
+ // concat is used to avoid the "Script URL" JSLint error:
125
+ iframe
126
+ .unbind('load')
127
+ .prop('src', 'javascript'.concat(':false;'));
128
+ }
129
+ if (form) {
130
+ form.remove();
131
+ }
132
+ }
133
+ };
134
+ }
135
+ });
136
+
137
+ // The iframe transport returns the iframe content document as response.
138
+ // The following adds converters from iframe to text, json, html, and script:
139
+ $.ajaxSetup({
140
+ converters: {
141
+ 'iframe text': function (iframe) {
142
+ return iframe.find('body').text();
143
+ },
144
+ 'iframe json': function (iframe) {
145
+ return $.parseJSON(iframe.find('body').text());
146
+ },
147
+ 'iframe html': function (iframe) {
148
+ return iframe.find('body').html();
149
+ },
150
+ 'iframe script': function (iframe) {
151
+ return $.globalEval(iframe.find('body').text());
152
+ }
153
+ }
154
+ });
155
+
156
+ }(jQuery));
@@ -0,0 +1,108 @@
1
+ /*
2
+ * jQuery postMessage Transport Plugin 1.0
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2011, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://creativecommons.org/licenses/MIT/
10
+ */
11
+
12
+ /*jslint unparam: true, nomen: true */
13
+ /*global jQuery, window, document */
14
+
15
+ (function ($) {
16
+ 'use strict';
17
+
18
+ var counter = 0,
19
+ names = [
20
+ 'accepts',
21
+ 'cache',
22
+ 'contents',
23
+ 'contentType',
24
+ 'crossDomain',
25
+ 'data',
26
+ 'dataType',
27
+ 'headers',
28
+ 'ifModified',
29
+ 'mimeType',
30
+ 'password',
31
+ 'processData',
32
+ 'timeout',
33
+ 'traditional',
34
+ 'type',
35
+ 'url',
36
+ 'username'
37
+ ],
38
+ convert = function (p) {
39
+ return p;
40
+ };
41
+
42
+ $.ajaxSetup({
43
+ converters: {
44
+ 'postmessage text': convert,
45
+ 'postmessage json': convert,
46
+ 'postmessage html': convert
47
+ }
48
+ });
49
+
50
+ $.ajaxTransport('postmessage', function (options) {
51
+ if (options.postMessage && window.postMessage) {
52
+ var iframe,
53
+ loc = $('<a>').prop('href', options.postMessage)[0],
54
+ target = loc.protocol + '//' + loc.host,
55
+ xhrUpload = options.xhr().upload;
56
+ return {
57
+ send: function (_, completeCallback) {
58
+ var message = {
59
+ id: 'postmessage-transport-' + (counter += 1)
60
+ },
61
+ eventName = 'message.' + message.id;
62
+ iframe = $(
63
+ '<iframe style="display:none;" src="' +
64
+ options.postMessage + '" name="' +
65
+ message.id + '"></iframe>'
66
+ ).bind('load', function () {
67
+ $.each(names, function (i, name) {
68
+ message[name] = options[name];
69
+ });
70
+ message.dataType = message.dataType.replace('postmessage ', '');
71
+ $(window).bind(eventName, function (e) {
72
+ e = e.originalEvent;
73
+ var data = e.data,
74
+ ev;
75
+ if (e.origin === target && data.id === message.id) {
76
+ if (data.type === 'progress') {
77
+ ev = document.createEvent('Event');
78
+ ev.initEvent(data.type, false, true);
79
+ $.extend(ev, data);
80
+ xhrUpload.dispatchEvent(ev);
81
+ } else {
82
+ completeCallback(
83
+ data.status,
84
+ data.statusText,
85
+ {postmessage: data.result},
86
+ data.headers
87
+ );
88
+ iframe.remove();
89
+ $(window).unbind(eventName);
90
+ }
91
+ }
92
+ });
93
+ iframe[0].contentWindow.postMessage(
94
+ message,
95
+ target
96
+ );
97
+ }).appendTo(document.body);
98
+ },
99
+ abort: function () {
100
+ if (iframe) {
101
+ iframe.remove();
102
+ }
103
+ }
104
+ };
105
+ }
106
+ });
107
+
108
+ }(jQuery));
@@ -0,0 +1,233 @@
1
+ function RestInPlaceEditor(e) {
2
+ this.element = jQuery(e);
3
+ this.initOptions();
4
+ this.bindForm();
5
+
6
+ this.element.bind('click', {editor: this}, this.clickHandler);
7
+ }
8
+
9
+ RestInPlaceEditor.prototype = {
10
+ // Public Interface Functions //////////////////////////////////////////////
11
+
12
+ activate : function() {
13
+ this.oldValue = this.element.html();
14
+ this.element.addClass('rip-active');
15
+ this.element.unbind('click', this.clickHandler);
16
+ this.activateForm();
17
+ },
18
+
19
+ abort : function() {
20
+ this.element
21
+ .html(this.oldValue)
22
+ .removeClass('rip-active')
23
+ .bind('click', {editor: this}, this.clickHandler);
24
+ },
25
+
26
+ // PADMA addition
27
+ create : function() {
28
+ var editor = this;
29
+ editor.ajax({
30
+ "type" : "post",
31
+ "dataType" : "json",
32
+ "data" : editor.requestDataForPost(),
33
+ "error" : function(response) {
34
+ if (response.status == 100 && response.statusText == "parsererror") {
35
+ editor.ajax({
36
+ "dataType" : 'json',
37
+ "success" : function(data){ editor.loadSuccessCallback(data) }
38
+ });
39
+ } else if (response.status == 400 ) {
40
+ editor.loadFailureCallback(response);
41
+ editor.abort();
42
+ } else {
43
+ editor.loadExceptionCallback(response);
44
+ editor.abort();
45
+ }
46
+ },
47
+ "success" : function(data){
48
+ if (data) {
49
+ editor.loadSuccessCallback(data)
50
+ } else {
51
+ editor.ajax({
52
+ "dataType" : 'json',
53
+ "success" : function(data){ editor.loadSuccessCallback(data) }
54
+ });
55
+ }
56
+ }
57
+ });
58
+ editor.element.html("<span class='spinner' width=" + editor.element.width() + "></span>");
59
+ },
60
+
61
+ update : function() {
62
+ var editor = this;
63
+ editor.ajax({
64
+ "type" : "post",
65
+ "dataType" : "json",
66
+ "data" : editor.requestData(),
67
+ "error" : function(response) {
68
+ if (response.status == 100 && response.statusText == "parsererror") {
69
+ editor.ajax({
70
+ "dataType" : 'json',
71
+ "success" : function(data){ editor.loadSuccessCallback(data) }
72
+ });
73
+ } else if (response.status == 400 ) {
74
+ editor.loadFailureCallback(response);
75
+ editor.abort();
76
+ } else {
77
+ editor.loadExceptionCallback(response);
78
+ editor.abort();
79
+ }
80
+ },
81
+ "success" : function(data){
82
+ if (data) {
83
+ editor.loadSuccessCallback(data)
84
+ } else {
85
+ editor.ajax({
86
+ "dataType" : 'json',
87
+ "success" : function(data){ editor.loadSuccessCallback(data) }
88
+ });
89
+ }
90
+ }
91
+ });
92
+ editor.element.html("<span class='spinner' width=" + editor.element.width() + "></span>");
93
+ },
94
+
95
+ activateForm : function() {
96
+ alert("The form was not properly initialized. activateForm is unbound");
97
+ },
98
+
99
+ // Helper Functions ////////////////////////////////////////////////////////
100
+
101
+ initOptions : function() {
102
+ // Try parent supplied info
103
+ var self = this;
104
+ self.element.parents().each(function(){
105
+ self.url = self.url || jQuery(this).attr("data-url");
106
+ self.formType = self.formType || jQuery(this).attr("data-formtype");
107
+ self.objectName = self.objectName || jQuery(this).attr("data-object");
108
+ self.attributeName = self.attributeName || jQuery(this).attr("data-attribute");
109
+ });
110
+ // Try Rails-id based if parents did not explicitly supply something
111
+ self.element.parents().each(function(){
112
+ var res;
113
+ if (res = this.id.match(/^(\w+)_(\d+)$/i)) {
114
+ self.objectName = self.objectName || res[1];
115
+ }
116
+ });
117
+ // Load own attributes (overrides all others)
118
+ self.url = self.element.attr("data-url") || self.url || document.location.pathname;
119
+ self.formType = self.element.attr("data-formtype") || self.formtype || "input";
120
+ self.objectName = self.element.attr("data-object") || self.objectName;
121
+ self.attributeName = self.element.attr("data-attribute") || self.attributeName;
122
+ },
123
+
124
+ bindForm : function() {
125
+ this.activateForm = RestInPlaceEditor.forms[this.formType].activateForm;
126
+ this.getValue = RestInPlaceEditor.forms[this.formType].getValue;
127
+ },
128
+
129
+ getValue : function() {
130
+ alert("The form was not properly initialized. getValue is unbound");
131
+ },
132
+
133
+ /* Generate the data sent in the POST request */
134
+ requestDataForPost : function() {
135
+ //jq14: data as JS object, not string.
136
+ var data = "";
137
+ var objectName = this.objectName;
138
+ data += objectName+'['+this.attributeName+']='+encodeURIComponent(this.getValue());
139
+ if(typeof this.element.data().otherattributes != 'undefined'){
140
+ $.each(this.element.data().otherattributes,function(k,v){
141
+ data += "&"+objectName+'['+k+']='+encodeURIComponent(v);
142
+ });
143
+ }
144
+ if (window.rails_authenticity_token) {
145
+ data += "&authenticity_token="+encodeURIComponent(window.rails_authenticity_token);
146
+ }
147
+ return data;
148
+ },
149
+
150
+ /* Generate the data sent in the POST request */
151
+ requestData : function() {
152
+ //jq14: data as JS object, not string.
153
+ var data = "_method=put";
154
+ data += "&"+this.objectName+'['+this.attributeName+']='+encodeURIComponent(this.getValue());
155
+ if (window.rails_authenticity_token) {
156
+ data += "&authenticity_token="+encodeURIComponent(window.rails_authenticity_token);
157
+ }
158
+ return data;
159
+ },
160
+
161
+ ajax : function(options) {
162
+ options.url = this.url;
163
+ return jQuery.ajax(options);
164
+ },
165
+
166
+ // Handlers ////////////////////////////////////////////////////////////////
167
+
168
+ loadSuccessCallback : function(data) {
169
+ //jq14: data as JS object, not string.
170
+ if (jQuery.fn.jquery < "1.4") data = eval('(' + data + ')' );
171
+ this.element.html(data[this.objectName][this.attributeName]);
172
+ this.element.bind('click', {editor: this}, this.clickHandler);
173
+ this.element.removeClass('rip-active');
174
+ },
175
+
176
+ clickHandler : function(event) {
177
+ event.data.editor.activate();
178
+ }
179
+ };
180
+
181
+
182
+ RestInPlaceEditor.forms = {
183
+ "input" : {
184
+ /* is bound to the editor and called to replace the element's content with a form for editing data */
185
+ activateForm : function() {
186
+ this.element.html('<form action="javascript:void(0)" style="display:inline;"><input type="text" value="' + jQuery.trim(this.oldValue) + '"></form>');
187
+ this.element.find('input')[0].select();
188
+ this.element.find("form")
189
+ .bind('submit', {editor: this}, RestInPlaceEditor.forms.input.submitHandler);
190
+ this.element.find("input")
191
+ .bind('blur', {editor: this}, RestInPlaceEditor.forms.input.inputBlurHandler);
192
+ },
193
+
194
+ getValue : function() {
195
+ return this.element.find("input").val();
196
+ },
197
+
198
+ inputBlurHandler : function(event) {
199
+ event.data.editor.abort();
200
+ },
201
+
202
+ submitHandler : function(event) {
203
+ event.data.editor.update();
204
+ return false;
205
+ }
206
+ },
207
+
208
+ "textarea" : {
209
+ /* is bound to the editor and called to replace the element's content with a form for editing data */
210
+ activateForm : function() {
211
+ this.element.html('<form action="javascript:void(0)" style="display:inline;"><textarea>' + jQuery.trim(this.oldValue) + '</textarea></form>');
212
+ this.element.find('textarea')[0].select();
213
+ this.element.find("textarea")
214
+ .bind('blur', {editor: this}, RestInPlaceEditor.forms.textarea.blurHandler);
215
+ },
216
+
217
+ getValue : function() {
218
+ return this.element.find("textarea").val();
219
+ },
220
+
221
+ blurHandler : function(event) {
222
+ event.data.editor.update();
223
+ }
224
+
225
+ }
226
+ };
227
+
228
+ jQuery.fn.rest_in_place = function() {
229
+ this.each(function(){
230
+ jQuery(this).data('restInPlaceEditor', new RestInPlaceEditor(this));
231
+ })
232
+ return this;
233
+ };
@@ -70,13 +70,13 @@ $(function(){
70
70
  // When top of wrapping parent is out of view
71
71
  $stickyHead.add($stickyInsct).css({
72
72
  opacity: 1,
73
- top: $stickyWrap.scrollTop()
73
+ top: $stickyWrap.scrollTop(),
74
74
  });
75
75
  } else {
76
76
  // When top of wrapping parent is in view
77
77
  $stickyHead.add($stickyInsct).css({
78
78
  opacity: 0,
79
- top: 0
79
+ top: 0,
80
80
  });
81
81
  }
82
82
  } else {
@@ -86,13 +86,15 @@ $(function(){
86
86
  // When top of viewport is in the table itself
87
87
  $stickyHead.add($stickyInsct).css({
88
88
  opacity: 1,
89
- top: $w.scrollTop() - $t.offset().top
89
+ top: $w.scrollTop() - $t.offset().top,
90
+ "z-index": 100
90
91
  });
91
92
  } else {
92
93
  // When top of viewport is above or below table
93
94
  $stickyHead.add($stickyInsct).css({
94
95
  opacity: 0,
95
- top: 0
96
+ top: 0,
97
+ "z-index": -1
96
98
  });
97
99
  }
98
100
  }
@@ -102,7 +104,7 @@ $(function(){
102
104
  // When left of wrapping parent is out of view
103
105
  $stickyCol.add($stickyInsct).css({
104
106
  opacity: 1,
105
- left: $stickyWrap.scrollLeft()
107
+ left: $stickyWrap.scrollLeft(),
106
108
  });
107
109
  } else {
108
110
  // When left of wrapping parent is in view