Add announcement admin and view template
This commit is contained in:
1 parent
4807066c68
commit
5570a2dfbf
12 files changed
+145
-115
No files matched your search
@@ -0,0 +1,22 @@
|
||||
<h1>Editing announcement</h1>
|
||||
|
||||
<% form_for @announcement, :url => admin_announcement_path(@announcement) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :title, "Title" %>
|
||||
<%= f.text_field :title %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label :content, "Content" %>
|
||||
<%= f.text_area :content %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.submit 'Update' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Show', @announcement %> |
|
||||
<%= link_to 'Back', admin_announcements_path %>
|
||||
@@ -0,0 +1,21 @@
|
||||
<h1>Listing announcements</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
|
||||
<% @announcements.each do |announcement| %>
|
||||
<tr>
|
||||
<td><%=h announcement.title %></td>
|
||||
<td><%= link_to 'Show', announcement_path(announcement) %> |
|
||||
<%= link_to 'Edit', edit_admin_announcement_path(announcement) %> |
|
||||
<%= link_to 'Destroy', admin_announcement_path(announcement), :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New announcement', new_admin_announcement_path %>
|
||||
@@ -0,0 +1,21 @@
|
||||
<h1>New announcement</h1>
|
||||
|
||||
<% form_for @announcement, :url => admin_announcements_path do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<p>
|
||||
<%= f.label :title, "Title" %>
|
||||
<%= f.text_field :title %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label :content, "Content" %>
|
||||
<%= f.text_area :content %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.submit 'Create' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', admin_announcements_path %>
|
||||
Reference in new issue
Block a user