sunrise-cms 1.1.1 → 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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +49 -0
  3. data/.rubocop.yml +3 -1
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.rdoc +5 -0
  6. data/Gemfile +9 -17
  7. data/Gemfile.lock +332 -207
  8. data/README.md +42 -34
  9. data/app/assets/config/manifest.js +1 -0
  10. data/app/assets/javascripts/sunrise/application.js +2 -4
  11. data/app/controllers/sunrise/manager_controller.rb +4 -6
  12. data/app/controllers/sunrise/settings_controller.rb +2 -3
  13. data/app/helpers/sunrise/structure_helper.rb +2 -2
  14. data/app/views/layouts/sunrise/application.html.erb +2 -0
  15. data/app/views/sunrise/manager/_field.html.erb +5 -5
  16. data/app/views/sunrise/manager/_form.html.erb +15 -15
  17. data/app/views/sunrise/manager/_header_edit.html.erb +3 -4
  18. data/app/views/sunrise/manager/_header_new.html.erb +3 -3
  19. data/app/views/sunrise/manager/_header_show.html.erb +9 -13
  20. data/app/views/sunrise/manager/_nested_field.html.erb +6 -6
  21. data/app/views/sunrise/manager/edit.html.erb +1 -1
  22. data/app/views/sunrise/manager/new.html.erb +1 -1
  23. data/app/views/sunrise/manager/structures/thumbs/_record.html.erb +19 -16
  24. data/app/views/sunrise/manager/thumbs/_record.html.erb +26 -22
  25. data/app/views/sunrise/settings/_form.html.erb +5 -5
  26. data/app/views/sunrise/settings/_header_edit.html.erb +3 -4
  27. data/config/locales/sunrise/en.yml +35 -35
  28. data/config/locales/sunrise/ru.yml +35 -35
  29. data/config/locales/sunrise/uk.yml +35 -35
  30. data/db/migrate/20111216144515_create_assets.rb +1 -1
  31. data/db/migrate/20111216144915_create_structures.rb +1 -1
  32. data/db/migrate/20111216145015_create_users.rb +1 -1
  33. data/db/migrate/20120611095315_create_settings.rb +1 -1
  34. data/lib/generators/sunrise/templates/config/active_record/sunrise.rb +0 -4
  35. data/lib/generators/sunrise/templates/config/mongoid/sunrise.rb +0 -4
  36. data/lib/generators/sunrise/templates/models/active_record/attachment_file.rb +0 -2
  37. data/lib/generators/sunrise/templates/models/active_record/avatar.rb +0 -2
  38. data/lib/generators/sunrise/templates/models/active_record/picture.rb +0 -2
  39. data/lib/generators/sunrise/templates/models/active_record/position_type.rb +4 -4
  40. data/lib/generators/sunrise/templates/models/active_record/role_type.rb +5 -5
  41. data/lib/generators/sunrise/templates/models/active_record/settings.rb +14 -2
  42. data/lib/generators/sunrise/templates/models/active_record/structure_type.rb +6 -6
  43. data/lib/generators/sunrise/templates/models/mongoid/attachment_file.rb +0 -2
  44. data/lib/generators/sunrise/templates/models/mongoid/avatar.rb +0 -2
  45. data/lib/generators/sunrise/templates/models/mongoid/picture.rb +0 -2
  46. data/lib/generators/sunrise/templates/models/mongoid/position_type.rb +4 -4
  47. data/lib/generators/sunrise/templates/models/mongoid/role_type.rb +5 -5
  48. data/lib/generators/sunrise/templates/models/mongoid/structure_type.rb +6 -6
  49. data/lib/generators/sunrise/templates/models/sunrise/sunrise_structure.rb +2 -2
  50. data/lib/generators/sunrise/templates/spec/controllers/pages_controller_spec.rb +2 -2
  51. data/lib/generators/sunrise/templates/spec/controllers/welcome_controller_spec.rb +1 -1
  52. data/lib/generators/sunrise/templates/spec/factories/structure_factory.rb +2 -2
  53. data/lib/generators/sunrise/templates/spec/factories/user_factory.rb +6 -6
  54. data/lib/generators/sunrise/templates/spec/spec_helper.rb +1 -1
  55. data/lib/generators/sunrise/templates/spec/support/helpers/controller_macros.rb +4 -4
  56. data/lib/generators/sunrise/templates/uploaders/attachment_file_uploader.rb +4 -0
  57. data/lib/generators/sunrise/templates/uploaders/avatar_uploader.rb +4 -0
  58. data/lib/generators/sunrise/templates/uploaders/picture_uploader.rb +4 -0
  59. data/lib/sunrise/abstract_model.rb +10 -0
  60. data/lib/sunrise/carrierwave/glue.rb +1 -7
  61. data/lib/sunrise/config.rb +0 -5
  62. data/lib/sunrise/core_ext/string.rb +0 -5
  63. data/lib/sunrise/engine.rb +5 -5
  64. data/lib/sunrise/models/ability.rb +1 -1
  65. data/lib/sunrise/models/position_type.rb +1 -7
  66. data/lib/sunrise/models/role_type.rb +4 -6
  67. data/lib/sunrise/models/structure.rb +3 -3
  68. data/lib/sunrise/models/structure_type.rb +1 -7
  69. data/lib/sunrise/models/user.rb +4 -4
  70. data/lib/sunrise/utils.rb +1 -2
  71. data/lib/sunrise/version.rb +1 -1
  72. data/lib/sunrise/views/search_wrapper.rb +1 -1
  73. data/sunrise-cms.gemspec +8 -11
  74. metadata +22 -38
  75. data/.rspec +0 -2
  76. data/lib/sunrise/carrierwave/file_size_validator.rb +0 -75
  77. data/lib/sunrise/utils/transliteration.rb +0 -73
data/README.md CHANGED
@@ -1,25 +1,33 @@
1
1
  # Sunrise CMS
2
2
 
3
+ [![Tests](https://github.com/galetahub/sunrise/actions/workflows/tests.yml/badge.svg)](https://github.com/galetahub/sunrise/actions/workflows/tests.yml)
4
+
3
5
  Open source mini content management system for programmers.
4
6
 
5
7
  ## Setup
6
8
 
9
+ For rails 7.x.x:
10
+
11
+ ```ruby
12
+ gem 'sunrise-cms', '~> 2.0', require: 'sunrise'
13
+ ```
14
+
7
15
  For rails 5.x.x:
8
16
 
9
17
  ```ruby
10
- gem 'sunrise-cms', '~> 1.1.0', require: 'sunrise'
18
+ gem 'sunrise-cms', '~> 1.1.0', require: 'sunrise'
11
19
  ```
12
20
 
13
21
  For rails 4.x.x:
14
22
 
15
23
  ```ruby
16
- gem "sunrise-cms", :require => "sunrise"
24
+ gem "sunrise-cms", require: "sunrise"
17
25
  ```
18
26
 
19
27
  For rails 3.x.x:
20
28
 
21
29
  ```ruby
22
- gem "sunrise-cms", "~> 0.7.x" :require => "sunrise"
30
+ gem "sunrise-cms", "~> 0.7.x" require: "sunrise"
23
31
  ```
24
32
 
25
33
  ## Instructions
@@ -27,23 +35,23 @@ For rails 3.x.x:
27
35
  ### ActiveRecord
28
36
 
29
37
  ```bash
30
- $> rails g devise:install
31
- $> rails g sunrise:install --orm=active_record
38
+ rails g devise:install
39
+ rails g sunrise:install --orm=active_record
32
40
  ```
33
41
 
34
42
  Copy db migrations files:
35
43
 
36
44
  ```bash
37
- $> rake sunrise:install:migrations
38
- $> rake page_parts_engine:install:migrations
39
- $> rake meta_manager_engine:install:migrations
40
- $> rails g public_activity:migration
45
+ rake sunrise:install:migrations
46
+ rake page_parts_engine:install:migrations
47
+ rake meta_manager_engine:install:migrations
48
+ rails g public_activity:migration
41
49
  ```
42
50
 
43
51
  ### Mongoid
44
52
 
45
53
  ```bash
46
- $> rails g sunrise:install --orm=mongoid
54
+ rails g sunrise:install --orm=mongoid
47
55
  ```
48
56
 
49
57
  ## Usage
@@ -57,7 +65,7 @@ class SunriseProduct < Sunrise::AbstractModel
57
65
  association :structure
58
66
 
59
67
  after_sort :clear_cache
60
-
68
+
61
69
  index :thumbs do
62
70
  scope { Product.includes(:picture) }
63
71
  preview lambda { |product| product.picture.try(:url, :thumb) }
@@ -78,7 +86,7 @@ class SunriseProduct < Sunrise::AbstractModel
78
86
  field :unique_accounts_count
79
87
  field :total_points
80
88
  end
81
-
89
+
82
90
  show do
83
91
  field :title
84
92
  field :price
@@ -86,43 +94,43 @@ class SunriseProduct < Sunrise::AbstractModel
86
94
  field :sort_order
87
95
  field :is_visible
88
96
  end
89
-
97
+
90
98
  form do
91
99
  field :title
92
100
  field :price
93
101
  field :total_stock
94
-
102
+
95
103
  field do |form, record|
96
- form.input :notes, :as => :text, :id => record.id
104
+ form.input :notes, as: :text, id: record.id
97
105
  end
98
106
 
99
- group :sidebar, :holder => :sidebar do
100
- field :sale_limit_id, :collection => lambda { SaleLimit.all }, :include_blank => false
107
+ group :sidebar, holder: :sidebar do
108
+ field :sale_limit_id, collection: lambda { SaleLimit.all }, include_blank: false
101
109
  field :sort_order
102
- field :is_visible, :boolean => true
110
+ field :is_visible, boolean: true
103
111
  end
104
112
 
105
- group :bottom, :holder => :bottom do
106
- nested_attributes :variants, :multiply => true do
113
+ group :bottom, holder: :bottom do
114
+ nested_attributes :variants, multiply: true do
107
115
  field :size
108
- field :total_stock, :html => { :style => 'width:100%;clear:both;' }
109
- field :item_model_id, :collection => lambda { ItemModel.all }, :include_blank => false
116
+ field :total_stock, html: { style: 'width:100%;clear:both;' }
117
+ field :item_model_id, collection: lambda { ItemModel.all }, include_blank: false
110
118
  end
111
119
 
112
120
  nested_attributes :project_fields, multiply: true, sort: true do
113
121
  field :name
114
122
  field :value
115
123
  end
116
-
117
- field :picture, :as => :uploader
124
+
125
+ field :picture, as: :uploader
118
126
  end
119
127
  end
120
128
 
121
- protected
129
+ private
122
130
 
123
- def clear_cache
124
- Rails.cache.clear
125
- end
131
+ def clear_cache
132
+ Rails.cache.clear
133
+ end
126
134
  end
127
135
  ```
128
136
 
@@ -156,14 +164,14 @@ For more info look at jbuilder https://rubygems.org/gems/jbuilder.
156
164
  #### Excel
157
165
 
158
166
  ```
159
- gem "ruby2xlsx", "~> 0.0.1"
167
+ gem "ruby2xlsx"
160
168
 
161
169
  GET /manage/users/export.xlsx
162
170
  ```
163
171
 
164
172
  ### Strong parameters
165
173
 
166
- Now in sunrise file you can perform attributes check.
174
+ Now in sunrise file you can perform attributes check.
167
175
  By default permited_attributes allow edit all attributes.
168
176
 
169
177
  ```ruby
@@ -171,11 +179,11 @@ class SunrisePost < Sunrise::AbstractModel
171
179
  self.resource_name = "Post"
172
180
  edit do
173
181
  # Default value
174
- # permited_attributes :all
182
+ # permited_attributes :all
175
183
 
176
184
  # Pre user check
177
- permited_attributes lambda { |user|
178
- user.admin? ? :all : [:title, :content]
185
+ permited_attributes lambda { |user|
186
+ user.admin? ? :all : [:title, :content]
179
187
  }
180
188
  end
181
189
  end
@@ -207,4 +215,4 @@ config.to_prepare do
207
215
  end
208
216
  ```
209
217
 
210
- Copyright (c) 2014 Fodojo, released under the MIT license
218
+ Copyright (c) 2025 Fodojo, released under the MIT license
@@ -0,0 +1 @@
1
+ //= link sunrise/application.css
@@ -1,8 +1,6 @@
1
- //= require jquery
2
- //= require jquery_ujs
1
+ //= require jquery-ui/widgets/sortable
2
+ //= require jquery-ui/widgets/datepicker
3
3
 
4
- //= require jquery-ui/sortable
5
- //= require jquery-ui/datepicker
6
4
  //= require datepicker/jquery.ui.datepicker-uk
7
5
  //= require datepicker/jquery.ui.datepicker-ru
8
6
 
@@ -12,7 +12,7 @@ module Sunrise
12
12
  helper_method :abstract_model, :apply_scope, :scoped_index_path
13
13
 
14
14
  respond_to(*Sunrise::Config.navigational_formats)
15
- respond_to :xml, :csv, :xlsx, only: %i[export]
15
+ respond_to :json, :csv, :xlsx, only: %i[export]
16
16
 
17
17
  def index
18
18
  @records = abstract_model.apply_scopes(params)
@@ -29,7 +29,7 @@ module Sunrise
29
29
  end
30
30
 
31
31
  def new
32
- @record.assign_attributes(abstract_model.model_params)
32
+ @record.assign_attributes(abstract_model.permit_model_params)
33
33
 
34
34
  respond_with(@record) do |format|
35
35
  format.html { render_with_scope }
@@ -37,7 +37,7 @@ module Sunrise
37
37
  end
38
38
 
39
39
  def create
40
- @record.update_attributes(model_params)
40
+ @record.update(model_params)
41
41
  respond_with(@record, location: redirect_after_update(@record))
42
42
  end
43
43
 
@@ -48,7 +48,7 @@ module Sunrise
48
48
  end
49
49
 
50
50
  def update
51
- @record.update_attributes(model_params)
51
+ @record.update(model_params)
52
52
  respond_with(@record, location: redirect_after_update(@record))
53
53
  end
54
54
 
@@ -64,8 +64,6 @@ module Sunrise
64
64
  format.xml { render xml: @records }
65
65
  format.json { render json: @records }
66
66
  format.csv { render abstract_model.export_options.merge(csv: @records) }
67
-
68
- format.xlsx { render abstract_model.export_options.merge(xlsx: @records) } if defined?(Mime::XLSX)
69
67
  end
70
68
  end
71
69
 
@@ -5,12 +5,11 @@ module Sunrise
5
5
  authorize_resource class: false
6
6
 
7
7
  def edit
8
- @settings = Settings.get_all
9
- respond_with(@settings)
8
+ @fields = Settings.defined_fields
10
9
  end
11
10
 
12
11
  def update
13
- Settings.update_attributes(params[:settings])
12
+ Settings.update(params[:settings])
14
13
  redirect_to root_path
15
14
  end
16
15
  end
@@ -7,9 +7,9 @@ module Sunrise
7
7
 
8
8
  options = { parent_id: record.id, parent_type: 'Structure' }.merge(options)
9
9
 
10
- case record.structure_type.kind
10
+ case record.structure_type.name
11
11
  when :page then edit_path(model_name: 'pages', id: record.id)
12
- when :posts then index_path(options.merge(model_name: record.structure_type.kind))
12
+ when :posts then index_path(options.merge(model_name: record.structure_type.name))
13
13
  else edit_path(model_name: 'structures', id: record.id)
14
14
  end
15
15
  end
@@ -8,6 +8,8 @@
8
8
  <title><%= t('manage.page_title') %></title>
9
9
 
10
10
  <%= stylesheet_link_tag 'sunrise/application' %>
11
+ <%= javascript_include_tag 'https://code.jquery.com/jquery-3.7.1.slim.min.js', integrity: 'sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=', crossorigin: 'anonymous' %>
12
+ <%= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.2.3/rails.min.js' %>
11
13
  <%= javascript_include_tag 'sunrise/application' %>
12
14
  <%#= javascript_include_tag ::Ckeditor.cdn_url %>
13
15
  </head>
@@ -6,14 +6,14 @@
6
6
  <% elsif field.nested? -%>
7
7
  <div class="nested">
8
8
  <div class="title-switcher up"><%= form.label field.name %></div>
9
-
9
+
10
10
  <%= form.simple_fields_for field.name.to_sym do |nested| %>
11
- <%= render :partial => "nested_field", :locals => { :form => nested, :field => field } %>
11
+ <%= render partial: "nested_field", locals: { form: nested, field: field } %>
12
12
  <% end -%>
13
-
13
+
14
14
  <% if field.multiply? %>
15
15
  <div class="nested_bottom">
16
- <%= manage_add_child_link t('manage.buttons.add_nested_field'), form, field, {:partial=>"nested_field"} %>
16
+ <%= manage_add_child_link t('manage.buttons.add_nested_field'), form, field, { partial: "nested_field" } %>
17
17
  </div>
18
18
  <% end -%>
19
19
 
@@ -28,7 +28,7 @@
28
28
  <% elsif field.association? -%>
29
29
  <%= form.association field.name.to_sym, field.input_options.merge(options) %>
30
30
  <% else -%>
31
- <%= form.input field.name, field.input_options.merge(options) %>
31
+ <%= form.input field.name, field.input_options.merge(options) %>
32
32
  <% end -%>
33
33
  <% end -%>
34
34
  <% end -%>
@@ -1,15 +1,15 @@
1
- <%= manage_form_for @record, :html => { :multipart => true } do |f| -%>
2
- <%= render :partial => 'sunrise/shared/parent' %>
1
+ <%= manage_form_for @record, html: { multipart: true, id: 'resource-manage-form' } do |f| -%>
2
+ <%= render partial: 'sunrise/shared/parent' %>
3
3
 
4
4
  <div class="post-edit-holder">
5
- <%= render :partial => "sunrise/shared/locale" if abstract_model.translate? %>
6
-
5
+ <%= render partial: "sunrise/shared/locale" if abstract_model.translate? %>
6
+
7
7
  <div class="wysiwyg-holder">
8
- <%= render :partial => "sunrise/shared/available_locales", :locals => {:form => f} if abstract_model.translate? %>
9
-
10
- <%= render :partial => 'field', :collection => abstract_model.form_fields, :locals => {:form => f} %>
8
+ <%= render partial: "sunrise/shared/available_locales", locals: {form: f} if abstract_model.translate? %>
9
+
10
+ <%= render partial: 'field', collection: abstract_model.form_fields, locals: {form: f} %>
11
11
  </div>
12
-
12
+
13
13
  <% if abstract_model.sidebar_groups? -%>
14
14
  <div class="post-properties-holder">
15
15
  <% abstract_model.sidebar_groups.each do |group| -%>
@@ -17,17 +17,17 @@
17
17
  <% if group.title != false -%>
18
18
  <div class="title-switcher up"><span><%= group.title %></span></div>
19
19
  <% end -%>
20
-
21
- <%= render :partial => 'field', :collection => group.fields, :locals => {:form => f} %>
20
+
21
+ <%= render partial: 'field', collection: group.fields, locals: {form: f} %>
22
22
  </div>
23
23
  <% end -%>
24
- </div>
24
+ </div>
25
25
  <% end -%>
26
26
  </div>
27
-
27
+
28
28
  <% abstract_model.bottom_groups.each do |group| -%>
29
- <%= render :partial => 'field', :collection => group.fields, :locals => {:form => f} %>
29
+ <%= render partial: 'field', collection: group.fields, locals: {form: f} %>
30
30
  <% end -%>
31
-
32
- <%= f.button :submit, :style => "display:none;", :id => "submit-button-hidden" %>
31
+
32
+ <%= f.button :submit, style: "display:none;", id: "submit-button-hidden" %>
33
33
  <% end -%>
@@ -1,11 +1,10 @@
1
1
  <div class="filter-line-wrapper">
2
2
  <div class="filter-line-holder">
3
3
  <div class="struct-name"><%= t('manage.edit')%></div>
4
-
4
+
5
5
  <div class="vline-block">
6
- <%= submit_tag t('manage.update'), :class => 'button', :id => 'submit-form-button' %>
7
- <%= submit_tag t('manage.cancel'), :class => 'button gray', :id => 'cancel-submit-form-button' %>
8
- <!--<input type="submit" value="Применить" class="button gray" />-->
6
+ <%= submit_tag t('manage.update'), class: 'button', id: 'submit-form-button', form: 'resource-manage-form' %>
7
+ <%= submit_tag t('manage.cancel'), class: 'button gray', id: 'cancel-submit-form-button' %>
9
8
  </div>
10
9
  </div>
11
10
  </div>
@@ -1,10 +1,10 @@
1
1
  <div class="filter-line-wrapper">
2
2
  <div class="filter-line-holder">
3
3
  <div class="struct-name"><%= t('manage.add')%></div>
4
-
4
+
5
5
  <div class="vline-block">
6
- <%= submit_tag t('manage.create'), :class => 'button', :id => 'submit-form-button' %>
7
- <%= submit_tag t('manage.cancel'), :class => 'button gray', :id => 'cancel-submit-form-button' %>
6
+ <%= submit_tag t('manage.create'), class: 'button', id: 'submit-form-button', form: 'resource-manage-form' %>
7
+ <%= submit_tag t('manage.cancel'), class: 'button gray', id: 'cancel-submit-form-button' %>
8
8
  </div>
9
9
  </div>
10
10
  </div>
@@ -3,10 +3,10 @@
3
3
  <div class="struct-name"><%= abstract_model.label %></div>
4
4
 
5
5
  <div class="vline-block">
6
- <%= form_for search_wrapper, :url => scoped_index_path, :html => { :method => :get, :novalidate => true } do |f| %>
7
- <%= render :partial => 'sunrise/shared/parent' %>
6
+ <%= form_for search_wrapper, url: scoped_index_path, html: { method: :get, novalidate: true } do |f| %>
7
+ <%= render partial: 'sunrise/shared/parent' %>
8
8
  <%= f.text_field :q %>
9
- <%= f.submit t('manage.search'), :class => "button" %>
9
+ <%= f.submit t('manage.search'), class: "button" %>
10
10
  <% end %>
11
11
  </div>
12
12
  </div>
@@ -15,28 +15,24 @@
15
15
  <div class="top-line-holder">
16
16
  <div class="act-buttons-wrapper">
17
17
 
18
- <% if can? :edit, @record, :context => :sunrise %>
18
+ <% if can? :edit, @record, context: :sunrise %>
19
19
  <div class="but-holder">
20
20
  <div class="act-but">
21
- <%= link_to image_tag('sunrise/empty.gif'), edit_path(abstract_model.parent_hash.merge(:id => @record.id)), :class => 'but-container edit', :title => 'Edit' %>
21
+ <%= link_to image_tag('sunrise/empty.gif'), edit_path(abstract_model.parent_hash.merge(id: @record.id)), class: 'but-container edit', title: 'Edit' %>
22
22
  </div>
23
23
  </div>
24
24
  <% end -%>
25
25
 
26
- <% if can? :delete, @record, :context => :sunrise %>
26
+ <% if can? :delete, @record, context: :sunrise %>
27
27
  <div class="but-holder">
28
28
  <div class="act-but">
29
- <%= link_to image_tag('sunrise/empty.gif'), delete_path(abstract_model.parent_hash.merge(:id => @record.id)),
30
- :class => 'but-container del',
31
- :title => 'Delete',
32
- :method=>:delete,
33
- :data => { :confirm => t('manage.confirm_delete') } %>
29
+ <%= link_to image_tag('sunrise/empty.gif'), delete_path(abstract_model.parent_hash.merge(id: @record.id)), class: 'but-container del', title: 'Delete', method: :delete, data: { confirm: t('manage.confirm_delete') } %>
34
30
  </div>
35
31
  </div>
36
32
  <% end %>
37
33
 
38
34
  <div class="buttons-holder">
39
- <%= render :partial => apply_scope("controls"), :locals => {:record => @record} %>
35
+ <%= render partial: apply_scope("controls"), locals: { record: @record } %>
40
36
  </div>
41
37
  </div>
42
- </div>
38
+ </div>
@@ -1,10 +1,10 @@
1
1
  <div class="nested_item">
2
- <%= manage_remove_child_link('', form, :class => "close-but") if field.multiply? %>
3
-
2
+ <%= manage_remove_child_link('', form, class: "close-but") if field.multiply? %>
3
+
4
4
  <% if field.sort? %>
5
- <%= image_tag 'sunrise/tree_dnd1.png', :class => "nested_input_handle" %>
6
- <%= form.hidden_field field.sort_column, :class => "nested_input_sort" if field.sort_hidden_field? %>
5
+ <%= image_tag 'sunrise/tree_dnd1.png', class: "nested_input_handle" %>
6
+ <%= form.hidden_field field.sort_column, class: "nested_input_sort" if field.sort_hidden_field? %>
7
7
  <% end -%>
8
8
 
9
- <%= render :partial => 'field', :collection => field.fields, :locals => {:form => form} %>
10
- </div>
9
+ <%= render partial: 'field', collection: field.fields, locals: { form: form } %>
10
+ </div>
@@ -1,3 +1,3 @@
1
1
  <div class="wrapper without-panel">
2
- <%= render :partial => 'form' %>
2
+ <%= render partial: 'form' %>
3
3
  </div>
@@ -1,3 +1,3 @@
1
1
  <div class="wrapper without-panel">
2
- <%= render :partial => 'form' %>
2
+ <%= render partial: 'form' %>
3
3
  </div>
@@ -1,15 +1,14 @@
1
- <%= content_tag(:div, :id => dom_id(record), :class => "main-item") do %>
1
+ <%= content_tag(:div, id: dom_id(record), class: "main-item") do %>
2
2
  <div class="check-block"><input type="checkbox" /></div>
3
3
  <div class="img-block"> <%= image_tag 'sunrise/default_ava.png' %> </div>
4
4
  <div class="data-block">
5
5
  <div class="top-info-bl">
6
6
  <%= manage_date_tag(record.created_at)%>
7
- <!--<a href="#" class="grey-but">Активировать</a>-->
8
7
  </div>
9
- <%= link_to record.send(abstract_model.config.object_label_method), manage_structure_path(record), :class=>"item-title" %>
10
-
8
+ <%= link_to record.send(abstract_model.config.object_label_method), manage_structure_path(record), class: "item-title" %>
9
+
11
10
  <div class="bot-info-bl">
12
-
11
+
13
12
  <% abstract_model.list.fields.each do |field|%>
14
13
  <div class="info-item">
15
14
  <b><%= field.human_name %></b> <%= manage_render_field(field, record)%>
@@ -18,15 +17,19 @@
18
17
 
19
18
  </div>
20
19
  </div>
21
- <div class="but-block" style="display: none">
22
- <div class="act-but">
23
- <%= link_to image_tag('sunrise/empty.gif'), delete_path(abstract_model.parent_hash.merge(:id => record.id)),
24
- :method=>:delete, :data => {:confirm=>t("manage.confirm_delete")}, :class=>"but-container del",
25
- :id => dom_id(record, :delete) if can?(:delete, record, :context => :sunrise) %>
26
- </div>
27
-
28
- <div class="act-but">
29
- <%= link_to image_tag('sunrise/empty.gif'), edit_path(abstract_model.parent_hash.merge(:id => record.id)), :class=>"but-container edit", :id => dom_id(record, :edit) if can?(:edit, record, :context => :sunrise) %>
30
- </div>
20
+ <div class="but-block">
21
+ <% if can?(:delete, record, context: :sunrise) %>
22
+ <div class="act-but">
23
+ <%= link_to image_tag('sunrise/empty.gif'), delete_path(abstract_model.parent_hash.merge(id: record.id)),
24
+ method: :delete, data: {confirm: t("manage.confirm_delete")}, class: "but-container del",
25
+ id: dom_id(record, :delete) %>
26
+ </div>
27
+ <% end %>
28
+
29
+ <% if can?(:edit, record, context: :sunrise) %>
30
+ <div class="act-but">
31
+ <%= link_to image_tag('sunrise/empty.gif'), edit_path(abstract_model.parent_hash.merge(id: record.id)), class: "but-container edit", id: dom_id(record, :edit) %>
32
+ </div>
33
+ <% end %>
31
34
  </div>
32
- <% end -%>
35
+ <% end -%>
@@ -1,18 +1,18 @@
1
- <%= content_tag(:div, :id => dom_id(record), :class => "main-item") do -%>
1
+ <%= content_tag(:div, id: dom_id(record), class: "main-item") do -%>
2
2
  <div class="check-block">
3
- <%= check_box_tag dom_id(record, :editable), record.id, false, :name => :editable %>
3
+ <%= check_box_tag dom_id(record, :editable), record.id, false, name: :editable %>
4
4
  </div>
5
- <% if abstract_model.list.preview -%>
5
+ <% if abstract_model.list.preview -%>
6
6
  <div class="img-block"><%= image_tag abstract_model.list.preview_for(record) %></div>
7
7
  <% end -%>
8
8
  <div class="data-block">
9
9
  <div class="top-info-bl">
10
10
  <%= manage_date_tag(record.created_at)%>
11
- <%= render :partial => apply_scope("controls"), :locals => {:record => record} %>
11
+ <%= render partial: apply_scope("controls"), locals: {record: record} %>
12
12
  </div>
13
- <%= link_to record.send(abstract_model.config.object_label_method), show_model_path(abstract_model, record), :class=>"item-title" %>
14
-
15
- <div class="bot-info-bl">
13
+ <%= link_to record.send(abstract_model.config.object_label_method), show_model_path(abstract_model, record), clas:"item-title" %>
14
+
15
+ <div class="bot-info-bl">
16
16
  <% abstract_model.list.fields.each do |field| -%>
17
17
  <div class="info-item">
18
18
  <%= content_tag(:b, field.human_name) if field.label? %>
@@ -21,19 +21,23 @@
21
21
  <% end -%>
22
22
  </div>
23
23
  </div>
24
- <div class="but-block" style="display: none">
25
- <div class="act-but">
26
- <%= link_to image_tag('sunrise/empty.gif'), delete_path(abstract_model.parent_hash.merge(:id => record.id)),
27
- :method=>:delete,
28
- :data => {:confirm => t("manage.confirm_delete") },
29
- :class=>"but-container del",
30
- :id => dom_id(record, :delete) if can?(:delete, record, :context => :sunrise) %>
31
- </div>
32
-
33
- <div class="act-but">
34
- <%= link_to image_tag('sunrise/empty.gif'), edit_path(abstract_model.parent_hash.merge(:id => record.id)),
35
- :class=>"but-container edit",
36
- :id => dom_id(record, :edit) if can?(:edit, record, :context => :sunrise) %>
37
- </div>
24
+ <div class="but-block">
25
+ <% if can?(:delete, record, context: :sunrise) %>
26
+ <div class="act-but">
27
+ <%= link_to image_tag('sunrise/empty.gif'), delete_path(abstract_model.parent_hash.merge(id: record.id)),
28
+ method: :delete,
29
+ data: {confirm: t("manage.confirm_delete") },
30
+ clas:"but-container del",
31
+ id: dom_id(record, :delete) %>
32
+ </div>
33
+ <% end %>
34
+
35
+ <% if can?(:edit, record, context: :sunrise) %>
36
+ <div class="act-but">
37
+ <%= link_to image_tag('sunrise/empty.gif'), edit_path(abstract_model.parent_hash.merge(id: record.id)),
38
+ clas:"but-container edit",
39
+ id: dom_id(record, :edit) %>
40
+ </div>
41
+ <% end %>
38
42
  </div>
39
- <% end -%>
43
+ <% end -%>
@@ -1,13 +1,13 @@
1
- <%= simple_form_for Settings, :url => settings_path, :html => {:method => :put} do |f| -%>
1
+ <%= simple_form_for Settings.new, url: settings_path, html: {method: :put, id: 'resource-manage-form'} do |f| -%>
2
2
  <div class="post-edit-holder">
3
3
  <div class="wysiwyg-holder">
4
- <% @settings.each do |key, value| -%>
4
+ <% @fields.each do |field| -%>
5
5
  <div class="padder">
6
- <%= f.input key, :value => value, :required => false %>
6
+ <%= f.input field[:key], value: Settings[field[:key]], placeholder: field[:default], readonly: field[:readonly], as: field[:type] %>
7
7
  </div>
8
8
  <% end -%>
9
9
  </div>
10
10
  </div>
11
-
12
- <%= f.button :submit, :style => "display:none;", :id => "submit-button-hidden" %>
11
+
12
+ <%= f.button :submit, style: "display:none;", id: "submit-button-hidden" %>
13
13
  <% end -%>
@@ -1,11 +1,10 @@
1
1
  <div class="filter-line-wrapper">
2
2
  <div class="filter-line-holder">
3
3
  <div class="struct-name"><%= t('manage.edit')%></div>
4
-
4
+
5
5
  <div class="vline-block">
6
- <%= submit_tag t('manage.update'), :class => 'button', :id => 'submit-form-button' %>
7
- <%= submit_tag t('manage.cancel'), :class => 'button gray', :id => 'cancel-submit-form-button' %>
8
- <!--<input type="submit" value="Применить" class="button gray" />-->
6
+ <%= submit_tag t('manage.update'), class: 'button', id: 'submit-form-button', form: 'resource-manage-form' %>
7
+ <%= submit_tag t('manage.cancel'), class: 'button gray', id: 'cancel-submit-form-button' %>
9
8
  </div>
10
9
  </div>
11
10
  </div>