activeadmin-selleo-cms 0.0.32 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/app/admin/activeadmin_selleo_cms/asset.rb +1 -1
  2. data/app/admin/activeadmin_selleo_cms/attachment.rb +23 -0
  3. data/app/admin/activeadmin_selleo_cms/image.rb +23 -0
  4. data/app/admin/activeadmin_selleo_cms/page.rb +13 -10
  5. data/app/admin/activeadmin_selleo_cms/related_item.rb +1 -1
  6. data/app/admin/activeadmin_selleo_cms/section_translation.rb +50 -0
  7. data/app/assets/javascripts/activeadmin-selleo-cms/custom.js +49 -17
  8. data/app/assets/stylesheets/activeadmin-selleo-cms/custom.css +38 -1
  9. data/app/assets/stylesheets/activeadmin-selleo-cms/jquery-ui.css +38 -31
  10. data/app/helpers/pages_helper.rb +38 -0
  11. data/app/models/activeadmin_selleo_cms/asset.rb +3 -0
  12. data/app/models/activeadmin_selleo_cms/layout.rb +12 -12
  13. data/app/models/activeadmin_selleo_cms/locale.rb +1 -0
  14. data/app/models/activeadmin_selleo_cms/page.rb +9 -3
  15. data/app/models/activeadmin_selleo_cms/section.rb +31 -7
  16. data/app/modules/activeadmin_selleo_cms/content_translation.rb +6 -0
  17. data/app/views/admin/assets/destroy.js.erb +3 -1
  18. data/app/views/admin/attachments/_attachment.html.haml +6 -0
  19. data/app/views/admin/attachments/_form.html.haml +14 -0
  20. data/app/views/admin/attachments/create.js.erb +14 -0
  21. data/app/views/admin/attachments/edit.html.erb +9 -0
  22. data/app/views/admin/attachments/new.html.erb +1 -0
  23. data/app/views/admin/attachments/update.js.erb +2 -0
  24. data/app/views/admin/images/_form.html.haml +10 -0
  25. data/app/views/admin/images/_image.html.haml +6 -0
  26. data/app/views/admin/images/create.js.erb +14 -0
  27. data/app/views/admin/images/edit.html.erb +8 -0
  28. data/app/views/admin/images/new.html.erb +1 -0
  29. data/app/views/admin/images/update.js.erb +3 -0
  30. data/app/views/admin/pages/_form.html.haml +35 -5
  31. data/app/views/admin/pages/_translated_fields.html.haml +33 -68
  32. data/app/views/admin/pages/update.js.erb +1 -0
  33. data/app/views/admin/related_items/_form.html.haml +10 -0
  34. data/app/views/admin/related_items/_related_item.html.haml +5 -0
  35. data/app/views/admin/related_items/create.js.erb +6 -0
  36. data/app/views/admin/related_items/destroy.js.erb +3 -1
  37. data/app/views/admin/related_items/edit.html.erb +6 -0
  38. data/app/views/admin/related_items/update.js.erb +3 -0
  39. data/app/views/admin/section_translations/_attachments_form.html.haml +14 -0
  40. data/app/views/admin/section_translations/_form.html.haml +36 -0
  41. data/app/views/admin/section_translations/_images_form.html.haml +11 -0
  42. data/app/views/admin/section_translations/_related_items_form.html.haml +10 -0
  43. data/app/views/admin/section_translations/edit.html.erb +1 -0
  44. data/app/views/admin/sections/_form.html.haml +1 -1
  45. data/config/initializers/active_admin.rb +3 -1
  46. data/config/initializers/acts_as_list.rb +1 -0
  47. data/config/locales/cms.en.yml +30 -1
  48. data/db/migrate/20130531154539_add_position_to_assets.rb +9 -0
  49. data/db/migrate/20130601141800_add_position_to_related_items.rb +9 -0
  50. data/lib/activeadmin-selleo-cms/version.rb +1 -1
  51. metadata +67 -6
@@ -0,0 +1,9 @@
1
+ <h3 class="upload-file">
2
+ <%= t("active_admin.cms.file_manager.edit_attachment") %>
3
+ <% if resource.assetable.activeadmin_selleo_cms_section.attachments? %>
4
+ <%= link_to_function t("active_admin.cms.back"), "fileManager('#{edit_admin_section_translation_path(resource.assetable.id)}')", class: "fltr" %>
5
+ <% end %>
6
+ </h3>
7
+
8
+ <%= render partial: 'form' %>
9
+
@@ -0,0 +1 @@
1
+ <%= render partial: 'form' %>
@@ -0,0 +1,2 @@
1
+ $('#file-manager').effect('highlight');
2
+ $('#file-manager form').html('<%= j render partial: 'form' %>');
@@ -0,0 +1,10 @@
1
+ = semantic_form_for [:admin, resource], remote: true, html: { multipart: true } do |form|
2
+
3
+ -#= @page.errors.full_messages
4
+
5
+ = form.inputs id: 'image_fields' do
6
+ = form.input :data, label: "Image", hint: (resource.data.exists? ? image_tag(resource.data.url, style: "max-width:520px") : "No image")
7
+ = form.input :assetable_type, as: :hidden, value: resource.assetable_type
8
+ = form.input :assetable_id, as: :hidden, value: resource.assetable_id
9
+ = form.input :caption
10
+ = form.actions :submit
@@ -0,0 +1,6 @@
1
+ %li{"id" => "asset_#{image.id}", "data-asset-id" => image.id}
2
+ .attachment
3
+ .cover-image= image_tag(image.data.url, style: "max-width:80px")
4
+ .file-name= image.caption.blank? ? image.data_file_name : image.caption
5
+ = link_to_function t("active_admin.cms.edit"), "edit_image(#{image.id})"
6
+ = link_to_function "Delete", "delete_asset(#{image.id})", class: 'fltr'
@@ -0,0 +1,14 @@
1
+ <% if resource.valid? %>
2
+ <% if resource.assetable.images? %>
3
+ $('<%= j render partial: 'image', locals: { image: resource } %>').appendTo('ol#assets');
4
+ $('#new_image').replaceWith('<%= j render partial: '/admin/section_translations/images_form', locals: { image: ActiveadminSelleoCms::Image.new, section_translation: resource.assetable } %>');
5
+ <% elsif resource.assetable.activeadmin_selleo_cms_section.image? %>
6
+ $('#file-manager').html('<%= j render partial: 'form' %>');
7
+ <% end %>
8
+ <% else %>
9
+ <% if resource.assetable.images? %>
10
+ $('#new_image').replaceWith('<%= j render partial: '/admin/section_translations/images_form', locals: { image: resource, section_translation: resource.assetable } %>');
11
+ <% elsif resource.assetable.activeadmin_selleo_cms_section.image? %>
12
+ $('#file-manager').html('<%= j render partial: 'form' %>');
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <h3 class="upload-file">
2
+ <%= t("active_admin.cms.file_manager.edit_image") %>
3
+ <% if resource.assetable.activeadmin_selleo_cms_section.images? %>
4
+ <%= link_to_function t("active_admin.cms.back"), "fileManager('#{edit_admin_section_translation_path(resource.assetable.id)}')", class: "fltr" %>
5
+ <% end %>
6
+ </h3>
7
+
8
+ <%= render partial: 'form' %>
@@ -0,0 +1 @@
1
+ <%= render partial: 'form' %>
@@ -0,0 +1,3 @@
1
+ $('#file-manager').effect('highlight');
2
+ $('#file-manager form').html('<%= j render partial: 'form' %>');
3
+
@@ -1,13 +1,13 @@
1
1
  = semantic_form_for [:admin, @page], url: (@page.new_record? ? admin_pages_path : admin_page_path(@page.id)), html: { multipart: true } do |form|
2
2
 
3
3
  %input{name: "_change_layout", type: "hidden"}
4
- - @page.initialize_missing_translations
5
- - current_locale = ActiveadminSelleoCms::Locale.find_by_code(I18n.locale)
6
- - @page.initialize_missing_sections
4
+ - @page.new_record? ? @page.initialize_missing_translations : @page.create_missing_translations
5
+ - current_locale = ActiveadminSelleoCms::Locale.find_by_code(I18n.default_locale)
6
+ - @page.create_missing_sections unless @page.new_record?
7
7
  - @section_forms = []
8
8
  -#= @page.errors.full_messages
9
9
 
10
- = form.inputs general_options(@page) do
10
+ = form.inputs general_options(@page), id: 'id-general-options' do
11
11
  = form.input :layout_name, collection: ActiveadminSelleoCms::Layout.all.sort, include_blank: false, hint: "The form will reload on change"
12
12
  = form.input :parent_id, as: :select, collection: nested_set_options(ActiveadminSelleoCms::Page, @page) {|i| "#{'-' * i.level} #{i.title}" }
13
13
  = form.input :show_in_menu, as: :boolean
@@ -27,7 +27,7 @@
27
27
  - else
28
28
  = ""
29
29
 
30
- .language-tabs
30
+ .language-tabs#id-meta-data
31
31
  %ul.language-selection
32
32
  %li= link_to current_locale.name, "#lang-#{current_locale.code}"
33
33
  - @page.translations.each do |translation|
@@ -49,6 +49,7 @@
49
49
  %li.cancel
50
50
  = link_to I18n.t('active_admin.cancel'), admin_pages_path
51
51
 
52
+ %div#file-manager
52
53
 
53
54
  :javascript
54
55
  function is_link_url(){
@@ -85,4 +86,33 @@
85
86
  $(this).closest('form').find('input[name="_change_layout"]').attr('value','1');
86
87
  $(this).closest('form').submit();
87
88
  });
89
+
90
+ $('#file-manager').dialog({
91
+ width: 1200,
92
+ height: 'auto',
93
+ title: 'File manager',
94
+ modal: true,
95
+ autoOpen: false
96
+ });
88
97
  });
98
+
99
+ $(function() {
100
+
101
+ var $sidebar = $("#sidebar"),
102
+ $window = $(window),
103
+ offset = $sidebar.offset(),
104
+ topPadding = 15;
105
+
106
+ $window.scroll(function() {
107
+ if ($window.scrollTop() > offset.top) {
108
+ $sidebar.stop().animate({
109
+ marginTop: $window.scrollTop() - offset.top + topPadding
110
+ });
111
+ } else {
112
+ $sidebar.stop().animate({
113
+ marginTop: 0
114
+ });
115
+ }
116
+ });
117
+
118
+ });
@@ -1,5 +1,5 @@
1
1
  - @page.sections.each do |section|
2
- - section.initialize_missing_translations
2
+ - section.create_missing_translations unless @page.new_record?
3
3
  = form.inputs "#{locale.name} translation" do
4
4
  %ol
5
5
  = form.input :title
@@ -10,83 +10,48 @@
10
10
  = form.input :locale, :as => :hidden, :label => false
11
11
  -#- unless @page.new_record?
12
12
  - @section_forms.sort_by{|sf| sf.object.name}.each do |section_form|
13
- %section{:name => section_form.object.name}
13
+ %section{:name => section_form.object.name, :id => "id-#{section_form.object.name}"}
14
14
  = section_form.semantic_fields_for :translations do |section_form_translated|
15
15
  - if section_form_translated.object.locale.to_sym == locale.code
16
16
  - section = @page.layout.find_section(section_form.object.name)
17
17
 
18
- - if section.text?
19
- = section_form_translated.input :body, as: section.type, label: section.name.titleize, input_html: { toolbar: section.toolbar }
18
+ %fieldset.inputs
19
+ %legend
20
+ %span= "#{section.name.titleize} section"
20
21
 
21
- - elsif section.image?
22
- = section_form_translated.inputs section.name.titleize, for: [:image, section_form_translated.object.image || ActiveadminSelleoCms::Image.new] do |image_form|
23
- = image_form.input :image_width, as: :hidden, value: section.width
24
- = image_form.input :image_height, as: :hidden, value: section.height
25
- = image_form.input :resize_method, as: :hidden, value: section.resize_method
26
- = image_form.input :data, label: "File to upload", input_html: { multiple: false }, hint: (section_form_translated.object.image ? section_form_translated.template.image_tag(section_form_translated.object.image.url) : "No icon uploaded yet" )
27
- = image_form.input :caption
22
+ %ol
23
+ - if section.text?
24
+ = section_form_translated.input :body, as: section.type, label: "Content", input_html: { toolbar: section.toolbar }
28
25
 
29
- - elsif section.images?
30
- = section_form_translated.inputs section.name.titleize, for: [:images, ActiveadminSelleoCms::Image.new] do |image_form|
31
- = image_form.input :image_width, as: :hidden, value: section.width
32
- = image_form.input :image_height, as: :hidden, value: section.height
33
- = image_form.input :resize_method, as: :hidden, value: section.resize_method
34
- = image_form.input :data, label: "File to upload", input_html: { multiple: false }
35
- = image_form.input :caption
36
- - unless section_form_translated.object.new_record?
37
- - section_form_translated.object.images.each do |image|
38
- %li{"data-asset-id" => image.id}
39
- %label Image
40
- = image.data_file_name
41
- = link_to_function "Delete", "delete_asset(#{@page.id}, #{image.id})"
26
+ - elsif section.image?
27
+ %li.input
28
+ %label Image
29
+ %ol{ :style => "padding-left: 275px;" }
30
+ %li= button_to_function t("active_admin.cms.file_manager.edit_image"), "fileManager('#{section_form_translated.object.image ? edit_admin_image_path(section_form_translated.object.image.id) : new_admin_image_path(image: { assetable_type: section_form_translated.class.name, assetable_id: section_form_translated.id })}')", style: "padding: 5px;"
42
31
 
43
- - elsif section.attachment?
44
- = section_form_translated.inputs section.name.titleize, for: [:attachment, section_form_translated.object.image || ActiveadminSelleoCms::Attachment.new] do |attachment_form|
45
- = attachment_form.input :data, label: "File to upload", input_html: { multiple: false }, hint: (section_form_translated.object.image ? link_to(section_form_translated.object.image.url) : "No file uploaded yet" )
46
- = attachment_form.input :cover_width, as: :hidden, value: section.cover_width
47
- = attachment_form.input :cover_height, as: :hidden, value: section.cover_height
48
- = attachment_form.input :cover_resize_method, as: :hidden, value: section.cover_resize_method
49
- = attachment_form.input :cover, label: "Cover image"
50
- = attachment_form.input :caption
32
+ - elsif section.images?
33
+ %li.input
34
+ %label Attachments
35
+ %ol{ :style => "padding-left: 275px;" }
36
+ %li= button_to_function t("active_admin.cms.manage_images"), "fileManager('#{edit_admin_section_translation_path(section_form_translated.object.id)}')", style: "padding: 5px;"
51
37
 
52
- = section_form_translated.input :locale, :as => :hidden, :label => false
38
+ - elsif section.attachment?
39
+ %li.input
40
+ %label Attachment
41
+ %ol{ :style => "padding-left: 275px;" }
42
+ %li= button_to_function t("active_admin.cms.file_manager.edit_attachment"), "fileManager('#{section_form_translated.object.attachment ? edit_admin_attachment_path(section_form_translated.object.attachment.id): new_admin_attachment_path(image: { assetable_type: section_form_translated.class.name, assetable_id: section_form_translated.id }) }')", style: "padding: 5px;"
53
43
 
54
- - if section.attachments?
55
- = section_form_translated.inputs "#{section.name.titleize} attachments", for: [:attachments, section_form_translated.object.attachments.detect{|a| a.new_record?} || ActiveadminSelleoCms::Attachment.new] do |attachment_form|
56
- = attachment_form.input :data, label: "File to upload"
57
- = attachment_form.input :cover_width, as: :hidden, value: section.cover_width
58
- = attachment_form.input :cover_height, as: :hidden, value: section.cover_height
59
- = attachment_form.input :cover_resize_method, as: :hidden, value: section.cover_resize_method
60
- = attachment_form.input :cover, label: "Cover image"
61
- = attachment_form.input :caption
62
- - if section_form_translated.object.attachments.any? and !section_form_translated.object.new_record?
63
- %li Existing files
64
- - section_form_translated.object.attachments.each do |attachment|
65
- - unless attachment.new_record?
66
- %li{"data-asset-id" => attachment.id}
67
- %label File
68
- .attachment
69
- .cover-image= image_tag(attachment.cover.url) if attachment.cover.exists?
70
- .file-name= attachment.data_file_name
71
- .caption= attachment.caption
72
- .delete-link= link_to_function "Delete", "delete_asset(#{@page.id}, #{attachment.id})"
44
+ = section_form_translated.input :locale, :as => :hidden, :label => false
73
45
 
74
- - if section.related?
75
- = section_form_translated.inputs "#{section.name.titleize}", for: [:related_items, section_form_translated.object.related_items.detect{|ri| ri.new_record?} || ActiveadminSelleoCms::RelatedItem.new] do |related_form|
76
- = related_form.input :title
77
- = related_form.input :related_url
78
- %li or
79
- = related_form.input :page, collection: ActiveadminSelleoCms::Page.published.reorder("lft"), label: 'Related page'
80
- - if section_form_translated.object.related_items.any? and !section_form_translated.object.new_record?
81
- %li Related links
82
- - section_form_translated.object.related_items.each do |related_item|
83
- - unless related_item.new_record?
84
- %li{"data-related-item-id" => related_item.id}
85
- %label Link
86
- .related
87
- .related-item= link_to related_item.target_title, related_item.target_url, target: '_blank'
88
- .delete-link= link_to_function "Delete", "delete_related(#{@page.id}, #{related_item.id})"
46
+ - if section.attachments?
47
+ %li.input
48
+ %ol{ :style => "padding-left: 275px;" }
49
+ %li= button_to_function t("active_admin.cms.manage_attachments"), "fileManager('#{edit_admin_section_translation_path(section_form_translated.object.id)}')", style: "padding: 5px;"
50
+
51
+ - if section.related?
52
+ %li.input
53
+ %ol{ :style => "padding-left: 275px;" }
54
+ %li= button_to_function t("active_admin.cms.manage_related"), "fileManager('#{edit_admin_section_translation_path(section_form_translated.object.id)}')", style: "padding: 5px;"
89
55
 
90
56
  - else
91
57
  = ""
92
-
@@ -0,0 +1 @@
1
+ alert('<%= params[:page] %>');
@@ -0,0 +1,10 @@
1
+ = semantic_form_for [:admin, resource], remote: true do |form|
2
+
3
+ -#= @page.errors.full_messages
4
+
5
+ = form.inputs id: 'related_item_fields' do
6
+ = form.input :related_url
7
+ = form.input :title
8
+ = form.input :relatable_type, as: :hidden, value: resource.relatable_type
9
+ = form.input :relatable_id, as: :hidden, value: resource.relatable_id
10
+ = form.actions :submit
@@ -0,0 +1,5 @@
1
+ %li{"id" => "related_item_#{related_item.id}", "data-related-item-id" => related_item.id}
2
+ .related_item
3
+ .url= related_item.title.blank? ? related_item.related_url : related_item.title
4
+ = link_to_function t("active_admin.cms.edit"), "edit_related_item(#{related_item.id})"
5
+ = link_to_function "Delete", "delete_related_item(#{related_item.id})", class: "fltr"
@@ -0,0 +1,6 @@
1
+ <% if resource.valid? %>
2
+ $('<%= j render partial: 'related_item', locals: { related_item: resource } %>').appendTo('ol#assets');
3
+ $('#new_related_item').replaceWith('<%= j render partial: '/admin/section_translations/related_items_form', locals: { related_item: ActiveadminSelleoCms::RelatedItem.new, section_translation: resource.relatable } %>');
4
+ <% else %>
5
+ $('#new_related_item').replaceWith('<%= j render partial: '/admin/section_translations/related_items_form', locals: { related_item: resource, section_translation: resource.relatable } %>');
6
+ <% end %>
@@ -1 +1,3 @@
1
- $('li[data-related-item-id="<%= @related_item.id %>"]').remove();
1
+ $('li[data-related-item-id="<%= @related_item.id %>"]').fadeOut('slow', function() {
2
+ $(this).remove();
3
+ });
@@ -0,0 +1,6 @@
1
+ <h3 class="upload-file">
2
+ <%= t("active_admin.cms.file_manager.edit_related_item") %>
3
+ <%= link_to_function t("active_admin.cms.back"), "fileManager('#{edit_admin_section_translation_path(resource.relatable.id)}')", class: "fltr" %>
4
+ </h3>
5
+
6
+ <%= render partial: 'form' %>
@@ -0,0 +1,3 @@
1
+ $('#file-manager').effect('highlight');
2
+ $('#file-manager form').html('<%= j render partial: 'form' %>');
3
+
@@ -0,0 +1,14 @@
1
+ = semantic_form_for [:admin, attachment], remote: true, url: admin_attachments_path(format: :js), html: { multipart: true } do |form|
2
+
3
+ -#= @page.errors.full_messages
4
+
5
+ = form.inputs id: 'attachment_fields' do
6
+ = form.input :data
7
+ = form.input :assetable_type, as: :hidden, value: section_translation.class.name
8
+ = form.input :assetable_id, as: :hidden, value: section_translation.id
9
+ = form.input :cover_width, as: :hidden, value: section_translation.activeadmin_selleo_cms_section.cover_width
10
+ = form.input :cover_height, as: :hidden, value: section_translation.activeadmin_selleo_cms_section.cover_height
11
+ = form.input :cover_resize_method, as: :hidden, value: section_translation.activeadmin_selleo_cms_section.cover_resize_method
12
+ = form.input :cover
13
+ = form.input :caption
14
+ = form.actions :submit
@@ -0,0 +1,36 @@
1
+ %h3.upload-file= t("active_admin.cms.file_manager.upload_file")
2
+ - if resource.activeadmin_selleo_cms_section.attachments?
3
+ = render partial: 'attachments_form', locals: { attachment: ActiveadminSelleoCms::Attachment.new, section_translation: resource }
4
+ - elsif resource.activeadmin_selleo_cms_section.images?
5
+ = render partial: 'images_form', locals: { image: ActiveadminSelleoCms::Image.new, section_translation: resource }
6
+ - elsif resource.activeadmin_selleo_cms_section.related?
7
+ = render partial: 'related_items_form', locals: { related_item: ActiveadminSelleoCms::RelatedItem.new, section_translation: resource }
8
+
9
+ %hr
10
+
11
+ %h3.manage-files= t("active_admin.cms.file_manager.manage_files")
12
+ %small= t("active_admin.cms.file_manager.hint")
13
+ %form
14
+ %fieldset.inputs.assets
15
+ %ol#assets
16
+ - if resource.activeadmin_selleo_cms_section.attachments?
17
+ = render partial: '/admin/attachments/attachment', collection: resource.attachments
18
+ - elsif resource.activeadmin_selleo_cms_section.images?
19
+ = render partial: '/admin/images/image', collection: resource.images
20
+ - elsif resource.activeadmin_selleo_cms_section.related?
21
+ = render partial: '/admin/related_items/related_item', collection: resource.related_items
22
+
23
+ :javascript
24
+ $('ol#assets').sortable({
25
+ stop: function(event, ui) {
26
+ $.ajax({
27
+ type: 'post',
28
+ data: $('ol#assets').sortable('serialize'),
29
+ dataType: 'script',
30
+ success: function(request){
31
+ $('ol#assets').closest('fieldset').effect('highlight');
32
+ },
33
+ url: '#{sort_assets_admin_section_translation_path(resource)}'
34
+ })
35
+ }
36
+ });
@@ -0,0 +1,11 @@
1
+ = semantic_form_for [:admin, image], remote: true, url: admin_images_path, html: { multipart: true } do |form|
2
+
3
+ = form.inputs id: 'image_fields' do
4
+ = form.input :assetable_type, as: :hidden, value: section_translation.class.name
5
+ = form.input :assetable_id, as: :hidden, value: section_translation.id
6
+ = form.input :image_width, as: :hidden, value: section_translation.activeadmin_selleo_cms_section.width
7
+ = form.input :image_height, as: :hidden, value: section_translation.activeadmin_selleo_cms_section.height
8
+ = form.input :resize_method, as: :hidden, value: section_translation.activeadmin_selleo_cms_section.resize_method
9
+ = form.input :data
10
+ = form.input :caption
11
+ = form.actions :submit
@@ -0,0 +1,10 @@
1
+ = semantic_form_for [:admin, related_item], remote: true, url: admin_related_items_path(format: :js), html: { multipart: true } do |form|
2
+
3
+ -#= @page.errors.full_messages
4
+
5
+ = form.inputs id: 'related_item_fields' do
6
+ = form.input :related_url
7
+ = form.input :title
8
+ = form.input :relatable_type, as: :hidden, value: section_translation.class.name
9
+ = form.input :relatable_id, as: :hidden, value: section_translation.id
10
+ = form.actions :submit
@@ -0,0 +1 @@
1
+ <%= render partial: 'form' %>
@@ -1,7 +1,7 @@
1
1
  = semantic_form_for [:admin, @section], url: (@section.new_record? ? admin_sections_path : admin_section_path(@section.id)), html: { multipart: true } do |form|
2
2
 
3
3
  = form.input :name, as: :hidden, label: false
4
- - @section.initialize_missing_translations
4
+ - @section.new_record? ? @section.initialize_missing_translations : @section.create_missing_translations
5
5
  - current_locale = ActiveadminSelleoCms::Locale.find_by_code(I18n.locale)
6
6
 
7
7
  .language-tabs
@@ -3,10 +3,12 @@ ActiveAdmin.application.tap do |config|
3
3
  config.register_javascript 'ckeditor/init.js'
4
4
  config.register_javascript 'activeadmin-selleo-cms/custom.js'
5
5
  config.register_javascript 'activeadmin-selleo-cms/jquery-ui-timepicker-addon.js'
6
+ config.register_javascript 'jquery.iframe-transport.js'
7
+ config.register_javascript 'jquery.remotipart.js'
6
8
 
7
9
  config.register_stylesheet 'activeadmin-selleo-cms/jquery-ui.css'
8
10
  config.register_stylesheet 'activeadmin-selleo-cms/custom.css'
9
- config.register_stylesheet 'activeadmin-selleo-cms/jquery-ui-timepicker-addon.css'
11
+ config.register_stylesheet 'activeadmin-selleo-cms/custom.css'
10
12
 
11
13
  config.load_paths << "#{ActiveadminSelleoCms::Engine.root}/app/admin"
12
14
  config.load_paths << File.expand_path('app/admin', Rails.root)
@@ -0,0 +1 @@
1
+ require 'acts_as_list'
@@ -1,6 +1,35 @@
1
1
  en:
2
+ activerecord:
3
+ attributes:
4
+ activeadmin_selleo_cms/image:
5
+ data: "Image"
6
+ activeadmin_selleo_cms/attachment:
7
+ data: "Attachment"
8
+ cover: "Cover image"
2
9
  active_admin:
3
10
  cms:
4
11
  view_on_site: "View on site"
5
12
  sub_pages: "Sub pages"
6
- edit: "Edit"
13
+ edit: "Edit"
14
+ delete: "Delete"
15
+ no_sections_defined: "No sections defined"
16
+ navigation: "Navigation"
17
+ general_options: "General options"
18
+ metadata: "Metadata"
19
+ sections: "Sections"
20
+ save_changes: "Save changes"
21
+ back: "Back"
22
+ edit_image: "Edit image"
23
+ edit_attachment: "Edit attachment"
24
+ manage_images: "Manage images"
25
+ manage_attachments: "Manage attachments"
26
+ manage_related: "Manage related"
27
+ file_manager:
28
+ title: "File manager"
29
+ upload_file: "Upload file"
30
+ manage_files: "Manage files"
31
+ edit_attachment: "Edit attachment"
32
+ edit_image: "Edit image"
33
+ edit_related_item: "Edit related"
34
+ hint: "Hint: drag and drop files to reorder them"
35
+ no_cover: "No cover image"
@@ -0,0 +1,9 @@
1
+ class AddPositionToAssets < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :activeadmin_selleo_cms_assets, :position, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :activeadmin_selleo_cms_assets, :position
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddPositionToRelatedItems < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :activeadmin_selleo_cms_related_items, :position, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :activeadmin_selleo_cms_related_items, :position
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.32"
2
+ VERSION = "0.0.33"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-selleo-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-04 00:00:00.000000000 Z
12
+ date: 2013-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.11
21
+ version: 3.2.13
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.11
29
+ version: 3.2.13
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: jquery-rails
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 0.5.1
53
+ version: 0.6.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.1
61
+ version: 0.6.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: globalize3
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -219,6 +219,38 @@ dependencies:
219
219
  - - ! '>='
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
+ - !ruby/object:Gem::Dependency
223
+ name: remotipart
224
+ requirement: !ruby/object:Gem::Requirement
225
+ none: false
226
+ requirements:
227
+ - - ~>
228
+ - !ruby/object:Gem::Version
229
+ version: '1.0'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ~>
236
+ - !ruby/object:Gem::Version
237
+ version: '1.0'
238
+ - !ruby/object:Gem::Dependency
239
+ name: acts_as_list
240
+ requirement: !ruby/object:Gem::Requirement
241
+ none: false
242
+ requirements:
243
+ - - ! '>='
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ type: :runtime
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
222
254
  - !ruby/object:Gem::Dependency
223
255
  name: pg
224
256
  requirement: !ruby/object:Gem::Requirement
@@ -361,9 +393,12 @@ files:
361
393
  - app/admin/translation.rb
362
394
  - app/admin/active_admin/views_helper.rb
363
395
  - app/admin/activeadmin_selleo_cms/section.rb
396
+ - app/admin/activeadmin_selleo_cms/attachment.rb
364
397
  - app/admin/activeadmin_selleo_cms/asset.rb
398
+ - app/admin/activeadmin_selleo_cms/section_translation.rb
365
399
  - app/admin/activeadmin_selleo_cms/locale.rb
366
400
  - app/admin/activeadmin_selleo_cms/page.rb
401
+ - app/admin/activeadmin_selleo_cms/image.rb
367
402
  - app/admin/activeadmin_selleo_cms/related_item.rb
368
403
  - app/helpers/pages_helper.rb
369
404
  - app/assets/stylesheets/activeadmin-selleo-cms/jquery-ui.css
@@ -394,9 +429,32 @@ files:
394
429
  - app/views/admin/pages/_form.html.haml
395
430
  - app/views/admin/pages/update_positions.js.erb
396
431
  - app/views/admin/pages/_translated_fields.html.haml
432
+ - app/views/admin/pages/update.js.erb
433
+ - app/views/admin/images/_form.html.haml
434
+ - app/views/admin/images/new.html.erb
435
+ - app/views/admin/images/_image.html.haml
436
+ - app/views/admin/images/create.js.erb
437
+ - app/views/admin/images/edit.html.erb
438
+ - app/views/admin/images/update.js.erb
397
439
  - app/views/admin/assets/destroy.js.erb
398
440
  - app/views/admin/translations/update.js.haml
399
441
  - app/views/admin/related_items/destroy.js.erb
442
+ - app/views/admin/related_items/_form.html.haml
443
+ - app/views/admin/related_items/create.js.erb
444
+ - app/views/admin/related_items/edit.html.erb
445
+ - app/views/admin/related_items/update.js.erb
446
+ - app/views/admin/related_items/_related_item.html.haml
447
+ - app/views/admin/attachments/_form.html.haml
448
+ - app/views/admin/attachments/new.html.erb
449
+ - app/views/admin/attachments/create.js.erb
450
+ - app/views/admin/attachments/edit.html.erb
451
+ - app/views/admin/attachments/_attachment.html.haml
452
+ - app/views/admin/attachments/update.js.erb
453
+ - app/views/admin/section_translations/_form.html.haml
454
+ - app/views/admin/section_translations/_images_form.html.haml
455
+ - app/views/admin/section_translations/edit.html.erb
456
+ - app/views/admin/section_translations/_related_items_form.html.haml
457
+ - app/views/admin/section_translations/_attachments_form.html.haml
400
458
  - app/views/pages/index.json.erb
401
459
  - app/views/pages/show.html.haml
402
460
  - app/views/searches/show.html.haml
@@ -422,6 +480,7 @@ files:
422
480
  - config/initializers/active_admin.rb
423
481
  - config/initializers/formtastic.rb
424
482
  - config/initializers/i18n.rb
483
+ - config/initializers/acts_as_list.rb
425
484
  - config/initializers/string_extensions.rb
426
485
  - db/migrate/20130207213528_change_activeadmin_selleo_cms_assets.rb
427
486
  - db/migrate/20121204112326_create_ckeditor_assets.rb
@@ -429,6 +488,8 @@ files:
429
488
  - db/migrate/20130206173233_change_activeadmin_selleo_cms_searches.rb
430
489
  - db/migrate/20121129160200_create_activeadmin_selleo_cms_locales.rb
431
490
  - db/migrate/20130109132745_add_fields_to_page.rb
491
+ - db/migrate/20130601141800_add_position_to_related_items.rb
492
+ - db/migrate/20130531154539_add_position_to_assets.rb
432
493
  - db/migrate/20130211151210_create_activeadmin_selleo_cms_related_items.rb
433
494
  - db/migrate/20121221164723_create_activeadmin_selleo_cms_searches.rb
434
495
  - db/migrate/20130108153415_add_redirect_to_first_sub_page.rb