beautiful_scaffold 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,10 @@
28
28
  $.each(return_json, function(index, value) {
29
29
  $('table.table th.col-' + value + ', table.table td.col-' + value).css('display', 'table-cell');
30
30
  });
31
+ $('div[class^="col"]').css('display', 'none');
32
+ $.each(return_json, function(index, value) {
33
+ $('div.col-' + value).css('display', 'inline');
34
+ });
31
35
  $('#modal-columns').modal('hide');
32
36
  }
33
37
  });
@@ -4,6 +4,8 @@
4
4
  <%%= link_to '<i class="icon-plus"></i>'.html_safe + t(:new, :default => "New") + ' <%= model %>', new_<%= namespace_for_route %><%= singular_table_name %>_path, :class => "btn" %>
5
5
  </p>
6
6
 
7
+ <%%= render :partial => "layouts/mass_inserting", :locals => { :namespace => 'admin', :model_name => '<%= model %>', :model_columns => [<%= attributes.map{ |e| "'#{e.name}'" }.join(',') %>] } %>
8
+
7
9
  <%%# Set your scopes below (string in array) %>
8
10
  <%% scopes = [] %>
9
11
  <%% if not scopes.blank? then %>
@@ -31,7 +33,7 @@
31
33
  <button class="btn" type="submit"><i class="icon-ok"></i> <%%= t(:process, :default => "Process") %></button>
32
34
  </div>
33
35
 
34
- <%%= render :partial => "layouts/modal_columns", :locals => { :model_name => "<%= singular_table_name %>", :model_columns => [<%= attributes.map{ |e| "'#{e.name}'" }.join(',') %>] } %>
36
+ <%%= render :partial => "layouts/modal_columns", :locals => { :model_name => "<%= singular_table_name %>", :model_columns => [<%= (attributes.map{ |e| "'#{e.name}'" }.to_a + ["'created_at'", "'updated_at'"]).join(',') %>] } %>
35
37
 
36
38
  <table class="table table-striped table-bordered table-condensed">
37
39
  <thead>
@@ -49,6 +51,12 @@
49
51
  </th>
50
52
  <%= render_partial 'app/views/partials/_index_header.html.erb' %>
51
53
  <!-- Beautiful_scaffold - AddField - Header - Do not remove -->
54
+ <th <%%= visible_column("<%= singular_table_name %>", "created_at") %> class="col-created_at">
55
+ <%%= sorting_header("<%= singular_table_name %>", "created_at", "<%= namespace_alone %>") %>
56
+ </th>
57
+ <th <%%= visible_column("<%= singular_table_name %>", "updated_at") %> class="col-updated_at">
58
+ <%%= sorting_header("<%= singular_table_name %>", "updated_at", "<%= namespace_alone %>") %>
59
+ </th>
52
60
  <th colspan="3">
53
61
  <label class="checkbox">
54
62
  <%%= check_box_tag :checkallelt, 'all' %>
@@ -63,6 +71,12 @@
63
71
  <td><%%= <%= singular_table_name %>.id %></td>
64
72
  <td><%%= check_box_tag "ids[]",<%= singular_table_name %>.id, false, :class => 'cbbatch' %></td>
65
73
  <%= render_partial 'app/views/partials/_index_column.html.erb' %><!-- Beautiful_scaffold - AddField - Column - Do not remove -->
74
+ <td <%%= visible_column("<%= singular_table_name %>", "created_at") %> class="col-created_at <%%= align_attribute("datetime") %>">
75
+ <%%= l(<%= singular_table_name %>.created_at, :format => :long) %>
76
+ </td>
77
+ <td <%%= visible_column("<%= singular_table_name %>", "updated_at") %> class="col-updated_at <%%= align_attribute("datetime") %>">
78
+ <%%= l(<%= singular_table_name %>.updated_at, :format => :long) %>
79
+ </td>
66
80
  <td><%%= link_to '<i class="icon-search"></i>'.html_safe, <%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
67
81
  <td><%%= link_to '<i class="icon-pencil"></i>'.html_safe, edit_<%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
68
82
  <td><%%= link_to '<i class="icon-remove"></i>'.html_safe, <%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>), :confirm => t(:are_you_sure, :default => "Are you sure?"), :method => :delete %></td>
@@ -91,7 +105,7 @@
91
105
  <%% end %>
92
106
  </div>
93
107
  <div class="span3">
94
- <%%= search_form_for @q, :url => { :controller => "<%= namespace_for_url %><%= model_pluralize %>" }, :html => { :class => "well" } do |f| %>
108
+ <%%= search_form_for @q, :url => <%= namespace_for_route + 'search_' + model_pluralize + '_path' %>, :html => { :class => "well" }, :method => :post do |f| %>
95
109
  <%= render_partial 'app/views/partials/_index_search.html.erb' %>
96
110
  <!-- Beautiful_scaffold - AddField - Search - Do not remove -->
97
111
  <%%= f.submit t(:filter, :default => "Filter"), :class => "btn btn-primary" %>
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="<%%= I18n.default_locale %>">
2
+ <html lang="<%%= (I18n.locale || I18n.default_locale) %>">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <title>Beautiful Scaffold</title>
@@ -7,7 +7,7 @@
7
7
  <meta name="description" content="Beautiful Scaffold">
8
8
  <meta name="author" content="You or me Sylvain Claudel (http://blog.escarworld.com)">
9
9
 
10
- <%%= stylesheet_link_tag "reset", "bootstrap.min", "bootstrap-responsive.min", "beautiful-scaffold" %>
10
+ <%%= stylesheet_link_tag "reset", "bootstrap.min", "bootstrap-responsive.min", "datepicker", "timepicker", "beautiful-scaffold" %>
11
11
  <style>
12
12
  body {
13
13
  padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
@@ -97,10 +97,18 @@
97
97
  <div class="circle1"></div>
98
98
  </div>
99
99
 
100
- <%%= javascript_include_tag "bootstrap.min", "bootstrap-alert", "bootstrap-dropdown", "bootstrap-modal", "bootstrap-tooltip" %>
100
+ <%%= javascript_include_tag "bootstrap.min", "bootstrap-alert", "bootstrap-datepicker" ,"bootstrap-timepicker", "bootstrap-dropdown", "bootstrap-modal", "bootstrap-tooltip" %>
101
101
  <script type="text/javascript">
102
- $('.dropdown-toggle').dropdown();
102
+ ;(function($){
103
+ $.fn.datepicker.dates['<%= I18n.locale.to_s %>'] = {
104
+ days: <%= (I18n.t("date.day_names") + [I18n.t("date.day_names").first]).map(&:capitalize).to_s.html_safe %>,
105
+ daysShort: <%= (I18n.t("date.abbr_day_names") + [I18n.t("date.abbr_day_names").first]).map(&:capitalize).to_s.html_safe %>,
106
+ daysMin: <%= (I18n.t("date.abbr_day_names") + [I18n.t("date.abbr_day_names").first]).map{ |d| d.capitalize[0..2] }.to_s.html_safe %>,
107
+ months: <%= I18n.t("date.month_names")[1..12].map(&:capitalize).to_s.html_safe %>,
108
+ monthsShort: <%= I18n.t("date.abbr_month_names")[1..12].map(&:capitalize).to_s.html_safe %>
109
+ };
110
+ }(jQuery));
103
111
  </script>
104
-
112
+ <%%= javascript_include_tag "bootstrap-datetimepicker-for-beautiful-scaffold" %>
105
113
  </body>
106
114
  </html>
@@ -46,6 +46,35 @@
46
46
  </div>
47
47
  </div>
48
48
  </div>
49
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':date') then -%>
50
+ <div class="control-group">
51
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
52
+ <div class="controls">
53
+ <div class="input-append">
54
+ <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 %>" />
55
+ <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(2i)]" id="<%= singular_table_name %>_<%= attribute.name %>_2i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.mon rescue "" end %>" />
56
+ <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(1i)]" id="<%= singular_table_name %>_<%= attribute.name %>_1i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.year rescue "" end %>" />
57
+ <%%= f.text_field :<%= attribute.name %>, :class => "dpicker" %><span class="add-on"><i class="icon-calendar"></i></span>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':datetime') then -%>
62
+ <div class="control-group">
63
+ <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
64
+ <div class="controls">
65
+ <div class="input-append">
66
+ <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 %>" />
67
+ <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(2i)]" id="<%= singular_table_name %>_<%= attribute.name %>_2i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.mon rescue "" end %>" />
68
+ <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(1i)]" id="<%= singular_table_name %>_<%= attribute.name %>_1i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.year rescue "" end %>" />
69
+ <%%= f.text_field :<%= attribute.name %>, :class => "dpicker" %><span class="add-on"><i class="icon-calendar"></i></span>
70
+ </div>
71
+ <div class="input-append">
72
+ <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(4i)]" id="<%= singular_table_name %>_<%= attribute.name %>_4i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.min rescue "" end %>" />
73
+ <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(5i)]" id="<%= singular_table_name %>_<%= attribute.name %>_5i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.hour rescue "" end %>" />
74
+ <%%= f.text_field :<%= attribute.name %>, :class => "tpicker" %><span class="add-on"><i class="icon-time"></i></span>
75
+ </div>
76
+ </div>
77
+ </div>
49
78
  <%- else -%>
50
79
  <div class="control-group">
51
80
  <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
@@ -1,19 +1,19 @@
1
1
  <%- attributes.each do |attribute| -%>
2
2
  <td <%%= visible_column("<%= singular_table_name %>", "<%= attribute.name %>") %> class="col-<%= attribute.name %> <%%= align_attribute("<%= attribute.type %>") %>">
3
- <% if @beautiful_attributes.include?(attribute.name + ':price') then %>
3
+ <%- if @beautiful_attributes.include?(attribute.name + ':price') then -%>
4
4
  <%%= number_to_currency(<%= singular_table_name %>.<%= attribute.name %>) %>
5
- <% elsif @beautiful_attributes.include?(attribute.name + ':richtext') then %>
5
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':richtext') then -%>
6
6
  <%%= truncate(<%= singular_table_name %>.<%= attribute.name + "_fulltext" %>, :length => 30) %>
7
- <% elsif @beautiful_attributes.include?(attribute.name + ':boolean') then %>
7
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':boolean') then -%>
8
8
  <%%= t((<%= singular_table_name %>.<%= attribute.name %> ? "yes" : "no").to_sym) %>
9
- <% elsif @beautiful_attributes.include?(attribute.name + ':references') then %>
9
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':references') then -%>
10
10
  <%% if not <%= singular_table_name %>.<%= attribute.name %>_id.nil? then %>
11
11
  <%%= link_to "#" + <%= singular_table_name %>.<%= attribute.name %>_id.to_s, <%= namespace_for_route %><%= attribute.name %>_path(<%= singular_table_name %>.<%= attribute.name %>_id) %>
12
12
  <%% else %>
13
13
  <%%= t(:any, :default => "Any") %>
14
14
  <%% end %>
15
- <% else %>
15
+ <%- else -%>
16
16
  <%%= <%= singular_table_name %>.<%= attribute.name %> %>
17
- <% end %>
17
+ <%- end -%>
18
18
  </td>
19
19
  <%- end -%>
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.1.3
4
+ version: 0.1.4
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-08-01 00:00:00.000000000Z
12
+ date: 2012-08-06 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Beautiful Scaffold generate a complete scaffold (sort, export, paginate
15
15
  and filter data)
@@ -31,11 +31,15 @@ files:
31
31
  - lib/generators/templates/app/assets/images/glyphicons-halflings.png
32
32
  - lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js
33
33
  - lib/generators/templates/app/assets/javascripts/bootstrap-alert.js
34
+ - lib/generators/templates/app/assets/javascripts/bootstrap-datepicker.js
35
+ - lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js
34
36
  - lib/generators/templates/app/assets/javascripts/bootstrap-dropdown.js
35
37
  - lib/generators/templates/app/assets/javascripts/bootstrap-modal.js
38
+ - lib/generators/templates/app/assets/javascripts/bootstrap-timepicker.js
36
39
  - lib/generators/templates/app/assets/javascripts/bootstrap-tooltip.js
37
40
  - lib/generators/templates/app/assets/javascripts/bootstrap.js
38
41
  - lib/generators/templates/app/assets/javascripts/bootstrap.min.js
42
+ - lib/generators/templates/app/assets/javascripts/jquery.livequery.js
39
43
  - lib/generators/templates/app/assets/javascripts/jquery.pjax.js
40
44
  - lib/generators/templates/app/assets/javascripts/modernizr.custom.js
41
45
  - lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss
@@ -43,7 +47,9 @@ files:
43
47
  - lib/generators/templates/app/assets/stylesheets/bootstrap-responsive.min.css
44
48
  - lib/generators/templates/app/assets/stylesheets/bootstrap.css
45
49
  - lib/generators/templates/app/assets/stylesheets/bootstrap.min.css
50
+ - lib/generators/templates/app/assets/stylesheets/datepicker.css
46
51
  - lib/generators/templates/app/assets/stylesheets/reset.css
52
+ - lib/generators/templates/app/assets/stylesheets/timepicker.css
47
53
  - lib/generators/templates/app/controllers/base.rb
48
54
  - lib/generators/templates/app/controllers/master_base.rb
49
55
  - lib/generators/templates/app/helpers/beautiful_helper.rb
@@ -54,6 +60,7 @@ files:
54
60
  - lib/generators/templates/app/models/pdf_report.rb
55
61
  - lib/generators/templates/app/views/_beautiful_menu.html.erb
56
62
  - lib/generators/templates/app/views/_form.html.erb
63
+ - lib/generators/templates/app/views/_mass_inserting.html.erb
57
64
  - lib/generators/templates/app/views/_modal_columns.html.erb
58
65
  - lib/generators/templates/app/views/dashboard.html.erb
59
66
  - lib/generators/templates/app/views/edit.html.erb