activeadmin-selleo-cms 0.0.4 → 0.0.5

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.
@@ -42,16 +42,27 @@ ActiveAdmin.register ActiveadminSelleoCms::Page, as: "Page", sort_order: "lft_as
42
42
  respond_to :html, :js
43
43
 
44
44
  def create
45
- create! do |success, failure|
46
- success.html { render action: :edit }
47
- failure.html { render action: :new }
45
+ @page = ActiveadminSelleoCms::Page.new(params[:page])
46
+ if params[:_change_layout] == "1"
47
+ render action: :new
48
+ else
49
+ create! do |success, failure|
50
+ success.html { redirect_to admin_pages_path }
51
+ failure.html { render action: :new }
52
+ end
48
53
  end
49
54
  end
50
55
 
51
56
  def update
52
- update! do |success, failure|
53
- success.html { render action: :edit }
54
- failure.html { render action: :edit }
57
+ @page = ActiveadminSelleoCms::Page.find(params[:id])
58
+ if params[:_change_layout] == "1"
59
+ @page.attributes = params[:page]
60
+ render action: :edit
61
+ else
62
+ update! do |success, failure|
63
+ success.html { redirect_to admin_pages_path }
64
+ failure.html { render action: :edit }
65
+ end
55
66
  end
56
67
  end
57
68
  end
@@ -1,5 +1,6 @@
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
+ %input{name: "_change_layout", type: "hidden"}
3
4
  - @page.initialize_missing_translations
4
5
  - current_locale = ActiveadminSelleoCms::Locale.find_by_code(I18n.locale)
5
6
  - @page.initialize_missing_sections
@@ -72,6 +73,7 @@
72
73
  });
73
74
 
74
75
  $('select#page_layout').change(function(){
76
+ $(this).closest('form').find('input[name="_change_layout"]').attr('value','1');
75
77
  $(this).closest('form').submit();
76
78
  });
77
79
  });
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
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.4
4
+ version: 0.0.5
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: 2012-12-28 00:00:00.000000000 Z
12
+ date: 2012-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails