beautiful_scaffold 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +16 -0
- data/beautiful_scaffold.gemspec +1 -1
- data/lib/generators/beautiful_migration_generator.rb +3 -3
- data/lib/generators/templates/app/assets/javascripts/application-bs.js +3 -0
- data/lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js +13 -4
- data/lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss +30 -3
- data/lib/generators/templates/app/controllers/master_base.rb +10 -10
- data/lib/generators/templates/app/helpers/beautiful_helper.rb +1 -1
- data/lib/generators/templates/app/locales/beautiful_scaffold.en.yml +2 -0
- data/lib/generators/templates/app/locales/beautiful_scaffold.fr.yml +3 -1
- data/lib/generators/templates/app/views/index.html.erb +26 -8
- data/lib/generators/templates/app/views/layout.html.erb +1 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
== 0.3.3
|
2
|
+
|
3
|
+
* enhancement
|
4
|
+
* Icons aligned to center, id aligned to right in table
|
5
|
+
* Accordion for option
|
6
|
+
* Add vertical-align on icon
|
7
|
+
* Add title for search-and-filter box
|
8
|
+
|
9
|
+
* bugfix
|
10
|
+
* Mass inserting set focus for first input
|
11
|
+
* I18n for caption in index table
|
12
|
+
* Rails 4 all -> to_a
|
13
|
+
* Improve sorting with treeview
|
14
|
+
* Responsive for Tablet / Mobile / Desktop
|
15
|
+
* Foreignkey in mass-insert and filter-columns error
|
16
|
+
|
1
17
|
== 0.3.2
|
2
18
|
|
3
19
|
* bugfix
|
data/beautiful_scaffold.gemspec
CHANGED
@@ -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.3.
|
6
|
+
s.version = "0.3.3"
|
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"
|
@@ -7,8 +7,8 @@ class BeautifulMigrationGenerator < Rails::Generators::Base
|
|
7
7
|
|
8
8
|
source_root File.expand_path('../templates', __FILE__)
|
9
9
|
|
10
|
-
argument :name, :type => :string, :desc => "Name of the migration CamelCase
|
11
|
-
argument :myattributes, :type => :array, :default => [], :banner => "field:type field:type"
|
10
|
+
argument :name, :type => :string, :desc => "Name of the migration CamelCase AddXxxToYyy (Yyy must be plural)"
|
11
|
+
argument :myattributes, :type => :array, :default => [], :banner => "field:type field:type (for bt relation model:references)"
|
12
12
|
class_option :namespace, :default => nil
|
13
13
|
|
14
14
|
def install_gems
|
@@ -56,7 +56,7 @@ class BeautifulMigrationGenerator < Rails::Generators::Base
|
|
56
56
|
inject_into_file("#{commonpath}index.html.erb", render_partial("app/views/partials/_index_header.html.erb"), :before => "<!-- Beautiful_scaffold - AddField - Header - Do not remove -->\n" )
|
57
57
|
inject_into_file("#{commonpath}index.html.erb", render_partial("app/views/partials/_index_column.html.erb"), :before => "<!-- Beautiful_scaffold - AddField - Column - Do not remove -->\n" )
|
58
58
|
inject_into_file("#{commonpath}index.html.erb", render_partial("app/views/partials/_index_search.html.erb"), :before => "<!-- Beautiful_scaffold - AddField - Search - Do not remove -->\n" )
|
59
|
-
inject_into_file("#{commonpath}index.html.erb", myattributes.map{ |attr| a,t = attr.split(':');
|
59
|
+
inject_into_file("#{commonpath}index.html.erb", myattributes.map{ |attr| a,t = attr.split(':');"'#{a}'" }.join(',') + ',', :after => ":model_columns => [" )
|
60
60
|
# Show
|
61
61
|
inject_into_file("#{commonpath}show.html.erb", render_partial("app/views/partials/_show_field.html.erb"), :before => "<!-- Beautiful_scaffold - AddField - Field - Do not remove -->\n" )
|
62
62
|
end
|
@@ -158,11 +158,20 @@ function bs_init(){
|
|
158
158
|
$("div.control-group>div.field_with_errors").parent().addClass("error");
|
159
159
|
$("#error_explanation").addClass("text-error");
|
160
160
|
|
161
|
+
// Collapse without IDS (next)
|
162
|
+
$('body').on('click.collapse-next.data-api', '[data-toggle=collapse-next]', function() {
|
163
|
+
var $target = $(this).parent().next();
|
164
|
+
$target.data('collapse') ? $target.collapse('toggle') : $target.collapse()
|
165
|
+
return false;
|
166
|
+
});
|
167
|
+
|
161
168
|
// Mass inserting set focus
|
162
|
-
|
163
|
-
|
164
|
-
$(
|
165
|
-
|
169
|
+
$(function() {
|
170
|
+
var elt = $('form.mass-inserting div[style*="inline"][class*="col"] .input-small').first();
|
171
|
+
if($('form.mass-inserting').hasClass('setfocus')){
|
172
|
+
elt.focus();
|
173
|
+
}
|
174
|
+
});
|
166
175
|
|
167
176
|
// Menu dropdown
|
168
177
|
try{
|
@@ -2,10 +2,19 @@
|
|
2
2
|
text-align:right;
|
3
3
|
}
|
4
4
|
.al, table td.al, table th.al{
|
5
|
-
|
5
|
+
text-align:left;
|
6
6
|
}
|
7
7
|
.ac, table td.ac, table th.ac{
|
8
|
-
|
8
|
+
text-align:center;
|
9
|
+
}
|
10
|
+
.ab, table td.ab, table th.ab{
|
11
|
+
vertical-align:bottom;
|
12
|
+
}
|
13
|
+
.am, table td.am, table th.am{
|
14
|
+
vertical-align:middle;
|
15
|
+
}
|
16
|
+
.at, table td.at, table th.at{
|
17
|
+
vertical-align:top;
|
9
18
|
}
|
10
19
|
|
11
20
|
$border-spinner:#0088CC;
|
@@ -139,4 +148,22 @@ html, body {
|
|
139
148
|
z-index: -1;
|
140
149
|
}
|
141
150
|
|
142
|
-
#jstree-marker-line {pointer-events: none;}
|
151
|
+
#jstree-marker-line {pointer-events: none;}
|
152
|
+
|
153
|
+
/* Search & filter */
|
154
|
+
.search-and-filter div.accordion{
|
155
|
+
margin-bottom:0;
|
156
|
+
}
|
157
|
+
.search-and-filter div.accordion .accordion-toggle{
|
158
|
+
padding-left:0;
|
159
|
+
}
|
160
|
+
.search-and-filter div.accordion .accordion-group{
|
161
|
+
border:0;
|
162
|
+
}
|
163
|
+
.search-and-filter div.accordion .accordion-inner{
|
164
|
+
padding:0;
|
165
|
+
margin-top:0;
|
166
|
+
}
|
167
|
+
.search-and-filter h3{
|
168
|
+
margin-top:0;
|
169
|
+
}
|
@@ -70,11 +70,11 @@ class BeautifulController < ApplicationController
|
|
70
70
|
modelclass.transaction do
|
71
71
|
all_elt = modelclass.where(foreignkey => parent_id).order("position ASC").to_a
|
72
72
|
|
73
|
-
begin
|
74
|
-
if index ==
|
75
|
-
new_pos = all_elt.
|
76
|
-
elsif index ==
|
77
|
-
new_pos = all_elt.
|
73
|
+
#begin
|
74
|
+
if index == 0 then
|
75
|
+
new_pos = (begin (all_elt.first.position - 1) rescue 1 end)
|
76
|
+
elsif index == all_elt.length then
|
77
|
+
new_pos = (begin (all_elt.last.position + 1) rescue 1 end)
|
78
78
|
else
|
79
79
|
new_pos = all_elt[index].position
|
80
80
|
|
@@ -82,18 +82,18 @@ class BeautifulController < ApplicationController
|
|
82
82
|
end_of_array.each{ |g|
|
83
83
|
next if g == elt
|
84
84
|
g.position = g.position.to_i + 1
|
85
|
-
g.save
|
85
|
+
g.save!
|
86
86
|
|
87
87
|
next_elt = end_of_array[end_of_array.index(g) + 1]
|
88
88
|
break if not next_elt.nil? and next_elt.position > g.position
|
89
89
|
}
|
90
90
|
end
|
91
|
-
rescue
|
92
|
-
|
93
|
-
end
|
91
|
+
#rescue
|
92
|
+
# new_pos = 0
|
93
|
+
#end
|
94
94
|
end
|
95
95
|
elt.position = new_pos
|
96
96
|
end
|
97
|
-
return elt.save
|
97
|
+
return elt.save!
|
98
98
|
end
|
99
99
|
end
|
@@ -253,7 +253,7 @@ module BeautifulHelper
|
|
253
253
|
<ul>'
|
254
254
|
ar = obj.send(child_relation.to_sym)
|
255
255
|
ar = ar.order('position') if obj.class.column_names.include?("position")
|
256
|
-
for o in ar.
|
256
|
+
for o in ar.to_a
|
257
257
|
out += build_treeview(o, child_relation, caption_method)
|
258
258
|
end
|
259
259
|
out += '
|
@@ -44,4 +44,6 @@ fr:
|
|
44
44
|
password_confirmation: "Mot de passe (Confirmation)"
|
45
45
|
forgot_your_password: "Mot de passe oublié ?"
|
46
46
|
send_me_reset_password_instructions: "Me ré-envoyer les instructions de réinitialisation du mot de passe"
|
47
|
-
register: "Inscription"
|
47
|
+
register: "Inscription"
|
48
|
+
search_and_filter: "Option de filtre"
|
49
|
+
more_options: "Plus d'options..."
|
@@ -41,7 +41,7 @@
|
|
41
41
|
<table class="table table-striped table-bordered table-condensed">
|
42
42
|
<thead>
|
43
43
|
<tr>
|
44
|
-
<th>
|
44
|
+
<th class="ac">
|
45
45
|
<a class="" data-toggle="modal" href="#modal-columns" title="<%%= t(:select_columns, :default => "Select Columns") %>" ><i class="icon-th-list"></i></a>
|
46
46
|
</th>
|
47
47
|
<th>
|
@@ -58,7 +58,7 @@
|
|
58
58
|
<th colspan="3">
|
59
59
|
<label class="checkbox">
|
60
60
|
<%%= check_box_tag :checkallelt, 'all' %>
|
61
|
-
<%%= pluralize(@<%= singular_table_name %>_scope.count, "<%= singular_table_name %>") %>
|
61
|
+
<%%= pluralize(@<%= singular_table_name %>_scope.count, "<%= i18n_t_m(singular_table_name) %>", "<%= i18n_t_m_p(singular_table_name) %>") %>
|
62
62
|
</label>
|
63
63
|
</th>
|
64
64
|
</tr>
|
@@ -66,7 +66,7 @@
|
|
66
66
|
<tbody>
|
67
67
|
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
68
68
|
<tr class="line-<%%= cycle("1","2") %>">
|
69
|
-
<td><%%= <%= singular_table_name %>.id %></td>
|
69
|
+
<td class="ar"><%%= <%= singular_table_name %>.id %></td>
|
70
70
|
<td><%%= check_box_tag "ids[]",<%= singular_table_name %>.id, false, :class => 'cbbatch' %></td>
|
71
71
|
<%= render_partial 'app/views/partials/_index_column.html.erb' %><!-- Beautiful_scaffold - AddField - Column - Do not remove -->
|
72
72
|
<td <%%= visible_column("<%= singular_table_name %>", "created_at") %> class="col-created_at <%%= align_attribute("datetime") %>">
|
@@ -75,9 +75,9 @@
|
|
75
75
|
<td <%%= visible_column("<%= singular_table_name %>", "updated_at") %> class="col-updated_at <%%= align_attribute("datetime") %>">
|
76
76
|
<%%= l(<%= singular_table_name %>.updated_at, :format => :long) %>
|
77
77
|
</td>
|
78
|
-
<td><%%= link_to '<i class="icon-search"></i>'.html_safe, <%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>), :title => t(:show, :default => "Show") %></td>
|
79
|
-
<td><%%= link_to '<i class="icon-pencil"></i>'.html_safe, edit_<%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>), :title => t(:edit, :default => "Edit") %></td>
|
80
|
-
<td><%%= link_to '<i class="icon-remove"></i>'.html_safe, <%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>), :data => { :confirm => t(:are_you_sure, :default => "Are you sure?") }, :method => :delete, :title => t(:destroy, :default => "Destroy") %></td>
|
78
|
+
<td class="ac am"><%%= link_to '<i class="icon-search"></i>'.html_safe, <%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>), :title => t(:show, :default => "Show") %></td>
|
79
|
+
<td class="ac am"><%%= link_to '<i class="icon-pencil"></i>'.html_safe, edit_<%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>), :title => t(:edit, :default => "Edit") %></td>
|
80
|
+
<td class="ac am"><%%= link_to '<i class="icon-remove"></i>'.html_safe, <%= namespace_for_route %><%= singular_table_name %>_path(<%= singular_table_name %>), :data => { :confirm => t(:are_you_sure, :default => "Are you sure?") }, :method => :delete, :title => t(:destroy, :default => "Destroy") %></td>
|
81
81
|
</tr>
|
82
82
|
<%% end %>
|
83
83
|
</tbody>
|
@@ -103,9 +103,27 @@
|
|
103
103
|
<%% end %>
|
104
104
|
</div>
|
105
105
|
<div class="span3">
|
106
|
-
<%%= search_form_for @q, :url => <%= namespace_for_route + 'search_' + model_pluralize + '_path' %>, :html => { :class => "well well-small" }, :method => :post do |f| %>
|
106
|
+
<%%= search_form_for @q, :url => <%= namespace_for_route + 'search_' + model_pluralize + '_path' %>, :html => { :class => "well well-small search-and-filter" }, :method => :post do |f| %>
|
107
|
+
|
108
|
+
<h3><%%= t("search_and_filter", :default => "Search & filter") %></h3>
|
109
|
+
|
107
110
|
<%= render_partial 'app/views/partials/_index_search.html.erb' %>
|
108
|
-
|
111
|
+
|
112
|
+
<div class="accordion">
|
113
|
+
<div class="accordion-group">
|
114
|
+
<div class="accordion-heading">
|
115
|
+
<a class="accordion-toggle" data-toggle="collapse-next">
|
116
|
+
<%%= t(:more_options, :default => "More options...") %>
|
117
|
+
</a>
|
118
|
+
</div>
|
119
|
+
<div class="accordion-body collapse">
|
120
|
+
<div class="accordion-inner">
|
121
|
+
<%= render_partial 'app/views/partials/_index_search_default_fields.html.erb' %>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
109
127
|
<!-- Beautiful_scaffold - AddField - Search - Do not remove -->
|
110
128
|
<%%= f.submit t(:filter, :default => "Filter"), :class => "btn btn-primary" %>
|
111
129
|
<%%= link_to t(:cancel, :default => "Cancel"), <%= namespace_for_route %><%= model_pluralize %>_path(:nosearch => "ok"), :class => "btn" %>
|
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
<meta name="description" content="Beautiful Scaffold">
|
8
8
|
<meta name="author" content="You or me Sylvain Claudel (http://blog.escarworld.com)">
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
9
10
|
|
10
11
|
<%%= stylesheet_link_tag "application-bs" %>
|
11
12
|
<%%= javascript_include_tag "application-bs" %>
|
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.
|
4
|
+
version: 0.3.3
|
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:
|
12
|
+
date: 2014-01-31 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
|