poodle-rb 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/fonts/FontAwesome.otf +0 -0
  6. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  7. data/app/assets/fonts/fontawesome-webfont.svg +520 -0
  8. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  9. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  10. data/app/assets/javascripts/poodle/application.js +21 -0
  11. data/app/assets/javascripts/poodle/bootstrap.js +2323 -0
  12. data/app/assets/javascripts/poodle/common.js +0 -0
  13. data/app/assets/javascripts/poodle/photo_upload.js +104 -0
  14. data/app/assets/javascripts/poodle/utilities.js +50 -0
  15. data/app/assets/javascripts/poodle/validations/sample.js +67 -0
  16. data/app/assets/stylesheets/poodle/application.css +18 -0
  17. data/app/assets/stylesheets/poodle/bootstrap-theme.css +473 -0
  18. data/app/assets/stylesheets/poodle/bootstrap.css +5482 -0
  19. data/app/assets/stylesheets/poodle/font-awesome.css +1672 -0
  20. data/app/assets/stylesheets/poodle/poodle-theme.css +55 -0
  21. data/app/controllers/poodle/application_controller.rb +15 -0
  22. data/app/helpers/poodle/application_helper.rb +4 -0
  23. data/app/helpers/poodle/display_helper.rb +36 -0
  24. data/app/helpers/poodle/flash_helper.rb +14 -0
  25. data/app/helpers/poodle/image_helper.rb +100 -0
  26. data/app/helpers/poodle/meta_tags_helper.rb +4 -0
  27. data/app/helpers/poodle/navigation_helper.rb +20 -0
  28. data/app/helpers/poodle/notification_helper.rb +20 -0
  29. data/app/helpers/poodle/params_parser_helper.rb +32 -0
  30. data/app/helpers/poodle/title_helper.rb +16 -0
  31. data/app/helpers/poodle/url_helper.rb +21 -0
  32. data/app/views/layouts/poodle/application/_footer.html.erb +5 -0
  33. data/app/views/layouts/poodle/application/_header.html.erb +26 -0
  34. data/app/views/layouts/poodle/application/_sidebar.html.erb +45 -0
  35. data/app/views/layouts/poodle/application.html.erb +56 -0
  36. data/app/views/layouts/poodle/common/_field.html.erb +46 -0
  37. data/app/views/layouts/poodle/common/_flash_message.html.erb +23 -0
  38. data/app/views/layouts/poodle/common/_meta_tags.html.erb +42 -0
  39. data/app/views/layouts/poodle/common/_overlays.html.erb +28 -0
  40. data/app/views/layouts/poodle/public.html.erb +48 -0
  41. data/app/views/widgets/_more_details.html.erb +89 -0
  42. data/config/initializers/api_errors.rb +32 -0
  43. data/config/routes.rb +2 -0
  44. data/lib/poodle/configuration.rb +14 -0
  45. data/lib/poodle/engine.rb +5 -0
  46. data/lib/poodle/version.rb +3 -0
  47. data/lib/poodle-rb.rb +20 -0
  48. data/lib/tasks/poodle_tasks.rake +4 -0
  49. data/test/dummy/README.rdoc +28 -0
  50. data/test/dummy/Rakefile +6 -0
  51. data/test/dummy/app/assets/javascripts/application.js +13 -0
  52. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  53. data/test/dummy/app/controllers/application_controller.rb +5 -0
  54. data/test/dummy/app/helpers/application_helper.rb +2 -0
  55. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  56. data/test/dummy/bin/bundle +3 -0
  57. data/test/dummy/bin/rails +4 -0
  58. data/test/dummy/bin/rake +4 -0
  59. data/test/dummy/config/application.rb +23 -0
  60. data/test/dummy/config/boot.rb +5 -0
  61. data/test/dummy/config/database.yml +25 -0
  62. data/test/dummy/config/environment.rb +5 -0
  63. data/test/dummy/config/environments/development.rb +37 -0
  64. data/test/dummy/config/environments/production.rb +78 -0
  65. data/test/dummy/config/environments/test.rb +39 -0
  66. data/test/dummy/config/initializers/assets.rb +8 -0
  67. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  68. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  69. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/test/dummy/config/initializers/inflections.rb +16 -0
  71. data/test/dummy/config/initializers/mime_types.rb +4 -0
  72. data/test/dummy/config/initializers/session_store.rb +3 -0
  73. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  74. data/test/dummy/config/locales/en.yml +23 -0
  75. data/test/dummy/config/routes.rb +4 -0
  76. data/test/dummy/config/secrets.yml +22 -0
  77. data/test/dummy/config.ru +4 -0
  78. data/test/dummy/public/404.html +67 -0
  79. data/test/dummy/public/422.html +67 -0
  80. data/test/dummy/public/500.html +66 -0
  81. data/test/dummy/public/favicon.ico +0 -0
  82. data/test/integration/navigation_test.rb +10 -0
  83. data/test/poodle_test.rb +7 -0
  84. data/test/test_helper.rb +19 -0
  85. metadata +226 -0
File without changes
@@ -0,0 +1,104 @@
1
+ var status;
2
+ var maxPhotoUploadFileSize = 5000000;
3
+
4
+ // Used to clone photo uploader
5
+ function add_fields(link, association, content) {
6
+ var new_id = new Date().getTime();
7
+ var regexp = new RegExp("new_" + association, "g")
8
+ $(link).parent().before(content.replace(regexp, new_id));
9
+ var upload_label = $('label.upload_image');
10
+ if($(upload_label).length > 0) {
11
+ $(upload_label).text('browse');
12
+ }
13
+ }
14
+
15
+ // Remove a photo uploader
16
+ function remove_fields(link) {
17
+ $(link).prev("input[type=hidden]").val("1");
18
+ $(link).closest("div.add-photos-path").hide();
19
+ }
20
+
21
+ // Remove Option filed
22
+ function remove_option_field(link) {
23
+ $(link).prev("input[type=hidden]").val("1");
24
+ $(link).closest("div.div-new-field").hide();
25
+ }
26
+
27
+ /* Validate image file extension. The Supported formats are
28
+ .jpg, .jpeg, .ico, .png, .gif
29
+ */
30
+ function validate_file_extn(filename) {
31
+ var image_extns = new Array(/^jpg$/i, /^png$/i, /^jpeg$/i, /^ico$/i, /^gif$/i)
32
+ var extn = filename.split('.');
33
+ for(var i = 0; i < image_extns.length; i++) {
34
+ if(extn[1].match(image_extns[i])) {
35
+ status = "true"
36
+ break;
37
+ }
38
+ else {
39
+ status = "false";
40
+ }
41
+ }
42
+ return status;
43
+ }
44
+
45
+ // Client side image preview before uploading to server
46
+
47
+ function preview_image(input, element_id, width) {
48
+
49
+ if(width == undefined){
50
+ width = 90;
51
+ }
52
+
53
+ var filename = $(input).val().split('\\').pop();
54
+ var status = validate_file_extn(filename);
55
+ var reader = '';
56
+
57
+ if(status == "false") {
58
+ $(input).val('');
59
+ alert("File type is not supported");
60
+ }
61
+ else {
62
+
63
+ if(navigator.userAgent.match(/msie/i) && !navigator.userAgent.match(/msie 10/i)) {
64
+ if($('.div-sg-photo-preview').length > 0) {
65
+ $('.div-sg-photo-preview').css('border', '1px solid lightgray').html(filename);
66
+ }
67
+ else {
68
+ $(input).parents('.add-photos-path').find('.jquery-sg-image-container').
69
+ css('border-top', '1px solid gray').html(filename);
70
+ }
71
+ }
72
+ else if(navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/msie 10/i)) {
73
+ reader = new FileReader();
74
+ reader.onload = function (e) {
75
+ $('#'+element_id)
76
+ .attr('src', e.target.result)
77
+ .width(width);
78
+ };
79
+
80
+ reader.readAsDataURL(input.files[0]);
81
+ }
82
+
83
+ else {
84
+
85
+ if (input.files && input.files[0]) {
86
+ if(input.files[0].size < maxPhotoUploadFileSize) {
87
+ reader = new FileReader();
88
+ reader.onload = function (e) {
89
+ $('#'+element_id)
90
+ .attr('src', e.target.result)
91
+ .width(width);
92
+ };
93
+
94
+ reader.readAsDataURL(input.files[0]);
95
+ }
96
+ else {
97
+ alert("Maximum Size is " + maxPhotoUploadFileSize + " KB");
98
+ }
99
+
100
+ }
101
+ }
102
+ }
103
+
104
+ }
@@ -0,0 +1,50 @@
1
+ // Write down only those functions which are being used by application.init or any part of the application like ajax event handlers.
2
+
3
+ // loadANewPage will accept a url and will load a new page
4
+ // It can be tuned to show a lightbox showing a loading, please wait message.
5
+ function loadANewPage(url){
6
+ // showLightBoxLoading();
7
+ window.location.href=url;
8
+ }
9
+
10
+ // sendAjaxRequest is used to send an xml http request using javascript to a url using a method / get, put, post, delete
11
+ function sendAjaxRequest(url, mType){
12
+ methodType = mType || "GET";
13
+ jQuery.ajax({type: methodType, dataType:"script", url:url});
14
+ }
15
+
16
+ // Call this function by passing model Id, heading and a bodyContent.
17
+ // it will pop up bootstrap 3 modal.
18
+ var messageModalId = "div_modal_message";
19
+ var genericModalId = "div_modal_generic";
20
+ function showModal(heading, bodyContent, modalId){
21
+ if(modalId==null){
22
+ var modalId = genericModalId;
23
+ }
24
+ //$('#' + modalId + ' .modal-body').html("<p>"+ message +"</p>");
25
+ $('#' + modalId + ' .modal-header h4.modal-title').text(heading);
26
+ $('#' + modalId + ' div.modal-body-main').html(bodyContent);
27
+ $('#' + modalId).modal('show');
28
+ //$('#' + modalId + ' .modal-footer button.btn-primary').button('reset');
29
+ }
30
+
31
+ // Call this function by passing heading and a message.
32
+ // it will pop up bootstrap 3 modal which shows the heading and message as content body.
33
+ function showModalMessage(heading, message, modalId){
34
+ if(modalId==null){
35
+ var modalId = messageModalId;
36
+ }
37
+ var bodyContent = "<p>"+ message +"</p>";
38
+ //$('#' + modalId + ' .modal-body').html("<p>"+ message +"</p>");
39
+ $('#' + modalId + ' .modal-header h4.modal-title').text(heading);
40
+ $('#' + modalId + ' div.modal-body').html(bodyContent);
41
+ $('#' + modalId).modal('show');
42
+ //$('#' + modalId + ' .modal-footer button.btn-primary').button('reset');
43
+ }
44
+
45
+ function closeModal(modalId){
46
+ if(modalId==null){
47
+ var modalId = genericModalId;
48
+ }
49
+ $('#' + modalId).modal('hide');
50
+ }
@@ -0,0 +1,67 @@
1
+ function validateSampleForm() {
2
+
3
+ $('#form_sample').validate({
4
+ debug: true,
5
+ rules: {
6
+ "sample[first_name]": {
7
+ required: true,
8
+ minlength: 2,
9
+ maxlength: 50
10
+ },
11
+ "sample[last_name]": {
12
+ required: true,
13
+ minlength: 2,
14
+ maxlength: 50
15
+ },
16
+ "sample[email]": {
17
+ required: true,
18
+ email: true
19
+ },
20
+ },
21
+ errorElement: "span",
22
+ errorClass: "help-block",
23
+ messages: {
24
+ "sample[first_name]": "Please specify First Name",
25
+ "sample[last_name]": "Please specify Last Name",
26
+ "sample[email]": {
27
+ required: "We need your email address to contact you",
28
+ email: "Your email address must be in the format of name@domain.com"
29
+ },
30
+ },
31
+ highlight: function(element) {
32
+ $(element).parent().parent().addClass("has-error");
33
+ },
34
+ unhighlight: function(element) {
35
+ $(element).parent().parent().removeClass("has-error");
36
+ },
37
+ invalidHandler: function(event, validator) {
38
+ // 'this' refers to the form
39
+ var errors = validator.numberOfInvalids();
40
+ if (errors) {
41
+
42
+ // Populating error message
43
+ var errorMessage = errors == 1
44
+ ? 'You missed 1 field. It has been highlighted'
45
+ : 'You missed ' + errors + ' fields. They have been highlighted';
46
+
47
+ // Removing the form error if it already exists
48
+ $("#div_sample_js_validation_error").remove();
49
+
50
+ errorHtml = "<div id='div_sample_js_validation_error' class=\"alert alert-danger\" data-alert=\"alert\" style=\"margin-bottom:5px;\">"+ errorMessage +"</div>"
51
+ //$("#div_sample_details").prepend(errorHtml);
52
+ $("#div_modal_generic div.modal-body-main").prepend(errorHtml);
53
+
54
+ // Show error labels
55
+ $("div.error").show();
56
+
57
+ } else {
58
+ // Hide error labels
59
+ $("div.error").hide();
60
+ // Removing the error message
61
+ $("#div_sample_js_validation_error").remove();
62
+ }
63
+ }
64
+
65
+ });
66
+
67
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require poodle/bootstrap
12
+ *= require poodle/bootstrap-theme
13
+ *= require poodle/font-awesome
14
+ *= require poodle/poodle-theme
15
+ *= require handycss.css
16
+ *= require_self
17
+
18
+ */