beautiful_scaffold 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. data/beautiful_scaffold.gemspec +1 -1
  2. data/lib/generators/beautiful_scaffold_generator.rb +19 -4
  3. data/lib/generators/templates/app/assets/images/ui-anim_basic_16x16.gif +0 -0
  4. data/lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js +20 -5
  5. data/lib/generators/templates/app/assets/javascripts/jquery.jstree.js +4551 -0
  6. data/lib/generators/templates/app/assets/javascripts/tagit.js +489 -0
  7. data/lib/generators/templates/app/assets/stylesheets/tagit-dark-grey.css +135 -0
  8. data/lib/generators/templates/app/assets/stylesheets/themes/default/d.gif +0 -0
  9. data/lib/generators/templates/app/assets/stylesheets/themes/default/d.png +0 -0
  10. data/lib/generators/templates/app/assets/stylesheets/themes/default/style.css +74 -0
  11. data/lib/generators/templates/app/assets/stylesheets/themes/default/throbber.gif +0 -0
  12. data/lib/generators/templates/app/controllers/base.rb +11 -0
  13. data/lib/generators/templates/app/controllers/master_base.rb +39 -0
  14. data/lib/generators/templates/app/helpers/beautiful_helper.rb +53 -19
  15. data/lib/generators/templates/app/locales/beautiful_scaffold.en.yml +1 -0
  16. data/lib/generators/templates/app/locales/beautiful_scaffold.fr.yml +2 -1
  17. data/lib/generators/templates/app/views/_form_habtm_tag.html.erb +47 -0
  18. data/lib/generators/templates/app/views/_treeview_js.html.erb +42 -0
  19. data/lib/generators/templates/app/views/edit.html.erb +1 -1
  20. data/lib/generators/templates/app/views/index.html.erb +3 -0
  21. data/lib/generators/templates/app/views/layout.html.erb +1 -7
  22. data/lib/generators/templates/app/views/partials/_form_field.html.erb +1 -1
  23. data/lib/generators/templates/app/views/partials/_index_search.html.erb +4 -0
  24. data/lib/generators/templates/app/views/treeview.html.erb +22 -0
  25. metadata +14 -3
@@ -0,0 +1,42 @@
1
+ <script type="text/javascript">
2
+ $(function () {
3
+ $("#treeview")
4
+ .jstree({
5
+ "plugins" : [
6
+ "themes","html_data","ui","dnd"
7
+ ],
8
+ "core" : {
9
+ "initially_open" : [<%= opened_node %>]
10
+ }
11
+ })
12
+ .bind("move_node.jstree", function (e, data) {
13
+ data.rslt.o.each(function (i) {
14
+ $.ajax({
15
+ async : false,
16
+ type: 'POST',
17
+ url: "/admin/<%= plural_model_name %>/" + $(this).data("id") + "/treeview_update",
18
+ data : {
19
+ "operation" : "move_node",
20
+ "<%= model_name %>_id" : data.rslt.cr === -1 ? "" : data.rslt.np.data("id"),
21
+ "position" : data.rslt.cp + i,
22
+ "title" : data.rslt.name,
23
+ "copy" : data.rslt.cy ? 1 : 0
24
+ },
25
+ success : function (r) {
26
+ $(data.rslt.oc).attr("id", "treeelt_" + r.id);
27
+ if(data.rslt.cy && $(data.rslt.oc).children("UL").length) {
28
+ data.inst.refresh(data.inst._get_parent(data.rslt.oc));
29
+ }
30
+ },
31
+ error : function (r) {
32
+ $.jstree.rollback(data.rlbk);
33
+ }
34
+ });
35
+ });
36
+ });
37
+ //$("#jstree-marker-line").remove();
38
+ });
39
+ </script>
40
+ <style type="text/css">
41
+ #jstree-marker-line {pointer-events: none;}
42
+ </style>
@@ -1,4 +1,4 @@
1
- <h2><%%= t(:editing, :default => 'Editing') %><%= singular_table_name %></h2>
1
+ <h2><%%= t(:editing, :default => 'Editing') %> <%= singular_table_name %></h2>
2
2
 
3
3
  <%%= render 'form' %>
4
4
 
@@ -2,6 +2,9 @@
2
2
 
3
3
  <p>
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
+ <%% 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") + ' <%= model %>', treeview_<%= namespace_for_route %><%= model_pluralize %>_path, :class => "btn" %>
7
+ <%% end %>
5
8
  </p>
6
9
 
7
10
  <%%= render :partial => "layouts/mass_inserting", :locals => { :namespace => 'admin', :model_name => '<%= model %>', :model_columns => [<%= attributes.map{ |e| "'#{e.name}'" }.join(',') %>] } %>
@@ -7,14 +7,12 @@
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", "datepicker", "timepicker", "beautiful-scaffold" %>
10
+ <%%= stylesheet_link_tag "reset", "bootstrap.min", "bootstrap-responsive.min", "datepicker", "timepicker", "beautiful-scaffold", "tagit-dark-grey" %>
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 */
14
14
  }
15
15
  </style>
16
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
17
- <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>-->
18
16
  <%%= javascript_include_tag "application", "jquery.pjax" %>
19
17
  <%%= javascript_include_tag "jquery.markitup.js" %>
20
18
  <%%= javascript_include_tag "markitup/sets/default/set.js" %>
@@ -66,8 +64,6 @@
66
64
  </div>
67
65
  <div class="span10">
68
66
  <!-- Zone PJAX -->
69
-
70
- <!-- TODO with pjax -->
71
67
  <%% if not flash[:notice].blank? then %>
72
68
  <div class="alert alert-info">
73
69
  <a class="close" data-dismiss="alert" href="#">×</a>
@@ -82,11 +78,9 @@
82
78
  <%%= flash[:error] %>
83
79
  </div>
84
80
  <%% end %>
85
-
86
81
  <div id="pjax-container">
87
82
  <%%= yield %>
88
83
  </div>
89
-
90
84
  <!-- FIN Zone PJAX -->
91
85
  </div>
92
86
  </div>
@@ -79,7 +79,7 @@
79
79
  <div class="control-group">
80
80
  <%%= f.label :<%= attribute.name %>, t(:<%= attribute.name %>, :default => "<%= attribute.name.capitalize %>"), :class => "control-label" %>
81
81
  <div class="controls">
82
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
82
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %><%= ', :rows => 5' if attribute.field_type == :text_area %> %>
83
83
  </div>
84
84
  </div>
85
85
  <%- end -%>
@@ -8,3 +8,7 @@
8
8
  <%- end -%>
9
9
  <%%= ransack_field("<%= singular_table_name %>", "<%= a.name %><%= attribute %>", f, "<%= caption %>") %>
10
10
  <%- end -%>
11
+
12
+ <%- { :created_at => "Created At", :updated_at => "Updated At", :id => "Id" }.each{ |k,v| -%>
13
+ <%%= ransack_field("<%= singular_table_name %>", "<%= k.to_s %>", f, "<%= v %>") %>
14
+ <%- } -%>
@@ -0,0 +1,22 @@
1
+ <h2><%%= t(:treeview, :default => 'Treeview') %> <%= singular_table_name %></h2>
2
+
3
+ <div id="treeview">
4
+ <ul>
5
+ <%% <%= model_camelize %>.transaction do %>
6
+ <%% ar = <%= model_camelize %>.where(:<%= model %>_id => nil) %>
7
+ <%% ar = ar.order("position") if <%= model_camelize %>.column_names.include?("position") %>
8
+ <%% for g in ar.all %>
9
+ <%%= build_treeview(g, '<%= model_pluralize %>') %>
10
+ <%% end %>
11
+ <%% end %>
12
+ </ul>
13
+ </div>
14
+
15
+ <%%
16
+ plural_model_name = "<%= model_pluralize %>"
17
+ model_name = "<%= singular_table_name %>"
18
+ opened_node = <%= model_camelize %>.select(:id).all.map{ |g| '"treeelt_' + g.id.to_s + '"' }.join(',').html_safe
19
+ %>
20
+
21
+ <%%= render :partial => "layouts/treeview_js", :locals => { :model_name => model_name, :plural_model_name => plural_model_name, :opened_node => opened_node } %>
22
+
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.4
4
+ version: 0.1.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-08-06 00:00:00.000000000Z
12
+ date: 2012-08-14 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Beautiful Scaffold generate a complete scaffold (sort, export, paginate
15
15
  and filter data)
@@ -29,6 +29,7 @@ files:
29
29
  - lib/generators/beautiful_scaffold_generator.rb
30
30
  - lib/generators/templates/app/assets/images/glyphicons-halflings-white.png
31
31
  - lib/generators/templates/app/assets/images/glyphicons-halflings.png
32
+ - lib/generators/templates/app/assets/images/ui-anim_basic_16x16.gif
32
33
  - lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js
33
34
  - lib/generators/templates/app/assets/javascripts/bootstrap-alert.js
34
35
  - lib/generators/templates/app/assets/javascripts/bootstrap-datepicker.js
@@ -39,9 +40,11 @@ files:
39
40
  - lib/generators/templates/app/assets/javascripts/bootstrap-tooltip.js
40
41
  - lib/generators/templates/app/assets/javascripts/bootstrap.js
41
42
  - lib/generators/templates/app/assets/javascripts/bootstrap.min.js
43
+ - lib/generators/templates/app/assets/javascripts/jquery.jstree.js
42
44
  - lib/generators/templates/app/assets/javascripts/jquery.livequery.js
43
45
  - lib/generators/templates/app/assets/javascripts/jquery.pjax.js
44
46
  - lib/generators/templates/app/assets/javascripts/modernizr.custom.js
47
+ - lib/generators/templates/app/assets/javascripts/tagit.js
45
48
  - lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss
46
49
  - lib/generators/templates/app/assets/stylesheets/bootstrap-responsive.css
47
50
  - lib/generators/templates/app/assets/stylesheets/bootstrap-responsive.min.css
@@ -49,6 +52,11 @@ files:
49
52
  - lib/generators/templates/app/assets/stylesheets/bootstrap.min.css
50
53
  - lib/generators/templates/app/assets/stylesheets/datepicker.css
51
54
  - lib/generators/templates/app/assets/stylesheets/reset.css
55
+ - lib/generators/templates/app/assets/stylesheets/tagit-dark-grey.css
56
+ - lib/generators/templates/app/assets/stylesheets/themes/default/d.gif
57
+ - lib/generators/templates/app/assets/stylesheets/themes/default/d.png
58
+ - lib/generators/templates/app/assets/stylesheets/themes/default/style.css
59
+ - lib/generators/templates/app/assets/stylesheets/themes/default/throbber.gif
52
60
  - lib/generators/templates/app/assets/stylesheets/timepicker.css
53
61
  - lib/generators/templates/app/controllers/base.rb
54
62
  - lib/generators/templates/app/controllers/master_base.rb
@@ -60,8 +68,10 @@ files:
60
68
  - lib/generators/templates/app/models/pdf_report.rb
61
69
  - lib/generators/templates/app/views/_beautiful_menu.html.erb
62
70
  - lib/generators/templates/app/views/_form.html.erb
71
+ - lib/generators/templates/app/views/_form_habtm_tag.html.erb
63
72
  - lib/generators/templates/app/views/_mass_inserting.html.erb
64
73
  - lib/generators/templates/app/views/_modal_columns.html.erb
74
+ - lib/generators/templates/app/views/_treeview_js.html.erb
65
75
  - lib/generators/templates/app/views/dashboard.html.erb
66
76
  - lib/generators/templates/app/views/edit.html.erb
67
77
  - lib/generators/templates/app/views/index.html.erb
@@ -74,6 +84,7 @@ files:
74
84
  - lib/generators/templates/app/views/partials/_index_search.html.erb
75
85
  - lib/generators/templates/app/views/partials/_show_field.html.erb
76
86
  - lib/generators/templates/app/views/show.html.erb
87
+ - lib/generators/templates/app/views/treeview.html.erb
77
88
  - lib/generators/templates/markitup/jquery.markitup.js
78
89
  - lib/generators/templates/markitup/sets/bbcode/images/bold.png
79
90
  - lib/generators/templates/markitup/sets/bbcode/images/clean.png
@@ -225,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
236
  version: '0'
226
237
  requirements: []
227
238
  rubyforge_project: beautiful_scaffold
228
- rubygems_version: 1.8.10
239
+ rubygems_version: 1.8.17
229
240
  signing_key:
230
241
  specification_version: 3
231
242
  summary: Beautiful Scaffold generate fully customizable scaffold