rails_dash 0.0.6 → 0.1.0

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.
Files changed (89) hide show
  1. data/README.rdoc +5 -3
  2. data/app/assets/images/rails_dash/{tip.png → shadow.png} +0 -0
  3. data/app/assets/stylesheets/rails_dash/content.scss +5 -0
  4. data/app/assets/stylesheets/rails_dash/flash.scss +24 -0
  5. data/app/assets/stylesheets/rails_dash/footer.scss +16 -0
  6. data/app/assets/stylesheets/rails_dash/forms.scss +79 -0
  7. data/app/assets/stylesheets/rails_dash/grid.scss +65 -0
  8. data/app/assets/stylesheets/rails_dash/header.scss +19 -0
  9. data/app/assets/stylesheets/rails_dash/index.css +3 -0
  10. data/app/assets/stylesheets/rails_dash/navigation.scss +35 -0
  11. data/app/assets/stylesheets/rails_dash/page.scss +9 -0
  12. data/app/assets/stylesheets/rails_dash/pager.scss +36 -0
  13. data/app/assets/stylesheets/rails_dash/style.scss +53 -0
  14. data/app/helpers/rails_dash/application_helper.rb +2 -6
  15. data/app/views/rails_dash/_header.html.erb +8 -0
  16. data/config/locales/en.yml +4 -9
  17. data/config/locales/es.yml +4 -9
  18. data/lib/generators/dash/install_generator.rb +2 -4
  19. data/lib/generators/dash/resource_generator.rb +10 -19
  20. data/lib/generators/dash/templates/dash.html.erb +49 -0
  21. data/lib/generators/dash/templates/dash_controller.rb +11 -0
  22. data/lib/generators/dash/templates/form.html.erb +7 -0
  23. data/lib/generators/dash/templates/index.html.erb +19 -0
  24. data/lib/generators/dash/templates/resource_controller.rb +49 -0
  25. data/lib/rails_dash/version.rb +1 -1
  26. data/test/dummy/app/controllers/dash/photos_controller.rb +42 -4
  27. data/test/dummy/app/controllers/dash_controller.rb +2 -1
  28. data/test/dummy/app/models/photo.rb +1 -1
  29. data/test/dummy/app/views/dash/photos/form.html.erb +11 -0
  30. data/test/dummy/app/views/dash/photos/index.html.erb +19 -0
  31. data/test/dummy/app/views/layouts/dash.html.erb +49 -0
  32. data/test/dummy/config/application.rb +2 -3
  33. data/test/dummy/config/routes.rb +1 -3
  34. data/test/dummy/db/development.sqlite3 +0 -0
  35. data/test/dummy/log/development.log +9951 -0
  36. data/test/dummy/tmp/cache/assets/C4B/BD0/sprockets%2F94eaaa522916020d13dd607587191496 +0 -0
  37. data/test/dummy/tmp/cache/assets/C73/810/sprockets%2F001b4e4880284b42e41d1a6e65628f23 +0 -0
  38. data/test/dummy/tmp/cache/assets/CAC/DF0/sprockets%2F68591a55b098a6a551a059f2f8a007c2 +0 -0
  39. data/test/dummy/tmp/cache/assets/CB3/790/sprockets%2F95d10b82ed3c32813ae86305967ac495 +0 -0
  40. data/test/dummy/tmp/cache/assets/CBC/060/sprockets%2Fe48229a61b685914cd5bd763728f35c3 +0 -0
  41. data/test/dummy/tmp/cache/assets/CC5/330/sprockets%2F822e9659e8ca6a7b8fd06735768a1309 +0 -0
  42. data/test/dummy/tmp/cache/assets/CC6/480/sprockets%2Fc269551493a16482fab7596f973d8cd5 +0 -0
  43. data/test/dummy/tmp/cache/assets/CD9/9F0/sprockets%2F35b50387099edf09e230a9a06e93a22a +0 -0
  44. data/test/dummy/tmp/cache/assets/CF2/AE0/sprockets%2F6484cd7d52962c9097ecb92ae30d8826 +0 -0
  45. data/test/dummy/tmp/cache/assets/D12/550/sprockets%2F2feb384c6935a8dc50503c8d6d1c4772 +0 -0
  46. data/test/dummy/tmp/cache/assets/D1A/8C0/sprockets%2Ff52bc139a9583db6445e577f9a5c614a +0 -0
  47. data/test/dummy/tmp/cache/assets/D1C/F20/sprockets%2F86ca1d7c73ec19f06bd7f1693d602795 +0 -0
  48. data/test/dummy/tmp/cache/assets/D1F/C40/sprockets%2F6c48d64b48f391e8cd9bf71508b6147a +0 -0
  49. data/test/dummy/tmp/cache/assets/D29/0B0/sprockets%2F606c351a2b9c0b15a5dbc5bf073e0377 +0 -0
  50. data/test/dummy/tmp/cache/assets/D41/CA0/sprockets%2F2fd6911b1d88afa5d82480545bd95aa6 +0 -0
  51. data/test/dummy/tmp/cache/assets/D4B/300/sprockets%2F21c96e74b485df5c493d1b6df0d4e791 +0 -0
  52. data/test/dummy/tmp/cache/assets/D78/AA0/sprockets%2F451a5e76762fe84ce5f63dbc40f08ee3 +0 -0
  53. data/test/dummy/tmp/cache/assets/D95/470/sprockets%2F59f10d12bccbc7645c63fbb322c277ee +0 -0
  54. data/test/dummy/tmp/cache/assets/D9D/390/sprockets%2F612e4dfda3799cc2e6ea2b7197ca142d +0 -0
  55. data/test/dummy/tmp/cache/assets/DA3/120/sprockets%2Fb5fcb985221ac8754fb55d74faa4e1b9 +0 -0
  56. data/test/dummy/tmp/cache/assets/DA4/4A0/sprockets%2Fb0eaf551806a0469f07288ea4ffdcc9e +0 -0
  57. data/test/dummy/tmp/cache/assets/DAB/320/sprockets%2F59831ac1cca50d82e29e49d7fbee91f7 +0 -0
  58. data/test/dummy/tmp/cache/assets/E3C/BA0/sprockets%2Fc0f6779a15cd28aef5c6da4cf8adf96d +0 -0
  59. metadata +72 -53
  60. data/app/assets/images/rails_dash/grid.png +0 -0
  61. data/app/assets/images/rails_dash/shadow.gif +0 -0
  62. data/app/assets/stylesheets/rails_dash/application.css +0 -13
  63. data/app/assets/stylesheets/rails_dash/autocomplete.sass +0 -24
  64. data/app/assets/stylesheets/rails_dash/content.sass +0 -3
  65. data/app/assets/stylesheets/rails_dash/flash.sass +0 -19
  66. data/app/assets/stylesheets/rails_dash/footer.sass +0 -14
  67. data/app/assets/stylesheets/rails_dash/forms.sass +0 -65
  68. data/app/assets/stylesheets/rails_dash/grid.sass +0 -53
  69. data/app/assets/stylesheets/rails_dash/header.sass +0 -15
  70. data/app/assets/stylesheets/rails_dash/navigation.sass +0 -27
  71. data/app/assets/stylesheets/rails_dash/page.sass +0 -6
  72. data/app/assets/stylesheets/rails_dash/pager.sass +0 -27
  73. data/app/assets/stylesheets/rails_dash/style.sass +0 -42
  74. data/app/controllers/rails_dash/base_controller.rb +0 -7
  75. data/app/controllers/rails_dash/crud_controller.rb +0 -76
  76. data/app/controllers/rails_dash/statics_controller.rb +0 -8
  77. data/app/views/rails_dash/shared/_options.html.haml +0 -6
  78. data/app/views/rails_dash/shared/_pager.html.haml +0 -26
  79. data/app/views/rails_dash/statics/home.html.haml +0 -0
  80. data/config/routes.rb +0 -5
  81. data/lib/generators/dash/templates/dash.erb +0 -10
  82. data/lib/generators/dash/templates/form.erb +0 -4
  83. data/lib/generators/dash/templates/index.erb +0 -21
  84. data/lib/generators/dash/templates/layout.erb +0 -40
  85. data/lib/generators/dash/templates/resource.erb +0 -5
  86. data/test/dummy/app/controllers/statics_controller.rb +0 -6
  87. data/test/dummy/app/views/dash/photos/form.html.haml +0 -6
  88. data/test/dummy/app/views/dash/photos/index.html.haml +0 -25
  89. data/test/dummy/app/views/layouts/dash.html.haml +0 -43
data/README.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  === NOTE: There are some incompatibilities between versions before 0.0.5, we're trying to improve this from version 0.0.5 and above
2
2
 
3
+ === NOTE: From version 0.1.0 and above erb will be use and no abstract class will be use
4
+
3
5
  ---
4
6
 
5
7
  {<img src="https://codeclimate.com/github/mattways/rails_dash.png" />}[https://codeclimate.com/github/mattways/rails_dash] {<img src="https://travis-ci.org/mattways/rails_dash.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mattways/rails_dash] {<img src="https://gemnasium.com/mattways/rails_dash.png" alt="Dependency Status" />}[https://gemnasium.com/mattways/rails_dash]
@@ -33,13 +35,13 @@ To change the behavior of a resource:
33
35
  app/controllers/dash/model_controller.rb
34
36
 
35
37
  To change the layout edit:
36
- app/views/layouts/dash.html.haml
38
+ app/views/layouts/dash.html.erb
37
39
 
38
40
  To change the resource form edit:
39
- app/views/dash/model/form.html.haml
41
+ app/views/dash/model/form.html.erb
40
42
 
41
43
  To change the resource grid edit:
42
- app/views/dash/model/index.html.html
44
+ app/views/dash/model/index.html.erb
43
45
 
44
46
  To change the records in the grid and the filter behavior edit the filter scope in your resource model:
45
47
  app/models/model.rb
@@ -0,0 +1,5 @@
1
+
2
+ #content {
3
+ padding: 40px 0 100px 0;
4
+ }
5
+
@@ -0,0 +1,24 @@
1
+
2
+ #flash {
3
+ margin: 20px auto 5px auto;
4
+ padding-top: 5px;
5
+ font-size: 14px;
6
+
7
+ p {
8
+ margin-bottom: 5px;
9
+ padding: 8px 24px;
10
+
11
+ &.success {
12
+ color: #4f8a10;
13
+ border: 1px solid #629827;
14
+ background: #dff2bf;
15
+ }
16
+
17
+ &.error {
18
+ color: #d8000c;
19
+ border: 1px solid #d8000c;
20
+ background: #ffbaba;
21
+ }
22
+ }
23
+ }
24
+
@@ -0,0 +1,16 @@
1
+
2
+ #footer {
3
+ background: #272728;
4
+ height: 48px;
5
+
6
+ * {
7
+ font-size: 10px;
8
+ line-height: 48px;
9
+ }
10
+
11
+ #copyright {
12
+ float: left;
13
+ color: #b6b8bb;
14
+ }
15
+ }
16
+
@@ -0,0 +1,79 @@
1
+
2
+ form {
3
+ margin: auto;
4
+ width: 452px;
5
+
6
+ a {
7
+ font-size: 13px;
8
+ }
9
+
10
+ fieldset {
11
+ border: none;
12
+
13
+ legend {
14
+ float: left;
15
+ width: 100%;
16
+ text-align: right;
17
+ font-size: 14px;
18
+ padding-bottom: 6px;
19
+ margin: 15px 0 18px 0;
20
+ border-bottom: 1px dashed #d1d2d1;
21
+ }
22
+ }
23
+
24
+ li {
25
+ width: 100%;
26
+ display: inline-block;
27
+ margin-bottom: 20px;
28
+
29
+ &.actions {
30
+ width: 100%;
31
+ margin-top: 18px;
32
+ text-align: right;
33
+
34
+ button {
35
+ cursor: pointer;
36
+ border: none;
37
+ padding: 10px 22px;
38
+ background: #237b42;
39
+ color: #fff;
40
+ font-size: 12px;
41
+ text-transform: uppercase;
42
+
43
+ &:hover {
44
+ background: #4d4c4c;
45
+ }
46
+ }
47
+ }
48
+
49
+ label {
50
+ display: block;
51
+ font-size: 11px;
52
+ color: #908c8c;
53
+ padding-left: 12px;
54
+ margin-bottom: 5px;
55
+ }
56
+
57
+ input[type="text"],input[type="password"],textarea {
58
+ border: 1px solid #e8e8e8;
59
+ width: 416px;
60
+ padding: 9px 18px;
61
+ background: url(shadow.gif) top repeat-x;
62
+ }
63
+
64
+ input[type="text"],input[type="password"] {
65
+ height: 22px;
66
+ }
67
+
68
+ textarea {
69
+ resize: none;
70
+ height: 148px;
71
+ overflow: auto;
72
+ }
73
+
74
+ img {
75
+ border: 1px solid #e8e8e8;
76
+ }
77
+ }
78
+ }
79
+
@@ -0,0 +1,65 @@
1
+
2
+ #options {
3
+ display: inline-block;
4
+ width: 100%;
5
+ margin: 0 0 27px 0;
6
+
7
+ #search {
8
+ float: left;
9
+
10
+ input {
11
+ border: none;
12
+ float: left;
13
+ width: 158px;
14
+ line-height: 34px;
15
+ height: 32px;
16
+ padding: 0 36px 0 15px;
17
+ color: #adaeae;
18
+ background: url(filter.png);
19
+ }
20
+ }
21
+
22
+ a {
23
+ float: right;
24
+ margin-top: 0;
25
+ }
26
+ }
27
+
28
+ table {
29
+ border-collapse: collapse;
30
+ width: 100%;
31
+
32
+ th,td {
33
+ text-align: left;
34
+ color: #787878;
35
+ font-size: 12px;
36
+ padding: 0 15px;
37
+ }
38
+
39
+ th {
40
+ line-height: 32px;
41
+ height: 32px;
42
+ border: 1px solid #d2d3d3;
43
+ background: #e7e9e8;
44
+ font-weight: normal;
45
+ }
46
+
47
+ td {
48
+ line-height: 50px;
49
+ height: 50px;
50
+ border-bottom: 1px solid #eee;
51
+
52
+ img {
53
+ display: block;
54
+ }
55
+
56
+ &.actions {
57
+ width: 120px;
58
+
59
+ a {
60
+ margin-right: 5px;
61
+ }
62
+ }
63
+ }
64
+ }
65
+
@@ -0,0 +1,19 @@
1
+
2
+ #header {
3
+ background: #e7e9e8;
4
+ height: 61px;
5
+ padding-top: 30px;
6
+
7
+ h1 {
8
+ float: left;
9
+ color: #878787;
10
+ font-size: 29px;
11
+ line-height: 29px;
12
+ text-transform: uppercase;
13
+ }
14
+
15
+ form {
16
+ float: right;
17
+ }
18
+ }
19
+
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_directory .
3
+ */
@@ -0,0 +1,35 @@
1
+
2
+ #navigation {
3
+ width: 100%;
4
+ height: 48px;
5
+ background: #4d4c4c;
6
+
7
+ * {
8
+ color: #fff;
9
+ font-size: 12px;
10
+ line-height: 48px;
11
+ }
12
+
13
+ a:hover {
14
+ color: #5d8869;
15
+ }
16
+
17
+ #menu {
18
+ float: left;
19
+
20
+ li {
21
+ float: left;
22
+ margin-right: 30px;
23
+ }
24
+ }
25
+
26
+ #session {
27
+ float: right;
28
+
29
+ * {
30
+ float: left;
31
+ margin-left: 30px;
32
+ }
33
+ }
34
+ }
35
+
@@ -0,0 +1,9 @@
1
+
2
+ #page {
3
+ width: 100%;
4
+ min-height: 100%;
5
+ height: auto !important;
6
+ height: 100%;
7
+ margin-bottom: -48px;
8
+ }
9
+
@@ -0,0 +1,36 @@
1
+
2
+ #pager {
3
+ margin-top: 24px;
4
+ width: 100%;
5
+ text-align: right;
6
+
7
+ * {
8
+ font-size: 12px;
9
+ color: #908c8c;
10
+ }
11
+
12
+ a:hover,.current {
13
+ color: #237b42;
14
+ }
15
+
16
+ .page {
17
+ margin: 0 3px;
18
+ }
19
+
20
+ .first,.previous {
21
+ margin-right: 3px;
22
+ }
23
+
24
+ .previous {
25
+ margin-right: 6px;
26
+ }
27
+
28
+ .next,.last {
29
+ margin-left: 3px;
30
+ }
31
+
32
+ .next {
33
+ margin-left: 6px;
34
+ }
35
+ }
36
+
@@ -0,0 +1,53 @@
1
+
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ html,body {
8
+ height: 100%;
9
+ }
10
+
11
+ body,input,textarea,select {
12
+ font-family: Armata;
13
+ color: #787878;
14
+ }
15
+
16
+ ul,li {
17
+ list-style: none;
18
+ }
19
+
20
+ a {
21
+ color: #5d8869;
22
+ cursor: pointer;
23
+ text-decoration: none;
24
+ }
25
+
26
+ .hidden-text {
27
+ overflow: hidden;
28
+ text-indent: -9999px;
29
+ }
30
+
31
+ .holder {
32
+ margin: auto;
33
+ width: 980px;
34
+ }
35
+
36
+ .button {
37
+ display: block;
38
+ }
39
+
40
+ .action {
41
+ height: 32px;
42
+ padding: 0 20px;
43
+ background: #f1f3f2;
44
+ font-size: 11px;
45
+ line-height: 32px;
46
+ color: #797878;
47
+ text-transform: uppercase;
48
+
49
+ &:hover {
50
+ background: #dbdddc;
51
+ }
52
+ }
53
+
@@ -1,12 +1,8 @@
1
1
  module RailsDash
2
2
  module ApplicationHelper
3
3
 
4
- def options(add_button=true)
5
- render :partial => 'rails_dash/shared/options', :locals => { :add_button => add_button }
6
- end
7
-
8
- def pager(collection)
9
- render :partial => 'rails_dash/shared/pager', :locals => { :collection => collection }
4
+ def header(new_path=nil)
5
+ render partial: 'rails_dash/header', locals: { new_path: new_path }
10
6
  end
11
7
 
12
8
  end
@@ -0,0 +1,8 @@
1
+ <div id="options">
2
+ <%= form_tag request.fullpath, method: 'get', id: 'search' do %>
3
+ <%= text_field_tag :q, params[:q], placeholder: t('dash.grid.filter') %>
4
+ <% end %>
5
+ <% if new_path %>
6
+ <%= link_to t('dash.grid.create'), new_path, class: 'button action' %>
7
+ <% end %>
8
+ </div>
@@ -2,8 +2,8 @@ en:
2
2
  dash:
3
3
  flash:
4
4
  success:
5
- add: "Record added successfully."
6
- edit: "Record edited successfully."
5
+ create: "Record added successfully."
6
+ update: "Record edited successfully."
7
7
  destroy: "Record destroyed successfully."
8
8
  menu:
9
9
  home: "Home"
@@ -14,11 +14,6 @@ en:
14
14
  grid:
15
15
  filter: "Filter"
16
16
  actions: "Actions"
17
- add: "Add"
18
- edit: "Edit"
17
+ create: "Add"
18
+ update: "Edit"
19
19
  destroy: "Destroy"
20
- pager:
21
- first: "First"
22
- previous: "Previous"
23
- next: "Next"
24
- last: "Last"
@@ -2,8 +2,8 @@ es:
2
2
  dash:
3
3
  flash:
4
4
  success:
5
- add: "Registro agregado correctamente."
6
- edit: "Registro editado correctamente."
5
+ create: "Registro agregado correctamente."
6
+ update: "Registro editado correctamente."
7
7
  destroy: "Registro eliminiado correctamente."
8
8
  menu:
9
9
  home: "Inicio"
@@ -14,11 +14,6 @@ es:
14
14
  grid:
15
15
  filter: "Filtrar"
16
16
  actions: "Acciones"
17
- add: "Agregar"
18
- edit: "Editar"
17
+ create: "Agregar"
18
+ update: "Editar"
19
19
  destroy: "Eliminar"
20
- pager:
21
- first: "Primero"
22
- previous: "Anterior"
23
- next: "Siguiente"
24
- last: "Último"
@@ -4,10 +4,8 @@ module Dash
4
4
  source_root File.expand_path('../templates', __FILE__)
5
5
 
6
6
  def install
7
- route "mount RailsDash::Engine => '/dash'"
8
- route "namespace :dash do\n\n end"
9
- template 'dash.erb', 'app/controllers/dash_controller.rb'
10
- template 'layout.erb', 'app/views/layouts/dash.html.haml'
7
+ template 'dash_controller.rb', 'app/controllers/dash_controller.rb'
8
+ copy_file 'dash.html.erb', 'app/views/layouts/dash.html.erb'
11
9
  end
12
10
 
13
11
  end
@@ -2,31 +2,22 @@ module Dash
2
2
  class ResourceGenerator < Rails::Generators::NamedBase
3
3
 
4
4
  source_root File.expand_path('../templates', __FILE__)
5
-
6
- def add_route
7
- insert_into_file 'config/routes.rb', :after => /namespace :dash(.*)/ do
8
- "\n\n resources :#{table_name}"
9
- end
10
- end
11
5
 
12
6
  def add_scope
13
- insert_into_file "app/models/#{singular_name}.rb", :after => /class #{singular_name.camelize}(.*)/ do
14
- "\n\n scope :filter, lambda { |filter| where('', :filter => \"%\#{filter.present? ? filter.downcase : ''}%\") }"
15
- end
16
- end
17
-
18
- def add_menu
19
- insert_into_file 'app/views/layouts/dash.html.haml', :before => /(.*)#session(.*)/ do
20
- "#{' ' * 16}%li\n" +
21
- "#{' ' * 18}%a{ :href => main_app.url_for(:controller => 'dash/#{table_name}', :action => 'index'), :title => #{singular_name.camelize}.model_name.human(:count => 2) }\n" +
22
- "#{' ' * 20}= #{singular_name.camelize}.model_name.human(:count => 2)\n"
7
+ insert_into_file "app/models/#{singular_name}.rb", after: /class #{singular_name.camelize}(.*)/ do
8
+ "\n\n scope :filter, lambda { |filter| where('', filter: \"%\#{filter.to_s.downcase}%\") }"
23
9
  end
24
10
  end
25
11
 
26
12
  def create_templates
27
- template 'resource.erb', "app/controllers/dash/#{table_name}_controller.rb"
28
- template 'form.erb', "app/views/dash/#{table_name}/form.html.haml"
29
- template 'index.erb', "app/views/dash/#{table_name}/index.html.haml"
13
+ @param_singular = ":#{singular_name}"
14
+ @param_plural = ":#{plural_name}"
15
+ @instance_singular = "@#{singular_name}"
16
+ @instance_plural = "@#{plural_name}"
17
+ @index_path = "dash_#{index_helper}_path"
18
+ template 'resource_controller.rb', "app/controllers/dash/#{table_name}_controller.rb"
19
+ template 'form.html.erb', "app/views/dash/#{table_name}/form.html.erb"
20
+ template 'index.html.erb', "app/views/dash/#{table_name}/index.html.erb"
30
21
  end
31
22
 
32
23
  end
@@ -0,0 +1,49 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%= I18n.locale %>">
3
+ <head>
4
+ <title><%= @meta_title %></title>
5
+ <meta charset="utf-8" />
6
+ <%= google_fonts_link_tag 'Armata' %>
7
+ <%= stylesheet_link_tag 'rails_dash', :media => 'all' %>
8
+ <%= javascript_include_tag 'application' %>
9
+ <%= csrf_meta_tags %>
10
+ </head>
11
+ <body>
12
+ <div id="page">
13
+ <div id="navigation">
14
+ <div class="holder">
15
+ <ul id="menu">
16
+ <li><%= link_to t('dash.menu.home'), '#' %></li>
17
+ </ul>
18
+ <div id="session">
19
+ <%= link_to t('dash.session.logout'), '#', :class => 'button' %>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <% if @title.present? %>
24
+ <div id="header">
25
+ <div class="holder">
26
+ <h1><%= @title %></h1>
27
+ </div>
28
+ </div>
29
+ <% end %>
30
+ <% unless flash.empty? %>
31
+ <div id="flash" class="flash holder">
32
+ <% [:error, :success].each do |type| %>
33
+ <% if flash.key? type %>
34
+ <% flash[type].each do |message| %>
35
+ <p class="<%= type %>"><%= message.capitalize %></p>
36
+ <% end %>
37
+ <% end %>
38
+ <% end %>
39
+ </div>
40
+ <% end %>
41
+ <div id="content" class="holder"><%= yield %></div>
42
+ </div>
43
+ <div id="footer">
44
+ <div class="holder">
45
+ <p id="copyright"><%= t 'dash.footer.copyright', :year => Time.now.year %></p>
46
+ </div>
47
+ </div>
48
+ </body>
49
+ </html>
@@ -0,0 +1,11 @@
1
+ class DashController < ApplicationController
2
+ helper RailsDash::ApplicationHelper
3
+
4
+ before_filter :authorize
5
+
6
+ protected
7
+
8
+ def authorize
9
+ end
10
+
11
+ end
@@ -0,0 +1,7 @@
1
+ <%%= form_for [:dash, <%= @instance_singular %>] do |f| %>
2
+ <ul>
3
+ <li class="actions">
4
+ <%%= f.submit %>
5
+ </li>
6
+ </ul>
7
+ <%% end %>
@@ -0,0 +1,19 @@
1
+ <%%= header new_dash_<%= singular_name %>_path %>
2
+ <table cellpadding="0" cellspacing="0">
3
+ <tr>
4
+ <th>#</th>
5
+ <th><%%= <%= class_name %>.human_attribute_name :created_at %></th>
6
+ <th class="actions"><%%= t 'dash.grid.actions' %></th>
7
+ </tr>
8
+ <%% <%= @instance_plural %>.each do |<%= singular_name %>| %>
9
+ <tr>
10
+ <td><%%= <%= singular_name %>.id %></td>
11
+ <td><%%= l <%= singular_name %>.created_at %></td>
12
+ <td class="actions">
13
+ <%%= link_to t('dash.grid.update'), [:dash, <%= singular_name %>] %>
14
+ <%%= link_to t('dash.grid.destroy'), [:dash, <%= singular_name %>], method: 'delete' %>
15
+ </td>
16
+ </tr>
17
+ <%% end %>
18
+ </table>
19
+ <%%= pager <%= @instance_plural %> %>
@@ -0,0 +1,49 @@
1
+ module Dash
2
+ class <%= plural_name.camelize %>Controller < DashController
3
+
4
+ def index
5
+ @meta_title = @title = <%= class_name %>.model_name.human(count: 2)
6
+ <%= @instance_plural %> = <%= class_name %>.filter(params[:q]).page(params[:p].present? ? params[:p].to_i : 1).per(15)
7
+ end
8
+
9
+ def new
10
+ @meta_title = @title = "#{t('dash.grid.create')} #{<%= class_name %>.model_name.human}"
11
+ <%= @instance_singular %> = <%= class_name %>.new
12
+ render :form
13
+ end
14
+
15
+ def create
16
+ @meta_title = @title = "#{t('dash.grid.create')} #{<%= class_name %>.model_name.human}"
17
+ <%= @instance_singular %> = <%= class_name %>.new(params[<%= @param_singular %>])
18
+ if <%= @instance_singular %>.save
19
+ redirect_with_flash <%= @index_path %>, :success, t('dash.flash.success.create'), params
20
+ else
21
+ flash_errors <%= @instance_singular %>
22
+ render :form
23
+ end
24
+ end
25
+
26
+ def show
27
+ @meta_title = @title = "#{t('dash.grid.update')} #{<%= class_name %>.model_name.human}"
28
+ <%= @instance_singular %> = <%= class_name %>.find(params[:id])
29
+ render :form
30
+ end
31
+
32
+ def update
33
+ @meta_title = @title = "#{t('dash.grid.update')} #{<%= class_name %>.model_name.human}"
34
+ <%= @instance_singular %> = <%= class_name %>.find(params[:id])
35
+ if <%= @instance_singular %>.update_attributes(params[<%= @param_singular %>])
36
+ redirect_with_flash <%= @index_path %>, :success, t('dash.flash.success.update'), params
37
+ else
38
+ flash_errors <%= @instance_singular %>
39
+ render :form
40
+ end
41
+ end
42
+
43
+ def destroy
44
+ <%= class_name %>.destroy params[:id]
45
+ redirect_with_flash <%= @index_path %>, :success, t('dash.flash.success.destroy')
46
+ end
47
+
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  module RailsDash
2
2
 
3
- VERSION = '0.0.6'
3
+ VERSION = '0.1.0'
4
4
 
5
5
  end