Skip to content

Commit

Permalink
[admin] Clean up news index
Browse files Browse the repository at this point in the history
  • Loading branch information
jerodsanto committed Sep 11, 2023
1 parent 7a352b6 commit e5393ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 73 deletions.
10 changes: 2 additions & 8 deletions lib/changelog_web/templates/admin/news_item/_table.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
<th>Type</th>
<th>Headline</th>
<th>Topics</th>
<%= if @status == :published do %>
<th><i class="mouse pointer icon"></i> / <i class="eye icon"></i></th>
<th>CTR</th>
<% else %>
<%= if @status != :published do %>
<th>Create Time</th>
<% end %>
<%= if Enum.member?([:published, :scheduled], @status) do %>
Expand Down Expand Up @@ -60,10 +57,7 @@
<%= link "##{topic.slug}", to: Routes.admin_topic_path(@conn, :edit, topic.slug) %><br/>
<% end %>
</td>
<%= if @status == :published do %>
<td><%= item.click_count %> / <%= item.impression_count %></td>
<td><%= SharedHelpers.ctr(item) %>%</td>
<% else %>
<%= if @status != :published do %>
<td><%= AdminHelpers.ts(item.inserted_at) %></td>
<% end %>
<%= if Enum.member?([:published, :scheduled], @status) do %>
Expand Down
65 changes: 0 additions & 65 deletions lib/changelog_web/templates/admin/news_item/index.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -49,71 +49,6 @@
<% end %>
<% end %>

<%= if Enum.any?(@scheduled) do %>
<h2 id="scheduled" class="ui header">Scheduled</h2>
<%= render("_table.html", Map.merge(assigns, %{status: :scheduled, items: @scheduled})) %>
<% end %>

<h2 id="queued" class="ui header">Queued</h2>
<%= if Enum.any?(@queued) do %>
<%= render("_table.html", Map.merge(assigns, %{status: :queued, items: @queued})) %>
<% else %>
<div class="ui basic segment icon message">
<i class="meh face icon"></i>
<div class="content">
<div class="header">No news items in the queue</div>
</div>
</div>
<% end %>

<%= if Policies.AdminsOnly.index(@current_user) do %>
<h2 id="sponsorships" class="ui header">
<%= link "Sponsorships", to: Routes.admin_news_sponsorship_path(@conn, :index) %>

<div class="ui right floated basic buttons">
<%= link to: Routes.admin_news_sponsorship_path(@conn, :index), class: "ui icon button", title: "View All" do %>
<i class="list icon"></i>
<% end %>
<%= link to: Routes.admin_news_sponsorship_path(@conn, :schedule), class: "ui icon button", title: "Full Schedule" do %>
<i class="calendar icon"></i>
<% end %>
<%= link to: Routes.admin_news_sponsorship_path(@conn, :new), class: "ui icon button" do %>
<i class="add icon"></i>
<% end %>
</div>
</h2>
<%= render(NewsSponsorshipView, "_schedule.html", conn: @conn, weeks: TimeView.weeks()) %>

<div class="basic segment">
<h2 id="recently" class="ui header">Recently</h2>

<div class="ui equal width grid">
<%= for feed <- @activity do %>
<div class="ui column feed">
<%= for object <- feed do %>
<div class="event">
<div class="label">
<i class="<%= if is_edited(object), do: "pencil", else: "plus" %> icon"></i>
</div>
<div class="content">
<div class="summary">
<%= if object.__struct__ == Topic do %>
The <%= link object.name, to: Routes.admin_topic_path(@conn, :edit, object.slug) %> topic
<% else %>
The <%= link object.name, to: Routes.admin_news_source_path(@conn, :edit, object) %> news source
<% end %>
was <%= if is_edited(object), do: "edited", else: "added" %>
<div class="date"><%= TimeView.ts(object.updated_at, "admin") %></div>
</div>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
</div>
<% end %>

<%= if Enum.any?(@published) do %>
<h2 id="published" class="ui header">Published (<%= @page.total_entries |> SharedHelpers.comma_separated %>)</h2>
<%= render("_table.html", Map.merge(assigns, %{status: :published, items: @published})) %>
Expand Down

0 comments on commit e5393ac

Please sign in to comment.