_publisher.html.haml 11 KB
Newer Older
danielgrippi's avatar
danielgrippi committed
1
-#   Copyright (c) 2010-2011, Diaspora Inc.  This file is
Raphael's avatar
Raphael committed
2
-#   licensed under the Affero General Public License version 3 or later.  See
Raphael's avatar
Raphael committed
3
-#   the COPYRIGHT file.
4

5 6
-if publisher_explain
  :javascript
7
    $(document).ready(function() {
8
        if( app.publisher ) app.publisher.triggerGettingStarted();
9
      });
10

11 12 13 14 15
-unless defined?(bootstrap).nil?
  .row-fluid#publisher{:class => ((aspect == :profile || publisher_open) ? "mention_popup" : "closed")}
    .content_creation
      = form_for(StatusMessage.new) do |status|
        = status.error_messages
16 17
        %params
          #publisher_textarea_wrapper
18
            - if current_user.getting_started?
19
              = status.text_area :fake_text, :rows => 2, :value => h(publisher_formatted_text), :tabindex => 1, :placeholder => "#{t('contacts.index.start_a_conversation')}...",
20
                'data-title' => popover_with_close_html( '1. ' + t('shared.public_explain.share') ),
21 22
                'data-content' => t('shared.public_explain.new_user_welcome_message')
            - else
23
              = status.text_area :fake_text, :rows => 2, :value => h(publisher_formatted_text), :tabindex => 1, :placeholder => "#{t('contacts.index.start_a_conversation')}..."
24
            = status.hidden_field :text, :value => h(publisher_hidden_text), :class => 'clear_on_submit'
danielvincent's avatar
danielvincent committed
25

26 27 28 29 30 31 32 33 34 35 36 37 38
            .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('.upload_photos')}
                  %i.entypo.camera.publisher_image
                #locator.btn.btn-link{:title => t('.get_location')}
                  %i.entypo.location.publisher_image
                #hide_location.btn.btn-link{:title => t('.remove_location')}
                  %i.entypo.cross.publisher_image
              %span.help-block.markdownIndications
flaburgan's avatar
flaburgan committed
39
                != t('.formatWithMarkdown', markdown_link: link_to(t('help.markdown'), 'https://diasporafoundation.org/formatting', target: :blank))
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102

        - 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('.discard_post')}
              =t('cancel')
            
            .btn-toolbar.pull-right
              %span#publisher_service_icons
                - if current_user.services
                  - for service in current_user.services
                    .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'} }
                      -if service.provider == 'wordpress'
                        %span.social_media_logos-wordpress-16x16
                      -else                         
                        %i.entypo.small{ :class => service.provider }
                %a.btn.btn-link{ :href => "#question_mark_pane", :class => 'question_mark', :rel => 'facebox', :title => t('shared.public_explain.manage') }
                  %i.entypo.small.cog
              .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', '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)}
                    %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

              %button{ :disabled => ("disabled" if publisher_hidden_text.blank?), :class => 'btn btn-default post_preview_button'}
                = t('.preview')

103 104
              %button#submit.btn.btn-primary.creation{ :disabled => ("disabled" if publisher_hidden_text.blank?), :tabindex => 2}
                = t('.share')
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

            .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

- else
  #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('.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')
128
              - else
129 130
                = 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'
131

132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
              #publisher-images
                %span.markdownIndications
                  != t('.formatWithMarkdown', markdown_link: link_to(t('help.markdown'), 'https://diasporafoundation.org/formatting', target: :blank))
                #locator.btn{:title => t('.get_location')}
                  = image_tag 'icons/marker.png', :alt => t('.get_location').titleize, :class => 'publisher_image'
                #file-upload.btn{:title => t('.upload_photos')}
                  = image_tag 'icons/camera.png', :alt => t('.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
163

164 165 166 167 168
            .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)
169
                  = t('all_aspects')
170 171 172 173 174 175 176 177 178 179 180 181 182
                - 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')
183

184 185
                  - for aspect in all_aspects
                    = aspect_dropdown_list_item(aspect, !all_aspects_selected?(selected_aspects) && selected_aspects.include?(aspect) )
186

187 188
            %button{ :disabled => ("disabled" if publisher_hidden_text.blank?), :class => 'button post_preview_button'}
              = t('.preview')
Steffen van Bergerem's avatar
Steffen van Bergerem committed
189

190
            = status.submit t('.share'), :disabled => publisher_hidden_text.blank?, :class => 'button creation', :tabindex => 2
191

192 193 194 195
            .facebox_content
              #question_mark_pane
                = render 'shared/public_explain'
      = link_to '', contacts_path(:aspect_ids => aspect_ids), :class => 'selected_contacts_link hidden'
196

197

198
      #publisher_photo_upload