hobo_rapid 1.4.0.pre4 → 1.4.0.pre5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0.pre4
1
+ 1.4.0.pre5
data/lib/hobo_rapid.rb CHANGED
@@ -4,7 +4,7 @@ module HoboRapid
4
4
  @@root = Pathname.new File.expand_path('../..', __FILE__)
5
5
  def self.root; @@root; end
6
6
 
7
- EDIT_LINK_BASE = "https://github.com/tablatom/hobo_tree_table/edit/master/hobo_rapid"
7
+ EDIT_LINK_BASE = "https://github.com/tablatom/hobo/edit/master/hobo_rapid"
8
8
 
9
9
  require 'hobo_rapid/railtie' if defined?(Rails)
10
10
 
data/taglibs/i18n/t.dryml CHANGED
@@ -3,6 +3,11 @@
3
3
  The tag content is used as the :default option. It is overridden by an explicit 'default' attribute.
4
4
  There is a default :count => 1.
5
5
 
6
+ ### Examples
7
+
8
+ <t key="activerecord.attributes.model.field">Field</t>
9
+ <t key="my_key" count="1">A Foo</t>
10
+
6
11
  ### Attributes
7
12
 
8
13
  - key: the key to lookup
@@ -2,20 +2,20 @@
2
2
 
3
3
  ### Attributes
4
4
 
5
- - `labels` - A hash that gives custom labels for the values of the enum.
6
- Any values that do not have corresponding keys in this hash will get `value.titleize` as the label.
7
- - `titleize` - Set to false to have the value itself (rather than `value.titleize`) be the default label. Default: true
5
+ - `labels` - A hash that gives custom labels for the values of the enum. This attribute is present for backwards compatibility. A better way to customize the labels is to use the translation framework. The key for enum 'e' on field 'f' for model 'm' would be `activerecord.attributes.m.f.e`.
6
+ - `titleize` - Set to false to have the value itself (rather than `value.titleize`) be the default label if translation fails. Default: true
8
7
  - `first-option` - a string to be used for an extra option in the first position. E.g. "Please choose..."
9
8
  - `first-value` - the value to be used with the `first-option`. Typically not used, meaning the option has a blank value.
10
-
11
9
  -->
12
10
  <def tag="input" for="HoboFields::Types::EnumString" attrs="labels, titleize, first-option, first-value"><%
13
11
  labels ||= {}
14
12
  labels = HashWithIndifferentAccess.new(labels)
15
- titleize = true if titleize.nil?
16
- options = this_type.values.map {|v|
13
+ titleize = true if titleize.nil? && labels.empty?
14
+ options = this_type.values.map {|v|
15
+ default = labels[v] || v
16
+ default = default.titleize if titleize
17
17
  [I18n.t("activerecord.attributes.#{this_parent.class.to_s.downcase}/#{this_field}s.#{v}",
18
- :default => titleize ? v.titleize : v),
18
+ :default => default),
19
19
  v]
20
20
  }
21
21
  %>
@@ -1,4 +1,4 @@
1
- <!--- This tag is very similar `<field-list-v1>`. However, instead of rendering a table, it renders what [Anatoli Papirovski calls "perfect form markup"](http://web.archive.org/web/20090922234755/http://fecklessmind.com/2009/01/23/how-to-reliable-css-forms/)
1
+ <!-- This tag is very similar `<field-list-v1>`. However, instead of rendering a table, it renders what [Anatoli Papirovski calls "perfect form markup"](http://web.archive.org/web/20090922234755/http://fecklessmind.com/2009/01/23/how-to-reliable-css-forms/)
2
2
 
3
3
  It takes the same attributes & parameters as `<field-list-v1>`, with the addition of a `legend` parameter and a `required` attribute.
4
4
 
@@ -43,7 +43,7 @@ A more complicated example stolen from actual working code:
43
43
  <extend tag="signup-form" for="User">
44
44
  <old-signup-form >
45
45
  <field-list: replace>
46
- <fieldset class="horizontal">
46
+ <fieldset class="horizontal feckless-fields">
47
47
  <legend>New Account Registration</legend>
48
48
  <div class="field name-field">
49
49
  <label class="name-label" for="user_name">Name</label>
@@ -69,7 +69,7 @@ A more complicated example stolen from actual working code:
69
69
  <def tag="feckless-fieldset" attrs="tag, no-edit, required, no-blanks">
70
70
  <% tag ||= scope.in_form ? "input" : "view"; no_edit ||= "skip" -%>
71
71
  <% required ||= "" ; required = comma_split(required.gsub('-', '_')) -%>
72
- <fieldset class="feckless-fields" merge-attrs="&attributes - attrs_for(:with_fields)">
72
+ <fieldset class="feckless-fields" merge-attrs="&attributes - attrs_for(:with_fields)" param>
73
73
  <legend param if="&all_parameters[:legend]" />
74
74
  <with-fields merge-attrs="&attributes & attrs_for(:with_fields)">
75
75
  <% field_name = this_field_name
@@ -17,7 +17,7 @@ All other attributes are merged into the form, so standard form attributes are s
17
17
  <% attributes[:message] ||= t("hobo.live_search.spinner_message", :default => "Querying...") %>
18
18
  <% query_param ||= "query" %>
19
19
  <div class="search" data-rapid='{"live-search": {}}'>
20
- <form merge-attrs param refocus-form>
20
+ <form merge-attrs param refocus-form with="&nil">
21
21
  <input type="hidden" value="2" name="search_version"/>
22
22
  <label for="&query_param" param><t key="hobo.live_search.label">Search</t></label><input type="search" name="&query_param" class="live-search" param/>
23
23
  </form>
@@ -21,7 +21,7 @@ sort-columns: a hash that allow you to map fields to sortable columns. The def
21
21
  -->
22
22
  <def tag="table-plus" attrs="sort-field, sort-direction, sort-columns" >
23
23
  <% sort_field ||= @sort_field; sort_direction ||= @sort_direction; sort_columns ||= {} %>
24
- <% sort_columns['this'] ||= this.member_class.try.name_attribute %>
24
+ <% sort_columns['this'] ||= this.try.member_class.try.name_attribute %>
25
25
  <% ajax_attrs, attributes = attributes.partition_hash(HoboRapidHelper::AJAX_ATTRS) %>
26
26
  <div class="table-plus" merge-attrs="&attributes - attrs_for(:with_fields) - attrs_for(:table)">
27
27
  <div class="header" param="header">
@@ -41,7 +41,7 @@ sort-columns: a hash that allow you to map fields to sortable columns. The def
41
41
  <% col = sort_columns[scope.field_path] || scope.field_path
42
42
  sort = sort_field == col && sort_direction == 'asc' ?
43
43
  "-#{col}" : col
44
- sort_url = url_for_page_path(query_parameters_filtered('except' => 'page').merge(:sort => sort))
44
+ sort_url = url_for_page_path(query_parameters_filtered('skip' => 'page').merge(:sort => sort))
45
45
  col_heading_name = this.member_class.try.human_attribute_name(scope.field_name, :default=> scope.field_name.titleize) %>
46
46
 
47
47
  <th param="#{scope.field_name}-heading">
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hobo_rapid
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.4.0.pre4
5
+ version: 1.4.0.pre5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tom Locke, Bryan Larsen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-28 00:00:00 Z
13
+ date: 2012-04-23 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hobo
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.4.0.pre4
23
+ version: 1.4.0.pre5
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
26
  description: The RAPID tag library for Hobo