diff --git a/app/assets/stylesheets/mobile/admins.scss b/app/assets/stylesheets/mobile/admins.scss new file mode 100644 index 000000000..11c10674e --- /dev/null +++ b/app/assets/stylesheets/mobile/admins.scss @@ -0,0 +1,14 @@ +#app { + .btn-block, + input { + margin-bottom: 5px; + margin-top: 5px; + } +} + +#admin-nav li a { + &:hover, + &:focus { + background-color: $gray-light; + } +} diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss index 54d01870e..fbc4873ef 100644 --- a/app/assets/stylesheets/mobile/mobile.scss +++ b/app/assets/stylesheets/mobile/mobile.scss @@ -16,6 +16,7 @@ @import "mobile/stream_element"; @import "mobile/comments"; @import 'mobile/openid_connect_error_page'; +@import 'mobile/admins'; @import 'typography'; diff --git a/app/controllers/admin/pods_controller.rb b/app/controllers/admin/pods_controller.rb index 1b4d2bf2f..739740831 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 @@ -26,6 +27,7 @@ module Admin respond_with do |format| format.html { redirect_to admin_pods_path } format.json { render json: PodPresenter.new(pod).as_json } + format.mobile { redirect_to admin_pods_path } end end end diff --git a/app/views/admins/_admin_bar.haml b/app/views/admins/_admin_bar.haml index 43ab0a8a4..dd9be53b8 100644 --- a/app/views/admins/_admin_bar.haml +++ b/app/views/admins/_admin_bar.haml @@ -1,9 +1,7 @@ - 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 +20,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/_user_entry.mobile.haml b/app/views/admins/_user_entry.mobile.haml new file mode 100644 index 000000000..d9c876673 --- /dev/null +++ b/app/views/admins/_user_entry.mobile.haml @@ -0,0 +1,76 @@ + +%li.user.media + .pull-left + - if user.person + %span.media-object + = person_image_tag(user.person, size: :thumb_small) + + .media-body.row + %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 + .unstyled.text-right.actions + = 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" + + - unless user.closed_account? + - if !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" + - 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" + + .row + .col-md-5 + %dl.dl-horizontal + %dt= t("username") + %dd= user.username + %dt= t(".email") + %dd= user.email + %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") + %dd= invite_code_url(user.invited_by.invitation_code) + %dt= t(".account_closed") + %dd + - if user.person.closed_account + %span.label.label-warning= t(".yes") + - else + %span.label.label-success= t(".no") + %dt= t(".nsfw") + %dd + - if user.person.profile.nsfw + %span.label.label-warning= t(".yes") + - else + %span.label.label-success= t(".no") + + %h4= t("layouts.header.profile") + + %dl.dl-horizontal + %dt= t("people.profile_sidebar.born") + %dd= user.person.profile.birthday + %dt= t("people.profile_sidebar.gender") + %dd= user.person.profile.gender + %dt= t("people.profile_sidebar.location") + %dd= user.person.profile.location + %dt= t("people.profile_sidebar.bio") + %dd= user.person.profile.bio diff --git a/app/views/admins/dashboard.mobile.haml b/app/views/admins/dashboard.mobile.haml new file mode 100644 index 000000000..52696e01b --- /dev/null +++ b/app/views/admins/dashboard.mobile.haml @@ -0,0 +1,9 @@ +.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) diff --git a/app/views/admins/pods.mobile.haml b/app/views/admins/pods.mobile.haml new file mode 100644 index 000000000..6ef234b2f --- /dev/null +++ b/app/views/admins/pods.mobile.haml @@ -0,0 +1,9 @@ +.container + .row + .col-md-9 + %h2 + = t(".pod_network") + + .alert.alert-warning + = t(".pod_desktop_view") + = link_to t(".pod_desktop_link"), toggle_mobile_path diff --git a/app/views/admins/stats.mobile.haml b/app/views/admins/stats.mobile.haml new file mode 100644 index 000000000..d4cf025b2 --- /dev/null +++ b/app/views/admins/stats.mobile.haml @@ -0,0 +1,56 @@ +.col-md-9 + %h1= t(".usage_statistic") + + %div + = 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 btn-block" + + %h3 + != t("admins.stats.display_results", segment: content_tag(:strong, @segment)) + + .row + - %i(posts comments aspect_memberships users).each do |name| + - model = instance_variable_get("@#{name}") + - 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)) diff --git a/app/views/admins/user_search.mobile.haml b/app/views/admins/user_search.mobile.haml new file mode 100644 index 000000000..f7cc719e3 --- /dev/null +++ b/app/views/admins/user_search.mobile.haml @@ -0,0 +1,56 @@ +.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 btn-block" + + .more_invites.col-md-4 + %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")) + + = 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 btn-block" + + .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} 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..c2d9022b9 --- /dev/null +++ b/app/views/admins/weekly_user_stats.mobile.haml @@ -0,0 +1,17 @@ +.col-md-9 + %h2 + = t(".current_server", date: Time.zone.now.to_date) + + %div + = 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 btn-block" + + = t(".amount_of", count: @counter) + %br + - @created_users_by_week[@selected_week].each do |m| + = link_to m, "/u/#{m}" + %br diff --git a/app/views/layouts/_drawer.mobile.haml b/app/views/layouts/_drawer.mobile.haml index c6d48424c..57230c446 100644 --- a/app/views/layouts/_drawer.mobile.haml +++ b/app/views/layouts/_drawer.mobile.haml @@ -35,5 +35,7 @@ = 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? + = render partial: "admins/admin_bar" %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/report/index.mobile.haml b/app/views/report/index.mobile.haml new file mode 100644 index 000000000..3f5902283 --- /dev/null +++ b/app/views/report/index.mobile.haml @@ -0,0 +1,39 @@ +.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 diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 3116e0c19..3d5f156f7 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -160,6 +160,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" + pod_desktop_link: "desktop view." aspects: edit: confirm_remove_aspect: "Are you sure you want to delete this aspect?"