diff --git a/Changelog.md b/Changelog.md index e3ac7b85f..0e43f8699 100644 --- a/Changelog.md +++ b/Changelog.md @@ -18,15 +18,24 @@ * Render mentions as links in comments [#7327](https://github.com/diaspora/diaspora/pull/7327) * Add support for mentions in comments to the front-end [#7386](https://github.com/diaspora/diaspora/pull/7386) -# 0.6.7.0 +# 0.6.8.0 ## Refactor ## Bug fixes +## Features + +# 0.6.7.0 + +## Refactor +* Cleanup some translations [#7465](https://github.com/diaspora/diaspora/pull/7465) + ## Features * Change email without confirmation when mail is disabled [#7455](https://github.com/diaspora/diaspora/pull/7455) * Warn users if they leave the profile editing page with unsaved changes [#7473](https://github.com/diaspora/diaspora/pull/7473) +* Add admin pages to the mobile interface [#7295](https://github.com/diaspora/diaspora/pull/7295) +* Add links to discourse to footer and sidebar [#7446](https://github.com/diaspora/diaspora/pull/7446) # 0.6.6.0 diff --git a/app/assets/javascripts/mobile/mobile_drawer.js b/app/assets/javascripts/mobile/mobile_drawer.js index 7a96a37d4..f20cb5bf3 100644 --- a/app/assets/javascripts/mobile/mobile_drawer.js +++ b/app/assets/javascripts/mobile/mobile_drawer.js @@ -1,17 +1,11 @@ -(function(){ +(function() { Diaspora.Mobile.Drawer = { - initialize: function(){ - $("#all_aspects").bind("tap click", function(evt){ - evt.preventDefault(); - $(this).find("+ li").toggleClass("hide"); - }); - - $("#menu-badge").bind("tap click", function(evt){ + initialize: function() { + $("#menu-badge").bind("tap click", function(evt) { evt.preventDefault(); $("#app").toggleClass("draw"); }); - - $("#followed_tags").bind("tap click", function(evt){ + $("#all_aspects, #followed_tags, #admin").bind("tap click", function(evt) { evt.preventDefault(); $(this).find("+ li").toggleClass("hide"); }); diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index ea933e6e6..078edf674 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -2,9 +2,9 @@ @import 'bootstrap-variables'; @import 'animations'; -/** ADMIN STYlES **/ -/** user search **/ +// ADMIN STYlES +// user search .users { li.user { border-bottom: 1px solid $light-grey; @@ -16,15 +16,14 @@ .avatar { width: 50px; height: 50px; + max-width: none; } - .actions{ width: 150px; } - .pull-right .label{ display: inline-block; } } } -/** Invites panel **/ +// Invites panel .more_invites{ #add-invites-section{ line-height: 34px; @@ -32,12 +31,49 @@ } } -/** reported posts **/ +.invite-emails { + margin-bottom: 10px; +} -@import 'report'; +// Weekly stats +.week-selector { + margin-top: 10px; +} -/** pod list **/ +// Pod stats +.segment-selection { + select, + [type=submit] { + margin-top: 10px; + } +} +.percent-change { + &.increase { + color: $increase; + } + + &.decrease { + color: $decrease; + } +} + +// reported posts +.reports { + .reason-label { + font-weight: bold; + } + + .content { + padding-bottom: 20px; + } + + .panel-body .btn-info { + margin-right: 5px; + } +} + +// pod list #pod-list { .pod-title { max-width: 200px; diff --git a/app/assets/stylesheets/color-variables.scss b/app/assets/stylesheets/color-variables.scss index 40acec470..e69540df5 100644 --- a/app/assets/stylesheets/color-variables.scss +++ b/app/assets/stylesheets/color-variables.scss @@ -32,3 +32,6 @@ $left-navbar-drawer-background: darken($white, 6%) !default; $hovercard-background: $white !default; $card-shadow: 0 1px 2px 0 rgba(0, 0, 0, .16), 0 2px 10px 0 rgba(0, 0, 0, .12) !default; + +$increase: #008000; +$decrease: #fe0000; diff --git a/app/assets/stylesheets/footer.scss b/app/assets/stylesheets/footer.scss index ad1c398a2..99bb28158 100644 --- a/app/assets/stylesheets/footer.scss +++ b/app/assets/stylesheets/footer.scss @@ -5,6 +5,11 @@ html { body { margin-bottom: 150px; } +.powered-by-diaspora a { + color: $link-grey; + font-weight: bold; +} + footer.footer { background-color: $background-grey; border-top: 1px solid $border-grey; @@ -15,11 +20,6 @@ footer.footer { position: absolute; width: 100%; - .powered-by-diaspora { - color: $link-grey; - font-weight: bold; - } - ul#footer_nav { margin: 0; padding: 0; diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss index 54d01870e..e9d612991 100644 --- a/app/assets/stylesheets/mobile/mobile.scss +++ b/app/assets/stylesheets/mobile/mobile.scss @@ -885,3 +885,9 @@ select#aspect_ids_ { .form-control:active, .form-control:focus { border-color: #999999; } .tag_following_action { margin: 5px 0 10px 0; } + +// --- Admin pages --- +.pod-version { + // The fetching of the pod version is not done on mobile currently so we hide this alert. + display: none; +} diff --git a/app/assets/stylesheets/navbar_left.scss b/app/assets/stylesheets/navbar_left.scss index 498b4fde5..319a38e9f 100644 --- a/app/assets/stylesheets/navbar_left.scss +++ b/app/assets/stylesheets/navbar_left.scss @@ -114,7 +114,8 @@ padding: 10px 20px 0; .excellence-box, - .info-links { + .info-links, + .powered-box { border-top: 1px solid $border-grey; padding: 5px; } @@ -175,7 +176,6 @@ ul { list-style: none; - margin-bottom: 5px; padding-left: 0; } diff --git a/app/assets/stylesheets/report.scss b/app/assets/stylesheets/report.scss deleted file mode 100644 index c3a5f62eb..000000000 --- a/app/assets/stylesheets/report.scss +++ /dev/null @@ -1,12 +0,0 @@ -#reports { - .reason-label { - font-weight: bold; - } - - .content { - padding-bottom: 20px; - } - form input { - margin-right: 5px; - } -} diff --git a/app/controllers/admin/pods_controller.rb b/app/controllers/admin/pods_controller.rb index 1b4d2bf2f..309ee3861 100644 --- a/app/controllers/admin/pods_controller.rb +++ b/app/controllers/admin/pods_controller.rb @@ -1,7 +1,7 @@ module Admin class PodsController < AdminController - respond_to :html, :json + respond_to :html, :json, :mobile def index pods_json = PodPresenter.as_collection(Pod.all) @@ -15,6 +15,7 @@ module Admin render "admins/pods" end + format.mobile { render "admins/pods" } format.json { render json: pods_json } end end diff --git a/app/views/admins/_admin_bar.haml b/app/views/admins/_admin_bar.haml index 43ab0a8a4..698fd2da9 100644 --- a/app/views/admins/_admin_bar.haml +++ b/app/views/admins/_admin_bar.haml @@ -1,9 +1,5 @@ -- content_for :head do - = stylesheet_link_tag :admin - %h2= t(".pages") - -%ul#admin_nav.nav.nav-pills.nav-stacked +%ul.nav.nav-pills.nav-stacked#admin-nav %li{role: "presentation", class: current_page?(admin_dashboard_path) && "active"} = link_to t(".dashboard"), admin_dashboard_path %li{role: "presentation", class: current_page?(user_search_path) && "active"} @@ -22,4 +18,3 @@ = link_to t(".pod_network"), admin_pods_path %li{role: "presentation", class: current_page?(sidekiq_path) && "active"} = link_to t(".sidekiq_monitor"), sidekiq_path - diff --git a/app/views/admins/_dashboard.haml b/app/views/admins/_dashboard.haml new file mode 100644 index 000000000..503162dbe --- /dev/null +++ b/app/views/admins/_dashboard.haml @@ -0,0 +1,11 @@ +#pod-status + %h2 + = t(".pod_status") + .alert.alert-info.pod-version{role: "alert"} + = t(".fetching_diaspora_version") + - if unreviewed_reports_count > 0 + .alert.alert-warning.reports-warning{role: "alert"} + = t("report.unreviewed_reports", count: unreviewed_reports_count) + - else + %p + = t("report.unreviewed_reports", count: 0) diff --git a/app/views/admins/_stats.haml b/app/views/admins/_stats.haml new file mode 100644 index 000000000..ad74a7ab6 --- /dev/null +++ b/app/views/admins/_stats.haml @@ -0,0 +1,52 @@ +- content_for :head do + = stylesheet_link_tag :admin + +.container-fluid + .row + .col-sm-9 + %h1= t(".usage_statistic") + .col-sm-3 + = form_tag("/admins/stats", method: "get", class: "row form-inline segment-selection") do + .col-sm-8 + %select.form-control{name: "range"} + - %w(daily week 2weeks month).each do |range| + %option{value: range, selected: ("selected" if params[:range] == range)} + = t(".#{range}") + .col-sm-4 + = submit_tag t(".go"), class: "btn btn-primary btn-block" + + .row + .col-xs-12 + %h4 + != t("admins.stats.display_results", segment: content_tag(:strong, segment)) + + .row + - %i(posts comments aspect_memberships users).each do |name| + :ruby + model = instance_variable_get("@#{name}") + count = model[:yesterday] + label_with_count = name == :aspect_memberships ? t(".shares", count: count) : t(".#{name}", count: count) + + .col-md-3 + %h2{style: "font-weight:bold;"} + = label_with_count + %h4 + = model[:day_before] + %span.percent-change{class: (model[:change] > 0 ? "increase" : "decrease")} + = "(#{model[:change]}%)" + + .row + %p.col-md-12.alert.alert-info.text-center{role: "alert"} + != t("admins.stats.current_segment", + post_yest: content_tag(:strong, posts[:yesterday] / user_count), + post_day: content_tag(:strong, posts[:day_before] / user_count)) + + .row + .col-md-12 + %h3= t(".50_most") + %ul + - @popular_tags.each do |name, count| + %li + != t("admins.stats.tag_name", + name_tag: content_tag(:strong, name), + count_tag: content_tag(:strong, count)) diff --git a/app/views/admins/_user_entry.haml b/app/views/admins/_user_entry.haml index 13ac091b0..3ab517836 100644 --- a/app/views/admins/_user_entry.haml +++ b/app/views/admins/_user_entry.haml @@ -1,70 +1,81 @@ - %li.user.media - %div.pull-left + .media-left - if user.person - %span.media-object + .media-object = person_image_tag(user.person, size: :thumb_small) - - %div.media-body.row - %div.pull-right - %span.label.label-default - = t('.id') - = user.id - %span.label.label-info - = t('.guid') - = user.person.guid if user.person - - %h4.media-heading - = user.person.name if user.person - - %div.pull-right - .unstyled.text-right.actions - = link_to t('admins.user_search.view_profile'), person_path(user.person), class: 'btn btn-default btn-block btn-xs' - = link_to t('admins.user_search.add_invites'), add_invites_path(user.invitation_code), class: 'btn btn-info btn-block btn-xs' - - unless user.person.closed_account - = link_to t('admins.user_search.close_account'), admin_close_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure') }, class: 'btn btn-danger btn-block btn-xs' - - - unless user.closed_account? - - unless user.access_locked? - = link_to t('admins.user_search.lock_account'), admin_lock_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure_lock_account') }, class: 'btn btn-danger btn-block btn-xs' - - else - = link_to t('admins.user_search.unlock_account'), admin_unlock_account_path(user), method: :post, data: { confirm: t('admins.user_search.are_you_sure_unlock_account') }, class: 'btn btn-danger btn-block btn-xs' - - %div.row - %div.col-md-5 + .media-body + .row + .col-sm-7 + %h4.media-heading + = user.try(:person).try(:name) + .col-sm-5 + .pull-right + %span.label.label-default + = t(".id") + = user.id + %span.label.label-info + = t(".guid") + = user.try(:person).try(:guid) + .row + .col-sm-8 %dl.dl-horizontal - %dt= t('username') + %dt= t("username") %dd= user.username - %dt= t('.email') + %dt= t(".email") %dd= user.email - %dt= t('.diaspora_handle') + %dt= t(".diaspora_handle") %dd= user.person.diaspora_handle - %dt= t('.last_seen') - %dd= user.last_seen || t('.unknown') - -if user.invited_by.present? - %dt= t('.invite_token') + %dt= t(".last_seen") + %dd= user.last_seen || t(".unknown") + - if user.invited_by.present? + %dt= t(".invite_token") %dd= invite_code_url(user.invited_by.invitation_code) - %dt= t('.account_closed') + %dt= t(".account_closed") %dd - if user.person.closed_account - %span.label.label-warning= t('.yes') + %span.label.label-warning= t(".yes") - else - %span.label.label-success= t('.no') - %dt= t('.nsfw') + %span.label.label-success= t(".no") + %dt= t(".nsfw") %dd - if user.person.profile.nsfw - %span.label.label-warning= t('.yes') + %span.label.label-warning= t(".yes") - else - %span.label.label-success= t('.no') + %span.label.label-success= t(".no") - %h4= t('layouts.header.profile') + %h4= t("layouts.header.profile") %dl.dl-horizontal - %dt= t('people.profile_sidebar.born') + %dt= t("people.profile_sidebar.born") %dd= user.person.profile.birthday - %dt= t('people.profile_sidebar.gender') + %dt= t("people.profile_sidebar.gender") %dd= user.person.profile.gender - %dt= t('people.profile_sidebar.location') + %dt= t("people.profile_sidebar.location") %dd= user.person.profile.location - %dt= t('people.profile_sidebar.bio') + %dt= t("people.profile_sidebar.bio") %dd= user.person.profile.bio + + .col-sm-4 + = link_to t("admins.user_search.view_profile"), + person_path(user.person), + class: "btn btn-default btn-block" + = link_to t("admins.user_search.add_invites"), + add_invites_path(user.invitation_code), + class: "btn btn-info btn-block" + - unless user.person.closed_account + = link_to t("admins.user_search.close_account"), + admin_close_account_path(user), + method: :post, data: {confirm: t("admins.user_search.are_you_sure")}, + class: "btn btn-danger btn-block" + - if user.access_locked? + = link_to t("admins.user_search.unlock_account"), + admin_unlock_account_path(user), + method: :post, + data: {confirm: t("admins.user_search.are_you_sure_unlock_account")}, + class: "btn btn-danger btn-block" + - else + = link_to t("admins.user_search.lock_account"), + admin_lock_account_path(user), + method: :post, + data: {confirm: t("admins.user_search.are_you_sure_lock_account")}, + class: "btn btn-danger btn-block" diff --git a/app/views/admins/_user_search.haml b/app/views/admins/_user_search.haml new file mode 100644 index 000000000..33e02cee8 --- /dev/null +++ b/app/views/admins/_user_search.haml @@ -0,0 +1,57 @@ +- content_for :head do + = stylesheet_link_tag :admin + +.row + .user_search.col-md-12 + %h3= t("admins.admin_bar.user_search") + = form_for @search, url: {action: "user_search"}, html: {method: :get, class: "form-horizontal"} do |f| + .form-group + = f.label :username, t("username"), class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :username, class: "form-control" + + .form-group + = f.label :email, t("email"), class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :email, class: "form-control" + + .form-group + = f.label :guid, t("admins.user_entry.guid"), class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :guid, class: "form-control" + + .form-group + .col-md-offset-2.col-md-8.col-sm-12 + = f.label :under13 do + = f.check_box :under13 + = t(".under_13") + .col-md-2.col-sm-12 + = submit_tag t("admins.stats.go"), class: "btn btn-block btn-primary" + +.row + .col-md-12 + .alert.alert-info.text-center{role: "alert"} + = t(".users", count: nb_users) + +.row + .users.col-md-12 + %ul.media-list + - @users.each do |user| + = render partial: "user_entry", locals: {user: user} + +.row + .more_invites.col-md-12 + %h3= t("shared.invitations.invites") + .clearfix#add-invites-section + != t(".you_currently", count: current_user.invitation_code.count, + link: link_to(t(".add_invites"), add_invites_path(current_user.invitation_code), + class: "btn btn-link pull-right block-admin")) + + = form_tag "admin_inviter", method: :get, class: "form-horizontal" do + .form-group + %label.col-xs-12.col-md-2.control-label + = t(".email_to") + .col-xs-12.col-md-8 + = text_field_tag "identifier", nil, class: "form-control invite-emails" + .col-xs-12.col-md-2 + = submit_tag t(".invite"), class: "btn btn-block btn-primary" diff --git a/app/views/admins/_weekly_user_stats.haml b/app/views/admins/_weekly_user_stats.haml new file mode 100644 index 000000000..a3a9eff07 --- /dev/null +++ b/app/views/admins/_weekly_user_stats.haml @@ -0,0 +1,21 @@ +- content_for :head do + = stylesheet_link_tag :admin + +.row + .col-md-9.col-xs-12 + %h2 + = t(".current_server", date: Time.zone.now.to_date) + + .col-md-3.col-xs-12 + = form_tag("/admins/weekly_user_stats", method: "get", class: "form-inline week-selector row") do + .col-xs-9.center + = select_tag(:week, + options_for_select(created_users_by_week.keys.reverse, selected_week), + class: "form-control") + .col-xs-3.center + = submit_tag t("admins.stats.go"), class: "btn btn-primary" + += t(".amount_of", count: counter) +%br +- created_users_by_week[selected_week].each do |m| + = link_to m, "/u/#{m}" diff --git a/app/views/admins/dashboard.html.haml b/app/views/admins/dashboard.html.haml index 326758301..13f0f70d6 100644 --- a/app/views/admins/dashboard.html.haml +++ b/app/views/admins/dashboard.html.haml @@ -3,11 +3,4 @@ .col-md-3 = render partial: "admins/admin_bar" .col-md-9 - #pod-status - %h2 - = t(".pod_status") - .alert.alert-info.pod-version{role: "alert"} - = t(".fetching_diaspora_version") - - if unreviewed_reports_count > 0 - .alert.alert-warning.reports-warning{role: "alert"} - = t("report.unreviewed_reports", count: unreviewed_reports_count) + = render partial: "admins/dashboard" diff --git a/app/views/admins/dashboard.mobile.haml b/app/views/admins/dashboard.mobile.haml new file mode 100644 index 000000000..0dbc94e97 --- /dev/null +++ b/app/views/admins/dashboard.mobile.haml @@ -0,0 +1 @@ += render partial: "admins/dashboard" diff --git a/app/views/admins/pods.html.haml b/app/views/admins/pods.html.haml index cb7058543..d37e6e1db 100644 --- a/app/views/admins/pods.html.haml +++ b/app/views/admins/pods.html.haml @@ -1,3 +1,6 @@ +- content_for :head do + = stylesheet_link_tag :admin + .container .row .col-md-3 diff --git a/app/views/admins/pods.mobile.haml b/app/views/admins/pods.mobile.haml new file mode 100644 index 000000000..97a3ceeb7 --- /dev/null +++ b/app/views/admins/pods.mobile.haml @@ -0,0 +1,5 @@ +%h2 + = t(".pod_network") + +.alert.alert-warning + != t(".pod_desktop_view", desktop_link: link_to(t(".pod_desktop_link"), toggle_mobile_path)) diff --git a/app/views/admins/stats.html.haml b/app/views/admins/stats.html.haml index d2d5fcc5e..afa0980d2 100644 --- a/app/views/admins/stats.html.haml +++ b/app/views/admins/stats.html.haml @@ -3,58 +3,4 @@ .col-md-3 = render partial: "admins/admin_bar" .col-md-9 - %h1= t('.usage_statistic') - - .pull-right - = form_tag('/admins/stats', :method => 'get', class: 'form-inline') do - %select.form-control{name: "range"} - %option{:value => 'daily', :selected => ('selected' if params[:range] == 'daily')} - = t('.daily') - %option{:value => 'week', :selected => ('selected' if params[:range] == 'week')} - = t('.week') - %option{:value => '2weeks', :selected => ('selected' if params[:range] == '2weeks')} - = t('.2weeks') - %option{:value => 'month', :selected => ('selected' if params[:range] == 'month')} - = t('.month') - - = submit_tag t('.go'), class: 'btn btn-primary' - - %h3 - != t("admins.stats.display_results", segment: content_tag(:strong, @segment)) - - .row - - [:posts, :comments, :aspect_memberships, :users].each do |name| - - model = eval("@#{name.to_s}") - - if name == :aspect_memberships - - name = t('.shares', :count => model[:yesterday]) - - if name == :posts - - name = t('.posts', :count => model[:yesterday]) - - if name == :comments - - name = t('.comments', :count => model[:yesterday]) - - if name == :users - - name = t('.users', :count => model[:yesterday]) - - .col-md-3 - %h2{:style => 'font-weight:bold;'} - = name.to_s - %h4 - = model[:day_before] - %span.percent_change{:class => (model[:change] > 0 ? "green" : "red")} - = "(#{model[:change]}%)" - - .row - .col-md-12 - %p.alert.alert-info.text-center{role: "alert"} - != t("admins.stats.current_segment", - post_yest: content_tag(:strong, @posts[:yesterday] / @user_count.to_f), - post_day: content_tag(:strong, @posts[:day_before] / @user_count.to_f)) - - .row - .col-md-12 - %h3= t('.50_most') - %ul - - @popular_tags.each do |name,count| - %li - != t("admins.stats.tag_name", - name_tag: content_tag(:strong, name), - count_tag: content_tag(:strong, count)) + = render partial: "admins/stats", locals: {segment: @segment, posts: @posts, user_count: @user_count.to_f} diff --git a/app/views/admins/stats.mobile.haml b/app/views/admins/stats.mobile.haml new file mode 100644 index 000000000..cbd77fa6a --- /dev/null +++ b/app/views/admins/stats.mobile.haml @@ -0,0 +1 @@ += render partial: "admins/stats", locals: {segment: @segment, posts: @posts, user_count: @user_count.to_f} diff --git a/app/views/admins/user_search.html.haml b/app/views/admins/user_search.html.haml index 4be69152f..9bc5154ff 100644 --- a/app/views/admins/user_search.html.haml +++ b/app/views/admins/user_search.html.haml @@ -3,58 +3,4 @@ .col-md-3 = render partial: "admins/admin_bar" .col-md-9 - .row - .user_search.col-md-8 - %h3= t('admins.admin_bar.user_search') - = form_for @search, url: {action: 'user_search'}, html: {method: :get, class: 'form-horizontal'} do |f| - .form-group - = f.label :username, t('username'), class: 'col-sm-2 control-label' - .col-sm-10 - = f.text_field :username, class: "form-control" - - .form-group - = f.label :email, t('email'), class: 'col-sm-2 control-label' - .col-sm-10 - = f.text_field :email, class: "form-control" - - .form-group - = f.label :guid, t('admins.user_entry.guid'), class: 'col-sm-2 control-label' - .col-sm-10 - = f.text_field :guid, class: "form-control" - - .form-group - .col-sm-offset-2.col-sm-10 - = f.label :under13 do - = f.check_box :under13 - = t(".under_13") - .form-group - .clearfix.col-sm-12 - = submit_tag t("admins.stats.go"), class: "btn btn-primary pull-right" - - .more_invites.col-md-4 - %h3= t("shared.invitations.invites") - #add-invites-section.clearfix - != t(".you_currently", count: current_user.invitation_code.count, - link: link_to(t(".add_invites"), add_invites_path(current_user.invitation_code), - class: "btn btn-link pull-right")) - - = form_tag "admin_inviter", method: :get, class: "form-horizontal" do - .form-group - %label.col-sm-4.control-label - = t(".email_to") - .col-sm-8 - = text_field_tag "identifier", nil, class: "form-control" - .form-group - .clearfix.col-md-12 - = submit_tag t(".invite"), class: "btn btn-default pull-right" - - .row - .col-md-12 - .alert.alert-info.text-center{role: "alert"} - = t(".users", count: @users.count) - - .row - .users.col-md-12 - %ul.media-list - - @users.each do |user| - = render partial: 'user_entry', locals: { user: user } + = render partial: "admins/user_search", locals: {nb_users: @users.count} diff --git a/app/views/admins/user_search.mobile.haml b/app/views/admins/user_search.mobile.haml new file mode 100644 index 000000000..6aae225d0 --- /dev/null +++ b/app/views/admins/user_search.mobile.haml @@ -0,0 +1,6 @@ +- flash.each do |name, msg| + .expose#flash-container + .flash-message{class: "message alert alert-#{flash_class name}", role: "alert"} + = msg + += render partial: "admins/user_search", locals: {nb_users: @users.count} diff --git a/app/views/admins/weekly_user_stats.haml b/app/views/admins/weekly_user_stats.haml index fe2f88e35..264f27eaa 100644 --- a/app/views/admins/weekly_user_stats.haml +++ b/app/views/admins/weekly_user_stats.haml @@ -3,16 +3,5 @@ .col-md-3 = render partial: "admins/admin_bar" .col-md-9 - %h2 - = t('.current_server', date: Time.now.to_date) - - .pull-right - = form_tag('/admins/weekly_user_stats', method: 'get', class: 'form-inline') do - = select_tag(:week, options_for_select(@created_users_by_week.keys.reverse, @selected_week), class: "form-control") - = submit_tag t('admins.stats.go'), class: 'btn btn-primary' - - = t('.amount_of', count: @counter) - %br - - @created_users_by_week[@selected_week].each do |m| - = link_to m, "/u/#{m}" - %br + = render partial: "admins/weekly_user_stats", + locals: {created_users_by_week: @created_users_by_week, selected_week: @selected_week, counter: @counter} diff --git a/app/views/admins/weekly_user_stats.mobile.haml b/app/views/admins/weekly_user_stats.mobile.haml new file mode 100644 index 000000000..054f1468f --- /dev/null +++ b/app/views/admins/weekly_user_stats.mobile.haml @@ -0,0 +1,2 @@ += render partial: "admins/weekly_user_stats", + locals: {created_users_by_week: @created_users_by_week, selected_week: @selected_week, counter: @counter} diff --git a/app/views/layouts/_drawer.mobile.haml b/app/views/layouts/_drawer.mobile.haml index c6d48424c..a9e9efb53 100644 --- a/app/views/layouts/_drawer.mobile.haml +++ b/app/views/layouts/_drawer.mobile.haml @@ -35,5 +35,22 @@ = person_image_tag(current_user, size: :thumb_small) %li= link_to t("_contacts"), contacts_path %li= link_to t("layouts.header.settings"), edit_user_path + - if current_user.admin? + %li#admin + = link_to t("streams.admin.title"), "#" + %li.no-border.hide + %ul + %li= link_to t("admins.admin_bar.dashboard"), admin_dashboard_path + %li= link_to t("admins.admin_bar.user_search"), user_search_path + %li= link_to t("admins.admin_bar.weekly_user_stats"), weekly_user_stats_path + %li= link_to t("admins.admin_bar.pod_stats"), pod_stats_path + %li + %a{href: report_index_path} + - if unreviewed_reports_count > 0 + .pull-right.badge + = unreviewed_reports_count + = t("admins.admin_bar.report") + %li= link_to t("admins.admin_bar.pod_network"), admin_pods_path + %li= link_to t("admins.admin_bar.sidekiq_monitor"), sidekiq_path %li= link_to t("layouts.application.toggle"), toggle_mobile_path %li= link_to t("layouts.header.logout"), destroy_user_session_path, method: :delete diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml index ab8263507..cfa2f167a 100644 --- a/app/views/layouts/_footer.html.haml +++ b/app/views/layouts/_footer.html.haml @@ -1,7 +1,6 @@ %footer.footer .container - .pull-left - .powered-by-diaspora - =t("layouts.application.powered_by") + .powered-by-diaspora.pull-left + = link_to t("layouts.application.powered_by"), "https://diasporafoundation.org" %ul#footer_nav.pull-right - = render :partial =>'shared/links' + = render partial: "shared/links" diff --git a/app/views/report/_reports.haml b/app/views/report/_reports.haml new file mode 100644 index 000000000..fafe6bad0 --- /dev/null +++ b/app/views/report/_reports.haml @@ -0,0 +1,44 @@ +- content_for :head do + = stylesheet_link_tag :admin + +.reports + %h1 + = t("report.title") + - if @reports.empty? + %p + = t("report.unreviewed_reports", count: 0) + - @reports.each do |report| + - if report.item + .panel.panel-default + - username = report.user.username + .panel-heading + .reporter.pull-right + != t("report.reported_label", person: link_to(username, user_profile_path(username))) + .reason + %span.reason-label + = t("report.reason_label") + %span + = report.text + .panel-body + .content + = report_content(report) + .segment-selection + = button_to t("report.reported_user_details"), + user_search_path(admins_controller_user_search: {guid: report.reported_author.guid}), + class: "btn pull-left btn-info btn-small col-md-3 col-xs-12", method: :post + = button_to t("report.review_link"), report_path(report.id, type: report.item_type), + class: "btn pull-left btn-info btn-small col-md-3 col-xs-12", method: :put + = button_to t("report.delete_link"), report_path(report.id, type: report.item_type), + data: {confirm: t("report.confirm_deletion")}, + class: "btn pull-right btn-danger btn-small col-md-3 col-xs-12", method: :delete + - else + .panel.panel-default + - username = report.user.username + .panel-heading + .reporter.pull-right + != t("report.reported_label", person: link_to(username, user_profile_path(username))) + .title + = report_content(report) + .panel-body + = button_to t("report.review_link"), report_path(report.id, type: report.item_type), + class: "btn pull-left btn-info btn-small", method: :put diff --git a/app/views/report/index.html.haml b/app/views/report/index.html.haml index 219ad34ba..d96304603 100644 --- a/app/views/report/index.html.haml +++ b/app/views/report/index.html.haml @@ -1,47 +1,7 @@ -- content_for :head do - = stylesheet_link_tag :admin - .container .row .col-md-3 - if current_user.admin? = render partial: "admins/admin_bar" .col-md-9 - #reports - %h1 - = t("report.title") - - @reports.each do |report| - - if report.item - .panel.panel-default - - username = report.user.username - .panel-heading - .reporter.pull-right - = raw t("report.reported_label", person: link_to(username, user_profile_path(username))) - .reason - %span.reason-label - = t("report.reason_label") - %span - = report.text - .panel-body - .content - = report_content(report) - - = button_to t("report.reported_user_details"), - user_search_path(admins_controller_user_search: {guid: report.reported_author.guid}), - class: "btn pull-left btn-info btn-small", method: :post - = button_to t("report.review_link"), report_path(report.id, type: report.item_type), - class: "btn pull-left btn-info btn-small", method: :put - = button_to t("report.delete_link"), report_path(report.id, type: report.item_type), - data: {confirm: t("report.confirm_deletion")}, - class: "btn pull-right btn-danger btn-small", method: :delete - - else - .panel.panel-default - - username = report.user.username - .panel-heading - .reporter.pull-right - = raw t("report.reported_label", person: link_to(username, user_profile_path(username))) - .title - = report_content(report) - .panel-body - = button_to t("report.review_link"), report_path(report.id, type: report.item_type), - class: "btn pull-left btn-info btn-small", method: :put + = render partial: "report/reports" diff --git a/app/views/report/index.mobile.haml b/app/views/report/index.mobile.haml new file mode 100644 index 000000000..6f28a776d --- /dev/null +++ b/app/views/report/index.mobile.haml @@ -0,0 +1 @@ += render partial: "report/reports" diff --git a/app/views/shared/_links.haml b/app/views/shared/_links.haml index 1567e0159..2032d6197 100644 --- a/app/views/shared/_links.haml +++ b/app/views/shared/_links.haml @@ -1,8 +1,9 @@ -%li= link_to 'diasporafoundation.org', "https://diasporafoundation.org" -%li= link_to 'Wiki', "https://wiki.diasporafoundation.org" -%li= link_to t('layouts.application.whats_new'), changelog_url -%li= link_to t('layouts.header.code') + " " + pod_version, "#{source_url}", {:title => t('layouts.application.source_package')} +%li= link_to t("layouts.application.discourse"), "https://discourse.diasporafoundation.org" +%li= link_to t("layouts.application.whats_new"), changelog_url +%li= link_to t("layouts.header.code") + " " + pod_version, + source_url.to_s, + title: t("layouts.application.source_package") %li= link_to t("layouts.application.statistics_link"), statistics_path -%li= link_to(t('layouts.application.toggle'), toggle_mobile_path) +%li= link_to t("layouts.application.toggle"), toggle_mobile_path - if AppConfig.settings.terms.enable? - %li= link_to(t('_terms'), terms_path) + %li= link_to t("_terms"), terms_path diff --git a/app/views/streams/main_stream.html.haml b/app/views/streams/main_stream.html.haml index da6c31f75..3a8b0225a 100644 --- a/app/views/streams/main_stream.html.haml +++ b/app/views/streams/main_stream.html.haml @@ -91,8 +91,8 @@ "https://wiki.diasporafoundation.org/How_to_report_a_bug")) %li != t("aspects.index.help.feature_suggestion", - link: link_to("#" + t("aspects.index.help.tag_feature"), - tag_path(name: t("aspects.index.help.tag_feature")))) + link: link_to(t("aspects.index.help.tag_feature"), + "https://discourse.diasporafoundation.org/c/features-and-ideas")) %p != t("aspects.index.help.tutorials_and_wiki", faq: link_to(t("_help"), help_path), @@ -102,6 +102,11 @@ target: "_blank"), target: "_blank") + %p + != t("aspects.index.help.support_forum", + support_forum: link_to(t("aspects.index.help.support_forum_link"), + "https://discourse.diasporafoundation.org/c/support", target: "_blank")) + - unless AppConfig.configured_services.blank? || all_services_connected? .section.collapsed .title @@ -165,6 +170,11 @@ %ul = render "shared/links" + .powered-box + .content + .powered-by-diaspora.text-center + = link_to t("layouts.application.powered_by"), "https://diasporafoundation.org" + .col-md-9 .stream_container#aspect_stream_container = render "aspects/aspect_stream", stream: @stream diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index b4f0119e4..931dfceda 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -55,14 +55,10 @@ en: attributes: person_id: taken: "must be unique among this user’s contacts." - request: - attributes: - from_id: - taken: "is a duplicate of a pre-existing request." reshare: attributes: root_guid: - taken: "That good, eh? You've already reshared that post!" + taken: "That good, eh? You've already reshared that post!" poll: attributes: poll_answers: @@ -117,7 +113,7 @@ en: id: "ID" guid: "GUID" email: "Email" - diaspora_handle: "diaspora* handle" + diaspora_handle: "diaspora* ID" last_seen: "Last seen" account_closed: "Account closed" nsfw: "#nsfw" @@ -160,6 +156,8 @@ en: tag_name: "Tag name: %{name_tag} Count: %{count_tag}" pods: pod_network: "Pod network" + pod_desktop_view: "This page is not available on mobile view, please switch to %{desktop_link}." + pod_desktop_link: "desktop view" aspects: edit: confirm_remove_aspect: "Are you sure you want to delete this aspect?" @@ -172,7 +170,7 @@ en: you_should_add_some_more_contacts: "You should add some more contacts!" try_adding_some_more_contacts: "You can search or %{invite_link} more contacts." invite_link_text: "invite" - or_spotlight: "Or you can share with %{link}" + or_spotlight: "Or you can share with %{link}" community_spotlight: "Community spotlight" aspect_listings: add_an_aspect: "+ Add an aspect" @@ -196,7 +194,7 @@ en: keep_pod_running: "Keep %{pod} running fast and buy servers their coffee fix with a monthly donation!" donate_liberapay: "Donate to liberapay" welcome_to_diaspora: "Welcome to diaspora*, %{name}!" - introduce_yourself: "This is your stream. Jump in and introduce yourself." + introduce_yourself: "This is your stream. Jump in and introduce yourself." new_here: title: "Welcome new users" @@ -215,6 +213,8 @@ en: tag_feature: "feature" tutorials_and_wiki: "%{faq}, %{tutorial} & %{wiki}: help for your first steps." tutorial_link_text: "Tutorials" + support_forum: "You can also join the %{support_forum}." + support_forum_link: "support forum" any_problem: "Got a problem?" contact_podmin: "Contact the administrator of your pod!" mail_podmin: "Podmin email" @@ -258,7 +258,6 @@ en: contacts: index: start_a_conversation: "Start a conversation" - add_a_new_aspect: "Add a new aspect" title: "Contacts" no_contacts: "Looks like you need to add some contacts!" no_contacts_message: "Check out %{community_spotlight}" @@ -576,9 +575,9 @@ en: sending_invitation: "Sending invitation..." paste_link: "Share this link with your friends to invite them to diaspora*, or email them the link directly." codes_left: - zero: "No invites left on this code" - one: "One invite left on this code" - other: "%{count} invites left on this code" + zero: "No invites left on this code" + one: "One invite left on this code" + other: "%{count} invites left on this code" layouts: header: @@ -591,6 +590,7 @@ en: powered_by: "Powered by diaspora*" whats_new: "What’s new?" statistics_link: "Pod statistics" + discourse: "Project discussions and support" toggle: "Toggle mobile" public_feed: "Public diaspora* feed for %{name}" back_to_top: "Back to top" @@ -634,7 +634,6 @@ en: zero: "%{actors} have reshared your post %{post_link}." one: "%{actors} has reshared your post %{post_link}." other: "%{actors} have reshared your post %{post_link}." - post: "post" also_commented_deleted: zero: "%{actors} commented on a deleted post." one: "%{actors} commented on a deleted post." @@ -924,9 +923,9 @@ en: photos: create: - runtime_error: "Photo upload failed. Are you sure that your seatbelt is fastened?" - integrity_error: "Photo upload failed. Are you sure that was an image?" - type_error: "Photo upload failed. Are you sure an image was added?" + runtime_error: "Photo upload failed. Are you sure that your seatbelt is fastened?" + integrity_error: "Photo upload failed. Are you sure that was an image?" + type_error: "Photo upload failed. Are you sure an image was added?" destroy: notice: "Photo deleted." new_profile_photo: @@ -1091,8 +1090,8 @@ en: share_this: "Share this link via email, blog, or social networks!" public_explain: control_your_audience: "Control your audience" - new_user_welcome_message: "Use #hashtags to classify your posts and find people who share your interests. Call out awesome people with @Mentions" - visibility_dropdown: "Use this dropdown to change visibility of your post. (We suggest you make this first one public.)" + new_user_welcome_message: "Use #hashtags to classify your posts and find people who share your interests. Call out awesome people with @Mentions" + visibility_dropdown: "Use this dropdown to change visibility of your post. (We suggest you make this first one public.)" title: "Set up connected services" share: "Share" outside: "Public messages will be available for others outside of diaspora* to see." @@ -1148,6 +1147,9 @@ en: follow: "Follow" all: "All tags" + admin: + title: "Admin" + tags: title: "Posts tagged: %{tags}" @@ -1243,11 +1245,11 @@ en: connect_to_facebook: "We can speed things up a bit by %{link} to diaspora*. This will pull your name and photo, and enable cross-posting." connect_to_facebook_link: "Hooking up your Facebook account" what_are_you_in_to: "What are you into?" - hashtag_explanation: "Hashtags allow you to talk about and follow your interests. They’re also a great way to find new people on diaspora*." + hashtag_explanation: "Hashtags allow you to talk about and follow your interests. They’re also a great way to find new people on diaspora*." hashtag_suggestions: "Try following tags like #art, #movies, #gif, etc." update: - password_changed: "Password changed. You can now log in with your new password." + password_changed: "Password changed. You can now log in with your new password." password_not_changed: "Password change failed" language_changed: "Language changed" diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml index 5ef87d181..7c5071762 100644 --- a/config/locales/javascript/javascript.en.yml +++ b/config/locales/javascript/javascript.en.yml @@ -135,8 +135,6 @@ en: my_aspects: "My aspects" publisher: - limited: "Limited: your post will only be seen by people you are sharing with" - public: "Public: your post will be visible to everyone and found by search engines" near_from: "Posted from: <%= location %>" option: "Answer" add_option: "Add an answer" @@ -184,7 +182,7 @@ en: mobile_row_unchecked: "<%= name %> (add)" stopped_sharing_with: "You have stopped sharing with <%= name %>." started_sharing_with: "You have started sharing with <%= name %>!" - error: "Couldn’t start sharing with <%= name %>. Are you ignoring them?" + error: "Couldn’t start sharing with <%= name %>. Are you ignoring them?" error_remove: "Couldn’t remove <%= name %> from the aspect :(" toggle: one: "In <%= count %> aspect" @@ -206,7 +204,7 @@ en: add_an_aspect: "+ Add an aspect" getting_started: hey: "Hey, <%= name %>!" - no_tags: "Hey, you haven’t followed any tags! Continue anyway?" + no_tags: "Hey, you haven’t followed any tags! Continue anyway?" alright_ill_wait: "All right, I’ll wait." preparing_your_stream: "Preparing your personalized stream..." photo_uploader: diff --git a/features/mobile/drawer.feature b/features/mobile/drawer.feature index aa845a08d..fdeca1cc5 100644 --- a/features/mobile/drawer.feature +++ b/features/mobile/drawer.feature @@ -4,12 +4,7 @@ Feature: Navigate between pages using the header menu and the drawer I want to be able navigate between the pages of the mobile version Background: - Given following users exist: - | username | email | - | Bob Jones | bob@bob.bob | - | Alice Smith | alice@alice.alice | - - And a user with email "bob@bob.bob" is connected with "alice@alice.alice" + Given a user with email "alice@alice.alice" And I sign in as "alice@alice.alice" on the mobile website Scenario: navigate to the stream page @@ -57,9 +52,9 @@ Feature: Navigate between pages using the header menu and the drawer Then I should be on the mentioned stream page Scenario: navigate to aspects pages - Given "bob@bob.bob" has a public post with text "bob's text" Given I have a limited post with text "Hi you!" in the aspect "Besties" When I open the drawer + Then I should not see "All aspects" within "#drawer" And I click on "My aspects" in the drawer And I click on "All aspects" in the drawer Then I should be on the aspects page @@ -73,6 +68,7 @@ Feature: Navigate between pages using the header menu and the drawer When I follow the "boss" tag And I go to the stream page And I open the drawer + Then I should not see "All tags" within "#drawer" And I click on "#Followed tags" in the drawer And I click on "All tags" in the drawer Then I should be on the followed tags stream page @@ -109,3 +105,29 @@ Feature: Navigate between pages using the header menu and the drawer When I open the drawer And I click on "Settings" in the drawer Then I should be on my account settings page + + Scenario: navigate to the admin pages + Given an admin with email "bob@bob.bob" + And I sign in as "bob@bob.bob" on the mobile website + When I open the drawer + Then I should not see "Dashboard" within "#drawer" + When I click on "Admin" in the drawer + And I click on "Dashboard" in the drawer + Then I should see "Pod status" within "#main h2" + When I click on "Admin" in the drawer + And I click on "User search" in the drawer + Then I should see "User search" within "#main h3" + When I click on "Admin" in the drawer + And I click on "Weekly user stats" in the drawer + Then I should see "Current server date is " within "#main h2" + When I click on "Admin" in the drawer + And I click on "Pod stats" in the drawer + Then I should see "Usage statistics" within "#main h1" + When I click on "Admin" in the drawer + And I click on "Reports" in the drawer + Then I should see "Reports overview" within "#main h1" + When I click on "Admin" in the drawer + And I click on "Pod network" in the drawer + Then I should see "Pod network " within "#main h2" + When I click on "Admin" in the drawer + Then I should see "Sidekiq monitor" within "#drawer" diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 0bad1d618..2338693c3 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -25,6 +25,10 @@ Given /^a nsfw user with email "([^\"]*)"$/ do |email| user.profile.update_attributes(:nsfw => true) end +Given /^an admin with email "([^\"]*)"$/ do |email| + user = create_user(email: email) + Role.add_admin(user) +end Given /^(?:|[tT]hat )?following user[s]?(?: exist[s]?)?:$/ do |table| table.hashes.each do |hash| @@ -38,7 +42,6 @@ Given /^(?:|[tT]hat )?following user[s]?(?: exist[s]?)?:$/ do |table| end end - Given /^I have been invited by an admin$/ do admin = FactoryGirl.create(:user) admin.invitation_code