Refactor partials + pronto
This commit is contained in:
parent
a7d97b7fd3
commit
2782edc780
20 changed files with 187 additions and 206 deletions
|
|
@ -5,7 +5,7 @@
|
|||
evt.preventDefault();
|
||||
$("#app").toggleClass("draw");
|
||||
});
|
||||
$("#all_aspects, #followed_tags, #admin").bind("tap click", function(evt) {
|
||||
$("#all_aspects, #followed_tags, #admin").bind("tap click", function(evt) {
|
||||
evt.preventDefault();
|
||||
$(this).find("+ li").toggleClass("hide");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Weekly stats
|
||||
.week-selector {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
// Pod stats
|
||||
.segment-selection {
|
||||
select,
|
||||
|
|
@ -49,6 +54,10 @@
|
|||
.content {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.panel-body .btn-info {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
/** pod list **/
|
||||
|
|
|
|||
|
|
@ -886,7 +886,7 @@ select#aspect_ids_ {
|
|||
|
||||
.tag_following_action { margin: 5px 0 10px 0; }
|
||||
|
||||
/* --- Admin pages --- */
|
||||
// --- Admin pages ---
|
||||
.pod-version {
|
||||
// The fetching of the pod version is not done on mobile currently so we hide this alert.
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ 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
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
.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)
|
||||
- else
|
||||
%p
|
||||
= t("report.unreviewed_reports", count: 0)
|
||||
#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)
|
||||
|
|
|
|||
|
|
@ -1,61 +1,50 @@
|
|||
- content_for :head do
|
||||
= stylesheet_link_tag :admin
|
||||
|
||||
.col-md-9
|
||||
%h1= t(".usage_statistic")
|
||||
%h1= t(".usage_statistic")
|
||||
|
||||
.row
|
||||
= form_tag("/admins/stats", method: "get", class: "form-inline segment-selection") do
|
||||
.col-sm-2.col-sm-push-8
|
||||
%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")
|
||||
.col-sm-2.col-sm-push-8
|
||||
= submit_tag t(".go"), class: "btn btn-primary btn-block"
|
||||
.row
|
||||
= form_tag("/admins/stats", method: "get", class: "col-sm-12 form-inline segment-selection") do
|
||||
.col-sm-2.col-sm-push-8
|
||||
%select.form-control{name: "range"}
|
||||
- ["daily", "week", "2weeks", "month"].each do |range|
|
||||
%option{value: range, selected: ("selected" if params[:range] == range)}
|
||||
= t(".#{range}")
|
||||
.col-sm-2.col-sm-push-8
|
||||
= submit_tag t(".go"), class: "btn btn-primary btn-block"
|
||||
|
||||
.col-sm-8.col-sm-pull-4
|
||||
.col-sm-8.col-sm-pull-4
|
||||
%h4
|
||||
!= 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])
|
||||
- else
|
||||
- name = t(".#{name}", count: model[:yesterday])
|
||||
|
||||
.col-md-3
|
||||
%h2{style: "font-weight:bold;"}
|
||||
= name.to_s
|
||||
%h4
|
||||
!= t("admins.stats.display_results", segment: content_tag(:strong, @segment))
|
||||
= model[:day_before]
|
||||
%span.percent_change{class: (model[:change] > 0 ? "green" : "red")}
|
||||
= "(#{model[:change]}%)"
|
||||
|
||||
.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])
|
||||
.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.to_f),
|
||||
post_day: content_tag(:strong, @posts[:day_before] / @user_count.to_f))
|
||||
|
||||
.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))
|
||||
.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))
|
||||
|
|
|
|||
|
|
@ -67,8 +67,6 @@
|
|||
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.unlock_account"),
|
||||
admin_unlock_account_path(user),
|
||||
|
|
|
|||
|
|
@ -1,58 +1,57 @@
|
|||
- content_for :head do
|
||||
= stylesheet_link_tag :admin
|
||||
|
||||
.col-md-9
|
||||
.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"
|
||||
.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 :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
|
||||
= 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"
|
||||
.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: @users.count)
|
||||
.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}
|
||||
.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"))
|
||||
.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"
|
||||
.col-xs-12.col-md-2
|
||||
= submit_tag t(".invite"), class: "btn btn-block btn-primary"
|
||||
= 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"
|
||||
.col-xs-12.col-md-2
|
||||
= submit_tag t(".invite"), class: "btn btn-block btn-primary"
|
||||
|
|
|
|||
21
app/views/admins/_weekly_user_stats.haml
Normal file
21
app/views/admins/_weekly_user_stats.haml
Normal file
|
|
@ -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}"
|
||||
|
|
@ -2,4 +2,5 @@
|
|||
.row
|
||||
.col-md-3
|
||||
= render partial: "admins/admin_bar"
|
||||
= render partial: "admins/dashboard"
|
||||
.col-md-9
|
||||
= render partial: "admins/dashboard"
|
||||
|
|
|
|||
|
|
@ -1,4 +1 @@
|
|||
- content_for :head do
|
||||
= stylesheet_link_tag :admin
|
||||
|
||||
= render partial: "admins/dashboard"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
.container
|
||||
.row
|
||||
.col-md-9
|
||||
%h2
|
||||
= t(".pod_network")
|
||||
%h2
|
||||
= t(".pod_network")
|
||||
|
||||
.alert.alert-warning
|
||||
!= t(".pod_desktop_view", desktop_link: link_to(t(".pod_desktop_link"), toggle_mobile_path))
|
||||
.alert.alert-warning
|
||||
!= t(".pod_desktop_view", desktop_link: link_to(t(".pod_desktop_link"), toggle_mobile_path))
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@
|
|||
.row
|
||||
.col-md-3
|
||||
= render partial: "admins/admin_bar"
|
||||
= render partial: "admins/stats"
|
||||
.col-md-9
|
||||
= render partial: "admins/stats"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
= render partial: "user_entry"
|
||||
|
|
@ -2,4 +2,5 @@
|
|||
.row
|
||||
.col-md-3
|
||||
= render partial: "admins/admin_bar"
|
||||
= render partial: "admins/user_search"
|
||||
.col-md-9
|
||||
= render partial: "admins/user_search"
|
||||
|
|
|
|||
|
|
@ -3,16 +3,4 @@
|
|||
.col-md-3
|
||||
= render partial: "admins/admin_bar"
|
||||
.col-md-9
|
||||
%h2
|
||||
= t(".current_server", date: Time.zone.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"
|
||||
|
|
|
|||
|
|
@ -1,17 +1 @@
|
|||
.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
|
||||
= render partial: "admins/weekly_user_stats"
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
%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{role: "presentation", class: current_page?(report_index_path)}
|
||||
%li
|
||||
%a{href: report_index_path}
|
||||
- if unreviewed_reports_count > 0
|
||||
.pull-right.badge
|
||||
|
|
|
|||
|
|
@ -1,46 +1,44 @@
|
|||
- content_for :head do
|
||||
= stylesheet_link_tag :admin
|
||||
= stylesheet_link_tag :report
|
||||
|
||||
.col-md-9
|
||||
.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
|
||||
.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", method: :put
|
||||
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
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@
|
|||
.col-md-3
|
||||
- if current_user.admin?
|
||||
= render partial: "admins/admin_bar"
|
||||
= render partial: "report/reports"
|
||||
.col-md-9
|
||||
= render partial: "report/reports"
|
||||
|
|
|
|||
Loading…
Reference in a new issue