Add Item, Page, Component, Link inheritanced models

This commit is contained in:
Wen-Tien Chang committed 2010-01-14 18:30:53 +08:00
1 parent cd21cadfe7
commit e1440a79d8
38 files changed
+417 -175

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
<%= f.error_messages %>
<%= f.hidden_field :parent_item_name %>
<p>
<%= f.label :name, "Name" %>
<%= f.text_field :name, :class => 'text' %>
</p>
<p>
<%= f.label :title, "Title en" %>
<%= f.text_field :title_en, :class => 'text' %>
</p>
<p>
<%= f.label :layout_name, "Layout Name" %>
<%= f.text_field :layout_name, :class => 'text' %>
</p>
<p>
<%= f.label :title, "Title zh_tw" %>
<%= f.text_field :title_zh_tw, :class => 'text' %>
</p>
<p>
<%= f.label :is_published, "Is Published" %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
<p>
<%= f.label :engine_name, "Choose Engine" %>
<%= f.text_field :engine_name %>
</p>
+10
View File
@@ -0,0 +1,10 @@
<h1>Editing pages</h1>
<% form_for @component, :url => admin_component_path(@component) do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
+11
View File
@@ -0,0 +1,11 @@
<h1><%= t(:new_component, :scope => :admin) %></h1>
<% form_for @component, :url => admin_components_path do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
+12
View File
@@ -0,0 +1,12 @@
<tr>
<td><%= item.class %></td>
<td><%= link_to item.name, admin_items_path(:parent_item_name => item.name) %></td>
<td><%=h item.title %>
<td><%= item.position %></td>
<td><%= item.is_published.to_s %></td>
<td>
<%= link_to t(:show), admin_component_path(item.name) %> |
<%= link_to t(:edit), edit_admin_component_path(item) %> |
<%= link_to t(:delete), admin_component_path(item), :confirm => 'Are you sure?', :method => :delete %>
</td>
</tr>
+12
View File
@@ -0,0 +1,12 @@
<tr>
<td><%= item.class %></td>
<td><%= link_to item.name, admin_items_path(:parent_item_name => item.name) %></td>
<td><%=h item.title %>
<td><%= item.position %></td>
<td><%= item.is_published.to_s %></td>
<td>
<%= link_to t(:show), admin_link_path(item.name) %> |
<%= link_to t(:edit), edit_admin_link_path(item) %> |
<%= link_to t(:delete), admin_link_path(item), :confirm => 'Are you sure?', :method => :delete %>
</td>
</tr>
+12
View File
@@ -0,0 +1,12 @@
<tr>
<td><%= item.class %></td>
<td><%= link_to item.name, admin_items_path(:parent_item_name => item.name) %></td>
<td><%=h item.title %>
<td><%= item.position %></td>
<td><%= item.is_published.to_s %></td>
<td>
<%= link_to t(:show), admin_page_path(item.name) %> |
<%= link_to t(:edit), edit_admin_page_path(item) %> |
<%= link_to t(:delete), admin_page_path(item), :confirm => 'Are you sure?', :method => :delete %>
</td>
</tr>
+15
View File
@@ -0,0 +1,15 @@
<h1>Listing snippets</h1>
<table>
<tr>
</tr>
<% snippets.each do |snippet| %>
<tr>
<td><%= snippet.name %></td>
<td><%= link_to t(:show), admin_snippet_path(snippet) %>
<td><%= link_to t(:edit), edit_admin_snippet_path(snippet) %></td>
<td><%= link_to t(:delete), admin_snippet_path(snippet), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
+28
View File
@@ -0,0 +1,28 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t(:new_page, :scope => :admin), new_admin_page_path( :parent_item_name => @parent_item.name ), :class => 'button positive' %></li>
<li><%= link_to t(:new_component, :scope => :admin), new_admin_component_path( :parent_item_name => @parent_item.name ) %>
<li><%= link_to t(:new_link, :scope => :admin), new_admin_link_path( :parent_item_name => @parent_item.name ) %>
<li><%= link_to t(:new_snippet, :scope => :admin ), new_admin_snippet_path( :parent_item_name => @parent_item.name ), :class => 'button positive' %></li>
</ul>
<% end -%>
<h1>Listing items: <%= @parent_item.name %>/</h1>
<table>
<tr>
<th>Class</th>
<th>Name</th>
<th>Title</th>
<th>Position</th>
<th>Published?</th>
<th>Action</th>
</tr>
<% @items.each do |item| %>
<%= render :partial => item.class.to_s.downcase, :locals => { :item => item } %>
<% end %>
</table>
<%= render :partial => "snippets", :locals => { :snippets => @snippets } %>
+3 -3
View File
@@ -7,12 +7,12 @@
<% @layouts.each do |layout| %>
<tr>
<td><%= layout.name %></td>
<td><%= link_to 'Edit', edit_admin_layout_path(layout) %></td>
<td><%= link_to 'Destroy', admin_layout_path(layout), :confirm => 'Are you sure?', :method => :delete %></td>
<td><%= link_to t(:edit), edit_admin_layout_path(layout) %></td>
<td><%= link_to t(:delete), admin_layout_path(layout), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New layouts', new_admin_layout_path, :class => 'button positive' %>
<%= link_to t(:new_layout, :scope => :admin), new_admin_layout_path, :class => 'button positive' %>
+28
View File
@@ -0,0 +1,28 @@
<%= f.error_messages %>
<%= f.hidden_field :parent_item_name %>
<p>
<%= f.label :name, "Name" %>
<%= f.text_field :name, :class => 'text' %>
</p>
<p>
<%= f.label :title, "Title en" %>
<%= f.text_field :title_en, :class => 'text' %>
</p>
<p>
<%= f.label :title, "Title zh_tw" %>
<%= f.text_field :title_zh_tw, :class => 'text' %>
</p>
<p>
<%= f.label :is_published, "Is Published" %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
<p>
<%= f.label :url, "URL" %>
<%= f.text_field :url %>
</p>
+10
View File
@@ -0,0 +1,10 @@
<h1>Editing pages</h1>
<% form_for @link, :url => admin_link_path(@link) do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
+11
View File
@@ -0,0 +1,11 @@
<h1><%= t(:new_link, :scope => :admin) %></h1>
<% form_for @link, :url => admin_links_path do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
+3 -15
View File
@@ -1,3 +1,6 @@
<%= f.error_messages %>
<%= f.hidden_field :parent_item_name %>
<p>
<%= f.label :name, "Name" %>
<%= f.text_field :name, :class => 'text' %>
@@ -14,11 +17,6 @@
<%= f.text_field :title_zh_tw, :class => 'text' %>
</p>
<p>
<%= f.label :parent_page_name, "Parent Page Name" %>
<%= f.text_field :parent_page_name, :class => 'text' %>
</p>
<p>
<%= f.label :layout_name, "Layout Name" %>
<%= f.text_field :layout_name, :class => 'text' %>
@@ -40,16 +38,6 @@
<%= f.label :is_published, "Is Published" %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
<p>
<%= f.label :component_name, "Component Name" %>
<%= f.text_field :component_name %>
</p>
<p>
<%= f.label :external_link, "External Link" %>
<%= f.text_field :external_link %>
</p>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
+2 -5
View File
@@ -1,13 +1,10 @@
<h1>Editing pages</h1>
<% form_for @page, :url => admin_page_path(@page) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Back', admin_pages_path %>
<% end %>
-38
View File
@@ -1,38 +0,0 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to 'New pages', new_admin_page_path, :class => 'button positive' %></li>
<li><%= link_to 'New component entry', '#' %>
<li><%= link_to 'New root menu snippets', new_admin_snippet_path( :menu => 'root' ), :class => 'button positive' %></li>
</ul>
<% end -%>
<h1>Listing pages: <%= params[:parent] || "root" %></h1>
<table>
<tr>
<th>Name</th>
<th>Title</th>
<th>Layout</th>
<th>Position</th>
<th>Published?</th>
<th>Action</th>
</tr>
<% @pages.each do |page| %>
<tr>
<td><%= link_to page.name, admin_pages_path(:parent => page.name) %></td>
<td><%=h page.title %>
<td><%= page.layout_name %></th>
<td><%= page.position %></td>
<td><%= page.is_published.to_s %></td>
<td>
<%= link_to t(:show), page_path(page.name) %> |
<%= link_to t(:edit), edit_admin_page_path(page) %> |
<%= link_to t(:add_chile_page, :scope => :admin), new_admin_page_path( :parent_page_name => page.name ) %> |
<%= link_to t(:delete), admin_page_path(page), :confirm => 'Are you sure?', :method => :delete %>
</td>
</tr>
<% end %>
</table>
+1 -5
View File
@@ -1,9 +1,7 @@
<h1>New pages</h1>
<% form_for :page, :url => admin_pages_path do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :parent_page_name %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
@@ -11,5 +9,3 @@
</p>
<% end %>
<%= link_to 'Back', admin_pages_path %>
+3
View File
@@ -1,3 +1,6 @@
<%= f.error_messages %>
<%= f.hidden_field :parent_item_name %>
<p>
<%= f.label :name, "Name" %>
<%= f.text_field :name, :class => 'text' %>
+1 -3
View File
@@ -8,6 +8,4 @@
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Back', admin_snippets_path %>
<% end %>
-18
View File
@@ -1,18 +0,0 @@
<h1>Listing snippets</h1>
<table>
<tr>
</tr>
<% @snippets.each do |snippet| %>
<tr>
<td><%= snippet.name %></td>
<td><%= link_to 'Edit', edit_admin_snippet_path(snippet) %></td>
<td><%= link_to 'Destroy', admin_snippet_path(snippet), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New snippets', new_admin_snippet_path, :class => 'button positive' %>
+1 -3
View File
@@ -8,6 +8,4 @@
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
<%= link_to 'Back', admin_snippets_path %>
<% end %>
-3
View File
@@ -1,3 +0,0 @@
<%= link_to 'Edit', edit_announcement_path(@announcement) %> |
<%= link_to 'Back', announcements_path %>
+1 -2
View File
@@ -20,8 +20,7 @@
<ul id="nav">
<li><%= link_to t(:home, :scope => :admin), root_path %></li>
<li><%= link_to t(:page, :scope => :admin), admin_pages_path %></li>
<li><%= link_to t(:snippet, :scope => :admin), admin_snippets_path %></li>
<li><%= link_to t(:item, :scope => :admin), admin_items_path %></li>
<li><%= link_to t(:layout, :scope => :admin), admin_layouts_path %></li>
<li><%= link_to t(:announcement, :scope => :admin), panel_announcements_path( :entry_name => 'news' ) %></li>
</ul>