wheels 0.1.8 → 0.1.9

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 (243) hide show
  1. data/Gemfile +20 -0
  2. data/VERSION +1 -1
  3. data/app/controllers/app_configs_controller.rb +12 -0
  4. data/app/controllers/application_controller.rb +39 -0
  5. data/app/helpers/application_helper.rb +24 -2
  6. data/app/models/sitemap.rb +7 -0
  7. data/app/views/app_configs/css.css.haml +2 -0
  8. data/app/views/layouts/application.html.haml +21 -15
  9. data/app/views/pages/_form_fields.html.haml +2 -0
  10. data/app/views/sitemaps/index.html.haml +68 -76
  11. data/db/migrate/0000_devise_create_users.rb +26 -0
  12. data/db/migrate/0180_acts_as_taggable_on_migration.rb +28 -0
  13. data/lib/generators/app_layout/app_layout_generator.rb +1 -1
  14. data/lib/generators/{wheels/core_extensions.rb → core_extensions.rb} +42 -1
  15. data/lib/generators/recipes/wheels.rb +46 -0
  16. data/lib/generators/recipes/wheels_update.rb +18 -0
  17. data/lib/generators/wheels/wheels_generator.rb +3 -1
  18. data/lib/generators/wheels_checkout_assets/USAGE +8 -0
  19. data/lib/generators/wheels_checkout_assets/wheels_checkout_assets_generator.rb +9 -0
  20. data/lib/generators/wheels_checkout_assets_readonly/USAGE +8 -0
  21. data/lib/generators/wheels_checkout_assets_readonly/wheels_checkout_assets_readonly_generator.rb +10 -0
  22. data/lib/generators/wheels_controller/USAGE +8 -0
  23. data/lib/generators/wheels_controller/wheels_controller_generator.rb +14 -0
  24. data/lib/generators/{wheels_views → wheels_model}/USAGE +1 -1
  25. data/lib/generators/wheels_model/wheels_model_generator.rb +14 -0
  26. data/lib/generators/{update_wheels/update_wheels_generator.rb → wheels_update/wheels_update_generator.rb} +7 -13
  27. data/lib/generators/wheels_view/USAGE +8 -0
  28. data/lib/generators/wheels_view/wheels_view_generator.rb +14 -0
  29. data/lib/wheels/routes.rb +7 -1
  30. data/wheels.gemspec +44 -218
  31. metadata +44 -218
  32. data/lib/generators/app_layout/core_extensions.rb +0 -51
  33. data/lib/generators/update_wheels/core_extensions.rb +0 -51
  34. data/lib/generators/update_wheels/recipes/wheels.rb +0 -11
  35. data/lib/generators/update_wheels/templates/haml/app/views/layouts/application.html.haml +0 -9
  36. data/lib/generators/wheels/install_generator.rb +0 -25
  37. data/lib/generators/wheels/recipes/wheels.rb +0 -66
  38. data/lib/generators/wheels/templates/cancan/ability.rb +0 -13
  39. data/lib/generators/wheels/templates/database/postgresql.yml +0 -19
  40. data/lib/generators/wheels/templates/git/gitignore +0 -8
  41. data/lib/generators/wheels/templates/mongoid/features/step_definitions/mongoid_steps.rb +0 -4
  42. data/lib/generators/wheels/templates/mongoid/features/support/hooks.rb +0 -3
  43. data/lib/generators/wheels/views_generator.rb +0 -15
  44. data/lib/generators/wheels_views/LICENCE +0 -20
  45. data/lib/generators/wheels_views/wheels_views_generator.rb +0 -15
  46. data/lib/wheels/base.rb +0 -7
  47. data/public/404.html +0 -26
  48. data/public/422.html +0 -26
  49. data/public/500.html +0 -26
  50. data/public/favicon.ico +0 -0
  51. data/public/images/dreamy/Thumbs.db +0 -0
  52. data/public/images/dreamy/bg-ad-top.png +0 -0
  53. data/public/images/dreamy/bg-body.png +0 -0
  54. data/public/images/dreamy/bg-feed.gif +0 -0
  55. data/public/images/dreamy/bg-footer.jpg +0 -0
  56. data/public/images/dreamy/bg-header.jpg +0 -0
  57. data/public/images/dreamy/bg-menu-hover.png +0 -0
  58. data/public/images/dreamy/bg-menu.png +0 -0
  59. data/public/images/dreamy/bg-sidebar-bottom.gif +0 -0
  60. data/public/images/dreamy/button-feed.png +0 -0
  61. data/public/images/dreamy/icon-comment.png +0 -0
  62. data/public/images/growl/error.png +0 -0
  63. data/public/images/growl/growl_bottom.png +0 -0
  64. data/public/images/growl/growl_repeat.png +0 -0
  65. data/public/images/growl/growl_top.png +0 -0
  66. data/public/images/growl/info.png +0 -0
  67. data/public/images/menu/item-pointer-mover.gif +0 -0
  68. data/public/images/menu/item-pointer.gif +0 -0
  69. data/public/images/menu/lava.gif +0 -0
  70. data/public/images/menu/lava.png +0 -0
  71. data/public/images/menu/main-bg.png +0 -0
  72. data/public/images/menu/main-delimiter.png +0 -0
  73. data/public/javascripts/galleries/configure_ckeditor.js +0 -8
  74. data/public/javascripts/jqUrl.js +0 -28
  75. data/public/javascripts/jquery-validate/additional-methods.js +0 -259
  76. data/public/javascripts/jquery-validate/changelog.txt +0 -239
  77. data/public/javascripts/jquery-validate/jquery.validate.js +0 -1146
  78. data/public/javascripts/jquery-validate/jquery.validate.min.js +0 -16
  79. data/public/javascripts/jquery-validate/jquery.validate.pack.js +0 -15
  80. data/public/javascripts/jquery-validate/lib/jquery-1.4.2.js +0 -6240
  81. data/public/javascripts/jquery-validate/lib/jquery.form.js +0 -660
  82. data/public/javascripts/jquery-validate/lib/jquery.js +0 -4376
  83. data/public/javascripts/jquery-validate/lib/jquery.metadata.js +0 -122
  84. data/public/javascripts/jquery-validate/localization/messages_ar.js +0 -24
  85. data/public/javascripts/jquery-validate/localization/messages_bg.js +0 -23
  86. data/public/javascripts/jquery-validate/localization/messages_cn.js +0 -23
  87. data/public/javascripts/jquery-validate/localization/messages_cs.js +0 -23
  88. data/public/javascripts/jquery-validate/localization/messages_da.js +0 -20
  89. data/public/javascripts/jquery-validate/localization/messages_de.js +0 -20
  90. data/public/javascripts/jquery-validate/localization/messages_el.js +0 -24
  91. data/public/javascripts/jquery-validate/localization/messages_es.js +0 -23
  92. data/public/javascripts/jquery-validate/localization/messages_fa.js +0 -23
  93. data/public/javascripts/jquery-validate/localization/messages_fi.js +0 -21
  94. data/public/javascripts/jquery-validate/localization/messages_fr.js +0 -23
  95. data/public/javascripts/jquery-validate/localization/messages_he.js +0 -23
  96. data/public/javascripts/jquery-validate/localization/messages_hu.js +0 -20
  97. data/public/javascripts/jquery-validate/localization/messages_it.js +0 -23
  98. data/public/javascripts/jquery-validate/localization/messages_kk.js +0 -23
  99. data/public/javascripts/jquery-validate/localization/messages_lt.js +0 -23
  100. data/public/javascripts/jquery-validate/localization/messages_lv.js +0 -23
  101. data/public/javascripts/jquery-validate/localization/messages_nl.js +0 -23
  102. data/public/javascripts/jquery-validate/localization/messages_no.js +0 -23
  103. data/public/javascripts/jquery-validate/localization/messages_pl.js +0 -23
  104. data/public/javascripts/jquery-validate/localization/messages_ptbr.js +0 -23
  105. data/public/javascripts/jquery-validate/localization/messages_ptpt.js +0 -23
  106. data/public/javascripts/jquery-validate/localization/messages_ro.js +0 -23
  107. data/public/javascripts/jquery-validate/localization/messages_ru.js +0 -23
  108. data/public/javascripts/jquery-validate/localization/messages_se.js +0 -21
  109. data/public/javascripts/jquery-validate/localization/messages_sk.js +0 -20
  110. data/public/javascripts/jquery-validate/localization/messages_tr.js +0 -23
  111. data/public/javascripts/jquery-validate/localization/messages_tw.js +0 -23
  112. data/public/javascripts/jquery-validate/localization/messages_ua.js +0 -23
  113. data/public/javascripts/jquery-validate/localization/methods_de.js +0 -12
  114. data/public/javascripts/jquery-validate/localization/methods_nl.js +0 -9
  115. data/public/javascripts/jquery-validate/localization/methods_pt.js +0 -9
  116. data/public/javascripts/jquery-validate/todo +0 -172
  117. data/public/javascripts/jquery.cookie.js +0 -96
  118. data/public/javascripts/jquery.filedrop.js +0 -253
  119. data/public/javascripts/jquery.growl.js +0 -143
  120. data/public/javascripts/jquery.hotkeys.js +0 -99
  121. data/public/javascripts/jquery.js +0 -6240
  122. data/public/javascripts/jquery.jstree.js +0 -3510
  123. data/public/javascripts/jquery.uploadify.js +0 -26
  124. data/public/javascripts/jquery.validate.js +0 -1147
  125. data/public/javascripts/loadbehind.js +0 -0
  126. data/public/javascripts/menu.js +0 -247
  127. data/public/javascripts/sitemap_jstree.js +0 -329
  128. data/public/javascripts/swfobject.js +0 -4
  129. data/public/jstree/_demo/_dump.sql +0 -20
  130. data/public/jstree/_demo/_inc/__mysql_errors.log +0 -0
  131. data/public/jstree/_demo/_inc/class._database.php +0 -146
  132. data/public/jstree/_demo/_inc/class._database_i.php +0 -152
  133. data/public/jstree/_demo/_inc/class.tree.php +0 -602
  134. data/public/jstree/_demo/_install.txt +0 -6
  135. data/public/jstree/_demo/config.php +0 -14
  136. data/public/jstree/_demo/index.html +0 -262
  137. data/public/jstree/_demo/server.php +0 -69
  138. data/public/jstree/_docs/!style.css +0 -37
  139. data/public/jstree/_docs/_drive.png +0 -0
  140. data/public/jstree/_docs/_html_data.html +0 -2
  141. data/public/jstree/_docs/_json_data.json +0 -4
  142. data/public/jstree/_docs/_search_data.json +0 -6
  143. data/public/jstree/_docs/_search_result.json +0 -1
  144. data/public/jstree/_docs/_xml_flat.xml +0 -12
  145. data/public/jstree/_docs/_xml_nest.xml +0 -18
  146. data/public/jstree/_docs/checkbox.html +0 -148
  147. data/public/jstree/_docs/contextmenu.html +0 -120
  148. data/public/jstree/_docs/cookies.html +0 -96
  149. data/public/jstree/_docs/core.html +0 -622
  150. data/public/jstree/_docs/crrm.html +0 -315
  151. data/public/jstree/_docs/dnd.html +0 -197
  152. data/public/jstree/_docs/hotkeys.html +0 -81
  153. data/public/jstree/_docs/html_data.html +0 -174
  154. data/public/jstree/_docs/index.html +0 -75
  155. data/public/jstree/_docs/json_data.html +0 -240
  156. data/public/jstree/_docs/languages.html +0 -138
  157. data/public/jstree/_docs/search.html +0 -114
  158. data/public/jstree/_docs/sort.html +0 -84
  159. data/public/jstree/_docs/syntax/!script.js +0 -2232
  160. data/public/jstree/_docs/syntax/!style.css +0 -511
  161. data/public/jstree/_docs/syntax/clipboard.swf +0 -0
  162. data/public/jstree/_docs/syntax/help.png +0 -0
  163. data/public/jstree/_docs/syntax/magnifier.png +0 -0
  164. data/public/jstree/_docs/syntax/page_white_code.png +0 -0
  165. data/public/jstree/_docs/syntax/page_white_copy.png +0 -0
  166. data/public/jstree/_docs/syntax/printer.png +0 -0
  167. data/public/jstree/_docs/syntax/wrapping.png +0 -0
  168. data/public/jstree/_docs/themeroller.html +0 -98
  169. data/public/jstree/_docs/themes.html +0 -126
  170. data/public/jstree/_docs/types.html +0 -173
  171. data/public/jstree/_docs/ui.html +0 -188
  172. data/public/jstree/_docs/unique.html +0 -70
  173. data/public/jstree/_docs/xml_data.html +0 -214
  174. data/public/jstree/_lib/jquery.cookie.js +0 -96
  175. data/public/jstree/_lib/jquery.hotkeys.js +0 -99
  176. data/public/jstree/_lib/jquery.js +0 -6240
  177. data/public/jstree/jquery.jstree.js +0 -3510
  178. data/public/jstree/jstree.html +0 -237
  179. data/public/jstree/themes/apple/bg.jpg +0 -0
  180. data/public/jstree/themes/apple/d.png +0 -0
  181. data/public/jstree/themes/apple/dot_for_ie.gif +0 -0
  182. data/public/jstree/themes/apple/style.css +0 -60
  183. data/public/jstree/themes/apple/throbber.gif +0 -0
  184. data/public/jstree/themes/classic/d.png +0 -0
  185. data/public/jstree/themes/classic/dot_for_ie.gif +0 -0
  186. data/public/jstree/themes/classic/style.css +0 -59
  187. data/public/jstree/themes/classic/throbber.gif +0 -0
  188. data/public/jstree/themes/default/d.gif +0 -0
  189. data/public/jstree/themes/default/d.png +0 -0
  190. data/public/jstree/themes/default/style.css +0 -73
  191. data/public/jstree/themes/default/throbber.gif +0 -0
  192. data/public/jstree/themes/default-rtl/d.gif +0 -0
  193. data/public/jstree/themes/default-rtl/d.png +0 -0
  194. data/public/jstree/themes/default-rtl/dots.gif +0 -0
  195. data/public/jstree/themes/default-rtl/style.css +0 -83
  196. data/public/jstree/themes/default-rtl/throbber.gif +0 -0
  197. data/public/stylesheets/dreamy.css +0 -183
  198. data/public/stylesheets/menu.css +0 -101
  199. data/public/stylesheets/sass/dreamy.sass +0 -165
  200. data/public/stylesheets/sass/menu.sass +0 -139
  201. data/public/stylesheets/sass/uploadify.sass +0 -52
  202. data/public/stylesheets/sass/wheels.sass +0 -25
  203. data/public/stylesheets/scaffold.css +0 -56
  204. data/public/stylesheets/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
  205. data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  206. data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  207. data/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  208. data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  209. data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  210. data/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  211. data/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  212. data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  213. data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  214. data/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  215. data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  216. data/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  217. data/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  218. data/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  219. data/public/stylesheets/ui-lightness/jquery-ui-1.8.2.custom.css +0 -359
  220. data/public/stylesheets/ui-lightness/jquery-ui-1.8.4.custom.css +0 -549
  221. data/public/test.html +0 -18
  222. /data/lib/generators/{wheels/recipes → recipes}/cancan.rb +0 -0
  223. /data/lib/generators/{wheels/recipes → recipes}/cucumber.rb +0 -0
  224. /data/lib/generators/{wheels/recipes → recipes}/default.rb +0 -0
  225. /data/lib/generators/{wheels/recipes → recipes}/design.rb +0 -0
  226. /data/lib/generators/{wheels/recipes → recipes}/devise.rb +0 -0
  227. /data/lib/generators/{wheels/recipes → recipes}/factory_girl.rb +0 -0
  228. /data/lib/generators/{wheels/recipes → recipes}/haml.rb +0 -0
  229. /data/lib/generators/{wheels/recipes → recipes}/jquery.rb +0 -0
  230. /data/lib/generators/{wheels/recipes → recipes}/mongoid.rb +0 -0
  231. /data/lib/generators/{wheels/recipes → recipes}/postgresql.rb +0 -0
  232. /data/lib/generators/{wheels/recipes → recipes}/recipes.rb +0 -0
  233. /data/lib/generators/{wheels/recipes → recipes}/remarkable.rb +0 -0
  234. /data/lib/generators/{wheels/recipes → recipes}/rspec.rb +0 -0
  235. /data/lib/generators/{wheels/snippets → snippets}/cucumber/database_config +0 -0
  236. /data/lib/generators/{update_wheels/templates → templates}/cancan/ability.rb +0 -0
  237. /data/lib/generators/{update_wheels/templates → templates}/database/postgresql.yml +0 -0
  238. /data/lib/generators/{update_wheels/templates → templates}/git/gitignore +0 -0
  239. /data/lib/generators/{wheels/templates → templates}/haml/app/views/layouts/application.html.haml +0 -0
  240. /data/lib/generators/{update_wheels/templates → templates}/mongoid/features/step_definitions/mongoid_steps.rb +0 -0
  241. /data/lib/generators/{update_wheels/templates → templates}/mongoid/features/support/hooks.rb +0 -0
  242. /data/lib/generators/{update_wheels → wheels_update}/LICENCE +0 -0
  243. /data/lib/generators/{update_wheels → wheels_update}/USAGE +0 -0
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+ gem "rails", "3.0.0" # Blah
3
+ gem "pg"
4
+ gem "haml"
5
+ gem "cancan"
6
+ gem "pg"
7
+ gem "acts-as-taggable-on"
8
+ gem "aws-s3"
9
+ gem "casey_jones", "0.1.0" #, :path=>"/home/tyler/ruby/current/casey_jones"#
10
+ gem "da_huangs_ruby_extensions", "0.0.22" # :path=>"/home/tyler/projects/gems/da_huangs_ruby_extensions"
11
+ gem "devise", "1.1.rc2"
12
+ gem "has_scope"
13
+ gem "inherited_resources", "1.1.2"
14
+ gem "mail"# , "2.1.3"
15
+ gem "paperclip" # paperclip
16
+ gem "rails3-generators"
17
+ gem "RedCloth"
18
+ gem "wheels", "0.1.0" # :path=>"/home/tyler/proj/wheels"
19
+ gem 'will_paginate', "~> 3.0.pre2"
20
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
@@ -1,5 +1,17 @@
1
1
  class AppConfigsController < InheritedResources::Base
2
2
  respond_to :html, :js
3
+ respond_to :css, :only=>:css
3
4
  ajax_loading
5
+
6
+ def css
7
+ @stylesheet = AppConfig["stylesheet"]
8
+ if params[:page_id]
9
+ page = Page.find(params[:page_id])
10
+ @stylesheet += '\n/* Page-level styles' + page.stylesheet
11
+ end
12
+ respond_with @stylesheet do |format|
13
+ format.css{render :layout=>'bare'}
14
+ end
15
+ end
4
16
  end
5
17
 
@@ -0,0 +1,39 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ def include_jqueryui
4
+ content_for :head do
5
+ stylesheet_link_tag("ui-lightness/jquery-ui-1.8.4.custom")
6
+ javascript_include_tag("jquery-ui")
7
+ end
8
+ end
9
+
10
+ load_main_menu
11
+
12
+
13
+ def self.resource_attributes(*parameters)
14
+ for action in [:show, :new, :edit, :create]
15
+ a = "def #{action};" + ([:new, :create].include?(action) ?
16
+ "@#{resource_class.name.underscore} = resource_class.new;" : ""
17
+ ) +
18
+ parameters.map{|p|
19
+ if p.class == Hash
20
+ meth, prm = [p.to_a.flatten[0], p.to_a.flatten[1]]
21
+ else
22
+ meth, prm = [p, p]
23
+ end
24
+ meth = meth.to_s + "="
25
+
26
+ if prm == :current_user
27
+ val = "current_user"
28
+ else
29
+ val = "params[:#{prm}]"
30
+ end
31
+ "resource.send(\"#{meth}\", #{val})"
32
+ }.join(";") +
33
+ ";#{action}!;end;"
34
+ class_eval a
35
+ puts a
36
+ end
37
+ end
38
+ end
39
+
@@ -1,14 +1,36 @@
1
1
  module ApplicationHelper
2
- load_main_menu
3
2
  def menu_node(name, url)
4
3
  content_tag(:li, content_tag(:a, content_tag(:span, name, :class=>name.underscore.gsub(/ /, '_')), :href=>url))
5
4
  end
5
+
6
+ def sidebar_link(name, url, is_title = false)
7
+ _class = name.underscore.gsub(/ /, '_')
8
+ _class += "sidebar_title" if is_title
9
+ content_tag(:li, content_tag(:a, content_tag(:span, name, :class=>name.underscore), :href=>url), :class=>_class)
10
+ end
11
+
12
+ def sidebar_content(&block)
13
+ @sidebar = true
14
+ content_for(:sidebar) do
15
+ block.call
16
+ end
17
+ end
18
+
6
19
  def include_ckeditor
7
20
  content_for :head do
8
21
  javascript_include_tag('/ckeditor/ckeditor.js',
9
22
  '/ckeditor/adapters/jquery.js',
10
- "galleries/configure_ckeditor.js", 'ckeditor_loaded')
23
+ "galleries/configure_ckeditor.js")
11
24
  end
12
25
  end
26
+ def session_key_name
27
+ Rails.application.config.session_options[:key]
28
+ end
29
+ def make_session_string
30
+ arr = []
31
+ request.env['HTTP_COOKIE'].each_char{|c| arr.push(c[0].to_s)}
32
+ arr.join("x")
33
+ end
34
+
13
35
  end
14
36
 
@@ -7,6 +7,13 @@ class Sitemap < ActiveRecord::Base
7
7
  end
8
8
  end
9
9
 
10
+ def self.new_main_menu_page(name)
11
+ Sitemap.create( :parent=>self.main_menu,
12
+ :menu_text=>name,
13
+ :resource=>Page.create(:title=>name),
14
+ :position=>Sitemap.main_menu.children.count)
15
+ end
16
+
10
17
  belongs_to :parent, :class_name=>'Sitemap', :foreign_key=>'parent_id'
11
18
  belongs_to :resource, :polymorphic => true
12
19
  after_create :create_resource
@@ -0,0 +1,2 @@
1
+ = @stylesheet
2
+
@@ -1,13 +1,13 @@
1
1
  !!! 5
2
2
  %html
3
3
  %head
4
- %title CAGYM Web Site
4
+ %title Wheels Test Site
5
5
  = csrf_meta_tag
6
6
  /[if lt IE 9]
7
7
  = javascript_include_tag 'html5'
8
8
  = javascript_include_tag :defaults
9
- = javascript_include_tag *%w(jquery-ui menu application)
10
- = stylesheet_link_tag *%w(menu dreamy cagym ui-lightness/jquery-ui-1.8.4.custom)
9
+ = javascript_include_tag *%w(jquery-ui menu application jquery.growl)
10
+ = stylesheet_link_tag *%w(ui-lightness/jquery-ui-1.8.4.custom)
11
11
  = yield(:head)
12
12
 
13
13
  :javascript
@@ -19,23 +19,29 @@
19
19
  #header
20
20
  #menu
21
21
  %ul.menu
22
- != menu_item "Home", "/pages/Welcome"
23
- != menu_item "About Us", "/pages/About_Us/"
24
- != menu_item "Committees", "/pages/Committees"
25
- != menu_item "Members", "/pages/Members"
26
- != menu_item "Support Forum", "/forums"
27
- != menu_item "Resources", "/pages/Resources"
28
- != menu_item "Contact Us", "/submit_feedback"
29
- #sidebar
30
- %ul
31
- = yield(:links)
32
- = yield(:sidebar)
33
- #sidebar-bottom
22
+ - @menu_items.each do |sitemap_node|
23
+ != menu_node sitemap_node.menu_text, sitemap_node.url
24
+ - if @sitemap && @sitemap.parent != Sitemap.main_menu
25
+ = sidebar_content do
26
+ %ul.sidebar
27
+ != menu_node "Back to #{@sitemap.parent.menu_text}", @sitemap.parent.url
28
+ - if @sitemap && !@sitemap.children.empty?
29
+ = sidebar_content do
30
+ %ul.sidebar
31
+ - @sitemap.children.each do |sitemap_node|
32
+ != menu_node sitemap_node.menu_text, sitemap_node.url
33
+ - if @sidebar
34
+ #sidebar
35
+ #sidebar_top
36
+ = yield(:sidebar)
37
+ #sidebar_bottom
34
38
  \&nbsp;
35
39
  #content
36
40
  - flash.each do |key, value|
37
41
  %p{:class=>key}= value
38
42
  = yield
43
+ #dialog
44
+ %p#dialog_html
39
45
  #footer
40
46
  #footer-valid
41
47
 
@@ -14,6 +14,8 @@
14
14
  .textarea
15
15
  = f.label :body
16
16
  = f.text_area :body, :class=>'ckeditor_textarea', :cols=>100, :rows=>25
17
+ = f.label :stylesheet
18
+ = f.text_area :stylesheet
17
19
  = hidden_field_tag :container, 'content_pane'
18
20
  = hidden_field_tag :ajax_function, 'html'
19
21
  .actions
@@ -2,90 +2,82 @@
2
2
  = content_for :head do
3
3
  = javascript_include_tag %w(jquery.hotkeys jquery.cookie jquery.jstree)
4
4
  = javascript_include_tag %(sitemap_jstree)
5
- :css
6
- #sitemap, #sitemap input, .jstree-dnd-helper, #vakata-contextmenu { font-size:10px; font-family:Verdana; }
7
- #container .sitemap { border:2; padding:0; }
8
- #container #sitemap { opacity: opaque; width: 98%; height: 98%; overflow:auto; border:1px solid gray; }
9
- #menub { height:30px; overflow:auto; }
10
- #text { margin-top:1px; }
11
- #alog { font-size:9px !important; margin:5px; border:1px solid silver; }
12
- #content_pane {width: 100%; height: 600px; border-top: 2px; border-color: #0bba10;}
13
- #control_panel {position: absolute; width: 125px; height: 180px;}
14
- #control_panel_handle {width: 100%; height: 14px; background-color: #44c012;}
5
+ = stylesheet_link_tag %(admin)
15
6
  #container
16
7
  #control_panel
17
8
  #control_panel_handle
18
9
  %h3 Control Panel
19
- / the tree container (notice NOT an UL node)
20
- #sitemap.sitemap
21
- / JavaScript neccessary for the tree
10
+ #sitemap_container
11
+ #sitemap.sitemap
22
12
  #content_pane
23
- :javascript
24
- $(function () {
25
- $('#control_panel').draggable({handle: '#control_panel_handle'}).resizable();
26
13
 
27
- // Settings up the tree - using $(selector).jstree(options);
28
- // All those configuration options are documented in the _docs folder
29
- $.jstree._themes = '/jstree/themes/'
30
- $("#sitemap")
31
- .jstree(sitemapJsTreeConfig())
32
- .bind("create.jstree", jstreeEventDeclarations()["create.jstree"])
33
- .bind("remove.jstree", jstreeEventDeclarations()["remove.jstree"])
34
- // { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
35
- .bind("rename.jstree", jstreeEventDeclarations()["rename.jstree"])
36
- .bind("select_node.jstree", jstreeEventDeclarations()["select_node.jstree"])
37
- .bind("move_node.jstree", jstreeEventDeclarations()["move_node.jstree"]);
38
- });
39
- :javascript
40
- function createSiteMap(data, callback) {
41
- $.post(
42
- "#{sitemaps_path(:format=>:json)}",
43
- {
44
- "utf8" : "#{"&#x2713;".html_safe}",
45
- #{authenticity_token_json}
46
- "sitemap[menu_text]" : data['menu_text'],
47
- "sitemap[position]" : data['position'],
48
- "sitemap[resource_type]" : data['resource_type'],
49
- "sitemap[resource_id]" : data['resource_id'],
50
- "sitemap[parent_id]" : data['parent_id']
51
- },
52
- callback
53
- );
54
- }
14
+ #dialog_form
55
15
 
56
- function updateSiteMap(data, callback) {
57
- post_data = {
58
- "utf8" : "#{"&#x2713;".html_safe}",
59
- "format" : "json",
60
- #{authenticity_token_json}
61
- }
62
- if (data['parent_id'] != null) {post_data['parent_id'] = data['parent_id']}
63
- if (data['menu_text'] != null) {post_data['sitemap[menu_text]'] = data['menu_text']}
64
- if (data['position'] != null) {post_data['sitemap[position]'] = data['position']}
65
- if (data['resource_id'] != null) {post_data['sitemap[resource_id]'] = data['resource_id']}
66
- if (data['resource_type'] != null) {post_data['sitemap[resource_type]'] = data['resource_type']}
67
16
 
68
- $.ajax({
69
- async : false,
70
- type: 'PUT',
71
- url: "/sitemaps/" + data['id'].toString(),
72
- data : post_data,
73
- success: callback
74
- });
75
- }
17
+ :javascript
18
+ $(function () {
19
+ // $('#control_panel').draggable({handle: '#control_panel_handle', containment: '#content'}).resizable();
76
20
 
77
- function deleteSiteMap(node_id, callback) {
78
- $.ajax({
79
- async : false,
80
- type: 'DELETE',
81
- url: "/sitemaps/" + node_id.toString() + ".json",
82
- data : {
83
- "utf8" : "#{"&#x2713;".html_safe}",
84
- #{authenticity_token_json}
85
- },
86
- success : callback
87
- });
88
- }
21
+ // Settings up the tree - using $(selector).jstree(options);
22
+ // All those configuration options are documented in the _docs folder
23
+ $.jstree._themes = '/jstree/themes/'
24
+ $("#sitemap")
25
+ .jstree(sitemapJsTreeConfig())
26
+ .bind("create.jstree", jstreeEventDeclarations()["create.jstree"])
27
+ .bind("remove.jstree", jstreeEventDeclarations()["remove.jstree"])
28
+ // { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
29
+ .bind("rename.jstree", jstreeEventDeclarations()["rename.jstree"])
30
+ .bind("select_node.jstree", jstreeEventDeclarations()["select_node.jstree"])
31
+ .bind("move_node.jstree", jstreeEventDeclarations()["move_node.jstree"]);
32
+ });
89
33
 
90
- #dialog_form
34
+ function createSiteMap(data, callback) {
35
+ $.post(
36
+ "#{sitemaps_path(:format=>:json)}",
37
+ {
38
+ "utf8" : "#{"&#x2713;".html_safe}",
39
+ #{authenticity_token_json}
40
+ "sitemap[menu_text]" : data['menu_text'],
41
+ "sitemap[position]" : data['position'],
42
+ "sitemap[resource_type]" : data['resource_type'],
43
+ "sitemap[resource_id]" : data['resource_id'],
44
+ "sitemap[parent_id]" : data['parent_id']
45
+ },
46
+ callback
47
+ );
48
+ }
49
+
50
+ function updateSiteMap(data, callback) {
51
+ post_data = {
52
+ "utf8" : "#{"&#x2713;".html_safe}",
53
+ "format" : "json",
54
+ #{authenticity_token_json}
55
+ }
56
+ if (data['parent_id'] != null) {post_data['parent_id'] = data['parent_id']}
57
+ if (data['menu_text'] != null) {post_data['sitemap[menu_text]'] = data['menu_text']}
58
+ if (data['position'] != null) {post_data['sitemap[position]'] = data['position']}
59
+ if (data['resource_id'] != null) {post_data['sitemap[resource_id]'] = data['resource_id']}
60
+ if (data['resource_type'] != null) {post_data['sitemap[resource_type]'] = data['resource_type']}
61
+
62
+ $.ajax({
63
+ async : false,
64
+ type: 'PUT',
65
+ url: "/sitemaps/" + data['id'].toString(),
66
+ data : post_data,
67
+ success: callback
68
+ });
69
+ }
70
+
71
+ function deleteSiteMap(node_id, callback) {
72
+ $.ajax({
73
+ async : false,
74
+ type: 'DELETE',
75
+ url: "/sitemaps/" + node_id.toString() + ".json",
76
+ data : {
77
+ "utf8" : "#{"&#x2713;".html_safe}",
78
+ #{authenticity_token_json}
79
+ },
80
+ success : callback
81
+ });
82
+ }
91
83
 
@@ -0,0 +1,26 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table(:users) do |t|
4
+ t.database_authenticatable :null => false
5
+ t.recoverable
6
+ t.rememberable
7
+ t.trackable
8
+
9
+ # t.confirmable
10
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
11
+ # t.token_authenticatable
12
+
13
+ t.timestamps
14
+ end
15
+
16
+ add_index :users, :email, :unique => true
17
+ add_index :users, :reset_password_token, :unique => true
18
+ # add_index :users, :confirmation_token, :unique => true
19
+ # add_index :users, :unlock_token, :unique => true
20
+ end
21
+
22
+ def self.down
23
+ drop_table :users
24
+ end
25
+ end
26
+
@@ -0,0 +1,28 @@
1
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :tags do |t|
4
+ t.string :name
5
+ end
6
+
7
+ create_table :taggings do |t|
8
+ t.references :tag
9
+
10
+ # You should make sure that the column created is
11
+ # long enough to store the required class names.
12
+ t.references :taggable, :polymorphic => true
13
+ t.references :tagger, :polymorphic => true
14
+
15
+ t.string :context
16
+
17
+ t.datetime :created_at
18
+ end
19
+
20
+ add_index :taggings, :tag_id
21
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
22
+ end
23
+
24
+ def self.down
25
+ drop_table :taggings
26
+ drop_table :tags
27
+ end
28
+ end
@@ -7,7 +7,7 @@ require 'rails/generators/active_record'
7
7
  class AppLayoutGenerator < Rails::Generators::Base
8
8
  include Rails::Generators::Migration
9
9
  source_root File.expand_path('../../../../', __FILE__)
10
- require File.join(File.dirname(__FILE__), 'core_extensions.rb')
10
+ require File.join(File.dirname(__FILE__), '../core_extensions.rb')
11
11
  desc "Installs files needed for App Template gem."
12
12
 
13
13
  def copy_files
@@ -16,6 +16,40 @@ module Rails
16
16
  stategies.each {|stategy| stategy.call }
17
17
  end
18
18
 
19
+ def gemfile()
20
+ File.open(File.expand_path('Gemfile', WheelsGenerator::SOURCE_ROOT)) do |gemfile|
21
+ while line = gemfile.readline
22
+ line = line.split("#").first.strip
23
+ if line.index('gem') == 0
24
+ pcs = line.split(' ')
25
+ gem = pcs[1].gsub(/[,"']/, '')
26
+ version = pcs[2].try(:gsub, /[,"']/, '')
27
+ gem_version gem, version
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def gem_version(gem_name, version_name)
34
+ new_gemfile = ""
35
+ added = false
36
+ File.open('Gemfile', 'r') do |file|
37
+ new_gemline = %(gem "#{gem_name}") + (version_name ? %(, "#{version_name}") : '') + '\n'
38
+ while (line = file.readline)
39
+ if line.index("gem") == 0 && (line.include? gem_name)
40
+ new_gemfile += new_gemline
41
+ added = true
42
+ else
43
+ new_gemfile += line
44
+ end
45
+ end
46
+ unless added
47
+ new_gemfile += new_gemline
48
+ end
49
+ end
50
+ File.open('Gemfile', 'w').write(new_gemfile)
51
+ end
52
+
19
53
  def load_options
20
54
  @template_options[:design] = ask("Which design framework? [none(default), compass]: ").downcase
21
55
  @template_options[:design] = "none" if @template_options[:design].nil?
@@ -42,6 +76,14 @@ module Rails
42
76
  contents
43
77
  end
44
78
 
79
+ def migrations
80
+ Dir.new('db/migrate').entries
81
+ end
82
+
83
+ def have_migration?(name)
84
+ !migrations.select{|t| t.include? name}.empty?
85
+ end
86
+
45
87
  def snippet_path(name)
46
88
  File.join(File.dirname(__FILE__), 'snippets', name)
47
89
  end
@@ -49,7 +91,6 @@ module Rails
49
91
  def template_path(name)
50
92
  File.join(File.dirname(__FILE__), 'templates', name)
51
93
  end
52
-
53
94
  end
54
95
  end
55
96
  end
@@ -0,0 +1,46 @@
1
+ gemfile
2
+
3
+ route "root :to => \"blogs#index\""
4
+
5
+ unless have_migration? "insert_admin_user_and_roles"
6
+ user_attr = %w(user_email user_password user_first_name user_last_name user_blog_title user_alias)
7
+ for attrib in user_attr
8
+ class_eval "attr_accessor :#{attrib}"
9
+ send "#{attrib}=", ask("Please enter #{attrib}...")
10
+ end
11
+ end
12
+
13
+ unless File.exist? 'config/amazon_s3.yml'
14
+ class_eval do
15
+ attr_accessor :bucket, :access_key_id, :secret_access_key
16
+ end
17
+ say ("If you have your S3 info handy, put it in now.")
18
+ for attribute in %w(bucket access_key_id secret_access_key)
19
+ self.send "#{attribute}=", ask("What's the #{attribute}?")
20
+ end
21
+
22
+ template 'config/amazon_s3.yml', 'config/amazon_s3.yml'
23
+ end
24
+
25
+ generate "wheels_checkout_assets_readonly"
26
+
27
+ stategies << lambda do
28
+ generate "devise:install"
29
+ source_root File.expand_path('../../../../', __FILE__)
30
+ my_migrations = Dir.new(File.expand_path('db/migrate', source_root)).entries
31
+
32
+ my_migrations.each do |file|
33
+ migration_oldnum = file.split("_").first
34
+ migration_name = file.split('.').first.
35
+ split("_").reject{|t| t==migration_oldnum}.join('_')
36
+ if migrations.select{|t| t.include?(migration_name)}.empty?
37
+ migration_template "db/migrate/#{file}", "db/migrate/#{migration_name}"
38
+ sleep 1
39
+ end
40
+ end
41
+
42
+ # create wheels_resources first so that devise_for :users will appear first in routes.rb
43
+ route "wheels_resources"
44
+ route "devise_for :users"
45
+ end
46
+
@@ -0,0 +1,18 @@
1
+ generate "wheels_checkout_assets_readonly"
2
+
3
+ stategies << lambda do
4
+ generate "devise:install"
5
+ source_root File.expand_path('../../../../', __FILE__)
6
+ my_migrations = Dir.new(File.expand_path('db/migrate', source_root)).entries
7
+
8
+ my_migrations.each do |file|
9
+ migration_oldnum = file.split("_").first
10
+ migration_name = file.split('.').first.
11
+ split("_").reject{|t| t==migration_oldnum}.join('_')
12
+ if migrations.select{|t| t.include?(migration_name)}.empty?
13
+ migration_template "db/migrate/#{file}", "db/migrate/#{migration_name}"
14
+ sleep 1
15
+ end
16
+ end
17
+ end
18
+
@@ -2,11 +2,13 @@ require 'rails/generators'
2
2
  require 'rails/generators/migration'
3
3
  require 'rails/generators/generated_attribute'
4
4
  require 'rails/generators/active_record'
5
+ require File.join(File.dirname(__FILE__), '../core_extensions.rb')
5
6
 
6
7
  class WheelsGenerator < Rails::Generators::Base
7
8
  include Rails::Generators::Migration
8
- require File.join(File.dirname(__FILE__), 'core_extensions.rb')
9
+ require File.join(File.dirname(__FILE__), '../core_extensions.rb')
9
10
  source_root File.expand_path('../../../../', __FILE__)
11
+ SOURCE_ROOT = source_root
10
12
  desc "Installs files needed for App Template gem."
11
13
 
12
14
  # argument :scope, :required => false, :default => nil,
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate wheels_checkout_assets Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,9 @@
1
+ class WheelsCheckoutAssetsGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ def checkout_files
5
+ run "rm -rf public"
6
+ run "git clone git@github.com:tylergannon/wheels_assets.git public"
7
+ end
8
+ end
9
+
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate wheels_checkout_assets_readonly Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,10 @@
1
+ class WheelsCheckoutAssetsReadonlyGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ def checkout_files
5
+ run "rm -rf public"
6
+ run "git clone git://github.com/tylergannon/wheels_assets.git public"
7
+ run "rm -rf public/.git"
8
+ end
9
+ end
10
+
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate wheels_controller Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,14 @@
1
+ class WheelsControllerGenerator < Rails::Generators::NamedBase
2
+ include Rails::Generators::Migration
3
+ source_root File.expand_path('../../../../', __FILE__)
4
+ desc "Installs a copy of the named controller into the app/controllers folder."
5
+
6
+ def install_file
7
+ if class_name == "All"
8
+ directory "app/controllers", "app/controllers"
9
+ else
10
+ file "app/controllers/#{plural_name}_controller.rb", "app/controllers/#{plural_name}_controller.rb"
11
+ end
12
+ end
13
+ end
14
+
@@ -2,7 +2,7 @@ Description:
2
2
  Explain the generator
3
3
 
4
4
  Example:
5
- rails generate app_template Thing
5
+ rails generate wheels_model Thing
6
6
 
7
7
  This will create:
8
8
  what/will/it/create