activeadmin-selleo-cms 0.0.41 → 0.0.42

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,8 +27,8 @@ ActiveAdmin.register ActiveadminSelleoCms::Section, as: "Section", sort_order: "
27
27
 
28
28
  def create
29
29
  create! do |success, failure|
30
- success.html { redirect_to admin_sections_path }
31
- failure.html { render action: :new }
30
+ success.html { redirect_to admin_sections_path }
31
+ failure.html { render action: :new }
32
32
  end
33
33
  end
34
34
 
@@ -0,0 +1,7 @@
1
+ //= require 'active_admin/base'
2
+ //= require 'ckeditor/init'
3
+ //= require 'ckeditor/plugins/inlinesave/plugin'
4
+ //= require 'activeadmin-selleo-cms/custom.js'
5
+ //= require 'activeadmin-selleo-cms/jquery-ui-timepicker-addon.js'
6
+ //= require 'jquery.iframe-transport.js'
7
+ //= require 'jquery.remotipart.js'
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @fileOverview Save plugin.
8
+ */
9
+
10
+ (function() {
11
+ var saveCmd = {
12
+ exec: function( editor ) {
13
+ if ( editor.element.getAttribute('data-id') != null ) {
14
+ $.ajax({
15
+ url: '/admin/sections/' + editor.element.getAttribute('data-id') + '.js',
16
+ type: 'PUT',
17
+ data: {
18
+ 'section': {
19
+ 'body': editor.getData()
20
+ }
21
+ }
22
+ });
23
+ } else {
24
+ alert('Section id not specified!');
25
+ }
26
+ }
27
+ };
28
+
29
+ var pluginName = 'inlinesave';
30
+
31
+ // Register a plugin named "save".
32
+ CKEDITOR.plugins.add( pluginName, {
33
+ icons: 'save', // %REMOVE_LINE_CORE%
34
+ init: function( editor ) {
35
+
36
+ editor.addCommand( pluginName, saveCmd );
37
+
38
+ editor.ui.addButton && editor.ui.addButton( 'Save', {
39
+ label: 'Save',
40
+ command: pluginName,
41
+ toolbar: 'document'
42
+ });
43
+ }
44
+ });
45
+ })();
@@ -1,3 +1,5 @@
1
+ @import 'jquery-ui.css.scss';
2
+
1
3
  div.translation > input {
2
4
  -webkit-appearance: none;
3
5
  -webkit-background-clip: border-box;
@@ -77,4 +77,8 @@ module PagesHelper
77
77
  def root
78
78
  page_path(I18n.locale, ActiveadminSelleoCms::Page.root)
79
79
  end
80
+
81
+ def switch_editing
82
+ params[:editing] ? request.url.sub(/\?editing=[^&]*/, '?').sub(/\&editing=[^&]*/, '').sub(/\?$/,'') : request.url+'?editing=true'
83
+ end
80
84
  end
@@ -41,6 +41,7 @@ module ActiveadminSelleoCms
41
41
 
42
42
  after_initialize do
43
43
  self.layout_name = Layout.all.first if (new_record? and layout_name.blank?) or (read_attribute(:layout_name) and !layout)
44
+ create_missing_sections
44
45
  end
45
46
 
46
47
  after_initialize do
@@ -137,6 +138,10 @@ module ActiveadminSelleoCms
137
138
  end
138
139
  end
139
140
 
141
+ def method_missing(sym, *args)
142
+ sections.with_name(sym.to_s).first
143
+ end
144
+
140
145
  class Translation
141
146
  attr_protected :id
142
147
 
@@ -28,28 +28,28 @@ module ActiveadminSelleoCms
28
28
  end
29
29
  end
30
30
 
31
+ def current_translation
32
+ translations.with_locales(I18n.fallbacks[I18n.locale]).first
33
+ end
34
+
31
35
  def image
32
- @image ||= if current_translation = translations.with_locales(I18n.fallbacks[I18n.locale]).detect{|t| t.image}
33
- current_translation.image
34
- else
35
- nil
36
- end
36
+ current_translation.image
37
37
  end
38
38
 
39
39
  def attachment
40
- @attachment ||= if current_translation = translations.with_locales(I18n.fallbacks[I18n.locale]).detect{|t| t.attachment}
41
- current_translation.attachment
42
- else
43
- nil
44
- end
40
+ current_translation.attachment
41
+ end
42
+
43
+ def attachments
44
+ current_translation.attachments
45
45
  end
46
46
 
47
47
  def images
48
- @images ||= if current_translation = translations.with_locales(I18n.fallbacks[I18n.locale]).detect{|t| t.images.any? }
49
- current_translation.images
50
- else
51
- []
52
- end
48
+ current_translation.images
49
+ end
50
+
51
+ def related_items
52
+ current_translation.related_items
53
53
  end
54
54
 
55
55
  def to_s
@@ -21,7 +21,7 @@
21
21
 
22
22
  %ol
23
23
  - if section.text?
24
- = section_form_translated.input :body, as: section.type, label: "Content", input_html: { toolbar: section.toolbar }
24
+ = section_form_translated.input :body, as: section.type, label: "Content", label: false, input_html: { ckeditor: { toolbar: section.toolbar } }
25
25
 
26
26
  = section_form_translated.input :locale, :as => :hidden, :label => false
27
27
 
@@ -0,0 +1,5 @@
1
+ <% if resource.valid? %>
2
+ $('section[data-id="<%= resource.id %>"]').effect('highlight');
3
+ <% else %>
4
+ alert('Error!');
5
+ <% end %>
@@ -1,15 +1,4 @@
1
1
  ActiveAdmin.application.tap do |config|
2
- config.register_javascript 'active_admin/base.js'
3
- config.register_javascript 'ckeditor/init.js'
4
- config.register_javascript 'activeadmin-selleo-cms/custom.js'
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'
8
-
9
- config.register_stylesheet 'activeadmin-selleo-cms/jquery-ui.css'
10
- config.register_stylesheet 'activeadmin-selleo-cms/custom.css'
11
- config.register_stylesheet 'activeadmin-selleo-cms/custom.css'
12
-
13
2
  config.load_paths << "#{ActiveadminSelleoCms::Engine.root}/app/admin"
14
3
  config.load_paths << File.expand_path('app/admin', Rails.root)
15
4
 
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.41"
2
+ VERSION = "0.0.42"
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.41
4
+ version: 0.0.42
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-06-20 00:00:00.000000000 Z
12
+ date: 2013-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - '='
84
84
  - !ruby/object:Gem::Version
85
- version: 3.7.3
85
+ version: 4.0.4
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - '='
92
92
  - !ruby/object:Gem::Version
93
- version: 3.7.3
93
+ version: 4.0.4
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: paperclip
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -128,17 +128,17 @@ dependencies:
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
- - - ! '>='
131
+ - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: '0'
133
+ version: 3.1.8
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
139
- - - ! '>='
139
+ - - '='
140
140
  - !ruby/object:Gem::Version
141
- version: '0'
141
+ version: 3.1.8
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: awesome_nested_set
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -401,16 +401,18 @@ files:
401
401
  - app/admin/activeadmin_selleo_cms/image.rb
402
402
  - app/admin/activeadmin_selleo_cms/related_item.rb
403
403
  - app/helpers/pages_helper.rb
404
- - app/assets/stylesheets/activeadmin-selleo-cms/jquery-ui.css
405
- - app/assets/stylesheets/activeadmin-selleo-cms/application.css
406
- - app/assets/stylesheets/activeadmin-selleo-cms/custom.css
407
- - app/assets/stylesheets/activeadmin-selleo-cms/jquery-ui-timepicker-addon.css
404
+ - app/assets/stylesheets/active_admin/jquery-ui.css.scss
405
+ - app/assets/stylesheets/active_admin/cms.css.scss
406
+ - app/assets/javascripts/active_admin.js
408
407
  - app/assets/javascripts/ckeditor/config.js
408
+ - app/assets/javascripts/ckeditor/plugins/inlinesave/icons/save.png
409
+ - app/assets/javascripts/ckeditor/plugins/inlinesave/plugin.js
409
410
  - app/assets/javascripts/activeadmin-selleo-cms/jquery-ui-timepicker-addon.js
410
411
  - app/assets/javascripts/activeadmin-selleo-cms/application.js
411
412
  - app/assets/javascripts/activeadmin-selleo-cms/jquery.mjs.nestedSortable.js
412
413
  - app/assets/javascripts/activeadmin-selleo-cms/custom.js
413
414
  - app/views/admin/sections/_form.html.haml
415
+ - app/views/admin/sections/update.js.erb
414
416
  - app/views/admin/pages/_js.html.haml
415
417
  - app/views/admin/pages/reorder.html.haml
416
418
  - app/views/admin/pages/_form.html.haml
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,10 +0,0 @@
1
- .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
2
- .ui-timepicker-div dl { text-align: left; }
3
- .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
4
- .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
5
- .ui-timepicker-div td { font-size: 90%; }
6
- .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
7
-
8
- .ui-timepicker-rtl{ direction: rtl; }
9
- .ui-timepicker-rtl dl { text-align: right; }
10
- .ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }