diff --git a/app/assets/stylesheets/specific/admin_dashboards.css.scss b/app/assets/stylesheets/specific/admin_dashboards.css.scss new file mode 100644 index 000000000..aa59f308d --- /dev/null +++ b/app/assets/stylesheets/specific/admin_dashboards.css.scss @@ -0,0 +1,5 @@ +#c-admin-dashboards { + .section { + margin-bottom: 2em; + } +} \ No newline at end of file diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb new file mode 100644 index 000000000..83076fdd7 --- /dev/null +++ b/app/controllers/admin/dashboards_controller.rb @@ -0,0 +1,9 @@ +module Admin + class DashboardsController < ApplicationController + before_filter :admin_only + + def show + @dashboard = AdminDashboard.new + end + end +end diff --git a/app/controllers/user_name_change_requests_controller.rb b/app/controllers/user_name_change_requests_controller.rb index 2f62cf54e..9c2eaaf61 100644 --- a/app/controllers/user_name_change_requests_controller.rb +++ b/app/controllers/user_name_change_requests_controller.rb @@ -18,7 +18,8 @@ class UserNameChangeRequestsController < ApplicationController if @change_request.errors.any? render :action => "new" else - redirect_to user_name_change_request_path(@change_request), :notice => "Your request has been submitted and is pending admin review" + @change_request.approve! + redirect_to user_name_change_request_path(@change_request), :notice => "Your name has been changed" end end diff --git a/app/logical/admin_dashboard.rb b/app/logical/admin_dashboard.rb new file mode 100644 index 000000000..8d4635e0d --- /dev/null +++ b/app/logical/admin_dashboard.rb @@ -0,0 +1,17 @@ +class AdminDashboard + def tag_aliases + TagAlias.where(status: "pending").order("id desc") + end + + def tag_implications + TagImplication.where(status: "pending").order("id desc") + end + + def update_requests + BulkUpdateRequest.where(status: "pending").order("id desc") + end + + def forum_topics + ForumTopic.where(category_id: 1).order("id desc").limit(20) + end +end diff --git a/app/views/admin/dashboards/_aliases.html.erb b/app/views/admin/dashboards/_aliases.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/admin/dashboards/show.html.erb b/app/views/admin/dashboards/show.html.erb new file mode 100644 index 000000000..e45999905 --- /dev/null +++ b/app/views/admin/dashboards/show.html.erb @@ -0,0 +1,29 @@ +
| Creator | +Forum | +Script | +Status | ++ |
|---|---|---|---|---|
| <%= link_to_user(request.user) %> | +<%= link_to(request.forum_topic_id, forum_topic_path(request.forum_topic_id)) %> | +<%= script_with_line_breaks(request.script) %> | +<%= request.status %> | ++ <% if CurrentUser.is_moderator? && request.status == "pending" %> + <%= link_to "Approve", approve_bulk_update_request_path(request), :method => :post %> | + <% end %> + <% if request.editable?(CurrentUser.user) %> + <%= link_to "Delete", bulk_update_request_path(request), :method => :delete, :data => {:confirm => "Are you sure you want to delete this bulk update request?"} %> | + <%= link_to "Edit", edit_bulk_update_request_path(request) %> + <% end %> + | +
| Creator | -Forum | -Script | -Status | -- |
|---|---|---|---|---|
| <%= link_to_user(request.user) %> | -<%= link_to(request.forum_topic_id, forum_topic_path(request.forum_topic_id)) %> | -<%= script_with_line_breaks(request.script) %> | -<%= request.status %> | -- <% if CurrentUser.is_moderator? && request.status == "pending" %> - <%= link_to "Approve", approve_bulk_update_request_path(request), :method => :post %> | - <% end %> - <% if request.editable?(CurrentUser.user) %> - <%= link_to "Delete", bulk_update_request_path(request), :method => :delete, :data => {:confirm => "Are you sure you want to delete this bulk update request?"} %> | - <%= link_to "Edit", edit_bulk_update_request_path(request) %> - <% end %> - | -
| Title | +Creator | +Updated by | +Updated at | +
|---|---|---|---|
| + <% if topic.is_sticky? %> + Sticky: + <% end %> + + <% unless topic.read_by?(CurrentUser.user) %> + NEW + <% end %> + + <%= link_to topic.title, forum_topic_path(topic) %> + + <% if topic.response_count > Danbooru.config.posts_per_page %> + <%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %> + <% end %> + + <% if topic.is_locked? %> + (locked) + <% end %> + | +<%= link_to_user topic.creator %> | +<%= link_to_user topic.updater %> | +<%= compact_time topic.updated_at %> | +
| Title | -Creator | -Updated by | -Updated at | -
|---|---|---|---|
| - <% if topic.is_sticky? %> - Sticky: - <% end %> - - <% unless topic.read_by?(CurrentUser.user) %> - NEW - <% end %> - - <%= link_to topic.title, forum_topic_path(topic) %> - - <% if topic.response_count > Danbooru.config.posts_per_page %> - <%= link_to "page #{topic.last_page}", forum_topic_path(topic, :page => topic.last_page), :class => "last-page" %> - <% end %> - - <% if topic.is_locked? %> - (locked) - <% end %> - | -<%= link_to_user topic.creator %> | -<%= link_to_user topic.updater %> | -<%= compact_time topic.updated_at %> | -
| From | +To | +Reference | +Status | ++ |
|---|---|---|---|---|
| <%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> <%= tag_alias.antecedent_tag.post_count rescue 0 %> | +<%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> <%= tag_alias.consequent_tag.post_count rescue 0 %> | ++ <% if tag_alias.forum_topic_id %> + <%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %> + <% end %> + | ++ <%= tag_alias.status %> + | ++ <%= link_to "Show", tag_alias_path(tag_alias) %> + + <% if tag_alias.editable_by?(CurrentUser.user) %> + | <%= link_to "Edit", edit_tag_alias_path(tag_alias) %> + <% end %> + + <% if tag_alias.is_pending? && tag_alias.editable_by?(CurrentUser.user) %> + | <%= link_to "Delete", tag_alias_path(tag_alias), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this alias?"} %> + <% end %> + + <% if CurrentUser.is_admin? && tag_alias.is_pending? %> + | <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %> + <% end %> + + <% if CurrentUser.is_janitor? %> + | <%= link_to "Fix", tag_alias_correction_path(:tag_alias_id => tag_alias.id) %> + <% end %> + | +
| From | -To | -Reference | -Status | -- |
|---|---|---|---|---|
| <%= link_to tag_alias.antecedent_name, posts_path(:tags => tag_alias.antecedent_name) %> <%= tag_alias.antecedent_tag.post_count rescue 0 %> | -<%= link_to tag_alias.consequent_name, posts_path(:tags => tag_alias.consequent_name) %> <%= tag_alias.consequent_tag.post_count rescue 0 %> | -- <% if tag_alias.forum_topic_id %> - <%= link_to tag_alias.forum_topic_id, forum_topic_path(tag_alias.forum_topic_id) %> - <% end %> - | -- <%= tag_alias.status %> - | -- <%= link_to "Show", tag_alias_path(tag_alias) %> + <%= render "listing", :tag_aliases => @tag_aliases %> - <% if tag_alias.editable_by?(CurrentUser.user) %> - | <%= link_to "Edit", edit_tag_alias_path(tag_alias) %> - <% end %> - - <% if tag_alias.is_pending? && tag_alias.editable_by?(CurrentUser.user) %> - | <%= link_to "Delete", tag_alias_path(tag_alias), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this alias?"} %> - <% end %> - - <% if CurrentUser.is_admin? && tag_alias.is_pending? %> - | <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %> - <% end %> - - <% if CurrentUser.is_janitor? %> - | <%= link_to "Fix", tag_alias_correction_path(:tag_alias_id => tag_alias.id) %> - <% end %> - | -
| From | +To | +Reference | +Status | ++ |
|---|---|---|---|---|
| <%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> <%= tag_implication.antecedent_tag.post_count rescue 0 %> | +<%= link_to tag_implication.consequent_name, posts_path(:tags => tag_implication.consequent_name) %> <%= tag_implication.consequent_tag.post_count rescue 0 %> | ++ <% if tag_implication.forum_topic_id %> + <%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %> + <% end %> + | +<%= tag_implication.status %> | ++ <%= link_to "Show", tag_implication_path(tag_implication) %> + + <% if tag_implication.is_pending? && tag_implication.editable_by?(CurrentUser.user) %> + | <%= link_to "Edit", edit_tag_implication_path(tag_implication) %> + <% end %> + + <% if tag_implication.deletable_by?(CurrentUser.user) %> + | <%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this implication?"} %> + <% end %> + + <% if CurrentUser.user.is_admin? && tag_implication.is_pending? %> + | <%= link_to "Approve", approve_tag_implication_path(tag_implication), :remote => true, :method => :post %> + <% end %> + | +
| From | -To | -Reference | -Status | -- |
|---|---|---|---|---|
| <%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> <%= tag_implication.antecedent_tag.post_count rescue 0 %> | -<%= link_to tag_implication.consequent_name, posts_path(:tags => tag_implication.consequent_name) %> <%= tag_implication.consequent_tag.post_count rescue 0 %> | -- <% if tag_implication.forum_topic_id %> - <%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %> - <% end %> - | -<%= tag_implication.status %> | -- <%= link_to "Show", tag_implication_path(tag_implication) %> - - <% if tag_implication.is_pending? && tag_implication.editable_by?(CurrentUser.user) %> - | <%= link_to "Edit", edit_tag_implication_path(tag_implication) %> - <% end %> - - <% if tag_implication.deletable_by?(CurrentUser.user) %> - | <%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this implication?"} %> - <% end %> - - <% if CurrentUser.user.is_admin? && tag_implication.is_pending? %> - | <%= link_to "Approve", approve_tag_implication_path(tag_implication), :remote => true, :method => :post %> - <% end %> - | -