rails_dash 0.0.1

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 (173) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +38 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/images/rails_dash/filter.png +0 -0
  5. data/app/assets/images/rails_dash/grid.png +0 -0
  6. data/app/assets/images/rails_dash/shadow.gif +0 -0
  7. data/app/assets/images/rails_dash/tip.png +0 -0
  8. data/app/assets/stylesheets/rails_dash/application.css +13 -0
  9. data/app/assets/stylesheets/rails_dash/autocomplete.sass +24 -0
  10. data/app/assets/stylesheets/rails_dash/content.sass +3 -0
  11. data/app/assets/stylesheets/rails_dash/flash.sass +19 -0
  12. data/app/assets/stylesheets/rails_dash/footer.sass +14 -0
  13. data/app/assets/stylesheets/rails_dash/forms.sass +65 -0
  14. data/app/assets/stylesheets/rails_dash/grid.sass +53 -0
  15. data/app/assets/stylesheets/rails_dash/header.sass +15 -0
  16. data/app/assets/stylesheets/rails_dash/navigation.sass +27 -0
  17. data/app/assets/stylesheets/rails_dash/page.sass +6 -0
  18. data/app/assets/stylesheets/rails_dash/pager.sass +27 -0
  19. data/app/assets/stylesheets/rails_dash/style.sass +42 -0
  20. data/app/controllers/rails_dash/base_controller.rb +23 -0
  21. data/app/controllers/rails_dash/crud_controller.rb +65 -0
  22. data/app/controllers/rails_dash/statics_controller.rb +8 -0
  23. data/app/views/rails_dash/statics/home.html.haml +0 -0
  24. data/config/routes.rb +5 -0
  25. data/lib/generators/dash/install_generator.rb +15 -0
  26. data/lib/generators/dash/resource_generator.rb +17 -0
  27. data/lib/generators/dash/templates/dash.erb +10 -0
  28. data/lib/generators/dash/templates/filter.erb +5 -0
  29. data/lib/generators/dash/templates/form.erb +4 -0
  30. data/lib/generators/dash/templates/index.erb +19 -0
  31. data/lib/generators/dash/templates/layout.erb +40 -0
  32. data/lib/generators/dash/templates/pager.erb +26 -0
  33. data/lib/generators/dash/templates/resource.erb +5 -0
  34. data/lib/rails_dash/engine.rb +7 -0
  35. data/lib/rails_dash/version.rb +5 -0
  36. data/lib/rails_dash.rb +5 -0
  37. data/test/dummy/README.rdoc +261 -0
  38. data/test/dummy/Rakefile +7 -0
  39. data/test/dummy/app/assets/javascripts/application.js +15 -0
  40. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  41. data/test/dummy/app/controllers/application_controller.rb +3 -0
  42. data/test/dummy/app/controllers/dash/photos_controller.rb +5 -0
  43. data/test/dummy/app/controllers/dash_controller.rb +10 -0
  44. data/test/dummy/app/helpers/application_helper.rb +2 -0
  45. data/test/dummy/app/models/photo.rb +13 -0
  46. data/test/dummy/app/views/dash/photos/form.html.haml +4 -0
  47. data/test/dummy/app/views/dash/photos/index.html.haml +19 -0
  48. data/test/dummy/app/views/dash/shared/_filter.html.haml +5 -0
  49. data/test/dummy/app/views/dash/shared/_pager.html.haml +26 -0
  50. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  51. data/test/dummy/app/views/layouts/dash.html.haml +40 -0
  52. data/test/dummy/config/application.rb +63 -0
  53. data/test/dummy/config/boot.rb +10 -0
  54. data/test/dummy/config/database.yml +25 -0
  55. data/test/dummy/config/environment.rb +5 -0
  56. data/test/dummy/config/environments/development.rb +37 -0
  57. data/test/dummy/config/environments/production.rb +67 -0
  58. data/test/dummy/config/environments/test.rb +37 -0
  59. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/test/dummy/config/initializers/inflections.rb +15 -0
  61. data/test/dummy/config/initializers/mime_types.rb +5 -0
  62. data/test/dummy/config/initializers/secret_token.rb +7 -0
  63. data/test/dummy/config/initializers/session_store.rb +8 -0
  64. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/test/dummy/config/locales/en.yml +5 -0
  66. data/test/dummy/config/routes.rb +7 -0
  67. data/test/dummy/config.ru +4 -0
  68. data/test/dummy/db/development.sqlite3 +0 -0
  69. data/test/dummy/db/migrate/20130402143213_create_photos.rb +12 -0
  70. data/test/dummy/db/schema.rb +22 -0
  71. data/test/dummy/log/development.log +8089 -0
  72. data/test/dummy/log/test.log +3 -0
  73. data/test/dummy/public/404.html +26 -0
  74. data/test/dummy/public/422.html +26 -0
  75. data/test/dummy/public/500.html +25 -0
  76. data/test/dummy/public/favicon.ico +0 -0
  77. data/test/dummy/script/rails +6 -0
  78. data/test/dummy/tmp/cache/assets/BFB/7E0/sprockets%2F9320085d33b800555194fe929982762b +0 -0
  79. data/test/dummy/tmp/cache/assets/C58/890/sprockets%2F2d7971158b18b431d02989a96e33e812 +0 -0
  80. data/test/dummy/tmp/cache/assets/C5B/F90/sprockets%2F8c7a3bc5548168137aa7392b86284906 +0 -0
  81. data/test/dummy/tmp/cache/assets/C6D/C60/sprockets%2F62a541364d6d42f11830c3426f841a3a +0 -0
  82. data/test/dummy/tmp/cache/assets/C79/E70/sprockets%2F179bde618f75a5099991956a966f6861 +0 -0
  83. data/test/dummy/tmp/cache/assets/C8B/270/sprockets%2F7a0602acfe998896b0d470e151625588 +0 -0
  84. data/test/dummy/tmp/cache/assets/C8F/D20/sprockets%2F2d66fda9c7d8645910e0754749f11544 +0 -0
  85. data/test/dummy/tmp/cache/assets/C99/E60/sprockets%2F064aac0041190c605c1728b86db5e660 +0 -0
  86. data/test/dummy/tmp/cache/assets/C9D/5C0/sprockets%2Fa3870a84599f2900e899d917239fee70 +0 -0
  87. data/test/dummy/tmp/cache/assets/CA3/D40/sprockets%2Fd0c463ae779d0510a7d2a39201475f80 +0 -0
  88. data/test/dummy/tmp/cache/assets/CA6/DD0/sprockets%2F41c60b85ca6aa885732e007b88c05343 +0 -0
  89. data/test/dummy/tmp/cache/assets/CAB/660/sprockets%2F0c2455743e4d9189dd1f0ef250c11394 +0 -0
  90. data/test/dummy/tmp/cache/assets/CB0/680/sprockets%2Fa545b40f4926503219dee13976ba83c7 +0 -0
  91. data/test/dummy/tmp/cache/assets/CB0/DB0/sprockets%2F3b03d1b258e45bf0488808687a3c019f +0 -0
  92. data/test/dummy/tmp/cache/assets/CBD/760/sprockets%2Fcd6bf3159c52152955549982d634f4bc +0 -0
  93. data/test/dummy/tmp/cache/assets/CCB/C40/sprockets%2F6c2c30b00feda0096c1523c4721e8647 +0 -0
  94. data/test/dummy/tmp/cache/assets/CD2/BD0/sprockets%2F68d29301abf7b7892ca072ad232341f2 +0 -0
  95. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  96. data/test/dummy/tmp/cache/assets/CE0/1D0/sprockets%2F95cf9361ed4c73f7736bb1065003c27d +0 -0
  97. data/test/dummy/tmp/cache/assets/CE5/C90/sprockets%2F0e2f9731d66610f311f7d93ee472be92 +0 -0
  98. data/test/dummy/tmp/cache/assets/CEB/150/sprockets%2F21cd9639cd9b6925f1a127192c2959fb +0 -0
  99. data/test/dummy/tmp/cache/assets/CF8/E40/sprockets%2F97e76837bd2bd4d792b34582df74a747 +0 -0
  100. data/test/dummy/tmp/cache/assets/CFD/B30/sprockets%2F0e7126250acecd256a22173a6c69f33c +0 -0
  101. data/test/dummy/tmp/cache/assets/D03/FF0/sprockets%2F6159334a6b4a6011f9e4aca85713deb2 +0 -0
  102. data/test/dummy/tmp/cache/assets/D0C/6D0/sprockets%2F066b73503006b11fe0ca9cf979818bcf +0 -0
  103. data/test/dummy/tmp/cache/assets/D0C/D50/sprockets%2F1e1fb266cbd216d68ad5f460542f8507 +0 -0
  104. data/test/dummy/tmp/cache/assets/D0F/AF0/sprockets%2Fcee92070637e21e6c3b0ae89b5604b96 +0 -0
  105. data/test/dummy/tmp/cache/assets/D13/380/sprockets%2F45ea51d9524b0d78eb92ba6f205e3957 +0 -0
  106. data/test/dummy/tmp/cache/assets/D15/8D0/sprockets%2F576fdac742aaf620938b5586e3e261e3 +0 -0
  107. data/test/dummy/tmp/cache/assets/D15/B80/sprockets%2Fc6e382a83453937ad9d0988e2c12c6aa +0 -0
  108. data/test/dummy/tmp/cache/assets/D1A/0E0/sprockets%2Ffa6065deb98c82544e6bf8960f31801c +0 -0
  109. data/test/dummy/tmp/cache/assets/D22/130/sprockets%2F710e497370aad44a1ad04addbd256204 +0 -0
  110. data/test/dummy/tmp/cache/assets/D2A/A60/sprockets%2F1d0eea7f3b7d8e691998d5a97568514c +0 -0
  111. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  112. data/test/dummy/tmp/cache/assets/D35/120/sprockets%2F0b2424217f6c72fc05df4183dcd169ea +0 -0
  113. data/test/dummy/tmp/cache/assets/D37/950/sprockets%2F60859b54ca0d1dfca7049028bedf2903 +0 -0
  114. data/test/dummy/tmp/cache/assets/D3A/720/sprockets%2Fd2e3289732e11cf54d74e8ea51acd125 +0 -0
  115. data/test/dummy/tmp/cache/assets/D3C/F40/sprockets%2Ff0f0ade9590889033e221c7e60c73afa +0 -0
  116. data/test/dummy/tmp/cache/assets/D3D/F70/sprockets%2Fd09ae614e12f07187afd3458c57a6a4d +0 -0
  117. data/test/dummy/tmp/cache/assets/D3F/DC0/sprockets%2F9bd1780aa8721f46e01a84e7db0e6e56 +0 -0
  118. data/test/dummy/tmp/cache/assets/D41/670/sprockets%2F19274a17da516d46b58baf55fd1c3f58 +0 -0
  119. data/test/dummy/tmp/cache/assets/D45/340/sprockets%2Fd417be808603d0e3a7cb829d55f5a68e +0 -0
  120. data/test/dummy/tmp/cache/assets/D4D/640/sprockets%2Ffea346129509ff08d5d5d8b77ba98b24 +0 -0
  121. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  122. data/test/dummy/tmp/cache/assets/D55/110/sprockets%2F18e497baefd6939772d9cc267d3416ea +0 -0
  123. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  124. data/test/dummy/tmp/cache/assets/D5F/8A0/sprockets%2F0412cd81c0aa11e2ccef0d9e479e7146 +0 -0
  125. data/test/dummy/tmp/cache/assets/D69/4F0/sprockets%2Fb9d37dc41f5268332346adebac1379bb +0 -0
  126. data/test/dummy/tmp/cache/assets/D6A/400/sprockets%2F630afb0339b0ce630663983b8dd2efec +0 -0
  127. data/test/dummy/tmp/cache/assets/D77/080/sprockets%2Fd231e66bef5f5ccb5a92272f714786dd +0 -0
  128. data/test/dummy/tmp/cache/assets/D78/090/sprockets%2F14e4a77f7da894213732ad97befdd4d4 +0 -0
  129. data/test/dummy/tmp/cache/assets/D79/0C0/sprockets%2Fffa7fbddfd8a63f466156a14f4471753 +0 -0
  130. data/test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c +0 -0
  131. data/test/dummy/tmp/cache/assets/D9C/9F0/sprockets%2F7c6e5cc58a73cac2d1c900d4a0c589d8 +0 -0
  132. data/test/dummy/tmp/cache/assets/DA2/E80/sprockets%2Fb9b99eb30a9731cc4abcdf42ff951247 +0 -0
  133. data/test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b +0 -0
  134. data/test/dummy/tmp/cache/assets/DBA/780/sprockets%2Fe231e0256cb57ae5feac27411bb8cab5 +0 -0
  135. data/test/dummy/tmp/cache/assets/DC0/F90/sprockets%2Fea7b247b3a394fd0a87b9b3f300a1cfd +0 -0
  136. data/test/dummy/tmp/cache/assets/DC6/790/sprockets%2F223d40d7aed38d4da4e2cad0d555ff39 +0 -0
  137. data/test/dummy/tmp/cache/assets/DCD/AB0/sprockets%2Fd7094ece7c1b47b62d4b280aea7e80ef +0 -0
  138. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  139. data/test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7 +0 -0
  140. data/test/dummy/tmp/cache/assets/DF1/BA0/sprockets%2Ff2aaadaa5f593082c04c59cde41ecc37 +0 -0
  141. data/test/dummy/tmp/cache/assets/E02/5F0/sprockets%2Fc099f7cc09acdb9f0c28860edd9a0ba7 +0 -0
  142. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  143. data/test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4 +0 -0
  144. data/test/dummy/tmp/cache/assets/E5D/4B0/sprockets%2Fba31b9d7aabcf86ec3c48fcd7db830e5 +0 -0
  145. data/test/dummy/tmp/cache/assets/E67/970/sprockets%2F39d69c6bafd9cebefdea7015bd7d0a87 +0 -0
  146. data/test/dummy/tmp/cache/assets/E93/600/sprockets%2F2daf7d5f74f8c9ac8be0bedcfae6009c +0 -0
  147. data/test/dummy/tmp/cache/assets/EEE/360/sprockets%2Ff7b473abfbca6ef0bd2bdfdfda3939ee +0 -0
  148. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/autocomplete.sassc +0 -0
  149. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/content.sassc +0 -0
  150. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/flash.sassc +0 -0
  151. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/footer.sassc +0 -0
  152. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/forms.sassc +0 -0
  153. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/grid.sassc +0 -0
  154. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/header.sassc +0 -0
  155. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/navigation.sassc +0 -0
  156. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/page.sassc +0 -0
  157. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/pager.sassc +0 -0
  158. data/test/dummy/tmp/cache/sass/6128927ae7b2ea45af1afbf9ff6b49e6d69ec9f1/style.sassc +0 -0
  159. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/autocomplete.sassc +0 -0
  160. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/content.sassc +0 -0
  161. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/flash.sassc +0 -0
  162. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/footer.sassc +0 -0
  163. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/forms.sassc +0 -0
  164. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/grid.sassc +0 -0
  165. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/header.sassc +0 -0
  166. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/intro.sassc +0 -0
  167. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/navigation.sassc +0 -0
  168. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/page.sassc +0 -0
  169. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/pager.sassc +0 -0
  170. data/test/dummy/tmp/cache/sass/e22804675e303f28a5c33209e40bad6d47fd67a4/style.sassc +0 -0
  171. data/test/rails_dash_test.rb +9 -0
  172. data/test/test_helper.rb +15 -0
  173. metadata +465 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Mattways
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,38 @@
1
+ {<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]
2
+
3
+ = Rails Dash
4
+
5
+ Minimalistic and easy to customize dashboard.
6
+
7
+ = Install
8
+
9
+ Put this line in your Gemfile:
10
+ gem 'rails_dash'
11
+
12
+ Then bundle:
13
+ $ bundle
14
+
15
+ = Usage
16
+
17
+ To install the dash do:
18
+ rails g dash:install
19
+
20
+ To generate a resource do:
21
+ rails g dash:resource model
22
+
23
+ = Configuration
24
+
25
+ To protect the dash directory edit authorize filter in:
26
+ app/controller/dash_controller.rb
27
+
28
+ To change the behavior of a resource:
29
+ app/controllers/dash/model_controller.rb
30
+
31
+ To change the layout edit:
32
+ app/views/layouts/dash.html.haml
33
+
34
+ To change the resource form edit:
35
+ app/views/dash/model/form.html.haml
36
+
37
+ To change the resource grid edit:
38
+ app/views/dash/model/index.html.html
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'RailsDash'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,24 @@
1
+
2
+ .ui-helper-hidden-accessible
3
+ display: none
4
+
5
+ .ui-autocomplete
6
+ position: absolute
7
+ cursor: pointer
8
+ background: #fff
9
+ border: 1px solid #ccc
10
+
11
+ .ui-menu
12
+ display: block
13
+ list-style: none
14
+
15
+ a
16
+ text-align: left
17
+ text-decoration: none
18
+ display: block
19
+ padding: 0 10px
20
+ line-height: 34px
21
+
22
+ &.ui-state-focus
23
+ background: #5d8869
24
+ color: #fff
@@ -0,0 +1,3 @@
1
+
2
+ #content
3
+ padding: 40px 0 100px 0
@@ -0,0 +1,19 @@
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
+ &.error
17
+ color: #d8000c
18
+ border: 1px solid #d8000c
19
+ background: #ffbaba
@@ -0,0 +1,14 @@
1
+
2
+ #footer
3
+ background: #272728
4
+ margin-top: -48px
5
+ height: 48px
6
+
7
+ *
8
+ font-size: 10px
9
+ line-height: 48px
10
+
11
+ #copyright
12
+ float: left
13
+ color: #b6b8bb
14
+
@@ -0,0 +1,65 @@
1
+
2
+ form
3
+ margin: auto
4
+ width: 452px
5
+
6
+ a
7
+ font-size: 13px
8
+
9
+ fieldset
10
+ border: none
11
+
12
+ legend
13
+ float: left
14
+ width: 100%
15
+ text-align: right
16
+ font-size: 14px
17
+ padding-bottom: 6px
18
+ margin: 15px 0 18px 0
19
+ border-bottom: 1px dashed #d1d2d1
20
+
21
+ li
22
+ width: 100%
23
+ display: inline-block
24
+ margin-bottom: 20px
25
+
26
+ &.actions
27
+ width: 100%
28
+ margin-top: 18px
29
+ text-align: right
30
+
31
+ button
32
+ cursor: pointer
33
+ border: none
34
+ padding: 10px 22px
35
+ background: #237b42
36
+ color: #fff
37
+ font-size: 12px
38
+ text-transform: uppercase
39
+
40
+ &:hover
41
+ background: #4d4c4c
42
+
43
+ label
44
+ display: block
45
+ font-size: 11px
46
+ color: #908c8c
47
+ padding-left: 12px
48
+ margin-bottom: 5px
49
+
50
+ input[type="text"],input[type="password"],textarea
51
+ border: 1px solid #e8e8e8
52
+ width: 416px
53
+ padding: 9px 18px
54
+ background: url(shadow.gif) top repeat-x
55
+
56
+ input[type="text"],input[type="password"]
57
+ height: 22px
58
+
59
+ textarea
60
+ resize: none
61
+ height: 148px
62
+ overflow: auto
63
+
64
+ img
65
+ border: 1px solid #e8e8e8
@@ -0,0 +1,53 @@
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
+ a
21
+ float: right
22
+ margin-top: 0
23
+
24
+ table
25
+ border-collapse: collapse
26
+ width: 100%
27
+
28
+ th,td
29
+ text-align: left
30
+ color: #787878
31
+ font-size: 12px
32
+ padding: 0 15px
33
+
34
+ th
35
+ line-height: 32px
36
+ height: 32px
37
+ border: 1px solid #d2d3d3
38
+ background: #e7e9e8
39
+ font-weight: normal
40
+
41
+ td
42
+ line-height: 50px
43
+ height: 50px
44
+ border-bottom: 1px solid #eee
45
+
46
+ img
47
+ display: block
48
+
49
+ &.actions
50
+ width: 120px
51
+
52
+ a
53
+ margin-right: 5px
@@ -0,0 +1,15 @@
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
+ form
15
+ float: right
@@ -0,0 +1,27 @@
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
+ a:hover
13
+ color: #5d8869
14
+
15
+ #menu
16
+ float: left
17
+
18
+ li
19
+ float: left
20
+ margin-right: 30px
21
+
22
+ #session
23
+ float: right
24
+
25
+ *
26
+ float: left
27
+ margin-left: 30px
@@ -0,0 +1,6 @@
1
+
2
+ #page
3
+ width: 100%
4
+ min-height: 100%
5
+ height: auto !important
6
+ height: 100%
@@ -0,0 +1,27 @@
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
+ a:hover,.current
12
+ color: #237b42
13
+
14
+ .page
15
+ margin: 0 3px
16
+
17
+ .first,.previous
18
+ margin-right: 3px
19
+
20
+ .previous
21
+ margin-right: 6px
22
+
23
+ .next,.last
24
+ margin-left: 3px
25
+
26
+ .next
27
+ margin-left: 6px
@@ -0,0 +1,42 @@
1
+
2
+ *
3
+ margin: 0
4
+ padding: 0
5
+
6
+ html,body
7
+ height: 100%
8
+
9
+ body,input,textarea,select
10
+ font-family: Armata
11
+ color: #787878
12
+
13
+ ul,li
14
+ list-style: none
15
+
16
+ a
17
+ color: #5d8869
18
+ cursor: pointer
19
+ text-decoration: none
20
+
21
+ .hidden-text
22
+ overflow: hidden
23
+ text-indent: -9999px
24
+
25
+ .holder
26
+ margin: auto
27
+ width: 980px
28
+
29
+ .button
30
+ display: block
31
+
32
+ .action
33
+ height: 32px
34
+ padding: 0 20px
35
+ background: #f1f3f2
36
+ font-size: 11px
37
+ line-height: 32px
38
+ color: #797878
39
+ text-transform: uppercase
40
+
41
+ &:hover
42
+ background: #dbdddc
@@ -0,0 +1,23 @@
1
+ module RailsDash
2
+ class BaseController < ActionController::Base
3
+
4
+ before_filter :year
5
+
6
+ layout 'dash'
7
+
8
+ protected
9
+
10
+ def year
11
+ @year = Time.now.year
12
+ end
13
+
14
+ def page
15
+ params[:p].present? ? params[:p].to_i : 1
16
+ end
17
+
18
+ def filter
19
+ params[:q]
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,65 @@
1
+ module RailsDash
2
+ class CrudController < ::DashController
3
+
4
+ before_filter :model
5
+
6
+ def index
7
+ @meta_title = @title = "#{@model.model_name.human :count => 2}"
8
+ @records = @model.list(page, filter)
9
+ end
10
+
11
+ def new
12
+ @meta_title = @title = "#{t('global.add')} #{@model.model_name.human}"
13
+ @record = @model.new
14
+ render :form
15
+ end
16
+
17
+ def create
18
+ @meta_title = @title = "#{t('global.add')} #{@model.model_name.human}"
19
+ @record = @model.new(params[param])
20
+ if @record.save
21
+ redirect_with_flash(index_path, :success, t('flash.success.add'), params)
22
+ else
23
+ flash_errors @record
24
+ render :form
25
+ end
26
+ end
27
+
28
+ def show
29
+ @meta_title = @title = "#{t('global.view')} #{@model.model_name.human}"
30
+ @record = @model.find(params[:id])
31
+ render :form
32
+ end
33
+
34
+ def update
35
+ @meta_title = @title = "#{t('global.view')} #{@model.model_name.human}"
36
+ @record = @model.find(params[:id])
37
+ if @record.update_attributes(params[param])
38
+ redirect_with_flash index_path, :success, t('flash.success.edit'), params
39
+ else
40
+ flash_errors @record
41
+ render :form
42
+ end
43
+ end
44
+
45
+ def destroy
46
+ @model.destroy params[:id]
47
+ redirect_with_flash index_path, :success, t('flash.success.delete')
48
+ end
49
+
50
+ protected
51
+
52
+ def model
53
+ @model = Object.const_get self.class.name.split('::').last.gsub('Controller', '').singularize
54
+ end
55
+
56
+ def index_path
57
+ send "dash_#{@model.name.tableize}_path"
58
+ end
59
+
60
+ def param
61
+ @model.name.underscore.to_sym
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,8 @@
1
+ module RailsDash
2
+ class StaticsController < ::DashController
3
+
4
+ def home
5
+ end
6
+
7
+ end
8
+ end
File without changes
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ RailsDash::Engine.routes.draw do
2
+
3
+ root :to => 'statics#home'
4
+
5
+ end
@@ -0,0 +1,15 @@
1
+ module Dash
2
+ class InstallGenerator < Rails::Generators::Base
3
+
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def install
7
+ route "mount RailsDash::Engine => '/dash'"
8
+ template 'dash.erb', 'app/controllers/dash_controller.rb'
9
+ template 'layout.erb', 'app/views/layouts/dash.html.haml'
10
+ template 'filter.erb', 'app/views/dash/shared/_filter.html.haml'
11
+ template 'pager.erb', 'app/views/dash/shared/_pager.html.haml'
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module Dash
2
+ class ResourceGenerator < Rails::Generators::NamedBase
3
+
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def add_route
7
+ route "namespace :dash do resources :#{table_name} end"
8
+ end
9
+
10
+ def create_templates
11
+ template 'resource.erb', "app/controllers/dash/#{table_name}_controller.rb"
12
+ template 'form.erb', "app/views/dash/#{table_name}/form.html.haml"
13
+ template 'index.erb', "app/views/dash/#{table_name}/index.html.haml"
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ class DashController < RailsDash::BaseController
2
+
3
+ before_filter :authorize
4
+
5
+ protected
6
+
7
+ def authorize
8
+ end
9
+
10
+ end
@@ -0,0 +1,5 @@
1
+ #options
2
+ = form_tag request.fullpath, :method => 'get', :id => 'search' do
3
+ = text_field_tag :q, (params[:q].present? ? params[:q] : t('layouts.dash.options.search_text')), :onblur => "if (this.value == '') {this.value = '#{t('layouts.dash.options.search_text')}';}", :onfocus => "if (this.value == '#{t('layouts.dash.options.search_text')}') {this.value = '';}"
4
+ %a.button.action{ :href => url_for([:new, :dash, @model.name.underscore.to_sym]) }
5
+ = t('global.add')
@@ -0,0 +1,4 @@
1
+ = form_for [:dash, @record] do |f|
2
+ %ul
3
+ %li.actions
4
+ = f.submit
@@ -0,0 +1,19 @@
1
+ = render :partial => 'dash/shared/filter'
2
+ %table{ :cellpadding => '0', :cellspacing => '0' }
3
+ %tr
4
+ %th
5
+ = '#'
6
+ %th
7
+ = @model.human_attribute_name('created_at')
8
+ %th.actions
9
+ = t('global.actions')
10
+ - @records.each do |record|
11
+ %tr
12
+ %td
13
+ = record.id
14
+ %td
15
+ = l(record.created_at)
16
+ %td.actions
17
+ = link_to(t('global.edit'), [:dash, record])
18
+ = link_to(t('global.destroy'), [:dash, record], :method => :delete)
19
+ = render :partial => 'dash/shared/pager', :locals => { :collection => @records }
@@ -0,0 +1,40 @@
1
+ !!! Strict
2
+ %html{:xmlns => 'http://www.w3.org/1999/xhtml', :'xml:lang' => I18n.locale, :lang => I18n.locale}
3
+ %head
4
+ %title= @meta_title
5
+ = stylesheet_link_tag 'rails_dash/application', :media => 'all'
6
+ = javascript_include_tag 'application'
7
+ = csrf_meta_tags
8
+ %body
9
+ #page
10
+ #navigation
11
+ .holder
12
+ #menu
13
+ %ul
14
+ %li
15
+ %a{ :href => rails_dash.root_path, :title => t('layouts.dash.menu.home') }
16
+ = t('layouts.dash.menu.home')
17
+ #session
18
+ %a.button{ :href => '#', :title => t('layouts.dash.session.logout') }
19
+ = t('layouts.dash.session.logout')
20
+ - if @title
21
+ #header
22
+ .holder
23
+ %h1
24
+ = @title
25
+ - if not flash.empty? and ((flash.key?(:error) and flash[:error].any?) or (flash.key?(:success) and flash[:success].any?))
26
+ #flash.flash.holder
27
+ - if flash.key?(:error) and flash[:error].any?
28
+ - while flash[:error].any?
29
+ %p.error
30
+ = flash[:error].shift.capitalize
31
+ - if flash.key?(:success) and flash[:success].any?
32
+ - while flash[:success].any?
33
+ %p.success
34
+ = flash[:success].shift.capitalize
35
+ #content.holder
36
+ = yield
37
+ #footer
38
+ .holder
39
+ %p#copyright
40
+ = t('layouts.dash.footer.copyright', :year => @year)