vision 0.0.1.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +5 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/images/vision/sort-arrows-down.png +0 -0
  5. data/app/assets/images/vision/sort-arrows-up.png +0 -0
  6. data/app/assets/javascripts/redactor-rails/config.js +16 -0
  7. data/app/assets/javascripts/redactor-rails/ru.js +69 -0
  8. data/app/assets/javascripts/vision/application.js +18 -0
  9. data/app/assets/stylesheets/vision/admin.css.less +0 -0
  10. data/app/assets/stylesheets/vision/application.css +24 -0
  11. data/app/assets/stylesheets/vision/bootstrap_and_overrides.css.less +63 -0
  12. data/app/assets/stylesheets/vision/bootstrap_theme/bootstrap-responsive.min.css.less +9 -0
  13. data/app/assets/stylesheets/vision/bootstrap_theme/bootstrap.css.less +5616 -0
  14. data/app/assets/stylesheets/vision/bootstrap_theme/bootswatch.css.less +412 -0
  15. data/app/assets/stylesheets/vision/bootstrap_theme/variables.less +301 -0
  16. data/app/controllers/redactor_rails/pictures_controller.rb +22 -0
  17. data/app/controllers/vision/application_controller.rb +9 -0
  18. data/app/controllers/vision/resource_controller.rb +57 -0
  19. data/app/controllers/vision/responder.rb +4 -0
  20. data/app/helpers/vision/application_helper.rb +42 -0
  21. data/app/helpers/vision/application_helper.rb~ +8 -0
  22. data/app/helpers/vision/resource_helper.rb +10 -0
  23. data/app/helpers/vision/resource_helper.rb~ +10 -0
  24. data/app/models/ability.rb +7 -0
  25. data/app/models/redactor_rails/asset.rb +6 -0
  26. data/app/models/redactor_rails/picture.rb +7 -0
  27. data/app/uploaders/redactor_rails_picture_uploader.rb +53 -0
  28. data/app/views/layouts/vision/application.html.haml +25 -0
  29. data/app/views/shared/_pagination.html.haml +2 -0
  30. data/app/views/vision/application/_user_bar.html.haml +8 -0
  31. data/app/views/vision/resource/_form.html.haml +6 -0
  32. data/app/views/vision/resource/_index.html.haml +16 -0
  33. data/app/views/vision/resource/_search.html.haml +4 -0
  34. data/app/views/vision/resource/edit.html.haml +9 -0
  35. data/app/views/vision/resource/index.html.haml +9 -0
  36. data/app/views/vision/resource/new.html.haml +5 -0
  37. data/app/views/vision/resource/show.html.haml +10 -0
  38. data/config/initializers/simple_form.rb +142 -0
  39. data/config/initializers/simple_form_bootstrap.rb +45 -0
  40. data/config/routes.rb +3 -0
  41. data/lib/generators/install_generator.rb~ +7 -0
  42. data/lib/generators/templates/resource/_form.html.haml +6 -0
  43. data/lib/generators/templates/resource/_index.html.haml +16 -0
  44. data/lib/generators/templates/resource/_search.html.haml +4 -0
  45. data/lib/generators/templates/resource/edit.html.haml +9 -0
  46. data/lib/generators/templates/resource/index.html.haml +9 -0
  47. data/lib/generators/templates/resource/new.html.haml +5 -0
  48. data/lib/generators/templates/resource/show.html.haml +10 -0
  49. data/lib/generators/templates/resource_controller.rb.erb +12 -0
  50. data/lib/generators/templates/vision.rb +2 -0
  51. data/lib/generators/templates/vision_navigation.rb +13 -0
  52. data/lib/generators/vision/install_generator.rb +21 -0
  53. data/lib/generators/vision/install_generator.rb~ +6 -0
  54. data/lib/generators/vision/resource_generator.rb +22 -0
  55. data/lib/generators/vision/views_generator.rb +12 -0
  56. data/lib/tasks/vision_tasks.rake +4 -0
  57. data/lib/vision.rb +33 -0
  58. data/lib/vision/engine.rb +4 -0
  59. data/lib/vision/engine.rb~ +5 -0
  60. data/lib/vision/version.rb +3 -0
  61. data/test/dummy/README.rdoc +261 -0
  62. data/test/dummy/Rakefile +7 -0
  63. data/test/dummy/app/assets/javascripts/application.js +15 -0
  64. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  65. data/test/dummy/app/controllers/application_controller.rb +3 -0
  66. data/test/dummy/app/controllers/vision/users_controller.rb +12 -0
  67. data/test/dummy/app/helpers/application_helper.rb +2 -0
  68. data/test/dummy/app/models/user.rb +11 -0
  69. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  70. data/test/dummy/config.ru +4 -0
  71. data/test/dummy/config/application.rb +59 -0
  72. data/test/dummy/config/boot.rb +10 -0
  73. data/test/dummy/config/database.yml +25 -0
  74. data/test/dummy/config/environment.rb +5 -0
  75. data/test/dummy/config/environments/development.rb +37 -0
  76. data/test/dummy/config/environments/production.rb +67 -0
  77. data/test/dummy/config/environments/test.rb +37 -0
  78. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  79. data/test/dummy/config/initializers/devise.rb +240 -0
  80. data/test/dummy/config/initializers/inflections.rb +15 -0
  81. data/test/dummy/config/initializers/mime_types.rb +5 -0
  82. data/test/dummy/config/initializers/secret_token.rb +7 -0
  83. data/test/dummy/config/initializers/session_store.rb +8 -0
  84. data/test/dummy/config/initializers/vision.rb +2 -0
  85. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  86. data/test/dummy/config/locales/devise.en.yml +59 -0
  87. data/test/dummy/config/locales/en.yml +5 -0
  88. data/test/dummy/config/routes.rb +66 -0
  89. data/test/dummy/config/vision_navigation.rb +13 -0
  90. data/test/dummy/db/development.sqlite3 +0 -0
  91. data/test/dummy/db/migrate/20130211073237_devise_create_users.rb +46 -0
  92. data/test/dummy/db/schema.rb +34 -0
  93. data/test/dummy/db/test.sqlite3 +0 -0
  94. data/test/dummy/log/development.log +1544 -0
  95. data/test/dummy/public/404.html +26 -0
  96. data/test/dummy/public/422.html +26 -0
  97. data/test/dummy/public/500.html +25 -0
  98. data/test/dummy/public/favicon.ico +0 -0
  99. data/test/dummy/script/rails +6 -0
  100. data/test/dummy/test/fixtures/users.yml +11 -0
  101. data/test/dummy/test/unit/user_test.rb +7 -0
  102. data/test/dummy/tmp/cache/assets/BFD/BE0/sprockets%2F7750d34d5ab84713536684084175b777 +0 -0
  103. data/test/dummy/tmp/cache/assets/C0D/930/sprockets%2F57ada54e11211525881db12657063262 +0 -0
  104. data/test/dummy/tmp/cache/assets/C22/760/sprockets%2F01391319c77618e63259d5172da3c087 +0 -0
  105. data/test/dummy/tmp/cache/assets/C61/E30/sprockets%2F7cc7480787c36cb33f8958a018908621 +0 -0
  106. data/test/dummy/tmp/cache/assets/C64/2A0/sprockets%2F134c13b9bd41169120f00f41d229a058 +0 -0
  107. data/test/dummy/tmp/cache/assets/C83/BE0/sprockets%2F07d225b2971966fcc599b7001056e44d +0 -0
  108. data/test/dummy/tmp/cache/assets/CAB/EE0/sprockets%2F93064e70efa31924ce83d518222ba718 +0 -0
  109. data/test/dummy/tmp/cache/assets/CB8/880/sprockets%2F870390941fc4f61d24bc06c257f58a78 +0 -0
  110. data/test/dummy/tmp/cache/assets/CC5/DB0/sprockets%2F185b16e33c6e5952c63fe56e65d80787 +0 -0
  111. data/test/dummy/tmp/cache/assets/CCF/C50/sprockets%2F235f6e18294ffe4e969e1852c84f0893 +0 -0
  112. data/test/dummy/tmp/cache/assets/CD1/B10/sprockets%2F26e034c4229e35b5280e372090ca7acf +0 -0
  113. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  114. data/test/dummy/tmp/cache/assets/CDE/F80/sprockets%2Fab0f6cb3198d15258990f645d46b161a +0 -0
  115. data/test/dummy/tmp/cache/assets/CE0/200/sprockets%2Fa9c2101de170df66d9c80861d89042d6 +0 -0
  116. data/test/dummy/tmp/cache/assets/CE3/4D0/sprockets%2F6381f9fd192014c42dfc274e83c9a650 +0 -0
  117. data/test/dummy/tmp/cache/assets/CEA/6B0/sprockets%2F575d96d2842a1d2deec19fe881033089 +0 -0
  118. data/test/dummy/tmp/cache/assets/CEE/180/sprockets%2Fc5ce9c764b20d7176d70584d76a764e4 +0 -0
  119. data/test/dummy/tmp/cache/assets/CF2/540/sprockets%2F5c1c7a9d6a79855f609fae58f5505513 +0 -0
  120. data/test/dummy/tmp/cache/assets/CF9/8B0/sprockets%2F6580899d8cc41372d92d8a5e8ab78c73 +0 -0
  121. data/test/dummy/tmp/cache/assets/CFB/640/sprockets%2F2a4d6aba04a724d2792087832bd3a0b8 +0 -0
  122. data/test/dummy/tmp/cache/assets/D01/870/sprockets%2F975c929398c5770978a8eb96aac660af +0 -0
  123. data/test/dummy/tmp/cache/assets/D02/B10/sprockets%2F33f4d4d4552a4ae5b172b26c0716c39d +0 -0
  124. data/test/dummy/tmp/cache/assets/D08/980/sprockets%2Fb70493dfb381aae06c270b4965b451f6 +0 -0
  125. data/test/dummy/tmp/cache/assets/D08/9E0/sprockets%2Fbd1b5d382eb7585ef2311f0e8a144185 +0 -0
  126. data/test/dummy/tmp/cache/assets/D12/C80/sprockets%2F6ad24bf08272a07cdd957e174b964b73 +0 -0
  127. data/test/dummy/tmp/cache/assets/D1B/3E0/sprockets%2F77c391e536f4b5060992b74d7fbebc09 +0 -0
  128. data/test/dummy/tmp/cache/assets/D1E/250/sprockets%2Ff976c60140c7662f9d86d9b3048c5dda +0 -0
  129. data/test/dummy/tmp/cache/assets/D21/D90/sprockets%2F976738f91218aa8bfc0e679cf3f3f061 +0 -0
  130. data/test/dummy/tmp/cache/assets/D26/3A0/sprockets%2F89ad96fb04e98d506546aed21b918d79 +0 -0
  131. data/test/dummy/tmp/cache/assets/D30/9A0/sprockets%2F7f9ae14760822ff7b8978a67d6fe36e4 +0 -0
  132. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  133. data/test/dummy/tmp/cache/assets/D3B/5C0/sprockets%2F40ae394bdc18dce154393aed80a27576 +0 -0
  134. data/test/dummy/tmp/cache/assets/D3F/5B0/sprockets%2F6557d14727823bddeba2822eb4fcc951 +0 -0
  135. data/test/dummy/tmp/cache/assets/D45/5A0/sprockets%2Fed747866979a368aef7d8fee884b2789 +0 -0
  136. data/test/dummy/tmp/cache/assets/D4A/880/sprockets%2Fcc23ed71c73788a938e1357d11ca78ef +0 -0
  137. data/test/dummy/tmp/cache/assets/D4D/EF0/sprockets%2F05a24a46916881e9d38ee2e0c8d9f5fb +0 -0
  138. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  139. data/test/dummy/tmp/cache/assets/D50/730/sprockets%2F084ff5f6ea3f368a543911339e9dfe2e +0 -0
  140. data/test/dummy/tmp/cache/assets/D55/740/sprockets%2F6bfb0414e9f0de2e909917674dbe9f95 +0 -0
  141. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  142. data/test/dummy/tmp/cache/assets/D60/8A0/sprockets%2F1aaf8a80a707722d04cd8e53a971b1be +0 -0
  143. data/test/dummy/tmp/cache/assets/D69/DB0/sprockets%2F217c932a66b36e34ed25ced07f9e0be0 +0 -0
  144. data/test/dummy/tmp/cache/assets/D71/370/sprockets%2F19dac330438dea0771e8395b86eddf1c +0 -0
  145. data/test/dummy/tmp/cache/assets/D94/4C0/sprockets%2Fabaa1497cede72926b760ddef110144f +0 -0
  146. data/test/dummy/tmp/cache/assets/DA0/280/sprockets%2Fe2a91fe4ce8ef0c54b515145f44dde82 +0 -0
  147. data/test/dummy/tmp/cache/assets/DA8/F80/sprockets%2F97cf03aa7e0ff76969bab9206da267cd +0 -0
  148. data/test/dummy/tmp/cache/assets/DAC/2F0/sprockets%2Fc630da1a0c4bb5a2529e034ba2c7cdb6 +0 -0
  149. data/test/dummy/tmp/cache/assets/DB3/3A0/sprockets%2F6fce069886bdd665c59c2455edf01efd +0 -0
  150. data/test/dummy/tmp/cache/assets/DBB/030/sprockets%2F3ad40a6ab1a1bd6a4b0efee48168c367 +0 -0
  151. data/test/dummy/tmp/cache/assets/DBC/510/sprockets%2Fc49b6ed55fefd850e586e0f77ac958a7 +0 -0
  152. data/test/dummy/tmp/cache/assets/DCF/000/sprockets%2Fd0dfcf6a2f21043e23cf879aa9b81d9e +0 -0
  153. data/test/dummy/tmp/cache/assets/DCF/EE0/sprockets%2Fb4b66c49e5d32ce05fff1ff1397a50db +0 -0
  154. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  155. data/test/dummy/tmp/cache/assets/DE1/6C0/sprockets%2F6cd864830694d6acbef4f69cd0c88dae +0 -0
  156. data/test/dummy/tmp/cache/assets/DEE/430/sprockets%2Fdfcd51eae6f3a2a51c058c27ee0d750a +0 -0
  157. data/test/dummy/tmp/cache/assets/E02/F00/sprockets%2Fa5845e8c36cf9e160fccfadf0a2db837 +0 -0
  158. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  159. data/test/dummy/tmp/cache/assets/E09/6D0/sprockets%2Fcbdb4fef8b144c0fd37dc8ad96926e64 +0 -0
  160. data/test/dummy/tmp/cache/assets/E0A/210/sprockets%2F05aadb4dc0b849fe9c3dd7788f28c5eb +0 -0
  161. data/test/dummy/tmp/cache/assets/E17/BC0/sprockets%2Ff206319de0be2dd9adcaaa314ecf132f +0 -0
  162. data/test/dummy/tmp/cache/assets/E1A/BD0/sprockets%2F5baeff0d2da03cd0e93a561e71b5aac9 +0 -0
  163. data/test/dummy/tmp/cache/assets/E2D/070/sprockets%2Fc4744f83de73cd2bbd645dabffd16b4c +0 -0
  164. data/test/dummy/tmp/cache/assets/E30/850/sprockets%2Fb6e723da1e4c9dab751ccd5ec295a9fe +0 -0
  165. data/test/integration/navigation_test.rb +10 -0
  166. data/test/test_helper.rb +15 -0
  167. data/test/vision_test.rb +7 -0
  168. metadata +658 -0
@@ -0,0 +1,45 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
4
+ b.use :html5
5
+ b.use :placeholder
6
+ b.use :label
7
+ b.wrapper :tag => 'div', :class => 'controls' do |ba|
8
+ ba.use :input
9
+ ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
10
+ ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
11
+ end
12
+ end
13
+
14
+ config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
15
+ b.use :html5
16
+ b.use :placeholder
17
+ b.use :label
18
+ b.wrapper :tag => 'div', :class => 'controls' do |input|
19
+ input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
20
+ prepend.use :input
21
+ end
22
+ input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
23
+ input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
24
+ end
25
+ end
26
+
27
+ config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
28
+ b.use :html5
29
+ b.use :placeholder
30
+ b.use :label
31
+ b.wrapper :tag => 'div', :class => 'controls' do |input|
32
+ input.wrapper :tag => 'div', :class => 'input-append' do |append|
33
+ append.use :input
34
+ end
35
+ input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
36
+ input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
37
+ end
38
+ end
39
+
40
+ # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
41
+ # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
42
+ # to learn about the different styles for forms and inputs,
43
+ # buttons and other elements.
44
+ config.default_wrapper = :bootstrap
45
+ end
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+
3
+ end
@@ -0,0 +1,7 @@
1
+ class InstallGenerator < Rails::Generators::Base
2
+ source_root File.expand_path("../templates", __FILE__)
3
+
4
+ def install
5
+ copy_file "vision_navigation.rb", "config/templates/vision_navigation.rb"
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ = simple_form_for [:vision, resource], :html=>{:class=>"form form-horizontal"} do |f|
2
+ - (form_attributes-association_attributes).each do |attr|
3
+ = f.input attr.to_sym, :input_html=>{:class=>"input-xxlarge"}
4
+ - associations(:belongs_to).each do |assoc|
5
+ = f.association assoc.name.to_sym
6
+ = f.submit :class=>"btn btn-success"
@@ -0,0 +1,16 @@
1
+ %table.table.table-striped
2
+ %thead
3
+ %tr
4
+ - attributes.each do |attr|
5
+ %th= sortable attr, resource_class.human_attribute_name(attr)
6
+ %tbody
7
+ - collection.each do |resource|
8
+ %tr
9
+ - attributes.each do |attr|
10
+ %td
11
+ = resource.public_send(attr).to_s.truncate(20)
12
+ %td
13
+ .btn-group
14
+ = link_to t(:show), resource_path(resource), :class=>"btn btn-action"
15
+ = link_to t(:edit), edit_resource_path(resource),:class=>"btn btn-warning"
16
+ = link_to( t(:delete), resource_path(resource),:method => :delete, :confirm =>"This action is irreversible!",:class=>"btn btn-danger" )
@@ -0,0 +1,4 @@
1
+ = form_tag collection_path, :method => 'get', :id => "text_search", :html=>{:class=>"form-search"} do
2
+ = text_field_tag :q, params[:q], :class=>"input-xxlarge search-query"
3
+ = hidden_field_tag :direction, params[:direction]
4
+ = hidden_field_tag :sort, params[:sort]
@@ -0,0 +1,9 @@
1
+ %h2
2
+ = "Edit #{resource_class.model_name.human}"
3
+ .from
4
+ = render "form"
5
+ %br/
6
+ .btn-group
7
+ = link_to t(:show), resource_path(resource), :class=>"btn btn-action"
8
+ = link_to t(:back), collection_path, :class=>"btn btn-warning"
9
+
@@ -0,0 +1,9 @@
1
+ .row
2
+ .span1
3
+ = link_to t(:new), new_resource_path, class: "btn btn-success"
4
+ .span9
5
+ = render :partial => "search" if searchable?
6
+ .row
7
+ = render :partial => "index"
8
+ .row
9
+ = paginate collection, :theme => 'twitter-bootstrap'
@@ -0,0 +1,5 @@
1
+ %h2
2
+ = "New #{resource_class.model_name.human}"
3
+ = render :partial => "form"
4
+ %br/
5
+ = link_to t(:back), collection_path
@@ -0,0 +1,10 @@
1
+ %div
2
+ %dl.dl-horizontal
3
+ - attributes.each do |attr|
4
+ %dt
5
+ = resource_class.human_attribute_name(attr)
6
+ %dd
7
+ = resource.public_send(attr) || "none"
8
+ .btn-group
9
+ = link_to t(:back), collection_path, :class=>"btn btn-action"
10
+ = link_to t(:edit), edit_resource_path(resource), :class=>"btn btn-warning"
@@ -0,0 +1,12 @@
1
+ class Vision::<%= resource_name.classify.pluralize %>Controller < Vision::ResourceController
2
+
3
+ private
4
+ #DEFINE INPUT AND OUTPUT attributes!
5
+ #def attributes
6
+ # resource_class.attribute_names & form_attributes
7
+ #end
8
+ #
9
+ #def form_attributes
10
+ # %w(email password password_confirmation)
11
+ #end
12
+ end
@@ -0,0 +1,2 @@
1
+ #You can change whatever you like
2
+ #Vision.title= "My App Dashboard"
@@ -0,0 +1,13 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Configures your navigation
3
+ SimpleNavigation::Configuration.run do |navigation|
4
+ navigation.selected_class = 'active'
5
+
6
+ navigation.items do |primary|
7
+ primary.dom_class = 'nav nav-pills nav-stacked bs-docs-sidenav'
8
+
9
+ primary.item :home, 'Home', vision_root_path
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,21 @@
1
+ module Vision
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../../templates', __FILE__)
5
+ argument :vision_path, :type => :string, :default=>'vision'
6
+ desc 'Creates a vision_navigation configuration'
7
+ def copy_config_files
8
+ copy_file 'vision_navigation.rb', 'config/vision_navigation.rb'
9
+ end
10
+
11
+ def add_route_to_vision_namespace
12
+ inject_into_file 'config/routes.rb', " namespace :vision, {:path=>'#{vision_path}'} do\n # vision routes\n end\n", after: "::Application.routes.draw do\n"
13
+ end
14
+
15
+ def copy_initializer
16
+ copy_file 'vision.rb', 'config/initializers/vision.rb'
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ class Vision::InstallGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+ def copy_config_files
4
+ copy_file 'vision_navigation.rb', 'config/vision_navigation.rb'
5
+ end
6
+ end
@@ -0,0 +1,22 @@
1
+ module Vision
2
+ module Generators
3
+ class ResourceGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+ argument :resource_name, :type => :string
6
+ desc "Creates a vision resource_controller"
7
+
8
+ def create_resource_controller
9
+ template 'resource_controller.rb.erb', "app/controllers/vision/#{resource_name.tableize}_controller.rb"
10
+ end
11
+
12
+ def add_route_to_vision_namespace
13
+ inject_into_file 'config/routes.rb', "resources :#{resource_name.tableize}\n",after: "# vision routes\n"
14
+ end
15
+
16
+ def add_menu_item
17
+ inject_into_file 'config/vision_navigation.rb', "\nprimary.item :#{resource_name}, '#{resource_name}', vision_#{resource_name.tableize}_path\n", after:"navigation.items do |primary|\n"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ module Vision
2
+ module Generators
3
+ class ViewsGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+ argument :resource_name, :type => :string
6
+ desc "Creates a vision resource_controller"
7
+ def copy_view_files
8
+ directory 'resource', "app/views/vision/#{resource_name.tableize}"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :vision do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,33 @@
1
+ require "vision/engine"
2
+ require 'rails/generators'
3
+
4
+
5
+ #GEMS REQUIRE!
6
+ require 'haml-rails'
7
+
8
+ require 'kaminari'
9
+ require 'bootstrap-kaminari-views'
10
+
11
+ require 'redactor-rails'
12
+ require 'carrierwave'
13
+ require 'mini_magick'
14
+
15
+ require 'simple_form'
16
+ require 'simple_form_fancy_uploads'
17
+ require 'simple-navigation'
18
+ #SimpleNavigation::config_file_paths << File.expand_path("../../config", __FILE__)
19
+ require 'inherited_resources'
20
+ require 'has_scope'
21
+ require 'devise'
22
+ require 'cancan'
23
+ require 'less'
24
+ require 'less-rails'
25
+ require 'twitter-bootstrap-rails'
26
+ require 'uglifier'
27
+ require 'execjs'
28
+
29
+ module Vision
30
+ mattr_accessor :title
31
+ end
32
+
33
+ Vision.title= "Vision Dashboard"
@@ -0,0 +1,4 @@
1
+ module Vision
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module Vision
2
+ class Engine < ::Rails::Engine
3
+ config.generators.templates.unshift File.expand_path("lib/templates", root)
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Vision
2
+ VERSION = "0.0.1.alpha1"
3
+ end
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | |-- images
161
+ | |-- javascripts
162
+ | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | `-- tasks
177
+ |-- log
178
+ |-- public
179
+ |-- script
180
+ |-- test
181
+ | |-- fixtures
182
+ | |-- functional
183
+ | |-- integration
184
+ | |-- performance
185
+ | `-- unit
186
+ |-- tmp
187
+ | |-- cache
188
+ | |-- pids
189
+ | |-- sessions
190
+ | `-- sockets
191
+ `-- vendor
192
+ |-- assets
193
+ `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.