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: cb01b490fce9f6c956db607a7275b255ec580b05f0de6028aadbf519d04ebe25
4
- data.tar.gz: 4787db231d16f7e4ce662713ca1dab910ffcffd0eae2500960788a2e502acd75
3
+ metadata.gz: b507dcb18875d9bb4f5f28126c24e614781829254de088dc6416fcc7d3cfc58e
4
+ data.tar.gz: b44718dc7be81a03a71416b8db05c3c94b0f3544aa25dc099f9f41abff995b0c
5
5
  SHA512:
6
- metadata.gz: 6c0a37bfd79aed3792ee43517b67682e86bb839ce9021fe2a1ff4320769dedb4085a71063fac3323c6d02801dce842155865d35354fc8cb9ad8269f7f29f4e57
7
- data.tar.gz: 7f9387582fd88ec16806db90dc2991eef9900c420087ad0d1b140fc002bd78a7c2b81cc549e2ef98adf3a45bf702d12370e6aa5524785f5f4452e776572ef803
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 t('common_labels.new_record', model: create_model.model_name.human), new_polymorphic_path(create_model, create_attributes), class: 'btn btn-primary' %>
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>
@@ -5,3 +5,9 @@ cs:
5
5
  label_use_setting: Zobrazit
6
6
  label_unfilled: Nevyplněno
7
7
  label_export_as: "Stáhnout %{as}"
8
+
9
+ helpers:
10
+ action:
11
+ new: Vytvořit %{model}
12
+ edit: Upravit %{model}
13
+
@@ -1,3 +1,3 @@
1
1
  module AzaharaSchema
2
- VERSION = '0.3.12'
2
+ VERSION = '0.3.13'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azahara_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr