From cc7907f37a01f4a3c2be9123f2573d3cfa7f0319 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 22 Nov 2012 18:20:11 +0800 Subject: [PATCH] user roles starts --- .../admin/add_attribute_field.js.erb.bak} | 0 app/controllers/admin/roles_controller.rb | 5 +++-- app/views/admin/attributes/edit.html.erb | 4 ++-- .../infos/{_form.html.erb => _form.html.erb.bak} | 0 ...ield.html.erb => _attribute_field.html.erb.bak} | 0 .../roles/{_form.html.erb => _form.html.erb.bak} | 0 .../{_form_sub.html.erb => _form_sub.html.erb.bak} | 0 .../{_sub_role.html.erb => _sub_role.html.erb.bak} | 0 .../attribute_field}/_attribute_field.html.erb | 14 +++++++------- .../attribute_field}/_list_block.html.erb | 0 .../attribute_field}/_placeholder_block.html.erb | 0 config/mongoid.yml | 2 +- 12 files changed, 13 insertions(+), 12 deletions(-) rename app/{views/admin/infos/add_attribute_field.js.erb => assets/stylesheets/admin/add_attribute_field.js.erb.bak} (100%) rename app/views/admin/infos/{_form.html.erb => _form.html.erb.bak} (100%) rename app/views/admin/roles/{_attribute_field.html.erb => _attribute_field.html.erb.bak} (100%) rename app/views/admin/roles/{_form.html.erb => _form.html.erb.bak} (100%) rename app/views/admin/roles/{_form_sub.html.erb => _form_sub.html.erb.bak} (100%) rename app/views/admin/roles/{_sub_role.html.erb => _sub_role.html.erb.bak} (100%) rename app/views/{admin/infos => shared/attribute_field}/_attribute_field.html.erb (79%) rename app/views/{admin/infos => shared/attribute_field}/_list_block.html.erb (100%) rename app/views/{admin/infos => shared/attribute_field}/_placeholder_block.html.erb (100%) diff --git a/app/views/admin/infos/add_attribute_field.js.erb b/app/assets/stylesheets/admin/add_attribute_field.js.erb.bak similarity index 100% rename from app/views/admin/infos/add_attribute_field.js.erb rename to app/assets/stylesheets/admin/add_attribute_field.js.erb.bak diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index d02224a5..abae1ece 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -1,10 +1,11 @@ class Admin::RolesController < ApplicationController - layout "admin" + layout "new_admin" before_filter :authenticate_user! before_filter :is_admin? before_filter :set_attribute, :only => [:index, :show, :new, :edit] - + helper Admin::AttributeValuesViewHelper + def index @attributes = Role.all.entries render :template => 'admin/attributes/index' diff --git a/app/views/admin/attributes/edit.html.erb b/app/views/admin/attributes/edit.html.erb index 3ced1d2b..f74890dc 100644 --- a/app/views/admin/attributes/edit.html.erb +++ b/app/views/admin/attributes/edit.html.erb @@ -14,14 +14,14 @@ <% end %> - <%= render :partial=>"placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.item_name"),:field_name=>"info[title_translations]"}%> + <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.item_name"),:field_name=>"info[title_translations]"}%>

<%= t("admin.attributes")%>

- <%= render :partial=>"attribute_field",:collection=>@attribute.attribute_fields%> + <%= render :partial=>"shared/attribute_field/attribute_field",:collection=>@attribute.attribute_fields%>
diff --git a/app/views/admin/infos/_form.html.erb b/app/views/admin/infos/_form.html.erb.bak similarity index 100% rename from app/views/admin/infos/_form.html.erb rename to app/views/admin/infos/_form.html.erb.bak diff --git a/app/views/admin/roles/_attribute_field.html.erb b/app/views/admin/roles/_attribute_field.html.erb.bak similarity index 100% rename from app/views/admin/roles/_attribute_field.html.erb rename to app/views/admin/roles/_attribute_field.html.erb.bak diff --git a/app/views/admin/roles/_form.html.erb b/app/views/admin/roles/_form.html.erb.bak similarity index 100% rename from app/views/admin/roles/_form.html.erb rename to app/views/admin/roles/_form.html.erb.bak diff --git a/app/views/admin/roles/_form_sub.html.erb b/app/views/admin/roles/_form_sub.html.erb.bak similarity index 100% rename from app/views/admin/roles/_form_sub.html.erb rename to app/views/admin/roles/_form_sub.html.erb.bak diff --git a/app/views/admin/roles/_sub_role.html.erb b/app/views/admin/roles/_sub_role.html.erb.bak similarity index 100% rename from app/views/admin/roles/_sub_role.html.erb rename to app/views/admin/roles/_sub_role.html.erb.bak diff --git a/app/views/admin/infos/_attribute_field.html.erb b/app/views/shared/attribute_field/_attribute_field.html.erb similarity index 79% rename from app/views/admin/infos/_attribute_field.html.erb rename to app/views/shared/attribute_field/_attribute_field.html.erb index e5b2d0de..c18e0b9f 100644 --- a/app/views/admin/infos/_attribute_field.html.erb +++ b/app/views/shared/attribute_field/_attribute_field.html.erb @@ -13,7 +13,7 @@
- <%= render :partial=>"placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.name"),:field_name=>"info[attribute_fields][#{attribute_field_counter}][title_translations]"}%> + <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.name"),:field_name=>"info[attribute_fields][#{attribute_field_counter}][title_translations]"}%>
@@ -42,16 +42,16 @@
- <%= render :partial=> "placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeA][placeholder]"}%> + <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeA][placeholder]"}%> <% end %> <%= content_tag :div,:class=>show_type_panel(attribute_field,"typeB") do %> - <%= render :partial=> "placeholder_block",:locals=>{:label_ext=>t("admin.infos.initial"),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeB][initial]"}%> + <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t("admin.infos.initial"),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeB][initial]"}%> <% if attribute_field.self_defined_markup_options?%> - <%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][attribute][role][statuses]"} %> + <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][attribute][role][statuses]"} %> <%else #normal list%> - <%= render :partial=>"list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][typeB][option_list]"} %> + <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{attribute_field_counter}][typeB][option_list]"} %> <% end #of self_defined_markup_options?%> <% end %> @@ -95,10 +95,10 @@ - <%= render :partial=> "placeholder_block",:locals=>{:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %> + <%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %> <% end %> <%= content_tag :div,:class=>show_type_panel(attribute_field,"typeE") do%> - <%= render :partial=>"list_block",:locals=>{:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeE][option_list]",:values=>attribute_field["option_list"]}%> + <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"info[attribute_fields][#{attribute_field_counter}][typeE][option_list]",:values=>attribute_field["option_list"]}%> <% end %> <%= hidden_field "info[attribute_fields][#{attribute_field_counter}]","id",:value=>attribute_field.id%> diff --git a/app/views/admin/infos/_list_block.html.erb b/app/views/shared/attribute_field/_list_block.html.erb similarity index 100% rename from app/views/admin/infos/_list_block.html.erb rename to app/views/shared/attribute_field/_list_block.html.erb diff --git a/app/views/admin/infos/_placeholder_block.html.erb b/app/views/shared/attribute_field/_placeholder_block.html.erb similarity index 100% rename from app/views/admin/infos/_placeholder_block.html.erb rename to app/views/shared/attribute_field/_placeholder_block.html.erb diff --git a/config/mongoid.yml b/config/mongoid.yml index a809bc06..75c5ef80 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -2,7 +2,7 @@ defaults: &defaults host: localhost # slaves: # - host: slave1.local - port: 27017 + port: 37017 # - host: slave2.local # port: 27019