sunrise-cms 1.1.0 → 2.0.0

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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +49 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +3 -1
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.rdoc +13 -3
  7. data/Gemfile +11 -22
  8. data/Gemfile.lock +344 -214
  9. data/README.md +47 -33
  10. data/Rakefile +1 -0
  11. data/app/assets/config/manifest.js +1 -0
  12. data/app/assets/images/sunrise/icons/export.svg +4 -0
  13. data/app/assets/images/sunrise/icons/import.svg +5 -0
  14. data/app/assets/javascripts/sunrise/application.js +2 -5
  15. data/app/assets/javascripts/sunrise/jquery.dialog.js.coffee +113 -40
  16. data/app/assets/javascripts/sunrise/jquery.editable.js.coffee +21 -21
  17. data/app/assets/javascripts/sunrise/manage.js.coffee +29 -28
  18. data/app/assets/stylesheets/sunrise/application.css +0 -1
  19. data/app/assets/stylesheets/sunrise/customize.css +7 -4
  20. data/app/assets/stylesheets/sunrise/main.css +883 -606
  21. data/app/controllers/sunrise/manager_controller.rb +44 -7
  22. data/app/controllers/sunrise/settings_controller.rb +2 -3
  23. data/app/helpers/sunrise/structure_helper.rb +2 -2
  24. data/app/views/layouts/sunrise/application.html.erb +9 -6
  25. data/app/views/sunrise/manager/_field.html.erb +5 -5
  26. data/app/views/sunrise/manager/_form.html.erb +15 -15
  27. data/app/views/sunrise/manager/_header_edit.html.erb +3 -4
  28. data/app/views/sunrise/manager/_header_new.html.erb +3 -3
  29. data/app/views/sunrise/manager/_header_show.html.erb +9 -13
  30. data/app/views/sunrise/manager/_nested_field.html.erb +6 -6
  31. data/app/views/sunrise/manager/buttons/_export.html.erb +9 -2
  32. data/app/views/sunrise/manager/buttons/_import.html.erb +25 -0
  33. data/app/views/sunrise/manager/buttons/_sort.html.erb +3 -3
  34. data/app/views/sunrise/manager/edit.html.erb +1 -1
  35. data/app/views/sunrise/manager/new.html.erb +1 -1
  36. data/app/views/sunrise/manager/structures/thumbs/_record.html.erb +19 -16
  37. data/app/views/sunrise/manager/thumbs/_record.html.erb +26 -22
  38. data/app/views/sunrise/manager/tree/index.html.erb +1 -1
  39. data/app/views/sunrise/settings/_form.html.erb +5 -5
  40. data/app/views/sunrise/settings/_header_edit.html.erb +3 -4
  41. data/config/locales/sunrise/en.yml +35 -35
  42. data/config/locales/sunrise/ru.yml +35 -35
  43. data/config/locales/sunrise/uk.yml +35 -35
  44. data/config/routes.rb +1 -0
  45. data/db/migrate/20111216144515_create_assets.rb +1 -1
  46. data/db/migrate/20111216144915_create_structures.rb +1 -1
  47. data/db/migrate/20111216145015_create_users.rb +1 -1
  48. data/db/migrate/20120611095315_create_settings.rb +1 -1
  49. data/lib/generators/sunrise/templates/config/active_record/sunrise.rb +0 -4
  50. data/lib/generators/sunrise/templates/config/mongoid/sunrise.rb +0 -4
  51. data/lib/generators/sunrise/templates/models/active_record/attachment_file.rb +0 -2
  52. data/lib/generators/sunrise/templates/models/active_record/avatar.rb +0 -2
  53. data/lib/generators/sunrise/templates/models/active_record/picture.rb +0 -2
  54. data/lib/generators/sunrise/templates/models/active_record/position_type.rb +4 -4
  55. data/lib/generators/sunrise/templates/models/active_record/role_type.rb +5 -5
  56. data/lib/generators/sunrise/templates/models/active_record/settings.rb +14 -2
  57. data/lib/generators/sunrise/templates/models/active_record/structure_type.rb +6 -6
  58. data/lib/generators/sunrise/templates/models/mongoid/attachment_file.rb +0 -2
  59. data/lib/generators/sunrise/templates/models/mongoid/avatar.rb +0 -2
  60. data/lib/generators/sunrise/templates/models/mongoid/picture.rb +0 -2
  61. data/lib/generators/sunrise/templates/models/mongoid/position_type.rb +4 -4
  62. data/lib/generators/sunrise/templates/models/mongoid/role_type.rb +5 -5
  63. data/lib/generators/sunrise/templates/models/mongoid/structure_type.rb +6 -6
  64. data/lib/generators/sunrise/templates/models/sunrise/sunrise_structure.rb +2 -2
  65. data/lib/generators/sunrise/templates/spec/controllers/pages_controller_spec.rb +2 -2
  66. data/lib/generators/sunrise/templates/spec/controllers/welcome_controller_spec.rb +1 -1
  67. data/lib/generators/sunrise/templates/spec/factories/structure_factory.rb +2 -2
  68. data/lib/generators/sunrise/templates/spec/factories/user_factory.rb +6 -6
  69. data/lib/generators/sunrise/templates/spec/spec_helper.rb +1 -1
  70. data/lib/generators/sunrise/templates/spec/support/helpers/controller_macros.rb +4 -4
  71. data/lib/generators/sunrise/templates/uploaders/attachment_file_uploader.rb +4 -0
  72. data/lib/generators/sunrise/templates/uploaders/avatar_uploader.rb +4 -0
  73. data/lib/generators/sunrise/templates/uploaders/picture_uploader.rb +4 -0
  74. data/lib/sunrise/abstract_model.rb +13 -3
  75. data/lib/sunrise/carrierwave/glue.rb +1 -7
  76. data/lib/sunrise/config/model.rb +4 -0
  77. data/lib/sunrise/config.rb +0 -5
  78. data/lib/sunrise/core_ext/string.rb +0 -5
  79. data/lib/sunrise/engine.rb +7 -1
  80. data/lib/sunrise/models/ability.rb +8 -8
  81. data/lib/sunrise/models/position_type.rb +1 -7
  82. data/lib/sunrise/models/role_type.rb +4 -6
  83. data/lib/sunrise/models/structure.rb +3 -3
  84. data/lib/sunrise/models/structure_type.rb +1 -7
  85. data/lib/sunrise/models/user.rb +4 -4
  86. data/lib/sunrise/utils.rb +1 -2
  87. data/lib/sunrise/version.rb +1 -1
  88. data/lib/sunrise/views/search_wrapper.rb +1 -1
  89. data/sunrise-cms.gemspec +8 -13
  90. metadata +24 -65
  91. data/.rspec +0 -2
  92. data/lib/sunrise/carrierwave/file_size_validator.rb +0 -75
  93. data/lib/sunrise/utils/transliteration.rb +0 -73
@@ -5,22 +5,23 @@ class Sunrise
5
5
 
6
6
  constructor: (@namespace) ->
7
7
  @sortedFields = []
8
-
8
+
9
9
  setup: ->
10
10
  $('[title]').tooltip()
11
11
  $(".ddmenu").ddmenu()
12
12
  $('[data-editable]').editable()
13
13
  $('[data-lang]').lang_tabs()
14
14
 
15
- $("select.select:not(.noselect2)").select2(
16
- allowClear: true
17
- minimumResultsForSearch: 10
18
- width: 'resolve'
19
- )
20
-
15
+ if $?.fn?.select2?
16
+ $("select.select:not(.noselect2)").select2(
17
+ allowClear: true
18
+ minimumResultsForSearch: 10
19
+ width: 'resolve'
20
+ )
21
+
21
22
  this.init_submit_buttons()
22
23
  this.init_group_menus()
23
-
24
+
24
25
  getParameterByName: (name) ->
25
26
  match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search)
26
27
  if match then decodeURIComponent(match[1].replace(/\+/g, ' ')) else null
@@ -28,11 +29,11 @@ class Sunrise
28
29
  init_sort_select: ->
29
30
  $("#sort").bind 'change', (evt) ->
30
31
  this.form.submit()
31
-
32
+
32
33
  init_submit_buttons: ->
33
34
  $('#cancel-submit-form-button').bind 'click', (evt) ->
34
35
  window.history.back()
35
-
36
+
36
37
  $('#submit-form-button').bind 'click', (evt) ->
37
38
  $('form:first').submit()
38
39
 
@@ -52,21 +53,21 @@ class Sunrise
52
53
  storeQuery: () ->
53
54
  query = {}
54
55
  self = this
55
-
56
+
56
57
  $.each ['page', 'per', 'sort', 'view'], (index) ->
57
58
  value = self.getParameterByName(this)
58
59
  query[this] = value if value?
59
-
60
+
60
61
  $.cookie('params', $.param(query), { expires: 30, path: @namespace })
61
-
62
+
62
63
  serialize: (items, options) ->
63
64
  str = []
64
- defaults =
65
+ defaults =
65
66
  attribute: 'id'
66
67
  listType: 'ul'
67
68
  expression: /(.+)[-=_](.+)/
68
69
  key: null
69
-
70
+
70
71
  o = $.extend defaults, options
71
72
 
72
73
  $(items).each((index) ->
@@ -82,35 +83,35 @@ class Sunrise
82
83
  str.push(o.key + '=')
83
84
 
84
85
  return str.join('&')
85
-
86
+
86
87
  serializeTree: (element, options) ->
87
- defaults =
88
+ defaults =
88
89
  attribute: 'id'
89
90
  listType: 'ul'
90
91
  expression: /(.+)[-=_](.+)/
91
92
  key: "tree"
92
93
  startDepthCount: 0
93
94
  root: false
94
-
95
+
95
96
  o = $.extend defaults, options
96
97
  sDepth = o.startDepthCount
97
98
  ret = []
98
99
  left = 1
99
-
100
+
100
101
  if o.root
101
102
  sDepth += 1
102
103
  left += 1
103
-
104
+
104
105
  fn_recursiveArray = (item, depth, left) ->
105
106
  right = left + 1
106
107
 
107
108
  if $(item).children(o.listType).children('li').length > 0
108
109
  depth += 1
109
-
110
+
110
111
  $(item).children(o.listType).children('li').each(() ->
111
112
  right = fn_recursiveArray($(this), depth, right)
112
113
  )
113
-
114
+
114
115
  depth -= 1
115
116
 
116
117
  id = ($(item).attr(o.attribute)).match(o.expression)
@@ -126,7 +127,7 @@ class Sunrise
126
127
 
127
128
  left = right + 1
128
129
  return left
129
-
130
+
130
131
  if o.root
131
132
  ret.push(
132
133
  "item_id": 'root'
@@ -135,13 +136,13 @@ class Sunrise
135
136
  "left": '1'
136
137
  "right": ($('li', element).length + 1) * 2
137
138
  )
138
-
139
+
139
140
  $(element).children('li').each(() ->
140
141
  left = fn_recursiveArray(this, sDepth, left)
141
142
  )
142
143
 
143
144
  ret = ret.sort((a,b) -> return (a.left - b.left) )
144
-
145
+
145
146
  if o.key
146
147
  arr = []
147
148
  $.each(ret, () ->
@@ -150,7 +151,7 @@ class Sunrise
150
151
  hash[param] = this
151
152
  arr.push $.param(hash)
152
153
  )
153
-
154
+
154
155
  return arr.join("&")
155
156
  else
156
157
  return ret
@@ -165,7 +166,7 @@ class Sunrise
165
166
 
166
167
  remove_fields: (link) ->
167
168
  hidden_field = $(link).prev("input[type=hidden]")
168
-
169
+
169
170
  if hidden_field.length isnt 0
170
171
  hidden_field.val('1')
171
172
 
@@ -179,7 +180,7 @@ class Sunrise
179
180
  handle: '.nested_input_handle'
180
181
  items: '.nested_item'
181
182
  opacity: 0.8
182
- update: (event, ui) =>
183
+ update: (event, ui) =>
183
184
  element = $(ui.item)
184
185
  container = element.parents('div.nested')
185
186
  this.updateSortContainer(container)
@@ -8,7 +8,6 @@
8
8
  *= require sunrise/customize.css
9
9
  *= require sunrise/plugins.css
10
10
  *= require uploader/application
11
- *= require select2
12
11
 
13
12
  *= require jquery-ui/core
14
13
  *= require jquery-ui/theme
@@ -116,7 +116,7 @@ input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focu
116
116
  background: url(/assets/sunrise/top_plus.png) no-repeat 15px center;
117
117
  padding: 0 20px 0 35px;
118
118
  }
119
- .top-wrapper .menu-holder .main-menu .main .arr,
119
+ .top-wrapper .menu-holder .main-menu .main .arr,
120
120
  .top-wrapper .menu-holder .main-menu .creates .arr {
121
121
  display: block;
122
122
  overflow: hidden;
@@ -141,6 +141,9 @@ input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focu
141
141
  margin: 0 0 0 1px;
142
142
  list-style: none;
143
143
  border-left: solid 1px #000;
144
+ /* scrollable dropdowns */
145
+ max-height: calc(100vh - 60px);
146
+ overflow-y: auto;
144
147
  }
145
148
  .sub-wrapper .default-list li a {
146
149
  display: block;
@@ -165,7 +168,7 @@ input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focu
165
168
 
166
169
  .field_with_errors span.error {
167
170
  color: #ff0000;
168
- font-size: 12px;
171
+ font-size: 12px;
169
172
  }
170
173
 
171
174
  div.input.check_boxes span.checkbox {
@@ -284,7 +287,7 @@ div.input.boolean input {
284
287
  }
285
288
 
286
289
  .select2-drop-active {
287
- border: 1px solid #d9d9d9 !important;
290
+ border: 1px solid #d9d9d9 !important;
288
291
  }
289
292
  .select2-container-active .select2-choice, .select2-container-active .select2-choices {
290
293
  border: 1px solid #d9d9d9 !important;
@@ -292,4 +295,4 @@ div.input.boolean input {
292
295
  .select2-results .select2-highlighted {
293
296
  background: #972da0 !important;
294
297
  color: #fff !important;
295
- }
298
+ }