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,927 @@
|
|
1
|
+
|
2
|
+
var CURRENCY_ID_NUMBER = "#,##0"
|
3
|
+
var CURRENCY_ID_FORMAT = "#,##0"
|
4
|
+
var CURRENCY_ID_NUMBER_OBJECT = {format:CURRENCY_ID_NUMBER, locale:"us"};
|
5
|
+
var CURRENCY_ID_FORMAT_OBJECT = {format:CURRENCY_ID_FORMAT, locale:"us"};
|
6
|
+
|
7
|
+
var PERCENT_NUMBER = "#.0%"
|
8
|
+
var PERCENT_FORMAT = "#.0%"
|
9
|
+
var PERCENT_NUMBER_OBJECT = {format:PERCENT_NUMBER, locale:"us"};
|
10
|
+
var PERCENT_FORMAT_OBJECT = {format:PERCENT_FORMAT, locale:"us"};
|
11
|
+
|
12
|
+
// BASIC TABLE GRID
|
13
|
+
|
14
|
+
jQuery.fn.st_tableGrid = function(options){
|
15
|
+
|
16
|
+
return this.each(function(){
|
17
|
+
var defaults = {
|
18
|
+
width: 800,
|
19
|
+
height: "auto",
|
20
|
+
header_label: [],
|
21
|
+
columns: [],
|
22
|
+
flowing: true,
|
23
|
+
min_height: 150,
|
24
|
+
show_advanced_search: false
|
25
|
+
};
|
26
|
+
var opts = jQuery.extend(defaults, options);
|
27
|
+
|
28
|
+
var $elmt = jQuery(this);
|
29
|
+
var $rtc_header = $elmt.children('.rtc_header');
|
30
|
+
var $rtc_content = $elmt.children('.rtc_content');
|
31
|
+
var $rtc_grid = $rtc_content.children('.rtc_grid');
|
32
|
+
var $rtc_grid_header = $rtc_content.children('.rtc_grid_header');
|
33
|
+
var $rtc_footer = $elmt.children('.rtc_footer');
|
34
|
+
|
35
|
+
var table_width = opts.flowing ? $elmt.parent().width() : opts.width;
|
36
|
+
|
37
|
+
$elmt.width(table_width);
|
38
|
+
|
39
|
+
for (var i = 0; i < opts.slices; i++) {
|
40
|
+
}
|
41
|
+
|
42
|
+
$rtc_grid_header.wrapInner('<div class="rtc_gh_items"></div>');
|
43
|
+
|
44
|
+
var scroller_width = 0;
|
45
|
+
|
46
|
+
var nearleft = false;
|
47
|
+
var nearright = false;
|
48
|
+
var resized_column = -9;
|
49
|
+
var mousedown = false;
|
50
|
+
var min_cwidth = 40;
|
51
|
+
var rezrad = 5;
|
52
|
+
|
53
|
+
var $vertical_line;
|
54
|
+
var $rtc_gh_items = $rtc_grid_header.find('.rtc_gh_items');
|
55
|
+
|
56
|
+
var grid_table_width = $rtc_grid.width() - scroller_width; // substract with scroller width
|
57
|
+
|
58
|
+
var arr_cols_width = opts.columns;
|
59
|
+
var total_prop_columns = 0;
|
60
|
+
|
61
|
+
var ncolumn = $rtc_grid_header.find('.rtc_gh_item').size();
|
62
|
+
|
63
|
+
if(arr_cols_width.length == 0){
|
64
|
+
for(var i=0; i<ncolumn; i++){
|
65
|
+
var data_column_width = $rtc_gh_items.find('.rtc_gh_item').eq(i).data('column-width');
|
66
|
+
arr_cols_width[i] = data_column_width == undefined ? 1 : data_column_width;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
$rtc_grid.find('table').width(grid_table_width);
|
71
|
+
|
72
|
+
$elmt.st_tableGrid_update();
|
73
|
+
|
74
|
+
// adjusting table grid height
|
75
|
+
|
76
|
+
if(opts.height != "auto"){
|
77
|
+
$rtc_grid.height( opts.height
|
78
|
+
- $rtc_footer.outerHeight()
|
79
|
+
- $rtc_grid_header.outerHeight()
|
80
|
+
- $rtc_header.outerHeight()
|
81
|
+
- 7
|
82
|
+
);
|
83
|
+
}
|
84
|
+
else{
|
85
|
+
if($rtc_grid.height() + $rtc_footer.outerHeight() + $rtc_grid_header.outerHeight() + $rtc_header.outerHeight() + 7 < opts.min_height){
|
86
|
+
$rtc_grid.css( 'min-height', opts.min_height
|
87
|
+
- $rtc_footer.outerHeight()
|
88
|
+
- $rtc_grid_header.outerHeight()
|
89
|
+
- $rtc_header.outerHeight()
|
90
|
+
- 7
|
91
|
+
);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// just auto height, so that we comment the line just below
|
96
|
+
//$rtc_grid.height($rtc_grid.height());
|
97
|
+
|
98
|
+
// Adjust table width
|
99
|
+
for(var i=0; i<ncolumn; i++){
|
100
|
+
total_prop_columns += arr_cols_width[i];
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
// Adjust initial column width
|
105
|
+
for(var i=0; i<ncolumn; i++){
|
106
|
+
var tcw = arr_cols_width[i] * grid_table_width / total_prop_columns;
|
107
|
+
tcw = tcw < 40 ? 40 : tcw;
|
108
|
+
$rtc_grid.find('.resizer:eq('+i+')').width(tcw);
|
109
|
+
}
|
110
|
+
for(var i=0; i<ncolumn; i++){
|
111
|
+
$curr_rtc_gh_item = $rtc_grid_header.find('.rtc_gh_item:eq('+i+')');
|
112
|
+
$curr_rtc_gh_item.width($rtc_grid.find('.resizer:eq('+i+')').width());
|
113
|
+
if($curr_rtc_gh_item.text() == '') $curr_rtc_gh_item.html(' ')
|
114
|
+
}
|
115
|
+
|
116
|
+
$rtc_grid_header.find('.rtc_gh_item').mousemove(function(event){
|
117
|
+
var x = event.pageX - $(this).offset().left;
|
118
|
+
if(!mousedown){
|
119
|
+
nearleft = false;
|
120
|
+
nearright = false;
|
121
|
+
resized_column = -9;
|
122
|
+
if(x < 2*rezrad && $(this).index() > 0){
|
123
|
+
$(this).css({cursor: 'col-resize'});
|
124
|
+
nearleft = true;
|
125
|
+
nearright = false;
|
126
|
+
}
|
127
|
+
else if(($(this).width() - x) < rezrad){
|
128
|
+
$(this).css({cursor: 'col-resize'});
|
129
|
+
nearright = true;
|
130
|
+
nearleft = false;
|
131
|
+
}
|
132
|
+
else{
|
133
|
+
$(this).css({cursor: 'auto'});
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}).mousedown(function(event){
|
137
|
+
resized_column = $(this).index();
|
138
|
+
mousedown = true;
|
139
|
+
$('body').append($vertical_line = $('<div class="vertical_line"></div>'));
|
140
|
+
});
|
141
|
+
|
142
|
+
$(window).mousemove(function(event){
|
143
|
+
if( mousedown
|
144
|
+
&& (
|
145
|
+
(nearleft && resized_column > 0)
|
146
|
+
|| (nearleft || nearright)
|
147
|
+
)
|
148
|
+
){
|
149
|
+
|
150
|
+
var rc = resized_column;
|
151
|
+
if(nearleft) rc = resized_column - 1;
|
152
|
+
var x = event.pageX - $elmt.offset().left;
|
153
|
+
|
154
|
+
if(x > min_cwidth){
|
155
|
+
$vertical_line.css({
|
156
|
+
left: event.pageX,
|
157
|
+
top: $rtc_gh_items.offset().top,
|
158
|
+
height: $rtc_grid_header.height() + $rtc_grid.height() + 1
|
159
|
+
});
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}).mouseup(function(event){
|
163
|
+
if(mousedown){
|
164
|
+
if(nearleft){
|
165
|
+
resizeHeaderWidth(resized_column - 1);
|
166
|
+
}
|
167
|
+
else if(nearright){
|
168
|
+
resizeHeaderWidth(resized_column);
|
169
|
+
}
|
170
|
+
$vertical_line.remove();
|
171
|
+
resized_column = -9;
|
172
|
+
nearleft = false;
|
173
|
+
nearright = false;
|
174
|
+
mousedown = false;
|
175
|
+
}
|
176
|
+
});
|
177
|
+
|
178
|
+
// resize and adjust column width and table that containing it
|
179
|
+
var resizeHeaderWidth = function($rc){
|
180
|
+
var tch = Math.ceil($vertical_line.offset().left - $rtc_grid_header.find('.rtc_gh_item:eq('+$rc+')').offset().left);
|
181
|
+
$rtc_grid_header.find('.rtc_gh_item:eq('+$rc+')').width(tch);
|
182
|
+
|
183
|
+
var tmpwidth = 0;
|
184
|
+
$rtc_gh_items.find('.rtc_gh_item').each(function(index){
|
185
|
+
tmpwidth += $(this).width();
|
186
|
+
});
|
187
|
+
|
188
|
+
$rtc_gh_items.width(tmpwidth);
|
189
|
+
$rtc_grid.children('table').width(tmpwidth)
|
190
|
+
.find('.resizer').each(function(index){
|
191
|
+
$(this).width($rtc_grid_header.find('.rtc_gh_item:eq('+ index +')').width());
|
192
|
+
});
|
193
|
+
};
|
194
|
+
|
195
|
+
// Scrolling header column container
|
196
|
+
$rtc_grid.scroll(function(){
|
197
|
+
$rtc_gh_items.css({
|
198
|
+
left: $(this).scrollLeft() * (-1)
|
199
|
+
});
|
200
|
+
|
201
|
+
$(this).find('.rtc_loading').css({
|
202
|
+
top: $rtc_grid.scrollTop()
|
203
|
+
});
|
204
|
+
});
|
205
|
+
|
206
|
+
|
207
|
+
$rtc_gh_items.find('.rtc_gh_item a').each(function(){
|
208
|
+
if($(this).is('.asc')){
|
209
|
+
$(this).attr('href', $(this).attr('href').replace('asc', 'desc'));
|
210
|
+
}
|
211
|
+
});
|
212
|
+
|
213
|
+
var tmpwidth = 0;
|
214
|
+
$rtc_gh_items.find('.rtc_gh_item').each(function(index){
|
215
|
+
tmpwidth += $(this).width();
|
216
|
+
});
|
217
|
+
|
218
|
+
$rtc_gh_items.width(tmpwidth);
|
219
|
+
|
220
|
+
|
221
|
+
$elmt.resizable({
|
222
|
+
minWidth: $elmt.outerWidth(),
|
223
|
+
maxWidth: $elmt.outerWidth(),
|
224
|
+
alsoResize: $rtc_grid,
|
225
|
+
distance: 3,
|
226
|
+
autoHide: true,
|
227
|
+
handles: 's'
|
228
|
+
});
|
229
|
+
|
230
|
+
if(opts.show_advanced_search){
|
231
|
+
$elmt.find('#advance_search').trigger('click');
|
232
|
+
}
|
233
|
+
|
234
|
+
});
|
235
|
+
};
|
236
|
+
|
237
|
+
|
238
|
+
jQuery.fn.st_formatRow = function(options){
|
239
|
+
var defaults = {};
|
240
|
+
var opts = jQuery.extend(defaults, options);
|
241
|
+
return this.each(function(){
|
242
|
+
var $elmt = jQuery(this);
|
243
|
+
|
244
|
+
$elmt.find('td').wrapInner('<div class="cell"></div>');
|
245
|
+
$elmt.find('.cell .row_utility, .cell .edit_form_row').each(function(){
|
246
|
+
$(this).appendTo($(this).parents('td'));
|
247
|
+
});
|
248
|
+
|
249
|
+
|
250
|
+
// Adding numeric class for numeric cell
|
251
|
+
$elmt.parents('.st_table_grid').find('.thcnumeric').each(function(){
|
252
|
+
$elmt.find('td:eq('+$(this).index()+') .cell').addClass('numeric');
|
253
|
+
});
|
254
|
+
$elmt.parents('.st_table_grid').find('.thcprimary').each(function(){
|
255
|
+
$elmt.find('td:eq('+$(this).index()+') .cell').addClass('primary');
|
256
|
+
});
|
257
|
+
|
258
|
+
$elmt.find('a.button.collapse').hide();
|
259
|
+
})
|
260
|
+
};
|
261
|
+
|
262
|
+
|
263
|
+
jQuery.fn.st_tableGrid_update = function(options){
|
264
|
+
return this.each(function(){
|
265
|
+
var defaults = {
|
266
|
+
width: 800,
|
267
|
+
height: 200,
|
268
|
+
header_label: [],
|
269
|
+
columns: []
|
270
|
+
};
|
271
|
+
var opts = jQuery.extend(defaults, options);
|
272
|
+
|
273
|
+
var $elmt = jQuery(this);
|
274
|
+
var ncolumn = $elmt.find('.rtc_gh_item').size();
|
275
|
+
var $table = $elmt.find('table').eq(0);
|
276
|
+
|
277
|
+
for (var i = 0; i < opts.slices; i++) {
|
278
|
+
}
|
279
|
+
|
280
|
+
$table.children('tbody').children('tr:not(.resizers)').each(function(index){
|
281
|
+
$(this).st_formatRow();
|
282
|
+
});
|
283
|
+
|
284
|
+
|
285
|
+
// Adding resizer cell
|
286
|
+
var resizer = '<tr class="resizers">'
|
287
|
+
for(var i=0; i<ncolumn; i++){
|
288
|
+
resizer += '<th class="resizer"> </th>';
|
289
|
+
}
|
290
|
+
resizer += '</tr>';
|
291
|
+
$table.prepend(resizer);
|
292
|
+
|
293
|
+
var total_columns_width = 0;
|
294
|
+
// Adjust initial column width
|
295
|
+
for(var i=0; i<ncolumn; i++){
|
296
|
+
$elmt.find('.resizer:eq('+i+')').width($elmt.find('.rtc_gh_item:eq('+i+')').width());
|
297
|
+
total_columns_width += $elmt.find('.rtc_gh_item:eq('+i+')').width();
|
298
|
+
}
|
299
|
+
|
300
|
+
$table.width(total_columns_width == 0 ? '100%' : total_columns_width);
|
301
|
+
|
302
|
+
/*
|
303
|
+
if($elmt.find('table tr:last-child td').size() > 0 && (!($elmt.find('table tr:last-child td').size() == $elmt.find('.rtc_gh_item').size()))){
|
304
|
+
alert("Total column mismatch, please fix this");
|
305
|
+
}
|
306
|
+
*/
|
307
|
+
|
308
|
+
});
|
309
|
+
};
|
310
|
+
|
311
|
+
|
312
|
+
// BASIC TABLE LOADING CONTENT
|
313
|
+
|
314
|
+
jQuery.fn.st_tableGrid_loading = function(options){
|
315
|
+
return this.each(function(){
|
316
|
+
var defaults = {
|
317
|
+
message: 'Loading...',
|
318
|
+
image: ''
|
319
|
+
};
|
320
|
+
var opts = jQuery.extend(defaults, options);
|
321
|
+
|
322
|
+
var $elmt = jQuery(this);
|
323
|
+
var $rtc_grid = $elmt.find('.rtc_grid');
|
324
|
+
var scroller_width = 17;
|
325
|
+
|
326
|
+
$elmt.find('.rtc_loading').remove();
|
327
|
+
$rtc_grid.append('<div class="rtc_loading"><div class="loading_message">'+opts.image+'<span>'+opts.message+'</span></div></div>');
|
328
|
+
$elmt.find('.rtc_loading').css({
|
329
|
+
width: $rtc_grid.width() - scroller_width,
|
330
|
+
height: $rtc_grid.height(),
|
331
|
+
top: $rtc_grid.scrollTop()
|
332
|
+
});
|
333
|
+
|
334
|
+
});
|
335
|
+
};
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
// POPUP
|
353
|
+
|
354
|
+
jQuery.fn.st_popup = function(options){
|
355
|
+
var defaults = {
|
356
|
+
title: "",
|
357
|
+
message: "Are you sure?",
|
358
|
+
ok_label: "Ok",
|
359
|
+
cancel_label: "Cancel",
|
360
|
+
ok: function(event){},
|
361
|
+
cancel: function(event){},
|
362
|
+
close: function(event){},
|
363
|
+
loading: "Harap tunggu...",
|
364
|
+
loading_image: "/gfx/load48.gif",
|
365
|
+
close_button: "<div class='popup_close_button button small close'><div class='icon'></div></div>",
|
366
|
+
autoclose: true,
|
367
|
+
show_toolbar: true,
|
368
|
+
width: "auto"
|
369
|
+
};
|
370
|
+
var opts = jQuery.extend(defaults, options);
|
371
|
+
|
372
|
+
|
373
|
+
return this.each(function(){
|
374
|
+
var $elmt = jQuery(this);
|
375
|
+
var $popup = $('<div class="popup"></div>');
|
376
|
+
var $popup_background = $('<div class="popup_background"></div>');
|
377
|
+
var $popup_content = $('<div class="popup_content"></div>');
|
378
|
+
var $popup_title = $('<div class="popup_title"></div>');
|
379
|
+
var $popup_ok = $('<a href="#" class="popup_ok_button button">' + opts.ok_label + '</a>');
|
380
|
+
var $popup_cancel = $('<a href="#" class="popup_cancel_button button">' + opts.cancel_label + '</a>');
|
381
|
+
var $popup_close = $(opts.close_button);
|
382
|
+
var $popup_toolbar = $('<div class="popup_toolbar"></div>');
|
383
|
+
|
384
|
+
// Hide popup, remove all popup element
|
385
|
+
var removePopup = function(){
|
386
|
+
$popup.remove();
|
387
|
+
$popup_background.remove();
|
388
|
+
};
|
389
|
+
|
390
|
+
if(opts.message == ''){
|
391
|
+
$content = '<div class="load48"><img src="' + opts.loading_image + '" alt="' + opts.loading + '" /></div>'
|
392
|
+
}
|
393
|
+
// Remove before adding new popup
|
394
|
+
|
395
|
+
removePopup();
|
396
|
+
|
397
|
+
$popup_title.html('<span class="text">' + opts.title + '</span>');
|
398
|
+
|
399
|
+
$popup_close.click(function(event){
|
400
|
+
$(this).addClass('pressed');
|
401
|
+
opts.close();
|
402
|
+
removePopup();
|
403
|
+
unpressedButton();
|
404
|
+
});
|
405
|
+
$popup_ok.click(function(event){
|
406
|
+
$(this).addClass('pressed');
|
407
|
+
opts.ok();
|
408
|
+
opts.close();
|
409
|
+
unpressedButton();
|
410
|
+
if(opts.autoclose) removePopup();
|
411
|
+
});
|
412
|
+
$popup_cancel.click(function(){
|
413
|
+
$(this).addClass('pressed');
|
414
|
+
opts.cancel();
|
415
|
+
opts.close();
|
416
|
+
unpressedButton();
|
417
|
+
removePopup();
|
418
|
+
removeGlobalLoading();
|
419
|
+
});
|
420
|
+
$popup_background.click(function(event){
|
421
|
+
opts.close();
|
422
|
+
removePopup();
|
423
|
+
unpressedButton();
|
424
|
+
});
|
425
|
+
$popup_toolbar.append($popup_ok).append($popup_cancel);
|
426
|
+
|
427
|
+
$popup_content.html(opts.message);
|
428
|
+
|
429
|
+
if(opts.show_toolbar){
|
430
|
+
$popup_content.append($popup_toolbar);
|
431
|
+
}
|
432
|
+
$popup.append($popup_close).append($popup_title).append($popup_content);
|
433
|
+
|
434
|
+
$('body').append($popup).append($popup_background);
|
435
|
+
$('.popup, .popup_background').fadeIn('slow');
|
436
|
+
$('.popup_background').height($(document).height());
|
437
|
+
|
438
|
+
var top = ($(window).height() - $('.popup').outerHeight()) / 2.3;
|
439
|
+
var max_height = ($(window).height() - 100);
|
440
|
+
|
441
|
+
if($popup_content.height() > max_height){
|
442
|
+
$popup_content.height(max_height);
|
443
|
+
}
|
444
|
+
|
445
|
+
$popup_content.width(opts.width - ($popup.outerWidth() - $popup_content.width()));
|
446
|
+
if($popup_content.get(0).scrollWidth > $popup_content.width()){
|
447
|
+
$popup_content.width($popup_content.get(0).scrollWidth);
|
448
|
+
}
|
449
|
+
|
450
|
+
$('.popup').css({
|
451
|
+
'top': (top < 10 ? 10 : top),
|
452
|
+
'left' : ($(window).width() - $('.popup').outerWidth()) / 2
|
453
|
+
});
|
454
|
+
|
455
|
+
var dwidth = $popup.width() - $popup_content.width();
|
456
|
+
var dheight = $popup.height() - $popup_content.height();
|
457
|
+
// draggable & resizable
|
458
|
+
$popup.draggable({
|
459
|
+
handle: ".popup_title"
|
460
|
+
}).resizable({
|
461
|
+
alsoResize: $popup_content,
|
462
|
+
minWidth: 240,
|
463
|
+
minHeight: 126
|
464
|
+
});
|
465
|
+
//
|
466
|
+
|
467
|
+
$popup_ok.focus();
|
468
|
+
|
469
|
+
var unpressedButton = function(event){
|
470
|
+
$elmt.removeClass('pressed');
|
471
|
+
};
|
472
|
+
|
473
|
+
});
|
474
|
+
};
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
jQuery.fn.st_processMessage = function(options){
|
481
|
+
var defaults = {
|
482
|
+
message: t("processing"),
|
483
|
+
show_loading: true,
|
484
|
+
loading_image: '<img class="loading_image" src="/images/loading_image.gif" />',
|
485
|
+
position: "after"
|
486
|
+
};
|
487
|
+
var opts = jQuery.extend(defaults, options);
|
488
|
+
|
489
|
+
return this.each(function(){
|
490
|
+
var $elmt = $(this);
|
491
|
+
});
|
492
|
+
};
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
jQuery.fn.st_carouselWithThumbs = function(options){
|
497
|
+
var defaults = {
|
498
|
+
slideshow: true
|
499
|
+
};
|
500
|
+
var opts = jQuery.extend(defaults, options);
|
501
|
+
|
502
|
+
return this.each(function(){
|
503
|
+
var $elmt = jQuery(this);
|
504
|
+
var $citem = $elmt.children();
|
505
|
+
$citem.addClass('carousel_item');
|
506
|
+
$elmt.append('<div class="st_oc"><div class="st_cc"></div></div><div class="st_thumbs"></div>');
|
507
|
+
$citem.appendTo('.st_cc');
|
508
|
+
var $st_cc = $elmt.find('.st_cc');
|
509
|
+
var $st_oc = $elmt.find('.st_oc');
|
510
|
+
var $size = $citem.size();
|
511
|
+
|
512
|
+
var delay = 10000;
|
513
|
+
var speed = 'slow'
|
514
|
+
|
515
|
+
$elmt.css({
|
516
|
+
position: 'relative'
|
517
|
+
});
|
518
|
+
|
519
|
+
$st_oc.css({
|
520
|
+
height: $elmt.height(),
|
521
|
+
width: $elmt.width(),
|
522
|
+
overflow: 'hidden',
|
523
|
+
position: 'relative'
|
524
|
+
});
|
525
|
+
|
526
|
+
$st_cc.css({
|
527
|
+
height: $elmt.height(),
|
528
|
+
width: $elmt.width() * $size,
|
529
|
+
overflow: 'hidden',
|
530
|
+
position: 'absolute'
|
531
|
+
});
|
532
|
+
|
533
|
+
$citem.css({
|
534
|
+
position: 'relative',
|
535
|
+
height: $elmt.height(),
|
536
|
+
width: $elmt.width(),
|
537
|
+
float: 'left',
|
538
|
+
overflow: 'hidden'
|
539
|
+
});
|
540
|
+
|
541
|
+
$citem.find('.carousel_item_description').css({
|
542
|
+
position: 'absolute',
|
543
|
+
height: $elmt.height(),
|
544
|
+
width: $elmt.width(),
|
545
|
+
top: '0px',
|
546
|
+
left: '0px',
|
547
|
+
overflow: 'hidden'
|
548
|
+
});
|
549
|
+
|
550
|
+
|
551
|
+
// Setting up previous n next control
|
552
|
+
var $cidx = 0;
|
553
|
+
var $prev = $elmt.find('.st_prev');
|
554
|
+
var $next = $elmt.find('.st_next');
|
555
|
+
|
556
|
+
$prev.css({
|
557
|
+
float: 'left'
|
558
|
+
}).click(function(){
|
559
|
+
$cidx = ($cidx == 0) ? $size - 1 : $cidx - 1;
|
560
|
+
$st_cc.animate({
|
561
|
+
left: $cidx * -$elmt.width()
|
562
|
+
}, 'medium', 'easeInQuint');
|
563
|
+
});
|
564
|
+
|
565
|
+
$next.css({
|
566
|
+
float: 'right'
|
567
|
+
}).click(function(){
|
568
|
+
nextPage();
|
569
|
+
});
|
570
|
+
|
571
|
+
var $next_interval = setInterval ( "nextPage()", delay );
|
572
|
+
nextPage = function(){
|
573
|
+
$cidx = ($cidx == $size - 1) ? 0 : $cidx + 1;
|
574
|
+
goTo($cidx);
|
575
|
+
}
|
576
|
+
var goTo = function($gt_idx){
|
577
|
+
$cidx = $gt_idx;
|
578
|
+
$st_cc.animate({
|
579
|
+
left: $cidx * -$elmt.width()
|
580
|
+
}, speed, 'easeInQuint');
|
581
|
+
$st_thumbs.find('.st_thumbs_item').removeClass('selected').parent().find('.st_thumbs_item').eq($cidx).addClass('selected');
|
582
|
+
}
|
583
|
+
|
584
|
+
$elmt.hover(function(){
|
585
|
+
clearInterval($next_interval);
|
586
|
+
}, function(){
|
587
|
+
$next_interval = setInterval ( "nextPage()", delay );
|
588
|
+
});
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
var $st_thumbs = $elmt.find('.st_thumbs');
|
593
|
+
|
594
|
+
$st_oc.find('.carousel_item').each(function(){
|
595
|
+
$st_thumbs.append('<div class="st_thumbs_item"></div>');
|
596
|
+
});
|
597
|
+
|
598
|
+
$st_thumbs.css({
|
599
|
+
position: 'absolute'
|
600
|
+
}).find('.st_thumbs_item').css({
|
601
|
+
});
|
602
|
+
$st_thumbs.find('.st_thumbs_item').click(function(){
|
603
|
+
goTo(jQuery(this).index());
|
604
|
+
}).eq(0).addClass('selected');
|
605
|
+
|
606
|
+
});
|
607
|
+
};
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
jQuery.fn.st_entriesCarouselServices = function(options){
|
622
|
+
var defaults = {
|
623
|
+
};
|
624
|
+
var opts = jQuery.extend(defaults, options);
|
625
|
+
|
626
|
+
return this.each(function(){
|
627
|
+
var $elmt = jQuery(this);
|
628
|
+
|
629
|
+
var $container = $(
|
630
|
+
'<div class="component_content"></div>'
|
631
|
+
);
|
632
|
+
$container.appendTo($elmt);
|
633
|
+
$elmt.addClass('component');
|
634
|
+
|
635
|
+
var portal_address = $elmt.data('source');
|
636
|
+
$.ajax({
|
637
|
+
url: portal_address + '/entries.json/?callback=?',
|
638
|
+
dataType: 'json',
|
639
|
+
data: {
|
640
|
+
entry_type: 'post',
|
641
|
+
related_site: $elmt.data('categorySite')
|
642
|
+
},
|
643
|
+
success: function(feeds){
|
644
|
+
console.log(feeds);
|
645
|
+
|
646
|
+
var markup = $('<div></div>')
|
647
|
+
|
648
|
+
var carousel = $('<div></div>').addClass('carousel');
|
649
|
+
var carousel_image = $('<img src="http://sia.unm.ac.id/assets/favicon.png" data-src="' + portal_address + '${featured_image_url.fit}" />')
|
650
|
+
var carousel_content = $('<div></div>').addClass('carousel_content');
|
651
|
+
|
652
|
+
var title = $('<h2></h2>').html('<a href="data-href" data-href="/entries/${id}">${title}</a>');
|
653
|
+
var content = $('<h3></h3>').html('{{html description}}');
|
654
|
+
|
655
|
+
title.appendTo(carousel_content);
|
656
|
+
content.appendTo(carousel_content);
|
657
|
+
|
658
|
+
carousel_image.appendTo(carousel);
|
659
|
+
carousel_content.appendTo(carousel);
|
660
|
+
|
661
|
+
carousel.appendTo(markup);
|
662
|
+
|
663
|
+
$.template( 'carousel_template', markup );
|
664
|
+
$.tmpl( 'carousel_template', feeds ).appendTo( $elmt.find('.component_content') );
|
665
|
+
|
666
|
+
$('a[href=data-href]').each(function(){
|
667
|
+
$(this).attr('href', $(this).attr('data-href'));
|
668
|
+
});
|
669
|
+
|
670
|
+
$('[src="http://sia.unm.ac.id/assets/favicon.png"]').each(function(){
|
671
|
+
$(this).attr('src', $(this).attr('data-src'));
|
672
|
+
});
|
673
|
+
|
674
|
+
$elmt.find('.component_content').st_carouselWithThumbs();
|
675
|
+
},
|
676
|
+
error: function(XMLHttpRequest, textStatus, errorThrown){
|
677
|
+
console.log(XMLHttpRequest);
|
678
|
+
console.log(textStatus);
|
679
|
+
console.log(errorThrown);
|
680
|
+
}
|
681
|
+
});
|
682
|
+
|
683
|
+
});
|
684
|
+
}
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
jQuery.fn.st_entriesServices = function(options){
|
689
|
+
var defaults = {
|
690
|
+
};
|
691
|
+
var opts = jQuery.extend(defaults, options);
|
692
|
+
|
693
|
+
return this.each(function(){
|
694
|
+
var $elmt = jQuery(this);
|
695
|
+
|
696
|
+
var $container = $(
|
697
|
+
'<div class="component_content">' +
|
698
|
+
' <div class="rtc_header">' +
|
699
|
+
' <div class="rtc_title">Entries</div>' +
|
700
|
+
' </div>' +
|
701
|
+
' <div class="rtc_content">' +
|
702
|
+
' <div class="rtc_grid_header" style="display: none !important">' +
|
703
|
+
' <div class="rtc_gh_item"> </div>' +
|
704
|
+
' </div>' +
|
705
|
+
' <div class="rtc_grid">' +
|
706
|
+
' <table>' +
|
707
|
+
' </table>' +
|
708
|
+
' </div>' +
|
709
|
+
' </div>' +
|
710
|
+
'</div>'
|
711
|
+
);
|
712
|
+
$container.appendTo($elmt);
|
713
|
+
$elmt.addClass('rich_table_component entries_services');
|
714
|
+
|
715
|
+
var portal_address = $elmt.data('source');
|
716
|
+
$.ajax({
|
717
|
+
url: portal_address + '/entries.json/?callback=?',
|
718
|
+
dataType: 'json',
|
719
|
+
data: {
|
720
|
+
entry_type: 'post',
|
721
|
+
related_site: $elmt.data('categorySite')
|
722
|
+
},
|
723
|
+
success: function(feeds){
|
724
|
+
console.log(feeds);
|
725
|
+
|
726
|
+
var markup = $('<div></div>')
|
727
|
+
|
728
|
+
var list_view_row = $('<tr></tr>').addClass('list_view_row');
|
729
|
+
var list_td = $('<td></td>');
|
730
|
+
var lvr_entry = $('<div></div>').addClass('lvr_entry');
|
731
|
+
var lvr_entry_content = $('<div></div>').addClass('lvr_entry_content');
|
732
|
+
var lvr_entry_main_content = $('<div></div>').addClass('lvr_entry_main_content');
|
733
|
+
var lvr_entry_meta = $('<div></div>').addClass('lvr_entry_meta');
|
734
|
+
var lvr_entry_description = $('<div></div>').addClass('lvr_entry_description').html('{{html description}}');
|
735
|
+
|
736
|
+
var title = $('<h1></h1>').html('<a href="data-href" data-href="/entries/${id}">${title}</a>');
|
737
|
+
title.appendTo(lvr_entry_content);
|
738
|
+
|
739
|
+
var image_thumbnail = $('<img src="http://sia.unm.ac.id/assets/favicon.png" data-src="' + portal_address + '${featured_image_url.thumbsquare}" />')
|
740
|
+
image_thumbnail.prependTo(lvr_entry);
|
741
|
+
|
742
|
+
var author = $('<span></span>').html('Penulis: ${user.email}');
|
743
|
+
var posted_date = $('<span></span>').html('Dipublikasikan pada: ${created_at}');
|
744
|
+
author.appendTo(lvr_entry_meta);
|
745
|
+
posted_date.appendTo(lvr_entry_meta);
|
746
|
+
|
747
|
+
lvr_entry_content.append(lvr_entry_main_content);
|
748
|
+
lvr_entry.append(lvr_entry_content).append(lvr_entry_meta).append(lvr_entry_description)
|
749
|
+
list_view_row.append(list_td.append(lvr_entry));
|
750
|
+
markup.append(list_view_row);
|
751
|
+
|
752
|
+
$.template( 'entry_template', markup );
|
753
|
+
$.tmpl( 'entry_template', feeds ).appendTo( $elmt.find('.rtc_content .rtc_grid > table') );
|
754
|
+
|
755
|
+
$('.rich_table_component.entries_services > .component_content').st_tableGrid();
|
756
|
+
|
757
|
+
$('a[href=data-href]').each(function(){
|
758
|
+
$(this).attr('href', $(this).attr('data-href'));
|
759
|
+
});
|
760
|
+
|
761
|
+
$('[src="http://sia.unm.ac.id/assets/favicon.png"]').each(function(){
|
762
|
+
$(this).attr('src', $(this).attr('data-src'));
|
763
|
+
});
|
764
|
+
},
|
765
|
+
error: function(XMLHttpRequest, textStatus, errorThrown){
|
766
|
+
console.log(XMLHttpRequest);
|
767
|
+
console.log(textStatus);
|
768
|
+
console.log(errorThrown);
|
769
|
+
}
|
770
|
+
});
|
771
|
+
|
772
|
+
});
|
773
|
+
}
|
774
|
+
|
775
|
+
|
776
|
+
jQuery.fn.st_singleEntryServices = function(options){
|
777
|
+
|
778
|
+
return this.each(function(){
|
779
|
+
var defaults = {
|
780
|
+
};
|
781
|
+
var opts = jQuery.extend(defaults, options);
|
782
|
+
|
783
|
+
var $elmt = jQuery(this);
|
784
|
+
|
785
|
+
var $container = $(
|
786
|
+
' <div class="component_content">' +
|
787
|
+
' <div class="entry">' +
|
788
|
+
' <div class="entry_title">' +
|
789
|
+
' <h1>' +
|
790
|
+
' </h1>' +
|
791
|
+
' </div>' +
|
792
|
+
' <div class="entry_meta">' +
|
793
|
+
' <span class="publish_info">' +
|
794
|
+
' </span>' +
|
795
|
+
' </div>' +
|
796
|
+
' <div class="featured_image">' +
|
797
|
+
' </div>' +
|
798
|
+
' <div class="entry_content">' +
|
799
|
+
' </div>' +
|
800
|
+
' </div>' +
|
801
|
+
' </div>'
|
802
|
+
);
|
803
|
+
|
804
|
+
$container.appendTo($elmt);
|
805
|
+
$elmt.addClass('component single_component');
|
806
|
+
|
807
|
+
var portal_address = $elmt.data('source');
|
808
|
+
$.ajax({
|
809
|
+
url: portal_address + '/entries/' + $elmt.data('entryId') + '.json/?callback=?',
|
810
|
+
dataType: 'json',
|
811
|
+
data: {
|
812
|
+
entry_type: 'post',
|
813
|
+
related_site: $elmt.data('categorySite')
|
814
|
+
},
|
815
|
+
success: function(feed){
|
816
|
+
$elmt.find('.entry_title h1').html(feed.title);
|
817
|
+
$elmt.find('.entry_content').html(feed.content);
|
818
|
+
$elmt.find('.featured_image').html('<img src="' + portal_address + feed.featured_image_url.fit + '" />');
|
819
|
+
$elmt.find('.publish_info').html('Dibuatkan pada: ' + feed.created_at + ', oleh: ' + feed.user.email);
|
820
|
+
},
|
821
|
+
error: function(XMLHttpRequest, textStatus, errorThrown){
|
822
|
+
console.log(XMLHttpRequest);
|
823
|
+
console.log(textStatus);
|
824
|
+
console.log(errorThrown);
|
825
|
+
}
|
826
|
+
});
|
827
|
+
|
828
|
+
});
|
829
|
+
}
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
// Recapitulation
|
834
|
+
|
835
|
+
jQuery.fn.st_recapitulationMatrix = function(options){
|
836
|
+
|
837
|
+
return this.each(function(){
|
838
|
+
var defaults = {
|
839
|
+
};
|
840
|
+
var opts = jQuery.extend(defaults, options);
|
841
|
+
|
842
|
+
var $elmt = jQuery(this);
|
843
|
+
|
844
|
+
var columns = '';
|
845
|
+
label_col = opts.recapitulation_matrix.shift();
|
846
|
+
for(var i=0; i<label_col.length; i++){
|
847
|
+
columns += '<div class="rtc_gh_item" title="' + label_col[i] + '"><a>' + label_col[i] + '</a></div>';
|
848
|
+
}
|
849
|
+
|
850
|
+
var $container = $(
|
851
|
+
'<div class="component_content">' +
|
852
|
+
' <div class="rtc_header">' +
|
853
|
+
' <div class="rtc_title">Entries</div>' +
|
854
|
+
' </div>' +
|
855
|
+
' <div class="rtc_content">' +
|
856
|
+
' <div class="rtc_grid_header">' +
|
857
|
+
columns +
|
858
|
+
' </div>' +
|
859
|
+
' <div class="rtc_grid">' +
|
860
|
+
' <table>' +
|
861
|
+
' </table>' +
|
862
|
+
' </div>' +
|
863
|
+
' </div>' +
|
864
|
+
'</div>'
|
865
|
+
);
|
866
|
+
$container.appendTo($elmt);
|
867
|
+
$elmt.addClass('rich_table_component recapitulation_matrix');
|
868
|
+
|
869
|
+
|
870
|
+
var markup = $('<div></div>')
|
871
|
+
|
872
|
+
var list_view_row = $('<tr></tr>').addClass('list_view_row');
|
873
|
+
|
874
|
+
var list_td = $('<td style="font-weight: bold" title="{{= $data['+0+']}}">{{= $data['+0+']}}</td>');
|
875
|
+
list_view_row.append(list_td);
|
876
|
+
for(var i=1; i<label_col.length; i++){
|
877
|
+
var list_td = $('<td class="numeric" title="{{= $data['+i+']}}">{{= $data['+i+']}}</td>');
|
878
|
+
list_view_row.append(list_td);
|
879
|
+
}
|
880
|
+
|
881
|
+
markup.append(list_view_row);
|
882
|
+
|
883
|
+
$.template( 'entry_template', markup );
|
884
|
+
$.tmpl( 'entry_template', opts.recapitulation_matrix ).appendTo( $elmt.find('.rtc_content .rtc_grid > table') );
|
885
|
+
|
886
|
+
$elmt.find('.component_content').st_tableGrid();
|
887
|
+
|
888
|
+
|
889
|
+
});
|
890
|
+
}
|
891
|
+
|
892
|
+
|
893
|
+
|
894
|
+
|
895
|
+
// ONLOAD
|
896
|
+
|
897
|
+
$(function(){
|
898
|
+
$('.button.disabled, .button.pressed').live('click', function(event){
|
899
|
+
event.preventDefault();
|
900
|
+
return false;
|
901
|
+
});
|
902
|
+
$('a.button.remote, a[attr="#"]').live('click', function(event){
|
903
|
+
event.preventDefault();
|
904
|
+
});
|
905
|
+
|
906
|
+
$('.rtc_grid input[type=text]').live('focus', function(event){
|
907
|
+
$(this).addClass('focus');
|
908
|
+
});
|
909
|
+
|
910
|
+
|
911
|
+
$('.carousels').st_entriesCarouselServices();
|
912
|
+
$('.entries_services').st_entriesServices();
|
913
|
+
$('.single_entry_services').st_singleEntryServices();
|
914
|
+
});
|
915
|
+
|
916
|
+
|
917
|
+
(function($){
|
918
|
+
var _dataFn = $.fn.data;
|
919
|
+
$.fn.data = function(key, val){
|
920
|
+
if (typeof val !== 'undefined'){
|
921
|
+
$.expr.attrHandle[key] = function(elem){
|
922
|
+
return $(elem).attr(key) || $(elem).data(key);
|
923
|
+
};
|
924
|
+
}
|
925
|
+
return _dataFn.apply(this, arguments);
|
926
|
+
};
|
927
|
+
})(jQuery);
|