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,22 @@
|
|
1
|
+
module DocumentsHelper
|
2
|
+
|
3
|
+
# Return document thumbnail/icon
|
4
|
+
def document_image_tag(document)
|
5
|
+
if !(document.attachment.content_type =~ /^image/).nil?
|
6
|
+
image_tag document.attachment(:micro)
|
7
|
+
else
|
8
|
+
image_tag 'icons/file_extension/file_extension_' + (Document::FILE_EXTENSION_ICON[document.attachment.content_type].presence || '') + '.png'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Return document thumbnail/icon
|
13
|
+
def document_image_path(document)
|
14
|
+
if !(document.attachment.content_type =~ /^image/).nil?
|
15
|
+
document.attachment(:micro)
|
16
|
+
else
|
17
|
+
'/assets/icons/file_extension/file_extension_' + (Document::FILE_EXTENSION_ICON[document.attachment.content_type].presence || '') + '.png'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
module MenusHelper
|
2
|
+
|
3
|
+
def construct_all_menu
|
4
|
+
result = ""
|
5
|
+
Menu.roots.each do |menu_root|
|
6
|
+
if current_user.present?
|
7
|
+
result << '<div class="component menu menu_component grid_3 alpha omega"><div class="component_content">'
|
8
|
+
result << (construct_menu menu_root.sorted_tree)
|
9
|
+
result << '</div></div>'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
sanitize result
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def construct_menu_group(menu_group_id)
|
17
|
+
result = ""
|
18
|
+
if(Menu.exists?(menu_group_id))
|
19
|
+
menus = Menu.find(menu_group_id).sorted_tree
|
20
|
+
menus.keep_if{|menu| (menu.roles & current_user.roles).present?}
|
21
|
+
if current_user.present? && menus.present?
|
22
|
+
result << '<div class="component menu menu_component grid_3 alpha omega"><div class="component_content">'
|
23
|
+
result << (construct_menu menus)
|
24
|
+
result << '</div></div>'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
sanitize result
|
28
|
+
end
|
29
|
+
|
30
|
+
def construct_menu(menus)
|
31
|
+
result = ""
|
32
|
+
menus.keep_if{|menu| (menu.roles & current_user.roles).present?}
|
33
|
+
|
34
|
+
if menus.length > 0
|
35
|
+
root_depth = menus[0].depth
|
36
|
+
curr_depth = root_depth - 1
|
37
|
+
menus.each do |menu|
|
38
|
+
if menu.depth > curr_depth
|
39
|
+
result << '<ul class="parent_' + (menu.depth - root_depth).to_s + '">'
|
40
|
+
elsif menu.depth < curr_depth
|
41
|
+
result << '</ul></li>' * (curr_depth - menu.depth)
|
42
|
+
else
|
43
|
+
# same level
|
44
|
+
result << '</li>'
|
45
|
+
end
|
46
|
+
result << '<li class="child_' + (menu.depth - root_depth).to_s + '">'
|
47
|
+
result << menu_item(menu)
|
48
|
+
curr_depth = menu.depth
|
49
|
+
end
|
50
|
+
result << '</li></ul>' * (curr_depth - menus[0].depth + 1)
|
51
|
+
end
|
52
|
+
sanitize result
|
53
|
+
end
|
54
|
+
|
55
|
+
def menu_item(menu)
|
56
|
+
link_to t(menu.name), (menu.url.start_with?("'") ? eval("User.send(:sanitize_sql_array, [#{menu.url}])") : menu.url), class: ('menu_item ' + (menu.url == request.original_fullpath ? 'current_menu_item' : ''))
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
def breadcrumbs_component limit=20
|
61
|
+
results = []
|
62
|
+
results << (link_to icon('home', t('home')), '/', title: t('home'))
|
63
|
+
@parent_object = nil
|
64
|
+
if @parent_resources.present?
|
65
|
+
@parent_resources.reverse!.each_with_index do |pr, i|
|
66
|
+
begin
|
67
|
+
if i > 0
|
68
|
+
results << (link_to t("#{pr.singularize}"), {controller: pr, action: 'index', (@parent_resources[i - 1].singularize + '_id') => instance_variable_get("@#{@parent_resources[i - 1].singularize}").id})
|
69
|
+
else
|
70
|
+
results << (link_to t("#{pr.singularize}"), {controller: pr, action: 'index'})
|
71
|
+
end
|
72
|
+
rescue
|
73
|
+
results << t("#{pr.singularize}")
|
74
|
+
end
|
75
|
+
pr_id = params[(pr.singularize + '_id').to_sym]
|
76
|
+
parent_object = pr_id.present? ? pr.classify.constantize.find(pr_id) : instance_variable_get("@#{pr.singularize}")
|
77
|
+
results << {parent_object: @parent_object, resource: pr, current: (link_to parent_object.to_s, {controller: pr, action: 'show', id: parent_object}) + (link_to (' <b class="caret"></b>').html_safe, '#', "data-toggle" => 'dropdown', class: 'dropdown-toggle')}
|
78
|
+
@parent_object = parent_object
|
79
|
+
end
|
80
|
+
end
|
81
|
+
if params[:id]
|
82
|
+
|
83
|
+
if @parent_resources.present?
|
84
|
+
results << (link_to t("#{controller_name.singularize}"), {controller: controller_name, action: 'index', (@parent_resources.last.singularize + '_id') => instance_variable_get("@#{@parent_resources.last.singularize}").id})
|
85
|
+
else
|
86
|
+
begin
|
87
|
+
results << (link_to t("#{controller_name.singularize}"), {controller: controller_name, action: 'index'})
|
88
|
+
rescue
|
89
|
+
results << t("#{controller_name.singularize}")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
current_object = controller_name.classify.constantize.find(params[:id])
|
93
|
+
results << {parent_object: @parent_object, resource: controller_name, current: (link_to current_object.to_s, {controller: controller_name, action: 'show', id: current_object}) + (link_to (' <b class="caret"></b>').html_safe, '#', "data-toggle" => 'dropdown', class: 'dropdown-toggle')}
|
94
|
+
elsif !controller_name.eql?('home')
|
95
|
+
results << t("#{controller_name.singularize}")
|
96
|
+
end
|
97
|
+
render 'rich_table_component/component/breadcrumbs', breadcrumbs: results, limit: limit
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
def static_menu(options = {}, title_options = {}, icon_options = {})
|
103
|
+
case options
|
104
|
+
when Hash
|
105
|
+
_menus = options[:menu]
|
106
|
+
_title = options[:title]
|
107
|
+
_icon = options[:icon]
|
108
|
+
else
|
109
|
+
_menus = options
|
110
|
+
_title = title_options
|
111
|
+
_icon = icon_options
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
result = ""
|
116
|
+
sub_result = static_menu_li(menus: _menus, title: _title)
|
117
|
+
|
118
|
+
unless sub_result.length < 50
|
119
|
+
# list is not empty
|
120
|
+
#result << '<div class="grid_3 alpha omega">'
|
121
|
+
if _title.present?
|
122
|
+
result << ' <li class="dropdown">'
|
123
|
+
result << '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' + _title + '<b class="caret"></b></a>'
|
124
|
+
end
|
125
|
+
result << sub_result
|
126
|
+
if _title.present?
|
127
|
+
result << ' </li>'
|
128
|
+
end
|
129
|
+
#result << '</div>'
|
130
|
+
end
|
131
|
+
result.html_safe
|
132
|
+
end
|
133
|
+
|
134
|
+
def static_menu_li(options = {})
|
135
|
+
menus = options[:menus]
|
136
|
+
level = options[:level].presence || 0
|
137
|
+
title = options[:title]
|
138
|
+
ability = options[:ability]
|
139
|
+
|
140
|
+
result = ""
|
141
|
+
|
142
|
+
if menus.present?
|
143
|
+
result << '<ul class="dropdown-menu parent_' + level.to_s + '">' if title.present?
|
144
|
+
menus.compact.each do |menu|
|
145
|
+
subresult = ""
|
146
|
+
subresult << '<li class="child_' + level.to_s + '">'
|
147
|
+
|
148
|
+
case menu
|
149
|
+
when Array
|
150
|
+
subresult << (static_menu_li menus: menu, level: (level + 1)).presence || ""
|
151
|
+
when Hash
|
152
|
+
subresult << (link_to menu[:label], menu[:url], class: 'menu_item')
|
153
|
+
else
|
154
|
+
subresult << menu
|
155
|
+
end
|
156
|
+
|
157
|
+
subresult << '</li>'
|
158
|
+
|
159
|
+
if menu.class == Hash && menu[:ability].present?
|
160
|
+
unless can?(menu[:ability].keys.first, menu[:ability].values.first)
|
161
|
+
subresult = ""
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
if ability.present?
|
167
|
+
unless can?(ability.keys.first, ability.values.first)
|
168
|
+
subresult = ""
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
result << subresult
|
173
|
+
|
174
|
+
end
|
175
|
+
result << '</ul>' if title.present?
|
176
|
+
result
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module ParagraphHelper
|
2
|
+
|
3
|
+
def prettify_notification str=''
|
4
|
+
str.gsub!(/\B(##)\w*[a-zA-Z0-9_]+\w*/) do |x|
|
5
|
+
obj = (x.split('_')[0][2..100]).constantize.find_all_by_id(x.split('_')[1]).last
|
6
|
+
if can? :read, obj
|
7
|
+
link_to obj.to_s, obj
|
8
|
+
else
|
9
|
+
obj.to_s
|
10
|
+
end
|
11
|
+
end
|
12
|
+
str.html_safe
|
13
|
+
end
|
14
|
+
|
15
|
+
# required for truncating html
|
16
|
+
require 'rexml/parsers/pullparser'
|
17
|
+
|
18
|
+
# Return truncating in html raw format
|
19
|
+
def truncate_html(text, len = 30, at_end = ' ...')
|
20
|
+
p = REXML::Parsers::PullParser.new((text.presence || '<p> </p>').gsub(/[\r\n\t]/, ''))
|
21
|
+
tags = []
|
22
|
+
new_len = len
|
23
|
+
results = ''
|
24
|
+
while p.has_next? && new_len > 0
|
25
|
+
p_e = p.pull
|
26
|
+
case p_e.event_type
|
27
|
+
when :start_element
|
28
|
+
tags.push p_e[0]
|
29
|
+
results << "<#{tags.last}#{attrs_to_s(p_e[1])}>"
|
30
|
+
when :end_element
|
31
|
+
results << "</#{tags.pop}>"
|
32
|
+
when :text
|
33
|
+
results << p_e[0][0..new_len]
|
34
|
+
new_len -= p_e[0].length
|
35
|
+
else
|
36
|
+
results << "<!-- #{p_e.inspect} -->"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
if at_end && (sanitize(text).try(:length).to_i) > len
|
40
|
+
results << at_end
|
41
|
+
end
|
42
|
+
tags.reverse.each do |tag|
|
43
|
+
results << "</#{tag}>"
|
44
|
+
end
|
45
|
+
raw(results)
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def attrs_to_s(attrs)
|
51
|
+
if attrs.empty?
|
52
|
+
''
|
53
|
+
else
|
54
|
+
' ' + attrs.to_a.map { |attr| %{#{attr[0]}="#{attr[1]}"} }.join(' ')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.nested_field
|
2
|
+
- if f.object.new_record?
|
3
|
+
= f.input :document_type, as: :hidden, input_html: { value: controller_name.singularize }
|
4
|
+
= #f.input :name
|
5
|
+
= f.input :attachment
|
6
|
+
- else
|
7
|
+
.controls
|
8
|
+
.attachment_part
|
9
|
+
.attachment_entry
|
10
|
+
.attachment_entry_content
|
11
|
+
.attachment_entry_image
|
12
|
+
= link_to document_image_tag(f.object), download_document_path(f.object)
|
13
|
+
.attachment_entry_description
|
14
|
+
.file_name_part
|
15
|
+
= link_to f.object.attachment_file_name, download_document_path(f.object)
|
16
|
+
.file_size_part
|
17
|
+
= number_to_human_size f.object.attachment_file_size
|
18
|
+
|
19
|
+
|
20
|
+
= link_to_remove_fields t("remove"), f
|
@@ -0,0 +1,11 @@
|
|
1
|
+
.modal.fade
|
2
|
+
.modal-header
|
3
|
+
%button.close{'data-dismiss' => 'modal'}
|
4
|
+
×
|
5
|
+
%h3
|
6
|
+
= sanitize params[:form_title].presence || sanitize(params[:modal_title].presence) || "#{t('creating')} #{t(controller_name.singularize)}"
|
7
|
+
.modal-body
|
8
|
+
.component.form_component.new_form_component
|
9
|
+
.component_content
|
10
|
+
.part.form_part
|
11
|
+
= render 'form'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% rtc_controller_name = params[:rtc_controller_name].presence || controller_name %>
|
2
|
+
<% controller_name_singular = rtc_controller_name.singularize %>
|
3
|
+
<% @controller_name = instance_variable_get("@#{controller_name_singular}") %>
|
4
|
+
|
5
|
+
var $new_item = $('<%= j(render :partial => params[:rtc_partial].presence || controller_name_singular, locals: {"#{controller_name_singular}".to_sym => @controller_name}) %>').st_formatRow().addClass('created');
|
6
|
+
|
7
|
+
var $rtc = $('.rich_table_component.showing_new_form');
|
8
|
+
$rtc.removeClass('showing_new_form');
|
9
|
+
$rtc.find('.resizers').after($new_item);
|
10
|
+
|
11
|
+
$rtc.find('.showing_new_form').removeClass('showing_new_form');
|
12
|
+
$rtc.find('.lvr_entry_edited').removeClass('lvr_entry_edited');
|
13
|
+
$rtc.find('.rtc_empty_message').remove();
|
14
|
+
|
15
|
+
$('.modal').modal('hide');
|
16
|
+
|
17
|
+
|
18
|
+
<% flash[:error].try(:clear) %>
|
19
|
+
<% flash[:notice].try(:clear) %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$('.modal, .modal-backdrop').remove();
|
2
|
+
$('.cke_skin_kama').remove();
|
3
|
+
|
4
|
+
<% params[:remote] = true %>
|
5
|
+
<% params[:form_partial] ||= "form" %>
|
6
|
+
<% params[:form_title] ||= params[:modal_title].presence || "#{t('editing')} #{t(controller_name.singularize)}" %>
|
7
|
+
|
8
|
+
var $modal = $('<%= j(render "edit", form_partial: params[:form_partial], form_title: params[:form_title]) %>');
|
9
|
+
$modal.modal();
|
10
|
+
$modal.on('shown', function(){
|
11
|
+
|
12
|
+
// Fix Rich Table Component
|
13
|
+
renderModalTableGrid();
|
14
|
+
|
15
|
+
// call jquery-file-upload
|
16
|
+
renderJqueryFileUpload();
|
17
|
+
|
18
|
+
// call ckeditor
|
19
|
+
renderRemoteCkeditor();
|
20
|
+
|
21
|
+
// call tokens
|
22
|
+
renderTokens();
|
23
|
+
|
24
|
+
}).on('hidden', function(){
|
25
|
+
$('.showing_new_form').removeClass('showing_new_form');
|
26
|
+
$('.lvr_entry_edited').removeClass('lvr_entry_edited');
|
27
|
+
$('.modal, .modal-backdrop, .token-input-dropdown-bootstrap').remove();
|
28
|
+
});
|
@@ -0,0 +1,7 @@
|
|
1
|
+
var $elmt = $('.updating.rich_table_component');
|
2
|
+
$elmt.find('.rtc_grid').html("<%= j(render "rich_table_component/rtc/table", rtc_controller_name: params[:rtc_controller_name].presence || controller_name, rtc_partial: params[:rtc_partial].presence || nil) %>");
|
3
|
+
$elmt.st_tableGrid_update();
|
4
|
+
<% if params[:page].present? || params[:per_page].present? %>
|
5
|
+
$elmt.find('.pagination_area').html("<%= j(render "rich_table_component/pagination", rtc_controller_name: params[:rtc_controller_name].presence || controller_name ) %>");
|
6
|
+
<% end %>
|
7
|
+
$('.rich_table_component.updating').removeClass('updating');
|
@@ -0,0 +1,87 @@
|
|
1
|
+
- rtc_controller_name = params[:rtc_controller_name].presence || controller_name
|
2
|
+
- rtc_class_name = rtc_controller_name.classify if rtc_class_name.nil?
|
3
|
+
|
4
|
+
- @rtc_controller_name = instance_variable_get("@#{rtc_controller_name}")
|
5
|
+
|
6
|
+
%h2= "Tabel " + t(rtc_controller_name.classify.underscore)
|
7
|
+
%table{:border => "0", :cellpadding => "0", :cellspacing => "0"}
|
8
|
+
%tr
|
9
|
+
- puts params[:export_attribute_ids]
|
10
|
+
- params[:export_attribute_ids].each do |att|
|
11
|
+
- attribute = att.to_s
|
12
|
+
%th
|
13
|
+
.cell= t((attribute.split('.').last(2) - ['to_s']).join('_').presence || @rtc_controller_name.klass.name.underscore)
|
14
|
+
- @rtc_controller_name.each do |rtc|
|
15
|
+
%tr
|
16
|
+
- params[:export_attribute_ids].each do |att|
|
17
|
+
- attribute = att.to_s
|
18
|
+
- splitter = attribute.split('.')
|
19
|
+
- splitter.unshift(rtc)
|
20
|
+
- val = splitter.inject do |ret, n|
|
21
|
+
- if ret.respond_to? :collect
|
22
|
+
- ret.collect(&(n.to_sym))
|
23
|
+
- else
|
24
|
+
- ret.try(n)
|
25
|
+
- val = val.join(', ') if val.instance_of? Array
|
26
|
+
|
27
|
+
- case val.class.to_s
|
28
|
+
- when 'String'
|
29
|
+
- cell_type = "String"
|
30
|
+
- when 'Fixnum'
|
31
|
+
- cell_type = "Number"
|
32
|
+
- when 'ActiveSupport::TimeWithZone'
|
33
|
+
- cell_type = "String"
|
34
|
+
- when 'Date'
|
35
|
+
- cell_type = "String"
|
36
|
+
- when 'NilClass'
|
37
|
+
- cell_type = nil
|
38
|
+
- else
|
39
|
+
- cell_type = "String"
|
40
|
+
- if cell_type == nil
|
41
|
+
%td{"ss:StyleID" => "Content"}
|
42
|
+
- else
|
43
|
+
%td{class: "#{cell_type.underscore}"}
|
44
|
+
.cell= strip_tags(val.to_s)
|
45
|
+
|
46
|
+
%style{:type => "text/css"}
|
47
|
+
:css
|
48
|
+
table{
|
49
|
+
border-collapse: collapse;
|
50
|
+
border: 0;
|
51
|
+
font-size: 10px;
|
52
|
+
font-family: arial, tahoma, verdana, sans-serif;
|
53
|
+
color: #111;
|
54
|
+
margin: 0;
|
55
|
+
}
|
56
|
+
tr{
|
57
|
+
border: 0;
|
58
|
+
margin: 0;
|
59
|
+
}
|
60
|
+
th{
|
61
|
+
margin: 0;
|
62
|
+
padding: 7px 15px;
|
63
|
+
font-weight: bold;
|
64
|
+
color: #111;
|
65
|
+
background: #F1F1F1;
|
66
|
+
border: 1px solid #F0F0F0;
|
67
|
+
border-left: 0;
|
68
|
+
}
|
69
|
+
th:nth-child(1){
|
70
|
+
border-left: 1px solid #F0F0F0;
|
71
|
+
}
|
72
|
+
td{
|
73
|
+
margin: 0;
|
74
|
+
padding: 7px 10px;
|
75
|
+
background: #F8F8F8;
|
76
|
+
border: 0;
|
77
|
+
border-bottom: 1px solid #F0F0F0;
|
78
|
+
border-right: 1px solid #F0F0F0;
|
79
|
+
color: #444;
|
80
|
+
text-align: center;
|
81
|
+
}
|
82
|
+
tr:nth-child(2n) td{
|
83
|
+
background: #fff;
|
84
|
+
}
|
85
|
+
td:nth-child(1){
|
86
|
+
border-left: 1px solid #F0F0F0;
|
87
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
!!! XML
|
2
|
+
%Workbook{:xmlns => "urn:schemas-microsoft-com:office:spreadsheet", "xmlns:html" => "http://www.w3.org/TR/REC-html40", "xmlns:o" => "urn:schemas-microsoft-com:office:office", "xmlns:ss" => "urn:schemas-microsoft-com:office:spreadsheet", "xmlns:x" => "urn:schemas-microsoft-com:office:excel"}
|
3
|
+
%Styles
|
4
|
+
%Style{"ss:ID" => "Title"}
|
5
|
+
%Font{"ss:Bold" => "1", "ss:Size" => "16"}
|
6
|
+
%Style{"ss:ID" => "Header"}
|
7
|
+
%Borders
|
8
|
+
%Border{"ss:Color" => "#666666", "ss:LineStyle" => "Continuous", "ss:Position" => "Left", "ss:Weight" => "1"}
|
9
|
+
%Border{"ss:Color" => "#666666", "ss:LineStyle" => "Continuous", "ss:Position" => "Top", "ss:Weight" => "1"}
|
10
|
+
%Border{"ss:Color" => "#666666", "ss:LineStyle" => "Continuous", "ss:Position" => "Right", "ss:Weight" => "1"}
|
11
|
+
%Border{"ss:Color" => "#666666", "ss:LineStyle" => "Continuous", "ss:Position" => "Bottom", "ss:Weight" => "1"}
|
12
|
+
%Font{"ss:Bold" => "1", "ss:Color" => "#333333", "ss:Size" => "11"}
|
13
|
+
%Interior{"ss:Color" => "#DDDDDD", "ss:Pattern" => "Solid"}
|
14
|
+
%Style{"ss:ID" => "Content"}
|
15
|
+
%Borders
|
16
|
+
%Border{"ss:Color" => "#666666", "ss:LineStyle" => "Continuous", "ss:Position" => "Left", "ss:Weight" => "1"}
|
17
|
+
%Border{"ss:Color" => "#666666", "ss:LineStyle" => "Continuous", "ss:Position" => "Right", "ss:Weight" => "1"}
|
18
|
+
%Border{"ss:Color" => "#666666", "ss:LineStyle" => "Continuous", "ss:Position" => "Bottom", "ss:Weight" => "1"}
|
19
|
+
%Font{"ss:Color" => "#333333", "ss:Size" => "11"}
|
20
|
+
%Worksheet{"ss:Name" => "Sheet1"}
|
21
|
+
- rtc_controller_name = params[:rtc_controller_name].presence || controller_name
|
22
|
+
- rtc_class_name = rtc_controller_name.classify if rtc_class_name.nil?
|
23
|
+
- @rtc_controller_name = instance_variable_get("@#{rtc_controller_name}")
|
24
|
+
%Table
|
25
|
+
%Column{"ss:AutoFitWidth" => "1"}
|
26
|
+
%Row
|
27
|
+
%Cell{"ss:StyleID" => "Title"}
|
28
|
+
%Data{"ss:Type" => "String"}= "Tabel " + t(rtc_controller_name.classify.underscore)
|
29
|
+
%Row{"ss:Index" => "3"}
|
30
|
+
- params[:export_attribute_ids].each do |att|
|
31
|
+
- attribute = att.to_s
|
32
|
+
%Cell{"ss:StyleID" => "Header"}
|
33
|
+
%Data{"ss:Type" => "String"}= t((attribute.split('.').last(2) - ['to_s']).join('_').presence || @rtc_controller_name.klass.name.underscore)
|
34
|
+
- @rtc_controller_name.each do |rtc|
|
35
|
+
%Row
|
36
|
+
- params[:export_attribute_ids].each do |att|
|
37
|
+
- attribute = att.to_s
|
38
|
+
- splitter = attribute.split('.')
|
39
|
+
- splitter.unshift(rtc)
|
40
|
+
- val = splitter.inject do |ret, n|
|
41
|
+
- if ret.respond_to? :collect
|
42
|
+
- ret.collect(&(n.to_sym))
|
43
|
+
- else
|
44
|
+
- ret.try(n)
|
45
|
+
- val = val.join(', ') if val.instance_of? Array
|
46
|
+
|
47
|
+
- case val.class.to_s
|
48
|
+
- when 'String'
|
49
|
+
- cell_type = "String"
|
50
|
+
- when 'Fixnum'
|
51
|
+
- cell_type = "Number"
|
52
|
+
- when 'ActiveSupport::TimeWithZone'
|
53
|
+
- cell_type = "String"
|
54
|
+
- when 'Date'
|
55
|
+
- cell_type = "String"
|
56
|
+
- when 'NilClass'
|
57
|
+
- cell_type = nil
|
58
|
+
- else
|
59
|
+
- cell_type = "String"
|
60
|
+
- if cell_type == nil
|
61
|
+
%Cell{"ss:StyleID" => "Content"}
|
62
|
+
- else
|
63
|
+
%Cell{"ss:StyleID" => "Content"}
|
64
|
+
%Data{"ss:Type" => cell_type}= strip_tags(val.to_s)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$('.modal, .modal-backdrop').remove();
|
2
|
+
|
3
|
+
<% params[:remote] = true %>
|
4
|
+
|
5
|
+
var $modal = $('<%= j(render "new") %>');
|
6
|
+
$modal.modal();
|
7
|
+
$modal.on('shown', function(){
|
8
|
+
// Fix Rich Table Component
|
9
|
+
renderModalTableGrid();
|
10
|
+
|
11
|
+
// call jquery-file-upload
|
12
|
+
renderJqueryFileUpload();
|
13
|
+
|
14
|
+
// call ckeditor
|
15
|
+
renderRemoteCkeditor();
|
16
|
+
|
17
|
+
// call tokens
|
18
|
+
renderTokens();
|
19
|
+
|
20
|
+
}).on('hidden', function(){
|
21
|
+
$('.showing_new_form').removeClass('showing_new_form');
|
22
|
+
$('.lvr_entry_edited').removeClass('lvr_entry_edited');
|
23
|
+
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% if @recapitulation_error.present? %>
|
2
|
+
recapitulation_error = <%=raw @recapitulation_error %>;
|
3
|
+
recapitulation_matrix = null;
|
4
|
+
<% else %>
|
5
|
+
recapitulation_error = null;
|
6
|
+
<% if @recapitulation_matrix.present? %>
|
7
|
+
recapitulation_matrix = <%=raw @recapitulation_matrix %>;
|
8
|
+
<% else %>
|
9
|
+
recapitulation_error = {message: 'Tidak ada data, silakan ulangi pencarian'};
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
%h1.title
|
2
|
+
= t('recapitulation')
|
3
|
+
- if @recapitulation_matrix.present?
|
4
|
+
- label_cols = @recapitulation_matrix.shift
|
5
|
+
%table{:border => "0", :cellpadding => "0", :cellspacing => "0"}
|
6
|
+
%tr
|
7
|
+
- label_cols.each_with_index do |label_col, i|
|
8
|
+
- if i == 0
|
9
|
+
%th.label
|
10
|
+
= label_col
|
11
|
+
- else
|
12
|
+
%th
|
13
|
+
= label_col
|
14
|
+
- @recapitulation_matrix.each do |row|
|
15
|
+
%tr
|
16
|
+
- row.each_with_index do |cell, i|
|
17
|
+
- if i == 0
|
18
|
+
%td.label
|
19
|
+
= strip_tags(cell.to_s)
|
20
|
+
- else
|
21
|
+
%td
|
22
|
+
= strip_tags(cell.to_s)
|
23
|
+
|
24
|
+
%style{:type => "text/css"}
|
25
|
+
:css
|
26
|
+
table{
|
27
|
+
border-collapse: collapse;
|
28
|
+
border: 0;
|
29
|
+
font-size: 10px;
|
30
|
+
color: #111;
|
31
|
+
margin: 0;
|
32
|
+
}
|
33
|
+
tr{
|
34
|
+
border: 0;
|
35
|
+
margin: 0;
|
36
|
+
}
|
37
|
+
th{
|
38
|
+
margin: 0;
|
39
|
+
padding: 7px 15px;
|
40
|
+
font-weight: bold;
|
41
|
+
color: #111;
|
42
|
+
background: #F1F1F1;
|
43
|
+
border: 1px solid #F0F0F0;
|
44
|
+
border-left: 0;
|
45
|
+
border_bottom: 2px solid #cecece;
|
46
|
+
}
|
47
|
+
th.label{
|
48
|
+
border-left: 1px solid #F0F0F0;
|
49
|
+
}
|
50
|
+
td{
|
51
|
+
margin: 0;
|
52
|
+
padding: 7px 10px;
|
53
|
+
background: #F8F8F8;
|
54
|
+
border: 0;
|
55
|
+
border-bottom: 1px solid #F0F0F0;
|
56
|
+
border-right: 1px solid #F0F0F0;
|
57
|
+
color: #444;
|
58
|
+
text-align: center;
|
59
|
+
}
|
60
|
+
tr:nth-child(2n) td{
|
61
|
+
background: #fff;
|
62
|
+
}
|
63
|
+
td.label{
|
64
|
+
text-align :left;
|
65
|
+
font-weight: bold;
|
66
|
+
color: #111;
|
67
|
+
border-left: 1px solid #F0F0F0;
|
68
|
+
}
|