azahara_schema 0.3.12 → 0.3.13
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b507dcb18875d9bb4f5f28126c24e614781829254de088dc6416fcc7d3cfc58e
|
4
|
+
data.tar.gz: b44718dc7be81a03a71416b8db05c3c94b0f3544aa25dc099f9f41abff995b0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97635b0eb75a69deaedb960caf7cc3cc9fd69dfdfcb489655076ee775ddcdbac6dcd4ef8ce784e92a464aae57a4c49b6c45e70a944ebe11f481650b0d16202df
|
7
|
+
data.tar.gz: a43c3f980fcf1d36d5472c13e54d590508884e90ce1c081f03028c9a4059424a33a9a04d60593c1d00d0a5a5399d708513c111dd39d12d3c7122071025278398
|
@@ -1,6 +1,18 @@
|
|
1
1
|
module AzaharaSchema
|
2
2
|
module ApplicationHelper
|
3
3
|
|
4
|
+
def label_record_action(model)
|
5
|
+
model_name = model.model_name.human
|
6
|
+
key = model.persisted? ? :edit : :new
|
7
|
+
|
8
|
+
defaults = []
|
9
|
+
defaults << :"helpers.action.#{model.model_name.i18n_key}.#{key}"
|
10
|
+
defaults << :"helpers.action.#{key}"
|
11
|
+
defaults << "#{key.to_s.humanize} #{model_name}"
|
12
|
+
|
13
|
+
t(defaults.shift, model: model_name, default: defaults)
|
14
|
+
end
|
15
|
+
|
4
16
|
def operators_for_select(schema, filter_name)
|
5
17
|
schema.operators_for(filter_name).collect{|o| [o, o]}
|
6
18
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<%
|
2
2
|
create_attributes ||= {}
|
3
3
|
create_model ||= schema.model
|
4
|
+
create_model = create_model.new
|
4
5
|
%>
|
5
6
|
|
6
7
|
<% if local_assigns.fetch(:filters, true) %>
|
@@ -10,7 +11,7 @@
|
|
10
11
|
<div class="btn-toolbar text-right" role="toolbar" aria-label="Toolbar">
|
11
12
|
<% if can?(:create, create_model) %>
|
12
13
|
<div class="btn-group" role="group" aria-label="<%= t('label_actions') %>">
|
13
|
-
<%= link_to
|
14
|
+
<%= link_to label_record_action(create_model), new_polymorphic_path(create_model, create_attributes), class: 'btn btn-primary' %>
|
14
15
|
</div>
|
15
16
|
<% end %>
|
16
17
|
</div>
|
data/config/locales/cs.yml
CHANGED