friends_ajax_core 0.0.51

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 (44) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/images/icons-16/icon-arrow-down-hover.png +0 -0
  3. data/app/assets/images/icons-16/icon-arrow-down.png +0 -0
  4. data/app/assets/images/icons-16/icon-arrow-right-hover.png +0 -0
  5. data/app/assets/images/icons-16/icon-arrow-right.png +0 -0
  6. data/app/assets/images/icons/icon-close.png +0 -0
  7. data/app/assets/images/icons/loader-16.png +0 -0
  8. data/app/assets/images/icons/loader-24.png +0 -0
  9. data/app/assets/images/menu/alpha-bg-60.png +0 -0
  10. data/app/assets/images/menu/alpha-bg-75.png +0 -0
  11. data/app/assets/images/menu/alpha-bg-95.png +0 -0
  12. data/app/assets/images/menu/alpha-bg-99.png +0 -0
  13. data/app/assets/javascripts/ajax_callbacks_core/common.js.erb +83 -0
  14. data/app/assets/javascripts/ajax_callbacks_core/forms.js.erb +27 -0
  15. data/app/assets/javascripts/ajax_callbacks_core/helpers.js.erb +216 -0
  16. data/app/assets/javascripts/ajax_ext_core/colorpicker.js +484 -0
  17. data/app/assets/javascripts/ajax_ext_core/date.js.erb +335 -0
  18. data/app/assets/javascripts/ajax_ext_core/faye.js +2 -0
  19. data/app/assets/javascripts/ajax_ext_core/jquery-json.js +178 -0
  20. data/app/assets/javascripts/ajax_ext_core/jquery-ui-timepicker-addon.js +1923 -0
  21. data/app/assets/javascripts/ajax_ext_core/jquery.hash.js +203 -0
  22. data/app/assets/javascripts/ajax_ext_core/jquery.jsonSuggest.js +25 -0
  23. data/app/assets/javascripts/ajax_ext_core/jquery.mtz.monthpicker.js +271 -0
  24. data/app/assets/javascripts/ajax_ext_core/preload_images.js +56 -0
  25. data/app/assets/javascripts/ajax_ui_core/autocomplete.js.erb +26 -0
  26. data/app/assets/javascripts/ajax_ui_core/datepicker.js.erb +144 -0
  27. data/app/assets/javascripts/ajax_ui_core/friends_ui.js.erb +23 -0
  28. data/app/assets/javascripts/ajax_ui_core/overlay.js.erb +85 -0
  29. data/app/assets/javascripts/ajax_ui_core/slide-down.js +163 -0
  30. data/app/assets/javascripts/friends_ajax_core.js.erb +11 -0
  31. data/app/assets/javascripts/init_ajax_core.js.erb +22 -0
  32. data/app/controllers/friends_ajax_controller.rb +6 -0
  33. data/app/helpers/friends_ajax_helper.rb +176 -0
  34. data/app/views/layouts/_ajax_overlay.html.erb +5 -0
  35. data/app/views/layouts/_info_overlay.html.erb +9 -0
  36. data/app/views/layouts/_invisible_overlay.html.erb +10 -0
  37. data/app/views/layouts/_layout_defaults.html.erb +39 -0
  38. data/app/views/layouts/_overlay_js.html.erb +30 -0
  39. data/app/views/layouts/ajax_overlay.html.erb +5 -0
  40. data/app/views/layouts/info_overlay.html.erb +9 -0
  41. data/config/routes.rb +10 -0
  42. data/lib/friends_ajax_core.rb +117 -0
  43. data/lib/friends_ajax_core/version.rb +4 -0
  44. metadata +143 -0
@@ -0,0 +1,56 @@
1
+ jQuery.preloadCssImages = function(){
2
+
3
+     var allImgs = [];//new array for all the image urls  
4
+     var k = 0; //iterator for adding images
5
+     var sheets = document.styleSheets;//array of stylesheets
6
+
7
+     for(var i = 0; i<sheets .length; i++){//loop through each stylesheet
8
+
9
+         var cssPile = '';//create large string of all css rules in sheet
10
+         var csshref = (sheets[i].href) ? sheets[i].href : 'window.location.href';
11
+         var baseURLarr = csshref.split('/');//split href at / to make array
12
+
13
+         baseURLarr.pop();//remove file path from baseURL array
14
+
15
+         var baseURL = baseURLarr.join('/');//create base url for the images in this sheet (css file's dir)
16
+
17
+         if(baseURL!="") baseURL+='/'; //tack on a / if needed
18
+
19
+         if(document.styleSheets[i].cssRules){//w3
20
+
21
+             var thisSheetRules = document.styleSheets[i].cssRules; //w3
22
+
23
+             for(var j = 0; j<thisSheetRules.length; j++){
24
+                 cssPile+= thisSheetRules[j].cssText;
25
+             }
26
+         }
27
+         else {
28
+             cssPile+= document.styleSheets[i].cssText;
29
+         }
30
+
31
+         //parse cssPile for image urls and load them into the DOM
32
+         var imgUrls = cssPile.match(/[^\(]+\.(gif|jpg|jpeg|png)/g);//reg ex to get a string of between a "(" and a ".filename"
33
+
34
+         if(imgUrls != null && imgUrls.length>0 && imgUrls != ''){//loop array
35
+
36
+             var arr = jQuery.makeArray(imgUrls);//create array from regex obj        
37
+
38
+
39
+
40
+             jQuery(arr).each(function(){
41
+                 allImgs[k] = new Image(); //new img obj
42
+
43
+ url = this
44
+
45
+ // weirdness fix
46
+ if(url[0] == '"' || url[0] == "'"){
47
+ url = url.substring(1);
48
+ }
49
+
50
+                 allImgs[k].src = (url[0] == '/' || url.match('http://')) ? url : baseURL + url;     //set src either absolute or rel to css dir
51
+                 k++;
52
+             });
53
+         }
54
+     }//loop
55
+     return allImgs;
56
+ }
@@ -0,0 +1,26 @@
1
+ initAutoComplete = function(){
2
+
3
+ autocomplete_fields = $(".<%= AUTOCOMPLETE_SELECTOR %>")
4
+ autocomplete_fields.each(function(){
5
+ // Datenzusammensuchen
6
+ target = "<%= AUTOCOMPLETE_SOURCE_URL %>" + $(this).attr("<%= AUTOCOMPLETE_DATA_VALUE %>")
7
+ div_id = "#"+$(this).attr("id")
8
+
9
+ loadAutoCompleteJSONData(div_id, target);
10
+
11
+ });
12
+
13
+ }
14
+
15
+ loadAutoCompleteJSONData = function(div_id, target){
16
+ $.getJSON(target, function(data){
17
+ source_data = []
18
+ $.each(data, function(id, val){
19
+ source_data.push(val);
20
+ });
21
+
22
+ $(div_id).autocomplete({
23
+ source: source_data
24
+ });
25
+ });
26
+ }
@@ -0,0 +1,144 @@
1
+ // Intialisierungen der DatePicker UI Elemente
2
+
3
+ // Deutsche Sprache Laden
4
+ //= require jquery.ui.datepicker-de
5
+ var MONTHPICKER_MONTH_NAMES = ['Jan.', 'Feb.', 'März', 'April', 'Mai', 'Juni', 'Juli', 'Aug.', 'Sep.', 'Okt.', 'Nov.', 'Dez.']
6
+
7
+
8
+ // DatePicker in calenders#index
9
+ initDatepickerIconBoxCalendersIndex = function(){
10
+ $("#datepicker-calendars-index").datepicker({
11
+ onSelect: function(date, inst){
12
+ remote_function("/calenders/index/"+ PARAMS_ID + "?start_date="+date, 'calendar-container');
13
+ }
14
+ });
15
+
16
+ $(".datepicker-icon-box.calendars-index").click(function(){
17
+ $("#datepicker-calendars-index").datepicker('show');
18
+ });
19
+ }
20
+
21
+ // DateTimePicker / Loader für freie Räume für calenders#form
22
+ initDateTimePickerCalendersForm = function(){
23
+ $('#datepicker-calendars-form').datetimepicker({
24
+ controlType: 'select',
25
+ hourText: 'Stunde',
26
+ minuteText: 'Minute',
27
+ currentText: 'Jetzt',
28
+ closeText: 'Fertig'
29
+ });
30
+
31
+ $("#calender-datetime-select :input").change(function(){ loadRoomDataForCalendersForm(); });
32
+
33
+ $(".datepicker-box.calendars-form").click(function(){
34
+ $("#datepicker-calendars-form").datepicker('show');
35
+ });
36
+ }
37
+
38
+ loadRoomDataForCalendersForm = function(){
39
+ if(jQuery("#calender-datetime-select :input.datepicker-widget").val() == ""){
40
+ alert("Bitte wählen Sie ein Datum aus.")
41
+ }else{
42
+ jQuery.ajax({
43
+ beforeSend:function(request){ },
44
+ success:function(request){jQuery('#room_select').html(request);},
45
+ data: jQuery("#calender-datetime-select :input").serialize() + '&authenticity_token=' + AUTH_TOKEN,
46
+ type:'post',
47
+ url:'/calenders/get_free_rooms'
48
+ });
49
+ }
50
+ }
51
+
52
+ // Bereich Backoffice Umsatz
53
+ initDatePickerTarifBeginn = function(){
54
+ $("[id^=datepicker-tarif-beginn]").each(function(){
55
+ uid = $(this).attr('id').split("-")[3]
56
+ $(this).datepicker({
57
+ onSelect: function(date, inst){
58
+ remote_function("/tarif/backoffice_beginn_set/"+ uid + "?tarif_beginn="+date, 'beginn_'+uid, 'tiny');
59
+ }
60
+ });
61
+ });
62
+ }
63
+
64
+ // Datepicker für monthly_stepper
65
+ initMonthlyStepper = function(){
66
+ $("#monthly-stepper").monthpicker(
67
+ { startYear: <%= SC_START_DATE.year %>,
68
+ finalYear: <%= Time.now.year %>,
69
+ monthNames: MONTHPICKER_MONTH_NAMES
70
+ }
71
+ );
72
+ $("#monthly-stepper").bind('monthpicker-click-month', function(){
73
+ month_value = $("#monthly-stepper").val().split("/")[0];
74
+ year_value = $("#monthly-stepper").val().split("/")[1];
75
+
76
+ // Replace URL Placeholder
77
+ raw_url = raw_url.replace(".YYYY.", year_value);
78
+ raw_url = raw_url.replace(".MM.", month_value);
79
+
80
+ window.location = raw_url;
81
+ });
82
+ }
83
+
84
+
85
+ initDefaultDatepicker = function(){
86
+ $("input.<%= DEFAULT_DATEPICKER_SELECTOR %>").each(function(){
87
+ $(this).datepicker({changeYear: true, yearRange: '1930:<%= Time.now.year+80 %>', hideIfNoPrevNextType: false})
88
+ cur_date = $(this).attr("<%= HTML_DATA_CURRENT_DATE %>") || ""
89
+ if(cur_date != ""){
90
+ y = parseInt(cur_date.split("-")[0]);
91
+ m = parseInt(cur_date.split("-")[1])-1;
92
+ d = parseInt(cur_date.split("-")[2]);
93
+ real_date = new Date(y,m,d);
94
+ $(this).datepicker("setDate", real_date);
95
+ }
96
+ });
97
+ initDefaultDateTimepicker();
98
+ }
99
+
100
+ initDefaultDateTimepicker = function(){
101
+ $("input.<%= DEFAULT_DATETIMEPICKER_SELECTOR %>").each(function(){
102
+ $(this).datetimepicker({changeYear: true, yearRange: '1930:<%= Time.now.year+80 %>', hideIfNoPrevNextType: false, controlType: 'select', hourText: "Std.", minuteText: "Min.", closeText: 'OK', stepMinute: 10})
103
+ cur_date = $(this).attr("<%= HTML_DATA_CURRENT_DATE %>") || ""
104
+ if(cur_date != ""){
105
+ var regex = /(\d{2})\.(\d{2})\.(\d{4}) - (\d{2}):(\d{2})/;
106
+ var dateArray = regex.exec(cur_date);
107
+ var real_date = new Date(
108
+ (+dateArray[3]),
109
+ (+dateArray[2])-1, // Careful, month starts at 0!
110
+ (+dateArray[1]),
111
+ (+dateArray[4]),
112
+ (+dateArray[5]),
113
+ 0
114
+ );
115
+
116
+ $(this).datetimepicker("setDate", real_date);
117
+ }
118
+ });
119
+ }
120
+
121
+ initDefaultMonthpicker = function(){
122
+ $("input.<%= DEFAULT_MONTHPICKER_SELECTOR %>").each(function(){
123
+ $(this).monthpicker(
124
+ { startYear: 1930,
125
+ finalYear: <%= Time.now.year+80 %>,
126
+ monthNames: MONTHPICKER_MONTH_NAMES
127
+ }
128
+ )
129
+ $(this).bind('monthpicker-click-month', function(){
130
+ if($(this).val().match("/") != null){
131
+ old_val = ($(this).val().split("/"));
132
+ $(this).val("01."+old_val[0]+"."+old_val[1]);
133
+ return true
134
+ }
135
+ });
136
+ });
137
+ }
138
+
139
+
140
+ initDatePickers = function(){
141
+ initDefaultDatepicker();
142
+ initDefaultMonthpicker();
143
+ }
144
+
@@ -0,0 +1,23 @@
1
+ equalHeight = function(selector){
2
+ cols = $(selector);
3
+ cols_h = [];
4
+ cols.each(function(){
5
+ $(this).css("height", "auto");
6
+ });
7
+ cols.each(function(i){ cols_h.push($(cols[i]).height()); });
8
+
9
+ max_h = Math.max.apply( Math, cols_h );
10
+ cols.css("min-height", max_h+"px");
11
+ }
12
+
13
+
14
+ randomString = function (){
15
+ var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
16
+ var string_length = 8;
17
+ var randomstring = '';
18
+ for (var i=0; i<string_length; i++) {
19
+ var rnum = Math.floor(Math.random() * chars.length);
20
+ randomstring += chars.substring(rnum,rnum+1);
21
+ }
22
+ return randomstring;
23
+ }
@@ -0,0 +1,85 @@
1
+ //= Javascript für Overlays, Loader etc.
2
+
3
+ //== Loading Overlay
4
+ showLoading = function(show_text){
5
+ ol = $("#loadingOverlay");
6
+ ol.height($("#maklertools").height());
7
+ ol.width($("#maklertools").width());
8
+ ol.fadeIn(200);
9
+ }
10
+
11
+ hideLoading = function(){
12
+ $("#loadingOverlay").fadeOut(200);
13
+ }
14
+
15
+ hideSmarty = function(){
16
+ $('#smarty_area').fadeOut(400);
17
+ }
18
+
19
+
20
+ //== Ajax Overlay
21
+
22
+
23
+ //== Info-Overlay
24
+ initInfoOverlay = function(id){
25
+ overlay = $("#"+id)
26
+ overlay.hide()
27
+
28
+ dwidth = window.innerWidth
29
+ dheight = window.innerHeight
30
+
31
+ overlay.css({'max-width': (dwidth*0.9)+'px', 'max-height': (dheight*0.75)+'px'});
32
+
33
+ owidth = overlay.width();
34
+ oheight = overlay.height();
35
+
36
+ overlay.css({left: ((dwidth/2)-(owidth/2))+'px', top: ((dheight/2)-(oheight/2))+'px', width: owidth+'px', height: (oheight+25)+'px', position: "fixed"});
37
+ overlay.fadeIn(500);
38
+ }
39
+
40
+
41
+
42
+ //== Helper-Funktionen
43
+
44
+ // Ausblenden
45
+ hideAjaxOverlay = function(id_tmp){
46
+ $("#"+id_tmp).slideUp();
47
+ }
48
+
49
+
50
+ // Ajax Fullscreen Overlay
51
+ setAjaxFullscreen = function(id){
52
+
53
+ overlay = $("#"+id);
54
+
55
+ dwidth = window.innerWidth
56
+ dheight = window.innerHeight
57
+
58
+ overlay.css({'width': (dwidth*0.9)+'px', 'height': (dheight*0.8)+'px'});
59
+
60
+ //
61
+ // overlay.animate({left: "0px", top: "49px", width: ($(document).width())+"px", height: (window.outerHeight-154)+"px"}, 200);
62
+ // overlay.css("max-width", "100%");
63
+
64
+ }
65
+
66
+ // Z-Index setzen
67
+ // Overlay Z-Index Setter
68
+ initOverlayZindexSetter = function(over){
69
+ var zindexes = new Array
70
+ $("div.<%= AJAX_OVERLAY_CLASS %>, div.<%= INFO_OVERLAY_CLASS %>").each(function(){
71
+ zindexes.push(parseInt($(this).css('z-index')));
72
+ });
73
+ zindex_max = parseInt(zindexes.sort().reverse()[0]);
74
+
75
+ // neues Overlay z-index setzen
76
+ over.css('z-index', zindex_max+1);
77
+ zindex_max = parseInt(over.css('z-index'));
78
+
79
+ $('#'+over.attr('id')).click(function(){
80
+ $(this).css('z-index', zindex_max+1);
81
+ zindex_max = parseInt($(this).css('z-index'));
82
+ });
83
+ }
84
+
85
+
@@ -0,0 +1,163 @@
1
+ init_todo_slidedown = function(){
2
+ todo_buttons = $("#smart-toolbox .js-slidedown-button");
3
+ todo_content = $("#smart-toolbox .js-slidedown-content");
4
+
5
+ todo_content.each(function(){
6
+ $(this).hide();
7
+ });
8
+
9
+ todo_buttons.each(function(id){
10
+ $(this).click(function(){
11
+ $(todo_content[id]).slideToggle(200);
12
+ });
13
+ });
14
+ }
15
+
16
+ init_slidedown = function(){
17
+ boxes = $(".js-slide-down-box.plain");
18
+
19
+ boxes.each(function(id){
20
+ ident = randomString();
21
+
22
+ $(this).removeClass("plain");
23
+ $(this).addClass(ident);
24
+ btn = $($(this).children(".js-slidedown-button")[0]);
25
+ cont = $($(this).children(".js-slidedown-content")[0]);
26
+
27
+ btn.addClass(ident);
28
+ cont.addClass(ident);
29
+
30
+ btn = $(".js-slidedown-button."+ident);
31
+
32
+ btn.click(function(){
33
+ x = $(this).attr('class').split(' ');
34
+ ident = x[x.length-1];
35
+ cont = $(".js-slidedown-content."+ident);
36
+
37
+ box = $(".js-slide-down-box."+ident)
38
+
39
+ session_id = box.attr("data-session-id")
40
+ //cont.slideToggle(200);
41
+ $(box).toggleClass("open");
42
+
43
+ //$.ajax({url: "/ajax/save_slidedown_box/"+session_id, data:'authenticity_token=' + AUTH_TOKEN, type:'get'});
44
+ });
45
+ });
46
+
47
+ }
48
+
49
+ init_tab_slidedown = function(){
50
+ tab_boxes = $(".tabbed-box");
51
+ tab_buttons = $(".tabbed-box .tab-header");
52
+ tab_slidedown_content = $(".tabbed-box .tab-content");
53
+
54
+ tab_buttons.each(function(id){
55
+ // if(getCookieValue($(tab_boxes[id]).attr("id")) == "0"){
56
+ // $(tab_slidedown_content[id]).hide();
57
+ // }
58
+ $(this).click(function(){
59
+ if($(tab_slidedown_content[id]).attr("style") == "display: none;"){
60
+ setCookieValue($(tab_boxes[id]).attr("id"), 1);
61
+ }
62
+ else{
63
+ setCookieValue($(tab_boxes[id]).attr("id"), 0);
64
+ }
65
+ $(tab_slidedown_content[id]).slideToggle(200);
66
+ });
67
+ });
68
+ }
69
+
70
+ init_hide_rows = function(){
71
+ hide_rows = $("tr.hiding-row");
72
+
73
+ hide_rows.each(function(id){
74
+ $(this).click(function(){
75
+ $(this).children(".hide-me").slideDown(200);
76
+ });
77
+ $(this).mouseout(function(){
78
+ $(this).children(".hide-me").slideUp(200);
79
+ });
80
+ });
81
+ }
82
+
83
+ init_slide_table = function(){
84
+ tables = $(".js-slide-down-table")
85
+ tables.each(function(i){
86
+ $(tables[i]).children("thead").click(function(){
87
+ $(tables[i]).children("tbody").slideToggle(200);
88
+ });
89
+ })
90
+ }
91
+
92
+
93
+ initPopOutBox = function(){
94
+ PopOutClassName = "popped-out"
95
+
96
+ $(".js-pop-out-box.pop-disabled").each(function(){
97
+
98
+
99
+ $(this).mouseenter(function(){
100
+ original_width = $(this).width()
101
+
102
+ if($(this).hasClass(PopOutClassName)){
103
+ button = $(this)
104
+ button.children(".js-pop-out-content").fadeOut(0,function(){
105
+ button.removeClass(PopOutClassName)
106
+ });
107
+
108
+
109
+ }else{
110
+ // Alles Zu!
111
+ $(".js-pop-out-content:visible").hide();
112
+ $(".js-pop-out-box").removeAttr("style");
113
+ $(".js-pop-out-box").removeClass(PopOutClassName);
114
+
115
+
116
+ // Checken ob Box nach Links aufgehen muss
117
+ window_width = $(document).width()
118
+ if($(this).offset()['left'] > (window_width/2)){
119
+ lefty = true
120
+ }else{
121
+ lefty = false
122
+ }
123
+
124
+ if(lefty == true){
125
+ $(this).addClass("pop-out-left")
126
+ }else{
127
+ $(this).addClass("pop-out-right")
128
+ }
129
+ $(this).children(".js-pop-out-content").fadeIn(0)
130
+ $(this).addClass(PopOutClassName)
131
+
132
+ }
133
+
134
+ });
135
+
136
+ $(this).mouseleave(function(){
137
+ button = $(this)
138
+ button.children(".js-pop-out-content").fadeOut(0,function(){
139
+ button.removeClass(PopOutClassName)
140
+ });
141
+
142
+
143
+ });
144
+
145
+ $(this).removeClass("pop-disabled");
146
+ });
147
+ }
148
+
149
+ $(document).ready(function(){
150
+ init_slidedown();
151
+ init_tab_slidedown();
152
+ init_hide_rows();
153
+ init_slide_table();
154
+ initPopOutBox();
155
+ // Pop-Out Box
156
+
157
+
158
+ });
159
+
160
+
161
+
162
+
163
+