drg_cms 0.5.52.5 → 0.5.52.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/app/assets/javascripts/drg_cms/drg_cms.js +69 -5
- data/app/assets/stylesheets/drg_cms/drg_cms.css +151 -77
- data/app/controllers/cmsedit_controller.rb +1 -0
- data/app/controllers/dc_common_controller.rb +1 -1
- data/app/forms/all_options.yml +10 -4
- data/app/forms/dc_ad.yml +2 -0
- data/app/forms/dc_design.yml +1 -0
- data/app/forms/dc_link.yml +1 -0
- data/app/forms/dc_menu.yml +1 -2
- data/app/forms/dc_menu_item.yml +11 -18
- data/app/forms/dc_page.yml +1 -0
- data/app/forms/dc_piece.yml +1 -0
- data/app/forms/dc_policy.yml +2 -2
- data/app/forms/dc_policy_rule.yml +1 -0
- data/app/forms/dc_poll.yml +1 -0
- data/app/forms/dc_simple_menu.yml +8 -12
- data/app/forms/dc_simple_menu_item.yml +3 -4
- data/app/forms/dc_site.yml +1 -0
- data/app/helpers/cmsedit_helper.rb +73 -61
- data/app/helpers/dc_application_helper.rb +10 -4
- data/app/helpers/dc_menu_renderer.rb +5 -3
- data/app/models/drgcms_form_fields.rb +1 -1
- data/app/views/cmsedit/__result.html.erb +20 -0
- data/app/views/cmsedit/_form.html.erb +3 -8
- data/app/views/cmsedit/_result.html.erb +8 -2
- data/config/locales/drgcms_en.yml +1 -0
- data/config/locales/drgcms_sl.yml +1 -0
- data/config/locales/models_en.yml +2 -2
- data/lib/drg_cms/version.rb +1 -1
- data/lib/tasks/dc_at_the_beginning.rake +16 -20
- metadata +3 -2
@@ -55,6 +55,7 @@ attr_accessor :page_title
|
|
55
55
|
# all parts read from page, design, ...
|
56
56
|
attr_accessor :parts
|
57
57
|
|
58
|
+
attr_accessor :record_footer
|
58
59
|
|
59
60
|
############################################################################
|
60
61
|
# When @parent is present then helper methods are called from parent class otherwise
|
@@ -253,11 +254,11 @@ end
|
|
253
254
|
# String. HTML code for title.
|
254
255
|
############################################################################
|
255
256
|
def dc_table_title(text, result_set=nil)
|
256
|
-
c =
|
257
|
+
c = %Q[<div class="dc-title">#{text}]
|
257
258
|
if result_set and result_set.respond_to?(:current_page)
|
258
|
-
c <<
|
259
|
+
c << %Q[<div class="dc-paginate">#{paginate(result_set, :params => {:action => 'index'})}</div>]
|
259
260
|
end
|
260
|
-
c << '<
|
261
|
+
c << '<div style="clear: both;"></div></div>'
|
261
262
|
c.html_safe
|
262
263
|
end
|
263
264
|
|
@@ -350,11 +351,14 @@ end
|
|
350
351
|
# Similar to rails link_to, but also takes care of link icon, translation, ...
|
351
352
|
############################################################################
|
352
353
|
def dc_link_to(caption, icon, parms, rest={})
|
354
|
+
icon_pos = 'first'
|
353
355
|
if parms.class == Hash
|
354
356
|
parms.stringify_keys!
|
355
357
|
rest.stringify_keys!
|
356
358
|
rest['class'] = rest['class'].to_s + ' dc-animate'
|
357
359
|
rest['target'] ||= parms.delete('target')
|
360
|
+
parms['controller'] ||= 'cmsedit'
|
361
|
+
icon_pos = parms.delete('icon_pos') || 'first'
|
358
362
|
end
|
359
363
|
#
|
360
364
|
if icon
|
@@ -371,7 +375,9 @@ def dc_link_to(caption, icon, parms, rest={})
|
|
371
375
|
caption = t(caption, caption)
|
372
376
|
icon_image << ' ' if icon_image
|
373
377
|
end
|
374
|
-
|
378
|
+
icon_pos == 'first' ?
|
379
|
+
_origin.link_to("#{icon_image}#{caption}".html_safe, parms, rest) :
|
380
|
+
_origin.link_to("#{caption} #{icon_image}".html_safe, parms, rest)
|
375
381
|
end
|
376
382
|
|
377
383
|
####################################################################
|
@@ -40,8 +40,9 @@ include DcApplicationHelper
|
|
40
40
|
########################################################################
|
41
41
|
def initialize( parent, opts ) #:nodoc:
|
42
42
|
@parent = parent
|
43
|
-
opts[:name]
|
44
|
-
|
43
|
+
@menu = opts[:name] ?
|
44
|
+
DcMenu.find_by(name: opts[:name].to_s) :
|
45
|
+
DcMenu.find(@parent.site.menu_id)
|
45
46
|
@opts = opts
|
46
47
|
self
|
47
48
|
end
|
@@ -108,7 +109,7 @@ end
|
|
108
109
|
# Creates HTML code required for submenu on single level. Subroutine of default.
|
109
110
|
########################################################################
|
110
111
|
def do_menu_level(menu, options={})
|
111
|
-
html =
|
112
|
+
html = "<ul id=\"#{menu.name}\">"
|
112
113
|
if @opts[:edit_mode] > 1
|
113
114
|
options[:title] = menu.respond_to?('name') ? menu.name : menu.caption # 1. level or submenus
|
114
115
|
options[:id] = menu._id
|
@@ -152,6 +153,7 @@ def default
|
|
152
153
|
html << "<div id='#{@menu.div_name}'>" unless @menu.div_name.blank?
|
153
154
|
html << do_menu_level(@menu, table: 'dc_menu')
|
154
155
|
html << "</div>" unless @menu.div_name.blank?
|
156
|
+
html
|
155
157
|
end
|
156
158
|
|
157
159
|
########################################################################
|
@@ -1027,7 +1027,7 @@ class DatePicker < DrgcmsField
|
|
1027
1027
|
# Render date_picker field html code
|
1028
1028
|
###########################################################################
|
1029
1029
|
def render
|
1030
|
-
value = (@record and @record[@yaml['name']]) ? I18n.localize(@record[@yaml['name']].
|
1030
|
+
value = (@record and @record[@yaml['name']]) ? I18n.localize(@record[@yaml['name']].to_date) : nil
|
1031
1031
|
return ro_standard( @parent.dc_format_value(value)) if @readonly
|
1032
1032
|
#
|
1033
1033
|
@yaml['options'] ||= {}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
<div class="dc-table-frame">
|
3
|
+
|
4
|
+
<%= dc_table_title_for_result @records %>
|
5
|
+
|
6
|
+
<% unless @records.nil? %>
|
7
|
+
<%= dc_background_for_result(:start) %>
|
8
|
+
|
9
|
+
<tr><%= dc_header_for_result %></tr>
|
10
|
+
<% for document in @records %>
|
11
|
+
<%= dc_row_for_result(document) %>
|
12
|
+
<%= dc_actions_for_result(document) %>
|
13
|
+
<%= dc_columns_for_result(document) %>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= dc_background_for_result(:end) %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
</div>
|
@@ -2,19 +2,14 @@
|
|
2
2
|
<%= dc_flash_messages %>
|
3
3
|
<%= dc_error_messages_for @record %>
|
4
4
|
|
5
|
-
<div class="dc-form-frame"
|
5
|
+
<div class="dc-form-frame">
|
6
6
|
|
7
|
-
|
8
|
-
<%= dc_actions_for_form %>
|
9
|
-
</table>
|
7
|
+
<%= dc_actions_for_form %>
|
10
8
|
|
11
9
|
<%= dc_fields_for_form %>
|
12
10
|
<%= dc_document_statistics %>
|
13
11
|
|
14
|
-
|
15
|
-
<%= dc_actions_for_form %>
|
16
|
-
</table>
|
17
|
-
|
12
|
+
<%= dc_actions_for_form %>
|
18
13
|
</div>
|
19
14
|
|
20
15
|
<%= javascript_tag(@js) unless @js.blank? %>
|
@@ -6,12 +6,18 @@
|
|
6
6
|
<% unless @records.nil? %>
|
7
7
|
<%= dc_background_for_result(:start) %>
|
8
8
|
|
9
|
-
|
9
|
+
<%= dc_header_for_result %>
|
10
10
|
<% for document in @records %>
|
11
11
|
<%= dc_row_for_result(document) %>
|
12
12
|
<%= dc_actions_for_result(document) %>
|
13
13
|
<%= dc_columns_for_result(document) %>
|
14
|
-
</
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
<% if @record_footer %>
|
17
|
+
<div class="dc-result-data footer">
|
18
|
+
<%= ignore, code = dc_actions_column(); code.html_safe %></div>
|
19
|
+
<%= dc_columns_for_result(@record_footer) %>
|
20
|
+
</div>
|
15
21
|
<% end %>
|
16
22
|
|
17
23
|
<%= dc_background_for_result(:end) %>
|
@@ -408,7 +408,7 @@ en:
|
|
408
408
|
parent: Parent
|
409
409
|
active: Active
|
410
410
|
dc_site_id: Valid for site
|
411
|
-
updated_at:
|
411
|
+
updated_at: Last update
|
412
412
|
|
413
413
|
dc_mail:
|
414
414
|
tabletitle: Mails
|
@@ -456,7 +456,7 @@ en:
|
|
456
456
|
tabletitle: Big Table
|
457
457
|
|
458
458
|
key: Key
|
459
|
-
|
459
|
+
Description: Description
|
460
460
|
site_id: Site
|
461
461
|
dc_big_table_values: Values
|
462
462
|
active: Active
|
data/lib/drg_cms/version.rb
CHANGED
@@ -24,7 +24,7 @@ end
|
|
24
24
|
#
|
25
25
|
#########################################################################
|
26
26
|
def read_input(message, default='')
|
27
|
-
|
27
|
+
p "#{message} "
|
28
28
|
response = STDIN.gets.chomp
|
29
29
|
response.blank? ? default : response
|
30
30
|
end
|
@@ -33,15 +33,14 @@ def read_input(message, default='')
|
|
33
33
|
#
|
34
34
|
########################################################################
|
35
35
|
def create_superadmin
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
#
|
36
|
+
begin
|
37
|
+
username = read_input('Enter username for superadmin role:')
|
38
|
+
p 'Username should be at least 6 character long' if username.size < 6
|
39
|
+
end while username.size < 6
|
40
|
+
begin
|
41
|
+
password = read_input("Enter password for #{username} user :")
|
42
|
+
p 'Password should be at least 8 character long' if password.size < 8
|
43
|
+
end while password.size < 8
|
45
44
|
# Guest role first
|
46
45
|
role = DcPolicyRole.new
|
47
46
|
role.name = 'guest'
|
@@ -55,17 +54,14 @@ def create_superadmin
|
|
55
54
|
# Superadmin user
|
56
55
|
usr = DcUser.new
|
57
56
|
usr.username = username
|
58
|
-
usr.password =
|
59
|
-
usr.password_confirmation =
|
57
|
+
usr.password = password
|
58
|
+
usr.password_confirmation = password
|
60
59
|
usr.first_name = 'superadmin'
|
61
60
|
usr.save
|
62
61
|
# user role
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
r = DcUserRole.new
|
67
|
-
r.dc_policy_role_id = sa._id
|
68
|
-
usr.dc_user_roles << r
|
62
|
+
user_role = DcUserRole.new
|
63
|
+
user_role.dc_policy_role_id = sa._id
|
64
|
+
usr.dc_user_roles << user_role
|
69
65
|
# cmsedit permission
|
70
66
|
permission = DcPermission.new
|
71
67
|
permission.table_name = 'Default permission'
|
@@ -105,8 +101,8 @@ def create_superadmin
|
|
105
101
|
i.type = 'submit_tag'
|
106
102
|
i.save
|
107
103
|
#
|
108
|
-
p "Superadmin user created.
|
109
|
-
end
|
104
|
+
p "Superadmin user created. Remember login data #{username}/#{password}"
|
105
|
+
end
|
110
106
|
|
111
107
|
########################################################################
|
112
108
|
# Initial database seed
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.52.
|
4
|
+
version: 0.5.52.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -303,6 +303,7 @@ files:
|
|
303
303
|
- app/models/dc_user_role.rb
|
304
304
|
- app/models/dc_visit.rb
|
305
305
|
- app/models/drgcms_form_fields.rb
|
306
|
+
- app/views/cmsedit/__result.html.erb
|
306
307
|
- app/views/cmsedit/_edit_stuff.html.erb
|
307
308
|
- app/views/cmsedit/_form.html.erb
|
308
309
|
- app/views/cmsedit/_result.html.erb
|