optimacms 0.2.13 → 0.2.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 534b652b869e30a22d9f380291344d807540e5ff
4
- data.tar.gz: 2371405e1a2b66cddfc315a18f3469672c468ba8
3
+ metadata.gz: 9114c48f0dfd82c25b0880f4776a0e3c4c981d38
4
+ data.tar.gz: 82a92a7e9b7aeba9cc3fe132e306f532bf4021ad
5
5
  SHA512:
6
- metadata.gz: fe792e4911d5096bc374218c1ba101f671315aa07f403762bdfe6f27d7689cdc034a91a3f1e3f35229160e6ba3bc40f6b686537c1160d05ad3f8e66d0b46800a
7
- data.tar.gz: 1b5ed811054e04c2ded2d5996abd49133f3c5194e2ab00390923d460f96fd3fc1c26aeaf6c2c12ca6a0a5136b860cbfc15ed3af27e2370d79024ede7f9633263
6
+ metadata.gz: 515bd0a4c299478540e73272822535b3b948a175521925e76d2ba9cdb4481e1aae48f70c1103462d833fb0874906a89f04b7f27d2f6e2ca6d101c0df31e35a5b
7
+ data.tar.gz: 38b448846a0c87b39017afc88a7f7108cd0129d8b34224a722bc7e4fab71d5110b92850621afe94d8240d5842e6db6501f6bdb225f2b42742e33d79486160e42
@@ -119,7 +119,8 @@ module Optimacms
119
119
  #@res = false
120
120
 
121
121
  if @res
122
- redirect_to url_list, success: 'Successfully updated'
122
+ u = params[:continue]=="1" ? edit_template_path(@item) : url_list
123
+ redirect_to u, success: 'Successfully updated'
123
124
  else
124
125
  render :edit
125
126
  end
@@ -0,0 +1,6 @@
1
+ class FakeInput < SimpleForm::Inputs::StringInput
2
+ # This method only create a basic input without reading any value from object
3
+ def input
4
+ template.text_field_tag(attribute_name, input_options.delete(:value), input_html_options)
5
+ end
6
+ end
@@ -5,6 +5,8 @@ File: #{@item.path}
5
5
  = horizontal_simple_form_for @item, {:html => { :class => "form-horizontal", :role => "form" }}.merge((@modal==1 ? {remote: true}: {})) do |f|
6
6
  = render 'optimacms/admin/shared/form_errors', :object=>@item
7
7
 
8
+ = f.input :continue, as: :fake, input_html: {value: "0"}
9
+
8
10
  = f.input :parent_id, as: :hidden
9
11
 
10
12
  = f.input :title, label: "Title"
@@ -24,4 +26,18 @@ File: #{@item.path}
24
26
 
25
27
 
26
28
 
27
- = f.button :submit_cancel, 'Save', :cancel=>@url_back
29
+ -#= f.button :submit_cancel, 'Save', :cancel=>@url_back
30
+ = f.button :save_continue_cancel, 'Save', :cancel=>@url_back
31
+
32
+
33
+ :javascript
34
+
35
+ $( document ).ready(function() {
36
+ $('#mainform a.btn-save-continue').click(function(e){
37
+ e.preventDefault();
38
+ console.log("click");
39
+ var f = $(this).closest("form");
40
+ f.find("input[name='continue']").val("1");
41
+ f.submit();
42
+ });
43
+ });
@@ -10,7 +10,6 @@
10
10
 
11
11
  function load_panel_blocks(path){
12
12
  var lang = get_current_tab_lang();
13
- console.log("lang="+lang);
14
13
 
15
14
  //
16
15
  var r = Math.random();
@@ -1,4 +1,5 @@
1
1
  en:
2
2
  simple_form:
3
3
  buttons:
4
- cancel: "Back"
4
+ cancel: "Back"
5
+ save_continue: "Save&Continue"
@@ -1,4 +1,5 @@
1
1
  ru:
2
2
  simple_form:
3
3
  buttons:
4
- cancel: "Отмена"
4
+ cancel: "Отмена"
5
+ save_continue: "Сохранить&Продолжить"
@@ -24,6 +24,31 @@ module Optimacms
24
24
  end
25
25
  end
26
26
 
27
+ def save_continue_cancel(*args, &block)
28
+ template.content_tag :div, :class => "form-group" do
29
+ template.content_tag :div, :class => "col-sm-offset-1 col-sm-6" do
30
+ options = args.extract_options!
31
+
32
+ # class
33
+ options[:class] = [options[:class], 'btn', 'btn-primary', 'btn-lg'].compact
34
+
35
+ #
36
+ args << options
37
+
38
+ buttons = submit(*args, &block) + '&nbsp;&nbsp;'.html_safe+
39
+ template.link_to(I18n.t('simple_form.buttons.save_continue'), '#', {class: options[:class]+['btn-save-continue']})
40
+
41
+ # with cancel link
42
+ if cancel = options.delete(:cancel)
43
+ (buttons+'&nbsp;&nbsp;'.html_safe + template.link_to(I18n.t('simple_form.buttons.cancel'), cancel)).html_safe
44
+ else
45
+ buttons.html_safe
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+
27
52
  end
28
53
 
29
54
  SimpleForm::FormBuilder.send :include, ButtonComponents
@@ -1,3 +1,3 @@
1
1
  module Optimacms
2
- VERSION = "0.2.13"
2
+ VERSION = "0.2.14"
3
3
  end