beautiful_scaffold 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ == 0.2.5
2
+
3
+ * enhancement
4
+ * Capitalize label (forms)
5
+ * Capitalize placeholder (massinserting)
6
+
7
+ * Bugfix
8
+ * Massinserting with boolean
9
+ * Treeview with namespace works
10
+
1
11
  == 0.2.4
2
12
 
3
13
  * Bugfix
data/README.rdoc CHANGED
@@ -8,7 +8,7 @@ Demo : http://demo.beautiful-scaffold.com/
8
8
  == Install
9
9
 
10
10
  Add this in your Gemfile :
11
- gem 'beautiful_scaffold', '0.2.3'
11
+ gem 'beautiful_scaffold', '0.2.5'
12
12
  And run
13
13
  bundle install
14
14
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "beautiful_scaffold"
6
- s.version = "0.2.4"
6
+ s.version = "0.2.5"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.summary = "Beautiful Scaffold generate fully customizable scaffold"
9
9
  s.email = "claudel.sylvain@gmail.com"
@@ -85,4 +85,13 @@ $shadow-spinner:#0060CC;
85
85
  @-webkit-keyframes spinoffPulse {
86
86
  0% { -webkit-transform:rotate(0deg); }
87
87
  100% { -webkit-transform:rotate(360deg); }
88
+ }
89
+ label.bs-label-ib{
90
+ display:inline-block;
91
+ padding-left:4px;
92
+ padding-right:4px;
93
+ }
94
+ label.bs-label-ib input{
95
+ margin-right:3px;
96
+ margin-top:0;
88
97
  }
@@ -5,7 +5,11 @@ class RegistrationsController < Devise::RegistrationsController
5
5
  if resource.id.nil? then
6
6
  self.instance_variable_set(:@_response_body, nil)
7
7
  @opened_modal = "#modal-register-form"
8
- render "beautiful/dashboard", :layout => "beautiful_layout", :location => root_path
8
+ if params[:path_to_redirect] then
9
+ redirect_to params[:path_to_redirect]
10
+ else
11
+ render "beautiful/dashboard", :layout => "beautiful_layout", :location => root_path
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -41,7 +41,10 @@ module BeautifulHelper
41
41
  default_caption = get_belongs_to_model(default_caption)
42
42
  end
43
43
 
44
- caption = t(attribute_name, :default => default_caption).capitalize
44
+ cap = attribute_name
45
+ cap = "number-attr" if attribute_name == "number"
46
+
47
+ caption = t(cap, :default => default_caption).capitalize
45
48
  strpath = model_name.pluralize + "_url"
46
49
  strpath = namespace + '_' + strpath if not namespace.blank?
47
50
 
@@ -78,8 +81,12 @@ module BeautifulHelper
78
81
 
79
82
  name_field = model_name_for_ransack + "_" + name_field unless model_name_for_ransack.blank?
80
83
 
84
+
85
+ cap = label_field
86
+ cap = "number-attr" if label_field == "number"
87
+
81
88
  response = '<div class="control-group">'
82
- response += f.label name_field, t(label_field, :default => default_caption).capitalize, :class => "control-label"
89
+ response += f.label name_field, t(cap, :default => default_caption).capitalize, :class => "control-label"
83
90
  response += '<div class="controls">'
84
91
 
85
92
  type_of_column = ar_model.columns_hash[attribute_name].type unless ar_model.columns_hash[attribute_name].nil?
@@ -11,21 +11,18 @@
11
11
  ar = model_name.classify.constantize.columns_hash[col]
12
12
  if not ar.nil? then
13
13
  case ar.type
14
- when 'integer' then
14
+ when :integer then
15
15
  if col =~ /.*_id/ then
16
16
  f.collection_select((col).to_sym, col.classify.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(col.to_sym, :default => col).capitalize)
19
19
  end
20
- when 'boolean' then
20
+ when :boolean then
21
21
  (
22
- f.radio_button_tag(col.to_sym, true)
23
- f.label((col + "_true").to_sym, t(:yes))
24
- f.radio_button_tag(col.to_sym, false)
25
- f.label((col + "_false").to_sym, t(:no))
22
+ "<label class='bs-label-ib'>#{f.check_box(col.to_sym, {}, true, false)}#{t(col.to_sym, :default => col).capitalize}</label>".html_safe
26
23
  )
27
24
  else
28
- 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(col.to_sym, :default => col).capitalize)
29
26
  end
30
27
  else
31
28
  f.collection_select((col + '_id').to_sym, col.classify.constantize.all, :id, :caption, { :include_blank => true, :selected => (begin params[:q][col + "_id_eq"].to_i rescue '' end) }, { :class => "input-small" })
@@ -14,7 +14,7 @@
14
14
  $.ajax({
15
15
  async : false,
16
16
  type: 'POST',
17
- url: "/admin/<%= plural_model_name %>/" + $(this).data("id") + "/treeview_update",
17
+ url: "/<%= namespace_for_url %><%= plural_model_name %>/" + $(this).data("id") + "/treeview_update",
18
18
  data : {
19
19
  "operation" : "move_node",
20
20
  "<%= model_name %>_id" : data.rslt.cr === -1 ? "" : data.rslt.np.data("id"),
@@ -1,7 +1,7 @@
1
1
  <%- attributes.each do |attribute| -%>
2
2
  <%- if @beautiful_attributes.include?(attribute.name + ':richtext') then -%>
3
3
  <div class="control-group">
4
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
4
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
5
5
  <div class="controls">
6
6
  <%%= f.text_area :<%= attribute.name %>, :class => "richtext-editor" %>
7
7
  </div>
@@ -31,7 +31,7 @@
31
31
  <%% end %>
32
32
  <%- elsif @beautiful_attributes.include?(attribute.name + ':wysiwyg') then -%>
33
33
  <div class="control-group">
34
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
34
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
35
35
  <div class="controls">
36
36
  <%%= f.text_area :<%= attribute.name %>, :class => "wysiwyg-editor" %>
37
37
  </div>
@@ -42,14 +42,14 @@
42
42
  </script>
43
43
  <%- elsif @beautiful_attributes.include?(attribute.name + ':references') then -%>
44
44
  <div class="control-group">
45
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
45
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
46
46
  <div class="controls">
47
47
  <%%= f.collection_select :<%= attribute.name %>_id, <%= attribute.name.camelcase %>.all, :id, :caption, :include_blank => true %>
48
48
  </div>
49
49
  </div>
50
50
  <%- elsif @beautiful_attributes.include?(attribute.name + ':price') then -%>
51
51
  <div class="control-group">
52
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
52
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
53
53
  <div class="controls">
54
54
  <div class="input-prepend">
55
55
  <span class="add-on">$</span><%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
@@ -58,7 +58,7 @@
58
58
  </div>
59
59
  <%- elsif @beautiful_attributes.include?(attribute.name + ':date') then -%>
60
60
  <div class="control-group">
61
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
61
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
62
62
  <div class="controls">
63
63
  <div class="input-append">
64
64
  <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(3i)]" id="<%= singular_table_name %>_<%= attribute.name %>_3i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.day rescue "" end %>" />
@@ -70,7 +70,7 @@
70
70
  </div>
71
71
  <%- elsif @beautiful_attributes.include?(attribute.name + ':datetime') then -%>
72
72
  <div class="control-group">
73
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
73
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
74
74
  <div class="controls">
75
75
  <div class="input-append">
76
76
  <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(3i)]" id="<%= singular_table_name %>_<%= attribute.name %>_3i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.day rescue "" end %>" />
@@ -87,7 +87,7 @@
87
87
  </div>
88
88
  <%- elsif @beautiful_attributes.include?(attribute.name + ':color') then -%>
89
89
  <div class="control-group">
90
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
90
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
91
91
  <div class="controls">
92
92
  <div class="input-append color" data-color="<%%= (@<%= model %>.<%= attribute.name %> || "rgba(0, 0, 0)") %>" data-color-format="rgba">
93
93
  <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %><span class="add-on"><i style="background-color: rgb(0, 0, 0)"></i></span>
@@ -99,7 +99,7 @@
99
99
  </script>
100
100
  <%- else -%>
101
101
  <div class="control-group">
102
- <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
102
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name %>").capitalize, :class => "control-label" %>
103
103
  <div class="controls">
104
104
  <%%= f.<%= attribute.field_type %> :<%= attribute.name %><%= ', :rows => 5' if attribute.field_type == :text_area %> %>
105
105
  </div>
@@ -13,10 +13,11 @@
13
13
  </div>
14
14
 
15
15
  <%%
16
+ namespace_for_url = "<%= namespace_for_url %>"
16
17
  plural_model_name = "<%= model_pluralize %>"
17
18
  model_name = "<%= singular_table_name %>"
18
19
  opened_node = <%= model_camelize %>.select(:id).all.map{ |g| '"treeelt_' + g.id.to_s + '"' }.join(',').html_safe
19
20
  %>
20
21
 
21
- <%%= render :partial => "layouts/treeview_js", :locals => { :model_name => model_name, :plural_model_name => plural_model_name, :opened_node => opened_node } %>
22
+ <%%= render :partial => "layouts/treeview_js", :locals => { :model_name => model_name, :plural_model_name => plural_model_name, :opened_node => opened_node, :namespace_for_url => namespace_for_url } %>
22
23
 
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.2.4
4
+ version: 0.2.5
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: 2012-09-14 00:00:00.000000000Z
12
+ date: 2012-12-04 00:00:00.000000000Z
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