user roles starts

This commit is contained in:
Matthew K. Fu JuYuan 2012-11-22 18:20:11 +08:00
parent 6dff83339a
commit cc7907f37a
12 changed files with 13 additions and 12 deletions

View File

@ -1,10 +1,11 @@
class Admin::RolesController < ApplicationController class Admin::RolesController < ApplicationController
layout "admin" layout "new_admin"
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :is_admin?
before_filter :set_attribute, :only => [:index, :show, :new, :edit] before_filter :set_attribute, :only => [:index, :show, :new, :edit]
helper Admin::AttributeValuesViewHelper
def index def index
@attributes = Role.all.entries @attributes = Role.all.entries
render :template => 'admin/attributes/index' render :template => 'admin/attributes/index'

View File

@ -14,14 +14,14 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<%= 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]"}%>
</div> </div>
</div> </div>
</div> </div>
<div class="map-block back attributes"> <div class="map-block back attributes">
<h4><span><%= t("admin.attributes")%></span></h4> <h4><span><%= t("admin.attributes")%></span></h4>
<%= render :partial=>"attribute_field",:collection=>@attribute.attribute_fields%> <%= render :partial=>"shared/attribute_field/attribute_field",:collection=>@attribute.attribute_fields%>
</div> </div>
</div> </div>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">

View File

@ -13,7 +13,7 @@
</div> </div>
</div> </div>
</div> </div>
<%= 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]"}%>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for=""><%= t("admin.infos.type")%></label> <label class="control-label" for=""><%= t("admin.infos.type")%></label>
<div class="controls"> <div class="controls">
@ -42,16 +42,16 @@
</label> </label>
</div> </div>
</div> </div>
<%= 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 %> <% end %>
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeB") do %> <%= 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?%> <% 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%> <%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 #of self_defined_markup_options?%>
<% end %> <% end %>
@ -95,10 +95,10 @@
</label> </label>
</div> </div>
</div> </div>
<%= 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 %> <% end %>
<%= content_tag :div,:class=>show_type_panel(attribute_field,"typeE") do%> <%= 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 %> <% end %>
</div> </div>
<%= hidden_field "info[attribute_fields][#{attribute_field_counter}]","id",:value=>attribute_field.id%> <%= hidden_field "info[attribute_fields][#{attribute_field_counter}]","id",:value=>attribute_field.id%>

View File

@ -2,7 +2,7 @@ defaults: &defaults
host: localhost host: localhost
# slaves: # slaves:
# - host: slave1.local # - host: slave1.local
port: 27017 port: 37017
# - host: slave2.local # - host: slave2.local
# port: 27019 # port: 27019