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.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +49 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.rdoc +13 -3
- data/Gemfile +11 -22
- data/Gemfile.lock +344 -214
- data/README.md +47 -33
- data/Rakefile +1 -0
- data/app/assets/config/manifest.js +1 -0
- data/app/assets/images/sunrise/icons/export.svg +4 -0
- data/app/assets/images/sunrise/icons/import.svg +5 -0
- data/app/assets/javascripts/sunrise/application.js +2 -5
- data/app/assets/javascripts/sunrise/jquery.dialog.js.coffee +113 -40
- data/app/assets/javascripts/sunrise/jquery.editable.js.coffee +21 -21
- data/app/assets/javascripts/sunrise/manage.js.coffee +29 -28
- data/app/assets/stylesheets/sunrise/application.css +0 -1
- data/app/assets/stylesheets/sunrise/customize.css +7 -4
- data/app/assets/stylesheets/sunrise/main.css +883 -606
- data/app/controllers/sunrise/manager_controller.rb +44 -7
- data/app/controllers/sunrise/settings_controller.rb +2 -3
- data/app/helpers/sunrise/structure_helper.rb +2 -2
- data/app/views/layouts/sunrise/application.html.erb +9 -6
- data/app/views/sunrise/manager/_field.html.erb +5 -5
- data/app/views/sunrise/manager/_form.html.erb +15 -15
- data/app/views/sunrise/manager/_header_edit.html.erb +3 -4
- data/app/views/sunrise/manager/_header_new.html.erb +3 -3
- data/app/views/sunrise/manager/_header_show.html.erb +9 -13
- data/app/views/sunrise/manager/_nested_field.html.erb +6 -6
- data/app/views/sunrise/manager/buttons/_export.html.erb +9 -2
- data/app/views/sunrise/manager/buttons/_import.html.erb +25 -0
- data/app/views/sunrise/manager/buttons/_sort.html.erb +3 -3
- data/app/views/sunrise/manager/edit.html.erb +1 -1
- data/app/views/sunrise/manager/new.html.erb +1 -1
- data/app/views/sunrise/manager/structures/thumbs/_record.html.erb +19 -16
- data/app/views/sunrise/manager/thumbs/_record.html.erb +26 -22
- data/app/views/sunrise/manager/tree/index.html.erb +1 -1
- data/app/views/sunrise/settings/_form.html.erb +5 -5
- data/app/views/sunrise/settings/_header_edit.html.erb +3 -4
- data/config/locales/sunrise/en.yml +35 -35
- data/config/locales/sunrise/ru.yml +35 -35
- data/config/locales/sunrise/uk.yml +35 -35
- data/config/routes.rb +1 -0
- data/db/migrate/20111216144515_create_assets.rb +1 -1
- data/db/migrate/20111216144915_create_structures.rb +1 -1
- data/db/migrate/20111216145015_create_users.rb +1 -1
- data/db/migrate/20120611095315_create_settings.rb +1 -1
- data/lib/generators/sunrise/templates/config/active_record/sunrise.rb +0 -4
- data/lib/generators/sunrise/templates/config/mongoid/sunrise.rb +0 -4
- data/lib/generators/sunrise/templates/models/active_record/attachment_file.rb +0 -2
- data/lib/generators/sunrise/templates/models/active_record/avatar.rb +0 -2
- data/lib/generators/sunrise/templates/models/active_record/picture.rb +0 -2
- data/lib/generators/sunrise/templates/models/active_record/position_type.rb +4 -4
- data/lib/generators/sunrise/templates/models/active_record/role_type.rb +5 -5
- data/lib/generators/sunrise/templates/models/active_record/settings.rb +14 -2
- data/lib/generators/sunrise/templates/models/active_record/structure_type.rb +6 -6
- data/lib/generators/sunrise/templates/models/mongoid/attachment_file.rb +0 -2
- data/lib/generators/sunrise/templates/models/mongoid/avatar.rb +0 -2
- data/lib/generators/sunrise/templates/models/mongoid/picture.rb +0 -2
- data/lib/generators/sunrise/templates/models/mongoid/position_type.rb +4 -4
- data/lib/generators/sunrise/templates/models/mongoid/role_type.rb +5 -5
- data/lib/generators/sunrise/templates/models/mongoid/structure_type.rb +6 -6
- data/lib/generators/sunrise/templates/models/sunrise/sunrise_structure.rb +2 -2
- data/lib/generators/sunrise/templates/spec/controllers/pages_controller_spec.rb +2 -2
- data/lib/generators/sunrise/templates/spec/controllers/welcome_controller_spec.rb +1 -1
- data/lib/generators/sunrise/templates/spec/factories/structure_factory.rb +2 -2
- data/lib/generators/sunrise/templates/spec/factories/user_factory.rb +6 -6
- data/lib/generators/sunrise/templates/spec/spec_helper.rb +1 -1
- data/lib/generators/sunrise/templates/spec/support/helpers/controller_macros.rb +4 -4
- data/lib/generators/sunrise/templates/uploaders/attachment_file_uploader.rb +4 -0
- data/lib/generators/sunrise/templates/uploaders/avatar_uploader.rb +4 -0
- data/lib/generators/sunrise/templates/uploaders/picture_uploader.rb +4 -0
- data/lib/sunrise/abstract_model.rb +13 -3
- data/lib/sunrise/carrierwave/glue.rb +1 -7
- data/lib/sunrise/config/model.rb +4 -0
- data/lib/sunrise/config.rb +0 -5
- data/lib/sunrise/core_ext/string.rb +0 -5
- data/lib/sunrise/engine.rb +7 -1
- data/lib/sunrise/models/ability.rb +8 -8
- data/lib/sunrise/models/position_type.rb +1 -7
- data/lib/sunrise/models/role_type.rb +4 -6
- data/lib/sunrise/models/structure.rb +3 -3
- data/lib/sunrise/models/structure_type.rb +1 -7
- data/lib/sunrise/models/user.rb +4 -4
- data/lib/sunrise/utils.rb +1 -2
- data/lib/sunrise/version.rb +1 -1
- data/lib/sunrise/views/search_wrapper.rb +1 -1
- data/sunrise-cms.gemspec +8 -13
- metadata +24 -65
- data/.rspec +0 -2
- data/lib/sunrise/carrierwave/file_size_validator.rb +0 -75
- data/lib/sunrise/utils/transliteration.rb +0 -73
@@ -4,15 +4,15 @@ module Sunrise
|
|
4
4
|
class ManagerController < Sunrise::ApplicationController
|
5
5
|
include Sunrise::Utils::SearchWrapper
|
6
6
|
|
7
|
-
before_action :build_record, only: [
|
8
|
-
before_action :find_record, only: [
|
7
|
+
before_action :build_record, only: %i[new create]
|
8
|
+
before_action :find_record, only: %i[show edit update destroy]
|
9
9
|
before_action :authorize_resource
|
10
10
|
|
11
11
|
helper :all
|
12
12
|
helper_method :abstract_model, :apply_scope, :scoped_index_path
|
13
13
|
|
14
14
|
respond_to(*Sunrise::Config.navigational_formats)
|
15
|
-
respond_to :
|
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.
|
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.
|
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.
|
51
|
+
@record.update(model_params)
|
52
52
|
respond_with(@record, location: redirect_after_update(@record))
|
53
53
|
end
|
54
54
|
|
@@ -64,8 +64,19 @@ 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
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def import
|
71
|
+
return render plain: 'Unacceptable', status: 422 unless import_possible?
|
67
72
|
|
68
|
-
|
73
|
+
@files = import_process_uploaded_files
|
74
|
+
|
75
|
+
respond_to do |format|
|
76
|
+
format.html { redirect_to scoped_index_path }
|
77
|
+
format.json do
|
78
|
+
render json: { files: @files }
|
79
|
+
end
|
69
80
|
end
|
70
81
|
end
|
71
82
|
|
@@ -89,6 +100,32 @@ module Sunrise
|
|
89
100
|
|
90
101
|
protected
|
91
102
|
|
103
|
+
def import_process_uploaded_files
|
104
|
+
raw_files = params['files']
|
105
|
+
return [] if raw_files.blank?
|
106
|
+
|
107
|
+
raw_files.each_with_object([]) do |file, obj|
|
108
|
+
results = abstract_model.model.public_send(:sunrise_import, file)
|
109
|
+
results = render_imported_results(results, file)
|
110
|
+
|
111
|
+
obj << { name: file.original_filename, records: results }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def render_imported_results(results, file)
|
116
|
+
return results unless import_custom_render?
|
117
|
+
|
118
|
+
abstract_model.model.send(:sunrise_import_results_renderer, results, file)
|
119
|
+
end
|
120
|
+
|
121
|
+
def import_possible?
|
122
|
+
abstract_model.model.methods.include?(:sunrise_import)
|
123
|
+
end
|
124
|
+
|
125
|
+
def import_custom_render?
|
126
|
+
abstract_model.model.methods.include?(:sunrise_import_results_renderer)
|
127
|
+
end
|
128
|
+
|
92
129
|
def find_model
|
93
130
|
@abstract_model = Utils.get_model(params[:model_name], params)
|
94
131
|
if @abstract_model.nil?
|
@@ -5,12 +5,11 @@ module Sunrise
|
|
5
5
|
authorize_resource class: false
|
6
6
|
|
7
7
|
def edit
|
8
|
-
@
|
9
|
-
respond_with(@settings)
|
8
|
+
@fields = Settings.defined_fields
|
10
9
|
end
|
11
10
|
|
12
11
|
def update
|
13
|
-
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.
|
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.
|
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
|
@@ -6,9 +6,12 @@
|
|
6
6
|
<meta name="robots" content="NONE,NOARCHIVE" />
|
7
7
|
<%= csrf_meta_tag %>
|
8
8
|
<title><%= t('manage.page_title') %></title>
|
9
|
-
|
10
|
-
<%= stylesheet_link_tag
|
11
|
-
|
9
|
+
|
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' %>
|
13
|
+
<%= javascript_include_tag 'sunrise/application' %>
|
14
|
+
<%#= javascript_include_tag ::Ckeditor.cdn_url %>
|
12
15
|
</head>
|
13
16
|
<body>
|
14
17
|
<div class="outer">
|
@@ -16,16 +19,16 @@
|
|
16
19
|
<%= render :partial => "sunrise/shared/panel" %>
|
17
20
|
<%= manage_render_header %>
|
18
21
|
</div>
|
19
|
-
|
22
|
+
|
20
23
|
<%= yield %>
|
21
24
|
</div>
|
22
|
-
|
25
|
+
|
23
26
|
<div class="footer">
|
24
27
|
<div class="fwrapper">
|
25
28
|
<%= image_tag("sunrise/created.png", :title => "fodojo.com") %>
|
26
29
|
</div>
|
27
30
|
</div>
|
28
|
-
|
31
|
+
|
29
32
|
<div id="dark-shadow" class="dark-bg" style="display:none;"></div>
|
30
33
|
</body>
|
31
34
|
</html>
|
@@ -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 :
|
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, {:
|
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, :
|
2
|
-
<%= render :
|
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 :
|
6
|
-
|
5
|
+
<%= render partial: "sunrise/shared/locale" if abstract_model.translate? %>
|
6
|
+
|
7
7
|
<div class="wysiwyg-holder">
|
8
|
-
<%= render :
|
9
|
-
|
10
|
-
<%= render :
|
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 :
|
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 :
|
29
|
+
<%= render partial: 'field', collection: group.fields, locals: {form: f} %>
|
30
30
|
<% end -%>
|
31
|
-
|
32
|
-
<%= f.button :submit, :
|
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'), :
|
7
|
-
<%= submit_tag t('manage.cancel'), :
|
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'), :
|
7
|
-
<%= submit_tag t('manage.cancel'), :
|
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, :
|
7
|
-
<%= render :
|
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'), :
|
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, :
|
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(:
|
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, :
|
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(:
|
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 :
|
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, :
|
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', :
|
6
|
-
<%= form.hidden_field field.sort_column, :
|
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 :
|
10
|
-
</div>
|
9
|
+
<%= render partial: 'field', collection: field.fields, locals: { form: form } %>
|
10
|
+
</div>
|
@@ -1,5 +1,12 @@
|
|
1
1
|
<div class="but-holder">
|
2
2
|
<div class="act-but">
|
3
|
-
<%= link_to
|
3
|
+
<%= link_to 'CSV', export_path(format: :csv), class: 'but-container export', title: 'Export' %>
|
4
4
|
</div>
|
5
|
-
</div>
|
5
|
+
</div>
|
6
|
+
<% if defined?(Mime::XLSX) %>
|
7
|
+
<div class="but-holder">
|
8
|
+
<div class="act-but">
|
9
|
+
<%= link_to 'XLS', export_path(format: :xlsx), class: 'but-container export', title: 'Export (XLS)' %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<% if abstract_model.config.available_import %>
|
2
|
+
<div class="but-holder">
|
3
|
+
<div class="act-but">
|
4
|
+
<%=
|
5
|
+
link_to(
|
6
|
+
image_tag('sunrise/empty.gif'),
|
7
|
+
export_path(format: :csv),
|
8
|
+
class: 'but-container import',
|
9
|
+
id: 'import-button',
|
10
|
+
title: 'Import',
|
11
|
+
data: {
|
12
|
+
title: 'Import',
|
13
|
+
url: import_path
|
14
|
+
}
|
15
|
+
)
|
16
|
+
%>
|
17
|
+
|
18
|
+
<script type="text/javascript">
|
19
|
+
$(document).ready(function(){
|
20
|
+
$('#import-button').import_dialog();
|
21
|
+
});
|
22
|
+
</script>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<div class="but-holder">
|
2
2
|
<div class="act-but">
|
3
3
|
<%= link_to image_tag('sunrise/empty.gif'), export_path(:format => :json), :class => 'but-container sort', :title => t('manage.buttons.sort'), :id => 'sort-button', :"data-save_title" => t('manage.buttons.save'), :"data-cancel_title" => t('manage.buttons.cancel'), :"data-url" => sort_path(:format => :json) %>
|
4
|
-
|
4
|
+
|
5
5
|
<script type="text/javascript">
|
6
6
|
$(document).ready(function(){
|
7
7
|
$('#sort-button').sort_dialog();
|
8
8
|
});
|
9
9
|
</script>
|
10
|
-
|
10
|
+
|
11
11
|
<script id="sort-template" type="text/x-jquery-tmpl">
|
12
12
|
<div class="sort-item" data-record-id="${id}">
|
13
13
|
<div class="sort-inner">
|
@@ -17,4 +17,4 @@
|
|
17
17
|
</div>
|
18
18
|
</script>
|
19
19
|
</div>
|
20
|
-
</div>
|
20
|
+
</div>
|
@@ -1,15 +1,14 @@
|
|
1
|
-
<%= content_tag(:div, :
|
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), :
|
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"
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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, :
|
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, :
|
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 :
|
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), :
|
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"
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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, :
|
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
|
-
<% @
|
4
|
+
<% @fields.each do |field| -%>
|
5
5
|
<div class="padder">
|
6
|
-
<%= f.input key, :
|
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, :
|
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'), :
|
7
|
-
<%= submit_tag t('manage.cancel'), :
|
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>
|