drg_cms 0.5.8 → 0.5.8.2

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/drg_cms/drg_cms.js +53 -0
  3. data/app/assets/javascripts/drg_cms/jquery.the-modal.js +260 -0
  4. data/app/assets/javascripts/drg_cms_cms.js +3 -0
  5. data/app/assets/stylesheets/drg_cms/drg_cms.css +68 -33
  6. data/app/assets/stylesheets/drg_cms/the-modal.css +33 -0
  7. data/app/assets/stylesheets/drg_cms_cms.css +1 -0
  8. data/app/controllers/cmsedit_controller.rb +69 -54
  9. data/app/controllers/dc_application_controller.rb +21 -17
  10. data/app/controllers/dc_common_controller.rb +0 -0
  11. data/app/forms/all_options.yml +3 -2
  12. data/app/forms/cms_menu.yml +30 -17
  13. data/app/forms/dc_big_table_value.yml +3 -0
  14. data/app/forms/dc_filter.yml +56 -0
  15. data/app/forms/dc_key_value_store.yml +33 -0
  16. data/app/helpers/cmsedit_helper.rb +32 -82
  17. data/app/models/dc_ad.rb +27 -1
  18. data/app/models/dc_ad_stat.rb +10 -1
  19. data/app/models/dc_big_menu.rb +18 -1
  20. data/app/models/dc_big_table.rb +15 -2
  21. data/app/models/dc_big_table_locale.rb +13 -2
  22. data/app/models/dc_big_table_value.rb +14 -2
  23. data/app/models/dc_category.rb +16 -2
  24. data/app/models/dc_design.rb +17 -1
  25. data/app/models/dc_dummy.rb +5 -1
  26. data/app/models/dc_filter.rb +172 -0
  27. data/app/models/dc_folder_permission.rb +11 -1
  28. data/app/models/dc_ident.rb +9 -1
  29. data/app/models/dc_internals.rb +58 -0
  30. data/app/models/dc_journal.rb +14 -1
  31. data/app/models/dc_key_value_store.rb +8 -2
  32. data/app/models/dc_link.rb +14 -1
  33. data/app/models/dc_menu.rb +16 -1
  34. data/app/models/dc_menu_item.rb +19 -1
  35. data/app/models/dc_page.rb +43 -1
  36. data/app/models/dc_part.rb +28 -1
  37. data/app/models/dc_permission.rb +11 -1
  38. data/app/models/dc_piece.rb +25 -1
  39. data/app/models/dc_policy.rb +14 -1
  40. data/app/models/dc_policy_role.rb +10 -1
  41. data/app/models/dc_policy_rule.rb +9 -1
  42. data/app/models/dc_poll.rb +23 -1
  43. data/app/models/dc_poll_item.rb +16 -1
  44. data/app/models/dc_simple_menu.rb +16 -1
  45. data/app/models/dc_simple_menu_item.rb +17 -1
  46. data/app/models/dc_site.rb +43 -13
  47. data/app/models/dc_stat.rb +14 -3
  48. data/app/models/dc_user.rb +38 -1
  49. data/app/models/dc_user_role.rb +13 -1
  50. data/app/models/dc_visit.rb +11 -1
  51. data/app/models/drgcms_form_fields.rb +20 -4
  52. data/config/locales/drgcms_en.yml +11 -6
  53. data/config/locales/drgcms_sl.yml +8 -4
  54. data/config/locales/models_en.yml +20 -1
  55. data/config/locales/models_sl.yml +18 -0
  56. data/lib/drg_cms/version.rb +1 -1
  57. data/lib/generators/new_drg_form/new_drg_form_generator.rb +1 -1
  58. data/lib/tasks/browse_models.rake +17 -2
  59. metadata +8 -2
@@ -22,7 +22,22 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_poll_item embedded documents.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_poll_item : Poll items
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # name String Name (alias) of returned field name
33
+ # text String Caption of item
34
+ # type String Input item type
35
+ # size String size
36
+ # mandatory Mongoid::Boolean Item entry is mandatory
37
+ # separator String Separator between items
38
+ # options String Options for the item. Depends on item type.
39
+ # order Integer Order of item on poll
40
+ # active Mongoid::Boolean Item is active
26
41
  #
27
42
  # DcPollItems define entry fields on poll questionary and formulars.
28
43
  ########################################################################
@@ -22,7 +22,22 @@
22
22
  #++
23
23
 
24
24
  #########################################################################
25
- # Mongoid::Document model for dc_simple_menus collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_simple_menu : Simple menus
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # name String Menu name
33
+ # description String Short description of menu
34
+ # div_name String Div id name around menu area
35
+ # link_prepend String Link field usually holds direct link to document. Prepand field holds data, that has to be prepanded to the link.
36
+ # css String CSS for this menu
37
+ # active Mongoid::Boolean Active
38
+ # created_by BSON::ObjectId created_by
39
+ # updated_by BSON::ObjectId updated_by
40
+ # dc_simple_menu_items Embedded:DcSimpleMenuItem Menu items
26
41
  #
27
42
  # Simple menus were first menu system developed for DRG CMS. They can be only two menu
28
43
  # levels deep. Menus are described in dc_simple_menu_items embedded documents.
@@ -22,7 +22,23 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_simple_menu_items embedded documents.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_simple_menu_item : drgCMS Simple menu items
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # caption String Caption of menu
33
+ # picture String Picture for the menu
34
+ # link String Link called when menu is chosen
35
+ # link_prepend String Link field usually holds direct link to document. Prepand field holds data, that has to be prepanded to the link.
36
+ # target String Target window for the link. Leave empty when same window.
37
+ # order Integer Order on which menu item is shown. Lower number means prior position.
38
+ # submenu String Submenu captions in form (caption\link).
39
+ # policy_id BSON::ObjectId Menu item will be diplayed according to this policy
40
+ # css String CSS only for this menu item
41
+ # active Mongoid::Boolean Is active
26
42
  #
27
43
  # DcMenuItem documents are embedded in the DcSimpleMenu document and define top
28
44
  # level item of menu system. Submenus are simply defined as YAML text in the submenu field.
@@ -45,7 +45,6 @@ included do
45
45
  field :menu_class, type: String, default: 'DcSimpleMenu'
46
46
  field :files_directory, type: String
47
47
  field :logo, type: String
48
- field :guest_access, type: Integer, default: 0
49
48
  field :active, type: Boolean, default: true
50
49
  field :created_by, type: BSON::ObjectId
51
50
  field :updated_by, type: BSON::ObjectId
@@ -62,7 +61,16 @@ included do
62
61
 
63
62
  validates :name, presence: true
64
63
  validates :name, uniqueness: true
65
-
64
+
65
+ ########################################################################
66
+ # Returns value of site setting. If no value is send as parameter it returns
67
+ # all settings hash object.
68
+ ########################################################################
69
+ def params(what=nil)
70
+ @params ||= self.settings.to_s.size > 5 ? YAML.load(self.settings) : {}
71
+ what.nil? ? @params : @params[what.to_s]
72
+ end
73
+
66
74
  ########################################################################
67
75
  # Return choices for select for site_id
68
76
  ########################################################################
@@ -79,23 +87,45 @@ def self.choices4_policies
79
87
  [['a','b']]
80
88
  end
81
89
 
82
- ########################################################################
83
- # Returns value of site setting. If no value is send as parameter it returns
84
- # all settings hash object.
85
- ########################################################################
86
- def params(what=nil)
87
- @params ||= self.settings.to_s.size > 5 ? YAML.load(self.settings) : {}
88
- what.nil? ? @params : @params[what.to_s]
89
- end
90
-
91
90
  end
92
91
  end
93
92
 
94
93
 
95
94
  ######################################################################
96
- # Mongoid::Document model for dc_sites collection.
95
+ # == Schema information
96
+ #
97
+ # Collection name: dc_site : Sites
98
+ #
99
+ # _id BSON::ObjectId _id
100
+ # created_at Time created_at
101
+ # updated_at Time updated_at
102
+ # name String Name of the site eg. www.mysite.com
103
+ # description String Short description of site
104
+ # homepage_link String Shortcut link when just site name is in the url
105
+ # error_link String Link to error page
106
+ # header String Additional data used in page html header
107
+ # css String Site wide CSS
108
+ # route_name String Default route name for creating page link. ex. page. Leave blank if not used.
109
+ # page_title String Default page title displayed in browser's top menu when title can not be extracted from document
110
+ # document_extension String Default document extension eg. html
111
+ # page_table String Name of table holding data for pages
112
+ # page_class String Rails model class name which defines table holding pages data usually DcPage
113
+ # site_layout String Rails layout used to draw response. This is by default content layout.
114
+ # menu_class String Rails model class name which defines table holding menu data usually DcMenu
115
+ # files_directory String Directory name where uploaded files are located
116
+ # logo String Logotype picture for the site
117
+ # active Mongoid::Boolean Is the site active
118
+ # created_by BSON::ObjectId created_by
119
+ # updated_by BSON::ObjectId updated_by
120
+ # menu_name String Menu name for this site
121
+ # settings String Various site settings
122
+ # alias_for String Is alias name for entered site name
123
+ # rails_view String Rails view filename used as standard design
124
+ # design String Standard design can also be defined at the site level
125
+ # dc_policies Embedded:DcPolicy Access policies defined for the site
126
+ # dc_parts Embedded:DcPart Parts contained in site
97
127
  #
98
- # Since DRG CMS can handle multiple sites on single ROR instance, every document
128
+ # dc_Since DRG CMS can handle multiple sites on single ROR instance, every document
99
129
  # in dc_sites collection defines data which defines a site.
100
130
  #
101
131
  # Sites can be aliased which is very usefull in development and test environment.
@@ -22,9 +22,20 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_stat documents.
26
- #
27
- #
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_stat : Experimental statistics collection. Not used.
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # key1 String key1
33
+ # key2 String key2
34
+ # key3 String key3
35
+ # value Integer value
36
+ # text1 String text1
37
+ # text2 String text2
38
+ # link String link
28
39
  ########################################################################
29
40
 
30
41
  class DcStat #:nodoc:
@@ -111,7 +111,44 @@ end
111
111
  end
112
112
 
113
113
  ########################################################################
114
- # Mongoid::Document model for dc_user documents.
114
+ # == Schema information
115
+ #
116
+ # Collection name: dc_user : Users
117
+ #
118
+ # _id BSON::ObjectId _id
119
+ # created_at Time created_at
120
+ # updated_at Time updated_at
121
+ # username String Username
122
+ # title String Title (dr, mag)
123
+ # first_name String Users first name
124
+ # middle_name String Middle name
125
+ # last_name String Users last name
126
+ # name String Name colected from firstname, title and lastname
127
+ # company String company
128
+ # address String Home address
129
+ # post String Post and post city
130
+ # country String Country
131
+ # phone String Phone number
132
+ # email String e-Mail address
133
+ # www String www
134
+ # picture String Picture file name
135
+ # birthdate Date Date of birth
136
+ # about String Short description of user
137
+ # last_visit Time Users last visit
138
+ # active Mongoid::Boolean Account is active
139
+ # valid_from Date Account is valid from
140
+ # valid_to Date Account is valid until
141
+ # created_by BSON::ObjectId created_by
142
+ # updated_by BSON::ObjectId Account last updated by
143
+ # type Integer Type of user account
144
+ # members Array Members (if type is group)
145
+ # signature String signature
146
+ # interests String interests
147
+ # job_occup String job_occup
148
+ # description String description
149
+ # reg_date Date reg_date
150
+ # password_digest String password_digest
151
+ # dc_user_roles Embedded:DcUserRole Roles for this user
115
152
  #
116
153
  # dc_users collection holds data about regitered users. Passwords are encrypted
117
154
  # with bcrypt gem.
@@ -22,7 +22,19 @@
22
22
  #++
23
23
 
24
24
  ########################################################################
25
- # Mongoid::Document model for dc_user_role embedded documents.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_user_role : User roles
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # created_at Time created_at
31
+ # updated_at Time updated_at
32
+ # dc_policy_role_id Object User role
33
+ # valid_from Date Role is valid from
34
+ # valid_to Date Role is valid to
35
+ # active Mongoid::Boolean Role is active
36
+ # created_by BSON::ObjectId created_by
37
+ # updated_by BSON::ObjectId Role last updated
26
38
  #
27
39
  # DcUserRole documents are embedded in DcUser model and define user roles which
28
40
  # belong to user.
@@ -22,7 +22,17 @@
22
22
  #++
23
23
 
24
24
  ######################################################################
25
- # Mongoid::Document model for dc_visit collection.
25
+ # == Schema information
26
+ #
27
+ # Collection name: dc_visit : Visits
28
+ #
29
+ # _id BSON::ObjectId _id
30
+ # page_id BSON::ObjectId page_id
31
+ # user_id BSON::ObjectId user_id
32
+ # site_id BSON::ObjectId site_id
33
+ # session_id String session_id
34
+ # ip String ip
35
+ # time DateTime time
26
36
  #
27
37
  # DcVisit documents are used to record visits to web site.
28
38
  ######################################################################
@@ -114,7 +114,7 @@ end
114
114
  ####################################################################
115
115
  def ro_standard(value=nil)
116
116
  value = @record[@yaml['name']] if value.nil? and @record.respond_to?(@yaml['name'])
117
- @html << (value.to_s.size == 0 ? '' : "<table class='dc-readonly'><td>#{value}</td></table>")
117
+ @html << (value.blank? ? '' : "<table class='dc-readonly'><td>#{value}</td></table>")
118
118
  self
119
119
  end
120
120
 
@@ -596,9 +596,9 @@ def ro_standard
596
596
  #
597
597
  get_choices.each do |choice|
598
598
  if choice.class == Array
599
- return super(choice.first) if choice.last == value
599
+ return super(choice.first) if choice.last.to_s == value.to_s
600
600
  else
601
- return super(choice) if choice == value
601
+ return super(choice) if choice.to_s == value.to_s
602
602
  end
603
603
  end
604
604
  super('')
@@ -1147,6 +1147,13 @@ EOJS
1147
1147
 
1148
1148
  self
1149
1149
  end
1150
+
1151
+ ###########################################################################
1152
+ # Return value. Return nil if input field is empty
1153
+ ###########################################################################
1154
+ def self.get_data(params, name)
1155
+ params['record']["_#{name}"].blank? ? nil : params['record'][name]
1156
+ end
1150
1157
  end
1151
1158
 
1152
1159
  ###########################################################################
@@ -1165,7 +1172,16 @@ end
1165
1172
  # size: 100x30
1166
1173
  ###########################################################################
1167
1174
  class TextArea < DrgcmsField
1168
-
1175
+
1176
+ ###########################################################################
1177
+ # Return value for readonly field
1178
+ ###########################################################################
1179
+ def ro_standard
1180
+ value = @record[@yaml['name']]
1181
+ @html << "<table class='dc-readonly'><td>#{value.gsub("\n",'<br>')}</td></table>" unless value.blank?
1182
+ self
1183
+ end
1184
+
1169
1185
  ###########################################################################
1170
1186
  # Render text_area field html code
1171
1187
  ###########################################################################
@@ -48,17 +48,18 @@ en:
48
48
  file_manager: File manager
49
49
  edit_selected: Edit documents in selected collection
50
50
  invalid_username: Invalid username or password!
51
- system_menu: CMS system tables
52
51
  menu_plus: Show alternative menu
53
52
  not_email: is not valid e-mail address!
54
53
  updated_by_other: Document was updated by other user. Please reenter your data.
55
54
  not_id: Value entered is not ID!
55
+ cms_main: CMS main tables
56
+ cms_advanced: CMS advanced
56
57
 
57
58
  edit: Edit
58
59
  show: Prikaz
59
60
  new: New
60
61
  sort: Sort
61
- filter: Filter
62
+ filter: Filter
62
63
  back: Back
63
64
  delete: Delete
64
65
  enable: Enable
@@ -67,13 +68,14 @@ en:
67
68
  save: Save
68
69
  save&back: Save & back
69
70
  save&close: Save & close
70
- filter_on: Filter ON
71
- filter_off: Filter OFF
71
+ filter_on: Filter ON
72
+ filter_off: Filter OFF
73
+ filter_set: Set filter
72
74
  maximize: Maximize
73
75
  minimize: Minimize
74
76
  reload: Reload
75
77
  error: Error!
76
- errors_no: 'No. of errors:'
78
+ errors_no: 'No. of errors:'
77
79
 
78
80
  created_by: Created by
79
81
  updated_by: Updated by
@@ -81,7 +83,7 @@ en:
81
83
  updated_at: Updated at
82
84
  new_record: New record
83
85
 
84
- choices4_filter_operators: 'Equal:eq,Like:like'
86
+ choices4_filter_operators: 'Equal to:eq,Contains:like,Greater then:gt,Less then:lt'
85
87
 
86
88
  browse_collections: Browse all collections
87
89
 
@@ -93,3 +95,6 @@ en:
93
95
  dc_captcha:
94
96
  simple_message: Please write in the name of month no %{number} in a year.
95
97
 
98
+ filters:
99
+ this_site_only: Documents for currently selected site only
100
+
@@ -48,11 +48,12 @@ sl:
48
48
  file_manager: Organizator datotek
49
49
  edit_selected: 'Uredi: Izbrano tabelo'
50
50
  invalid_username: Napaka uporabnik ali geslo!
51
- system_menu: CMS sistemske tabele
52
51
  menu_plus: Malo drugačen menu
53
52
  not_email: ni veljaven e-naslov!
54
53
  updated_by_other: Dokument je spremenil drug uporabnik. Prosimo ponovite vpis podatkov.
55
- not_id: Vsebina polja ni ključ ID!
54
+ not_id: Vsebina polja ni ključ ID!
55
+ cms_main: CMS tabele
56
+ cms_advanced: CMS napredne opcije
56
57
 
57
58
  edit: Urejanje
58
59
  show: Prikaz
@@ -69,6 +70,7 @@ sl:
69
70
  save&close: Shrani in zapri
70
71
  filter_on: Vklopi filter
71
72
  filter_off: Izklopi filter
73
+ filter_set: Nastavi filter
72
74
  maximize: Povečaj
73
75
  minimize: Pomanjšaj
74
76
  reload: Osveži
@@ -81,12 +83,14 @@ sl:
81
83
  updated_at: Spremenjeno
82
84
  new_record: Nov zapis
83
85
 
84
- choices4_filter_operators: 'Je enak:eq,Vsebuje:like'
86
+ choices4_filter_operators: 'Je enak:eq,Vsebuje:like,Je večji od:gt,Je manjši od:lt'
85
87
 
86
- browse_collections: Brskanje po zbirkah
88
+ browse_collections: Brskanje po definicijah zbirk
87
89
 
88
90
  dc_journal:
89
91
  zero_selected: Ni izbranih podatkov!
90
92
  restored: Podatki so restavrirani.
91
93
  restore: Restavriraj
92
94
 
95
+ filters:
96
+ this_site_only: Dokumenti samo trenutnoo izbrane strani
@@ -479,11 +479,21 @@ en:
479
479
  value: Value
480
480
 
481
481
  dc_key_value_store:
482
- tabletitle: Table used for storing all kind of values
482
+ tabletitle: Numbering store
483
483
 
484
484
  key: Id key
485
485
  value: Value
486
486
 
487
+ dc_filter:
488
+ tabletitle: Filters definitions for browsing tables
489
+
490
+ dc_user_id: User name
491
+ table: Collection name
492
+ description: Description
493
+ filter: Filter definition
494
+ public: Is public
495
+ sort: Default sort
496
+
487
497
  # help for forms #####################################################
488
498
 
489
499
  help:
@@ -830,3 +840,12 @@ en:
830
840
  dc_key_value_store:
831
841
  key: Identification key
832
842
  value: Stored value
843
+
844
+ dc_filter:
845
+ dc_user_id: User name when filter is for user only
846
+ table: Collection to which filter apply
847
+ description: Filter description
848
+ filter: Filter definition in YAML
849
+ public: Filter is available to all users
850
+ sort: Default sort when selecting filter
851
+