wheels 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/VERSION +1 -1
  2. data/lib/generators/wheels/wheels_generator.rb +1 -1
  3. data/wheels.gemspec +1 -103
  4. metadata +3 -105
  5. data/app/controllers/application_controller.rb +0 -17
  6. data/app/controllers/blogs_controller.rb +0 -17
  7. data/app/controllers/galleries_controller.rb +0 -60
  8. data/app/controllers/images_controller.rb +0 -30
  9. data/app/controllers/profiles_controller.rb +0 -16
  10. data/app/controllers/users_controller.rb +0 -4
  11. data/app/models/ability.rb +0 -23
  12. data/app/models/blog.rb +0 -8
  13. data/app/models/gallery.rb +0 -5
  14. data/app/models/image.rb +0 -8
  15. data/app/models/profile.rb +0 -11
  16. data/app/models/role.rb +0 -8
  17. data/app/models/user.rb +0 -43
  18. data/app/views/blogs/_form.html.haml +0 -28
  19. data/app/views/blogs/edit.html.haml +0 -8
  20. data/app/views/blogs/index.html.haml +0 -19
  21. data/app/views/blogs/index.xml.builder +0 -27
  22. data/app/views/blogs/new.html.haml +0 -6
  23. data/app/views/blogs/show.html.haml +0 -10
  24. data/app/views/galleries/_form.html.haml +0 -29
  25. data/app/views/galleries/_show.html.haml +0 -21
  26. data/app/views/galleries/edit.html.haml +0 -7
  27. data/app/views/galleries/index.html.haml +0 -15
  28. data/app/views/galleries/new.html.haml +0 -5
  29. data/app/views/galleries/show.html.haml +0 -4
  30. data/app/views/images/_form.html.haml +0 -10
  31. data/app/views/images/create.js.haml +0 -3
  32. data/app/views/images/destroy.js.haml +0 -3
  33. data/app/views/images/edit.html.haml +0 -7
  34. data/app/views/images/edit.js.haml +0 -3
  35. data/app/views/images/index.html.haml +0 -17
  36. data/app/views/images/index.js.haml +0 -3
  37. data/app/views/images/new.html.haml +0 -5
  38. data/app/views/images/new.js.haml +0 -3
  39. data/app/views/images/show.html.haml +0 -5
  40. data/app/views/images/show.js.haml +0 -3
  41. data/app/views/images/update.js.haml +0 -3
  42. data/app/views/layouts/image_dialog.html.haml +0 -18
  43. data/app/views/profiles/_form.html.haml +0 -26
  44. data/app/views/profiles/edit.html.haml +0 -7
  45. data/app/views/profiles/index.html.haml +0 -25
  46. data/app/views/profiles/new.html.haml +0 -5
  47. data/app/views/profiles/show.html.haml +0 -21
  48. data/app/views/users/index.html.haml +0 -19
  49. data/config/amazon_s3.yml +0 -15
  50. data/db/migrate/add_fields_to_users.rb +0 -28
  51. data/db/migrate/create_blogs.rb +0 -16
  52. data/db/migrate/create_galleries.rb +0 -15
  53. data/db/migrate/create_images.rb +0 -17
  54. data/db/migrate/create_profiles.rb +0 -24
  55. data/db/migrate/create_roles.rb +0 -16
  56. data/public/404.html +0 -26
  57. data/public/422.html +0 -26
  58. data/public/500.html +0 -26
  59. data/public/favicon.ico +0 -0
  60. data/public/images/dreamy/Thumbs.db +0 -0
  61. data/public/images/dreamy/bg-ad-top.png +0 -0
  62. data/public/images/dreamy/bg-body.png +0 -0
  63. data/public/images/dreamy/bg-feed.gif +0 -0
  64. data/public/images/dreamy/bg-footer.jpg +0 -0
  65. data/public/images/dreamy/bg-header.jpg +0 -0
  66. data/public/images/dreamy/bg-menu-hover.png +0 -0
  67. data/public/images/dreamy/bg-menu.png +0 -0
  68. data/public/images/dreamy/bg-sidebar-bottom.gif +0 -0
  69. data/public/images/dreamy/button-feed.png +0 -0
  70. data/public/images/dreamy/icon-comment.png +0 -0
  71. data/public/images/growl/error.png +0 -0
  72. data/public/images/growl/growl_bottom.png +0 -0
  73. data/public/images/growl/growl_repeat.png +0 -0
  74. data/public/images/growl/growl_top.png +0 -0
  75. data/public/images/growl/info.png +0 -0
  76. data/public/images/menu/item-pointer-mover.gif +0 -0
  77. data/public/images/menu/item-pointer.gif +0 -0
  78. data/public/images/menu/lava.gif +0 -0
  79. data/public/images/menu/lava.png +0 -0
  80. data/public/images/menu/main-bg.png +0 -0
  81. data/public/images/menu/main-delimiter.png +0 -0
  82. data/public/javascripts/jquery.growl.js +0 -143
  83. data/public/javascripts/loadbehind.js +0 -0
  84. data/public/javascripts/menu.js +0 -247
  85. data/public/stylesheets/.gitkeep +0 -0
  86. data/public/stylesheets/dreamy.css +0 -181
  87. data/public/stylesheets/menu.css +0 -101
  88. data/public/stylesheets/sass/dreamy.sass +0 -195
  89. data/public/stylesheets/sass/menu.sass +0 -105
  90. data/public/stylesheets/scaffold.css +0 -56
  91. data/public/stylesheets/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
  92. data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  93. data/public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  94. data/public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  95. data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  96. data/public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  97. data/public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  98. data/public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  99. data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  100. data/public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  101. data/public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  102. data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  103. data/public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  104. data/public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  105. data/public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  106. data/public/stylesheets/ui-lightness/jquery-ui-1.8.2.custom.css +0 -359
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -6,7 +6,7 @@ require 'rails/generators/active_record'
6
6
  class WheelsGenerator < Rails::Generators::Base
7
7
  include Rails::Generators::Migration
8
8
  require File.join(File.dirname(__FILE__), 'core_extensions.rb')
9
- source_root File.expand_path('../../../../', __FILE__)
9
+ source_root File.expand_path('../templates/wheels/', __FILE__)
10
10
  desc "Installs files needed for App Template gem."
11
11
 
12
12
  # argument :scope, :required => false, :default => nil,
data/wheels.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wheels}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler Gannon"]
@@ -23,57 +23,6 @@ Gem::Specification.new do |s|
23
23
  "README.rdoc",
24
24
  "Rakefile",
25
25
  "VERSION",
26
- "app/controllers/application_controller.rb",
27
- "app/controllers/blogs_controller.rb",
28
- "app/controllers/galleries_controller.rb",
29
- "app/controllers/images_controller.rb",
30
- "app/controllers/profiles_controller.rb",
31
- "app/controllers/users_controller.rb",
32
- "app/models/ability.rb",
33
- "app/models/blog.rb",
34
- "app/models/gallery.rb",
35
- "app/models/image.rb",
36
- "app/models/profile.rb",
37
- "app/models/role.rb",
38
- "app/models/user.rb",
39
- "app/views/blogs/_form.html.haml",
40
- "app/views/blogs/edit.html.haml",
41
- "app/views/blogs/index.html.haml",
42
- "app/views/blogs/index.xml.builder",
43
- "app/views/blogs/new.html.haml",
44
- "app/views/blogs/show.html.haml",
45
- "app/views/galleries/_form.html.haml",
46
- "app/views/galleries/_show.html.haml",
47
- "app/views/galleries/edit.html.haml",
48
- "app/views/galleries/index.html.haml",
49
- "app/views/galleries/new.html.haml",
50
- "app/views/galleries/show.html.haml",
51
- "app/views/images/_form.html.haml",
52
- "app/views/images/create.js.haml",
53
- "app/views/images/destroy.js.haml",
54
- "app/views/images/edit.html.haml",
55
- "app/views/images/edit.js.haml",
56
- "app/views/images/index.html.haml",
57
- "app/views/images/index.js.haml",
58
- "app/views/images/new.html.haml",
59
- "app/views/images/new.js.haml",
60
- "app/views/images/show.html.haml",
61
- "app/views/images/show.js.haml",
62
- "app/views/images/update.js.haml",
63
- "app/views/layouts/image_dialog.html.haml",
64
- "app/views/profiles/_form.html.haml",
65
- "app/views/profiles/edit.html.haml",
66
- "app/views/profiles/index.html.haml",
67
- "app/views/profiles/new.html.haml",
68
- "app/views/profiles/show.html.haml",
69
- "app/views/users/index.html.haml",
70
- "config/amazon_s3.yml",
71
- "db/migrate/add_fields_to_users.rb",
72
- "db/migrate/create_blogs.rb",
73
- "db/migrate/create_galleries.rb",
74
- "db/migrate/create_images.rb",
75
- "db/migrate/create_profiles.rb",
76
- "db/migrate/create_roles.rb",
77
26
  "init.rb",
78
27
  "lib/generators/wheels/LICENCE",
79
28
  "lib/generators/wheels/USAGE",
@@ -103,57 +52,6 @@ Gem::Specification.new do |s|
103
52
  "lib/generators/wheels/wheels_generator.rb",
104
53
  "lib/wheels.rb",
105
54
  "lib/wheels/routes.rb",
106
- "public/404.html",
107
- "public/422.html",
108
- "public/500.html",
109
- "public/favicon.ico",
110
- "public/images/dreamy/Thumbs.db",
111
- "public/images/dreamy/bg-ad-top.png",
112
- "public/images/dreamy/bg-body.png",
113
- "public/images/dreamy/bg-feed.gif",
114
- "public/images/dreamy/bg-footer.jpg",
115
- "public/images/dreamy/bg-header.jpg",
116
- "public/images/dreamy/bg-menu-hover.png",
117
- "public/images/dreamy/bg-menu.png",
118
- "public/images/dreamy/bg-sidebar-bottom.gif",
119
- "public/images/dreamy/button-feed.png",
120
- "public/images/dreamy/icon-comment.png",
121
- "public/images/growl/error.png",
122
- "public/images/growl/growl_bottom.png",
123
- "public/images/growl/growl_repeat.png",
124
- "public/images/growl/growl_top.png",
125
- "public/images/growl/info.png",
126
- "public/images/menu/item-pointer-mover.gif",
127
- "public/images/menu/item-pointer.gif",
128
- "public/images/menu/lava.gif",
129
- "public/images/menu/lava.png",
130
- "public/images/menu/main-bg.png",
131
- "public/images/menu/main-delimiter.png",
132
- "public/javascripts/jquery.growl.js",
133
- "public/javascripts/loadbehind.js",
134
- "public/javascripts/menu.js",
135
- "public/stylesheets/.gitkeep",
136
- "public/stylesheets/dreamy.css",
137
- "public/stylesheets/menu.css",
138
- "public/stylesheets/sass/dreamy.sass",
139
- "public/stylesheets/sass/menu.sass",
140
- "public/stylesheets/scaffold.css",
141
- "public/stylesheets/ui-lightness/images/ui-anim_basic_16x16.gif",
142
- "public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png",
143
- "public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png",
144
- "public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png",
145
- "public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png",
146
- "public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png",
147
- "public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png",
148
- "public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png",
149
- "public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png",
150
- "public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png",
151
- "public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png",
152
- "public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png",
153
- "public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png",
154
- "public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png",
155
- "public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png",
156
- "public/stylesheets/ui-lightness/jquery-ui-1.8.2.custom.css",
157
55
  "send_new_version",
158
56
  "test/helper.rb",
159
57
  "test/test_wheels.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wheels
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon
@@ -48,57 +48,6 @@ files:
48
48
  - README.rdoc
49
49
  - Rakefile
50
50
  - VERSION
51
- - app/controllers/application_controller.rb
52
- - app/controllers/blogs_controller.rb
53
- - app/controllers/galleries_controller.rb
54
- - app/controllers/images_controller.rb
55
- - app/controllers/profiles_controller.rb
56
- - app/controllers/users_controller.rb
57
- - app/models/ability.rb
58
- - app/models/blog.rb
59
- - app/models/gallery.rb
60
- - app/models/image.rb
61
- - app/models/profile.rb
62
- - app/models/role.rb
63
- - app/models/user.rb
64
- - app/views/blogs/_form.html.haml
65
- - app/views/blogs/edit.html.haml
66
- - app/views/blogs/index.html.haml
67
- - app/views/blogs/index.xml.builder
68
- - app/views/blogs/new.html.haml
69
- - app/views/blogs/show.html.haml
70
- - app/views/galleries/_form.html.haml
71
- - app/views/galleries/_show.html.haml
72
- - app/views/galleries/edit.html.haml
73
- - app/views/galleries/index.html.haml
74
- - app/views/galleries/new.html.haml
75
- - app/views/galleries/show.html.haml
76
- - app/views/images/_form.html.haml
77
- - app/views/images/create.js.haml
78
- - app/views/images/destroy.js.haml
79
- - app/views/images/edit.html.haml
80
- - app/views/images/edit.js.haml
81
- - app/views/images/index.html.haml
82
- - app/views/images/index.js.haml
83
- - app/views/images/new.html.haml
84
- - app/views/images/new.js.haml
85
- - app/views/images/show.html.haml
86
- - app/views/images/show.js.haml
87
- - app/views/images/update.js.haml
88
- - app/views/layouts/image_dialog.html.haml
89
- - app/views/profiles/_form.html.haml
90
- - app/views/profiles/edit.html.haml
91
- - app/views/profiles/index.html.haml
92
- - app/views/profiles/new.html.haml
93
- - app/views/profiles/show.html.haml
94
- - app/views/users/index.html.haml
95
- - config/amazon_s3.yml
96
- - db/migrate/add_fields_to_users.rb
97
- - db/migrate/create_blogs.rb
98
- - db/migrate/create_galleries.rb
99
- - db/migrate/create_images.rb
100
- - db/migrate/create_profiles.rb
101
- - db/migrate/create_roles.rb
102
51
  - init.rb
103
52
  - lib/generators/wheels/LICENCE
104
53
  - lib/generators/wheels/USAGE
@@ -128,57 +77,6 @@ files:
128
77
  - lib/generators/wheels/wheels_generator.rb
129
78
  - lib/wheels.rb
130
79
  - lib/wheels/routes.rb
131
- - public/404.html
132
- - public/422.html
133
- - public/500.html
134
- - public/favicon.ico
135
- - public/images/dreamy/Thumbs.db
136
- - public/images/dreamy/bg-ad-top.png
137
- - public/images/dreamy/bg-body.png
138
- - public/images/dreamy/bg-feed.gif
139
- - public/images/dreamy/bg-footer.jpg
140
- - public/images/dreamy/bg-header.jpg
141
- - public/images/dreamy/bg-menu-hover.png
142
- - public/images/dreamy/bg-menu.png
143
- - public/images/dreamy/bg-sidebar-bottom.gif
144
- - public/images/dreamy/button-feed.png
145
- - public/images/dreamy/icon-comment.png
146
- - public/images/growl/error.png
147
- - public/images/growl/growl_bottom.png
148
- - public/images/growl/growl_repeat.png
149
- - public/images/growl/growl_top.png
150
- - public/images/growl/info.png
151
- - public/images/menu/item-pointer-mover.gif
152
- - public/images/menu/item-pointer.gif
153
- - public/images/menu/lava.gif
154
- - public/images/menu/lava.png
155
- - public/images/menu/main-bg.png
156
- - public/images/menu/main-delimiter.png
157
- - public/javascripts/jquery.growl.js
158
- - public/javascripts/loadbehind.js
159
- - public/javascripts/menu.js
160
- - public/stylesheets/.gitkeep
161
- - public/stylesheets/dreamy.css
162
- - public/stylesheets/menu.css
163
- - public/stylesheets/sass/dreamy.sass
164
- - public/stylesheets/sass/menu.sass
165
- - public/stylesheets/scaffold.css
166
- - public/stylesheets/ui-lightness/images/ui-anim_basic_16x16.gif
167
- - public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
168
- - public/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
169
- - public/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
170
- - public/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png
171
- - public/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png
172
- - public/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png
173
- - public/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
174
- - public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
175
- - public/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
176
- - public/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png
177
- - public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png
178
- - public/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png
179
- - public/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png
180
- - public/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png
181
- - public/stylesheets/ui-lightness/jquery-ui-1.8.2.custom.css
182
80
  - send_new_version
183
81
  - test/helper.rb
184
82
  - test/test_wheels.rb
@@ -1,17 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
-
3
- def self.authorized
4
- class_eval do
5
- def resource
6
- authorize_this
7
- super
8
- end
9
- end
10
- end
11
-
12
- def authorize_this
13
- authorize! resource, params[:action] unless @authorized
14
- @authorized = true
15
- end
16
- end
17
-
@@ -1,17 +0,0 @@
1
- class BlogsController < InheritedResources::Base
2
- respond_to :html, :xml
3
- belongs_to :user, :optional=>true
4
- before_filter :load_current_user
5
-
6
- def collection
7
- @blogs ||= end_of_association_chain.
8
- paginate(:page => params[:page], :order => 'created_at DESC' )
9
- end
10
-
11
- def load_current_user
12
- unless params[:user_id]
13
- @user ||= (current_user ? User.find(current_user.id) : User.super_user)
14
- end
15
- end
16
- end
17
-
@@ -1,60 +0,0 @@
1
- class GalleriesController < InheritedResources::Base
2
- belongs_to :user, :optional=>true
3
- before_filter :load_user
4
-
5
- def index
6
- index! do |format|
7
- if params[:CKEditorFuncNum]
8
- format.html{
9
- render :action=>:index, :layout=>"image_dialog"
10
- }
11
- end
12
- end
13
- end
14
-
15
- def edit
16
- edit! do |format|
17
- if params[:CKEditorFuncNum]
18
- format.html{
19
- render :action=>:edit, :layout=>"image_dialog"
20
- }
21
- end
22
- end
23
- end
24
-
25
- def show
26
- show! do |format|
27
- images = paginated_images_for(@gallery)
28
- if params[:CKEditorFuncNum]
29
- format.html{
30
- render :action=>:show, :layout=>"image_dialog", :locals=>{:images=>images}
31
- }
32
- end
33
- end
34
- end
35
-
36
- def new
37
- @gallery = Gallery.create(:user=>@user)
38
- new!
39
- end
40
-
41
- def create
42
- create! {images_path(params.slice(:CKEditor, :CKEditorFuncNum, :langCode))}
43
- end
44
-
45
- def load_user
46
- unless params[:user_id]
47
- @user ||= (current_user ? User.find(current_user.id) : User.super_user)
48
- end
49
- end
50
- helper_method :ckeditor_params, :paginated_images_for
51
-
52
- def paginated_images_for(gallery)
53
- @images ||= Image.where(:gallery_id=>gallery.id).paginate(:page => params[:page], :order => 'created_at DESC' )
54
- end
55
-
56
- def ckeditor_params
57
- params.slice(:CKEditor, :CKEditorFuncNum, :langCode)
58
- end
59
- end
60
-
@@ -1,30 +0,0 @@
1
- class ImagesController < InheritedResources::Base
2
- respond_to :html, :js, :xml
3
- belongs_to :gallery
4
-
5
- def index
6
- index! do |format|
7
- if params[:CKEditorFuncNum]
8
- format.html {render :action=>:index, :layout=>"image_dialog"}
9
- end
10
- end
11
- end
12
-
13
- def create
14
- create! {edit_gallery_path(@gallery, params.slice(:CKEditor, :CKEditorFuncNum, :langCode))}
15
- end
16
-
17
- def show
18
- show! do |format|
19
- if params[:CKEditorFuncNum]
20
- format.html {render :layout=>"image_dialog"}
21
- end
22
- end
23
- end
24
-
25
- def collection
26
- @images ||= end_of_association_chain.
27
- paginate(:page => params[:page], :order => 'created_at DESC' )
28
- end
29
- end
30
-
@@ -1,16 +0,0 @@
1
- class ProfilesController < InheritedResources::Base
2
- respond_to :html
3
- before_filter :load_current_user
4
- belongs_to :user, :optional => true, :singleton=>true
5
-
6
- def load_current_user
7
- unless params[:user_id]
8
- @user ||= (current_user ? User.find(current_user.id) : User.super_user)
9
- end
10
- end
11
-
12
- def resource
13
- @profile ||= Profile.find_by_user_id(@user.id)
14
- end
15
- end
16
-
@@ -1,4 +0,0 @@
1
- class UsersController < InheritedResources::Base
2
-
3
- end
4
-
@@ -1,23 +0,0 @@
1
- class Ability
2
- include CanCan::Ability
3
-
4
- def initialize(user)
5
- can :read, :all
6
- return cannot :read, User unless user
7
- user ||= User.new
8
- case user.role_id
9
- when Role::SUPER
10
- can :manage, :all
11
- when Role::ADMIN
12
- can :manage, :all
13
- when Role::USER
14
- can :manage, Gallery, :user_id => user.id
15
- can :manage, Blog, :user_id => user.id
16
- can :edit, Profile, :user_id => user.id
17
- cannot :read, User
18
- end
19
- can :read, :all
20
-
21
- end
22
- end
23
-
data/app/models/blog.rb DELETED
@@ -1,8 +0,0 @@
1
- class Blog < ActiveRecord::Base
2
- belongs_to :user
3
- validates_presence_of :user_id
4
- has_many :images
5
- cattr_reader :per_page
6
- @@per_page = 5
7
- end
8
-
@@ -1,5 +0,0 @@
1
- class Gallery < ActiveRecord::Base
2
- belongs_to :user
3
- has_many :images, :dependent=>:destroy
4
- end
5
-
data/app/models/image.rb DELETED
@@ -1,8 +0,0 @@
1
- class Image < ActiveRecord::Base
2
- belongs_to :gallery
3
- has_attached_file :image,
4
- :storage => :s3,
5
- :s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
6
- :path => "/:style/:filename"
7
- end
8
-
@@ -1,11 +0,0 @@
1
- class Profile < ActiveRecord::Base
2
- belongs_to :user
3
- validates_uniqueness_of :alias
4
- has_attached_file :image,
5
- :storage => :s3,
6
- :s3_credentials => "#{Rails.root}/config/amazon_s3.yml",
7
- :path => "/:style/:filename",
8
- :styles => { :medium => "300x300>", :thumb => "100x100>" }
9
-
10
- end
11
-
data/app/models/role.rb DELETED
@@ -1,8 +0,0 @@
1
- class Role < ActiveRecord::Base
2
- has_many :users
3
-
4
- SUPER = 1
5
- ADMIN = 2
6
- USER = 3
7
- end
8
-
data/app/models/user.rb DELETED
@@ -1,43 +0,0 @@
1
- class User < ActiveRecord::Base
2
- before_create :create_profile
3
- belongs_to :role
4
-
5
- # Include default devise modules. Others available are:
6
- # :token_authenticatable, :confirmable, :lockable and :timeoutable
7
- devise :database_authenticatable, :registerable, :confirmable, :token_authenticatable,
8
- :recoverable, :rememberable, :trackable, :validatable
9
-
10
- def self.super_user
11
- @@super_user ||= User.where(:role_id=>Role::SUPER).first
12
- end
13
-
14
- has_many :blogs, :dependent => :destroy
15
- has_one :profile, :dependent => :destroy
16
- has_many :galleries, :dependent => :destroy
17
-
18
- def create_profile
19
- self.profile ||= Profile.create(:user => self)
20
- end
21
-
22
- def role=(role)
23
- if role.kind_of? Role
24
- self.role_id = role.id
25
- else
26
- if role.is_numeric?
27
- self.role_id= role
28
- else
29
- self.role_id= Role.find_by_name(role).id
30
- end
31
- end
32
- end
33
-
34
- def confirm!
35
- self.confirmed_at = DateTime::now
36
- save
37
- end
38
-
39
- # Setup accessible (or protected) attributes for your model
40
- attr_accessible :email, :password, :password_confirmation,
41
- :blogs, :profile, :role, :galleries
42
- end
43
-
@@ -1,28 +0,0 @@
1
- = content_for(:head) do
2
- = javascript_include_tag '/ckeditor/ckeditor.js'
3
- = javascript_include_tag '/ckeditor/adapters/jquery.js'
4
- :javascript
5
- $(function(){
6
- config = {
7
- filebrowserBrowseUrl : '#{galleries_path}'
8
- };
9
- $('.ckeditor_textarea').ckeditor(config);
10
- });
11
-
12
- = form_for [@blog.user, @blog], :html=>{:multipart=>true} do |f|
13
- -if @blog.errors.any?
14
- #errorExplanation
15
- %h2= "#{pluralize(@blog.errors.count, "error")} prohibited this blog from being saved:"
16
- %ul
17
- - @blog.errors.full_messages.each do |msg|
18
- %li= msg
19
-
20
- .field
21
- = f.label :title
22
- = f.text_field :title
23
- .field
24
- = f.label :body
25
- = f.text_area :body, :class=>'ckeditor_textarea'
26
- .actions
27
- = f.submit 'Save'
28
-
@@ -1,8 +0,0 @@
1
- %h1 Editing blog
2
-
3
- = render 'form'
4
-
5
- = link_to 'Show', resource_url
6
- \|
7
- = link_to 'Back', collection_url
8
-
@@ -1,19 +0,0 @@
1
- %h1 Someone's Blog
2
-
3
- - @blogs.each do |blog|
4
- #ad-top
5
- / Insert 468x60 banner advertisement
6
- .entry
7
- .entry-title= link_to blog.title, resource_url(blog)
8
-
9
- .date Posted on #{blog.created_at}
10
- .blog_body!= blog.body
11
- .comments
12
- %a{:href => "#"} 3 comments
13
-
14
-
15
- - if current_user.try(:id) == @user.id
16
- = link_to 'New Blog Post', new_user_blog_path(@user)
17
-
18
- = will_paginate @blogs
19
-
@@ -1,27 +0,0 @@
1
- xml.instruct!
2
-
3
- xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
4
-
5
- xml.title "Feed Name"
6
- xml.link "rel" => "self", "href" => user_blogs_path(@user, :only_path=>false, :format=>:xml)
7
- # xml.link "rel" => "alternate", "href" => url_for(:only_path => false, :controller => 'posts')
8
- xml.id user_blogs_path(@user, :only_path => false)
9
- xml.updated @blogs.first.updated_at.strftime "%Y-%m-%dT%H:%M:%SZ" if @blogs.any?
10
- xml.author { xml.name @blogs.first }
11
-
12
- @blogs.each do |post|
13
- xml.entry do
14
- xml.title post.title
15
- xml.link "rel" => "alternate", "href" => user_blogs_path(@user, post, :only_path => false)
16
- xml.id user_blog_path(@user, post, :only_path => false)
17
- xml.updated post.updated_at.strftime "%Y-%m-%dT%H:%M:%SZ"
18
- xml.author { xml.name post.user.email }
19
- xml.summary "Post summary"
20
- xml.content "type" => "html" do
21
- xml.cdata! post.body
22
- end
23
- end
24
- end
25
-
26
- end
27
-
@@ -1,6 +0,0 @@
1
- %h1 New blog
2
-
3
- = render 'form'
4
-
5
- = link_to 'Back', collection_url
6
-
@@ -1,10 +0,0 @@
1
- %p
2
- %b Title:
3
- = @blog.title
4
- %p
5
- %b Body:
6
- = raw @blog.body
7
- = link_to 'Edit', edit_resource_url
8
- \|
9
- = link_to 'Back', collection_url
10
-
@@ -1,29 +0,0 @@
1
- :css
2
- #image_gallery li {
3
- display: inline;
4
- list-style: none;
5
- width: 300px;
6
- min-height: 300px;
7
- float: left;
8
- margin: 0 10px 10px 0;
9
- text-align: center;
10
- }
11
- = form_for @gallery do |f|
12
- %h2 Gallery Name:
13
- = f.text_field :name
14
- = f.submit "Save Gallery"
15
-
16
- %ul#image_gallery
17
- - paginated_images_for(@gallery).each do |image|
18
- %li
19
- = image_tag image.image.url(:medium)
20
-
21
- = will_paginate paginated_images_for(@gallery)
22
-
23
- #upload_form
24
- = form_for [@gallery, Image.new(:gallery=>@gallery)], :html=>{:id=>'upload', :multipart=>true} do |f|
25
- - params.slice(:CKEditor, :CKEditorFuncNum, :langCode).each do |key, val|
26
- = hidden_field_tag key, val
27
- = f.file_field :image
28
- = f.submit :disable_with=>"Uploading..."
29
-