Favorite groups
This commit is contained in:
19
app/views/favorite_groups/_secondary_links.html.erb
Normal file
19
app/views/favorite_groups/_secondary_links.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", favorite_groups_path %></li>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<li><%= link_to "New", new_favorite_group_path %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:favorite_groups") %></li>
|
||||
|
||||
<% if @favorite_group && !@favorite_group.new_record? %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Show", favorite_group_path(@favorite_group) %></li>
|
||||
<li><%= link_to "Posts", posts_path(:tags => "favgroup:#{@favorite_group.id}") %></li>
|
||||
<% if @favorite_group.editable_by?(CurrentUser.user) %>
|
||||
<li><%= link_to "Edit", edit_favorite_group_path(@favorite_group) %></li>
|
||||
<li><%= link_to "Delete", favorite_group_path(@favorite_group), :method => :delete, :data => {:confirm => "Are you sure you want to delete this favorite group?"} %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% end %>
|
||||
19
app/views/favorite_groups/edit.html.erb
Normal file
19
app/views/favorite_groups/edit.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<div id="c-favorite-groups">
|
||||
<div id="a-edit">
|
||||
<h1>Edit Favorite Group: <%= @favorite_group.pretty_name %></h1>
|
||||
|
||||
<%= error_messages_for "favorite_group" %>
|
||||
|
||||
<%= simple_form_for(@favorite_group) do |f| %>
|
||||
<%= f.input :name, :as => :string, :input_html => { :value => @favorite_group.pretty_name } %>
|
||||
<%= f.input :post_ids, :label => "Posts" %>
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Edit Favorite Group - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
40
app/views/favorite_groups/index.html.erb
Normal file
40
app/views/favorite_groups/index.html.erb
Normal file
@@ -0,0 +1,40 @@
|
||||
<div id="c-favorite-groups">
|
||||
<div id="a-index">
|
||||
<table class="striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
<th width="60%">Name</th>
|
||||
<th width="10%">Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @favorite_groups.each do |favgroup| %>
|
||||
<%= content_tag(:tr, :id => "favorite-group-#{favgroup.id}") do %>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to favgroup.pretty_name, favorite_group_path(favgroup) %>
|
||||
|
||||
<% if favgroup.post_count > CurrentUser.user.per_page %>
|
||||
<%= link_to "page #{favgroup.last_page}", favorite_group_path(favgroup, :page => favgroup.last_page), :class => "last-page" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= favgroup.post_count %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= numbered_paginator(@favorite_groups) %>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Favorite Groups - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
19
app/views/favorite_groups/new.html.erb
Normal file
19
app/views/favorite_groups/new.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<div id="c-favorite-groups">
|
||||
<div id="a-new">
|
||||
<h1>New Favorite Group</h1>
|
||||
|
||||
<%= error_messages_for "favorite_group" %>
|
||||
|
||||
<%= simple_form_for(@favorite_group) do |f| %>
|
||||
<%= f.input :name, :as => :string, :required => true %>
|
||||
<%= f.input :post_ids, :label => "Posts" %>
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
New Favorite Group - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
22
app/views/favorite_groups/show.html.erb
Normal file
22
app/views/favorite_groups/show.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<div id="c-favorite-groups">
|
||||
<div id="a-show">
|
||||
<h1>
|
||||
Favorite Group:
|
||||
<%= link_to @favorite_group.pretty_name, posts_path(:tags => "favgroup:#{@favorite_group.id}") %>
|
||||
</h1>
|
||||
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
|
||||
<section>
|
||||
<%= @post_set.presenter.post_previews_html(self) %>
|
||||
|
||||
<%= numbered_paginator(@post_set) %>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Favorite Group - <%= @favorite_group.pretty_name %> - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
@@ -6,6 +6,7 @@
|
||||
<li><%= link_to "Hot", posts_path(:tags => "order:rank") %></li>
|
||||
<% unless CurrentUser.is_anonymous? %>
|
||||
<li><%= link_to "Favorites", favorites_path %></li>
|
||||
<li><%= link_to "Favorite groups", favorite_groups_path %></li>
|
||||
<% if CurrentUser.user.has_saved_searches? %>
|
||||
<li><%= link_to "Saved searches", saved_searches_path %></li>
|
||||
<% end %>
|
||||
|
||||
23
app/views/posts/partials/show/_favorite_groups.html.erb
Normal file
23
app/views/posts/partials/show/_favorite_groups.html.erb
Normal file
@@ -0,0 +1,23 @@
|
||||
<div id="favgroup-nav">
|
||||
<ul>
|
||||
<% post.favorite_groups.each do |favgroup| %>
|
||||
<li>
|
||||
<% if favgroup.neighbors(post).previous %>
|
||||
<%= link_to("‹ prev".html_safe, post_path(favgroup.neighbors(post).previous), :rel => "prev", :class => "prev") %>
|
||||
<% else %>
|
||||
<span class="prev">‹ prev</span>
|
||||
<% end %>
|
||||
|
||||
<span class="favgroup-name">
|
||||
<%= link_to("Favorite group: #{favgroup.name}", favorite_group_path(favgroup)) %>
|
||||
</span>
|
||||
|
||||
<% if favgroup.neighbors(post).next %>
|
||||
<%= link_to("next ›".html_safe, post_path(favgroup.neighbors(post).next), :rel => "next", :class => "next") %>
|
||||
<% else %>
|
||||
<span class="next">next ›</span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -7,5 +7,9 @@
|
||||
<% if post.pools.any? %>
|
||||
<%= render "posts/partials/show/pools", :post => post %>
|
||||
<% end %>
|
||||
|
||||
<% if post.favorite_groups.any? %>
|
||||
<%= render "posts/partials/show/favorite_groups", :post => post %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -44,6 +44,11 @@
|
||||
<td><%= presenter.favorite_count(self) %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Favorite Groups</th>
|
||||
<td><%= presenter.favorite_group_count(self) %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Post Changes</th>
|
||||
<td><%= presenter.post_version_count(self) %></td>
|
||||
|
||||
Reference in New Issue
Block a user