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
6fc6474e
Commit
6fc6474e
authored
Mar 01, 2014
by
Steffen van Bergerem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor publisher
parent
1b85d9d0
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
232 additions
and
209 deletions
+232
-209
app/helpers/layout_helper.rb
app/helpers/layout_helper.rb
+3
-0
app/helpers/publisher_helper.rb
app/helpers/publisher_helper.rb
+15
-0
app/views/aspects/_aspect_stream.haml
app/views/aspects/_aspect_stream.haml
+1
-1
app/views/publisher/_aspect_dropdown.html.haml
app/views/publisher/_aspect_dropdown.html.haml
+34
-0
app/views/publisher/_publisher.html.haml
app/views/publisher/_publisher.html.haml
+4
-0
app/views/publisher/_publisher.mobile.haml
app/views/publisher/_publisher.mobile.haml
+4
-4
app/views/publisher/_publisher_blueprint.html.haml
app/views/publisher/_publisher_blueprint.html.haml
+94
-0
app/views/publisher/_publisher_bootstrap.html.haml
app/views/publisher/_publisher_bootstrap.html.haml
+71
-0
app/views/shared/_publisher.html.haml
app/views/shared/_publisher.html.haml
+0
-198
app/views/status_messages/bookmarklet.html.haml
app/views/status_messages/bookmarklet.html.haml
+1
-1
app/views/status_messages/bookmarklet.mobile.haml
app/views/status_messages/bookmarklet.mobile.haml
+1
-1
app/views/status_messages/new.html.haml
app/views/status_messages/new.html.haml
+2
-2
app/views/status_messages/new.mobile.haml
app/views/status_messages/new.mobile.haml
+1
-1
app/views/tags/show.haml
app/views/tags/show.haml
+1
-1
No files found.
app/helpers/layout_helper.rb
View file @
6fc6474e
...
...
@@ -85,4 +85,7 @@ module LayoutHelper
end
.
join
(
' '
).
html_safe
end
def
bootstrap?
@css_framework
==
:bootstrap
end
end
app/helpers/publisher_helper.rb
View file @
6fc6474e
...
...
@@ -10,4 +10,19 @@ module PublisherHelper
def
all_aspects_selected?
(
selected_aspects
)
@all_aspects_selected
||=
all_aspects
.
size
==
selected_aspects
.
size
end
def
service_button
(
service
)
content_tag
:div
,
:class
=>
"btn btn-link service_icon dim"
,
:title
=>
"
#{
service
.
provider
.
titleize
}
(
#{
service
.
nickname
}
)"
,
:id
=>
"
#{
service
.
provider
}
"
,
:maxchar
=>
"
#{
service
.
class
::
MAX_CHARACTERS
}
"
,
:data
=>
{
:toggle
=>
'tooltip'
,
:placement
=>
'bottom'
}
do
if
service
.
provider
==
'wordpress'
content_tag
(
:span
,
''
,
:class
=>
"social_media_logos-wordpress-16x16"
)
else
content_tag
(
:i
,
''
,
:class
=>
"entypo small
#{
service
.
provider
}
"
)
end
end
end
end
app/views/aspects/_aspect_stream.haml
View file @
6fc6474e
...
...
@@ -6,7 +6,7 @@
%h3
#aspect_stream_header
.stream_title
=
stream
.
title
=
render
'
shared/publisher'
,
:selected_aspects
=>
stream
.
aspects
,
:aspect_ids
=>
stream
.
aspect_ids
,
:for_all_aspects
=>
stream
.
for_all_aspects?
,
:aspect
=>
stream
.
aspect
=
render
'
publisher/publisher'
,
:selected_aspects
=>
stream
.
aspects
,
:aspect_ids
=>
stream
.
aspect_ids
,
:aspect
=>
stream
.
aspect
=
render
'aspects/no_posts_message'
#gs-shim
{
:title
=>
popover_with_close_html
(
"3. #{t('.stay_updated')}"
),
'data-content'
=>
t
(
'.stay_updated_explanation'
)}
...
...
app/views/publisher/_aspect_dropdown.html.haml
0 → 100644
View file @
6fc6474e
.btn-group.aspect_dropdown
%button
.btn.btn-default.dropdown-toggle
{
!
current_user
.
getting_started?
?
{
'data-toggle'
=>
'dropdown'
}
:
{
'data-toggle'
=>
'dropdown'
,
:title
=>
popover_with_close_html
(
"2. #{t('shared.public_explain.control_your_audience')}"
),
'data-content'
=>
t
(
'shared.public_explain.visibility_dropdown'
)}
}
%span
.text
-
if
publisher_public
=
t
(
'public'
)
-
elsif
all_aspects_selected?
(
selected_aspects
)
=
t
(
'all_aspects'
)
-
elsif
selected_aspects
.
size
==
1
=
selected_aspects
.
first
.
name
-
else
=
t
(
'shared.aspect_dropdown.toggle'
,
:count
=>
selected_aspects
.
size
)
%span
.caret
%ul
.dropdown-menu.pull-right
{
:unSelectable
=>
'on'
}
%li
.public.radio
{
"data-aspect_id"
=>
"public"
,
:class
=>
(
"selected"
if
publisher_public
)}
%a
%span
.status_indicator
%i
.icon-ok
%span
.text
=
t
(
'public'
)
%li
.all_aspects.radio
{
"data-aspect_id"
=>
"all_aspects"
,
:class
=>
(
"selected"
if
(
!
publisher_public
&&
all_aspects_selected?
(
selected_aspects
)))}
%a
%span
.status_indicator
%i
.icon-ok
%span
.text
=
t
(
'all_aspects'
)
%li
.divider
-
for
aspect
in
all_aspects
%li
.aspect_selector
{
'data-aspect_id'
=>
aspect
.
id
,
:class
=>
!
all_aspects_selected?
(
selected_aspects
)
&&
selected_aspects
.
include?
(
aspect
)
?
"selected"
:
""
}
%a
%span
.status_indicator
%i
.icon-ok
%span
.text
=
aspect
.
name
app/views/publisher/_publisher.html.haml
0 → 100644
View file @
6fc6474e
-
if
bootstrap?
=
render
:partial
=>
'publisher/publisher_bootstrap'
,
:locals
=>
{
:aspect
=>
aspect
,
:selected_aspects
=>
selected_aspects
,
:aspect_ids
=>
aspect_ids
}
-
else
=
render
:partial
=>
'publisher/publisher_blueprint'
,
:locals
=>
{
:aspect
=>
aspect
,
:selected_aspects
=>
selected_aspects
,
:aspect_ids
=>
aspect_ids
}
app/views/
shared
/_publisher.mobile.haml
→
app/views/
publisher
/_publisher.mobile.haml
View file @
6fc6474e
...
...
@@ -10,7 +10,7 @@
=
form_for
StatusMessage
.
new
,
{
:data
=>
{
:ajax
=>
false
}}
do
|
status
|
=
status
.
hidden_field
:provider_display_name
,
:value
=>
'mobile'
=
status
.
text_area
:text
,
:placeholder
=>
t
(
'.whats_on_your_mind'
),
:rows
=>
4
,
:autofocus
=>
"autofocus"
=
status
.
text_area
:text
,
:placeholder
=>
t
(
'
shared.publisher
.whats_on_your_mind'
),
:rows
=>
4
,
:autofocus
=>
"autofocus"
%fieldset
%span
#publisher_service_icons
...
...
@@ -34,9 +34,9 @@
%ul
#photodropzone
#fileInfo-publisher
#file-upload-publisher
{
:title
=>
t
(
'.upload_photos'
),
:class
=>
'btn'
}
=
image_tag
'icons/camera.png'
,
alt:
t
(
'.upload_photos'
).
titleize
#file-upload-publisher
{
:title
=>
t
(
'
shared.publisher
.upload_photos'
),
:class
=>
'btn'
}
=
image_tag
'icons/camera.png'
,
alt:
t
(
'
shared.publisher
.upload_photos'
).
titleize
#publisher_mobile
=
submit_tag
t
(
'.share'
),
:class
=>
'btn primary'
,
:id
=>
"submit_new_message"
=
submit_tag
t
(
'
shared.publisher
.share'
),
:class
=>
'btn primary'
,
:id
=>
"submit_new_message"
#publisher_photo_upload
app/views/publisher/_publisher_blueprint.html.haml
0 → 100644
View file @
6fc6474e
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
if
publisher_explain
:javascript
$
(
document
).
ready
(
function
()
{
if
(
app
.
publisher
)
app
.
publisher
.
triggerGettingStarted
();
});
#publisher
{
:class
=>
((
aspect
==
:profile
||
publisher_open
)
?
"mention_popup"
:
"closed"
)}
.content_creation
=
form_for
(
StatusMessage
.
new
)
do
|
status
|
=
status
.
error_messages
%div
%params
#publisher_textarea_wrapper
=
link_to
(
content_tag
(
:div
,
nil
,
:class
=>
'icons-deletelabel'
),
"#"
,
:id
=>
"hide_publisher"
,
:title
=>
t
(
'shared.publisher.discard_post'
))
%ul
#photodropzone
-
if
current_user
.
getting_started?
=
status
.
text_area
:fake_text
,
:rows
=>
2
,
:value
=>
h
(
publisher_formatted_text
),
:tabindex
=>
1
,
:placeholder
=>
"
#{
t
(
'contacts.index.start_a_conversation'
)
}
..."
,
:title
=>
popover_with_close_html
(
'1. '
+
t
(
'shared.public_explain.share'
)
),
'data-content'
=>
t
(
'shared.public_explain.new_user_welcome_message'
)
-
else
=
status
.
text_area
:fake_text
,
:rows
=>
2
,
:value
=>
h
(
publisher_formatted_text
),
:tabindex
=>
1
,
:placeholder
=>
"
#{
t
(
'contacts.index.start_a_conversation'
)
}
..."
=
status
.
hidden_field
:text
,
:value
=>
h
(
publisher_hidden_text
),
:class
=>
'clear_on_submit'
#publisher-images
%span
.markdownIndications
!=
t
(
'shared.publisher.formatWithMarkdown'
,
markdown_link:
link_to
(
t
(
'help.markdown'
),
'https://diasporafoundation.org/formatting'
,
target: :blank
))
#locator
.btn
{
:title
=>
t
(
'shared.publisher.get_location'
)}
=
image_tag
'icons/marker.png'
,
:alt
=>
t
(
'shared.publisher.get_location'
).
titleize
,
:class
=>
'publisher_image'
#file-upload
.btn
{
:title
=>
t
(
'shared.publisher.upload_photos'
)}
=
image_tag
'icons/camera.png'
,
:alt
=>
t
(
'shared.publisher.upload_photos'
).
titleize
,
:class
=>
'publisher_image'
=
hidden_field
:location
,
:coords
#location_container
-
if
publisher_public
=
hidden_field_tag
'aspect_ids[]'
,
"public"
-
elsif
all_aspects_selected?
(
selected_aspects
)
=
hidden_field_tag
'aspect_ids[]'
,
"all_aspects"
-
else
-
for
aspect_id
in
aspect_ids
=
hidden_field_tag
'aspect_ids[]'
,
aspect_id
.
to_s
.options_and_submit
.public_toggle
%span
#publisher_service_icons
-
if
current_user
.
services
-
for
service
in
current_user
.
services
=
content_tag
:div
,
nil
,
:title
=>
"
#{
service
.
provider
.
titleize
}
(
#{
service
.
nickname
}
)"
,
:class
=>
"social_media_logos-
#{
service
.
provider
}
-16x16 service_icon dim"
,
:id
=>
"
#{
service
.
provider
}
"
,
:maxchar
=>
"
#{
service
.
class
::
MAX_CHARACTERS
}
"
,
:data
=>
{
:toggle
=>
'tooltip'
,
:placement
=>
'bottom'
}
%a
{
:href
=>
"#question_mark_pane"
,
:class
=>
'question_mark'
,
:rel
=>
'facebox'
,
:title
=>
t
(
'shared.public_explain.manage'
)
}
.icons-monotone_wrench_settings
.dropdown
{
!
current_user
.
getting_started?
?
{:
class
=>
"hang_right"
}
:
{
:class
=>
"hang_right"
,
:title
=>
popover_with_close_html
(
"2. #{t('shared.public_explain.control_your_audience')}"
),
'data-content'
=>
t
(
'shared.public_explain.visibility_dropdown'
)}
}
.button.toggle.publisher
-
if
publisher_public
=
t
(
'public'
)
-
elsif
all_aspects_selected?
(
selected_aspects
)
=
t
(
'all_aspects'
)
-
elsif
selected_aspects
.
size
==
1
=
selected_aspects
.
first
.
name
-
else
=
t
(
'shared.aspect_dropdown.toggle'
,
:count
=>
selected_aspects
.
size
)
▼
.wrapper
%ul
.dropdown_list
{
:unSelectable
=>
'on'
,
'data-person_id'
=>
(
person
.
id
if
defined?
(
person
)
&&
person
),
'data-service_uid'
=>
(
service_uid
if
defined?
(
service_uid
))}
%li
.public.radio
{
"data-aspect_id"
=>
"public"
,
:class
=>
(
"selected"
if
publisher_public
)}
=
t
(
'public'
)
%li
.divider.all_aspects.radio
{
:style
=>
"padding-bottom: 5px; border-bottom: 1px solid #ddd;"
,
"data-aspect_id"
=>
"all_aspects"
,
:class
=>
(
"selected"
if
(
!
publisher_public
&&
all_aspects_selected?
(
selected_aspects
)))}
=
t
(
'all_aspects'
)
-
for
aspect
in
all_aspects
=
aspect_dropdown_list_item
(
aspect
,
!
all_aspects_selected?
(
selected_aspects
)
&&
selected_aspects
.
include?
(
aspect
)
)
%button
{
:disabled
=>
(
"disabled"
if
publisher_hidden_text
.
blank?
),
:class
=>
'button post_preview_button'
}
=
t
(
'shared.publisher.preview'
)
=
status
.
submit
t
(
'shared.publisher.share'
),
:disabled
=>
publisher_hidden_text
.
blank?
,
:class
=>
'button creation'
,
:tabindex
=>
2
.facebox_content
#question_mark_pane
=
render
'shared/public_explain'
=
link_to
''
,
contacts_path
(
:aspect_ids
=>
aspect_ids
),
:class
=>
'selected_contacts_link hidden'
#publisher_photo_upload
app/views/publisher/_publisher_bootstrap.html.haml
0 → 100644
View file @
6fc6474e
-
if
publisher_explain
:javascript
$
(
document
).
ready
(
function
()
{
if
(
app
.
publisher
)
app
.
publisher
.
triggerGettingStarted
();
});
.row-fluid
#publisher
{
:class
=>
((
aspect
==
:profile
||
publisher_open
)
?
"mention_popup"
:
"closed"
)}
.content_creation
=
form_for
(
StatusMessage
.
new
)
do
|
status
|
=
status
.
error_messages
%params
#publisher_textarea_wrapper
-
if
current_user
.
getting_started?
=
status
.
text_area
:fake_text
,
:rows
=>
2
,
:value
=>
h
(
publisher_formatted_text
),
:tabindex
=>
1
,
:placeholder
=>
"
#{
t
(
'contacts.index.start_a_conversation'
)
}
..."
,
'data-title'
=>
popover_with_close_html
(
'1. '
+
t
(
'shared.public_explain.share'
)
),
'data-content'
=>
t
(
'shared.public_explain.new_user_welcome_message'
)
-
else
=
status
.
text_area
:fake_text
,
:rows
=>
2
,
:value
=>
h
(
publisher_formatted_text
),
:tabindex
=>
1
,
:placeholder
=>
"
#{
t
(
'contacts.index.start_a_conversation'
)
}
..."
=
status
.
hidden_field
:text
,
:value
=>
h
(
publisher_hidden_text
),
:class
=>
'clear_on_submit'
.row-fluid
#photodropzone_container
%ul
#photodropzone
.row-fluid
#location_container
=
hidden_field
:location
,
:coords
.row-fluid
#button_container
#publisher-images
.pull-right
#file-upload
.btn.btn-link
{
:title
=>
t
(
'shared.publisher.upload_photos'
)}
%i
.entypo.camera.publisher_image
#locator
.btn.btn-link
{
:title
=>
t
(
'shared.publisher.get_location'
)}
%i
.entypo.location.publisher_image
#hide_location
.btn.btn-link
{
:title
=>
t
(
'shared.publisher.remove_location'
)}
%i
.entypo.cross.publisher_image
%span
.help-block.markdownIndications
!=
t
(
'shared.publisher.formatWithMarkdown'
,
markdown_link:
link_to
(
t
(
'help.markdown'
),
'https://diasporafoundation.org/formatting'
,
target: :blank
))
-
if
publisher_public
=
hidden_field_tag
'aspect_ids[]'
,
"public"
-
elsif
all_aspects_selected?
(
selected_aspects
)
=
hidden_field_tag
'aspect_ids[]'
,
"all_aspects"
-
else
-
for
aspect_id
in
aspect_ids
=
hidden_field_tag
'aspect_ids[]'
,
aspect_id
.
to_s
.row-fluid.options_and_submit
.public_toggle
%button
.btn.btn-default.pull-left
#hide_publisher
{
:title
=>
t
(
'shared.publisher.discard_post'
)}
=
t
(
'cancel'
)
.btn-toolbar.pull-right
%span
#publisher_service_icons
-
if
current_user
.
services
-
for
service
in
current_user
.
services
=
service_button
(
service
)
%a
.btn.btn-link
{
:href
=>
"#question_mark_pane"
,
:class
=>
'question_mark'
,
:rel
=>
'facebox'
,
:title
=>
t
(
'shared.public_explain.manage'
)
}
%i
.entypo.small.cog
=
render
:partial
=>
"publisher/aspect_dropdown"
,
:locals
=>
{
:selected_aspects
=>
selected_aspects
}
%button
{
:disabled
=>
(
"disabled"
if
publisher_hidden_text
.
blank?
),
:class
=>
'btn btn-default post_preview_button'
}
=
t
(
'shared.publisher.preview'
)
%button
#submit
.btn.btn-primary.creation
{
:disabled
=>
(
"disabled"
if
publisher_hidden_text
.
blank?
),
:tabindex
=>
2
}
=
t
(
'shared.publisher.share'
)
.facebox_content
#question_mark_pane
=
render
'shared/public_explain'
=
link_to
''
,
contacts_path
(
:aspect_ids
=>
aspect_ids
),
:class
=>
'selected_contacts_link hidden'
#publisher_photo_upload
app/views/shared/_publisher.html.haml
deleted
100644 → 0
View file @
1b85d9d0
This diff is collapsed.
Click to expand it.
app/views/status_messages/bookmarklet.html.haml
View file @
6fc6474e
...
...
@@ -8,7 +8,7 @@
.row-fluid
%h4
=
t
(
'bookmarklet.post_something'
)
=
render
:partial
=>
'
shared/publisher'
,
:locals
=>
{
:aspect
=>
:profile
,
:selected_aspects
=>
@aspects
,
:aspect_ids
=>
@aspect_ids
,
:bootstrap
=>
'true'
}
=
render
:partial
=>
'
publisher/publisher'
,
:locals
=>
{
:aspect
=>
:profile
,
:selected_aspects
=>
@aspects
,
:aspect_ids
=>
@aspect_ids
}
:javascript
app
.
publisher
=
new
app
.
views
.
Publisher
({
...
...
app/views/status_messages/bookmarklet.mobile.haml
View file @
6fc6474e
...
...
@@ -2,7 +2,7 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
=
render
:partial
=>
'
shared
/publisher'
,
:locals
=>
{
:aspect
=>
:profile
,
:selected_aspects
=>
@aspects
,
:aspect_ids
=>
@aspect_ids
}
=
render
:partial
=>
'
publisher
/publisher'
,
:locals
=>
{
:aspect
=>
:profile
,
:selected_aspects
=>
@aspects
,
:aspect_ids
=>
@aspect_ids
}
:javascript
var
contents
=
"
#{
escape_javascript
params
[
:content
]
}
"
;
...
...
app/views/status_messages/new.html.haml
View file @
6fc6474e
...
...
@@ -10,7 +10,7 @@
%h3
=
t
(
'.mentioning'
,
:person
=>
@person
.
name
)
=
render
:partial
=>
'
shared
/publisher'
,
:locals
=>
{
:aspect
=>
@aspect
,
:aspect_ids
=>
@aspect_ids
,
:selected_aspects
=>
@aspects_with_person
,
:person
=>
@person
}
=
render
:partial
=>
'
publisher
/publisher'
,
:locals
=>
{
:aspect
=>
@aspect
,
:aspect_ids
=>
@aspect_ids
,
:selected_aspects
=>
@aspects_with_person
,
:person
=>
@person
}
:javascript
$
(
function
()
{
...
...
@@ -18,4 +18,4 @@
standalone
:
true
});
$
(
"
#publisher
"
).
bind
(
'
ajax:success
'
,
function
(){
location
.
reload
();
});
});
\ No newline at end of file
});
app/views/status_messages/new.mobile.haml
View file @
6fc6474e
...
...
@@ -2,4 +2,4 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
=
render
:partial
=>
'
shared/publisher'
,
:locals
=>
{
:aspect
=>
@aspects
.
first
,
:for_all_aspects
=>
true
,
:aspect_ids
=>
@aspect_ids
,
:selected_aspects
=>
@aspects
}
=
render
:partial
=>
'
publisher/publisher'
,
:locals
=>
{
:aspect
=>
@aspects
.
first
,
:aspect_ids
=>
@aspect_ids
,
:selected_aspects
=>
@aspects
}
app/views/tags/show.haml
View file @
6fc6474e
...
...
@@ -31,7 +31,7 @@
=
@stream
.
display_tag_name
-
if
current_user
=
render
'
shared/publisher'
,
:selected_aspects
=>
@stream
.
aspect_ids
,
:aspect_ids
=>
@stream
.
aspect_ids
,
:for_all_aspects
=>
true
,
:aspect
=>
@stream
.
aspect
=
render
'
publisher/publisher'
,
:selected_aspects
=>
@stream
.
aspect_ids
,
:aspect_ids
=>
@stream
.
aspect_ids
,
:aspect
=>
@stream
.
aspect
%hr
...
...
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