Revision 42f67a2a ui/templates/home.html

b/ui/templates/home.html
7 7
    <script src="static/jquery.cookie.js"></script>
8 8
    <script src="static/jQueryRotate.js"></script>
9 9
    <script src="static/jquery.dataTables.min.js"></script>
10
    <script>
11
        /* These have to be here for the translations to work */
12
        // ajax error checking  
13
        function ajax_error(jqXHR) {
14
            // prepare the error message
15
            $("#error-success h3").text('{% trans "Error!" %}');
16
            // check the error code
17
            switch (jqXHR.status) {
18
                case 400: // YY error/message
19
                    $("#error-success p").text('{% trans "A Bad Request has been made." %}');
20
                    break;
21
                case 404: // YY error/message
22
                    $("#error-success p").text('{% trans "Your request has failed." %}');
23
                    break;
24
                case 501: // XX error/message
25
                    $("#error-success p").text('{% trans "There has been an Internal Error. Our administrators have been notified." %}');
26
                    break;
27
                case 503: // XX error/message
28
                    $("#error-success p").text('{% trans "This service is unavailable right now, please try again later." %}');
29
                    break;
30
                default: // XXYY error/message
31
                    $("#error-success p").text('{% trans "An error has happened. Our administrators have been notified." %}');
32
            }         
33
            // bring up error notification
34
            var triggers = $("a#notification").overlay({
35
                // some mask tweaks suitable for modal dialogs
36
                mask: {
37
                    color: '#ebecff',
38
                    opacity: '0.9'
39
                },
40
                top: 'center',
41
                closeOnClick: false,
42
                oneInstance: false,
43
                load: false,
44
                onClose: function(){
45
                    choose_view();
46
                }
47
            });
48
            $("a#notification").data('overlay').load();
49
            return false;
50
        }
51
        
52
        // ajax success checking
53
        function ajax_success() {          
54
            // prepare the error message
55
            $("#error-success h3").text('{% trans "Success!" %}');
56
            $("#error-success p").text('{% trans "Your request has been succefully executed." %}');             
57
            // bring up success notification
58
            var triggers = $("a#notification").overlay({
59
                // some mask tweaks suitable for modal dialogs
60
                mask: {
61
                    color: '#ebecff',
62
                    opacity: '0.9'
63
                },
64
                top: 'center',
65
                closeOnClick: false,
66
                oneInstance: false,
67
                load: false,
68
                onClose: function(){
69
                    choose_view();
70
                }
71
            });
72
            $("a#notification").data('overlay').load();
73
            return false;
74
        }
75
    
76
    </script>
77
    <script src="static/synnefo.js"></script>
10 78

  
11 79
	<link rel="stylesheet" type="text/css" href="static/main.css"/>	
12 80

  
......
73 141
			        var pane = this.getPanes().eq(i);
74 142
                    pane.text('');
75 143
			        // load it with a page specified in the tab's href attribute
76
			        pane.load(this.getTabs().eq(i).attr("href"));
77

  
144
			        pane.load(this.getTabs().eq(i).attr("href"),function(){if (!i) {choose_view()}});
78 145
		        }
79 146
	        });
80 147
        });
......
82 149
        // toggle main menu
83 150
        $("#arrow").click(function(event){
84 151
        	toggleMenu();
85
        }); 
86
                
87
		function toggleMenu() {
88
        	var primary = $("ul.css-tabs li a.primary");
89
            var secondary = $("ul.css-tabs li a.secondary");
90
            var all = $("ul.css-tabs li a");			
91
			var toggled = $('ul.css-tabs li a.current').hasClass('secondary');
92
			
93
			// if anything is still moving, do nothing
94
        	if ($(":animated").length) {
95
        		return;
96
        	} 
97
        	
98
        	// nothing is current to begin with
99
            $('ul.css-tabs li a.current').removeClass('current');
100
			
101
			// move stuff around
102
            all.animate({top:'30px'}, {complete: function() { 
103
                $(this).hide();
104
                if (toggled) {
105
	                primary.show();
106
	                primary.animate({top:'9px'}, {complete: function() {
107
	                	$('ul.css-tabs li a.primary#machines').addClass('current');
108
	                	$('a#machines').click();                           	
109
	                }});
110
                } else {
111
                	secondary.show();
112
                	secondary.animate({top:'9px'}, {complete: function() {
113
	                	$('ul.css-tabs li a.secondary#files').addClass('current');
114
	                	$('a#files').click();                           			                	
115
                	}});
116
                }            	                          
117
            }});
118
            
119
            // rotate arrow icon
120
            if (toggled) {
121
            	$("#arrow").rotate({animateAngle: (0), bind:[{"click":function(){toggleMenu()}}]});
122
            	$("#arrow").rotateAnimation(0);            	
123
            } else {
124
            	$("#arrow").rotate({animateAngle: (-180), bind:[{"click":function(){toggleMenu()}}]});
125
            	$("#arrow").rotateAnimation(-180);
126
            }            
127
		}  
152
        });    
153
        
128 154
    </script>
155
    
129 156
</body>
130 157
</html>
131 158

  

Also available in: Unified diff