Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
diaspora
Commits
defaba50
Commit
defaba50
authored
Oct 20, 2011
by
Maxwell Salzberg
Committed by
danielgrippi
Oct 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functional 'show me where this post came from' in soup
parent
5dc36b14
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
9 deletions
+60
-9
app/helpers/interim_stream_hackiness_helper.rb
app/helpers/interim_stream_hackiness_helper.rb
+12
-0
app/views/shared/_stream_element.html.haml
app/views/shared/_stream_element.html.haml
+2
-3
lib/stream/base.rb
lib/stream/base.rb
+4
-0
lib/stream/soup.rb
lib/stream/soup.rb
+20
-6
public/javascripts/pages/soups-index.js
public/javascripts/pages/soups-index.js
+3
-0
public/stylesheets/sass/application.sass
public/stylesheets/sass/application.sass
+19
-0
No files found.
app/helpers/interim_stream_hackiness_helper.rb
View file @
defaba50
...
...
@@ -19,4 +19,16 @@ module InterimStreamHackinessHelper
nil
end
end
def
from_group
(
post
)
if
params
[
:controller
]
==
'soups'
@stream
.
post_from_group
(
post
)
else
nil
end
end
def
what_soup_sentence
(
post
)
from_group
(
post
).
map
{
|
x
|
x
.
to_s
.
gsub
(
"_soup"
,
''
).
gsub
(
'_'
,
' '
).
titleize
}.
to_sentence
end
end
app/views/shared/_stream_element.html.haml
View file @
defaba50
...
...
@@ -3,7 +3,7 @@
-# the COPYRIGHT file.
.stream_element
{
:id
=>
post
.
guid
}
.stream_element
{
:id
=>
post
.
guid
,
:class
=>
from_group
(
post
)
}
.right.controls
-
if
current_user
&&
post
.
author
.
owner_id
==
current_user
.
id
=
link_to
image_tag
(
'deletelabel.png'
),
post_path
(
post
),
:confirm
=>
t
(
'are_you_sure'
),
:method
=>
:delete
,
:remote
=>
true
,
:class
=>
"delete stream_element_delete"
,
:title
=>
t
(
'delete'
)
...
...
@@ -17,10 +17,9 @@
%p
=
t
(
'share_visibilites.update.see_it_on_their_profile'
,
:name
=>
person_link
(
post
.
author
)).
html_safe
=
link_to
t
(
'undo'
),
share_visibility_path
(
:id
=>
"42"
,
:post_id
=>
post
.
id
),
:method
=>
:put
,
:remote
=>
true
.indicator
{
:title
=>
"from #{what_soup_sentence(post)}"
}
.sm_body
=
person_image_link
(
post
.
author
,
:size
=>
:thumb_small
)
.content
%div
.post_initial_info
%span
.from
...
...
lib/stream/base.rb
View file @
defaba50
...
...
@@ -29,6 +29,10 @@ class Stream::Base
post_is_from_contact?
(
post
)
end
def
post_from_group
(
post
)
nil
end
# @return [String]
def
title
'a title'
...
...
lib/stream/soup.rb
View file @
defaba50
...
...
@@ -13,7 +13,7 @@ class Stream::Soup < Stream::Base
def
posts
@posts
||=
lambda
do
post_ids
=
aspect
_posts_ids
+
followed_tag
_ids
+
mentioned_post_ids
post_ids
=
aspect
s_post_ids
+
followed_tags_post
_ids
+
mentioned_post_ids
post_ids
+=
community_spotlight_post_ids
if
include_community_spotlight?
Post
.
where
(
:id
=>
post_ids
).
for_a_stream
(
max_time
,
order
)
end
.
call
...
...
@@ -23,18 +23,32 @@ class Stream::Soup < Stream::Base
false
end
#emits an enum of the groups which the post appeared
# :spotlight, :aspects, :tags, :mentioned
def
post_from_group
(
post
)
[
:community_spotlight
,
:aspects
,
:followed_tags
,
:mentioned
].
collect
do
|
source
|
is_in?
(
source
,
post
)
end
.
compact
end
private
def
is_in?
(
sym
,
post
)
if
self
.
send
(
"
#{
sym
.
to_s
}
_post_ids"
).
find
{
|
x
|
x
==
post
.
id
}
"
#{
sym
.
to_s
}
_soup"
.
to_sym
end
end
def
include_community_spotlight?
false
end
def
aspect
_posts
_ids
@aspect
_posts
_ids
||=
user
.
visible_shareable_ids
(
Post
,
:limit
=>
15
,
:order
=>
"
#{
order
}
DESC"
,
:max_time
=>
max_time
,
:all_aspects?
=>
true
,
:by_members_of
=>
aspect_ids
)
def
aspect
s_post
_ids
@aspect
s_post
_ids
||=
user
.
visible_shareable_ids
(
Post
,
:limit
=>
15
,
:order
=>
"
#{
order
}
DESC"
,
:max_time
=>
max_time
,
:all_aspects?
=>
true
,
:by_members_of
=>
aspect_ids
)
end
def
followed_tag_ids
@followed_tag_ids
||=
ids
(
StatusMessage
.
tag_stream
(
user
,
tag_array
,
max_time
,
order
))
def
followed_tag
s_post
_ids
@followed_tag
s
_ids
||=
ids
(
StatusMessage
.
tag_stream
(
user
,
tag_array
,
max_time
,
order
))
end
def
mentioned_post_ids
...
...
@@ -47,7 +61,7 @@ class Stream::Soup < Stream::Base
#worthless helpers
def
community_spotlight_person_ids
Person
.
community_spotlight
.
select
(
'id'
).
map
{
|
x
|
x
.
id
}
@community_spotlight_person_ids
||=
Person
.
community_spotlight
.
select
(
'id'
).
map
{
|
x
|
x
.
id
}
end
def
tag_array
...
...
public/javascripts/pages/soups-index.js
View file @
defaba50
...
...
@@ -5,5 +5,8 @@ Diaspora.Pages.SoupsIndex = function() {
self
.
aspectNavigation
=
self
.
instantiate
(
"
AspectNavigation
"
,
document
.
find
(
"
ul#aspect_nav
"
));
self
.
stream
=
self
.
instantiate
(
"
Stream
"
,
document
.
find
(
"
#aspect_stream_container
"
));
self
.
infiniteScroll
=
self
.
instantiate
(
"
InfiniteScroll
"
);
$
(
'
.indicator
'
).
tipsy
({
fade
:
true
});
});
};
public/stylesheets/sass/application.sass
View file @
defaba50
...
...
@@ -3493,3 +3493,22 @@ ul#getting_started
:
margin-top
-28px
:
color
#999
:
padding-right
9px
.indicator
:
margin-top
-15px
:
width
14px
:
height
4px
:
float
right
.aspects_soup
.indicator
:
background-color
red
.community_spotlight_soup
.indicator
:
background-color
green
.mentioned_soup
.indicator
:
background-color
blue
.followed_tags_soup
.indicator
:
background-color
yellow
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment