added news updates ui
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<header id="top">
|
||||
<%= render "news/listing" %>
|
||||
<%= render "news_updates/listing" %>
|
||||
|
||||
<h1><%= link_to Danbooru.config.app_name, "/" %></h1>
|
||||
<nav>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<% unless cookies["news-ticker"] == "2011-09-01" %>
|
||||
<div id="news-ticker" data-updated-at="2011-09-01">
|
||||
<ul>
|
||||
<li>10/22: Database has been reset</li>
|
||||
<li>Report issues on <a href="https://github.com/r888888888/danbooru/issues/new">Github</a> or the <a href="http://danbooru.donmai.us/forum/show/65870">forum</a></li>
|
||||
</ul>
|
||||
|
||||
<a href="#" id="close-news-ticker-link">close</a>
|
||||
</div>
|
||||
<% end %>
|
||||
11
app/views/news_updates/_listing.html.erb
Normal file
11
app/views/news_updates/_listing.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<% cache("news-updates", :expires_in => 1.hour) do %>
|
||||
<div id="news-updates" data-updated-at="<%= NewsUpdate.recent.first.try(:created_at).try(:strftime, "%m/%d/%Y") %>">
|
||||
<ul>
|
||||
<% NewsUpdate.recent.each do |news_update| %>
|
||||
<li><%= news_update.created_at.strftime("%m/%d") %>: <%= news_update.message.html_safe %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<a href="#" id="close-news-ticker-link">close</a>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/news_updates/_secondary_links.html.erb
Normal file
6
app/views/news_updates/_secondary_links.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", news_updates_path %></li>
|
||||
<li><%= link_to "New", new_news_update_path %></li>
|
||||
</menu>
|
||||
<% end %>
|
||||
1
app/views/news_updates/destroy.js.erb
Normal file
1
app/views/news_updates/destroy.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#news-update-<%= @news_update.id %>").remove();
|
||||
16
app/views/news_updates/edit.html.erb
Normal file
16
app/views/news_updates/edit.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<div id="c-news-updates">
|
||||
<div id="a-new">
|
||||
<h1>Edit Update</h1>
|
||||
|
||||
<%= simple_form_for(@news_update) do |f| %>
|
||||
<%= f.input :message, :hint => "Use HTML for formatting", :input_html => {:size => "30x5"} %>
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Edit Update - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
32
app/views/news_updates/index.html.erb
Normal file
32
app/views/news_updates/index.html.erb
Normal file
@@ -0,0 +1,32 @@
|
||||
<div id="c-news-updates">
|
||||
<div id="a-index">
|
||||
<h1>News Updates</h1>
|
||||
|
||||
<table class="striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Creator</th>
|
||||
<th>Message</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @news_updates.each do |news_update| %>
|
||||
<tr id="news-update-<%= news_update.id %>">
|
||||
<td><%= news_update.creator.name %></td>
|
||||
<td><%= news_update.message %></td>
|
||||
<td><%= link_to "Edit", edit_news_update_path(news_update) %> | <%= link_to "Delete", news_update_path(news_update), :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= numbered_paginator(@news_updates) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
News Updates - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
16
app/views/news_updates/new.html.erb
Normal file
16
app/views/news_updates/new.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<div id="c-news-updates">
|
||||
<div id="a-new">
|
||||
<h1>New Update</h1>
|
||||
|
||||
<%= simple_form_for(@news_update) do |f| %>
|
||||
<%= f.input :message, :hint => "Use HTML for formatting", :input_html => {:size => "30x5"} %>
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
New Update - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user