diff --git a/app/controllers/admin/user_attributes_controller.rb b/app/controllers/admin/user_attributes_controller.rb new file mode 100644 index 00000000..c7021c74 --- /dev/null +++ b/app/controllers/admin/user_attributes_controller.rb @@ -0,0 +1,43 @@ +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 diff --git a/app/helpers/admin/user_attributes_helper.rb b/app/helpers/admin/user_attributes_helper.rb new file mode 100644 index 00000000..c60beabb --- /dev/null +++ b/app/helpers/admin/user_attributes_helper.rb @@ -0,0 +1,2 @@ +module Admin::UserAttributesHelper +end diff --git a/app/views/admin/user_attributes/_form.html.erb b/app/views/admin/user_attributes/_form.html.erb new file mode 100644 index 00000000..05a03817 --- /dev/null +++ b/app/views/admin/user_attributes/_form.html.erb @@ -0,0 +1,43 @@ +
+ <%= f.label :name %> + <%= f.text_field :name %> +
+ + + +<% content_for :page_specific_javascript do %> + +<% end -%> \ No newline at end of file diff --git a/app/views/admin/user_attributes/edit.html.erb b/app/views/admin/user_attributes/edit.html.erb new file mode 100644 index 00000000..1bc86bc4 --- /dev/null +++ b/app/views/admin/user_attributes/edit.html.erb @@ -0,0 +1,12 @@ + ++ <%= f.submit %> +
+ +<% end -%> diff --git a/app/views/admin/user_attributes/index.html.erb b/app/views/admin/user_attributes/index.html.erb new file mode 100644 index 00000000..c9fe93b4 --- /dev/null +++ b/app/views/admin/user_attributes/index.html.erb @@ -0,0 +1,23 @@ +名稱 | +Key | ++ | + |
---|---|---|---|
<%= user_attribute.name %> | +<%= user_attribute.key %> | +<%= link_to t(:edit), edit_admin_user_attribute_path(user_attribute) %> | +<%= link_to t(:delete), admin_user_attribute_path(user_attribute), :confirm => 'Are you sure?', :method => :delete %> | +
+ <%= f.label :key, "Key" %> + <%= f.text_field :key %> +
+ + <%= render :partial => "form", :locals => { :f => f } %> + ++ <%= f.submit %> +
+ +<% end -%> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 54c76a1c..7770b6d4 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -24,6 +24,7 @@