drg_cms 0.5.52.12 → 0.6.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/javascripts/drg_cms/drg_cms.js +395 -120
- data/app/assets/javascripts/drg_cms/jstree.min.js +6 -6
- data/app/assets/javascripts/drg_cms_application.js +1 -1
- data/app/assets/stylesheets/drg_cms/drg_cms.css +476 -215
- data/app/assets/stylesheets/drg_cms/jstree.css +6 -12
- data/app/assets/stylesheets/drg_cms/select-multiple.css +19 -13
- data/app/assets/stylesheets/drg_cms_cms.css +1 -1
- data/app/controllers/cmsedit_controller.rb +474 -233
- data/app/controllers/dc_application_controller.rb +264 -41
- data/app/controllers/dc_common_controller.rb +75 -63
- data/app/{controllers → controls}/browse_models_control.rb +0 -0
- data/app/{controllers → controls}/dc_page_control.rb +24 -8
- data/app/controls/dc_poll_result_control.rb +88 -0
- data/app/controls/dc_report.rb +227 -0
- data/app/{controllers → controls}/design_element_settings_control.rb +0 -0
- data/app/forms/all_options.yml +70 -12
- data/app/forms/cms_menu.yml +26 -17
- data/app/forms/dc_ad.yml +11 -22
- data/app/forms/dc_big_table.yml +1 -0
- data/app/forms/dc_big_table_value.yml +1 -0
- data/app/forms/dc_design.yml +19 -16
- data/app/forms/dc_filter.yml +3 -6
- data/app/forms/dc_gallery.yml +53 -0
- data/app/forms/dc_json_ld.yml +59 -0
- data/app/forms/dc_key_value.yml +32 -0
- data/app/forms/dc_link.yml +16 -10
- data/app/forms/dc_menu_item.yml +6 -0
- data/app/forms/dc_page.yml +2 -7
- data/app/forms/dc_poll.yml +16 -9
- data/app/forms/dc_poll_item.yml +2 -1
- data/app/forms/dc_poll_result.yml +83 -0
- data/app/forms/dc_poll_result_export.yml +35 -0
- data/app/forms/dc_removed_url.yml +42 -0
- data/app/forms/dc_seo.yml +33 -0
- data/app/forms/dc_site.yml +2 -6
- data/app/forms/json_ld_schema.yml +168 -0
- data/app/helpers/cms_common_helper.rb +311 -0
- data/app/helpers/cms_edit_helper.rb +498 -0
- data/app/helpers/cms_helper.rb +230 -0
- data/app/helpers/cms_index_helper.rb +564 -0
- data/app/helpers/dc_application_helper.rb +195 -268
- data/app/models/{dc_dummy.rb → __dc_dummy.rb} +0 -0
- data/app/models/concerns/dc_page_concern.rb +31 -6
- data/app/models/concerns/dc_seo_concern.rb +66 -0
- data/app/models/concerns/dc_site_concern.rb +12 -1
- data/app/models/concerns/dc_user_concern.rb +5 -3
- data/app/models/dc_design.rb +2 -0
- data/app/models/dc_filter.rb +37 -20
- data/app/models/dc_gallery.rb +64 -0
- data/app/models/dc_json_ld.rb +152 -0
- data/app/models/dc_key_value.rb +48 -0
- data/app/models/dc_link.rb +1 -0
- data/app/models/dc_memory.rb +26 -4
- data/app/models/dc_page.rb +1 -2
- data/app/models/dc_permission.rb +30 -0
- data/app/models/dc_poll.rb +39 -19
- data/app/models/dc_poll_result.rb +46 -0
- data/app/models/dc_removed_url.rb +54 -0
- data/app/models/dc_temp.rb +140 -0
- data/app/models/drgcms_form_fields.rb +6 -1642
- data/app/models/drgcms_form_fields/action.rb +61 -0
- data/app/models/drgcms_form_fields/check_box.rb +72 -0
- data/app/models/drgcms_form_fields/comment.rb +53 -0
- data/app/models/drgcms_form_fields/date_picker.rb +104 -0
- data/app/models/drgcms_form_fields/date_select.rb +68 -0
- data/app/models/drgcms_form_fields/datetime_picker.rb +89 -0
- data/app/models/drgcms_form_fields/datetime_select.rb +73 -0
- data/app/models/drgcms_form_fields/drgcms_field.rb +287 -0
- data/app/models/drgcms_form_fields/embedded.rb +97 -0
- data/app/models/drgcms_form_fields/file_field.rb +52 -0
- data/app/models/drgcms_form_fields/file_select.rb +70 -0
- data/app/models/drgcms_form_fields/hash_field.rb +86 -0
- data/app/models/drgcms_form_fields/hidden_field.rb +52 -0
- data/app/models/drgcms_form_fields/html_field.rb +70 -0
- data/app/models/drgcms_form_fields/journal_diff.rb +60 -0
- data/app/models/drgcms_form_fields/link_to.rb +69 -0
- data/app/models/drgcms_form_fields/method.rb +65 -0
- data/app/models/drgcms_form_fields/multitext_autocomplete.rb +204 -0
- data/app/models/drgcms_form_fields/number_field.rb +92 -0
- data/app/models/drgcms_form_fields/password_field.rb +62 -0
- data/app/models/drgcms_form_fields/radio.rb +96 -0
- data/app/models/drgcms_form_fields/readonly.rb +79 -0
- data/app/models/drgcms_form_fields/select.rb +226 -0
- data/app/models/drgcms_form_fields/submit_tag.rb +58 -0
- data/app/models/drgcms_form_fields/text_area.rb +68 -0
- data/app/models/drgcms_form_fields/text_autocomplete.rb +155 -0
- data/app/models/drgcms_form_fields/text_field.rb +56 -0
- data/app/models/drgcms_form_fields/text_with_select.rb +95 -0
- data/app/models/drgcms_form_fields/tree_select.rb +169 -0
- data/app/{helpers → renderers}/dc_ad_renderer.rb +0 -0
- data/app/{helpers → renderers}/dc_big_menu_renderer.rb +1 -0
- data/app/{helpers → renderers}/dc_captcha_renderer.rb +0 -0
- data/app/{helpers → renderers}/dc_common_renderer.rb +0 -0
- data/app/renderers/dc_gallery_renderer.rb +95 -0
- data/app/{helpers → renderers}/dc_menu_renderer.rb +11 -4
- data/app/{helpers → renderers}/dc_page_renderer.rb +21 -3
- data/app/{helpers → renderers}/dc_part_renderer.rb +5 -4
- data/app/{helpers → renderers}/dc_piece_renderer.rb +1 -1
- data/app/{helpers → renderers}/dc_poll_renderer.rb +86 -51
- data/app/{helpers → renderers}/dc_renderer.rb +1 -0
- data/app/{helpers → renderers}/dc_simple_menu_renderer.rb +1 -0
- data/app/views/cmsedit/{remove_edit_stuff.js.erb → __remove_edit_stuff.js.erb} +0 -0
- data/app/views/cmsedit/{show.html.erb → __show.html.erb} +0 -0
- data/app/views/cmsedit/_edit_stuff.html.erb +4 -25
- data/app/views/cmsedit/_form.html.erb +4 -3
- data/app/views/cmsedit/_result.html.erb +2 -3
- data/app/views/cmsedit/edit.html.erb +2 -1
- data/app/views/cmsedit/index.html.erb +6 -1
- data/app/views/cmsedit/new.html.erb +1 -1
- data/config/locales/drgcms_en.yml +15 -3
- data/config/locales/drgcms_sl.yml +18 -6
- data/config/locales/models_en.yml +103 -19
- data/config/locales/models_sl.yml +102 -17
- data/drg_cms.gemspec +3 -3
- data/lib/drg_cms.rb +6 -2
- data/lib/drg_cms/version.rb +2 -2
- data/lib/generators/new_drg_form/new_drg_form_generator.rb +9 -2
- data/lib/tasks/database.rake +6 -56
- data/lib/tasks/dc_cleanup.rake +1 -1
- metadata +106 -61
- data/app/assets/stylesheets/drg_cms/__jquery-ui.css +0 -339
- data/app/helpers/application_helper.rb +0 -2
- data/app/helpers/cmsedit_helper.rb +0 -844
- data/test/fixtures/drg_cms_test_data.rb +0 -87
File without changes
|
@@ -31,12 +31,29 @@ module DcPageControl
|
|
31
31
|
# Called when new empty record is created
|
32
32
|
######################################################################
|
33
33
|
def dc_new_record()
|
34
|
-
|
35
|
-
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
# Called from menu. Fill in values, that could be obtained from menu
|
35
|
+
if params[:from_menu]
|
36
|
+
# find menu and submenu. Menu class is defined in Site.
|
37
|
+
menu_a = params[:id].split(';')
|
38
|
+
menu = dc_get_site.menu_klass.find(menu_a.shift)
|
39
|
+
menu_items_method = "#{dc_get_site.menu_class}_items".underscore
|
40
|
+
menu_i = menu.send(menu_items_method).find(menu_a.shift)
|
41
|
+
while menu_a.size > 0 do menu_i = menu_i.send(menu_items_method).find(menu_a.shift) end
|
42
|
+
# Fill values for form
|
43
|
+
@record.subject = menu_i.caption
|
44
|
+
@record.dc_site_id = menu.dc_site_id
|
45
|
+
@record.menu_id = params[:id]
|
46
|
+
# set update_menu on save parameter
|
47
|
+
params['p__update_menu'] = '1'
|
48
|
+
else
|
49
|
+
@record.design_id = params[:design_id] if params[:design_id]
|
50
|
+
return unless params[:page_id]
|
51
|
+
# inherit some values from currently active page
|
52
|
+
if page = DcPage.find(params[:page_id])
|
53
|
+
@record.design_id = page.design_id
|
54
|
+
@record.menu = page.menu
|
55
|
+
@record.dc_site_id = page.dc_site_id
|
56
|
+
end
|
40
57
|
end
|
41
58
|
end
|
42
59
|
|
@@ -44,8 +61,7 @@ end
|
|
44
61
|
# Called just after record is saved to DB.
|
45
62
|
######################################################################
|
46
63
|
def dc_after_save()
|
47
|
-
if params
|
48
|
-
# menu_class = dc_get_site.menu_class.classify.constantize
|
64
|
+
if params.dig(:_record,:_update_menu).to_s == '1'
|
49
65
|
dc_get_site.menu_klass.update_menu_item_link(@record)
|
50
66
|
end
|
51
67
|
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2014+ Damjan Rems
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
#++
|
24
|
+
|
25
|
+
######################################################################
|
26
|
+
# DrgcmsControls for DcPage model.
|
27
|
+
######################################################################
|
28
|
+
module DcPollResultControl
|
29
|
+
|
30
|
+
######################################################################
|
31
|
+
# Filter result data when filter is set
|
32
|
+
######################################################################
|
33
|
+
def poll_filter()
|
34
|
+
get_query
|
35
|
+
end
|
36
|
+
|
37
|
+
######################################################################
|
38
|
+
# Filter action called. Update url to reflect filter conditions and reload form.
|
39
|
+
######################################################################
|
40
|
+
def do_filter
|
41
|
+
url = url_for(controller: :cmsedit, action: :index, table: :dc_poll_result,
|
42
|
+
'record[dc_poll_id]' => params[:record][:dc_poll_id],
|
43
|
+
'record[start_date]' => params[:record][:start_date],
|
44
|
+
'record[end_date]' => params[:record][:end_date]
|
45
|
+
)
|
46
|
+
dc_render_ajax(operation: :url, value: url)
|
47
|
+
end
|
48
|
+
|
49
|
+
######################################################################
|
50
|
+
# Export data to file
|
51
|
+
######################################################################
|
52
|
+
def do_export
|
53
|
+
c, keys = '', []
|
54
|
+
get_query.to_a.each do |doc|
|
55
|
+
# ensure, that fields are always in same order
|
56
|
+
data = YAML.load(doc.data)
|
57
|
+
if c.blank?
|
58
|
+
data.each {|k,v| keys << k}
|
59
|
+
c << I18n.t('helpers.label.dc_poll_result.created_at') + "\t"
|
60
|
+
c << keys.join("\t") + "\n"
|
61
|
+
end
|
62
|
+
c << doc.created_at.strftime(I18n.t('date.formats.default') ) + "\t"
|
63
|
+
keys.each {|k| c << data[k] + "\t"}
|
64
|
+
c << "\n"
|
65
|
+
end
|
66
|
+
File.write(Rails.root.join('public','export.csv'), c)
|
67
|
+
dc_render_ajax(operation: :window, value: 'export.csv')
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
######################################################################
|
72
|
+
# Creates query for Poll results
|
73
|
+
######################################################################
|
74
|
+
def get_query()
|
75
|
+
if params.dig(:record,:dc_poll_id).nil?
|
76
|
+
qry = DcPollResult.all
|
77
|
+
else
|
78
|
+
qry = DcPollResult.where(dc_poll_id: params[:record][:dc_poll_id])
|
79
|
+
unless params[:record][:start_date].blank?
|
80
|
+
start_date = DrgcmsFormFields::DatePicker.get_data(params,'start_date').beginning_of_day
|
81
|
+
end_date = DrgcmsFormFields::DatePicker.get_data(params,'end_date').end_of_day
|
82
|
+
qry = qry.and(:created_at.gt => start_date).and(:created_at.lt => end_date)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
qry
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2020+ Damjan Rems
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
######################################################################
|
25
|
+
# Common methods required by reports
|
26
|
+
######################################################################
|
27
|
+
module DcReport
|
28
|
+
attr_accessor :report_id
|
29
|
+
attr_accessor :bulk
|
30
|
+
|
31
|
+
######################################################################
|
32
|
+
# Clear result if params[:clear] is 'yes' when form is first displayed
|
33
|
+
######################################################################
|
34
|
+
def dc_new_record
|
35
|
+
DcTemp.clear(temp_key) unless params[:clear].to_s == 'no'
|
36
|
+
end
|
37
|
+
|
38
|
+
######################################################################
|
39
|
+
# Check if report option is present in form and shuffle form, so it can
|
40
|
+
# be used to display result.
|
41
|
+
######################################################################
|
42
|
+
def dc_update_form
|
43
|
+
return unless @form && @form['report'] && params[:table] = 'dc_temp'
|
44
|
+
|
45
|
+
# copy form data under report option to top
|
46
|
+
@form['report'].each { |key, data| @form[key] = data }
|
47
|
+
end
|
48
|
+
|
49
|
+
######################################################################
|
50
|
+
# Print to PDF action
|
51
|
+
######################################################################
|
52
|
+
def print
|
53
|
+
begin
|
54
|
+
pdf_do
|
55
|
+
rescue Exception => e
|
56
|
+
dc_dump_exception(e)
|
57
|
+
render json: { msg_error: t('drgcms.runtime_error') } and return
|
58
|
+
end
|
59
|
+
|
60
|
+
pdf_file = "tmp/dokument-#{Time.now.to_i}.pdf"
|
61
|
+
@pdf.render_file Rails.root.join('public', pdf_file)
|
62
|
+
|
63
|
+
render json: print_response(pdf_file)
|
64
|
+
end
|
65
|
+
|
66
|
+
######################################################################
|
67
|
+
# Export data do excel action
|
68
|
+
######################################################################
|
69
|
+
def export
|
70
|
+
export_to_excel( temp_key )
|
71
|
+
end
|
72
|
+
|
73
|
+
######################################################################
|
74
|
+
# Default filter to select data for result.
|
75
|
+
######################################################################
|
76
|
+
def data_filter
|
77
|
+
params['clear'].to_s == 'yes' ? DcTemp.where(key: false) : DcTemp.where(key: temp_key).order_by(order: 1)
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
######################################################################
|
83
|
+
# Will create response message for print action. Response consists of
|
84
|
+
# opening pdf file in new browser tab and additional print_message if defined.
|
85
|
+
######################################################################
|
86
|
+
def print_response(pdf_file)
|
87
|
+
response = { window: "/#{pdf_file}" }
|
88
|
+
response.merge!(report_message) if respond_to?(:report_message, true)
|
89
|
+
response
|
90
|
+
end
|
91
|
+
|
92
|
+
######################################################################
|
93
|
+
# Temp key consists of report name and user's id. Key should be added
|
94
|
+
# to every dc_temp document and is used to define data, which belongs
|
95
|
+
# to current user.
|
96
|
+
######################################################################
|
97
|
+
def temp_key
|
98
|
+
"#{@report_id}-#{session[:user_id]}"
|
99
|
+
end
|
100
|
+
|
101
|
+
######################################################################
|
102
|
+
# Initialize report. Set report_id internal variable and initialize bulk
|
103
|
+
# for bulk saving data to dc_temp collection.
|
104
|
+
######################################################################
|
105
|
+
def init_report(id)
|
106
|
+
@report_id = id
|
107
|
+
@bulk = []
|
108
|
+
end
|
109
|
+
|
110
|
+
######################################################################
|
111
|
+
# Check if all send fields are blank.
|
112
|
+
######################################################################
|
113
|
+
def all_blank?(*fields)
|
114
|
+
fields.each {|e| e.blank? ? true : (break false) }
|
115
|
+
end
|
116
|
+
|
117
|
+
######################################################################
|
118
|
+
# Will write bulk data to dc_temp collection.
|
119
|
+
######################################################################
|
120
|
+
def bulk_write(doc, the_end = false)
|
121
|
+
if doc.class == TrueClass
|
122
|
+
the_end = true
|
123
|
+
else
|
124
|
+
@bulk << doc
|
125
|
+
end
|
126
|
+
|
127
|
+
if (the_end && @bulk.size > 0) || @bulk.size > 100
|
128
|
+
DcTemp.collection.insert_many(@bulk)
|
129
|
+
@bulk = []
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
######################################################################
|
134
|
+
# Export data to Excel
|
135
|
+
######################################################################
|
136
|
+
def export_to_excel(report_id)
|
137
|
+
read_drg_cms_form if @form.blank?
|
138
|
+
# use report options if present
|
139
|
+
columns = (@form['report'] ? @form['report'] : @form)['result_set']['columns'].sort
|
140
|
+
|
141
|
+
n, workbook = 0, Spreadsheet::Workbook.new
|
142
|
+
excel = workbook.create_worksheet(name: report_id)
|
143
|
+
# header
|
144
|
+
columns.each_with_index do |column, i|
|
145
|
+
caption = column.last['caption'] || column.last['label']
|
146
|
+
label = t(caption)
|
147
|
+
excel[n, i] = label.match('translation missing') ? caption : label
|
148
|
+
end
|
149
|
+
|
150
|
+
data_filter.each do |doc|
|
151
|
+
n += 1
|
152
|
+
columns.each_with_index do |column, i|
|
153
|
+
value = doc[column.last['name']].to_s.gsub('<br>', ";")
|
154
|
+
value = value.gsub(/\<\/strong\>|\<strong\>|\<\/b\>|\<b\>/, '')
|
155
|
+
excel[n, i] = value
|
156
|
+
end
|
157
|
+
end
|
158
|
+
workbook.write Rails.root.join("public/tmp/#{report_id}.xls")
|
159
|
+
dc_render_ajax(operation: :window, value: "/tmp/#{report_id}.xls")
|
160
|
+
end
|
161
|
+
|
162
|
+
############################################################################
|
163
|
+
# Returns html code for displaying date/time formatted by strftime. Will return '' if value is nil.
|
164
|
+
#
|
165
|
+
# Parameters:
|
166
|
+
# [value] Date/DateTime/Time.
|
167
|
+
# [format] String. strftime format mask. Defaults to locale's default format.
|
168
|
+
############################################################################
|
169
|
+
def dc_format_date_time(value, format = nil)
|
170
|
+
return '' if value.nil?
|
171
|
+
|
172
|
+
format ||= value.class == Date ? t('date.formats.default') : t('time.formats.default')
|
173
|
+
value.strftime(format)
|
174
|
+
end
|
175
|
+
|
176
|
+
##############################################################################
|
177
|
+
# Initialize PDF document for print
|
178
|
+
##############################################################################
|
179
|
+
def pdf_init(opts={})
|
180
|
+
opts[:margin] ||= [30,30,30,30]
|
181
|
+
opts[:page_size] ||= 'A4'
|
182
|
+
|
183
|
+
pdf = Prawn::Document.new(opts)
|
184
|
+
pdf.font_size = opts[:font_size] if opts[:font_size]
|
185
|
+
|
186
|
+
pdf.encrypt_document( owner_password: :random,
|
187
|
+
permissions: { print_document: true,
|
188
|
+
modify_contents: false,
|
189
|
+
copy_contents: false,
|
190
|
+
modify_annotations: false })
|
191
|
+
pdf.font_families.update(
|
192
|
+
'Arial' => { normal: Rails.root.join('public', 'arial.ttf'),
|
193
|
+
bold: Rails.root.join('public', 'arialbd.ttf') }
|
194
|
+
)
|
195
|
+
pdf.font 'Arial'
|
196
|
+
pdf
|
197
|
+
end
|
198
|
+
|
199
|
+
################################################################################
|
200
|
+
# Prints out single text (or object) on report.
|
201
|
+
#
|
202
|
+
# @param [Object] txt : Text or object. Result of to_s method of the object is
|
203
|
+
# @param [Hash] opts
|
204
|
+
###############################################################################
|
205
|
+
def pdf_text(txt, opts={})
|
206
|
+
box_opts = {}
|
207
|
+
ypos = @pdf.cursor
|
208
|
+
xpos = opts.delete(:atx) || 0
|
209
|
+
box_opts.merge!(single_line: (opts.delete(:single_line) || true))
|
210
|
+
box_opts.merge!(at: (opts.delete(:at) || [xpos, ypos]))
|
211
|
+
box_opts.merge!(width: opts[:width]) if opts[:width]
|
212
|
+
box_opts.merge!(align: opts[:align]) if opts[:align]
|
213
|
+
box_opts.merge!(inline_format: opts[:inline_format]) if opts[:inline_format]
|
214
|
+
|
215
|
+
@pdf.text_box(txt.to_s, box_opts)
|
216
|
+
end
|
217
|
+
|
218
|
+
################################################################################
|
219
|
+
# Skip line on report
|
220
|
+
#
|
221
|
+
# @param [Integer] skip . Number of lines to skip. Default 1.
|
222
|
+
###############################################################################
|
223
|
+
def pdf_skip(skip = 1)
|
224
|
+
@pdf.text('<br>' * skip, inline_format: true)
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
File without changes
|
data/app/forms/all_options.yml
CHANGED
@@ -3,13 +3,23 @@
|
|
3
3
|
extend: form_name
|
4
4
|
table: table_name
|
5
5
|
title: Some title
|
6
|
+
title:
|
7
|
+
text: Dynamicaly defined title
|
8
|
+
eval: SomeClass.title_method
|
6
9
|
controls: controls_file
|
7
10
|
readonly: 1
|
8
11
|
permissions:
|
9
12
|
can_view: role_name
|
13
|
+
|
14
|
+
script: "
|
15
|
+
javascript code
|
16
|
+
"
|
10
17
|
|
11
18
|
index:
|
12
19
|
filter: name, id as text_field
|
20
|
+
select_fields: id,name
|
21
|
+
deny_fields: body,email
|
22
|
+
|
13
23
|
actions: standard
|
14
24
|
|
15
25
|
actions:
|
@@ -18,6 +28,7 @@ index:
|
|
18
28
|
3: sort
|
19
29
|
|
20
30
|
actions:
|
31
|
+
standard: yes
|
21
32
|
1:
|
22
33
|
type: new
|
23
34
|
caption: Alternative caption
|
@@ -27,6 +38,9 @@ index:
|
|
27
38
|
url: some_url
|
28
39
|
caption: Some caption
|
29
40
|
title: Text for mouse over
|
41
|
+
html:
|
42
|
+
class: dc-link-spinner
|
43
|
+
data-confirm: Confirm dialog text.
|
30
44
|
|
31
45
|
3:
|
32
46
|
type: link
|
@@ -41,13 +55,22 @@ index:
|
|
41
55
|
|
42
56
|
result_set:
|
43
57
|
filter: custom_filter
|
58
|
+
footer: custom_footer
|
44
59
|
actions_width: 100
|
45
60
|
per_page: 10
|
61
|
+
|
62
|
+
dblclick:
|
63
|
+
table: model_name
|
64
|
+
form_name: form_name
|
65
|
+
readonly: 1
|
66
|
+
action: show
|
67
|
+
window_close: 1 (close), 2 (history.back)
|
68
|
+
|
46
69
|
table_style: 'color: green;'
|
47
70
|
table_class: tclass
|
48
71
|
tr_style: 'color: green;'
|
49
72
|
tr_class: trclass
|
50
|
-
|
73
|
+
tr_style:
|
51
74
|
eval: "document['result'] < 0 ? 'color: red;' : 'color: #000;'"
|
52
75
|
|
53
76
|
actions: standard
|
@@ -63,6 +86,8 @@ result_set:
|
|
63
86
|
type: delete
|
64
87
|
title: Delete it
|
65
88
|
icon: delete.png
|
89
|
+
icon: arrow-left
|
90
|
+
icon: home
|
66
91
|
4:
|
67
92
|
type: link
|
68
93
|
caption: Caption
|
@@ -78,6 +103,7 @@ result_set:
|
|
78
103
|
name: name
|
79
104
|
eval: dc_name4_id,dc_site,name
|
80
105
|
width: 10%
|
106
|
+
width: none || hidden
|
81
107
|
align: right (center)
|
82
108
|
style: 'color: red;'
|
83
109
|
td_class: class-name
|
@@ -88,6 +114,7 @@ result_set:
|
|
88
114
|
3:
|
89
115
|
name: valid_from
|
90
116
|
format: '%d.%m.%Y'
|
117
|
+
format: N2
|
91
118
|
4:
|
92
119
|
name: active
|
93
120
|
eval: dc_icon4_boolean
|
@@ -100,8 +127,7 @@ form:
|
|
100
127
|
title:
|
101
128
|
edit: Title for edit
|
102
129
|
show: Title for show
|
103
|
-
labels_pos: top
|
104
|
-
|
130
|
+
labels_pos: top
|
105
131
|
|
106
132
|
actions: standard
|
107
133
|
actions: none
|
@@ -109,23 +135,45 @@ form:
|
|
109
135
|
actions:
|
110
136
|
5:
|
111
137
|
type: ajax
|
112
|
-
controller:
|
113
|
-
action:
|
138
|
+
controller: ctrl
|
139
|
+
action: action
|
140
|
+
method: (get),put,post
|
141
|
+
caption: ajax_call
|
142
|
+
control: control_name.method_to_call
|
143
|
+
when_new: false
|
144
|
+
5:
|
145
|
+
type: window
|
146
|
+
controller: cmsedit
|
147
|
+
form_name: form
|
148
|
+
table: table
|
149
|
+
action: edit
|
114
150
|
method: (get),put,post
|
115
|
-
caption:
|
151
|
+
caption: Edit linked document
|
152
|
+
when_new: false
|
153
|
+
params:
|
154
|
+
id:
|
155
|
+
object: record (can be omitted)
|
156
|
+
method: page_id
|
157
|
+
user:
|
158
|
+
object: session
|
159
|
+
method: user_id
|
160
|
+
|
116
161
|
6:
|
117
162
|
type: script
|
118
163
|
caption: Cancle
|
119
|
-
js: parent.reload();
|
164
|
+
js: parent.location.reload();
|
120
165
|
7:
|
121
166
|
type: submit
|
122
167
|
caption: Send
|
168
|
+
when_new: false
|
123
169
|
params:
|
124
170
|
before-save: send_mail
|
125
171
|
after-save: return_to parent.reload
|
126
172
|
|
127
173
|
tabs:
|
128
174
|
tab1:
|
175
|
+
caption: my_caption
|
176
|
+
caption: helpers.label.table.tab1
|
129
177
|
|
130
178
|
10:
|
131
179
|
name: name
|
@@ -176,8 +224,8 @@ form:
|
|
176
224
|
100:
|
177
225
|
name: css
|
178
226
|
type: text_area
|
179
|
-
|
180
|
-
|
227
|
+
size: 100x20
|
228
|
+
|
181
229
|
|
182
230
|
110:
|
183
231
|
name: active
|
@@ -187,20 +235,26 @@ form:
|
|
187
235
|
10:
|
188
236
|
name: form
|
189
237
|
type: text_area
|
238
|
+
size: 100x50
|
190
239
|
html:
|
191
|
-
|
192
|
-
style: 'font-family:courier;'
|
240
|
+
style: 'font-family:courier;'
|
193
241
|
|
194
242
|
tab3:
|
195
243
|
20:
|
196
244
|
name: dc_poll_items
|
197
245
|
type: embedded
|
246
|
+
load: default,delay,always
|
198
247
|
form_name: dc_poll_item
|
199
248
|
html:
|
200
249
|
height: 800
|
201
250
|
20:
|
202
251
|
name: odhod
|
203
|
-
type: datetime_picker
|
252
|
+
type: datetime_picker
|
253
|
+
20:
|
254
|
+
name: gender
|
255
|
+
type: radio
|
256
|
+
inline: true
|
257
|
+
|
204
258
|
40:
|
205
259
|
name: customer_id
|
206
260
|
type: text_autocomplete
|
@@ -209,10 +263,14 @@ form:
|
|
209
263
|
field: custumer_name
|
210
264
|
method: search
|
211
265
|
with_new: customer
|
266
|
+
is_id: false
|
212
267
|
size: 50
|
213
268
|
50:
|
214
269
|
name: kats
|
215
270
|
type: tree_select
|
216
271
|
eval: "DcCategory.choices4_categories(@parent.dc_get_site)"
|
272
|
+
multiple: true
|
273
|
+
parent_disabled: true
|
274
|
+
parent_opened: true
|
217
275
|
style: 'max-height: 300px'
|
218
276
|
|