squeezer 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. data/VERSION +1 -1
  2. data/{lib/app → app}/controllers/application_controller.rb +0 -0
  3. data/{lib/app → app}/controllers/blogs_controller.rb +0 -0
  4. data/{lib/app → app}/controllers/comments_controller.rb +0 -0
  5. data/{lib/app → app}/controllers/pages_controller.rb +0 -0
  6. data/{lib/app → app}/controllers/posts_controller.rb +0 -0
  7. data/{lib/app → app}/controllers/roles_controller.rb +0 -0
  8. data/{lib/app → app}/controllers/sites_controller.rb +0 -0
  9. data/{lib/app → app}/controllers/users_controller.rb +0 -0
  10. data/{lib/app → app}/helpers/squeezer_helper.rb +0 -0
  11. data/{lib/app → app}/models/ability.rb +0 -0
  12. data/{lib/app → app}/models/blog.rb +0 -0
  13. data/{lib/app → app}/models/comment.rb +0 -0
  14. data/{lib/app → app}/models/page.rb +0 -0
  15. data/{lib/app → app}/models/post.rb +0 -0
  16. data/{lib/app → app}/models/role.rb +0 -0
  17. data/{lib/app → app}/models/site.rb +0 -0
  18. data/{lib/app → app}/models/user.rb +0 -0
  19. data/{lib/app → app}/views/blogs/_entry.haml +0 -0
  20. data/{lib/app → app}/views/blogs/_form.html.haml +0 -0
  21. data/{lib/app → app}/views/blogs/edit.html.haml +0 -0
  22. data/{lib/app → app}/views/blogs/index.html.haml +0 -0
  23. data/{lib/app → app}/views/blogs/new.html.haml +0 -0
  24. data/{lib/app → app}/views/blogs/show.html.haml +0 -0
  25. data/{lib/app → app}/views/comments/_form.html.haml +0 -0
  26. data/{lib/app → app}/views/comments/_index.html.haml +0 -0
  27. data/{lib/app → app}/views/comments/_post.html.haml +0 -0
  28. data/{lib/app → app}/views/comments/show.js.erb +0 -0
  29. data/{lib/app → app}/views/layouts/_footer.html.haml +0 -0
  30. data/{lib/app → app}/views/layouts/_login.haml +0 -0
  31. data/{lib/app → app}/views/layouts/_menu.html.haml +0 -0
  32. data/{lib/app → app}/views/layouts/_msn.haml +0 -0
  33. data/{lib/app → app}/views/layouts/_sidebar.html.haml +0 -0
  34. data/{lib/app → app}/views/layouts/application.html.erb +0 -0
  35. data/{lib/app → app}/views/layouts/ice/squeezer/_ice.haml +0 -0
  36. data/{lib/app → app}/views/layouts/ice/squeezer/ice/_ice.haml +0 -0
  37. data/{lib/app → app}/views/layouts/ice/squeezer/ice/squeezer/_ice.haml +0 -0
  38. data/{lib/app → app}/views/layouts/ice/squeezer/ice/squeezer/ice/_ice.haml +0 -0
  39. data/{lib/app → app}/views/layouts/ice/squeezer/ice/squeezer/ice/squeezer/_ice.haml +0 -0
  40. data/{lib/app → app}/views/layouts/squeezer/ice/_ice.haml +0 -0
  41. data/{lib/app → app}/views/layouts/squeezer/ice/squeezer/_ice.haml +0 -0
  42. data/{lib/app → app}/views/layouts/squeezer/ice/squeezer/ice/_ice.haml +0 -0
  43. data/{lib/app → app}/views/layouts/squeezer/ice/squeezer/ice/squeezer/_ice.haml +0 -0
  44. data/{lib/app → app}/views/layouts/squeezer/squeezer.css +0 -0
  45. data/{lib/app → app}/views/pages/_form.html.haml +0 -0
  46. data/{lib/app → app}/views/pages/edit.html.haml +0 -0
  47. data/{lib/app → app}/views/pages/index.html.haml +0 -0
  48. data/{lib/app → app}/views/pages/new.html.haml +0 -0
  49. data/{lib/app → app}/views/pages/show.html.haml +0 -0
  50. data/{lib/app → app}/views/roles/_form.html.haml +0 -0
  51. data/{lib/app → app}/views/roles/edit.html.haml +0 -0
  52. data/{lib/app → app}/views/roles/index.html.haml +0 -0
  53. data/{lib/app → app}/views/roles/new.html.haml +0 -0
  54. data/{lib/app → app}/views/roles/show.html.haml +0 -0
  55. data/{lib/app → app}/views/sites/_form.html.haml +0 -0
  56. data/{lib/app → app}/views/sites/edit.html.haml +0 -0
  57. data/{lib/app → app}/views/sites/index.html.haml +0 -0
  58. data/{lib/app → app}/views/sites/new.html.haml +0 -0
  59. data/{lib/app → app}/views/sites/show.html.haml +0 -0
  60. data/{lib/app → app}/views/users/index.haml +0 -0
  61. data/{lib/app → app}/views/users/roles.haml +0 -0
  62. data/{lib/app → app}/views/users/show.haml +0 -0
  63. data/lib/generators/squeezer/Gemfile +37 -0
  64. data/lib/generators/squeezer/README +2 -0
  65. data/lib/generators/squeezer/USAGE +7 -0
  66. data/lib/generators/squeezer/squeezer_generator.rb +114 -0
  67. data/lib/generators/squeezer/templates/Gemfile +37 -0
  68. data/lib/generators/squeezer/templates/app/controllers/application_controller.rb +25 -0
  69. data/lib/{blogs_controller.rb → generators/squeezer/templates/app/controllers/blogs_controller.rb} +0 -0
  70. data/lib/generators/squeezer/templates/app/controllers/comments_controller.rb +37 -0
  71. data/lib/generators/squeezer/templates/app/controllers/forums_controller.rb +42 -0
  72. data/lib/generators/squeezer/templates/app/controllers/pages_controller.rb +3 -0
  73. data/lib/generators/squeezer/templates/app/controllers/posts_controller.rb +23 -0
  74. data/lib/generators/squeezer/templates/app/controllers/roles_controller.rb +3 -0
  75. data/lib/generators/squeezer/templates/app/controllers/sites_controller.rb +70 -0
  76. data/lib/generators/squeezer/templates/app/controllers/topics_controller.rb +46 -0
  77. data/lib/generators/squeezer/templates/app/controllers/users_controller.rb +22 -0
  78. data/lib/generators/squeezer/templates/app/helpers/application_helper.rb +66 -0
  79. data/lib/generators/squeezer/templates/app/helpers/blogs_helper.rb +2 -0
  80. data/lib/generators/squeezer/templates/app/helpers/layout_helper.rb +71 -0
  81. data/lib/generators/squeezer/templates/app/helpers/pages_helper.rb +2 -0
  82. data/lib/generators/squeezer/templates/app/models/ability.rb +17 -0
  83. data/lib/generators/squeezer/templates/app/models/blog.rb +6 -0
  84. data/lib/generators/squeezer/templates/app/models/comment.rb +4 -0
  85. data/lib/generators/squeezer/templates/app/models/forum.rb +5 -0
  86. data/lib/generators/squeezer/templates/app/models/isntall.rb +9 -0
  87. data/lib/generators/squeezer/templates/app/models/page.rb +3 -0
  88. data/lib/generators/squeezer/templates/app/models/post.rb +12 -0
  89. data/lib/generators/squeezer/templates/app/models/role.rb +3 -0
  90. data/lib/generators/squeezer/templates/app/models/site.rb +17 -0
  91. data/lib/generators/squeezer/templates/app/models/topic.rb +6 -0
  92. data/lib/generators/squeezer/templates/app/models/user.rb +35 -0
  93. data/lib/generators/squeezer/templates/app/views/blogs/_entry.haml +26 -0
  94. data/lib/generators/squeezer/templates/app/views/blogs/_form.html.haml +15 -0
  95. data/lib/generators/squeezer/templates/app/views/blogs/edit.html.haml +8 -0
  96. data/lib/generators/squeezer/templates/app/views/blogs/index.html.haml +8 -0
  97. data/lib/generators/squeezer/templates/app/views/blogs/new.html.haml +5 -0
  98. data/lib/generators/squeezer/templates/app/views/blogs/show.html.haml +4 -0
  99. data/lib/generators/squeezer/templates/app/views/comments/_form.html.erb +5 -0
  100. data/lib/generators/squeezer/templates/app/views/comments/_form.html.haml +19 -0
  101. data/lib/generators/squeezer/templates/app/views/comments/_index.html.haml +26 -0
  102. data/lib/generators/squeezer/templates/app/views/comments/_post.html.haml +19 -0
  103. data/lib/generators/squeezer/templates/app/views/comments/_post2.haml +14 -0
  104. data/lib/generators/squeezer/templates/app/views/comments/edit.haml +7 -0
  105. data/lib/generators/squeezer/templates/app/views/comments/show.js.erb +1 -0
  106. data/lib/generators/squeezer/templates/app/views/confirmations/new.html.erb +12 -0
  107. data/lib/generators/squeezer/templates/app/views/devise/confirmations/new.html.erb +12 -0
  108. data/lib/generators/squeezer/templates/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  109. data/lib/generators/squeezer/templates/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  110. data/lib/generators/squeezer/templates/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  111. data/lib/generators/squeezer/templates/app/views/devise/passwords/edit.html.erb +16 -0
  112. data/lib/generators/squeezer/templates/app/views/devise/passwords/new.html.erb +12 -0
  113. data/lib/generators/squeezer/templates/app/views/devise/registrations/edit.html.erb +28 -0
  114. data/lib/generators/squeezer/templates/app/views/devise/registrations/new.html.erb +21 -0
  115. data/lib/generators/squeezer/templates/app/views/devise/sessions/new.html.erb +17 -0
  116. data/lib/generators/squeezer/templates/app/views/devise/shared/_links.erb +19 -0
  117. data/lib/generators/squeezer/templates/app/views/devise/unlocks/new.html.erb +12 -0
  118. data/lib/generators/squeezer/templates/app/views/devise_mailer/confirmation_instructions.html.erb +5 -0
  119. data/lib/generators/squeezer/templates/app/views/devise_mailer/reset_password_instructions.html.erb +8 -0
  120. data/lib/generators/squeezer/templates/app/views/devise_mailer/unlock_instructions.html.erb +7 -0
  121. data/lib/generators/squeezer/templates/app/views/forums/_form.html.haml +14 -0
  122. data/lib/generators/squeezer/templates/app/views/forums/edit.html.haml +8 -0
  123. data/lib/generators/squeezer/templates/app/views/forums/index.html.haml +37 -0
  124. data/lib/generators/squeezer/templates/app/views/forums/new.html.haml +5 -0
  125. data/lib/generators/squeezer/templates/app/views/forums/show.html.haml +43 -0
  126. data/lib/generators/squeezer/templates/app/views/layouts/_footer.html.haml +5 -0
  127. data/lib/generators/squeezer/templates/app/views/layouts/_header.html.haml +10 -0
  128. data/lib/generators/squeezer/templates/app/views/layouts/_ice.haml +27 -0
  129. data/lib/generators/squeezer/templates/app/views/layouts/_latest.haml +15 -0
  130. data/lib/generators/squeezer/templates/app/views/layouts/_login.html.erb +9 -0
  131. data/lib/generators/squeezer/templates/app/views/layouts/_login.html.haml +12 -0
  132. data/lib/generators/squeezer/templates/app/views/layouts/_menu.html.haml +6 -0
  133. data/lib/generators/squeezer/templates/app/views/layouts/_msn.haml +12 -0
  134. data/lib/generators/squeezer/templates/app/views/layouts/_sidebar.html.haml +1 -0
  135. data/lib/generators/squeezer/templates/app/views/layouts/application.html.erb +14 -0
  136. data/lib/generators/squeezer/templates/app/views/layouts/application.html.haml +14 -0
  137. data/lib/generators/squeezer/templates/app/views/layouts/ice/squeezer/_ice.haml +27 -0
  138. data/lib/generators/squeezer/templates/app/views/pages/_form.html.haml +17 -0
  139. data/lib/generators/squeezer/templates/app/views/pages/edit.html.haml +8 -0
  140. data/lib/generators/squeezer/templates/app/views/pages/index.html.haml +22 -0
  141. data/lib/generators/squeezer/templates/app/views/pages/new.html.haml +5 -0
  142. data/lib/generators/squeezer/templates/app/views/pages/show.html.haml +12 -0
  143. data/lib/generators/squeezer/templates/app/views/passwords/edit.html.erb +16 -0
  144. data/lib/generators/squeezer/templates/app/views/passwords/new.html.erb +12 -0
  145. data/lib/generators/squeezer/templates/app/views/registrations/edit.html.erb +25 -0
  146. data/lib/generators/squeezer/templates/app/views/registrations/new.html.erb +17 -0
  147. data/lib/generators/squeezer/templates/app/views/roles/_form.html.haml +9 -0
  148. data/lib/generators/squeezer/templates/app/views/roles/edit.html.haml +7 -0
  149. data/lib/generators/squeezer/templates/app/views/roles/index.html.haml +19 -0
  150. data/lib/generators/squeezer/templates/app/views/roles/new.html.haml +5 -0
  151. data/lib/generators/squeezer/templates/app/views/roles/show.html.haml +13 -0
  152. data/lib/generators/squeezer/templates/app/views/roles/user.html.erb +14 -0
  153. data/lib/generators/squeezer/templates/app/views/sessions/new.html.erb +17 -0
  154. data/lib/generators/squeezer/templates/app/views/shared/_devise_links.erb +19 -0
  155. data/lib/generators/squeezer/templates/app/views/sites/_form.html.haml +42 -0
  156. data/lib/generators/squeezer/templates/app/views/sites/edit.html.haml +1 -0
  157. data/lib/generators/squeezer/templates/app/views/sites/index.html.haml +165 -0
  158. data/lib/generators/squeezer/templates/app/views/sites/new.html.haml +1 -0
  159. data/lib/generators/squeezer/templates/app/views/sites/show.html.haml +18 -0
  160. data/lib/generators/squeezer/templates/app/views/topics/_form.html.haml +16 -0
  161. data/lib/generators/squeezer/templates/app/views/topics/edit.html.erb +8 -0
  162. data/lib/generators/squeezer/templates/app/views/topics/index.html.haml +23 -0
  163. data/lib/generators/squeezer/templates/app/views/topics/new.html.erb +5 -0
  164. data/lib/generators/squeezer/templates/app/views/topics/show.html.haml +16 -0
  165. data/lib/generators/squeezer/templates/app/views/unlocks/new.html.erb +12 -0
  166. data/lib/generators/squeezer/templates/app/views/users/index.haml +5 -0
  167. data/lib/generators/squeezer/templates/app/views/users/roles.haml +14 -0
  168. data/lib/generators/squeezer/templates/config/devise.rb +142 -0
  169. data/lib/generators/squeezer/templates/db/migrate/add_username_user.rb +11 -0
  170. data/lib/generators/squeezer/templates/db/migrate/blogs.rb +15 -0
  171. data/lib/generators/squeezer/templates/db/migrate/comments.rb +15 -0
  172. data/lib/generators/squeezer/templates/db/migrate/create_blogs.rb +15 -0
  173. data/lib/generators/squeezer/templates/db/migrate/create_comments.rb +15 -0
  174. data/lib/generators/squeezer/templates/db/migrate/create_pages.rb +16 -0
  175. data/lib/generators/squeezer/templates/db/migrate/create_posts.rb +16 -0
  176. data/lib/generators/squeezer/templates/db/migrate/create_roles.rb +13 -0
  177. data/lib/generators/squeezer/templates/db/migrate/create_roles_users.rb +15 -0
  178. data/lib/generators/squeezer/templates/db/migrate/create_sites.rb +26 -0
  179. data/lib/generators/squeezer/templates/db/migrate/data.rb +7 -0
  180. data/lib/generators/squeezer/templates/db/migrate/page_data.rb +10 -0
  181. data/lib/generators/squeezer/templates/db/migrate/pages.rb +16 -0
  182. data/lib/generators/squeezer/templates/db/migrate/posts.rb +16 -0
  183. data/lib/generators/squeezer/templates/db/migrate/roles.rb +13 -0
  184. data/lib/generators/squeezer/templates/db/migrate/roles_users.rb +15 -0
  185. data/lib/generators/squeezer/templates/db/migrate/sites.rb +26 -0
  186. data/lib/generators/squeezer/templates/db/migrate/squeez_data.rb +7 -0
  187. data/lib/generators/squeezer/templates/doc/clases.png +0 -0
  188. data/lib/generators/squeezer/templates/ice/squeezer/ice/_ice.haml +6 -0
  189. data/lib/generators/squeezer/templates/ice/squeezer/ice/squeezer/_ice.haml +28 -0
  190. data/lib/generators/squeezer/templates/ice/squeezer/ice/squeezer/ice/_ice.haml +6 -0
  191. data/lib/generators/squeezer/templates/ice/squeezer/ice/squeezer/ice/squeezer/_ice.haml +7 -0
  192. data/lib/generators/squeezer/templates/ice/squeezer/squeezer.css +252 -0
  193. data/lib/generators/squeezer/templates/public/javascripts/application.js +53 -0
  194. data/lib/generators/squeezer/templates/public/javascripts/jquery-ui.js +11437 -0
  195. data/lib/generators/squeezer/templates/public/javascripts/jquery-ui.min.js +401 -0
  196. data/lib/generators/squeezer/templates/public/javascripts/jquery.cleditor.min.js +31 -0
  197. data/lib/generators/squeezer/templates/public/javascripts/jquery.js +6883 -0
  198. data/lib/generators/squeezer/templates/public/javascripts/jquery.layout.min-1.2.0.js +80 -0
  199. data/lib/generators/squeezer/templates/public/javascripts/jquery.min.js +166 -0
  200. data/lib/generators/squeezer/templates/public/javascripts/rails.js +146 -0
  201. data/lib/generators/squeezer/templates/public/stylesheets/CLEditor1_3_0/images/buttons.gif +0 -0
  202. data/lib/generators/squeezer/templates/public/stylesheets/CLEditor1_3_0/images/toolbar.gif +0 -0
  203. data/lib/generators/squeezer/templates/public/stylesheets/CLEditor1_3_0/jquery.cleditor.css +24 -0
  204. data/lib/generators/squeezer/templates/public/stylesheets/ice/lagota/ice/_ice.haml +6 -0
  205. data/lib/generators/squeezer/templates/public/stylesheets/ice/lagota/lagota.css +284 -0
  206. data/lib/generators/squeezer/templates/public/stylesheets/ice/squeezer/ice/_ice.haml +6 -0
  207. data/lib/generators/squeezer/templates/public/stylesheets/ice/squeezer/ice/squeezer/_ice.haml +27 -0
  208. data/lib/generators/squeezer/templates/public/stylesheets/ice/squeezer/ice/squeezer/ice/_ice.haml +6 -0
  209. data/lib/generators/squeezer/templates/public/stylesheets/ice/squeezer/ice/squeezer/ice/squeezer/_ice.haml +7 -0
  210. data/lib/generators/squeezer/templates/public/stylesheets/ice/squeezer/squeezer.css +249 -0
  211. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  212. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  213. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  214. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  215. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  216. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  217. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  218. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  219. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  220. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  221. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  222. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  223. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  224. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  225. data/lib/generators/squeezer/templates/public/stylesheets/ui-lightness/jquery-ui-1.8.5.custom.css +572 -0
  226. data/lib/squeezer.rb +1 -1
  227. data/pkg/squeezer-0.1.3.gem +0 -0
  228. data/pkg/squeezer-0.1.4.gem +0 -0
  229. data/squeezer.gemspec +227 -65
  230. metadata +229 -67
  231. data/lib/squeezer/engine.rb +0 -0
@@ -0,0 +1,66 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ def link_permitted(*args)
4
+ name = args.first
5
+
6
+ action = args.second
7
+ obj = args.third
8
+ options = args.fourth
9
+
10
+ if permitted_to? action,obj
11
+ if action == :destroy
12
+ link_to name,options,:confirm => 'Are you sure?', :method => :delete
13
+ else
14
+ link_to name,options
15
+ end
16
+ end
17
+ end
18
+
19
+ def show_bar
20
+ "#{link_permitted "Mostrar",:show,controller_name.to_sym,{:action=>:show,:id=>params[:id]}} "
21
+ end
22
+
23
+ def index_bar
24
+ "#{link_permitted "Ver Todos",:index,controller_name.to_sym,{:action=>:index}} "
25
+ end
26
+
27
+ def destroy_bar
28
+ "#{link_permitted "Borrar",:destroy,controller_name.to_sym,{:action=>:show,:id=>params[:id]}} "
29
+ end
30
+
31
+ def historics_bar
32
+ "#{link_permitted "Historico",:historics,controller_name.to_sym,{:action=>:historics,:id=>params[:id]}} "
33
+ end
34
+
35
+ def edit_bar
36
+ "#{link_permitted "Editar",:edit,controller_name.to_sym,{:action=>:edit,:id=>params[:id]}} "
37
+ end
38
+
39
+ def new_bar
40
+ "#{link_permitted "Nuevo",:new,controller_name.to_sym,{:action=>:new}} "
41
+ end
42
+
43
+ def list_bar(a)
44
+ bar=""
45
+ a.each {|x|
46
+ bar +=eval(x.to_s+'_bar')
47
+ }
48
+ return bar
49
+ end
50
+
51
+ def action_bar
52
+ h={
53
+ :show => [:index,:new,:edit,:historics,:destroy],
54
+ :index =>[:new],
55
+ :new => [:index],
56
+ :edit => [:index,:show,:new,:historics,:destroy],
57
+ :historics =>[:index,:show,:new,:edit,:destroy],
58
+ :old => [:index,:show,:new,:historics]
59
+ }
60
+ bar=list_bar(h[action_name.to_sym])
61
+
62
+ content_for :action_bar do
63
+ bar
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,2 @@
1
+ module BlogsHelper
2
+ end
@@ -0,0 +1,71 @@
1
+ # These helper methods can be called in your template to set variables to be used in the layout
2
+ # This module should be included in all views globally,
3
+ # to do so you may need to add this line to your ApplicationController
4
+ # helper :layout
5
+ module LayoutHelper
6
+ def title(page_title, show_title = true)
7
+ @content_for_title = page_title.to_s
8
+ @show_title = show_title
9
+ end
10
+
11
+ def show_title?
12
+ @show_title
13
+ end
14
+
15
+ def stylesheet(*args)
16
+ content_for(:head) { stylesheet_link_tag(*args) }
17
+ end
18
+
19
+ def javascript(*args)
20
+ content_for(:head) { javascript_include_tag(*args) }
21
+ end
22
+
23
+ def wysiwug
24
+ content_for(:head) { javascript_include_tag('jquery.cleditor.min')}
25
+ content_for(:head) { stylesheet_link_tag('CLEditor1_3_0/jquery.cleditor')}
26
+ raw "<script>$(function(){$('.wysiwyg').cleditor();});</script>"
27
+ end
28
+
29
+ def link_to(*args, &block)
30
+ if block_given?
31
+ options = args.first || {}
32
+ html_options = args.second
33
+ link_to(capture(&block), options, html_options)
34
+ else
35
+ name = args[0]
36
+ options = args[1] || {}
37
+ html_options = args[2]
38
+
39
+ html_options = convert_options_to_data_attributes(options, html_options)
40
+ url = url_for(options)
41
+
42
+ if (url.split('/').last == url.split('/')[1])
43
+ action ="index"
44
+ else
45
+ action = url.split('/').last
46
+ if action.to_i > 0
47
+ action = "show"
48
+ if args[2]
49
+ if args[2][:method]
50
+ action = "destroy"
51
+ end
52
+ end
53
+ end
54
+ end
55
+ #controller = url.split('/')[1].chop.capitalize
56
+
57
+ href = html_options['href']
58
+ tag_options = tag_options(html_options)
59
+
60
+ href_attr = "href=\"#{ERB::Util.html_escape(url)}\"" unless href
61
+ classes="class='sq-#{action}'"
62
+
63
+ #if(can?(action.to_sym, controller) || controller >="User")
64
+ "<a #{classes} #{href_attr}#{tag_options}>#{ERB::Util.html_escape( name || url)}</a>".html_safe
65
+ #end
66
+
67
+
68
+ end
69
+ end
70
+
71
+ end
@@ -0,0 +1,2 @@
1
+ module PagesHelper
2
+ end
@@ -0,0 +1,17 @@
1
+ class Ability
2
+ include CanCan::Ability
3
+
4
+ def initialize(user)
5
+ user ||= User.new # Guest user
6
+ if (user.role?("Admin"))
7
+ can :manage, :all
8
+ else
9
+ can :read, :all
10
+ can :create, Post
11
+ can :update, Post do |comment|
12
+ comment.try(:user) == user
13
+ end
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,6 @@
1
+ class Blog < ActiveRecord::Base
2
+ attr_accessible :title, :body, :user_id
3
+ belongs_to :user
4
+ has_one :comment, :as=>:commentable,:dependent => :destroy
5
+
6
+ end
@@ -0,0 +1,4 @@
1
+ class Comment < ActiveRecord::Base
2
+ belongs_to :commentable, :polymorphic =>true
3
+ has_many :posts,:dependent => :destroy
4
+ end
@@ -0,0 +1,5 @@
1
+ class Forum < ActiveRecord::Base
2
+ attr_accessible :name, :desc
3
+
4
+ has_many :topics
5
+ end
@@ -0,0 +1,9 @@
1
+ class Isntall < ActiveRecord::Base
2
+ # Include default devise modules. Others available are:
3
+ # :token_authenticatable, :confirmable, :lockable and :timeoutable
4
+ devise :database_authenticatable, :registerable,
5
+ :recoverable, :rememberable, :trackable, :validatable
6
+
7
+ # Setup accessible (or protected) attributes for your model
8
+ attr_accessible :email, :password, :password_confirmation, :remember_me
9
+ end
@@ -0,0 +1,3 @@
1
+ class Page < ActiveRecord::Base
2
+ attr_accessible :title, :menu, :body, :user_id
3
+ end
@@ -0,0 +1,12 @@
1
+ class Post < ActiveRecord::Base
2
+ belongs_to :comment
3
+ belongs_to :user
4
+
5
+ validates_presence_of :body
6
+ validates_presence_of :name, :if => :user?
7
+
8
+ def user?
9
+ !user
10
+ end
11
+
12
+ end
@@ -0,0 +1,3 @@
1
+ class Role < ActiveRecord::Base
2
+ has_and_belongs_to_many :users
3
+ end
@@ -0,0 +1,17 @@
1
+ class Site < ActiveRecord::Base
2
+ #validates_attachment_presence :logo
3
+ #validates_attachment_size :logo, :less_than => 5.megabytes
4
+ #validates_attachment_content_type :logo, :content_type => ['image/jpeg', 'image/png']
5
+
6
+ #validates_attachment_presence :icon
7
+ #validates_attachment_size :icon, :less_than => 5.megabytes
8
+ #validates_attachment_content_type :icon, :content_type => ['image/jpeg', 'image/png']
9
+ validates_presence_of :name
10
+ has_attached_file :logo, :styles => { :thumb => "100x100>" },
11
+ :url => "/assets/sites/:id/:style/:basename.:extension",
12
+ :path => ":rails_root/public/assets/sites/:id/:style/:basename.:extension"
13
+
14
+ has_attached_file :icon, :styles => { :small => "10x10>", :thumb => "10x10>" },
15
+ :url => "/assets/sites/:id/:style/:basename.:extension",
16
+ :path => ":rails_root/public/assets/sites/:id/:style/:basename.:extension"
17
+ end
@@ -0,0 +1,6 @@
1
+ class Topic < ActiveRecord::Base
2
+ validates_presence_of :title,:forum_id
3
+ attr_accessible :title, :forum_id
4
+ has_one :comment, :as=>:commentable,:dependent => :destroy
5
+ belongs_to :forum
6
+ end
@@ -0,0 +1,35 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ # Include default devise modules. Others available are:
4
+ # :token_authenticatable, :confirmable, :lockable and :timeoutable
5
+ devise :database_authenticatable, :registerable,
6
+ :recoverable, :rememberable, :trackable, :validatable
7
+
8
+ # Setup accessible (or protected) attributes for your model
9
+ attr_accessible :email, :password, :password_confirmation,:username
10
+ # Include default devise modules. Others available are:
11
+ # :token_authenticatable, :confirmable, :lockable and :timeoutable
12
+ devise :database_authenticatable, :registerable,
13
+ :recoverable, :rememberable, :trackable, :validatable
14
+
15
+ # Setup accessible (or protected) attributes for your model
16
+ attr_accessible :email, :password, :password_confirmation,:role_ids,:username
17
+ has_and_belongs_to_many :roles
18
+
19
+ def role #array con los roles del usuario
20
+ roles.map do |role|
21
+ role.name
22
+ end
23
+ end
24
+
25
+ def role?(rol) #true si el usuario tiene el rol
26
+ role.include?(rol)
27
+ end
28
+
29
+ def role_symbols
30
+ roles.map do |role|
31
+ role.name.underscore.to_sym
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,26 @@
1
+ .post
2
+ .ui-widget-content
3
+ .ui-widget-header
4
+ =link_to_unless_current blog.title, blog
5
+ %p.meta
6
+ =blog.created_at
7
+ by
8
+ = blog.user.username
9
+ = link_to 'Show', blog
10
+ -if can? :edit, blog
11
+ = link_to 'Edit', edit_blog_path(blog)
12
+ = link_to 'Destroy', blog, :confirm => 'Are you sure?', :method => :delete
13
+
14
+ .entry
15
+ %p
16
+ -if action_name=='index'
17
+ =blog.body[0,200]
18
+ -else
19
+ =raw blog.body
20
+ %p
21
+ -if blog.comment && blog.comment.posts.size>0
22
+ Comentarios(
23
+ =blog.comment.posts.size
24
+ )
25
+ %p
26
+ =link_to 'Leer mas, comentar', blog
@@ -0,0 +1,15 @@
1
+ - form_for @blog, :html => { :multipart => true } do |f|
2
+ = f.error_messages
3
+ %p
4
+ = f.label :title
5
+ %br
6
+ = f.text_field :title
7
+ %p
8
+ = f.label :body
9
+ %br
10
+ = f.text_area(:body,:class=>'wysiwyg')
11
+ = wysiwug
12
+ %p
13
+ = f.file_field :image
14
+ %p
15
+ = f.submit
@@ -0,0 +1,8 @@
1
+ - title "Edit Blog"
2
+
3
+ = render 'form'
4
+
5
+ %p
6
+ = link_to "Show", blog_path(@blog)
7
+ |
8
+ = link_to "View All", blogs_path
@@ -0,0 +1,8 @@
1
+ - title "Blogs"
2
+
3
+ -if can? :new, Blog
4
+ = link_to "New Blog", new_blog_path
5
+ - for blog in @blogs
6
+ =render :partial=>'entry',:locals=>{:blog=>blog}
7
+
8
+
@@ -0,0 +1,5 @@
1
+ - title "New Blog"
2
+
3
+ = render 'form'
4
+
5
+ %p= link_to "Back to List", blogs_path
@@ -0,0 +1,4 @@
1
+ - title "Blog"
2
+
3
+ = render :partial=>'entry',:locals=>{:blog=>@blog}
4
+ = render :partial => "comments/index", :locals=>{:table=>@blog}
@@ -0,0 +1,5 @@
1
+ - form_for Post.new do |p|
2
+ = p.hidden_field :comment_id,:value=>table.comment.id
3
+ = p.text_area :body
4
+ %br
5
+ = p.submit
@@ -0,0 +1,19 @@
1
+ - if can? :new, Post
2
+ - form_for Post.new do |p|
3
+ - if Post.new.errors.any?
4
+ #error_explanation
5
+ %h2=pluralize(@post.errors.count, "error")
6
+ prohibited this post from being saved:
7
+ %ul
8
+ - @post.errors.full_messages.each do |msg|
9
+ %li=msg
10
+ = p.hidden_field :comment_id,:value=>table.comment.id
11
+ -if !current_user
12
+ Nombre
13
+ %br
14
+ =p.text_field :name
15
+ %br
16
+ = p.text_area(:body,:class=>'wysiwyg')
17
+ = wysiwug
18
+ %br
19
+ = p.submit
@@ -0,0 +1,26 @@
1
+ - if table.comment
2
+ %h3 Comentarios
3
+ <br>
4
+ #comments
5
+ = render :partial =>'comments/post', :locals=>{:@post=>table.comment.posts}
6
+
7
+
8
+ %br
9
+
10
+
11
+ - if !table.comment.open
12
+ comentario cerrados
13
+ -if can? :abrir, table.comment
14
+ = link_to 'Abrir',{:controller=>'comments',:id=> table.comment.id, :action =>'open'}
15
+ %br
16
+ = link_to 'Quitar comentarios',{:controller=>'comments',:id=> table.comment.id, :action =>'remove'}
17
+ - else
18
+ -if can? :cerrar,table.comment
19
+ = link_to 'Cerrar',{:controller=>'comments',:id=> table.comment.id, :action =>'close'}
20
+ -if can? :new, Post
21
+ = render :partial => "comments/form", :locals=>{:table=>table}
22
+
23
+
24
+ - else
25
+ no hay comentarios
26
+ = link_to 'Habilitar comentarios', "/comments/new?type=#{table.class}&id=#{table.id}"
@@ -0,0 +1,19 @@
1
+ - @post.each do |post|
2
+ .ui-widget-content{:post_id=>post.id , :data_time=>post.created_at.to_i }
3
+ .user.left{:style=>'width:100px; '}
4
+ -if post.user
5
+ = gravatar_url_for(post.user.email)
6
+ -else
7
+ = gravatar_url_for('aasdasasd')
8
+ .title
9
+ -if post.user
10
+ = link_to post.user.username, post.user
11
+ -else
12
+ %b=post.name
13
+ hace
14
+ = time_ago_in_words(post.created_at)
15
+ -if can? :edit, post
16
+ = link_to 'Editar', edit_post_path(post)
17
+ = link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete
18
+ .entry
19
+ = raw post.body
@@ -0,0 +1,14 @@
1
+ - @post.each do |post|
2
+ #post.post{:post_id=>post.id , :data_time=>post.created_at.to_i }
3
+ %div.user
4
+ -if post.user
5
+ = post.user.username
6
+ -else
7
+ =post.name
8
+ = post.created_at
9
+ - if can? :update, post
10
+ = link_to 'Editar', edit_post_path(post)
11
+ - if can? :destroy, post
12
+ = link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete
13
+ %div.entry
14
+ = post.body
@@ -0,0 +1,7 @@
1
+ - form_for @post do |f|
2
+ = f.error_messages
3
+ %p
4
+ = f.text_area(:body,:class=>'wysiwyg')
5
+ = wysiwug
6
+ %p
7
+ = f.submit
@@ -0,0 +1 @@
1
+ $('#comments').append("<%= escape_javascript(raw render(:partial => 'comments/post'))%>");
@@ -0,0 +1,12 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <% form_for resource_name, resource, :url => confirmation_path(resource_name) do |f| %>
4
+ <%= f.error_messages %>
5
+
6
+ <p><%= f.label :email %></p>
7
+ <p><%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Resend confirmation instructions" %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "shared/devise_links" %>
@@ -0,0 +1,12 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Resend confirmation instructions" %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,5 @@
1
+ <p>Welcome <%= @resource.email %>!</p>
2
+
3
+ <p>You can confirm your account through the link below:</p>
4
+
5
+ <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
@@ -0,0 +1,8 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
4
+
5
+ <p>Click the link below to unlock your account:</p>
6
+
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
@@ -0,0 +1,16 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <p><%= f.label :password %><br />
8
+ <%= f.password_field :password %></p>
9
+
10
+ <p><%= f.label :password_confirmation %><br />
11
+ <%= f.password_field :password_confirmation %></p>
12
+
13
+ <p><%= f.submit "Change my password" %></p>
14
+ <% end %>
15
+
16
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,12 @@
1
+ <h2>Forgot your password?</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Send me reset password instructions" %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,28 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :username %><br />
7
+ <%= f.text_field :username %></p>
8
+
9
+ <p><%= f.label :email %><br />
10
+ <%= f.text_field :email %></p>
11
+
12
+ <p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
13
+ <%= f.password_field :password %></p>
14
+
15
+ <p><%= f.label :password_confirmation %><br />
16
+ <%= f.password_field :password_confirmation %></p>
17
+
18
+ <p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
19
+ <%= f.password_field :current_password %></p>
20
+
21
+ <p><%= f.submit "Update" %></p>
22
+ <% end %>
23
+
24
+ <h3>Cancel my account</h3>
25
+
26
+ <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
27
+
28
+ <%= link_to "Back", :back %>
@@ -0,0 +1,21 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :username %><br />
7
+ <%= f.text_field :username %></p>
8
+
9
+ <p><%= f.label :email %><br />
10
+ <%= f.text_field :email %></p>
11
+
12
+ <p><%= f.label :password %><br />
13
+ <%= f.password_field :password %></p>
14
+
15
+ <p><%= f.label :password_confirmation %><br />
16
+ <%= f.password_field :password_confirmation %></p>
17
+
18
+ <p><%= f.submit "Sign up" %></p>
19
+ <% end %>
20
+
21
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,17 @@
1
+ <h2>Entrar</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4
+ <p><%= f.label 'Nombre' %><br />
5
+ <%= f.text_field :username %></p>
6
+
7
+ <p><%= f.label 'Clave' %><br />
8
+ <%= f.password_field :password %></p>
9
+
10
+ <% if devise_mapping.rememberable? -%>
11
+ <p><%= f.check_box :remember_me %> <%= f.label 'Recordarme' %></p>
12
+ <% end -%>
13
+
14
+ <p><%= f.submit "Conectar" %></p>
15
+ <% end %>
16
+
17
+ <%= render :partial => "devise/shared/links" %>
@@ -0,0 +1,19 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Entrar", new_session_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Registrarse", new_registration_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10
+ <%= link_to "¿Olvidaste tu clave?", new_password_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Resend unlock instructions" %></p>
10
+ <% end %>
11
+
12
+ <%= render :partial => "devise/shared/links" %>