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
841cc29d
Commit
841cc29d
authored
Dec 16, 2011
by
danielgrippi
Committed by
Dennis Collinson
Jan 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add api block to photo; photos display in stream
parent
6911ed5d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
0 deletions
+45
-0
app/models/photo.rb
app/models/photo.rb
+14
-0
app/models/post.rb
app/models/post.rb
+2
-0
app/models/status_message.rb
app/models/status_message.rb
+4
-0
app/views/templates/reshare.ujs
app/views/templates/reshare.ujs
+15
-0
app/views/templates/status_message.ujs
app/views/templates/status_message.ujs
+10
-0
No files found.
app/models/photo.rb
View file @
841cc29d
...
...
@@ -8,6 +8,20 @@ class Photo < ActiveRecord::Base
include
Diaspora
::
Commentable
include
Diaspora
::
Shareable
# NOTE API V1 to be extracted
acts_as_api
api_accessible
:backbone
do
|
t
|
t
.
add
:id
t
.
add
:guid
t
.
add
:created_at
t
.
add
:author
t
.
add
lambda
{
|
photo
|
{
:small
=>
photo
.
url
(
:thumb_small
),
:medium
=>
photo
.
url
(
:thumb_medium
),
:large
=>
photo
.
url
(
:scaled_full
)
}
},
:as
=>
:sizes
end
mount_uploader
:processed_image
,
ProcessedImage
mount_uploader
:unprocessed_image
,
UnprocessedImage
...
...
app/models/post.rb
View file @
841cc29d
...
...
@@ -25,11 +25,13 @@ class Post < ActiveRecord::Base
t
.
add
:provider_display_name
t
.
add
:author
t
.
add
:post_type
t
.
add
:photos_count
t
.
add
:image_url
t
.
add
:object_url
t
.
add
:root
t
.
add
:o_embed_cache
t
.
add
:user_like
t
.
add
:photos
end
xml_attr
:provider_display_name
...
...
app/models/status_message.rb
View file @
841cc29d
...
...
@@ -40,6 +40,10 @@ class StatusMessage < Post
joins
(
:likes
).
where
(
:likes
=>
{
:author_id
=>
person
.
id
})
}
def
photos_count
self
.
photos
.
size
end
def
self
.
guids_for_author
(
person
)
Post
.
connection
.
select_values
(
Post
.
where
(
:author_id
=>
person
.
id
).
select
(
'posts.guid'
).
to_sql
)
end
...
...
app/views/templates/reshare.ujs
View file @
841cc29d
...
...
@@ -22,10 +22,25 @@
</div>
<!-- duplicate from statusmessage partial -->
<% if(root.photos_count > 0) { %>
<div class="photo_attachments">
<img src="<%= root.photos[0].sizes.large %>" class="stream-photo big_stream_photo">
<% for(photo in root.photos) {
if(photo == 0){ continue; }
if(photo == 8){ break; } %>
<img src="<%= root.photos[photo].sizes.small %>" class="stream-photo thumb_small">
<% } %>
<% } %>
<p>
<%= root.text %>
</p>
<% if(o_embed_cache) { %>
<%= root.o_embed_cache.posts.data.html %>
<% } %>
<!-- end duplication -->
</div>
<% } else { %>
...
...
app/views/templates/status_message.ujs
View file @
841cc29d
<% if(photos_count > 0) { %>
<div class="photo_attachments">
<img src="<%= photos[0].sizes.large %>" class="stream-photo big_stream_photo">
<% for(photo in photos) {
if(photo == 0){ continue; }
if(photo == 8){ break; } %>
<img src="<%= photos[photo].sizes.small %>" class="stream-photo thumb_small">
<% } %>
<% } %>
<p>
<%= text %>
</p>
...
...
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