jyr (owner)

Revisions

gist: 187143 Download_button fork
public
Public Clone URL: git://gist.github.com/187143.git
Embed All Files: show embed
base.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
$(document).ready(function(){
$().ajaxSuccess(function(evt, request, settings){
        //TABS
        $('.detail').live('click',function() {
            $().gui({method: 'add', module: $(this).attr('rel'), action: 'detail', id: $(this).attr('id'), title: 'Details'});
            return false;
});
 
        $('.add-tab').live('click',function() {
            $().gui({method: 'add', module: $(this).attr('rel'), action: 'add', id: $(this).attr('id'), title: 'Add'});
            return false;
});
 
$('.edit-tab').live('click',function() {
            $().gui({method: 'add', module: $(this).attr('rel'), action: 'edit', id: $(this).attr('id'), title: 'Add'});
            return false;
});
 
$('.exit').live('click', function(){
$().gui({method: 'close', module: $(this).attr('rel')});
            return false;
});
 
//Paginacion
$('.page').live('click',function(){
$().gui({method:'pagination', url: $(this).attr('rel')});
return false;
});
 
//Seleciona todos los checkbox
$('#check-all').live('click',function(){
            $().gui({method: 'checkall', status: this.checked});
            //return false;
});
 
//Aplicar accion seleccionada
$('.apply').live('click', function(){
module = $(this).attr('rel');
 
$("input[name='check[]']").each(function(){
if (this.checked){
                    status = this.checked;
}
  });
 
            if (!status){
                $().gui({method:'growl', title: 'Success: Atention', text: 'Check a option', image: '/media/img/backend/Symbol-Exclamation.png', sticky:false});
            }
        
            status = true;
//$("input[name=check[]]:checked").each(function(i){
action= $('select.dropdown option:selected').val();
            
if (action == 'remove')
{
                    $().gui({method: 'block'});
                    $('#yes').one('click',function(){
                        $("input[name=check[]]:checked").each(function(i){
                            id = this.value;
$().gui({method: 'remove', id: id, module: module, action: action});
                        });
                        $.unblockUI();
                    });
                
                    $('#no').one('click', function(){
                        $.unblockUI();
                        return false;
                    });
status = true;
}
else
{
if(status)
{
     $().gui({method:'growl', title: 'Success: Atention', text: 'Select a action', image: '/media/img/backend/Symbol-Exclamation.png', sticky:false});
     status = false;
}
}
            return false;
// });
});
 
//Borrar registro
$('.delete').live('click',function(){
module = $(this).attr('rel');
id = $(this).attr('id');
action = $(this).attr('class');
 
            $().gui({method: 'block'});
            $('#yes').bind('click',function(){
$().gui({method: 'remove', id: id, module: module, action: action});
                $.unblockUI();
            });
        
            $('#no').live('click', function(){
                $.unblockUI();
                return false;
            });
});
 
$('#search').live('submit',function(){
title = $(this).attr('title');
            $(this).ajaxSubmit({
                target: '.tab-content',
                url: $(this).attr('action'),
                type: 'POST',
                success: $().gui({method:'growl', title: 'Success: '+title, text: 'Wait...', image: '/media/img/backend/Symbol-Refresh.png', sticky:false})
            });
            return false;
});
 
$('#submit').live('submit', function(){
title = $(this).attr('title');
$(this).ajaxSubmit({
                type: 'POST',
                success: $().gui({method:'growl', title: 'Success: '+title, text: 'Money updated', image: '/media/img/backend/Symbol-Refresh.png', sticky:false})
});
 
$(document).trigger('close.facebox');
 
if($('.current-tab').attr('href') != $(this).attr('action')){
if($('.current-tab').attr('href')){
                    $('.content-box-content').load($('.current-tab').attr('href'));
                }else{
                    $('.content-box-content').load($('.default-tab').attr('href'));
                }
}else{
                $().gui({method: 'close', module: $(this).attr('rel')});
                $('.content-box-content').load($('.default-tab').attr('href'));
            }
 
return false;
});
 
$('.add').one('click',function(){
module = $(this).attr('rel');
action = $(this).attr('title');
$('.facebox').one(jQuery.facebox({'ajax':'/backend/'+module+'/add/'}));
            return false;
});
    });
});