social_stream-base 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/stylesheets/base.css +1 -0
- data/app/assets/stylesheets/contacts.css +2 -1
- data/app/assets/stylesheets/fcbkComplete.css +1 -1
- data/app/assets/stylesheets/header.css +2 -2
- data/app/assets/stylesheets/messages.css +3 -3
- data/app/assets/stylesheets/{spheres.css → relation_customs.css} +0 -0
- data/app/controllers/contacts_controller.rb +9 -4
- data/app/controllers/messages_controller.rb +69 -68
- data/app/controllers/relation/customs_controller.rb +1 -11
- data/app/helpers/activities_helper.rb +1 -2
- data/app/helpers/notifications_helper.rb +3 -2
- data/app/helpers/permissions_helper.rb +5 -5
- data/app/helpers/subjects_helper.rb +9 -0
- data/app/helpers/toolbar_helper.rb +10 -89
- data/app/models/activity.rb +39 -15
- data/app/models/actor.rb +30 -71
- data/app/models/contact.rb +15 -0
- data/app/models/group.rb +1 -3
- data/app/models/permission.rb +9 -72
- data/app/models/profile.rb +7 -2
- data/app/models/relation/custom.rb +6 -33
- data/app/models/relation.rb +15 -39
- data/app/models/user.rb +5 -1
- data/app/views/activities/_new.html.erb +5 -2
- data/app/views/activities/_options.html.erb +2 -2
- data/app/views/activities/_walls.html.erb +1 -1
- data/app/views/contacts/_contact.html.erb +3 -3
- data/app/views/contacts/_form.html.erb +14 -20
- data/app/views/contacts/_index.html.erb +1 -1
- data/app/views/contacts/_suggestions.html.erb +1 -13
- data/app/views/contacts/destroy.js.erb +6 -0
- data/app/views/contacts/edit.html.erb +1 -1
- data/app/views/conversations/_conversation.html.erb +1 -1
- data/app/views/groups/_group.html.erb +1 -1
- data/app/views/groups/_index.html.erb +1 -1
- data/app/views/groups/show.html.erb +1 -1
- data/app/views/invitation_mailer/send_invitation.html.erb +17 -6
- data/app/views/invitation_mailer/send_invitation.text.erb +7 -2
- data/app/views/layouts/_representation.html.erb +10 -6
- data/app/views/layouts/_settings.html.erb +1 -1
- data/app/views/messages/_message.html.erb +1 -1
- data/app/views/messages/new.html.erb +1 -1
- data/app/views/notifications/_notification.html.erb +7 -3
- data/app/views/objects/_new.html.erb +0 -6
- data/app/views/profiles/edit.html.erb +5 -9
- data/app/views/relation/customs/_form.html.erb +2 -2
- data/app/views/{spheres → relation/customs}/_jquery.erb +0 -58
- data/app/views/relation/customs/_list.html.erb +9 -26
- data/app/views/relation/customs/create.js.erb +2 -3
- data/app/views/relation/customs/index.html.erb +67 -0
- data/app/views/users/_index.html.erb +1 -1
- data/app/views/users/show.html.erb +1 -1
- data/config/locales/en.yml +16 -41
- data/config/routes.rb +1 -6
- data/db/migrate/20110705103202_empty_ties_count.rb +4 -0
- data/db/migrate/20110712090343_remove_spheres.rb +30 -0
- data/db/migrate/20110712142140_remove_permission_function.rb +26 -0
- data/lib/generators/social_stream/base/install_generator.rb +4 -0
- data/lib/generators/social_stream/base/templates/mailboxer_custom.rb +13 -0
- data/lib/generators/social_stream/base/templates/navigation.rb +4 -0
- data/lib/generators/social_stream/base/templates/relations.yml +14 -20
- data/lib/social_stream/ability.rb +1 -2
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/social_stream/migration_finder.rb +19 -0
- data/lib/social_stream/toolbar_config.rb +113 -0
- data/lib/social_stream-base.rb +1 -0
- data/lib/tasks/db/populate.rake +1 -1
- data/social_stream-base.gemspec +4 -2
- data/spec/controllers/contacts_controller_spec.rb +1 -1
- data/spec/controllers/permissions_controller_spec.rb +1 -2
- data/spec/controllers/posts_controller_spec.rb +2 -2
- data/spec/controllers/relation_customs_controller_spec.rb +69 -62
- data/spec/dummy/config/database.yml +7 -0
- data/spec/dummy/config/relations.yml +14 -20
- data/spec/factories/relation_custom.rb +1 -1
- data/spec/factories/tie.rb +4 -0
- data/spec/models/activity_spec.rb +11 -2
- data/spec/models/user_spec.rb +68 -9
- data/spec/spec_helper.rb +0 -3
- data/spec/support/db.rb +9 -0
- data/spec/support/migrations.rb +3 -12
- metadata +19 -25
- data/app/controllers/spheres_controller.rb +0 -12
- data/app/models/sphere.rb +0 -9
- data/app/views/relation/customs/_index.html.erb +0 -28
- data/app/views/relation/customs/index.js.erb +0 -2
- data/app/views/spheres/_form.html.erb +0 -28
- data/app/views/spheres/_list.html.erb +0 -19
- data/app/views/spheres/create.js.erb +0 -20
- data/app/views/spheres/index.html.erb +0 -74
- data/spec/controllers/spheres_controller_spec.rb +0 -116
- data/spec/factories/sphere.rb +0 -5
- data/spec/models/relation_custom_spec.rb +0 -14
data/app/models/user.rb
CHANGED
@@ -29,8 +29,12 @@ class User < ActiveRecord::Base
|
|
29
29
|
|
30
30
|
# Subjects this user can acts as
|
31
31
|
def represented
|
32
|
+
candidates = contact_actors(:direction => :sent).map(&:id)
|
33
|
+
|
32
34
|
contact_subjects(:direction => :received) do |q|
|
33
|
-
q.joins(:sent_ties => { :relation => :permissions }).
|
35
|
+
q.joins(:sent_ties => { :relation => :permissions }).
|
36
|
+
merge(Permission.represent).
|
37
|
+
where(:id => candidates)
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
@@ -19,7 +19,10 @@
|
|
19
19
|
</div>
|
20
20
|
|
21
21
|
<div id="activities_share_btn">
|
22
|
-
|
23
|
-
|
22
|
+
<% if current_subject == receiver %>
|
23
|
+
<div id="securities"><%= select_tag :_relation_ids, options_for_select(current_subject.activity_relations(receiver).sort.map{ |r| [ r.name, r.id ] }), :id => 'security', :multiple => nil %></div>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<%= submit_tag(t('share'), :class => "myButtonBlue", :id => "masterSubmitButton") %>
|
24
27
|
</div>
|
25
28
|
<% end %>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<div class="activity_options">
|
2
2
|
<ul class="activity_options" >
|
3
3
|
<li><div class="post_time_ago"><%= t('time.ago', :time => time_ago_in_words(activity.created_at)) %></div></li>
|
4
|
-
<% if activity.is_root? && user_signed_in?
|
4
|
+
<% if activity.is_root? && user_signed_in? %>
|
5
5
|
<li><div class="verb_comment"> · <%= link_to t('activity.to_comment'), "#", :class => "to_comment" %> </div></li>
|
6
6
|
<% end %>
|
7
7
|
<li><div class="verb_like" id="like_<%= dom_id(activity) %>"> · <%= link_like(activity)%></div></li>
|
8
|
-
<% if activity.
|
8
|
+
<% if activity.delete_object_by?(current_subject) %>
|
9
9
|
<li><div class="verb_delete"> · <%= link_to t('activity.delete'), activity.direct_object , :confirm => t('confirm_delete', :scope => activity.direct_object.class.to_s.underscore), :method => :delete, :remote => true %> </div></li>
|
10
10
|
<% end %>
|
11
11
|
</ul>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
<div id="tabs" class="block">
|
11
11
|
<ul class="activity_tabs">
|
12
|
-
<li><%= link_to "<span>#{ h owner.name }</span>".html_safe, "#wall-profile" %></li>
|
12
|
+
<li><%= link_to "<span>#{ h truncate_name owner.name }</span>".html_safe, "#wall-profile" %></li>
|
13
13
|
|
14
14
|
<% owner.relation_customs.sort.each do |r| %>
|
15
15
|
<li><%= link_to "<span>#{ h r.name }</span>".html_safe,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<%= div_for contact, :class => 'row' do %>
|
2
2
|
<div class="logo">
|
3
3
|
<%= link_to(image_tag(contact.receiver.logo.url(:contact)),
|
4
4
|
contact.receiver_subject) %>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<%= contact_to(contact.receiver) %>
|
15
15
|
</div>
|
16
16
|
</div>
|
17
|
-
<div class="close"><%=link_to
|
17
|
+
<div class="close"><%= link_to 'X', contact, :method => :delete, :remote => true %></div>
|
18
18
|
<div class="space_center">
|
19
19
|
</div>
|
20
|
-
|
20
|
+
<% end %>
|
@@ -10,9 +10,6 @@
|
|
10
10
|
|
11
11
|
function checkBoxEnable(id) {
|
12
12
|
$('div[contain$=' + id + ']').addClass("checked-option");
|
13
|
-
|
14
|
-
var sphere = $("#"+id).attr("optionOf");
|
15
|
-
$(':checkbox[optionOf$='+sphere+']:checked:not(#'+id+')').checkBox('changeCheckStatus', false);
|
16
13
|
}
|
17
14
|
|
18
15
|
function checkBoxDisable(id) {
|
@@ -24,24 +21,21 @@
|
|
24
21
|
<%= form_for @contact do |f| %>
|
25
22
|
<%= hidden_field_tag "contact[relation_ids][]", "gotcha" %>
|
26
23
|
|
27
|
-
|
28
|
-
|
29
|
-
<
|
30
|
-
|
31
|
-
|
32
|
-
<
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
</div>
|
38
|
-
</li>
|
39
|
-
<% end %>
|
40
|
-
</ul>
|
24
|
+
<ul>
|
25
|
+
<% current_subject.relation_customs.each do |relation| %>
|
26
|
+
<li>
|
27
|
+
<div contain="<%= dom_id relation %>">
|
28
|
+
<input id="<%= dom_id relation %>" name="contact[relation_ids][]" value="<%= relation.id %>" type="checkbox" <%= raw('checked="checked"') if @contact.relation_ids.include?(relation.id) %> />
|
29
|
+
<label for="<%= dom_id relation %>">
|
30
|
+
<%= relation.name %>
|
31
|
+
</label>
|
32
|
+
</div>
|
33
|
+
</li>
|
41
34
|
<% end %>
|
35
|
+
</ul>
|
42
36
|
|
43
|
-
<div id="
|
44
|
-
<%= link_to t('contact.type.new'),
|
37
|
+
<div id="relation-new">
|
38
|
+
<%= link_to t('contact.type.new'), relation_customs_path %>
|
45
39
|
</div>
|
46
40
|
|
47
41
|
<div id="contact-message">
|
@@ -50,7 +44,7 @@
|
|
50
44
|
</div>
|
51
45
|
|
52
46
|
<div id="contact-submit">
|
53
|
-
<%= submit_tag t("contact.#{
|
47
|
+
<%= submit_tag t("contact.#{ f.object.action }.submit"), :class => "button" %>
|
54
48
|
</div>
|
55
49
|
<% end %>
|
56
50
|
</div>
|
@@ -1,16 +1,4 @@
|
|
1
1
|
<% if current_subject.suggestion.present? %>
|
2
|
-
<% content_for :javascript do %>
|
3
|
-
|
4
|
-
$(".suggestions .close").livequery("click",function(){
|
5
|
-
temp = $(this);
|
6
|
-
$.get("<%=suggestion_contacts_path%>", function(data) {
|
7
|
-
temp.parents(".contact").replaceWith(data);
|
8
|
-
});
|
9
|
-
|
10
|
-
});
|
11
|
-
|
12
|
-
<% end %>
|
13
|
-
|
14
2
|
<div class="block">
|
15
3
|
<div class="header">
|
16
4
|
<%= image_tag('btn/notifications.png', :class => "header_icon") %>
|
@@ -21,7 +9,7 @@
|
|
21
9
|
<div class="content">
|
22
10
|
<div class="suggestions">
|
23
11
|
<% if (sgs = current_subject.suggestions(2)).present? %>
|
24
|
-
<%= render
|
12
|
+
<%= render sgs %>
|
25
13
|
<%end%>
|
26
14
|
</div>
|
27
15
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% toolbar :profile => @contact.receiver_subject, :option => 'contacts' %>
|
2
2
|
|
3
3
|
<% location link_to(image_tag("btn/btn_friend.png", :class => "menu_icon") +
|
4
|
-
t(
|
4
|
+
t("contact.#{ @contact.action }.title", :name => @contact.receiver.name), edit_contact_path(@contact.to_param)) %>
|
5
5
|
|
6
6
|
<%= render :partial => 'form' %>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
</div>
|
9
9
|
<div class="content_left">
|
10
10
|
<div class="sender_name">
|
11
|
-
<%= link_to conversation.last_sender.name, conversation.last_sender.subject %>
|
11
|
+
<%= link_to truncate_name(conversation.last_sender.name), conversation.last_sender.subject %>
|
12
12
|
</div>
|
13
13
|
<div class="date">
|
14
14
|
<%= t('time.ago', :time => time_ago_in_words(conversation.updated_at)) %>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%=link_to(image_tag(group.logo.url(:actor), :class => 'btn_group', :alt => group.name, :title => group.name), group) %>
|
5
5
|
</div>
|
6
6
|
<div class="group_title">
|
7
|
-
<%=link_to(group.name, group)%>
|
7
|
+
<%=link_to(truncate_name(group.name), group)%>
|
8
8
|
</div>
|
9
9
|
<% end %>
|
10
10
|
</li>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<% end %>
|
17
17
|
|
18
18
|
<%= location(link_to(image_tag("btn/btn_group.png", :class => "btn_config")+t('group.one')+": "+
|
19
|
-
content_tag(:span, ( sanitize @group.name), :class=>"name_group")))%>
|
19
|
+
content_tag(:span, ( truncate_name sanitize @group.name), :class=>"name_group")))%>
|
20
20
|
|
21
21
|
<% toolbar :profile => @group %>
|
22
22
|
|
@@ -2,12 +2,23 @@
|
|
2
2
|
<div>
|
3
3
|
<span id="name" style="font-weight: bold;"><%= @sender.name %></span> has invited you to <%= link_to( t('socialstream'), new_user_registration_url)%>
|
4
4
|
<br/>
|
5
|
-
<
|
6
|
-
<
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
<div style="position: absolute;padding: 5px; border: #2A3890 solid 2px; background-color: #E1EEF5; margin:10px; min-height: 125px; width: 500px;">
|
6
|
+
<div style="float:left; margin-right:7px; border: thin solid #D4E4EA; background-color: white; max-height: 119px;">
|
7
|
+
<img src="http://<%= ActionMailer::Base.default_url_options[:host] +@sender.logo.url(:profile)%>" alt="<%=@sender.name%>">
|
8
|
+
</div>
|
9
|
+
<div style=" margin: 5px 5px 5px 5px;">
|
10
|
+
<p style="font-weight: bold; "><%= @sender.name %>
|
11
|
+
<% if @sender.profile.organization? %>
|
12
|
+
<br/><span style="color: #6C6D6F; font-weight: normal;"><%= @sender.profile.organization%></span>
|
13
|
+
<% end %>
|
14
|
+
</p>
|
15
|
+
<% if @message.blank? %>
|
16
|
+
<p style="text-align: justify;"><%= t('invitation.join_me')%></p>
|
17
|
+
<%else%>
|
18
|
+
<p style="text-align: justify; font-style: italic;">"<%= @message%>"</p>
|
19
|
+
<%end%>
|
20
|
+
</div>
|
21
|
+
</div>
|
11
22
|
</div>
|
12
23
|
<div>
|
13
24
|
<div>
|
@@ -1,5 +1,10 @@
|
|
1
|
-
<%= @sender.name %> has invited you to <%= t('socialstream')%>: <%=
|
2
|
-
|
1
|
+
<%= @sender.name %> has invited you to <%= t('socialstream')%>: <%= new_user_registration_url%>
|
2
|
+
|
3
|
+
<% if @message.blank? %>
|
4
|
+
<%= t('invitation.join_me')%>
|
5
|
+
<%else%>
|
6
|
+
"<%= @message%>"
|
7
|
+
<%end%>
|
3
8
|
|
4
9
|
<%= t('frontpage.main_title') %>
|
5
10
|
|
@@ -4,24 +4,28 @@
|
|
4
4
|
<% else %>
|
5
5
|
<%= link_to(image_tag(current_user.logo.url(:representation), :width => 20, :height => 20, :class => 'menu_icon'), current_user) %>
|
6
6
|
<% end %>
|
7
|
-
<%= link_to(current_user.name, current_user) %>
|
8
|
-
|
9
|
-
<%= t('representation.action') %>
|
7
|
+
<%= link_to(truncate_name(current_user.name), current_user) %>
|
10
8
|
</div>
|
11
9
|
|
10
|
+
|
12
11
|
<% representations = current_user.represented.unshift(current_user) - [current_subject] %>
|
13
12
|
|
14
|
-
|
13
|
+
<% if !representations.empty? %>
|
14
|
+
|
15
|
+
<span id="representation_text"><%= t('representation.action') %></span>
|
16
|
+
|
17
|
+
<div id="representations_menu">
|
15
18
|
<ul class="sf-menu" >
|
16
19
|
<li id="representation_li">
|
17
|
-
<a href="#" class="sf-with-ul" id="current_subject_avatar_img" style="background: transparent url('<%= image_path current_subject.logo.url(:representation)%>') no-repeat left top;"><%= current_subject.name %><span class="sf-sub-indicator"> »</span></a>
|
20
|
+
<a href="#" class="sf-with-ul" id="current_subject_avatar_img" style="background: transparent url('<%= image_path current_subject.logo.url(:representation)%>') no-repeat left top;"><%= truncate_name current_subject.name %><span class="sf-sub-indicator"> »</span></a>
|
18
21
|
<ul>
|
19
22
|
<% representations.each do |representation| %>
|
20
23
|
<li>
|
21
|
-
<%= link_to representation.name, { :s => representation.slug }, { :style => "background: transparent url('#{ image_path representation.logo.url(:representation)}') no-repeat left center;margin-left:2px;" } %>
|
24
|
+
<%= link_to truncate_name(representation.name), { :s => representation.slug }, { :style => "background: transparent url('#{ image_path representation.logo.url(:representation)}') no-repeat left center;margin-left:2px;" } %>
|
22
25
|
</li>
|
23
26
|
<% end %>
|
24
27
|
</ul>
|
25
28
|
</li>
|
26
29
|
</ul>
|
27
30
|
</div>
|
31
|
+
<% end %>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<div class="header">
|
9
9
|
<div class="content_left">
|
10
10
|
<div class="sender_name">
|
11
|
-
<%= link_to message.sender.name, message.sender.subject %>
|
11
|
+
<%= link_to truncate_name(message.sender.name), message.sender.subject %>
|
12
12
|
</div>
|
13
13
|
<div class="date">
|
14
14
|
<%= t('time.ago', :time => time_ago_in_words(message.updated_at)) %>
|
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
<% unless @recipient.nil? %>
|
49
|
-
$("#_recipients").trigger("addItem",[{"title": "<%= @recipient.name %>", "value": "<%= @recipient.id %>"}]);
|
49
|
+
$("#_recipients").trigger("addItem",[{"title": "<%= truncate_name @recipient.name %>", "value": "<%= @recipient.id %>"}]);
|
50
50
|
<% end %>
|
51
51
|
|
52
52
|
$(".new_message").validate();
|
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
<div class="notification"></div>
|
4
4
|
<div class="sender_photo">
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
<%if notification.object.nil? %>
|
6
|
+
<%= image_tag('logos/actor/user.png',:title => "unknown", :alt => "unknown")%>
|
7
|
+
<%else%>
|
8
|
+
<%= link_to image_tag(notification.object.sender.logo.url(:actor),
|
9
|
+
:title => notification.object.sender.name, :alt => notification.object.sender.name),
|
10
|
+
notification.object.sender.subject %>
|
11
|
+
<%end%>
|
8
12
|
</div>
|
9
13
|
<div class="content_left">
|
10
14
|
<div class="date">
|
@@ -5,10 +5,4 @@
|
|
5
5
|
<%= f.hidden_field :_contact_id %>
|
6
6
|
|
7
7
|
<%= render :partial => object.class.to_s.tableize+'/fields' , :locals => {:f => f} %>
|
8
|
-
|
9
|
-
<% if current_subject != receiver %>
|
10
|
-
<% current_subject.activity_relations(receiver, :from => :receiver).each do |r| %>
|
11
|
-
<%= f.hidden_field "_relation_ids][", :value => r.id %>
|
12
|
-
<% end %>
|
13
|
-
<% end %>
|
14
8
|
<% end %>
|
@@ -80,12 +80,6 @@ end %>
|
|
80
80
|
<% end %>
|
81
81
|
|
82
82
|
<% if !params[:section].present? or params[:section].eql?("about_me") %>
|
83
|
-
<% content_for :javascript do %>
|
84
|
-
$(function () {
|
85
|
-
$( "#profile_birthday" ).datepicker({ yearRange: '1900:<%= Time.now.utc.to_date.year%>',
|
86
|
-
changeYear: true, maxDate: '+0d', defaultDate: '-30y'});
|
87
|
-
});
|
88
|
-
<% end %>
|
89
83
|
<div class="row">
|
90
84
|
<div class="form_row">
|
91
85
|
<h2><%=t('profile.' + current_subject.class.to_s.downcase + '.info')%></h2>
|
@@ -94,10 +88,10 @@ end %>
|
|
94
88
|
<%= f.fields_for :actor do |actor_form| %>
|
95
89
|
<div class="form_row">
|
96
90
|
<div class="form_label">
|
97
|
-
<%= f.label t('actor.name')
|
91
|
+
<%= f.label t('actor.name') %><span class="needed"> (*)</span>
|
98
92
|
</div>
|
99
93
|
<div class="form_field">
|
100
|
-
<%= actor_form.text_field :name, :class => "required form_tag"
|
94
|
+
<%= actor_form.text_field :name, :class => "required form_tag"%>
|
101
95
|
</div>
|
102
96
|
</div>
|
103
97
|
<%end%>
|
@@ -118,7 +112,7 @@ end %>
|
|
118
112
|
<%= f.label t('profile.' + current_subject.class.to_s.downcase + '.birthday')%>
|
119
113
|
</div>
|
120
114
|
<div class="form_field">
|
121
|
-
<%=
|
115
|
+
<%= date_select "profile", "birthday", :order => [:day, :month, :year], :end_year=> Date.today.year, :start_year=> (Date.today.year - 100) %>
|
122
116
|
</div>
|
123
117
|
</div>
|
124
118
|
|
@@ -146,6 +140,7 @@ end %>
|
|
146
140
|
<div class="form_row">
|
147
141
|
<%= f.text_area :description, :maxlength => 200, :rows => 10, :class => "form_tag_long" %>
|
148
142
|
</div>
|
143
|
+
<div class="form_row needed"><%=t('required')%></div>
|
149
144
|
<% end %>
|
150
145
|
<% if !params[:section].present? or params[:section].eql?("contact_info") %>
|
151
146
|
<div class="form_row">
|
@@ -205,6 +200,7 @@ end %>
|
|
205
200
|
<% if params[:section].present? %>
|
206
201
|
<%= hidden_field_tag("section", params[:section]) %>
|
207
202
|
<% end %>
|
203
|
+
|
208
204
|
<div class="form_row space_center">
|
209
205
|
<%= f.submit t('button.update'), :class => "button" %>
|
210
206
|
<button class="button" onclick="window.location.href='<%= polymorphic_path(current_subject) %>';">
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<% @custom ||=
|
1
|
+
<% @custom ||= Relation::Custom.new(:actor_id => current_subject.actor_id) %>
|
2
2
|
|
3
3
|
<%= form_for @custom, :remote => true do |f| %>
|
4
|
-
<%= f.hidden_field :
|
4
|
+
<%= f.hidden_field :actor_id %>
|
5
5
|
|
6
6
|
<% if @custom.errors.any? %>
|
7
7
|
<div id="error_explanation">
|
@@ -26,28 +26,9 @@ function checkBoxEnable(id) {
|
|
26
26
|
|
27
27
|
switch (checkBoxType(id)) {
|
28
28
|
|
29
|
-
case "sphere":
|
30
|
-
$(':checkbox[id^="sphere"]:checked:not(#' + id + ')').checkBox('changeCheckStatus', false);
|
31
|
-
|
32
|
-
var sphereSelected = checkBoxId(id);
|
33
|
-
|
34
|
-
$.ajax({
|
35
|
-
url: "<%= relation_customs_path %>",
|
36
|
-
context: document.body,
|
37
|
-
data: { sphere_id: sphereSelected },
|
38
|
-
dataType: "script"
|
39
|
-
});
|
40
|
-
|
41
|
-
break;
|
42
|
-
|
43
29
|
case "relation_custom":
|
44
30
|
$(':checkbox[id^="relation_custom"]:checked:not(#' + id + ')').checkBox('changeCheckStatus', false);
|
45
31
|
|
46
|
-
var value = relations.length - checkBoxOrder(id) - 2;
|
47
|
-
$("#slider-range").slider("value", value);
|
48
|
-
|
49
|
-
$( "#relation" ).val(checkBoxValue(id));
|
50
|
-
|
51
32
|
$.ajax({
|
52
33
|
url: "<%= permissions_path %>",
|
53
34
|
context: document.body,
|
@@ -73,19 +54,10 @@ function checkBoxDisable(id) {
|
|
73
54
|
|
74
55
|
switch (checkBoxType(id)) {
|
75
56
|
|
76
|
-
case "sphere":
|
77
|
-
$("#permissions").html("");
|
78
|
-
$("#permissions").hide();
|
79
|
-
$("#relations").hide();
|
80
|
-
|
81
|
-
break;
|
82
|
-
|
83
57
|
case "relation_custom":
|
84
58
|
$("#permissions").html("");
|
85
59
|
$("#permissions").hide();
|
86
60
|
|
87
|
-
$("#slider-range").slider("value", relations.length - 1);
|
88
|
-
|
89
61
|
break;
|
90
62
|
|
91
63
|
case "permission":
|
@@ -98,33 +70,3 @@ function checkBoxDisable(id) {
|
|
98
70
|
|
99
71
|
}
|
100
72
|
}
|
101
|
-
|
102
|
-
|
103
|
-
function initSlider() {
|
104
|
-
/* TODO: get relations from checkboxOptions */
|
105
|
-
relations.unshift("<%= t 'relation_public.name' %>");
|
106
|
-
relations.push("<%= current_subject.name %>");
|
107
|
-
|
108
|
-
$("#relation").val(relations[relations.length - 1]);
|
109
|
-
|
110
|
-
$("#slider-range").slider({
|
111
|
-
orientation: "vertical",
|
112
|
-
range: "min",
|
113
|
-
min: 0,
|
114
|
-
max: relations.length - 1,
|
115
|
-
step: 1,
|
116
|
-
value: relations.length - 1,
|
117
|
-
slide: function(event, ui) {
|
118
|
-
$('#relation').val(relations[ui.value]);
|
119
|
-
},
|
120
|
-
stop: function(event, ui) {
|
121
|
-
var order = relations.length - ui.value - 2;
|
122
|
-
if (order >= 0 && order < relations.length - 2) {
|
123
|
-
var id = '#' + checkBoxIdByOrder(order);
|
124
|
-
$(id).checkBox('changeCheckStatus', true);
|
125
|
-
} else {
|
126
|
-
$(':checkbox[id^="relation_custom"]:checked').checkBox('changeCheckStatus', false);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
});
|
130
|
-
};
|