drg_cms 0.6.1.11 → 0.7.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +260 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +9 -5
  5. data/app/assets/javascripts/drg_cms/drg_cms.js +95 -34
  6. data/app/assets/javascripts/drg_cms/jquery.bpopup.js +372 -0
  7. data/app/assets/javascripts/drg_cms_application.js +1 -3
  8. data/app/assets/javascripts/drg_cms_cms.js +3 -4
  9. data/app/assets/stylesheets/drg_cms/drg_cms.css +37 -5
  10. data/app/assets/stylesheets/drg_cms/jstree.css +32 -27
  11. data/app/assets/stylesheets/drg_cms/select-multiple.css +6 -4
  12. data/app/controllers/cmsedit_controller.rb +22 -24
  13. data/app/controllers/dc_application_controller.rb +10 -9
  14. data/app/controllers/dc_common_controller.rb +14 -11
  15. data/app/controllers/dc_main_controller.rb +0 -1
  16. data/app/controls/dc_gallery_control.rb +46 -0
  17. data/app/controls/dc_image_control.rb +180 -0
  18. data/app/controls/dc_page_control.rb +3 -3
  19. data/app/controls/dc_poll_result_control.rb +7 -8
  20. data/app/controls/dc_report.rb +9 -4
  21. data/app/controls/design_element_settings_control.rb +88 -37
  22. data/app/forms/all_options.yml +18 -7
  23. data/app/forms/cms_menu.yml +10 -4
  24. data/app/forms/dc_category.yml +17 -8
  25. data/app/forms/dc_category_as_tree.yml +31 -0
  26. data/app/forms/dc_gallery.yml +1 -1
  27. data/app/forms/dc_image.yml +122 -0
  28. data/app/forms/dc_image_search.yml +72 -0
  29. data/app/forms/dc_page.yml +11 -8
  30. data/app/forms/dc_steps_template.yml +2 -1
  31. data/app/forms/help/dc_category_as_tree.en +4 -0
  32. data/app/forms/help/dc_category_as_tree.sl +5 -0
  33. data/app/helpers/cms_common_helper.rb +24 -16
  34. data/app/helpers/cms_edit_helper.rb +28 -35
  35. data/app/helpers/cms_helper.rb +21 -5
  36. data/app/helpers/cms_index_helper.rb +53 -38
  37. data/app/helpers/dc_application_helper.rb +95 -121
  38. data/app/helpers/dc_category_helper.rb +129 -0
  39. data/app/helpers/dc_image_helper.rb +127 -0
  40. data/app/models/concerns/dc_policy_rule_concern.rb +1 -1
  41. data/app/models/concerns/dc_user_concern.rb +12 -4
  42. data/app/models/dc_category.rb +62 -24
  43. data/app/models/dc_design.rb +5 -4
  44. data/app/models/dc_filter.rb +19 -18
  45. data/app/models/dc_image.rb +237 -0
  46. data/app/models/dc_internals.rb +5 -9
  47. data/app/models/dc_policy_role.rb +8 -8
  48. data/app/models/drgcms_form_fields/date_picker.rb +10 -12
  49. data/app/models/drgcms_form_fields/datetime_picker.rb +10 -11
  50. data/app/models/drgcms_form_fields/drgcms_field.rb +55 -30
  51. data/app/models/drgcms_form_fields/embedded.rb +11 -8
  52. data/app/models/drgcms_form_fields/journal_diff.rb +2 -2
  53. data/app/models/drgcms_form_fields/multitext_autocomplete.rb +51 -47
  54. data/app/models/drgcms_form_fields/select.rb +20 -14
  55. data/app/models/drgcms_form_fields/text_with_select.rb +5 -9
  56. data/app/models/drgcms_form_fields/tree_select.rb +20 -19
  57. data/app/renderers/dc_gallery_renderer.rb +10 -4
  58. data/app/renderers/dc_page_renderer.rb +7 -7
  59. data/app/renderers/dc_poll_renderer.rb +13 -12
  60. data/app/views/cmsedit/_edit_stuff.html.erb +1 -1
  61. data/app/views/cmsedit/edit.html.erb +1 -1
  62. data/app/views/cmsedit/index.html.erb +1 -1
  63. data/app/views/cmsedit/new.html.erb +1 -0
  64. data/app/views/layouts/content.html.erb +1 -1
  65. data/config/locales/drgcms_en.yml +16 -2
  66. data/config/locales/drgcms_sl.yml +15 -2
  67. data/config/locales/models_en.yml +33 -0
  68. data/config/locales/models_sl.yml +44 -1
  69. data/drg_cms.gemspec +3 -3
  70. data/lib/drg_cms/version.rb +1 -1
  71. data/lib/drg_cms.rb +19 -5
  72. data/lib/generators/convert_to_ar/USAGE +8 -0
  73. data/lib/generators/convert_to_ar/convert_to_ar_generator.rb +158 -0
  74. data/lib/tasks/dc_cleanup.rake +20 -42
  75. metadata +25 -14
  76. data/History.log +0 -109
  77. data/app/assets/javascripts/drg_cms/jquery.bpopup.min.js +0 -7
  78. data/app/views/layouts/__cmsedit.html.erb +0 -16
@@ -59,6 +59,7 @@ class TreeSelect < Select
59
59
  ###########################################################################
60
60
  def make_tree(parent)
61
61
  return '' unless @choices[parent.to_s]
62
+
62
63
  @html << '<ul>'
63
64
  choices = if @choices[parent.to_s].first[3] != 0
64
65
  @choices[parent.to_s].sort_by {|e| e[3].to_i } # sort by order if first is not 0
@@ -66,16 +67,16 @@ def make_tree(parent)
66
67
  @choices[parent.to_s].sort_alphabetical_by(&:first) # use UTF-8 sort
67
68
  end
68
69
  choices.each do |choice|
69
- data = [ %Q["selected" : #{choice.last ? 'true' : 'false'} ] ]
70
+ data = [ %("selected" : #{choice.last ? 'true' : 'false'} ) ]
70
71
  # only for parent objects
71
72
  if @choices[ choice[1].to_s ]
72
- # parent is not selectable
73
+ # parent is not selectable
73
74
  data << '"disabled" : true' unless @parent.dc_dont?(@yaml['parent_disabled'], true)
74
- # parents are opened on start
75
+ # parents are opened on start
75
76
  data << '"opened" : true' unless @parent.dc_dont?(@yaml['parent_opened'], true)
76
77
  end
77
78
  # data-jstree must be singe quoted
78
- @html << %Q[<li data-id="#{choice[1]}" data-jstree='{#{data.join(' , ')}}'>#{choice.first}\n]
79
+ @html << %(<li data-id="#{choice[1]}" data-jstree='{#{data.join(' , ')}}'>#{choice.first}\n)
79
80
  # call recursively for children
80
81
  make_tree(choice[1]) if @choices[ choice[1].to_s ]
81
82
  @html << "</li>"
@@ -87,25 +88,24 @@ end
87
88
  # Render tree_select field html code
88
89
  ###########################################################################
89
90
  def render
90
- #return ro_standard if @readonly
91
91
  set_initial_value('html','value')
92
92
  require 'sort_alphabetical'
93
93
 
94
94
  record = record_text_for(@yaml['name'])
95
95
  clas = 'tree-select' + (@readonly ? ' dc-readonly' : '')
96
96
  @html << "<div id=\"#{@yaml['name']}\" class=\"#{clas}\" #{set_style()} >"
97
- # Fill @choices hash. The key is parent object id
97
+ # Fill @choices hash. The key is parent object id
98
98
  @choices = {}
99
99
  choices_in_eval(@yaml['eval']).each do |data|
100
100
  @choices[ data[2].to_s ] ||= []
101
101
  @choices[ data[2].to_s ] << (data << false)
102
102
  end
103
- # put current values hash with. To speed up selection when there is a lot of categories
103
+ # put current values hash with. To speed up selection when there is a lot of categories
104
104
  current_values = {}
105
105
  current = @record[@yaml['name']] || []
106
106
  current = [current] unless current.class == Array # non array fields
107
- current.each {|e| current_values[e.to_s] = true}
108
- # set third element of @choices when selected
107
+ current.each { |e| current_values[e.to_s] = true }
108
+ # set third element of @choices when selected
109
109
  @choices.keys.each do |key|
110
110
  0.upto( @choices[key].size - 1 ) do |i|
111
111
  choice = @choices[key][i]
@@ -114,16 +114,16 @@ def render
114
114
  end
115
115
  make_tree(nil)
116
116
  @html << '</div>'
117
- # add hidden communication field
117
+ # add hidden communication field
118
118
  @html << @parent.hidden_field(record, @yaml['name'], value: current.join(','))
119
- # save multiple indicator for data processing on return
119
+ # save multiple indicator for data processing on return
120
120
  @html << @parent.hidden_field(record, "#{@yaml['name']}_multiple", value: 1) if @yaml['multiple']
121
- # javascript to update hidden record field when tree looses focus
122
- readonly_code = %Q[
121
+ # javascript to update hidden record field when tree looses focus
122
+ readonly_code = %(
123
123
  ,
124
124
  "conditionalselect" : function (node) {
125
125
  return false; }
126
- ]
126
+ )
127
127
 
128
128
  @js =<<EOJS
129
129
  $(function(){
@@ -131,7 +131,7 @@ $(function(){
131
131
  "checkbox" : {"three_state" : false},
132
132
  "core" : { "themes" : { "icons": false },
133
133
  "multiple" : #{@yaml['multiple'] ? 'true' : 'false'} },
134
- "plugins" : ["checkbox","conditionalselect"]
134
+ "plugins" : ["checkbox", "conditionalselect"]
135
135
  #{@readonly ? readonly_code : ''}
136
136
  });
137
137
  });
@@ -155,13 +155,14 @@ end
155
155
  ###########################################################################
156
156
  def self.get_data(params, name)
157
157
  return nil if params['record'][name].blank?
158
- #
158
+
159
159
  result = params['record'][name].split(',')
160
- result.delete_if {|e| e.blank? }
160
+ result.delete_if(&:blank?)
161
161
  return nil if result.size == 0
162
- # convert to BSON objects if is BSON object ID
162
+
163
+ # convert to BSON objects if is BSON object ID
163
164
  result = result.map{ |e| BSON::ObjectId.from_string(e) } if BSON::ObjectId.legal?(result.first)
164
- # return only first element if multiple values select was not alowed
165
+ # return only first element if multiple values select was not allowed
165
166
  params['record']["#{name}_multiple"] == '1' ? result : result.first
166
167
  end
167
168
 
@@ -52,14 +52,20 @@ end
52
52
  def default
53
53
  can_view, msg = dc_user_can_view(@parent, @page)
54
54
  return msg unless can_view
55
- #
55
+
56
56
  html = '<div class="picture-gallery"><ul>'
57
57
  DcGallery.where(doc_id: @opts[:doc_id], active: true).order_by(order: 1).each do |picture|
58
58
  html << '<li>'
59
- html << edit_menu(picture) if @opts[:edit_mode] > 1
59
+ if @opts[:edit_mode] > 1
60
+ html << edit_menu(picture)
61
+ html << %(
62
+ <span class="dc-inline-link dc-link-ajax" data-url="/cmsedit/run?control=DcGalleryControl.picture_remove;id=#{picture.id};table=DcGallery"
63
+ data-confirm="#{t('drgcms.confirm_delete')}" title="#{t('drgcms.delete')}">
64
+ <i class="mi-o mi-delete"></i>
65
+ </span>)
66
+ end
60
67
  html << "#{@parent.link_to(i@parent.mage_tag(picture.thumbnail, title: picture.title), picture.picture)}<li>"
61
68
  end
62
- #
63
69
  html << '</ul></div>'
64
70
  end
65
71
 
@@ -88,7 +94,7 @@ def edit_menu(picture)
88
94
  opts[:id] = picture.id
89
95
  opts[:table] = 'dc_gallery'
90
96
 
91
- '<li>'+dc_link_for_edit(opts)+'</li>'
97
+ '<li>' + dc_link_for_edit(opts) + '</li>'
92
98
  end
93
99
 
94
100
 
@@ -41,7 +41,7 @@ include CmsCommonHelper
41
41
  ########################################################################
42
42
  # Object initialization.
43
43
  ########################################################################
44
- def initialize( parent, opts={} ) #:nodoc:
44
+ def initialize( parent, opts = {} ) #:nodoc:
45
45
  @parent = parent
46
46
  @opts = opts
47
47
  @page = @parent.page
@@ -74,11 +74,11 @@ def iframe
74
74
  return '' if @page.if_url.blank?
75
75
 
76
76
  html = "\n<iframe"
77
- html << " id=\"#{@page.if_id}\"" unless @page.if_id.blank?
78
- html << " class=\"#{@page.if_class}\"" unless @page.if_class.blank?
77
+ html << " id=\"#{@page.if_id}\"" if @page.if_id.present?
78
+ html << " class=\"#{@page.if_class}\"" if @page.if_class.present?
79
79
  html << " border=\"#{@page.if_border}\""
80
- html << " height=\"#{@page.if_height}\"" unless @page.if_height.blank?
81
- html << " width=\"#{@page.if_width}\"" unless @page.if_width.blank?
80
+ html << " height=\"#{@page.if_height}\"" if @page.if_height.present?
81
+ html << " width=\"#{@page.if_width}\"" if @page.if_width.blank?
82
82
  html << " scrolling=\"#{@page.if_scroll}\""
83
83
  # Parameters
84
84
  parameters = @page.if_url.match(/\?/) ? '' : '?'
@@ -88,7 +88,7 @@ def iframe
88
88
  val = @parent.dc_internal_var(value['object'], value['method'])
89
89
  parameters << "&#{key}=#{val}" if val # only when not nil
90
90
  end
91
- url = @page.if_url + (parameters.size > 1 ? parameters : '')
91
+ url = @page.if_url + (parameters.blank? ? '' : parameters)
92
92
  html << "src=\"#{url}\" ></iframe>\n"
93
93
  html
94
94
  end
@@ -106,7 +106,7 @@ def default
106
106
  html << @page.body
107
107
  # render poll if defined
108
108
  if @page.dc_poll_id
109
- @opts.merge!(:poll_id => @page.dc_poll_id, :return_to => @parent.request.url, method: nil)
109
+ @opts.merge!(poll_id: @page.dc_poll_id, return_to: @parent.request.url, method: nil)
110
110
  comment = DcPollRenderer.new(@parent, @opts)
111
111
  html << "<div class='wrap row'>#{comment.render_html}</div>"
112
112
  @css << "\n#{comment.render_css}"
@@ -110,7 +110,7 @@ def do_one_item(poll, yaml)
110
110
  if !@end_of_data
111
111
  html << (poll.display == 'lr' ? "</div><br>\n" : "</div>\n")
112
112
  # captcha
113
- if poll.captcha_type.to_s.size > 1
113
+ if poll.captcha_type.present?
114
114
  @opts.merge!(:captcha_type => poll.captcha_type)
115
115
  captcha = DcCaptchaRenderer.new(@parent, @opts)
116
116
  html << captcha.render_html
@@ -157,7 +157,7 @@ end
157
157
  ########################################################################
158
158
  def default
159
159
  # poll_id may be defined in params or opts
160
- poll_id = @opts[:poll_id] || @parent.params[:poll_id]
160
+ poll_id = @opts[:id] || @opts[:poll_id] || @parent.params[:poll_id]
161
161
  return '<br>Poll id is not defined?<br>' if poll_id.nil?
162
162
 
163
163
  poll = DcPoll.find(poll_id)
@@ -191,18 +191,19 @@ def default
191
191
  html << %(<div class="poll-div">\n)
192
192
  # edit link
193
193
  if @opts[:edit_mode] > 1
194
- @opts[:editparams].merge!( controller: 'cmsedit', action: 'edit', id: poll._id, table: 'dc_poll', form_name: 'dc_poll' )
194
+ @opts[:editparams].merge!( controller: :cmsedit, action: :edit, id: poll._id, table: :dc_poll, form_name: :dc_poll )
195
195
  @opts[:editparams].merge!(title: "#{t('drgcms.edit')}: #{poll.name}")
196
196
  @opts[:editparams].delete(:ids) # this is from page, but it gets in a way
197
197
  html << dc_link_for_edit( @opts[:editparams] )
198
198
  end
199
199
 
200
200
  html << case
201
- when poll.operation == 'poll_submit' then
202
- @parent.form_tag(action: poll.operation, method: :put)
203
- when poll.operation == 'link' then
204
- @parent.form_tag( poll.parameters, method: :put)
205
- end
201
+ when poll.operation == 'poll_submit'
202
+ @parent.form_tag(action: poll.operation, method: :put, return_to: params[:return_to])
203
+ when poll.operation == 'link'
204
+ poll.parameters << "?return_to=#{params[:return_to]}" if params[:return_to]
205
+ @parent.form_tag( poll.parameters, method: :put)
206
+ end
206
207
  # header, - on first position will not display title
207
208
  html << %(<div class="poll-title">#{poll.title}</div>) unless poll.title[0] == '-'
208
209
  html << %(<div class="poll-text">#{poll.sub_text}</div>)
@@ -212,10 +213,10 @@ def default
212
213
  %(<div class="poll-data-div">\n)
213
214
  end
214
215
  # items. Convert each item to yaml
215
- @end_od_data = false
216
+ @end_of_data = false
216
217
  if poll.form.to_s.size < 10
217
218
  items = poll.dc_poll_items
218
- items.sort! { |a,b| a.order <=> b.order }
219
+ items.sort! { |a, b| a.order <=> b.order }
219
220
  items.each do |item|
220
221
  next unless item.active # disabled items
221
222
  # convert options to yaml
@@ -232,12 +233,12 @@ def default
232
233
  html << do_one_item(poll, yaml)
233
234
  end
234
235
  else
235
- yaml = YAML.load(poll.form.gsub('&nbsp;',' ')) # very annoying. They come with copy&paste ;-)
236
+ yaml = YAML.load(poll.form.gsub('&nbsp;', ' ')) # very annoying. They come with copy&paste ;-)
236
237
  # if entered without numbering yaml is returned as Hash otherwise as Array
237
238
  yaml.each { |i| html << do_one_item(poll, (i.class == Hash ? i : i.last)) } #
238
239
  end
239
240
  # hide some fields usefull as parameters
240
- html << @parent.hidden_field_tag('return_to', @opts[:return_to] || @parent.params[:return_to] || @parent.request.url)
241
+ html << @parent.hidden_field_tag('return_to', @opts[:return_to] || @parent.params[:return_to])
241
242
  html << @parent.hidden_field_tag('return_to_error', @parent.request.url )
242
243
  html << @parent.hidden_field_tag('poll_id', poll_id )
243
244
  html << @parent.hidden_field_tag('page_id', @parent.page.id )
@@ -43,7 +43,7 @@
43
43
 
44
44
  <div class="cmsedit-container">
45
45
  <div id="cms-menu">
46
- <%= dc_choices4_cmsmenu.html_safe %>
46
+ <%= dc_cms_menu %>
47
47
  </div>
48
48
 
49
49
  <div class="cmsedit-iframe" style="width: 99%;">
@@ -1,6 +1,6 @@
1
1
  <% dc_form_update %>
2
2
 
3
- <div <%= dc_form_id %>>
3
+ <div <%= dc_form_id %> <%= dc_form_class %> >
4
4
  <%= dc_head_for_form %>
5
5
  <%= dc_table_title dc_edit_title() %>
6
6
 
@@ -1,6 +1,6 @@
1
1
  <% dc_form_update %>
2
2
 
3
- <div <%= dc_form_id %> class="dc-form-frame">
3
+ <div <%= dc_form_id %> <%= dc_form_class('dc-form-frame') %> >
4
4
  <%= dc_title_for_index @records %>
5
5
 
6
6
  <%= dc_actions_for_index %>
@@ -1,6 +1,7 @@
1
1
  <% dc_form_update %>
2
2
 
3
3
  <div <%= dc_form_id %>>
4
+ <%= dc_head_for_form %>
4
5
  <%= dc_table_title dc_new_title %>
5
6
 
6
7
  <%= form_tag(@form_params, method: :post, id: CmsHelper.form_param(params) || CmsHelper.table_param(params),
@@ -4,7 +4,7 @@
4
4
  <title><%= @page_title %></title>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
6
  <%= stylesheet_link_tag "application", media: 'all' %>
7
- <style type="text/css" media="all"><%= "#{@site.css if @site}#{@design.css if @design}\n#{@page.css if @page}".html_safe %></style>
7
+ <style media="all"><%= "#{@site.css if @site}#{@design.css if @design}\n#{@page.css if @page}".html_safe %></style>
8
8
  <%= @site.header.html_safe %>
9
9
  <%= javascript_include_tag "application" %>
10
10
  <%= csrf_meta_tags %>
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2012-2013 Damjan Rems
2
+ # Copyright (c) 2012+ Damjan Rems
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -65,7 +65,8 @@ en:
65
65
  no_class: Class [%{class}] not defined!
66
66
  no_method: Method (helper) [%{method}] not defined!
67
67
  img_alt_not_present: All images in body must have alternative text entered
68
-
68
+ not_valid: Value is not valid!
69
+
69
70
  toggle_cms: Toggle CMS edit/view mode
70
71
  edit: Edit
71
72
  show: Show
@@ -87,6 +88,7 @@ en:
87
88
  save: Save
88
89
  save&back: Save & back
89
90
  save&close: Save & close
91
+ search: Search
90
92
  filter_on: Filter ON
91
93
  filter_off: Filter OFF
92
94
  filter_set: Set filter
@@ -113,6 +115,8 @@ en:
113
115
  choices4_filter_operators: 'Equal to:eq,Contains:like,Greater then:gt,Less then:lt,Is empty:empty'
114
116
 
115
117
  browse_collections: Browse all collections
118
+ category_has_subs: Category can't be deleted, because it contains sub-elements.
119
+ category_as_tree: Edit in treeview
116
120
 
117
121
  dc_journal:
118
122
  zero_selected: No data selected!
@@ -139,3 +143,13 @@ en:
139
143
  1basic: Basic
140
144
  2index: Index
141
145
  3form: Form
146
+
147
+ dc_image:
148
+ wrong_type: Image type not allowed! Types allowed are (jpg jpeg png gif svg webp).
149
+ no_file: Original image file not present. Try to upload image file again.
150
+ invoke: Invoke images manager.
151
+ search: Search and select image
152
+ select: Click to select
153
+ preview: Click to view image
154
+ available: Available image sizes
155
+ offset_error: Enter either X or Y offset.
@@ -64,7 +64,8 @@ sl:
64
64
  img_large: Klik za večjo sliko
65
65
  no_class: Razred (class) [%{class}] ni definiran!
66
66
  no_method: Metoda (helper) [%{method}] ne obstaja!
67
- img_alt_not_present: Vse slike v vsebini morajo imeti vpisano nadomestno besedilo
67
+ img_alt_not_present: Vse slike v vsebini morajo imeti vpisano nadomestno besedilo
68
+ not_valid: Nedovoljena vrednost!
68
69
 
69
70
  toggle_cms: Preklopi med CMS urejanjem in prikazom
70
71
  edit: Urejanje
@@ -87,6 +88,7 @@ sl:
87
88
  save: Shrani
88
89
  save&back: Shrani in nazaj
89
90
  save&close: Shrani in zapri
91
+ search: Išči
90
92
  filter_on: Vklopi filter
91
93
  filter_off: Izklopi filter
92
94
  filter_set: Nastavi filter
@@ -113,6 +115,8 @@ sl:
113
115
  choices4_filter_operators: 'Je enak:eq,Vsebuje:like,Je večji od:gt,Je manjši od:lt,Je prazen:empty'
114
116
 
115
117
  browse_collections: Brskanje po definicijah zbirk
118
+ category_has_subs: Kategorije ni mogoče izbrisati, ker vsebuje podrejene elemente.
119
+ category_as_tree: Uredi v drevesnem pogledu
116
120
 
117
121
  dc_journal:
118
122
  zero_selected: Ni izbranih podatkov!
@@ -137,4 +141,13 @@ sl:
137
141
  2index: Index
138
142
  3form: Forma
139
143
 
140
-
144
+ dc_image:
145
+ wrong_type: Nedovoljena vrsta slike. Dovoljene so vrste (jpg jpeg png gif svg webp).
146
+ no_file: Nisem našel originalne slike. Predlagam, da sliko ponovno naložite.
147
+ invoke: Zagon iskalnika slik.
148
+ search: Poiščite in izberite sliko
149
+ select: Kliknite za izbiro
150
+ preview: Kliknite za ogled slike
151
+ image: Slika
152
+ available: Velikosti na voljo
153
+ offset_error: Vpišite samo X ali Y zamik.
@@ -570,6 +570,26 @@ en:
570
570
  dc_json_lds: Schema sub element
571
571
  active: Active
572
572
 
573
+ dc_image:
574
+ tabletitle: Images manager
575
+
576
+ upload_file: Upload
577
+ name: File name
578
+ short: Short description
579
+ text: Description text
580
+ keep_original: Keep original
581
+ size_o: Original dimension
582
+ size_l: Large dimension
583
+ size_m: Medium dimension
584
+ size_s: Small dimension
585
+ size_ls: Large dimension
586
+ size_ms: Medium dimension
587
+ size_ss: Small dimension
588
+ categories: Categories
589
+ cats_input: Categories
590
+ categories_line: Categories
591
+ created_by: Uploaded by
592
+
573
593
  # help for forms #####################################################
574
594
 
575
595
  help:
@@ -973,3 +993,16 @@ en:
973
993
  active: Document is active
974
994
  add_schema: Add new schema
975
995
  add_error: Schema element %{schema} already exists!
996
+
997
+ dc_image:
998
+ upload_file: Select file to upload
999
+ name: Original file name
1000
+ short: Short image description
1001
+ text: Longer image description text
1002
+ keep_original: Keep original image
1003
+ size_o: Dimension of original image
1004
+ size_l: Dimension for large image
1005
+ size_m: Dimension form medium size image
1006
+ size_s: Dimension for small size image
1007
+ categories: Categories for later searching of image
1008
+ created_by: Image was uploaded by
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2012-2013 Damjan Rems
2
+ # Copyright (c) 2012+ Damjan Rems
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -574,6 +574,36 @@ sl:
574
574
  active: Aktiven
575
575
  dc_json_lds: Podelement strukture
576
576
 
577
+ dc_image:
578
+ tabletitle: Organizator slik
579
+
580
+ upload_file: Naloži datoteko
581
+ name: Originalno ime
582
+ short: Kratek opis
583
+ text: Daljši opis
584
+ keep_original: Ohrani original
585
+ size_o: Prvotna dimenzija
586
+ size_l: Velika dimenzija
587
+ size_m: Srednja dimenzija
588
+ size_s: Mala dimenzija
589
+ size_ls: Velika dimenzija
590
+ size_ms: Srednja dimenzija
591
+ size_ss: Mala dimenzija
592
+ offset_lx: Zamik X
593
+ offset_ly: Zamik Y
594
+ offset_mx: Zamik X
595
+ offset_my: Zamik Y
596
+ offset_sx: Zamik X
597
+ offset_sy: Zamik Y
598
+ preview_s: Slika
599
+ preview_m: Slika
600
+ preview_l: Slika
601
+
602
+ categories: Kategorije
603
+ cats_input: Kategorije
604
+ categories_line: Kategorije
605
+ created_by: Naložil
606
+
577
607
  # help pomoč na obrazcih ####################################################
578
608
 
579
609
  help:
@@ -985,3 +1015,16 @@ sl:
985
1015
  add_schema: Dodaj strukturo
986
1016
  add_error: Element %{schema} že obstaja!
987
1017
 
1018
+ dc_image:
1019
+ upload_file: Naloži datotekov obdelavo
1020
+ name: Originalno ime datoteke
1021
+ short: Kratek opis slike
1022
+ text: Daljši opis slike
1023
+ keep_original: Ohrani originalno sliko
1024
+ size_o: Dimenzije originalne slike
1025
+ size_l: Dimenzije velike slike
1026
+ size_m: Dimenzije srednje velike slike
1027
+ size_s: Dimenzije male slike
1028
+ categories: Kategorije za poznejše lažje iskanje slike
1029
+ created_by: Uporabnik, ki je naložil sliko
1030
+ offset: Offset image before resizing. Offset origin is the top left corner.
data/drg_cms.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.summary = 'DRG: Rapid web application development tool and CMS for Ruby, Rails and MongoDB'
16
16
  s.description = 'DRG, development tool for rapid building of in-house (Intranet, private cloud) applications as well as CMS for creating complex, data-entry intensive web sites.'
17
17
  s.license = 'MIT'
18
- s.files = Dir['{app,config,db,lib}/**/*'] + %w[MIT-LICENSE Rakefile README.md History.log drg_cms.gemspec]
18
+ s.files = Dir['{app,config,db,lib}/**/*'] + %w[MIT-LICENSE Rakefile README.md CHANGELOG.md drg_cms.gemspec]
19
19
  s.test_files = Dir['test/**/*']
20
20
 
21
21
  s.required_ruby_version = '>= 2.7'
@@ -23,10 +23,10 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'rails'#, '~> 6.1'
24
24
  s.add_dependency 'jquery-rails'
25
25
  s.add_dependency 'jquery-ui-rails'
26
- s.add_dependency 'non-stupid-digest-assets'
26
+ s.add_dependency 'non-digest-assets'
27
27
 
28
28
  s.add_dependency 'bcrypt' #, '~> 3.0.0'
29
- s.add_dependency 'mongoid', '~> 7'
29
+ s.add_dependency 'mongoid'#, '~> 7'
30
30
 
31
31
  s.add_dependency 'kaminari-mongoid'
32
32
  s.add_dependency 'kaminari-actionview'
@@ -23,5 +23,5 @@
23
23
 
24
24
  # drg_cms gem version
25
25
  module DrgCms #:nodoc:
26
- VERSION = '0.6.1.11'.freeze
26
+ VERSION = '0.7.0.8'.freeze
27
27
  end
data/lib/drg_cms.rb CHANGED
@@ -29,7 +29,7 @@ end
29
29
  # When new plugin with its own DRG forms is added to application, path to
30
30
  # forms directory must be send to DrgCms module. Paths are saved into @@paths hash variable.
31
31
  #
32
- # Adding path is best done in plugin mudule initialization code.
32
+ # Adding path is best done in plugin module initialization code.
33
33
  #
34
34
  # Parameters:
35
35
  # [path] String. Path to forms directory
@@ -54,7 +54,7 @@ def self.add_forms_path(path)
54
54
  end
55
55
 
56
56
  ###############################################################################
57
- # Patching is one of the rubies best strenghts and also its curse. Loading
57
+ # Patching is one of the rubies best strengths and also its curse. Loading
58
58
  # patches in development has become real problem for developers. This is my
59
59
  # way of patch loading.
60
60
  #
@@ -85,7 +85,7 @@ end
85
85
  # General add path method. Paths are saved into @@paths hash variable. Paths can
86
86
  # then be reused in different parts of application.
87
87
  #
88
- # Adding paths is best done in plugin mudule initialization code.
88
+ # Adding paths is best done in plugin module initialization code.
89
89
  #
90
90
  # Parameters:
91
91
  # [type] Symbol. Defines type of data. Current used values are :forms, :patches
@@ -120,9 +120,9 @@ end
120
120
 
121
121
  ####################################################################
122
122
  # Checks if any errors exist on document and writes error log. It can also
123
- # crash if requested. This is mostly usefull in development for debuging
123
+ # crash if requested. This is mostly useful in development for debugging
124
124
  # model errors or when updating multiple collections and each save must be
125
- # checked if succesfull.
125
+ # checked if successful.
126
126
  #
127
127
  # @param [Document] Document object which will be checked
128
128
  # @param [Boolean] If true method should end in runtime error. Default = false.
@@ -165,6 +165,7 @@ end
165
165
  # @param [String] Optional key to be deleted
166
166
  ####################################################################
167
167
  def self.cache_clear(key = nil)
168
+ return unless Rails.cache
168
169
  return Rails.cache.clear if key.nil?
169
170
 
170
171
  if redis_cache_store?
@@ -211,6 +212,19 @@ def self.cache_write(keys, data)
211
212
  data
212
213
  end
213
214
 
215
+ ####################################################################
216
+ # Reads data from mongoid cache. Mongoid has it's own cache, which can be
217
+ # used to cache results on single request.
218
+ #
219
+ # @param [model] class: Model name
220
+ # @param [id] String || BSON::ObjectId : Id
221
+ #
222
+ # @return [Object] data document.
223
+ ####################################################################
224
+ def self.cached(model, id)
225
+ Mongoid::QueryCache.cache { model.find(id) }
226
+ end
227
+
214
228
  ###############################################################################
215
229
  # All Routes required by DrgCms.
216
230
  #
@@ -0,0 +1,8 @@
1
+ Description:
2
+ new_drg_form_generator will create DRG form from model description.
3
+
4
+ Example:
5
+ rails generate new_drg_form model_name
6
+
7
+ This will create:
8
+ forms/model_name.yml