muck-profiles 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/muck/profiles_controller.rb +4 -44
- data/app/views/profiles/edit.html.erb +0 -16
- data/app/views/profiles/show.html.erb +5 -0
- data/lib/active_record/acts/muck_profile.rb +6 -2
- data/locales/en.yml +7 -1
- data/muck-profiles.gemspec +34 -2
- data/pkg/muck-profiles-0.1.1.gem +0 -0
- data/rdoc/created.rid +1 -1
- data/test/rails_root/app/controllers/application_controller.rb +7 -5
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -1,55 +1,15 @@
|
|
1
1
|
class Muck::ProfilesController < ApplicationController
|
2
2
|
unloadable
|
3
3
|
|
4
|
-
before_filter :search_results, :only => [:index, :search]
|
5
|
-
|
6
|
-
def index
|
7
|
-
respond_to do |format|
|
8
|
-
format.html { render :template => 'profiles/index' }
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def search
|
13
|
-
respond_to do |format|
|
14
|
-
format.html { render :template => 'profiles/index' }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
4
|
# show a given user's public profile information
|
19
5
|
def show
|
20
|
-
@user = User.
|
6
|
+
@user = User.find_by_login(params[:id])
|
21
7
|
respond_to do |format|
|
22
|
-
format.html
|
8
|
+
format.html do
|
9
|
+
render :template => 'profiles/show'
|
10
|
+
end
|
23
11
|
end
|
24
|
-
end
|
25
12
|
|
26
|
-
def edit
|
27
13
|
end
|
28
14
|
|
29
|
-
private
|
30
|
-
|
31
|
-
def search_results
|
32
|
-
@query = params[:q]
|
33
|
-
@per_page = 20
|
34
|
-
@browse = @query ? 'search' : params[:browse] || 'date'
|
35
|
-
|
36
|
-
# field_list = logged_in? ? 'protected_profile AS profile' : 'public_profile AS profile'
|
37
|
-
# field_list = 'public_profile AS profile'
|
38
|
-
field_list = '*'
|
39
|
-
|
40
|
-
@query = nil if (@query == '*')
|
41
|
-
|
42
|
-
if !@query.nil?
|
43
|
-
@results = User.find_by_solr("#{search_field}:(#{@query})", :offset => (@page-1)*@per_page, :limit => @per_page).results
|
44
|
-
|
45
|
-
elsif @browse == 'alpha'
|
46
|
-
@alpha_index = params[:alpha_index] || 'A'
|
47
|
-
@results = User.find(:all, :select => field_list, :conditions => ["last_name LIKE ?", @alpha_index + '%'], :order => 'last_name, first_name').paginate(:page => @page, :per_page => @per_page)
|
48
|
-
|
49
|
-
else
|
50
|
-
@results = User.find(:all, :select => field_list, :order => 'created_at DESC').paginate(:page => @page, :per_page => @per_page)
|
51
|
-
end
|
52
|
-
flash[:notice] = @results.empty? ? _('No profiles were found that matched your search.') : nil
|
53
|
-
end
|
54
|
-
|
55
15
|
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<div id="edit-user" class="common-form">
|
2
|
-
<h1><%= t('muck.users.update_user') %></h1>
|
3
|
-
|
4
|
-
<% custom_form_for @profile, :url => profile_path(@profile), :html => {:id => "edit-profile-form", :name => 'edit-profile-form', :method => :put, :multipart => true } do |f| -%>
|
5
|
-
|
6
|
-
<%= output_errors(t('muck.profiles.problem_editing_account'), {:class => 'help-box'}, @profile) %>
|
7
|
-
|
8
|
-
<%= image_tag @profile.photo.url(:thumb) %>
|
9
|
-
<%= f.file_field :photo, { :label => t('muck.profiles.upload_photo') } %>
|
10
|
-
<div class="button form-row">
|
11
|
-
<%= f.submit t('muck.general.save') %>
|
12
|
-
</div>
|
13
|
-
<%= hidden_field_tag :redirect_to, edit_profile_path(@profiles) %>
|
14
|
-
<% end %>
|
15
|
-
|
16
|
-
</div>
|
@@ -41,8 +41,12 @@ module ActiveRecord
|
|
41
41
|
# rss_link = RssMethods::auto_detect_rss_url(uri)
|
42
42
|
# write_attribute(:blog_rss, rss_link) if rss_link
|
43
43
|
# end
|
44
|
-
|
45
|
-
|
44
|
+
|
45
|
+
def can_edit?(user)
|
46
|
+
return false if user.nil?
|
47
|
+
self.user_id == user.id || user.admin?
|
48
|
+
end
|
49
|
+
|
46
50
|
end
|
47
51
|
|
48
52
|
end
|
data/locales/en.yml
CHANGED
@@ -2,4 +2,10 @@ en:
|
|
2
2
|
muck:
|
3
3
|
profiles:
|
4
4
|
upload_photo: "Upload a photo:"
|
5
|
-
problem_editing_account: "There was a problem updating your profile"
|
5
|
+
problem_editing_account: "There was a problem updating your profile"
|
6
|
+
edit_profile: "Edit Profile"
|
7
|
+
update_profile: "Update Profile"
|
8
|
+
edit_success: "Successfully updated your profile"
|
9
|
+
edit_failure: "An error occured while updating your profile."
|
10
|
+
could_not_find_user: "Could not find the specified user."
|
11
|
+
|
data/muck-profiles.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{muck-profiles}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Justin Ball"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-24}
|
10
10
|
s.description = %q{Profile engine for the muck system.}
|
11
11
|
s.email = %q{justinball@gmail.com}
|
12
12
|
s.extra_rdoc_files = [
|
@@ -47,40 +47,72 @@ Gem::Specification.new do |s|
|
|
47
47
|
"lib/muck_profiles/tasks.rb",
|
48
48
|
"lib/muck_profiles/tasks.rb",
|
49
49
|
"locales/ar.yml",
|
50
|
+
"locales/ar.yml",
|
51
|
+
"locales/bg.yml",
|
50
52
|
"locales/bg.yml",
|
51
53
|
"locales/ca.yml",
|
54
|
+
"locales/ca.yml",
|
55
|
+
"locales/cs.yml",
|
52
56
|
"locales/cs.yml",
|
53
57
|
"locales/da.yml",
|
58
|
+
"locales/da.yml",
|
59
|
+
"locales/de.yml",
|
54
60
|
"locales/de.yml",
|
55
61
|
"locales/el.yml",
|
62
|
+
"locales/el.yml",
|
56
63
|
"locales/en.yml",
|
57
64
|
"locales/en.yml",
|
58
65
|
"locales/es.yml",
|
66
|
+
"locales/es.yml",
|
59
67
|
"locales/fr.yml",
|
68
|
+
"locales/fr.yml",
|
69
|
+
"locales/it.yml",
|
60
70
|
"locales/it.yml",
|
61
71
|
"locales/iw.yml",
|
72
|
+
"locales/iw.yml",
|
73
|
+
"locales/ja.yml",
|
62
74
|
"locales/ja.yml",
|
63
75
|
"locales/ko.yml",
|
76
|
+
"locales/ko.yml",
|
77
|
+
"locales/lt.yml",
|
64
78
|
"locales/lt.yml",
|
65
79
|
"locales/lv.yml",
|
80
|
+
"locales/lv.yml",
|
81
|
+
"locales/nl.yml",
|
66
82
|
"locales/nl.yml",
|
67
83
|
"locales/no.yml",
|
84
|
+
"locales/no.yml",
|
85
|
+
"locales/pl.yml",
|
68
86
|
"locales/pl.yml",
|
69
87
|
"locales/pt.yml",
|
88
|
+
"locales/pt.yml",
|
89
|
+
"locales/ro.yml",
|
70
90
|
"locales/ro.yml",
|
71
91
|
"locales/ru.yml",
|
92
|
+
"locales/ru.yml",
|
93
|
+
"locales/sk.yml",
|
72
94
|
"locales/sk.yml",
|
73
95
|
"locales/sl.yml",
|
96
|
+
"locales/sl.yml",
|
97
|
+
"locales/sr.yml",
|
74
98
|
"locales/sr.yml",
|
75
99
|
"locales/sv.yml",
|
100
|
+
"locales/sv.yml",
|
101
|
+
"locales/tl.yml",
|
76
102
|
"locales/tl.yml",
|
77
103
|
"locales/uk.yml",
|
104
|
+
"locales/uk.yml",
|
105
|
+
"locales/vi.yml",
|
78
106
|
"locales/vi.yml",
|
79
107
|
"locales/zh-CN.yml",
|
108
|
+
"locales/zh-CN.yml",
|
109
|
+
"locales/zh-TW.yml",
|
80
110
|
"locales/zh-TW.yml",
|
81
111
|
"locales/zh.yml",
|
112
|
+
"locales/zh.yml",
|
82
113
|
"muck-profiles.gemspec",
|
83
114
|
"pkg/muck-profiles-0.1.0.gem",
|
115
|
+
"pkg/muck-profiles-0.1.1.gem",
|
84
116
|
"rails/init.rb",
|
85
117
|
"rails/init.rb",
|
86
118
|
"rdoc/classes/ActionController.html",
|
Binary file
|
data/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Fri, 19 Jun 2009 02:11:05 -0600
|
@@ -3,10 +3,12 @@ class ApplicationController < ActionController::Base
|
|
3
3
|
helper :all
|
4
4
|
protect_from_forgery
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
admin
|
10
|
-
|
6
|
+
protected
|
7
|
+
|
8
|
+
# called by Admin::Muck::BaseController to check whether or not the
|
9
|
+
# user should have access to the admin UI
|
10
|
+
def admin_access?
|
11
|
+
admin?
|
12
|
+
end
|
11
13
|
|
12
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muck-profiles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Ball
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-24 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- locales/zh.yml
|
95
95
|
- muck-profiles.gemspec
|
96
96
|
- pkg/muck-profiles-0.1.0.gem
|
97
|
+
- pkg/muck-profiles-0.1.1.gem
|
97
98
|
- rails/init.rb
|
98
99
|
- rdoc/classes/ActionController.html
|
99
100
|
- rdoc/classes/ActionController/Routing.html
|