refinerycms 0.9.6.5 → 0.9.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/application.rb +1 -1
- data/app/controllers/application_controller.rb +1 -1
- data/config/environment.rb +2 -2
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/preinitializer.rb +1 -1
- data/db/migrate/20100114092849_add_themes_table.rb +12 -12
- data/db/migrate/20100202034802_remove_custom_title_image_id_and_image_id_from_pages.rb +6 -6
- data/db/schema.rb +1 -1
- data/db/seeds.rb +2 -2
- data/lib/refinery_initializer.rb +1 -1
- data/public/javascripts/refinery/admin.js +61 -61
- data/readme.md +3 -3
- data/test/files/The world!.gif +0 -0
- data/test/files/car-wallpapers19.jpg +0 -0
- data/test/fixtures/images.yml +14 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/image_test.rb +19 -8
- data/test/unit/page_part_test.rb +11 -11
- data/test/unit/page_test.rb +125 -125
- data/vendor/plugins/authentication/app/controllers/users_controller.rb +20 -20
- data/vendor/plugins/authentication/app/models/user.rb +5 -5
- data/vendor/plugins/authentication/app/views/user_mailer/reset_notification.html.erb +2 -2
- data/vendor/plugins/authentication/app/views/users/forgot.html.erb +1 -1
- data/vendor/plugins/authentication/app/views/users/reset.html.erb +2 -2
- data/vendor/plugins/authentication/config/routes.rb +4 -4
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +1 -1
- data/vendor/plugins/dashboard/app/views/admin/dashboard/_recent_activity.html.erb +1 -1
- data/vendor/plugins/dashboard/rails/init.rb +1 -1
- data/vendor/plugins/images/app/models/image.rb +14 -14
- data/vendor/plugins/images/app/views/admin/images/_form.html.erb +1 -8
- data/vendor/plugins/images/app/views/admin/images/insert.html.erb +1 -1
- data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +3 -3
- data/vendor/plugins/inquiries/app/views/inquiries/new.html.erb +1 -1
- data/vendor/plugins/inquiries/app/views/inquiries/thank_you.html.erb +1 -1
- data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/controllers/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/views/news_items/index.html.erb +1 -1
- data/vendor/plugins/news/app/views/news_items/show.html.erb +1 -1
- data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +1 -1
- data/vendor/plugins/pages/app/models/page.rb +42 -42
- data/vendor/plugins/pages/app/models/page_part.rb +1 -1
- data/vendor/plugins/pages/app/presenters/page_presenter.rb +1 -1
- data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_list.html.erb +1 -1
- data/vendor/plugins/pages/app/views/admin/pages/_page_part_field.html.erb +1 -1
- data/vendor/plugins/pages/app/views/pages/home.html.erb +1 -1
- data/vendor/plugins/pages/app/views/pages/show.html.erb +1 -1
- data/vendor/plugins/pages/rails/init.rb +5 -5
- data/vendor/plugins/rails_indexes/lib/indexer.rb +49 -47
- data/vendor/plugins/rails_indexes/tasks/indexer.rake +5 -3
- data/vendor/plugins/rails_indexes/test/fixtures/app/controllers/users_controller.rb +3 -3
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/address.rb +2 -2
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/company.rb +4 -4
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/country.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/freelancer.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/gift.rb +4 -4
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/god.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/app/models/user.rb +7 -6
- data/vendor/plugins/rails_indexes/test/fixtures/app/sweepers/user_sweeper.rb +1 -1
- data/vendor/plugins/rails_indexes/test/fixtures/schema.rb +9 -9
- data/vendor/plugins/rails_indexes/test/rails_indexes_test.rb +18 -18
- data/vendor/plugins/refinery/app/views/admin/_head.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/layouts/application.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_content_page.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_head.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_header.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb +5 -5
- data/vendor/plugins/refinery/app/views/shared/_submenu.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_continue_editing.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_error_messages_for.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb +27 -13
- data/vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/admin/_sortable_list.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/model.rb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_sortable_list.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/index.html.erb +2 -2
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/index.html.erb +1 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/views/show.html.erb +1 -1
- data/vendor/plugins/refinery/lib/refinery/activity.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +4 -4
- data/vendor/plugins/refinery/lib/refinery/application_helper.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/base_presenter.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +1 -1
- data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +1 -1
- data/vendor/plugins/resources/app/models/resource.rb +8 -8
- data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +1 -1
- data/vendor/plugins/resources/app/views/admin/resources/index.html.erb +1 -1
- data/vendor/plugins/resources/app/views/admin/resources/insert.html.erb +1 -1
- data/vendor/plugins/resources/config/routes.rb +2 -2
- data/vendor/plugins/resources/rails/init.rb +1 -1
- data/vendor/plugins/themes/app/controllers/admin/themes_controller.rb +17 -17
- data/vendor/plugins/themes/app/models/theme.rb +40 -40
- data/vendor/plugins/themes/app/views/admin/themes/_form.html.erb +1 -1
- data/vendor/plugins/themes/config/routes.rb +2 -2
- data/vendor/plugins/themes/lib/theme_server.rb +26 -0
- data/vendor/plugins/themes/rails/init.rb +3 -1
- metadata +6 -3
- data/vendor/plugins/themes/app/controllers/themes_controller.rb +0 -45
data/test/unit/page_test.rb
CHANGED
@@ -1,130 +1,130 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PageTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
|
5
|
+
fixtures :pages, :page_parts
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@new_page = Page.new
|
9
|
+
end
|
10
|
+
|
11
11
|
def test_should_not_save_page_without_title
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
12
|
+
assert !@new_page.save, "Saved the page without a title"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_stop_system_pages_from_being_deleted
|
16
|
+
assert_equal false, pages(:home_page).deletable?
|
17
|
+
assert_equal false, pages(:page_not_found).destroy
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_allow_normal_pages_to_be_deleted
|
21
|
+
assert_equal true, pages(:services).deletable?
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_should_stop_custom_link_pages_from_being_deleted
|
25
|
+
assert_equal false, pages(:contact_us).deletable?
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_page_tree_structure
|
29
|
+
assert_equal 1, pages(:draft_page_child).ancestors.size
|
30
|
+
assert_equal pages(:draft_page), pages(:draft_page_child).ancestors.first
|
31
|
+
assert_equal 0, pages(:home_page).ancestors.size
|
32
|
+
|
33
|
+
assert_equal 3, pages(:products).children.size
|
34
|
+
assert_equal pages(:products), pages(:blue_jelly).ancestors.first
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_should_have_custom_seo_settings
|
38
|
+
assert_equal "Services", pages(:services).path
|
39
|
+
assert_equal "Secret Product - Secret information about secret product", pages(:draft_page_child).path
|
40
|
+
assert_equal "Secret information about secret product - Secret Product", pages(:draft_page_child).path(reverse = false)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_should_force_a_non_deletable_page_to_be_deleted
|
44
|
+
assert_equal Page, pages(:page_not_found).destroy!.class # not .destroy. Returns the page you just destroyed
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_have_custom_url_override
|
48
|
+
assert_equal "/inquiries/new", pages(:contact_us).url # the contact us page links to the inquiries plugin form
|
49
|
+
assert_equal "/", pages(:home_page).url # the home page has a special "/" url
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_have_regular_url
|
53
|
+
assert pages(:services).url.include? "/pages/"
|
54
|
+
# not sure how I get it to render the friendly_id url /pages/services
|
55
|
+
# test seems to reduce the id instead e.g. /pages/234423
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_drafts
|
59
|
+
assert_equal false, pages(:draft_page).live? # the draft page is indeed a draft
|
60
|
+
assert_equal true, pages(:home_page).live? # the home page is not a draft
|
61
|
+
assert_equal true, pages(:draft_page_child).live? # child pages with draft parents should be drafts too
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_home_page
|
65
|
+
assert pages(:home_page).home?
|
66
|
+
assert !pages(:services).home?
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_in_menu_logic
|
70
|
+
assert_equal true, pages(:home_page).in_menu? # home page should be in menu
|
71
|
+
assert_equal false, pages(:draft_page_child).in_menu? # child pages with draft parents should be hidden
|
72
|
+
assert_equal false, pages(:draft_page).in_menu? # draft pages should be hidden
|
73
|
+
|
74
|
+
pages(:home_page).toggle!(:draft) # make the page a draft
|
75
|
+
assert_equal false, pages(:home_page).live? # home page is no longer live
|
76
|
+
assert_equal false, pages(:home_page).in_menu? # it should also not appear in the menu now
|
77
|
+
|
78
|
+
pages(:home_page).toggle!(:draft) # make the page live again
|
79
|
+
assert_equal true, pages(:home_page).in_menu? # home page should reappear in the menu
|
80
|
+
|
81
|
+
pages(:home_page).toggle!(:show_in_menu) # now let's hide the home page from the menu
|
82
|
+
assert_equal false, pages(:home_page).in_menu? # yep, it's hidden.
|
83
|
+
|
84
84
|
assert_equal false, pages(:thank_you).in_menu? # a live page that's hidden should not show in menu
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_shown_siblings
|
88
|
+
assert_equal 3, pages(:products).children.size
|
89
|
+
assert_equal 3, pages(:products).shown_siblings.size
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_top_level_page_output
|
93
|
+
assert_equal 4, Page.top_level.size
|
94
|
+
|
95
|
+
# testing the order of pages.
|
96
|
+
assert_equal pages(:home_page), Page.top_level.first
|
97
|
+
assert_equal pages(:contact_us), Page.top_level.last
|
98
|
+
assert_equal pages(:products), Page.top_level[1]
|
99
|
+
assert_equal pages(:services), Page.top_level[2]
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_order_of_children
|
103
|
+
assert_equal pages(:blue_jelly), pages(:products).children.first
|
104
|
+
assert_equal pages(:green_jelly), pages(:products).children[1]
|
105
|
+
assert_equal pages(:rainbow_jelly), pages(:products).children.last
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_title_with_meta
|
109
|
+
assert_equal "Home Page", pages(:home_page).title_with_meta
|
110
|
+
assert_equal "Secret Product <em>(draft)</em>", pages(:draft_page).title_with_meta
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_per_page
|
114
|
+
assert_equal 20, Page.per_page
|
115
|
+
assert_equal 14, Page.per_page(dialog = true)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_all_page_part_content
|
119
|
+
assert_equal "This is the body This is the side body", pages(:home_page).all_page_part_content
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_page_parts
|
123
|
+
assert_equal page_parts(:home_page_body).body, pages(:home_page)[:body]
|
124
|
+
assert_equal page_parts(:home_page_side_body).body, pages(:home_page)[:side_body]
|
125
|
+
|
126
|
+
# but make sure we can still access other fields through []
|
127
|
+
assert_equal "Home Page", pages(:home_page)[:title]
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
@@ -62,12 +62,12 @@ class UsersController < ApplicationController
|
|
62
62
|
if user
|
63
63
|
user.create_reset_code
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
65
|
+
begin
|
66
|
+
flash[:notice] = "An email has been sent to #{user.email} with a link to reset your password."
|
67
|
+
UserMailer.deliver_reset_notification(user, request)
|
68
|
+
rescue
|
69
|
+
info.logger "error: email could not be sent for user password reset"
|
70
|
+
end
|
71
71
|
else
|
72
72
|
flash[:notice] = "Sorry, #{params[:user][:email]} isn't associated with any acounts. Are you sure you typed the correct email address?"
|
73
73
|
end
|
@@ -76,21 +76,21 @@ class UsersController < ApplicationController
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
|
-
|
79
|
+
def reset
|
80
|
+
@user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil?
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
if request.post?
|
83
|
+
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
|
84
|
+
self.current_user = @user
|
85
|
+
@user.delete_reset_code
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
flash[:notice] = "Password reset successfully for #{@user.email}"
|
88
|
+
redirect_back_or_default(admin_root_url)
|
89
|
+
else
|
90
|
+
render :action => :reset
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
94
|
|
95
95
|
protected
|
96
96
|
|
@@ -100,4 +100,4 @@ protected
|
|
100
100
|
User.count == 0
|
101
101
|
end
|
102
102
|
|
103
|
-
end
|
103
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'digest/sha1'
|
2
2
|
class User < ActiveRecord::Base
|
3
|
-
|
3
|
+
|
4
4
|
# Hack: Allow "rake gems:install" to run when this class is missing its gem dependency.
|
5
5
|
# For further clarification on why, refer to:
|
6
6
|
# https://rails.lighthouseapp.com/projects/8994/tickets/780-rake-gems-install-doesn-t-work-if-plugins-are-missing-gem-dependencies
|
@@ -112,11 +112,11 @@ class User < ActiveRecord::Base
|
|
112
112
|
|
113
113
|
def create_reset_code
|
114
114
|
@reset = true
|
115
|
-
|
115
|
+
code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )
|
116
116
|
self.attributes = {:reset_code => code[0..6]}
|
117
117
|
save(false)
|
118
|
-
end
|
119
|
-
|
118
|
+
end
|
119
|
+
|
120
120
|
def recently_reset?
|
121
121
|
@reset
|
122
122
|
end
|
@@ -150,4 +150,4 @@ protected
|
|
150
150
|
self.deleted_at = self.activation_code = nil
|
151
151
|
end
|
152
152
|
|
153
|
-
end
|
153
|
+
end
|
@@ -9,10 +9,10 @@
|
|
9
9
|
<%= f.label :password_confirmation %>
|
10
10
|
<%= f.password_field :password_confirmation %>
|
11
11
|
</div>
|
12
|
-
|
12
|
+
|
13
13
|
<div class='form-actions'>
|
14
14
|
<%= submit_tag 'Reset password' %>
|
15
15
|
or
|
16
16
|
<%= link_to "Cancel", login_url %>
|
17
17
|
</div>
|
18
|
-
<% end -%>
|
18
|
+
<% end -%>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
ActionController::Routing::Routes.draw do |map|
|
2
|
-
|
2
|
+
|
3
3
|
map.resources :users
|
4
4
|
map.resource :session
|
5
5
|
|
@@ -9,7 +9,7 @@ ActionController::Routing::Routes.draw do |map|
|
|
9
9
|
|
10
10
|
map.login '/login', :controller => 'sessions', :action => 'new'
|
11
11
|
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
|
12
|
-
|
13
|
-
|
12
|
+
map.forgot '/forgot', :controller => 'users', :action => 'forgot'
|
13
|
+
map.reset 'reset/:reset_code', :controller => 'users', :action => 'reset'
|
14
14
|
|
15
|
-
end
|
15
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Image < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
3
|
+
# Docs for attachment_fu http://github.com/technoweenie/attachment_fu
|
4
4
|
has_attachment :content_type => :image,
|
5
5
|
:storage => (USE_S3_BACKEND ? :s3 : :file_system),
|
6
6
|
:path_prefix => (USE_S3_BACKEND ? nil : 'public/system/images'),
|
@@ -8,30 +8,30 @@ class Image < ActiveRecord::Base
|
|
8
8
|
:thumbnails => ((((thumbnails = RefinerySetting.find_or_set(:image_thumbnails, {})).is_a?(Hash) ? thumbnails : (RefinerySetting[:image_thumbnails] = {}))) rescue {}),
|
9
9
|
:max_size => 50.megabytes
|
10
10
|
|
11
|
-
|
11
|
+
validates_as_attachment
|
12
12
|
|
13
13
|
# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
|
14
14
|
acts_as_indexed :fields => [:title],
|
15
|
-
|
15
|
+
:index_file => [Rails.root.to_s, "tmp", "index"]
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
named_scope :thumbnails, :conditions => "parent_id IS NOT NULL"
|
18
|
+
named_scope :originals, :conditions => {:parent_id => nil}
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
# when a dialog pops up with images, how many images per page should there be
|
21
|
+
PAGES_PER_DIALOG = 18
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
# when listing images out in the admin area, how many images should show per page
|
24
|
+
PAGES_PER_ADMIN_INDEX = 20
|
25
25
|
|
26
|
-
|
26
|
+
# How many images per page should be displayed?
|
27
27
|
def self.per_page(dialog = false)
|
28
28
|
dialog ? PAGES_PER_DIALOG : PAGES_PER_ADMIN_INDEX
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
# Returns a titleized version of the filename
|
32
|
-
|
32
|
+
# my_file.jpg returns My File
|
33
33
|
def title
|
34
|
-
self.filename.gsub(/\.\w+$/, '').titleize
|
34
|
+
CGI::unescape(self.filename).gsub(/\.\w+$/, '').titleize
|
35
35
|
end
|
36
36
|
|
37
|
-
end
|
37
|
+
end
|