Merge pull request #6336 from AugierLe42e/clean-publisher

Cleaning publisher
This commit is contained in:
Steffen van Bergerem 2015-09-26 00:41:01 +02:00
commit 9d6ce5b110
5 changed files with 74 additions and 57 deletions

View file

@ -53,6 +53,7 @@ With the port to Bootstrap 3, app/views/terms/default.haml has a new structure.
* Unify mobile and desktop header design [#6285](https://github.com/diaspora/diaspora/6285) * Unify mobile and desktop header design [#6285](https://github.com/diaspora/diaspora/6285)
* Add white background and box-shadow to stream elements [#6324](https://github.com/diaspora/diaspora/6324) * Add white background and box-shadow to stream elements [#6324](https://github.com/diaspora/diaspora/6324)
* Override Bootstrap list group design [#6345](https://github.com/diaspora/diaspora/6345) * Override Bootstrap list group design [#6345](https://github.com/diaspora/diaspora/6345)
* Clean up publisher code [#6336](https://github.com/diaspora/diaspora/6336)
## Bug fixes ## Bug fixes
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)

View file

@ -106,7 +106,7 @@ app.views.Publisher = Backbone.View.extend({
var form = this.$(".content_creation form"); var form = this.$(".content_creation form");
this.view_services = new app.views.PublisherServices({ this.view_services = new app.views.PublisherServices({
el: this.$("#publisher_service_icons"), el: this.$("#publisher-service-icons"),
input: this.inputEl, input: this.inputEl,
form: form form: form
}); });

View file

@ -29,19 +29,17 @@
} }
.options_and_submit { .options_and_submit {
padding: 10px 0 ; padding: 10px 0;
#publisher_service_icons { #publisher-service-icons {
.btn-link{ text-decoration: none; } text-decoration: none;
.btn-link.question_mark .entypo-cog {
.entypo-cog, .service_icon {
color: $text-grey; color: $text-grey;
font-size: 16px; font-size: 16px;
line-height: $line-height-computed; line-height: 16px;
}
.btn-link.question_mark:hover.entypo-cog { color: $black; }
.btn-link.service_icon {
padding-left: 5px;
padding-right: 5px;
} }
.service_icon { padding: 6px 5px; }
.btn.btn-link.question_mark:hover .entypo-cog { color: $black; }
.dim { opacity: 0.3; } .dim { opacity: 0.3; }
.social_media_logos-wordpress-16x16 { .social_media_logos-wordpress-16x16 {
display: inline-block; display: inline-block;
@ -49,6 +47,29 @@
width: 16px; width: 16px;
} }
} }
$sm-xs-average: ($screen-sm + $screen-xs) / 2;
@media(max-width: $sm-xs-average) {
#hide_publisher {
display: block;
width: 100%;
margin-bottom: 5px;
}
}
@media(max-width: $screen-xs) {
.btn-toolbar {
width: 100%;
display: flex;
.btn, .aspect_dropdown{ flex-grow: 1; }
.aspect_dropdown .btn { width: 100%; }
}
.btn-group:first-child { margin: 0; }
.dropdown-menu.pull-right {
left: 0;
right: auto;
}
}
} }
#publisher_textarea_wrapper { #publisher_textarea_wrapper {
@ -59,7 +80,7 @@
input[type='text']#status_message_text { input[type='text']#status_message_text {
border: none; border: none;
box-shadow: none; box-shadow: none;
margin: none; margin: 0;
} }
textarea { textarea {
@ -153,7 +174,7 @@
color: black; color: black;
font-size: 50px; font-size: 50px;
line-height: 50px; line-height: 50px;
font-style: bold; font-weight: bold;
position: absolute; position: absolute;
z-index: 2; z-index: 2;
opacity: 0.85; opacity: 0.85;
@ -183,7 +204,7 @@
#upload_error { #upload_error {
color: white; color: white;
font-style: bold; font-weight: bold;
border-top: 1px solid white; border-top: 1px solid white;
background-color: $red; background-color: $red;
text-align: center; text-align: center;

View file

@ -4,80 +4,75 @@
if( app.publisher ) app.publisher.triggerGettingStarted(); if( app.publisher ) app.publisher.triggerGettingStarted();
}); });
#publisher.row{class: ((aspect == :profile || publisher_open) ? "mention_popup" : "closed")} .row#publisher{class: ((aspect == :profile || publisher_open) ? "mention_popup" : "closed")}
.content_creation .content_creation
= form_for(StatusMessage.new) do |status| = form_for(StatusMessage.new) do |status|
= status.error_messages = status.error_messages
%params %params
#publisher_textarea_wrapper #publisher_textarea_wrapper
- if current_user.getting_started? - 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')}...", = status.text_area :fake_text, :rows => 2, :value => h(publisher_formatted_text),
'data-title' => popover_with_close_html( '1. ' + t('shared.public_explain.share') ), :tabindex => 1, :placeholder => "#{t('contacts.index.start_a_conversation')}...",
'data-content' => t('shared.public_explain.new_user_welcome_message'), "data-title" => popover_with_close_html("1. " + t("shared.public_explain.share")),
'class' => 'form-control' "data-content" => t("shared.public_explain.new_user_welcome_message"),
"class" => "form-control"
- else - else
= status.text_area :fake_text, rows: 2, value: h(publisher_formatted_text), tabindex: 1, placeholder: "#{t('contacts.index.start_a_conversation')}...", = status.text_area :fake_text, :rows => 2, :value => h(publisher_formatted_text),
'class' => 'form-control' :tabindex => 1, :placeholder => "#{t('contacts.index.start_a_conversation')}...",
= status.hidden_field :text, value: h(publisher_hidden_text), class: 'clear_on_submit' "class" => "form-control"
= status.hidden_field :text, value: h(publisher_hidden_text), class: "clear_on_submit"
#photodropzone_container.container-fluid .container-fluid#photodropzone_container
%ul#photodropzone %ul#photodropzone
#location_container.form-group{ style: "padding: 4px 6px;"} #location_container.form-group{ style: "padding: 4px 6px;"}
= hidden_field :location, :coords = hidden_field :location, :coords
#poll_creator_container #poll_creator_container
-# handlebars template -# handlebars template
#button_container #button_container
#publisher-images.pull-right .pull-right#publisher-images
#poll_creator.btn.btn-link{title: t('shared.publisher.poll.add_a_poll')} .btn.btn-link#poll_creator{title: t("shared.publisher.poll.add_a_poll")}
%i.entypo-bar-graph %i.entypo-bar-graph
#file-upload.btn.btn-link{title: t('shared.publisher.upload_photos')} .btn.btn-link#file-upload{title: t("shared.publisher.upload_photos")}
%i.entypo-camera.publisher_image %i.entypo-camera.publisher_image
#locator.btn.btn-link{title: t('shared.publisher.get_location')} .btn.btn-link#locator{title: t("shared.publisher.get_location")}
%i.entypo-location.publisher_image %i.entypo-location.publisher_image
#hide_location.btn.btn-link{title: t('shared.publisher.remove_location')} .btn.btn-link#hide_location{title: t("shared.publisher.remove_location")}
%i.entypo-cross.publisher_image %i.entypo-cross.publisher_image
%span.markdownIndications %span.markdownIndications
!= t('shared.publisher.formatWithMarkdown', markdown_link: link_to(t('help.markdown'), 'https://diasporafoundation.org/formatting', target: :blank)) != t("shared.publisher.formatWithMarkdown", markdown_link: link_to(t("help.markdown"),
"https://diasporafoundation.org/formatting", target: :blank))
- if publisher_public - if publisher_public
= hidden_field_tag 'aspect_ids[]', "public" = hidden_field_tag "aspect_ids[]", "public"
- elsif all_aspects_selected?(selected_aspects) - elsif all_aspects_selected?(selected_aspects)
= hidden_field_tag 'aspect_ids[]', "all_aspects" = hidden_field_tag "aspect_ids[]", "all_aspects"
- else - else
- for aspect_id in aspect_ids - for aspect_id in aspect_ids
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s = hidden_field_tag "aspect_ids[]", aspect_id.to_s
#publisher_spinner{class: 'hidden'} .hidden#publisher_spinner
.loader .loader
.spinner .spinner
.options_and_submit.col-sm-12 .options_and_submit.col-sm-12
.public_toggle .public_toggle.clearfix
.btn.btn-default.pull-left#hide_publisher{title: t('shared.publisher.discard_post')} .btn.btn-default.pull-left#hide_publisher{title: t("shared.publisher.discard_post")}
%span.text %span.text= t("cancel")
=t('cancel')
.btn-toolbar.pull-right .btn-toolbar.pull-right
%span#publisher_service_icons.btn-group = render partial: "publisher/aspect_dropdown", locals: {selected_aspects: selected_aspects}
- if current_user.services %button.btn.btn-default.btn-group.post_preview_button= t("shared.publisher.preview")
- for service in current_user.services %button.btn.btn-group.btn-primary#submit= t("shared.publisher.share")
= service_button(service)
.btn.btn-link{ class: "question_mark",
title: t("shared.public_explain.manage"),
data: {toggle: "modal", target: "#publicExplainModal"}}
%i.entypo-cog
= render partial: "publisher/aspect_dropdown", locals: { :selected_aspects => selected_aspects } .btn-toolbar.pull-right#publisher-service-icons
- if current_user.services
- current_user.services.each do |service|
= service_button(service)
.btn.btn-link.question_mark{title: t("shared.public_explain.manage"),
data: {toggle: "modal", target: "#publicExplainModal"}}
%i.entypo-cog
%button.btn.btn-default.btn-group.post_preview_button = link_to "", contacts_path(aspect_ids: aspect_ids), class: "selected_contacts_link hidden"
%span.text
= t('shared.publisher.preview')
%button#submit.btn.btn-group.btn-primary
%span.text
= t('shared.publisher.share')
= link_to '', contacts_path(:aspect_ids => aspect_ids), class: 'selected_contacts_link hidden'
#publisher_photo_upload #publisher_photo_upload
= render 'shared/public_explain' = render "shared/public_explain"

View file

@ -8,7 +8,7 @@
= status.text_area :text, placeholder: t('shared.publisher.whats_on_your_mind'), rows: 4, autofocus: "autofocus", class: "form-control" = status.text_area :text, placeholder: t('shared.publisher.whats_on_your_mind'), rows: 4, autofocus: "autofocus", class: "form-control"
.form-group .form-group
%span#publisher_service_icons %span#publisher-service-icons
- if current_user.services - if current_user.services
- for service in current_user.services - for service in current_user.services
= image_tag "social_media_logos/#{service.provider}-32x32.png", title: service.provider.titleize, class: "service_icon dim", id:"#{service.provider}", maxchar: "#{service.class::MAX_CHARACTERS}" = image_tag "social_media_logos/#{service.provider}-32x32.png", title: service.provider.titleize, class: "service_icon dim", id:"#{service.provider}", maxchar: "#{service.class::MAX_CHARACTERS}"