simple_form-magic_submit 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -5
- data/lib/simple_form/magic_submit/version.rb +1 -1
- data/lib/simple_form/magic_submit.rb +3 -1
- data/locales/en.yml +4 -4
- data/locales/ru.yml +29 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
A smart submit button extension for the Simple Form gem that:
|
4
4
|
|
5
5
|
- Displays an alternate title on validation errors.
|
6
|
-
- Displays a different "Loading..." title depending on whether the model is being
|
6
|
+
- Displays a different "Loading..." title depending on whether the model is being created or updated.
|
7
7
|
- Is optionally postfixed with a "Cancel" link.
|
8
8
|
- Is fully localizable via the I18n gem.
|
9
9
|
|
@@ -81,11 +81,11 @@ en:
|
|
81
81
|
create:
|
82
82
|
submit: "Create a new %{model}"
|
83
83
|
retry: "Try creating once again"
|
84
|
-
|
84
|
+
disable_with: "Creating…"
|
85
85
|
save:
|
86
86
|
submit: "Save changes"
|
87
87
|
retry: "Try saving once again"
|
88
|
-
|
88
|
+
disable_with: "Saving…"
|
89
89
|
cancel:
|
90
90
|
format: "%{submit_button} or %{cancel_link}"
|
91
91
|
cancel: "Cancel"
|
@@ -98,11 +98,11 @@ en:
|
|
98
98
|
# create:
|
99
99
|
# submit: "Create a new %{model}"
|
100
100
|
# retry: "Try creating once again"
|
101
|
-
#
|
101
|
+
# disable_with: "Creating…"
|
102
102
|
# save:
|
103
103
|
# submit: "Save changes"
|
104
104
|
# retry: "Try saving once again"
|
105
|
-
#
|
105
|
+
# disable_with: "Saving…"
|
106
106
|
```
|
107
107
|
|
108
108
|
Simply copy the file to you config/locales folder inside your Rails project if you want to change the default strings.
|
@@ -5,9 +5,11 @@ module SimpleForm
|
|
5
5
|
|
6
6
|
def submit_retry_button(*args, &block)
|
7
7
|
options = args.extract_options!
|
8
|
-
options[:
|
8
|
+
options[:data] ||= {}
|
9
|
+
options[:data][:disable_with] ||= translate_key(:disable_with)
|
9
10
|
options[:class] = ['btn-primary', 'btn-submit', options[:class]].compact
|
10
11
|
options[:id] ||= "submit_#{object_scope}"
|
12
|
+
options[:autocomplete] ||= :off
|
11
13
|
args << options
|
12
14
|
if cancel = options.delete(:cancel)
|
13
15
|
I18n.t("simple_form.magic_submit.cancel.format",
|
data/locales/en.yml
CHANGED
@@ -5,11 +5,11 @@ en:
|
|
5
5
|
create:
|
6
6
|
submit: "Create a new %{model}"
|
7
7
|
retry: "Try creating once again"
|
8
|
-
|
8
|
+
disable_with: "Creating…"
|
9
9
|
save:
|
10
10
|
submit: "Save changes"
|
11
11
|
retry: "Try saving once again"
|
12
|
-
|
12
|
+
disable_with: "Saving…"
|
13
13
|
cancel:
|
14
14
|
format: "%{submit_button} or %{cancel_link}"
|
15
15
|
cancel: "Cancel"
|
@@ -22,8 +22,8 @@ en:
|
|
22
22
|
# create:
|
23
23
|
# submit: "Create a new %{model}"
|
24
24
|
# retry: "Try creating once again"
|
25
|
-
#
|
25
|
+
# disable_with: "Creating…"
|
26
26
|
# save:
|
27
27
|
# submit: "Save changes"
|
28
28
|
# retry: "Try saving once again"
|
29
|
-
#
|
29
|
+
# disable_with: "Saving…"
|
data/locales/ru.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
ru:
|
2
|
+
simple_form:
|
3
|
+
magic_submit:
|
4
|
+
default:
|
5
|
+
create:
|
6
|
+
submit: "Сохранить"
|
7
|
+
retry: "Попробовать еще раз"
|
8
|
+
disable_with: "Сохранение…"
|
9
|
+
save:
|
10
|
+
submit: "Сохранить изменения"
|
11
|
+
retry: "Попробовать еще раз"
|
12
|
+
disable_with: "Сохранение…"
|
13
|
+
cancel:
|
14
|
+
format: "%{submit_button} или %{cancel_link}"
|
15
|
+
cancel: "отменить"
|
16
|
+
# Replace 'model_name' below with the name of your model and
|
17
|
+
# alter the transaltions as you wish.
|
18
|
+
#
|
19
|
+
# Each translation will have %{model} interpolated.
|
20
|
+
#
|
21
|
+
# model_name:
|
22
|
+
# create:
|
23
|
+
# submit: "Создать %{model}"
|
24
|
+
# retry: "Попробовать создать еще раз"
|
25
|
+
# disable_with: "Создание…"
|
26
|
+
# save:
|
27
|
+
# submit: "Сохранить изменения"
|
28
|
+
# retry: "Попробовать сохранить еще раз"
|
29
|
+
# disable_with: "Сохранение…"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form-magic_submit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
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-03-
|
12
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simple_form
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/simple_form/magic_submit.rb
|
107
107
|
- lib/simple_form/magic_submit/version.rb
|
108
108
|
- locales/en.yml
|
109
|
+
- locales/ru.yml
|
109
110
|
- preview/01-submit.png
|
110
111
|
- preview/02-submit-with-cancel.png
|
111
112
|
- preview/03-model-invalid.png
|