social_stream 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +2 -0
  2. data/app/controllers/authentications_controller.rb +17 -0
  3. data/app/controllers/omniauth_callbacks_controller.rb +17 -0
  4. data/app/models/actor.rb +11 -1
  5. data/app/models/authentication.rb +3 -0
  6. data/app/models/permission.rb +81 -18
  7. data/app/models/relation.rb +21 -3
  8. data/app/models/tie.rb +38 -20
  9. data/app/models/user.rb +29 -0
  10. data/app/views/frontpage/_sponsor.html.erb +6 -6
  11. data/app/views/groups/index.html.erb +1 -1
  12. data/app/views/layouts/_header.erb +1 -1
  13. data/app/views/layouts/application.html.erb +3 -3
  14. data/app/views/users/_profile.html.erb +5 -3
  15. data/app/views/users/edit.html.erb +105 -114
  16. data/app/views/users/index.html.erb +7 -6
  17. data/bin/social_stream +0 -0
  18. data/bin/social_stream_heroku +76 -0
  19. data/config/locales/en.yml +1 -0
  20. data/config/routes.rb +1 -2
  21. data/lib/generators/social_stream/install_generator.rb +8 -0
  22. data/lib/generators/social_stream/templates/initializer.rb +2 -2
  23. data/lib/generators/social_stream/templates/migration.rb +15 -0
  24. data/lib/generators/social_stream/templates/public/stylesheets/browse.css +47 -5
  25. data/lib/generators/social_stream/templates/public/stylesheets/edit_user.css +32 -19
  26. data/lib/generators/social_stream/templates/public/stylesheets/index.css +25 -13
  27. data/lib/generators/social_stream/templates/public/stylesheets/jqcloud.css +2 -2
  28. data/lib/generators/social_stream/templates/public/stylesheets/users.css +0 -22
  29. data/lib/generators/social_stream/templates/relations.yml +25 -20
  30. data/lib/social_stream.rb +1 -1
  31. data/lib/social_stream/models/subject.rb +9 -1
  32. data/lib/social_stream/rails.rb +2 -0
  33. data/lib/social_stream/version.rb +1 -1
  34. data/social_stream.gemspec +4 -1
  35. data/spec/dummy/config/initializers/devise.rb +71 -40
  36. data/spec/dummy/config/initializers/social_stream.rb +2 -2
  37. data/spec/dummy/config/relations.yml +25 -20
  38. data/spec/dummy/script/rails +0 -0
  39. data/spec/models/activity_spec.rb +3 -3
  40. data/spec/models/tie_spec.rb +1 -1
  41. metadata +78 -24
data/.gitignore CHANGED
@@ -6,3 +6,5 @@ Gemfile.lock
6
6
  nbproject
7
7
  .loadpath
8
8
  .project
9
+ .DS_Store
10
+ .yardoc/*
@@ -0,0 +1,17 @@
1
+ class AuthenticationsController < ApplicationController
2
+ def index
3
+ @authentications = current_user.authentications if current_user
4
+ end
5
+
6
+ def create
7
+ auth = request.env["omniauth.auth"]
8
+ current_user.authentications.find_or_create_by_provider_and_uid(auth['provider'], auth['uid'])
9
+ redirect_to authentications_url
10
+ end
11
+
12
+ def destroy
13
+ @authentication = current_user.authentications.find(params[:id])
14
+ @authentication.destroy
15
+ redirect_to authentications_url
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
2
+ def facebook
3
+ #print env['omniauth.auth']
4
+ @user = User.find_or_create_for_facebook_oauth(env['omniauth.auth'],current_user)
5
+ if @user.persisted?
6
+ sign_in_and_redirect @user, :event => :authentication
7
+ end
8
+ end
9
+
10
+ def linked_in
11
+ #print env['omniauth.auth']
12
+ @user = User.find_or_create_for_linkedin_oauth(env['omniauth.auth'],current_user)
13
+ if @user.persisted?
14
+ sign_in_and_redirect @user, :event => :authentication
15
+ end
16
+ end
17
+ end
data/app/models/actor.rb CHANGED
@@ -1,4 +1,14 @@
1
- # An actor is a social entity. This includes individuals, but also groups, departments, organizations even nations or states. Actors are linked by ties.
1
+ # An {Actor} is a social entity. This includes individuals, but also groups, departments, organizations even nations or states.
2
+ #
3
+ # Actors are the nodes of a social network. Two actors are linked by a {Tie}. The
4
+ # type of a {tie} is a {Relation}. Each actor can define and customize their relations.
5
+ #
6
+ # = Actor subtypes
7
+ # An actor subtype is called a {SocialStream::Models::Subject Subject}.
8
+ # {SocialStream} provides two actor subtypes, {User} and {Group}, but the
9
+ # application developer can define as many actor subtypes as required.
10
+ # Actors subtypes are added to +config/initializers/social_stream.rb+
11
+ #
2
12
  class Actor < ActiveRecord::Base
3
13
  @subtypes_name = :subject
4
14
  include SocialStream::Models::Supertype
@@ -0,0 +1,3 @@
1
+ class Authentication < ActiveRecord::Base
2
+ belongs_to :user
3
+ end
@@ -1,19 +1,81 @@
1
- # SocialStream provides a sophisticated and powerful system of permissions based on the relations
2
- # and ties of the social network.
1
+ # SocialStream provides a sophisticated and powerful system of permissions based on the {Relation relations}
2
+ # of the social network.
3
3
  #
4
- # Permissions are composed by action, objective and function. Action and objective are classical
5
- # in content management systems, e.g. "create" "activity", "update" "tie", "read" "post"
4
+ # = Permissions and Relations
6
5
  #
7
- # function is a novel feature. It supports applying the permission to certain set of ties.
8
- # This set of ties changes along with the formation of ties in your website.
6
+ # Permissions are assigned to {Relation Relations}, and through relations, to {Tie Ties}.
7
+ # When a sender establishes a {Tie} with a receiver, she is granting to the receiver
8
+ # the permissions assigned to {Relation} of the {Tie} she has just established.
9
9
  #
10
- # Permissions are assigned to relations, and through relations, to ties.
11
- # When a sender establishes a tie with a receiver, she is granting to the receiver the permissions assigned
12
- # to relation of the tie she has just established. For example, when Alice establishes a "friend" tie
13
- # to Bob, she is granting him the permissions associated with "friend" relation.
10
+ # For example, when _Alice_ establishes a _friend_ tie to _Bob_, she is granting
11
+ # him the permissions associated with her _friend_ relation.
14
12
  #
15
- # One of this permissions can be "read" "activity" "star_set". This way, Bob will have access
16
- # to read the activities attached to ties inside the "star_set", which are the ties from Alice to her "friends"
13
+ # = Permissions description
14
+ #
15
+ # Permissions are composed by *action*, *objective* and *function*. Action and objective
16
+ # are typical in content management systems, e.g. <tt>create activity</tt>,
17
+ # <tt>update tie</tt>, <tt>read post</tt>
18
+ #
19
+ # == Actions
20
+ #
21
+ # Current available actions are:
22
+ #
23
+ # +create+:: add a new instance of something (activity, tie, post, etc)
24
+ # +read+:: view something
25
+ # +update+:: modify something
26
+ # +destroy+:: delete something
27
+ # +follow+:: get activity updates from the receiver of the tie
28
+ # +represent+:: give the receiver rights to act as if he were us.
29
+ #
30
+ # == Objectives
31
+ #
32
+ # +activity+:: all the objects in a wall: posts, comments
33
+ #
34
+ # Other objectives currently not implemented could be +tie+, +post+, +comment+ or +message+
35
+ #
36
+ # == Functions
37
+ #
38
+ # Function is a novel feature. It supports applying the permission to other related ties.
39
+ # It is required because the set of ties changes along with the establish of contacts
40
+ # in the website, besides {SocialStream::Models::Subject subjects} can describe and
41
+ # customize their own relations and permissions.
42
+ #
43
+ # Available functions are:
44
+ #
45
+ # +tie+:: apply the permission to the established tie only.
46
+ #
47
+ # Example: if the _friend_ relation has the permission
48
+ # <tt>create activity tie</tt>, the _friend_ can create activities
49
+ # attached to this tie only.
50
+ #
51
+ # +weak_ties+:: apply the permission to all the related ties with a relation weaker
52
+ # or equal than this. When a subject establishes a strong ties,
53
+ # their related ties are established at the same time.
54
+ #
55
+ # Example: if the _member_ relation of a group has the permission
56
+ # <tt>create activity weak_ties</tt>, its members
57
+ # can also create activities attached to the weaker ties of
58
+ # _acquaintance_ and _public_.
59
+ # This means than a group _member_ can create activities at different
60
+ # levels of strength hierarchy, and therefore, with different levels of
61
+ # access.
62
+ #
63
+ # +star_ties+:: the permission applies to all the ties at the same level of strength,
64
+ # that is, ties with the same sender and the same relation but
65
+ # different receivers.
66
+ #
67
+ # Example: the _public_ relation has the permission
68
+ # <tt>read activity star_ties</tt>. If _Alice_ has a _public_ tie with
69
+ # _Bob_, she is granting him access to activities attached to other ties
70
+ # from _Alice_ to the rest of her _public_ contacts.
71
+ #
72
+ # +weak_star_ties+:: apply the permission to weak and star ties. This is the union of
73
+ # the former.
74
+ #
75
+ # Example: group's _admin relation has the permission
76
+ # <tt>destroy activity weak_star_ties</tt>
77
+ # This means that _admins_ can destroy activities from other
78
+ # _members_, _acquaintances_ and _public_.
17
79
  #
18
80
  class Permission < ActiveRecord::Base
19
81
  has_many :relation_permissions, :dependent => :destroy
@@ -28,11 +90,11 @@ class Permission < ActiveRecord::Base
28
90
  :table => {
29
91
  'tie' =>
30
92
  "ties_as.sender_id = ties.sender_id AND ties_as.receiver_id = ties.receiver_id AND ties_as.relation_id = ties.relation_id",
31
- 'weak_set' =>
93
+ 'weak_ties' =>
32
94
  "ties_as.sender_id = ties.sender_id AND ties_as.receiver_id = ties.receiver_id AND relations.lft BETWEEN relations_as.lft AND relations_as.rgt",
33
- 'star_set' =>
95
+ 'star_ties' =>
34
96
  "ties_as.sender_id = ties.sender_id AND ties_as.relation_id = ties.relation_id",
35
- 'weak_star_set' =>
97
+ 'weak_star_ties' =>
36
98
  "ties_as.sender_id = ties.sender_id AND relations.lft BETWEEN relations_as.lft AND relations_as.rgt"
37
99
  },
38
100
  :arel => {
@@ -42,18 +104,18 @@ class Permission < ActiveRecord::Base
42
104
  as[:receiver_id].eq(t.receiver_id)).and(
43
105
  as[:relation_id].eq(t.relation_id))
44
106
  },
45
- 'weak_set' => lambda { |as, t|
107
+ 'weak_ties' => lambda { |as, t|
46
108
  # The same sender and receiver, but a stronger or equal relation
47
109
  as[:sender_id].eq(t.sender_id).and(
48
110
  as[:receiver_id].eq(t.receiver_id)).and(
49
111
  as[:relation_id].in(t.relation.stronger_or_equal.map(&:id)))
50
112
  },
51
- 'star_set' => lambda { |as, t|
113
+ 'star_ties' => lambda { |as, t|
52
114
  # The same receiver and relation
53
115
  as[:sender_id].eq(t.sender_id).and(
54
116
  as[:relation_id].eq(t.relation_id))
55
117
  },
56
- 'weak_star_set' => lambda { |as, t|
118
+ 'weak_star_ties' => lambda { |as, t|
57
119
  # The same receiver with stronger or equal relations
58
120
  as[:sender_id].eq(t.sender_id).and(
59
121
  as[:relation_id].in(t.relation.stronger_or_equal.map(&:id)))
@@ -62,6 +124,7 @@ class Permission < ActiveRecord::Base
62
124
  }
63
125
 
64
126
  class << self
127
+ # Builds SQL conditions based on {ParameterConditions}
65
128
  def parameter_conditions(tie = nil)
66
129
  if tie.present?
67
130
  ParameterConditions[:arel].inject([]) { |conditions, h|
@@ -1,13 +1,31 @@
1
- # A Relation defines a type of Tie. Relations are affective (friendship, liking,
1
+ # A relation defines a type of {Tie tie}. Relations are affective (friendship, liking,
2
2
  # respect), formal or biological (authority, kinship), transfer of material
3
3
  # resources (transactions, lending and borrowing), messages or conversations,
4
4
  # physical connection and affiliation to same organizations.
5
5
  #
6
- # == Strength hierarchies
6
+ # = Default relations
7
+ #
8
+ # When a new {SocialStream::Models::Subject subject} is created, a initial set
9
+ # of relations is created for him. Afterwards, the {SocialStream::Models::Subject subject}
10
+ # can customize them and adapt them to his own preferences.
11
+ #
12
+ # Default relations are defined at config/relations.yml
13
+ #
14
+ # = Strength hierarchies
15
+ #
7
16
  # Relations are arranged in strength hierarchies, denoting that some ties between
8
- # two actors are stronger than others.
17
+ # two actors are stronger than others. For example, a "friend" relation is stronger than
18
+ # an "acquaintance" relation.
19
+ #
9
20
  # When a strong tie is established, ties with weaker relations are establised as well
10
21
  #
22
+ # = Permissions
23
+ #
24
+ # {SocialStream::Models::Subject Subjects} assign {Permission permissions} to relations.
25
+ # This way, when establishing {Tie ties}, they are granting permissions to their contacts.
26
+ #
27
+ # See the documentation of {Permission} for more details on permission definition.
28
+ #
11
29
  class Relation < ActiveRecord::Base
12
30
  acts_as_nested_set
13
31
 
data/app/models/tie.rb CHANGED
@@ -1,28 +1,46 @@
1
- # A link between two actors in a relation.
1
+ # A tie is a link between two {Actor actors} with a {Relation relation}.
2
2
  #
3
- # The first Actor is the sender of the Tie. The second Actor is the receiver of the Tie.
3
+ # The first {Actor actor} is the sender of the {Tie tie}. The second {Actor actor}
4
+ # is the receiver of the {Tie tie}.
4
5
  #
5
- # == Ties and Activities
6
- # Activities are attached to ties.
7
- # * The sender of the tie is the target of the Activity. The wall-profile of an actor is
8
- # composed by the resources assigned to the ties in which the actor is the sender.
9
- # * The receiver actor of the tie is the author of the Activity. It is the user that uploads
10
- # a resource to the website or the social entity that originates the activity.
11
- # * The Relation sets up the mode in which the Activity is shared. It sets the rules,
12
- # or permissions, by which actors have access to the Activity.
6
+ # = {Tie Ties} and {Activity activities}
7
+ # {Activity Activities} are attached to {Tie ties}.
8
+ # * The sender of the tie is the target of the {Activity}.
9
+ # The wall-profile of an {Actor} is composed by the resources assigned to
10
+ # the {Tie Ties} in which the {Actor} is the sender.
11
+ # * The receiver {Actor} of the {Tie} is the author of the {Activity}.
12
+ # It is the user that uploads a resource to the website or the social entity that
13
+ # originates the {Activity}.
14
+ # * The {Relation} sets up the mode in which the {Activity} is shared.
15
+ # It sets the rules, or {Permission Permissions}, by which {Actor} have access
16
+ # to the {Activity}.
13
17
  #
14
- # == Authorization
15
- # When an actor establishes a tie with other, she is granting a set of permissions to them
16
- # (posting to her wall, reading her posts, etc..) The set of permissions granted are
17
- # associated with the relation of the tie.
18
+ # = Tie strengh
18
19
  #
19
- # == Scopes
20
+ # Because each {Tie} belongs to a {Relation} and {Relation Relations} have strength
21
+ # hierarchies, {Tie Ties} also have them. A {Tie} is stronger than other if its
22
+ # {Relation} is stronger than the other's. For example, if _Alice_ has a _friend_ {Tie}
23
+ # with _Bob_, and an _acquaintance_ {Tie} with _Charlie_, given that _friend_ {Relation}
24
+ # is stronger than _acquaintance_, the {Tie} with _Bob_ is stronger than the {Tie} with
25
+ # _Charlie_.
26
+ #
27
+ # = Authorization
28
+ # When an {Actor} establishes a {Tie} with other, she is granting a set of
29
+ # {Permission Permissions} to them (posting to her wall, reading her posts, etc..)
30
+ # The set of {Permission Permissions} granted are associated with the {Relation} of
31
+ # the {Tie}.
32
+ #
33
+ # Usually, stronger ties (and relations) have more permissions than weaker ones.
34
+ #
35
+ # = Scopes
20
36
  # There are several scopes defined:
21
- # * sent_by(actor), ties whose sender is actor
22
- # * received_by(actor), ties whose receiver is actor
23
- # * sent_or_received_by(actor), the union of the former
24
- # * related_by(relation), ties with this relation. Accepts relation, relation_name, integer, array
25
- # * replied, ties having at least another tie in the other way, a tie from a to b is replied if there is a tie from b to a
37
+ # sent_by(actor):: ties whose sender is actor
38
+ # received_by(actor):: ties whose receiver is actor
39
+ # sent_or_received_by(actor):: the union of the former
40
+ # related_by(relation):: ties with this relation. Accepts relation, relation_name,
41
+ # integer, array
42
+ # replied:: ties having at least another tie in the other way, a tie from a to b
43
+ # is replied if there is a tie from b to a
26
44
  #
27
45
  class Tie < ActiveRecord::Base
28
46
  attr_accessor :message
data/app/models/user.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'devise/orm/active_record'
2
2
 
3
3
  class User < ActiveRecord::Base
4
+ has_many :authentications
4
5
  devise *SocialStream.devise_modules
5
6
 
6
7
  # Setup accessible (or protected) attributes for your model
@@ -98,5 +99,33 @@ class User < ActiveRecord::Base
98
99
 
99
100
  record
100
101
  end
102
+
103
+ def find_or_create_for_facebook_oauth(access_token,signed_in_resource=nil)
104
+ data = access_token['extra']['user_hash']
105
+ print data
106
+ auth = Authentication.find_by_provider_and_uid(access_token["provider"],access_token["uid"])
107
+ user = User.find_by_email(data["email"])
108
+
109
+ if user == nil
110
+ user = User.create!(:name => data["name"], :email => data["email"], :password => Devise.friendly_token[0,20])
111
+ end
112
+ if auth == nil
113
+ auth = Authentication.create!(:user_id => user.id, :uid =>access_token["uid"], :provider => access_token["provider"])
114
+ end
115
+ user
116
+ end
117
+
118
+ def find_or_create_for_linkedin_oauth(access_token,signed_in_resource=nil)
119
+ auth = Authentication.find_by_uid_and_provider(access_token["uid"],access_token["provider"])
120
+ if auth==nil
121
+ user = User.create!(:name => access_token["user_info"]["name"], :email => 'demo@socialstream.com', :password => Devise.friendly_token[0,20])
122
+ auth = Authentication.create!(:user_id => user.id, :uid =>access_token["uid"], :provider => access_token["provider"])
123
+ user
124
+ else
125
+ user = User.find_by_id(auth.user_id)
126
+ user
127
+ end
128
+ end
129
+
101
130
  end
102
131
  end
@@ -1,11 +1,11 @@
1
1
  <div id="sponsor">
2
2
  <ul>
3
- <li>
4
- <%=link_to("DIT","http://www.dit.upm.es/")%> -
5
- <%=link_to("UPM","http://www.upm.es/")%> &
6
- <%=link_to("CISE","http://www.cise.espol.edu.ec/")%> -
7
- <%=link_to("ESPOL","http://www.espol.edu.ec/")%>
8
- </li>
3
+ <li>
4
+ <%=link_to("DIT","http://www.dit.upm.es/")%> -
5
+ <%=link_to("UPM","http://www.upm.es/")%> &
6
+ <%=link_to("CISE","http://www.cise.espol.edu.ec/")%> -
7
+ <%=link_to("ESPOL","http://www.espol.edu.ec/")%>
8
+ </li>
9
9
  </ul>
10
10
  </div>
11
11
 
@@ -33,7 +33,7 @@
33
33
  <div id="spaces" class="tabconference_browse">
34
34
  <div class="space_center">
35
35
  </div>
36
- <div><input type="text" value="Search by name" id="search_field" class="search_input" /><%= image_tag("btn/search.png",:size=>"20x20",:id=>"search_button") %></div>
36
+ <div class="search_field_wrapper"><input type="text" value="Search by name" id="search_field" class="search_input" /><%= image_tag("btn/search.png",:size=>"20x20",:id=>"search_button") %></div>
37
37
  <div class="space_center">
38
38
  </div>
39
39
  <div class="letters" class="content_size">
@@ -39,4 +39,4 @@
39
39
  </div>
40
40
  </div>
41
41
  <br class="clearfloat" />
42
- </div>
42
+ </div>
@@ -18,13 +18,13 @@
18
18
  <%= stylesheet_link_tag "carousel", :media => "screen, projection" %>
19
19
  <%= stylesheet_link_tag "smoothness/jquery-ui-1.8.4.custom", :media => "screen, projection" %>
20
20
  <%= stylesheet_link_tag "ui.dropdownchecklist", :media => "screen, projection" %>
21
- <%= stylesheet_link_tag "jquery-ui.css", :media => "screen, projection" %>
21
+
22
22
  <%= stylesheet_link_tag "fcbkComplete.css", :media => "screen, projection" %>
23
23
 
24
- <%= stylesheet_link_tag "edit_user", :media => "screen, projection" %>
24
+
25
25
  <%= javascript_include_tag :defaults %>
26
26
 
27
- <%= javascript_include_tag 'jquery', 'jquery-ui.min', 'jquery.livequery','jquery.boxy', 'menu','ui.dropdownchecklist','jquery.form', 'jquery.validate','jquery.fcbkcomplete.min', 'jquery.ba-url' %>
27
+ <%= javascript_include_tag 'jquery', 'jquery.livequery','jquery.boxy', 'menu','ui.dropdownchecklist','jquery.form', 'jquery.fcbkcomplete.min', 'jquery.ba-url' %>
28
28
 
29
29
 
30
30
 
@@ -1,5 +1,7 @@
1
1
 
2
-
2
+ <div class="space_center"></div>
3
+ <div class="space_center"></div>
4
+ <div class="space_center"></div>
3
5
  <div class="future_conference" id="personal_info" >
4
6
  <div class="future_header">
5
7
  <div class="title_section">
@@ -132,7 +134,7 @@
132
134
  <div class="info_left">
133
135
  E-mail
134
136
  </div>
135
- <div class="info_right">
137
+ <div class="info_center">
136
138
  <%=h @user.email %>
137
139
  </div>
138
140
  </div>
@@ -153,7 +155,7 @@
153
155
  <div class="future_content">
154
156
  <div class="info_post">
155
157
 
156
- <div class="info_right">
158
+ <div class="info_center">
157
159
  <%=h @user.profile.experience %>
158
160
  </div>
159
161
  </div>
@@ -6,7 +6,11 @@
6
6
  <%= render :partial => 'middle_show' %>
7
7
  <% end %>
8
8
 
9
-
9
+ <% content_for :head do %>
10
+ <%= stylesheet_link_tag "jquery-ui.css", :media => "screen, projection" %>
11
+ <%= stylesheet_link_tag "edit_user", :media => "screen, projection" %>
12
+ <%= javascript_include_tag 'jquery-ui.min','jquery.validate' %>
13
+ <% end %>
10
14
 
11
15
  <%= form_for(@user, :remote => true) do |f| %>
12
16
  <% if @user.errors.any? %>
@@ -21,148 +25,135 @@
21
25
  </ul>
22
26
  </div>
23
27
  <% end %>
24
- <script type="text/javascript">
25
- $(function() {
26
- $("#content").css('border-right', 'none');
28
+
29
+ <% content_for :javascript do %>
30
+ $(function() {
27
31
  $("#content").css('border-bottom', 'none');
28
- $("#contact_info").addClass('section_normal');
29
- $("#experience_info").addClass('section_normal');
30
- $("#personal_info").addClass('section_normal');
31
-
32
-
33
- $("#edit_user_1").validate();
34
-
32
+ $("#edit_user_1").validate();
35
33
  });
36
- </script>
34
+ <% end %>
35
+
37
36
  <div class="field">
38
37
  <% if !params[:section].present? or params[:section].eql?("about_me") %>
39
- <div class="sectionEdit">
38
+ <div class="section_edit">
40
39
  Personal information
41
40
  </div>
42
- <br/>
43
- <%= f.label :name %>
44
- <br/>
45
-
46
- <%= f.text_field :name, :class => "required" %>
47
-
48
- <br/>
49
-
50
- <script type="text/javascript">
41
+ <div class="edit_field">
42
+ <div class="edit_label">
43
+ <%= f.label :name %>
44
+ </div>
45
+ <%= f.text_field :name, :class => "required edit_text" %>
46
+ </div>
51
47
 
48
+ <% content_for :javascript do %>
52
49
  $(function () {
53
50
  $( "#user_profile_attributes_birthday" ).datepicker({ yearRange: '1900:<%= Time.now.utc.to_date.year%>',
54
51
  changeYear: true, maxDate: '+0d', defaultDate: '-30y'});
55
-
56
- $("#personal_info").removeClass('section_normal');
57
52
  $("#personal_info").addClass('section_highlight');
58
53
 
59
54
  });
55
+ <% end %>
60
56
 
61
- </script>
62
57
  <%= f.fields_for :profile do |profile_form| %>
63
58
 
64
- <div class="editField">
65
- <%= profile_form.label :organization %>
66
- <br/>
59
+ <div class="edit_field">
60
+ <div class="edit_label">
61
+ <%= profile_form.label :organization %>
62
+ </div>
63
+ <%= profile_form.text_field :organization, :class => "edit_text" %>
67
64
  </div>
68
- <%= profile_form.text_field :organization %>
69
- <br/>
70
- <div class="editField">
71
- <%= profile_form.label :birthday %>
72
- <br/>
73
- </div>
74
- <%= profile_form.text_field( :birthday , :class => "date") %>
75
- <br/>
76
-
77
-
78
65
 
79
- <div class="editField">
80
- <%= profile_form.label :city %>
81
- <br/>
66
+ <div class="edit_field">
67
+ <div class="edit_label">
68
+ <%= profile_form.label :birthday %>
69
+ </div>
70
+ <%= profile_form.text_field( :birthday , :class => "date edit_text") %>
82
71
  </div>
83
- <%= profile_form.text_field :city %>
84
- <br/>
85
- <div class="editField">
86
- <%= profile_form.label :country %>
87
- <br/>
88
- </div>
89
- <%= profile_form.text_field :country %>
90
- <br/>
91
- <div class="editField">
72
+
73
+
74
+ <div class="edit_field">
75
+ <div class="edit_label">
76
+ <%= profile_form.label :city %>
77
+ </div>
78
+ <%= profile_form.text_field :city, :class => "edit_text" %>
79
+ </div>
80
+ <div class="edit_field">
81
+ <div class="edit_label">
82
+ <%= profile_form.label :country %>
83
+ </div>
84
+ <%= profile_form.text_field :country, :class => "edit_text" %>
85
+ </div>
86
+ <div class="edit_field">
92
87
  <%= profile_form.label "About me" %>
93
- <br/>
88
+ <%= profile_form.text_area :description, :rows =>6, :maxlength => 400, :class => "edit_text" %>
94
89
  </div>
95
- <%= profile_form.text_area :description, :rows =>6, :maxlength => 400 %>
96
- <br/>
97
- <br/>
90
+
98
91
  <% end %>
99
92
  <% end %>
100
93
  <% if !params[:section].present? or params[:section].eql?("contact_info") %>
101
- <script type="text/javascript">
102
94
 
103
- $(function() {
104
-
105
- $("#contact_info").removeClass('section_normal');
106
- $("#contact_info").addClass('section_highlight');
107
- });
95
+ <% content_for :javascript do %>
96
+
97
+ $(function() {
98
+ $("#contact_info").addClass('section_highlight');
99
+ });
100
+
101
+ <% end %>
108
102
 
109
- </script>
110
- <div class="sectionEdit">
111
- My contact information
112
- </div>
113
- <%= f.fields_for :profile do |profile_form| %>
114
- <br/>
115
- <div class="editField">
116
- <%= profile_form.label :phone %>
117
- <br/>
118
- </div>
119
- <%= profile_form.text_field :phone, :class => "phone" %>
120
- <br/>
121
- <div class="editField">
122
- <%= profile_form.label :mobile %>
123
- <br/>
124
- </div>
125
- <%= profile_form.text_field :mobile, :class => "phone" %>
126
- <br/>
127
- <div class="editField">
128
- <%= profile_form.label :fax %>
129
- <br/>
130
- </div>
131
- <%= profile_form.text_field :fax, :class => "phone" %>
132
- <br/>
133
- <div class="editField">
134
- <%= profile_form.label :address %>
135
- <br/>
136
- </div>
137
- <%= profile_form.text_field :address %>
138
- <br/>
139
- <div class="editField">
140
- <%= profile_form.label :website %>
141
- <br/>
142
- </div>
143
- <%= profile_form.text_field :website, :class => "url" %>
144
- <br/>
145
- <br/>
146
- <% end %>
147
- <% end %>
103
+ <div class="section_edit">
104
+ Contact information
105
+ </div>
106
+ <%= f.fields_for :profile do |profile_form| %>
107
+ <div class="edit_field">
108
+ <div class="edit_label">
109
+ <%= profile_form.label :phone %>
110
+ </div>
111
+ <%= profile_form.text_field :phone, :class => "phone edit_text" %>
112
+ </div>
113
+ <div class="edit_field">
114
+ <div class="edit_label">
115
+ <%= profile_form.label :mobile %>
116
+ </div>
117
+ <%= profile_form.text_field :mobile, :class => "phone edit_text" %>
118
+ </div>
119
+ <div class="edit_field">
120
+ <div class="edit_label">
121
+ <%= profile_form.label :fax %>
122
+ </div>
123
+ <%= profile_form.text_field :fax, :class => "phone edit_text" %>
124
+ </div>
125
+ <div class="edit_field">
126
+ <div class="edit_label">
127
+ <%= profile_form.label :address %>
128
+ </div>
129
+ <%= profile_form.text_field :address, :class => "edit_text" %>
130
+ </div>
131
+ <div class="edit_field">
132
+ <div class="edit_label">
133
+ <%= profile_form.label :website %>
134
+ </div>
135
+ <%= profile_form.text_field :website, :class => "url edit_text" %>
136
+ </div>
137
+
138
+ <% end %>
139
+ <% end %>
148
140
  <% if !params[:section].present? or params[:section].eql?("my_experience") %>
149
- <script type="text/javascript">
150
-
151
- $(function() {
152
141
 
153
- $("#experience_info").removeClass('section_normal');
154
- $("#experience_info").addClass('section_highlight');
155
- });
142
+ <% content_for :javascript do %>
143
+
144
+ $(function() {
145
+ $("#experience_info").addClass('section_highlight');
146
+ });
147
+
148
+ <% end %>
156
149
 
157
- </script>
158
- <div class="sectionEdit">
159
- My experience
150
+ <div class="section_edit">
151
+ Experience
160
152
  </div>
161
- <%= f.fields_for :profile do |profile_form| %>
162
- <br/>
163
- <%= profile_form.text_area :experience, :rows =>6, :maxlength => 500 %>
164
- <br/>
165
- <br/>
153
+ <div class="edit_field">
154
+ <%= f.fields_for :profile do |profile_form| %>
155
+ <%= profile_form.text_area :experience, :rows =>6, :maxlength => 500, :class => "edit_text" %>
156
+ </div>
166
157
  <% end %>
167
158
  <% end %>
168
159
  </div>
@@ -170,7 +161,7 @@
170
161
  <%= hidden_field_tag("section", params[:section]) %>
171
162
  <% end %>
172
163
  <div class="actions">
173
- <%= f.submit "Update" %>&nbsp;<button onclick="window.location.href='<%= user_url(@user) %>';">Cancel</button>
164
+ <%= f.submit "Update", :class => "button" %>&nbsp;<button onclick="window.location.href='<%= user_url(@user) %>';">Cancel</button>
174
165
  </div>
175
166
  <br/>
176
167
  <% end %>