rich_table_component 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +156 -139
- data/app/helpers/component_helper.rb +176 -0
- data/app/helpers/documents_helper.rb +22 -0
- data/app/helpers/menus_helper.rb +182 -0
- data/app/helpers/paragraph_helper.rb +57 -0
- data/app/helpers/translations_helper.rb +9 -0
- data/app/views/application/_document_fields.html.haml +20 -0
- data/app/views/application/_edit.html.haml +11 -0
- data/app/views/application/_new.html.haml +11 -0
- data/app/views/application/access_denied.js.erb +5 -0
- data/app/views/application/create.js.erb +19 -0
- data/app/views/application/destroy.js.erb +9 -0
- data/app/views/application/destroy_fail.js.erb +2 -0
- data/app/views/application/edit.html.haml +8 -0
- data/app/views/application/edit.js.erb +28 -0
- data/app/views/application/index.js.erb +7 -0
- data/app/views/application/index.pdf.haml +87 -0
- data/app/views/application/index.xls.haml +64 -0
- data/app/views/application/new.html.haml +7 -0
- data/app/views/application/new.js.erb +23 -0
- data/app/views/application/recapitulation.js.erb +12 -0
- data/app/views/application/recapitulation.pdf.haml +68 -0
- data/app/views/application/recapitulation.xls.haml +41 -0
- data/app/views/application/session_expired.js.erb +5 -0
- data/app/views/application/show.js.erb +29 -0
- data/app/views/application/update.js.erb +15 -0
- data/app/views/layouts/print/pdf.html.haml +8 -0
- data/app/views/layouts/print/recapitulation.html.haml +8 -0
- data/app/views/rich_table_component/_notification.html.haml +9 -0
- data/app/views/rich_table_component/_pagination.html.haml +11 -0
- data/app/views/rich_table_component/_recapitulation_matrix_groups.html.haml +42 -0
- data/app/views/rich_table_component/component/_ajax_upload.html.haml +6 -0
- data/app/views/rich_table_component/component/_ajax_upload_result.html.haml +2 -0
- data/app/views/rich_table_component/component/_breadcrumbs.html.haml +25 -0
- data/app/views/rich_table_component/component/_breadcrumbs_dropdown.html.haml +18 -0
- data/app/views/rich_table_component/component/_tabbed.html.haml +5 -0
- data/app/views/rich_table_component/rtc/_advanced_search.html.haml +95 -0
- data/app/views/rich_table_component/rtc/_advanced_search_recapitulation.html.haml +90 -0
- data/app/views/rich_table_component/rtc/_component.html.haml +62 -0
- data/app/views/rich_table_component/rtc/_component_actions.html.haml +69 -0
- data/app/views/rich_table_component/rtc/_component_content.html.haml +37 -0
- data/app/views/rich_table_component/rtc/_component_title.html.haml +37 -0
- data/app/views/rich_table_component/rtc/_content.html.haml +22 -0
- data/app/views/rich_table_component/rtc/_footer.html.haml +4 -0
- data/app/views/rich_table_component/rtc/_header.html.haml +56 -0
- data/app/views/rich_table_component/rtc/_recapitulation_matrix.html.haml +25 -0
- data/app/views/rich_table_component/rtc/_recapitulation_matrix_form.html.haml +47 -0
- data/app/views/rich_table_component/rtc/_table.html.haml +22 -0
- data/lib/pagination_list_link_renderer.rb +51 -0
- data/lib/rich_table_component/version.rb +1 -1
- data/lib/rich_table_component.rb +0 -8
- data/rich_table_component.gemspec +0 -1
- data/vendor/assets/images/icons/file_extension/file_extension_.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_3gp.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_7z.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ace.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ai.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_aif.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_aiff.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_amr.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_asf.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_asx.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_bat.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_bin.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_bmp.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_bup.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_cab.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_cbr.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_cda.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_cdl.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_cdr.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_chm.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_dat.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_divx.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_dll.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_dmg.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_doc.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_dss.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_dvf.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_dwg.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_eml.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_eps.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_exe.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_fla.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_flv.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_gif.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_gz.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_hqx.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_htm.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_html.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ifo.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_indd.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_iso.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_jar.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_jpeg.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_jpg.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_lnk.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_log.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_m4a.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_m4b.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_m4p.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_m4v.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mcd.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mdb.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mid.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mov.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mp2.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mp4.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mpeg.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mpg.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_msi.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_mswmm.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ogg.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_pdf.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_png.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_pps.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ppt.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ps.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_psd.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_pst.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ptb.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_pub.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_qbb.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_qbw.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_qxd.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ram.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_rar.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_rm.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_rmvb.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_rtf.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_sea.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ses.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_sit.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_sitx.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ss.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_swf.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_tgz.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_thm.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_tif.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_tmp.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_torrent.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_ttf.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_txt.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_vcd.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_vob.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_wav.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_wma.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_wmv.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_wps.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_xls.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_xpi.png +0 -0
- data/vendor/assets/images/icons/file_extension/file_extension_zip.png +0 -0
- data/vendor/assets/images/loading_image.gif +0 -0
- data/vendor/assets/images/pbar-ani.gif +0 -0
- data/vendor/assets/javascripts/admin/starqle.grid.js +708 -0
- data/vendor/assets/javascripts/admin/starqle.ui.jquery.js +927 -0
- data/vendor/assets/javascripts/ckeditor/config.js +112 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.13.custom.min.js +445 -0
- data/vendor/assets/javascripts/jquery.fileupload-ui.js +533 -0
- data/vendor/assets/javascripts/jquery.fileupload.js +975 -0
- data/vendor/assets/javascripts/jquery.tmpl.min.js +1 -0
- data/vendor/assets/javascripts/jquery.tokeninput.js +860 -0
- data/vendor/assets/javascripts/nested_attribute_action.js +19 -0
- data/vendor/assets/javascripts/rich_table_component.js +51 -0
- data/vendor/assets/stylesheets/fontfaces/england_hand_db/Freeware License.txt +5 -0
- data/vendor/assets/stylesheets/fontfaces/england_hand_db/england-webfont.eot +0 -0
- data/vendor/assets/stylesheets/fontfaces/england_hand_db/england-webfont.svg +146 -0
- data/vendor/assets/stylesheets/fontfaces/england_hand_db/england-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/fontfaces/england_hand_db/england-webfont.woff +0 -0
- data/vendor/assets/stylesheets/fontfaces/england_hand_db/stylesheet.css +16 -0
- data/vendor/assets/stylesheets/fontfaces/museo300-regular-webfont.eot +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo300-regular-webfont.svg +249 -0
- data/vendor/assets/stylesheets/fontfaces/museo300-regular-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo300-regular-webfont.woff +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo500-regular-webfont.eot +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo500-regular-webfont.svg +249 -0
- data/vendor/assets/stylesheets/fontfaces/museo500-regular-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo500-regular-webfont.woff +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo700-regular-webfont.eot +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo700-regular-webfont.svg +249 -0
- data/vendor/assets/stylesheets/fontfaces/museo700-regular-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/fontfaces/museo700-regular-webfont.woff +0 -0
- data/vendor/assets/stylesheets/partial/_base_functions.sass +101 -0
- data/vendor/assets/stylesheets/partial/_base_variables.sass +76 -0
- data/vendor/assets/stylesheets/partial/_form.sass +57 -0
- data/vendor/assets/stylesheets/partial/_grid.css +374 -0
- data/vendor/assets/stylesheets/partial/_notification.sass +33 -0
- data/vendor/assets/stylesheets/partial/_position.sass +122 -0
- data/vendor/assets/stylesheets/partial/_starqle.ui.grid.sass +495 -0
- data/vendor/assets/stylesheets/partial/_style.sass +674 -0
- data/vendor/assets/stylesheets/partial/_tabbed.sass +33 -0
- data/vendor/assets/stylesheets/partial/_user_component.sass +2 -0
- data/vendor/assets/stylesheets/rich_table_component/_custom.sass +0 -0
- data/vendor/assets/stylesheets/rich_table_component.css +18 -0
- data/vendor/assets/stylesheets/rtc_bootstrap_and_overrides.css.less +315 -0
- data/vendor/assets/stylesheets/rtc_config.sass +31 -0
- data/vendor/assets/stylesheets/rtc_jquery.fileupload-ui.css +155 -0
- data/vendor/assets/stylesheets/smoothness/images/Thumbs.db +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/jquery-ui-1.8.11.custom.css +573 -0
- metadata +209 -17
@@ -0,0 +1,708 @@
|
|
1
|
+
// -------------------------------------------------------------
|
2
|
+
// Define Constant
|
3
|
+
|
4
|
+
var NOTIFICATION = 0;
|
5
|
+
var SUCCESS = 1;
|
6
|
+
var WAITING = 2;
|
7
|
+
var WARNING = 3;
|
8
|
+
var ERROR = 4;
|
9
|
+
|
10
|
+
var DATE_FORMAT = 'dd-mm-yy';
|
11
|
+
|
12
|
+
var LOCALE = "id";
|
13
|
+
var translations = {
|
14
|
+
"id": {
|
15
|
+
"loading": "Memuat...",
|
16
|
+
"sorting": "Mengurutkan...",
|
17
|
+
"searching": "Mencari...",
|
18
|
+
"refreshing": "Mensegarkan...",
|
19
|
+
|
20
|
+
"loading_add_form": "Memuat form penambahan...",
|
21
|
+
"loading_edit_form": "Memuat form perubahan...",
|
22
|
+
"loading_form": "Memuat form...",
|
23
|
+
"click_to_hide": "Klik untuk menyembunyikan...",
|
24
|
+
|
25
|
+
"processing": "Memproses...",
|
26
|
+
"saving": "Menyimpan...",
|
27
|
+
"updating": "Memperbarui..." ,
|
28
|
+
"deleting": "Menghapus...",
|
29
|
+
"redirecting": "Memindahkan alamat...",
|
30
|
+
"update_successful": "Berhasil mengubah",
|
31
|
+
"update_failure": "Gagal mengubah",
|
32
|
+
|
33
|
+
"loading_form_failed": "Gagal memuat form",
|
34
|
+
|
35
|
+
"sent": "Terkirim",
|
36
|
+
"sending": "Mengirim...",
|
37
|
+
|
38
|
+
"are_you_sure": "Apakah anda yakin?",
|
39
|
+
"delete": "Hapus",
|
40
|
+
},
|
41
|
+
};
|
42
|
+
var LOADING_IMAGE = '<img class="loading_image" src="/assets/loading_image.gif" />';
|
43
|
+
|
44
|
+
|
45
|
+
var ajaxifyTableGrid = function(){
|
46
|
+
|
47
|
+
$('.rtc_header .btn-group-view-toggle .btn').live('ajax:beforeSend', function(event, xhr, settings){
|
48
|
+
var $ths = $(this);
|
49
|
+
var $elmt = $(this).parents('.rich_table_component');
|
50
|
+
var $pagination = $elmt.find('.pagination');
|
51
|
+
|
52
|
+
$('.rich_table_component.updating').removeClass('updating');
|
53
|
+
$elmt.addClass('updating');
|
54
|
+
$elmt.st_tableGrid_loading({
|
55
|
+
message: t("loading"),
|
56
|
+
image: LOADING_IMAGE
|
57
|
+
});
|
58
|
+
|
59
|
+
var params = {};
|
60
|
+
if($elmt.find('input#search').val() != ''){
|
61
|
+
params = getSerializeArray($elmt.find('input#search').serializeArray());
|
62
|
+
}
|
63
|
+
|
64
|
+
$.extend(params, getSerializeArray($elmt.find('form#filter_form').serializeArray()));
|
65
|
+
params.list_view = $(this).data("list-view");
|
66
|
+
|
67
|
+
settings.url += (settings.url.indexOf('?') >= 0 ? '&' : '?') + $.param(params);
|
68
|
+
});
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
// PAGINATING
|
73
|
+
$('.pagination a').live('ajax:beforeSend', function(event, xhr, settings){
|
74
|
+
|
75
|
+
var $ths = $(this);
|
76
|
+
var $elmt = $(this).parents('.rich_table_component');
|
77
|
+
$('.rich_table_component.updating').removeClass('updating');
|
78
|
+
$elmt.addClass('updating');
|
79
|
+
$elmt.st_tableGrid_loading({
|
80
|
+
message: t("loading"),
|
81
|
+
image: LOADING_IMAGE
|
82
|
+
});
|
83
|
+
var $pagination = $elmt.find('.pagination');
|
84
|
+
var params = {};//$('#advance_search form').serializeArray();
|
85
|
+
var $href = this.href
|
86
|
+
|
87
|
+
// check if this is a "Go" button
|
88
|
+
if($(this).is('.gotopage')){
|
89
|
+
params.page = $pagination.find('input').val();
|
90
|
+
$href = $(this).parents('.pagination').find('a').eq(0).get(0).href;
|
91
|
+
}
|
92
|
+
//params.per_page = $pagination.find('select').val();
|
93
|
+
if($elmt.find('input#search').val() != '') {
|
94
|
+
params.search = $elmt.find('input#search').val();
|
95
|
+
}
|
96
|
+
else{
|
97
|
+
params = $.extend(params, getSerializeArray($elmt.find('form.rtc_advanced_search input').serializeArray()));
|
98
|
+
}
|
99
|
+
params.pgos = true;
|
100
|
+
settings.url += (settings.url.indexOf('?') >= 0 ? '&' : '?') + $.param(params);
|
101
|
+
});
|
102
|
+
|
103
|
+
|
104
|
+
// SORTING
|
105
|
+
$('.rtc_gh_item a').live('ajax:beforeSend', function(event, xhr, settings){
|
106
|
+
var $ths = $(this);
|
107
|
+
var $elmt = $(this).parents('.rich_table_component');
|
108
|
+
var $pagination = $elmt.find('.pagination');
|
109
|
+
$('.rich_table_component.updating').removeClass('updating');
|
110
|
+
$elmt.addClass('updating');
|
111
|
+
$elmt.st_tableGrid_loading({
|
112
|
+
message: t("loading"),
|
113
|
+
image: LOADING_IMAGE
|
114
|
+
});
|
115
|
+
|
116
|
+
var params = {};
|
117
|
+
if($elmt.find('input#search').val() != ''){
|
118
|
+
params = getSerializeArray($elmt.find('input#search').serializeArray());
|
119
|
+
}
|
120
|
+
else{
|
121
|
+
params = $.extend(params, getSerializeArray($elmt.find('form.rtc_advanced_search input').serializeArray()));
|
122
|
+
}
|
123
|
+
|
124
|
+
$list_view = $elmt.find('.rtc_header .btn-group-view-toggle .btn.active').data('list-view');
|
125
|
+
if($list_view == 'th') params.list_view = 'th';
|
126
|
+
|
127
|
+
settings.url += (settings.url.indexOf('?') >= 0 ? '&' : '?') + $.param(params);
|
128
|
+
}).live('ajax:success', function(){
|
129
|
+
var $ths = $(this);
|
130
|
+
var $elmt = $(this).parents('.rich_table_component');
|
131
|
+
$select = $elmt.find('.pagination_area').find('select[name=per_page]');
|
132
|
+
$select.find('option').filter(function(index) { return $(this).text() === $select.attr('data_value'); }).attr('selected', true);
|
133
|
+
|
134
|
+
$elmt.find('.rtc_gh_item a').removeClass('asc').removeClass('desc');
|
135
|
+
if($ths.attr('href').indexOf("=asc") != -1){
|
136
|
+
$ths.attr('href', $ths.attr('href').replace('=asc', '=desc')).addClass('asc');
|
137
|
+
}
|
138
|
+
else if($ths.attr('href').indexOf("=desc") != -1){
|
139
|
+
$ths.attr('href', $ths.attr('href').replace('=desc', '=asc')).addClass('desc');
|
140
|
+
}
|
141
|
+
});
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
// SEARCHING (single term)
|
148
|
+
$('.rtc_search #search').focus(function(event){
|
149
|
+
$(this).select();
|
150
|
+
});
|
151
|
+
|
152
|
+
$('.rtc_search').live('ajax:beforeSend', function(event, xhr, settings){
|
153
|
+
clearAdvanceSearch();
|
154
|
+
|
155
|
+
var $ths = $(this);
|
156
|
+
var $elmt = $(this).parents('.rich_table_component');
|
157
|
+
var $pagination = $elmt.find('.pagination');
|
158
|
+
|
159
|
+
$('.rich_table_component.updating').removeClass('updating');
|
160
|
+
$elmt.addClass('updating');
|
161
|
+
$elmt.st_tableGrid_loading({
|
162
|
+
message: t("loading"),
|
163
|
+
image: LOADING_IMAGE
|
164
|
+
});
|
165
|
+
|
166
|
+
var params = getSerializeArray($elmt.find('form#filter_form').serializeArray());
|
167
|
+
$.extend(params, getSerializeArray($(this).serializeArray()));
|
168
|
+
params['page'] = 1;
|
169
|
+
|
170
|
+
var $this_button = $ths.find('input[type=submit]');
|
171
|
+
if($this_button.is('.disabled, .pressed')){return false;}
|
172
|
+
$this_button.addClass('pressed');
|
173
|
+
|
174
|
+
}).live('ajax:success', function(){
|
175
|
+
var $this_button = $(this).find('input[type=submit]');
|
176
|
+
$this_button.removeClass('pressed');
|
177
|
+
});
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
$(
|
183
|
+
'.btn.btn_new'
|
184
|
+
)
|
185
|
+
.live("ajax:before", function(){
|
186
|
+
showGlobalNotification('Memuat...', {show_loading: true});
|
187
|
+
$(this).parents('.rich_table_component').addClass('showing_new_form');
|
188
|
+
}).live("ajax:success", function(){
|
189
|
+
removeGlobalNotification();
|
190
|
+
});
|
191
|
+
|
192
|
+
|
193
|
+
$(
|
194
|
+
'.button_create_presentation, ' +
|
195
|
+
'.edit'
|
196
|
+
)
|
197
|
+
.live("ajax:before", function(){
|
198
|
+
showGlobalNotification(translate('loading_form'), {show_loading: true});
|
199
|
+
$(this).parents('tr').addClass('lvr_entry_edited');
|
200
|
+
}).live("ajax:success", function(){
|
201
|
+
removeGlobalNotification();
|
202
|
+
}).live("ajax:error", function(xhr, status, error){
|
203
|
+
showGlobalNotification(translate(status.responseText), {type: ERROR});
|
204
|
+
});
|
205
|
+
|
206
|
+
|
207
|
+
$(
|
208
|
+
'.btn_approve, ' +
|
209
|
+
'.btn_reject'
|
210
|
+
).live("ajax:before", function(){
|
211
|
+
$(this).parents('tr').addClass('lvr_entry_edited');
|
212
|
+
});
|
213
|
+
|
214
|
+
$(
|
215
|
+
'.rich_table_component .rtc_grid .btn.delete'
|
216
|
+
)
|
217
|
+
.live("ajax:before", function(evt, data, status, xhr){
|
218
|
+
$(this).parents('tr').addClass('lvr_entry_deleted');
|
219
|
+
});
|
220
|
+
|
221
|
+
$(
|
222
|
+
'form.simple_form'
|
223
|
+
).live('ajax:before', function(){
|
224
|
+
$(this).find('.form-actions .btn_submit').button('loading');
|
225
|
+
});
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
// SEARCHING (advanced)
|
231
|
+
$(
|
232
|
+
'form.rtc_advanced_search'
|
233
|
+
).live('ajax:before', function(){
|
234
|
+
var $el = $(this);
|
235
|
+
var $elmt = $(this).parents('.rich_table_component');
|
236
|
+
$('.rich_table_component.updating').removeClass('updating');
|
237
|
+
$elmt.addClass('updating')
|
238
|
+
//
|
239
|
+
clearNormalSearch();
|
240
|
+
|
241
|
+
// append filter form
|
242
|
+
$el.find('.advanced_filter_form').remove();
|
243
|
+
$adv_ff = $('<div class="advanced_filter_form"></div>');
|
244
|
+
$adv_ff.appendTo($el);
|
245
|
+
$elmt.find('form#filter_form input').each(function(){
|
246
|
+
$(this).clone().appendTo($adv_ff);
|
247
|
+
});
|
248
|
+
$adv_ff.find('input[name=page]').val('1');
|
249
|
+
|
250
|
+
$elmt.st_tableGrid_loading({
|
251
|
+
message: t("searching"),
|
252
|
+
image: LOADING_IMAGE
|
253
|
+
});
|
254
|
+
}).live('ajax:complete', function(event, xhr, status){
|
255
|
+
var $el = $(this);
|
256
|
+
$el.find('.advanced_filter_form').remove();
|
257
|
+
}).live("ajax:error", function(xhr, status, error){
|
258
|
+
showGlobalNotification(translate(status.responseText), {type: ERROR});
|
259
|
+
});
|
260
|
+
|
261
|
+
// RESETING ADVANCED SEARCH
|
262
|
+
$('form.rtc_advanced_search .clear_advanced_search').live('click', function(){
|
263
|
+
var $form = $(this).parents('form');
|
264
|
+
$form.find('input').val('');
|
265
|
+
$form.submit();
|
266
|
+
});
|
267
|
+
|
268
|
+
// HIDING ADVANCED SEARCH
|
269
|
+
$('form.rtc_advanced_search .hide_advanced_search').live('click', function(){
|
270
|
+
var $elmt = $(this).parents('.rich_table_component');
|
271
|
+
$elmt.find('.advanced_search_toggle_button').trigger('click');
|
272
|
+
});
|
273
|
+
|
274
|
+
// TOGGLING ADVANCED SEARCH
|
275
|
+
$('.advanced_search_toggle_button').live('click', function(){
|
276
|
+
var $elmt = $(this).parents('.rich_table_component');
|
277
|
+
if($(this).hasClass('active')){
|
278
|
+
$elmt.find('.rtc_header_expanded').slideDown('fast');
|
279
|
+
}
|
280
|
+
else{
|
281
|
+
$elmt.find('.rtc_header_expanded').slideUp('fast');
|
282
|
+
}
|
283
|
+
});
|
284
|
+
|
285
|
+
|
286
|
+
clearNormalSearch();
|
287
|
+
clearAdvanceSearch();
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
initExportButton();
|
293
|
+
initManualPopover();
|
294
|
+
|
295
|
+
initActiveTab();
|
296
|
+
initRecapitulation();
|
297
|
+
};
|
298
|
+
|
299
|
+
|
300
|
+
var clearAdvanceSearch = function(){
|
301
|
+
$('form.rtc_advanced_search').find('input[type=text]').val('');
|
302
|
+
|
303
|
+
$(':input', $('#advance_search form'))
|
304
|
+
.not(':button, :submit, :reset, :hidden')
|
305
|
+
.val('')
|
306
|
+
.removeAttr('checked')
|
307
|
+
.removeAttr('selected');
|
308
|
+
};
|
309
|
+
|
310
|
+
|
311
|
+
// Enabling file upload using jquery-file-upload
|
312
|
+
var renderJqueryFileUpload = function(){
|
313
|
+
|
314
|
+
$('.document').fileUploadUI({
|
315
|
+
uploadTable: $('.upload_files'),
|
316
|
+
downloadTable: $('.download_files'),
|
317
|
+
buildUploadRow: function (files, index) {
|
318
|
+
var file = files[index];
|
319
|
+
return $('<tr><td>' + file.name + '<\/td>' +
|
320
|
+
'<td class="file_upload_progress"><div><\/div><\/td>' +
|
321
|
+
'<td class="file_upload_cancel">' +
|
322
|
+
'<button class="ui-state-default ui-corner-all" title="Cancel">' +
|
323
|
+
'<span class="ui-icon ui-icon-cancel">Cancel<\/span>' +
|
324
|
+
'<\/button><\/td><\/tr>');
|
325
|
+
},
|
326
|
+
buildDownloadRow: function (file) {
|
327
|
+
var fresh_uploaded = $('<div class="attachment_part">' +
|
328
|
+
' <div class="attachment_entry">' +
|
329
|
+
' <input type="hidden" name="document_ids[]" value="' + file.id + '" />' +
|
330
|
+
' <div class="attachment_entry_content">' +
|
331
|
+
' <div class="attachment_entry_image">' +
|
332
|
+
' <a href="/documents/' + file.id + '/download">' +
|
333
|
+
' <img src="' + file.pic_path + '" alt="' + file.name + '">' +
|
334
|
+
' </a>' +
|
335
|
+
' </div>' +
|
336
|
+
' <div class="attachment_entry_description">' +
|
337
|
+
' <div class="file_name_part">' +
|
338
|
+
' <a href="/documents/' + file.id + '/download">' +
|
339
|
+
file.name +
|
340
|
+
' </a>' +
|
341
|
+
' </div>' +
|
342
|
+
' <div class="file_size_part">' +
|
343
|
+
file.size +
|
344
|
+
' </div>' +
|
345
|
+
' </div>' +
|
346
|
+
' </div>' +
|
347
|
+
' <a class="btn btn-danger remove_fresh_uploaded"><i class="icon-remove"></i> Hapus</a>' +
|
348
|
+
' </div>' +
|
349
|
+
'</div>');
|
350
|
+
fresh_uploaded.find('.remove_fresh_uploaded').click(function(){ $(this).parent().remove(); });
|
351
|
+
$('.controls.document_upload_result .upload_files').before(fresh_uploaded);
|
352
|
+
|
353
|
+
}
|
354
|
+
});
|
355
|
+
};
|
356
|
+
|
357
|
+
var clearNormalSearch = function(){
|
358
|
+
$('.rtc_search #search').val('');
|
359
|
+
};
|
360
|
+
|
361
|
+
var resetAllForm = function(){
|
362
|
+
$('form').each(function(index){
|
363
|
+
this.reset();
|
364
|
+
});
|
365
|
+
};
|
366
|
+
|
367
|
+
var increasePagination = function($elmt){
|
368
|
+
$item_from = $elmt.find('.item_from');
|
369
|
+
$item_to = $elmt.find('.item_to');
|
370
|
+
$item_total = $elmt.find('.item_total');
|
371
|
+
$item_to.text(parseInt($item_to.text()) + 1);
|
372
|
+
$item_total.text(parseInt($item_total.text()) + 1);
|
373
|
+
};
|
374
|
+
var decreasePagination = function($elmt){
|
375
|
+
$item_from = $elmt.find('.item_from');
|
376
|
+
$item_to = $elmt.find('.item_to');
|
377
|
+
$item_total = $elmt.find('.item_total');
|
378
|
+
$item_to.text(parseInt($item_to.text()) - 1);
|
379
|
+
$item_total.text(parseInt($item_total.text()) - 1);
|
380
|
+
};
|
381
|
+
|
382
|
+
|
383
|
+
var getParameterByName = function(name){
|
384
|
+
var name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
385
|
+
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
386
|
+
var regex = new RegExp(regexS);
|
387
|
+
var results = regex.exec(window.location.search);
|
388
|
+
if(results == null)
|
389
|
+
return "";
|
390
|
+
else
|
391
|
+
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
392
|
+
}
|
393
|
+
|
394
|
+
var getSerializeArray = function($serialize_array){
|
395
|
+
var obj = {};
|
396
|
+
for(var i=0; i<$serialize_array.length; i++){
|
397
|
+
obj[$serialize_array[i].name] = $serialize_array[i].value;
|
398
|
+
}
|
399
|
+
return obj;
|
400
|
+
};
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
// Temporarily moved from application.js
|
410
|
+
//////////////////////////////////////////////
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
var renderMultipleTokensById = function(token_id, url, min_chars){
|
415
|
+
$("#" + token_id).tokenInput(url, {
|
416
|
+
propertyToSearch: "name",
|
417
|
+
resultsFormatter: function(item){ var code = item.code == undefined ? '' : item.code; var avatar = item.avatar_resource_tiny == undefined ? '' : "<img src='" + item.avatar_resource_tiny + "' title='" + item.name + " " + code + "' height='25px' width='25px' />"; return "<li>" + avatar + "<div style='display: inline-block; padding-left: 10px;'><div class='name'>" + item.name + " " + code + "</div></div></li>" },
|
418
|
+
tokenFormatter: function(item) { var code = item.code == undefined ? '' : item.code; return "<li><p>" + item.name + " " + code + "</p></li>" },
|
419
|
+
theme: 'bootstrap',
|
420
|
+
minChars: (min_chars == undefined ? 2 : min_chars),
|
421
|
+
preventDuplicates: true,
|
422
|
+
prePopulate: $('#' + token_id).data('load')
|
423
|
+
});
|
424
|
+
};
|
425
|
+
|
426
|
+
var renderSingleTokensById = function(token_id, url, min_chars){
|
427
|
+
$("#" + token_id).tokenInput(url, {
|
428
|
+
propertyToSearch: "name",
|
429
|
+
resultsFormatter: function(item){ var code = item.code == undefined ? '' : item.code; var avatar = item.avatar_resource_tiny == undefined ? '' : "<img src='" + item.avatar_resource_tiny + "' title='" + item.name + " " + code + "' height='25px' width='25px' />"; return "<li>" + avatar + "<div style='display: inline-block; padding-left: 10px;'><div class='name'>" + item.name + " " + code + "</div></div></li>" },
|
430
|
+
tokenFormatter: function(item) { var code = item.code == undefined ? '' : item.code; return "<li><p>" + item.name + " " + code + "</p></li>" },
|
431
|
+
theme: 'bootstrap',
|
432
|
+
tokenLimit: 1,
|
433
|
+
minChars: (min_chars == undefined ? 2 : min_chars),
|
434
|
+
preventDuplicates: true,
|
435
|
+
prePopulate: $('#' + token_id).data('load')
|
436
|
+
});
|
437
|
+
};
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
// Translations
|
442
|
+
var t = function($str, $locale){
|
443
|
+
if($locale == null){ $locale = LOCALE; }
|
444
|
+
return (translations[$locale][$str] == undefined ? "translations."+$str+".missing" : translations[$locale][$str]);
|
445
|
+
};
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
// Reset nested destroy value to false. Prevent getting its value from cache
|
450
|
+
var resetNestedFieldDestroy = function(){
|
451
|
+
$('.nested_field input[id$=__destroy]').val(false);
|
452
|
+
$('.controls #document_ids').val('');
|
453
|
+
};
|
454
|
+
|
455
|
+
|
456
|
+
var renderModalTableGrid = function(){
|
457
|
+
$('.modal-body .rich_table_component .component_content').st_tableGrid();
|
458
|
+
};
|
459
|
+
|
460
|
+
var renderRemoteCkeditor = function(){
|
461
|
+
$('.remote_ckeditor').each(function(){
|
462
|
+
try {
|
463
|
+
var hEd = CKEDITOR.instances[$(this).attr('id')];
|
464
|
+
if (hEd) {
|
465
|
+
hEd.destroy(hEd);
|
466
|
+
}
|
467
|
+
$(this).ckeditor();
|
468
|
+
} catch(e){}}
|
469
|
+
);
|
470
|
+
};
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
// GLOBAL NOTIFICATION START FROM HERE
|
477
|
+
|
478
|
+
var NOTIFICATION = 0;
|
479
|
+
var SUCCESS = 1;
|
480
|
+
var WAITING = 2;
|
481
|
+
var WARNING = 3;
|
482
|
+
var ERROR = 4;
|
483
|
+
var DANGER = 5;
|
484
|
+
|
485
|
+
var showGlobalNotification = function($message, options){
|
486
|
+
|
487
|
+
var defaults = {
|
488
|
+
show_loading: false,
|
489
|
+
loading_image: LOADING_IMAGE,
|
490
|
+
type: NOTIFICATION
|
491
|
+
};
|
492
|
+
var opts = $.extend(defaults, options);
|
493
|
+
|
494
|
+
$type = opts.type;
|
495
|
+
$('.global_notification').remove();
|
496
|
+
$gl = $('<div class="global_notification"></div>').html((opts.show_loading ? opts.loading_image : '') + ' ' + $message).appendTo('body');
|
497
|
+
|
498
|
+
switch($type){
|
499
|
+
case NOTIFICATION:
|
500
|
+
$gl.addClass('info');
|
501
|
+
break;
|
502
|
+
case SUCCESS:
|
503
|
+
$gl.addClass('success');
|
504
|
+
removeGlobalNotification();
|
505
|
+
break;
|
506
|
+
case WAITING:
|
507
|
+
$gl.addClass('warning');
|
508
|
+
break;
|
509
|
+
case WARNING:
|
510
|
+
$gl.addClass('warning');
|
511
|
+
break;
|
512
|
+
case ERROR:
|
513
|
+
$gl.addClass('danger');
|
514
|
+
break;
|
515
|
+
case DANGER:
|
516
|
+
$gl.addClass('danger');
|
517
|
+
break;
|
518
|
+
default:
|
519
|
+
break;
|
520
|
+
}
|
521
|
+
|
522
|
+
|
523
|
+
$gl.click(function(event){
|
524
|
+
$(this).slideUp(function(event){
|
525
|
+
$(this).remove();
|
526
|
+
});
|
527
|
+
}).css({
|
528
|
+
'margin-left': $('.global_notification').outerWidth() / -2
|
529
|
+
}).attr({
|
530
|
+
'title': 'Click to hide'
|
531
|
+
});
|
532
|
+
|
533
|
+
};
|
534
|
+
|
535
|
+
var removeGlobalNotification = function(options){
|
536
|
+
var defaults = {
|
537
|
+
delay: 3000,
|
538
|
+
immediate: false
|
539
|
+
};
|
540
|
+
var opts = $.extend(defaults, options);
|
541
|
+
|
542
|
+
if(opts.immediate == false){
|
543
|
+
setTimeout(function(){
|
544
|
+
$('.global_notification').fadeOut('slow', function(){
|
545
|
+
$(this).remove();
|
546
|
+
})
|
547
|
+
}, opts.delay);
|
548
|
+
}
|
549
|
+
else{
|
550
|
+
$('.global_notification').fadeOut('fast')
|
551
|
+
}
|
552
|
+
};
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
var removeGlobalLoading = function(options){
|
557
|
+
removeGlobalNotification();
|
558
|
+
};
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
var translate = function(_str, _locale){
|
563
|
+
if(_locale == undefined){
|
564
|
+
_locale = LOCALE;
|
565
|
+
}
|
566
|
+
var result = translations[LOCALE][_str];
|
567
|
+
return result == undefined ? _str : result
|
568
|
+
}
|
569
|
+
|
570
|
+
|
571
|
+
var initExportButton = function(){
|
572
|
+
|
573
|
+
// OPENING EXPORT MODAL
|
574
|
+
$('.rich_table_component').delegate('.btn_export', 'click', function(evt){
|
575
|
+
evt.preventDefault();
|
576
|
+
|
577
|
+
$('body').append(
|
578
|
+
|
579
|
+
'<div id="export_modal" class="modal hide fade">' +
|
580
|
+
' <div class="modal-header">' +
|
581
|
+
' <button class="close" data-dismiss="modal">' +
|
582
|
+
' ×' +
|
583
|
+
' </button>' +
|
584
|
+
' <h3>' +
|
585
|
+
' Meng-ekspor' +
|
586
|
+
' </h3>' +
|
587
|
+
' </div>' +
|
588
|
+
' <div class="modal-body">' +
|
589
|
+
' <div class="component form_component new_form_component">' +
|
590
|
+
' <div class="component_content">' +
|
591
|
+
' <div class="part form_part">' +
|
592
|
+
' </div>' +
|
593
|
+
' </div>' +
|
594
|
+
' </div>' +
|
595
|
+
' </div>' +
|
596
|
+
'</div>'
|
597
|
+
);
|
598
|
+
|
599
|
+
var $elmt = $(this).parents('.rich_table_component');
|
600
|
+
var $the_form = $(this).parent().find('.hide .export_form').clone();
|
601
|
+
$the_form.append('<div class="hide"></div>')
|
602
|
+
$elmt.find('form#filter_form input').each(function(){
|
603
|
+
$(this).clone().appendTo($the_form.find('.hide'));
|
604
|
+
});
|
605
|
+
|
606
|
+
// change form action to pdf if it's pdf
|
607
|
+
if($(this).hasClass('btn_pdf')){
|
608
|
+
$the_form.attr('action', $the_form.attr('action').replace('.xls', '.pdf'));
|
609
|
+
}
|
610
|
+
|
611
|
+
// append filter form
|
612
|
+
var $el = $elmt.find('.rtc_advanced_search');
|
613
|
+
|
614
|
+
if($el.length > 0 && $elmt.find('.rtc_search #search').val() == ''){
|
615
|
+
$el.find('input').each(function(){
|
616
|
+
$(this).clone().appendTo($the_form.find('.hide'));
|
617
|
+
});
|
618
|
+
}
|
619
|
+
else{
|
620
|
+
$elmt.find('.rtc_search #search').clone().appendTo($the_form.find('.hide'));
|
621
|
+
}
|
622
|
+
|
623
|
+
|
624
|
+
$('#export_modal').find('.part.form_part').html($the_form).end().modal('show');
|
625
|
+
|
626
|
+
});
|
627
|
+
};
|
628
|
+
|
629
|
+
var initManualPopover = function(){
|
630
|
+
// Live tooltip
|
631
|
+
// $('body').tooltip({
|
632
|
+
// selector: '[rel=tooltip], [rel=tooltip nofollow]'
|
633
|
+
// });
|
634
|
+
|
635
|
+
// // Live popover
|
636
|
+
// $('body').popover({
|
637
|
+
// selector: '[rel=popover], [rel=popover nofollow]'
|
638
|
+
// });
|
639
|
+
$("[rel=popover]").popover({ trigger: 'manual' }).hover(function(e){
|
640
|
+
$("[rel=popover]").not(this).popover('hide');
|
641
|
+
$(this).popover('show');
|
642
|
+
e.preventDefault();
|
643
|
+
}, function(){
|
644
|
+
//
|
645
|
+
});
|
646
|
+
// $(".tooltip").tooltip();
|
647
|
+
// $("a[rel=tooltip]").tooltip();
|
648
|
+
$(document).click(function(evt){
|
649
|
+
if(!$(evt.target).hasClass('close') && ($(evt.target).hasClass('popover') || $(evt.target).parents('.popover').length > 0)){
|
650
|
+
|
651
|
+
}
|
652
|
+
else{
|
653
|
+
$("[rel=popover]").popover('hide');
|
654
|
+
}
|
655
|
+
});
|
656
|
+
};
|
657
|
+
|
658
|
+
// initialize hash active tab for bootstrap tab
|
659
|
+
var initActiveTab = function(){
|
660
|
+
|
661
|
+
// activate first hash for active tab
|
662
|
+
var activeTab = $('[href=' + location.hash + ']');
|
663
|
+
activeTab && activeTab.tab('show');
|
664
|
+
|
665
|
+
$('#myTab a').click(function (e) {
|
666
|
+
e.preventDefault();
|
667
|
+
window.location.hash = $(this).attr('href').substr(1);
|
668
|
+
$(this).tab('show');
|
669
|
+
});
|
670
|
+
|
671
|
+
var locationHashChanged = function(){
|
672
|
+
var activeTab = $('[href=' + location.hash + ']');
|
673
|
+
if(activeTab.length > 0){
|
674
|
+
activeTab.tab('show');
|
675
|
+
}
|
676
|
+
else{
|
677
|
+
$('#myTab a:first').tab('show');
|
678
|
+
}
|
679
|
+
}
|
680
|
+
|
681
|
+
window.onhashchange = locationHashChanged;
|
682
|
+
};
|
683
|
+
|
684
|
+
// Initialize racpitulation matrix
|
685
|
+
var initRecapitulation = function(){
|
686
|
+
//
|
687
|
+
$('.recapitulation_form').live('ajax:beforeSend', function(event, xhr, settings){
|
688
|
+
if(settings.url.indexOf('&export_pdf=') > 0){
|
689
|
+
settings.url += (settings.url.indexOf('?') >= 0 ? '&' : '?');
|
690
|
+
location.href = settings.url + '&format=pdf';
|
691
|
+
}
|
692
|
+
else if(settings.url.indexOf('&export_xls=') > 0){
|
693
|
+
settings.url += (settings.url.indexOf('?') >= 0 ? '&' : '?');
|
694
|
+
location.href = settings.url + '&format=xls';
|
695
|
+
}
|
696
|
+
}).live('ajax:success', function(){
|
697
|
+
if (recapitulation_error != null){
|
698
|
+
alert(recapitulation_error.message);
|
699
|
+
}
|
700
|
+
else{
|
701
|
+
$(this).parent('.well').find('.recapitulation_result').remove();
|
702
|
+
var $recapitulation_result = $('<div></div>').addClass('recapitulation_result');
|
703
|
+
$(this).parent('.well').append($recapitulation_result);
|
704
|
+
|
705
|
+
$recapitulation_result.st_recapitulationMatrix({recapitulation_matrix: recapitulation_matrix});
|
706
|
+
}
|
707
|
+
});
|
708
|
+
};
|