beautiful_scaffold 0.3.0.rc1 → 0.3.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,4 +23,5 @@
23
23
  *= require markitup/sets/markdown/style.css
24
24
  *= require markitup/sets/html/style.css
25
25
  *= require markitup/sets/textile/style.css
26
+ *= require chardinjs
26
27
  */
@@ -41,10 +41,9 @@ module BeautifulHelper
41
41
  default_caption = get_belongs_to_model(default_caption)
42
42
  end
43
43
 
44
- cap = attribute_name
45
- cap = "number-attr" if attribute_name == "number"
44
+ cap = i18n_translate_path(model_name, attribute_name)
46
45
 
47
- caption = t(cap, :default => default_caption).capitalize
46
+ caption = t(cap, :default => default_caption).capitalize
48
47
  strpath = model_name.pluralize + "_url"
49
48
  strpath = namespace + '_' + strpath if not namespace.blank?
50
49
 
@@ -81,9 +80,7 @@ module BeautifulHelper
81
80
 
82
81
  name_field = model_name_for_ransack + "_" + name_field unless model_name_for_ransack.blank?
83
82
 
84
-
85
- cap = label_field
86
- cap = "number-attr" if label_field == "number"
83
+ cap = i18n_translate_path(model_name, attribute_name)
87
84
 
88
85
  infostr = ''
89
86
  response = '' # See at end
@@ -269,4 +266,16 @@ module BeautifulHelper
269
266
  params.delete :q
270
267
  params.delete :fields
271
268
  end
269
+
270
+ def i18n_translate_path(model, attr)
271
+ "app.models.#{model}.bs_attributes.#{attr}"
272
+ end
273
+
274
+ def i18n_translate_path_model(model)
275
+ "app.models.#{model}.bs_caption"
276
+ end
277
+
278
+ def i18n_translate_path_model_plural(model)
279
+ "app.models.#{model}.bs_caption_plural"
280
+ end
272
281
  end
@@ -15,14 +15,14 @@
15
15
  if col =~ /.*_id/ then
16
16
  f.collection_select((col).to_sym, col.camelize.constantize.all, :id, :caption, { :include_blank => true, :selected => (begin params[:q][col + "_eq"].to_i rescue '' end) }, { :class => "input-small" })
17
17
  else
18
- f.text_field(col.to_sym, :class => "input-small", :placeholder => t(col.to_sym, :default => col).capitalize)
18
+ f.text_field(col.to_sym, :class => "input-small", :placeholder => t(i18n_translate_path(model_name, col)).capitalize)
19
19
  end
20
20
  when :boolean then
21
21
  (
22
- "<label class='bs-label-ib'>#{f.check_box(col.to_sym, {}, true, false)}#{t(col.to_sym, :default => col).capitalize}</label>".html_safe
22
+ "<label class='bs-label-ib'>#{f.check_box(col.to_sym, {}, true, false)}#{t(i18n_translate_path(model_name, col)).capitalize}</label>".html_safe
23
23
  )
24
24
  else
25
- f.text_field(col.to_sym, :class => "input-small", :placeholder => t(col.to_sym, :default => col).capitalize)
25
+ f.text_field(col.to_sym, :class => "input-small", :placeholder => t(i18n_translate_path(model_name, col)).capitalize)
26
26
  end
27
27
  else
28
28
  f.collection_select((col + '_id').to_sym, col.camelize.constantize.all, :id, :caption, { :include_blank => true, :selected => (begin params[:q][col + "_id_eq"].to_i rescue '' end) }, { :class => "input-small" })
@@ -1,9 +1,9 @@
1
1
  <h2><%%= t(:listing, :default => "Listing") %> <%%= <%= i18n_t_m_p(singular_table_name) %> %></h2>
2
2
 
3
3
  <p>
4
- <%%= link_to '<i class="icon-plus"></i>'.html_safe + t(:new, :default => "New") + ' ' + <%= i18n_t_m(model) %>, new_<%= namespace_for_route %><%= singular_table_name %>_path, :class => "btn" %>
4
+ <%%= link_to '<i class="icon-plus"></i> '.html_safe + t(:new, :default => "New") + ' ' + <%= i18n_t_m(model) %>, new_<%= namespace_for_route %><%= singular_table_name %>_path, :class => "btn" %>
5
5
  <%% if <%= model_camelize %>.columns.map(&:name).include?("<%= model %>_id") then %>
6
- <%%= link_to '<i class="icon-folder-close"></i>'.html_safe + t(:treeview, :default => "Treeview") + ' ' + <%= i18n_t_m(model) %>, treeview_<%= namespace_for_route %><%= model_pluralize %>_path, :class => "btn" %>
6
+ <%%= link_to '<i class="icon-folder-close"></i> '.html_safe + t(:treeview, :default => "Treeview") + ' ' + <%= i18n_t_m(model) %>, treeview_<%= namespace_for_route %><%= model_pluralize %>_path, :class => "btn" %>
7
7
  <%% end %>
8
8
  </p>
9
9
 
@@ -4,7 +4,7 @@
4
4
  namespace_for_url = "<%= namespace_for_url %>"
5
5
  plural_model_name = "<%= model_pluralize %>"
6
6
  model_name = "<%= singular_table_name %>"
7
- opened_node = <%= model_camelize %>.select(:id).all.map{ |g| '"treeelt_' + g.id.to_s + '"' }.join(',').html_safe
7
+ opened_node = <%= model_camelize %>.select(:id).all.map{ |g| "'treeelt_" + g.id.to_s + "'" }.join(',').html_safe
8
8
  %>
9
9
 
10
10
  <div id="treeview" data-model="<%%= model_name %>" data-url="/<%%= namespace_for_url %><%%= plural_model_name %>/" data-opened="[<%%= opened_node %>]">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beautiful_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.rc1
4
+ version: 0.3.0.rc2
5
5
  prerelease: 6
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-07-09 00:00:00.000000000 Z
12
+ date: 2013-07-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Beautiful Scaffold generate a complete scaffold (sort, export, paginate
15
15
  and filter data) http://www.beautiful-scaffold.com
@@ -44,6 +44,7 @@ files:
44
44
  - lib/generators/templates/app/assets/javascripts/bootstrap-timepicker.js
45
45
  - lib/generators/templates/app/assets/javascripts/bootstrap-wysihtml5.js
46
46
  - lib/generators/templates/app/assets/javascripts/fixed_menu.js
47
+ - lib/generators/templates/app/assets/javascripts/jquery-barcode.js
47
48
  - lib/generators/templates/app/assets/javascripts/jquery.jstree.js
48
49
  - lib/generators/templates/app/assets/javascripts/jquery.livequery.js
49
50
  - lib/generators/templates/app/assets/javascripts/jquery.pjax.js