Remove useless controller and view
user_attributes_controller and user_attributes views
This commit is contained in:
parent
b77282c643
commit
e0cdedfa2e
|
@ -1,10 +0,0 @@
|
|||
var new_one = $('fieldset #new_one').clone();
|
||||
$('fieldset #new_one').remove();
|
||||
|
||||
$('fieldset a.remove').live( "click", function(){
|
||||
$(this).parent().remove();
|
||||
});
|
||||
|
||||
$('fieldset a.add').click(function(){
|
||||
new_one.clone().appendTo( $('fieldset') );
|
||||
})
|
|
@ -1,43 +0,0 @@
|
|||
class Admin::UserAttributesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def index
|
||||
@user_attributes = UserAttribute.all
|
||||
end
|
||||
|
||||
def show
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@user_attribute = UserAttribute.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@user_attribute = UserAttribute.new(params[:user_attribute])
|
||||
@user_attribute.save
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def update
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
@user_attribute.update_attributes(params[:user_attribute])
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
@user_attribute.destroy
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
<p>
|
||||
<%= f.label :name %>
|
||||
<%= f.text_field :name %>
|
||||
</p>
|
||||
|
||||
<fieldset>
|
||||
<% @user_attribute.attrs.each_with_index do |attr, i| %>
|
||||
<p>
|
||||
<label><%= attr["key"] %></label>
|
||||
<%= hidden_field_tag "user_attribute[attrs][][key]", attr["key"] %>
|
||||
<%= text_field_tag "user_attribute[attrs][][name]", attr["name"] %>
|
||||
<%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field", "select"], attr["type"]) %>
|
||||
<a href="#" class="remove">(remove)</a>
|
||||
</p>
|
||||
<% end -%>
|
||||
|
||||
<p id="newone">
|
||||
<label>Key</label>
|
||||
<%= text_field_tag "user_attribute[attrs][][key]", "" %>
|
||||
<label>Name</label>
|
||||
<%= text_field_tag "user_attribute[attrs][][name]", "" %>
|
||||
<%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field"], "") %>
|
||||
<a href="#" class="remove">(remove)</a>
|
||||
</p>
|
||||
|
||||
<a href="#" class="add">(add)</a>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "user_attribute_form" %>
|
||||
<% end -%>
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
<h1>Editing user attribute: <%= @user_attribute.key %></h1>
|
||||
|
||||
<% form_for @user_attribute, :url => admin_user_attribute_path(@user_attribute) do |f| %>
|
||||
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
|
||||
<p>
|
||||
<%= f.submit %>
|
||||
</p>
|
||||
|
||||
<% end -%>
|
|
@ -1,23 +0,0 @@
|
|||
<h1>Listing user attributes</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>名稱</th>
|
||||
<th>Key</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @user_attributes.each do |user_attribute| %>
|
||||
<tr>
|
||||
<td><%= user_attribute.name %></td>
|
||||
<td><%= user_attribute.key %></td>
|
||||
<td><%= link_to t(:edit), edit_admin_user_attribute_path(user_attribute) %></td>
|
||||
<td><%= link_to t(:delete), admin_user_attribute_path(user_attribute), :confirm => 'Are you sure?', :method => :delete %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to t(:new_user_attribute, :scope => :admin), new_admin_user_attribute_path, :class => 'button positive' %>
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
<h1>New user attribute: <%= @user_attribute.key %></h1>
|
||||
|
||||
<% form_for @user_attribute, :url => admin_user_attributes_path do |f| %>
|
||||
|
||||
<p>
|
||||
<%= f.label :key, "Key" %>
|
||||
<%= f.text_field :key %>
|
||||
</p>
|
||||
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
|
||||
<p>
|
||||
<%= f.submit %>
|
||||
</p>
|
||||
|
||||
<% end -%>
|
Reference in New Issue