activeadmin-selleo-cms 0.0.11 → 0.0.12

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.
@@ -72,11 +72,9 @@ module ActiveadminSelleoCms
72
72
  class Translation
73
73
  attr_protected :id
74
74
 
75
- belongs_to :activeadmin_selleo_cms_page, class_name: '::ActiveadminSelleoCms::Page'
76
-
77
- validates_presence_of :title, unless: ->(translation) { translation.activeadmin_selleo_cms_page.is_link_url }
78
- validates_uniqueness_of :slug, scope: :locale, unless: ->(translation) { translation.activeadmin_selleo_cms_page.is_link_url }
79
- validates_format_of :slug, with: /^[a-z0-9\-_]+$/i, unless: ->(translation) { translation.activeadmin_selleo_cms_page.is_link_url }
75
+ validates_presence_of :title
76
+ validates_uniqueness_of :slug, scope: :locale
77
+ validates_format_of :slug, with: /^[a-z0-9\-_]+$/i
80
78
  end
81
79
  end
82
80
  end
@@ -13,20 +13,6 @@
13
13
  = form.input :is_link_url, as: :boolean, input_html: { checked: @page.link_url.present? }
14
14
  = form.input :link_url, hint: "Enter remote URL including the http part at the beginning"
15
15
 
16
- = form.inputs "Page icon", for: [:icon, form.object.icon || ActiveadminSelleoCms::Icon.new] do |icon_form|
17
- = icon_form.input :data, label: "Icon", hint: (form.object.icon ? icon_form.template.image_tag(form.object.icon_url) : "No icon uploaded yet" )
18
-
19
- = form.inputs "Header image", for: [:header_image, form.object.header_image || ActiveadminSelleoCms::HeaderImage.new] do |header_image_form|
20
- = header_image_form.input :data, label: "Header image", hint: (form.object.header_image ? header_image_form.template.image_tag(form.object.header_image_url) : "No header image uploaded yet" )
21
-
22
- = form.inputs "Attachments", for: [:attachments, ActiveadminSelleoCms::Attachment.new] do |attachment_form|
23
- = attachment_form.input :data, label: "Attachment", input_html: { multiple: true, name: "page[attachments_attributes][][data]" }
24
- - form.object.attachments.each do |attachment|
25
- %li{"data-attachment-id" => attachment.id}
26
- %label File
27
- = attachment.data_file_name
28
- = link_to_function "Delete", "delete_asset(#{@page.id}, #{attachment.id})"
29
-
30
16
  = form.semantic_fields_for :sections do |section_form|
31
17
  - if @page.section_names.include? section_form.object.name
32
18
  - @section_forms << section_form
@@ -47,6 +33,21 @@
47
33
  %div{id: "lang-#{additional_locale.code}", style: "#{'display:none;' if additional_locale.code == current_locale.code}"}
48
34
  = render partial: 'translated_fields', locals: { locale: additional_locale, form: translated_form }
49
35
 
36
+ = form.inputs "Page icon", for: [:icon, form.object.icon || ActiveadminSelleoCms::Icon.new] do |icon_form|
37
+ = icon_form.input :data, label: "Icon", hint: (form.object.icon ? icon_form.template.image_tag(form.object.icon_url) : "No icon uploaded yet" )
38
+
39
+ = form.inputs "Header image", for: [:header_image, form.object.header_image || ActiveadminSelleoCms::HeaderImage.new] do |header_image_form|
40
+ = header_image_form.input :data, label: "Header image", hint: (form.object.header_image ? header_image_form.template.image_tag(form.object.header_image_url) : "No header image uploaded yet" )
41
+
42
+ = form.inputs "Attachments", for: [:attachments, ActiveadminSelleoCms::Attachment.new] do |attachment_form|
43
+ = attachment_form.input :data, label: "Attachment", input_html: { multiple: true, name: "page[attachments_attributes][][data]" }
44
+ - form.object.attachments.each do |attachment|
45
+ %li{"data-attachment-id" => attachment.id}
46
+ %label File
47
+ = attachment.data_file_name
48
+ = link_to_function "Delete", "delete_asset(#{@page.id}, #{attachment.id})"
49
+
50
+
50
51
  = form.actions do
51
52
  = form.action :submit
52
53
  %li.cancel
@@ -56,11 +57,11 @@
56
57
  :javascript
57
58
  function is_link_url(){
58
59
  if($('input#page_is_link_url').is(':checked')){
59
- $('div.language-tabs').hide();
60
+ $('.link-url-hide, textarea').closest('li').hide();
60
61
  $('li#page_link_url_input').show();
61
62
  }else{
62
63
  $('li#page_link_url_input').hide();
63
- $('div.language-tabs').show();
64
+ $('.link-url-hide, textarea').closest('li').show();
64
65
  }
65
66
  }
66
67
 
@@ -4,9 +4,9 @@
4
4
  %ol
5
5
  = form.input :title
6
6
  = form.input :slug
7
- = form.input :browser_title
8
- = form.input :meta_keywords
9
- = form.input :meta_description, input_html: { rows: 3 }
7
+ = form.input :browser_title, input_html: { class: 'link-url-hide' }
8
+ = form.input :meta_keywords, input_html: { class: 'link-url-hide' }
9
+ = form.input :meta_description, input_html: { rows: 3, class: 'link-url-hide' }
10
10
  = form.input :locale, :as => :hidden, :label => false
11
11
  - @section_forms.each do |section_form|
12
12
  = section_form.semantic_fields_for :translations do |section_form_translated|
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
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.11
4
+ version: 0.0.12
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-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails