member role edit

This commit is contained in:
unknown 2013-01-14 18:19:14 +08:00 committed by chris
parent f589439870
commit 504f5027cc
16 changed files with 213 additions and 213 deletions

View File

@ -40,9 +40,10 @@ class Admin::InfosController < ApplicationController
@attribute.update_attributes(params[:info]) @attribute.update_attributes(params[:info])
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} @attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
respond_to do |format| respond_to do |format|
format.html { redirect_to :action => :index } format.html { redirect_to(edit_admin_info_path(params[:id])) }
format.js { render 'admin/attributes/toggle_enable' } format.js { render 'admin/attributes/toggle_enable' }
end end
end end
def destroy def destroy

View File

@ -8,6 +8,8 @@ class Attribute
field :disabled, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false
field :title, localize: true field :title, localize: true
field :to_search, :type => Boolean, :default => false
has_many :attribute_fields, :autosave => true, :dependent => :destroy has_many :attribute_fields, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true accepts_nested_attributes_for :attribute_fields, :allow_destroy => true

View File

@ -7,8 +7,6 @@ class Role < Attribute
field :built_in, :type => Boolean, :default => false field :built_in, :type => Boolean, :default => false
field :disabled, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false
field :to_search, :type => Boolean, :default => false
field :title, localize: true field :title, localize: true
has_many :sub_roles, :autosave => true, :dependent => :destroy has_many :sub_roles, :autosave => true, :dependent => :destroy

View File

@ -72,14 +72,32 @@ class User
sub_roles.where(role_id: role.id) sub_roles.where(role_id: role.id)
end end
def disable_sub_role=(var) def disable_role=(var)
var[:id].each do |id,val| var[:id].each do |id,val|
# binding.pry if id == '5052c5b22b5c49ab02000004' # binding.pry if id == '5052c5b22b5c49ab02000004'
if (val=="true") if (val=="true")
self.roles = self.roles.reject{|t| t.id.to_s==id}
elsif(val=="false")
self.roles << Role.find(id)
end
end
end
def disable_sub_role=(var)
var[:id].each do |id,val|
@sr = SubRole.find(id)
@roid = Role.find(@sr.role_id.to_s)
# binding.pry if id == '5052c5b22b5c49ab02000004'
if ( self.roles.include?(@roid) == false or val=="true")
self.sub_roles = self.sub_roles.reject{|t| t.id.to_s==id} self.sub_roles = self.sub_roles.reject{|t| t.id.to_s==id}
elsif(val=="false") elsif(val=="false")
self.sub_roles << SubRole.find(id) self.sub_roles << SubRole.find(id)
end end
end end
end end
@ -189,7 +207,8 @@ class User
protected protected
def save_roles def save_roles
self.roles = self.sub_roles.collect{|t| t.role}.uniq # self.roles = self.sub_roles.collect{|t| t.role}.uniq
self.roles = self.roles.uniq
end end

View File

@ -8,7 +8,7 @@
<h4><span><%= t(eval(":#{@attribute_type}"))%></span></h4> <h4><span><%= t(eval(":#{@attribute_type}"))%></span></h4>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="clear"> <div class="clear">
<% if @attribute._type == "Role" %>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:to_search) %></label> <label class="control-label" for="key"><%= t(:to_search) %></label>
<div class="controls"> <div class="controls">
@ -22,7 +22,6 @@
</label> </label>
</div> </div>
</div> </div>
<% end %>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:key) %></label> <label class="control-label" for="key"><%= t(:key) %></label>
@ -47,11 +46,14 @@
</div> </div>
</div> </div>
<div class="add-attributes form-actions pagination-right">
<%= ( link_to content_tag(:i,t(:add_attribute_field),:class=>"icon-plus icon-white"),admin_info_add_attribute_field_path(@attribute),:class=>"btn btn-primary",:remote => true )%>
</div>
<% end %> <% end %>
</div> </div>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">
<%= ( link_to content_tag(:i,t(:add_attribute_field),:class=>"icon-plus icon-white"),admin_info_add_attribute_field_path(@attribute),:class=>"btn btn-primary",:remote => true ) if @attribute._type == "Info"%>
<%= f.submit t(:save),:class=>"btn btn-primary"%> <%= f.submit t(:save),:class=>"btn btn-primary"%>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %> <%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div> </div>
@ -63,15 +65,11 @@
<% content_for :page_specific_javascript do -%> <% content_for :page_specific_javascript do -%>
<script> <script>
var CloneTarget ;
var NewNode;
$(document).ready(function(){ $(document).ready(function(){
// function mas(){
// $('.site-map').masonry({
// itemSelector: '.map-block',
// columnWidth: 450,
// isAnimated: true
// });
// }
function checkSwitch() { function checkSwitch() {
$(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled'); $(".groups").addClass('disabled').has('.groups > .form-horizontal > div:not(.hide)').removeClass('disabled');
} }
@ -80,110 +78,41 @@
$(this).find('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural") $(this).find('.controls').length==1 ? $(this).addClass("plural") : $(this).removeClass("plural")
}); });
} }
function removeInput() { function removeInput(){
$(".removeInput").click(function (){ $(".removeInput").live('click',function (){
$(this).parents(".controls").remove(); $(this).parents(".controls").remove();
checkMultipleInput(); checkMultipleInput();
return false; return false;
}); });
} }
function DataType() {
$(".dataType").each(function (i) {
$(this).change(function () {
$("option:selected").eq(i).each(function () {
if($(this).attr("ref")=="typeA") {
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
$(this).parents("legend").next("div").find(".typeA").removeClass("hide");
$(this).parents("legend").next("div").addClass("bottomLine");
}
if($(this).attr("ref")=="typeB") {
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
$(this).parents("legend").next("div").find(".typeB").removeClass("hide");
$(this).parents("legend").next("div").addClass("bottomLine");
}
if($(this).attr("ref")=="typeC") {
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
$(this).parents("legend").next("div").find(".typeC").removeClass("hide");
$(this).parents("legend").next("div").addClass("bottomLine");
}
if($(this).attr("ref")=="typeD") {
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
$(this).parents("legend").next("div").find(".typeD").removeClass("hide");
$(this).parents("legend").next("div").addClass("bottomLine");
}
if($(this).attr("ref")=="typeE") {
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
$(this).parents("legend").next("div").find(".typeE").removeClass("hide");
$(this).parents("legend").next("div").addClass("bottomLine");
}
if($(this).attr("ref")=="nothing"||$(this).attr("ref")=="typeF") {
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
$(this).parents("legend").next("div").removeClass("bottomLine");
}
});
})
});
}
function onOff() {
$(".form-horizontal:last").delegate(".onoff","click",function(){
$(this).parent("legend").parent(".form-horizontal").toggleClass("disabled");
$(this).toggleClass("disabled");
$(this).parents("legend").next("div").toggleClass("disabled");
$(this).parents("legend").next("div").find(".help-block").toggleClass("hide");
if($(this).parents("legend").next("div").hasClass("disabled")){
$(this).text("OFF");
$(this).parents("legend").find("input, select, textarea").attr({disabled:''});
$(this).parents("legend").next("div").find("input, select, textarea").attr({disabled:''});
}else{
$(this).text("ON");
$(this).parents("legend").find("input, select, textarea").removeAttr("disabled");
$(this).parents("legend").next("div").find("input, select, textarea").removeAttr("disabled");
}
checkSwitch(); checkSwitch();
return!1 checkMultipleInput();
removeInput();
$(".remove_attribute").live('click',function(){
$(this).siblings(".attribute_field_to_delete").val("true");
$(this).parents(".form-horizontal").fadeOut("slow", function () { $(this).hide(); });
}); });
// $('.onoff').click(function () {
// // if($(this).parents("h4").length==1) { $(".help-block a").live('click',function (){
// // $(this).parents(".map-block").toggleClass("disabled"); CloneTarget = $(this).parents(".controls").prev(".multipleInput").find('.controls:last');
// // $(this).parents(".map-block").find(".form-horizontal").toggleClass("hide"); NewNode = CloneTarget.clone();
// // if($(this).parents(".map-block").hasClass("disabled")){ var index;
// // $(this).text("OFF"); NewNode.find("input").each(function(k,v){
// // }else{ index = CloneTarget.parents("div.control-group").find(".list_count").val()
// // $(this).text("ON"); field_name = CloneTarget.parents("div.control-group").find(".field_name").val()
// // } ori_str = $(v).attr("name").replace(field_name,"");
// // } lang = ori_str.match(/\[\D*\]/);
// // if($(this).parents("legend").length==1) { new_field_name = (field_name+"[" + (parseInt(index)+1) + "]" + lang);
// $(this).toggleClass("disabled"); $(v).attr("name",new_field_name);
// $(this).parents("legend").next("div").toggleClass("disabled"); })
// if($(this).parents("legend").next("div").hasClass("disabled")){
// $(this).text("OFF"); $(this).parents("div.control-group").find(".list_count").val(parseInt(index)+1)
// $(this).parents("legend").find("input, select, textarea").attr({disabled:''}); $(this).parents(".controls").prev(".multipleInput").append(NewNode);
// $(this).parents("legend").next("div").find("input, select, textarea").attr({disabled:''});
// }else{
// $(this).text("ON");
// $(this).parents("legend").find("input, select, textarea").removeAttr("disabled");
// $(this).parents("legend").next("div").find("input, select, textarea").removeAttr("disabled");
// }
// checkSwitch();
// // }
// return false;
// });
}
function CloneDataType() {
$(".help-block a").click(function (){
var $CloneTarget = $(this).parents(".controls").prev(".multipleInput").find('.controls:last');
$(this).parents(".controls").prev(".multipleInput").append($CloneTarget.clone());
$(this).parents(".controls").prev(".multipleInput").find('.controls:last input').val(""); $(this).parents(".controls").prev(".multipleInput").find('.controls:last input').val("");
removeInput(); removeInput();
checkMultipleInput(); checkMultipleInput();
return false; return false;
}) })
}
checkSwitch();
checkMultipleInput();
removeInput();
DataType();
CloneDataType();
$(".status select").each(function (i) { $(".status select").each(function (i) {
$(this).change(function () { $(this).change(function () {
$(".status option:selected").eq(i).each(function () { $(".status option:selected").eq(i).each(function () {
@ -196,39 +125,34 @@
} }
}); });
}) })
}); })
$(".form-horizontal").delegate(".onoff","click",function(){ $('.onoff').live('click',function () {
$(this).toggleClass("disabled"); if($(this).parents("h4").length==1) {
$(this).parent("legend").parent(".form-horizontal").toggleClass("disabled"); $(this).parents(".map-block").toggleClass("disabled");
$(this).parents("legend").next("div").toggleClass("disabled"); $(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
$(this).parents("legend").next("div").find(".help-block").toggleClass("hide"); if($(this).parents(".map-block").hasClass("disabled")){
if($(this).parents("legend").next("div").hasClass("disabled")){
$(this).text("OFF"); $(this).text("OFF");
$(this).parents("legend").find("input, select, textarea").attr({disabled:''});
$(this).parents("legend").next("div").find("input, select, textarea").attr({disabled:''});
}else{ }else{
$(this).text("ON"); $(this).text("ON");
$(this).parents("legend").find("input, select, textarea").removeAttr("disabled"); }
$(this).parents("legend").next("div").find("input, select, textarea").removeAttr("disabled"); }
if($(this).parents("legend").length==1) {
$(this).toggleClass("disabled");
$(this).parents("legend").next("div").toggleClass("hide");
if($(this).parents("legend").next("div").hasClass("hide")){
$(this).text("OFF");
$(this).siblings(".attribute_field_disabled").val("true");
}else{
$(this).text("ON");
$(this).siblings(".attribute_field_disabled").val("false");
} }
checkSwitch(); checkSwitch();
return!1
});
$(".add-attributes a").click(function (){
var $CloneTarget = $(this).parents(".attributes").find('.form-horizontal:last');
$(".cistern").append($CloneTarget.clone());
$('.form-horizontal:last input, .form-horizontal:last select, .form-horizontal:last textarea').val("");
$('.form-horizontal:last input, .form-horizontal:last select, .form-horizontal:last textarea').removeAttr("disabled");
$('.form-horizontal:last').find("legend").next("div").find("div[class^='type']").addClass("hide");
if($('.form-horizontal:last').find("legend").next("div").hasClass("disabled")) {
$('.form-horizontal:last').find("legend>button").removeClass("disabled");
$('.form-horizontal:last').find("legend>button").text("ON");
$('.form-horizontal:last').find("legend").next("div").removeClass("disabled");
} }
DataType();
onOff();
CloneDataType();
return false; return false;
});
$(".dataType").change(function () {
$(this).parents("legend").next("div").find("div[class^='type']").addClass("hide");
$(this).parents("legend").next("div").find("."+$(this).find("option:selected").attr("ref")).removeClass("hide");
}) })
}); });
</script> </script>

View File

@ -1,5 +1,3 @@
<% # encoding: utf-8 %>
<% content_for :side_bar do %> <% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %> <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %> <% end %>
@ -56,17 +54,5 @@
</table> </table>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i,t("new.#{@attribute_type}"),:class=>"icon-plus icon-white"),eval("new_admin_#{@attribute_type}_path"),:class=>"btn btn-primary pull-right"%> <%= link_to content_tag(:i,t("new.#{@attribute_type}"),:class=>"icon-plus icon-white"),eval("new_admin_#{@attribute_type}_path"),:class=>"btn btn-primary pull-right"%>
<div class="paginationFixed">
<div class="pagination">
<ul>
<li><a href="#">Prev</a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">Next</a></li>
</ul>
</div>
</div>
</div> </div>

View File

@ -5,7 +5,6 @@
<div class="form-horizontal"> <div class="form-horizontal">
<div class="clear"> <div class="clear">
<% if @attribute._type == "Role" %>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:to_search) %></label> <label class="control-label" for="key"><%= t(:to_search) %></label>
<div class="controls"> <div class="controls">
@ -19,7 +18,6 @@
</label> </label>
</div> </div>
</div> </div>
<% end %>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:key) %></label> <label class="control-label" for="key"><%= t(:key) %></label>

View File

@ -2,13 +2,13 @@
<% <%
attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter
%> %>
<%= @af_counter %> <%= @af_counter + 1 %>
<%#= attribute_field_counter %> <%#= attribute_field_counter %>
<legend> <legend>
<button class="onoff pull-right <%= attribute_field.disabled ? 'disabled' : ''%>"><%= attribute_field.disabled ? 'OFF' : 'ON'%></button> <button class="onoff pull-right <%= attribute_field.disabled ? 'disabled' : ''%>"><%= attribute_field.disabled ? 'OFF' : 'ON'%></button>
<%= hidden_field "#{@field_name}[attribute_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"attribute_field_disabled"%> <%= hidden_field "#{@field_name}[attribute_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"attribute_field_disabled"%>
<%= hidden_field "#{@field_name}[attribute_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%> <%= hidden_field "#{@field_name}[attribute_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%>
<a class="btn btn-small pull-right btn-danger remove_attribute" href="#"><i class="icon-trash icon-large"></i> <%= t(:delete_)%></a> <a class="btn btn-small pull-right btn-danger remove_attribute"><i class="icon-trash icon-large"></i> <%= t(:delete_)%></a>
<div class="clear"> <div class="clear">
<div class="control-group"> <div class="control-group">
<label class="control-label" for="key"><%= t(:to_search) %></label> <label class="control-label" for="key"><%= t(:to_search) %></label>

View File

@ -4,6 +4,21 @@
<h4><span><%= t(eval(":#{@attribute_type}"))%>:<%= @attribute.title %></span></h4> <h4><span><%= t(eval(":#{@attribute_type}"))%>:<%= @attribute.title %></span></h4>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="clear"> <div class="clear">
<div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:to_search) %></label>
<div class="controls">
<label class="radio inline">
<%= f.radio_button :to_search, true %>
Yes
</label>
<label class="radio inline">
<%= f.radio_button :to_search, false %>
No
</label>
</div>
</div>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:key) %></label> <label class="control-label" for="key"><%= t(:key) %></label>
<div class="controls"> <div class="controls">

View File

@ -4,6 +4,21 @@
<h4><span><%= t(eval(":#{@attribute_type}"))%>:<%= @attribute.title %></span></h4> <h4><span><%= t(eval(":#{@attribute_type}"))%>:<%= @attribute.title %></span></h4>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="clear"> <div class="clear">
<div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:to_search) %></label>
<div class="controls">
<label class="radio inline">
<%= f.radio_button :to_search, true %>
Yes
</label>
<label class="radio inline">
<%= f.radio_button :to_search, false %>
No
</label>
</div>
</div>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:key) %></label> <label class="control-label" for="key"><%= t(:key) %></label>
<div class="controls"> <div class="controls">

View File

@ -1,41 +1,60 @@
<% # encoding: utf-8 %>
<% content_for :side_bar do %> <% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %> <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %> <% end %>
<div class="main_list">
<div class="button_bar up"> <div class="subnav">
<%= link_to t(:new_sub_role), eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"), :class => 'new' %> <ul class="breadcrumb">
<li><%= link_to( t("#{@attribute_type}"), admin_roles_path ) %> <span class="divider">/</span></li>
<li class="active"><%= @attribute.title %></li>
</ul>
<div id="accordion">
<div class="accordion-group filters">
<div class="table-label">
<table class="table main-list">
<thead>
<tr class="sort-header">
<th id="sort-name" class="sort span1-2 select active"><span><a href="#">Name<b class="web-symbol"></b></a></span></th>
</tr>
</thead>
</table>
</div> </div>
<table> </div>
</div>
</div>
<table class="table main-list member-list">
<thead> <thead>
<tr> <tr>
<td class="<%= @attribute_type %>s"><%= t("#{@attribute_type}") %>:<%= @attribute.title %></td> <th class="span1-2"></th>
<td class="action"><%= t(:action) %></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @attribute_fields_upper_object.each do |attribute| %>
<tr id="attribute_<%= attribute.id %>" class="have <%= "#{attribute.is_disabled? ? 'disable' : ''}" %>">
<td class="<%= @attribute_type %>s <%= attribute.key.downcase %>"><%= attribute.title %></span>
<td class="action">
<%= link_to t(:edit), eval("admin_#{@attribute_type}_edit_sub_role_path(attribute)"), :class => 'edit' %> <% @attribute_fields_upper_object.each do |attribute| %>
<%= link_to t(:sub_role_field), eval("admin_#{@attribute_type}_sub_role_field_path(attribute)"), :class => 'edit' %> <tr class="with_action">
<%= link_to t(:enable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :sub_role => {:disabled => true, :id => attribute })"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' %> <td class="span1-2">
<%= link_to t(:disable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :sub_role => {:disabled => false, :id => attribute })"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' %> <%= attribute.title %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t(:edit), eval("admin_#{@attribute_type}_edit_sub_role_path(attribute)") %></li>
<li><%= link_to t(:sub_role_field), eval("admin_#{@attribute_type}_sub_role_field_path(attribute)"), :class => 'edit' %></li>
<li><%= link_to t(:enable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :sub_role => {:disabled => true, :id => attribute })"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' %></li>
<li><%= link_to t(:disable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :sub_role => {:disabled => false, :id => attribute })"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' %></li>
<% if !attribute.is_built_in? %> <% if !attribute.is_built_in? %>
<%= link_to t(:delete_), eval("admin_#{@attribute_type}_path(attribute, :sub_role => {:id => attribute })"), :class => 'delete', :confirm => t('sure?'), :method => :delete %> <li><%= link_to t(:delete_), eval("admin_#{@attribute_type}_path(attribute, :sub_role => {:id => attribute })"), :class => 'delete', :confirm => t('sure?'), :method => :delete %></li>
<% end %> <% end %>
</ul>
</div>
</td> </td>
</tr> </tr>
<tr>
<td colspan="5"></td>
</tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<div class="button_bar">
<%= link_to t(:new_sub_role), eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"), :class => 'new' %> <div class="form-actions form-fixed pagination-right">
</div> <%= link_to content_tag(:i,t(:new_sub_role),:class=>"icon-plus icon-white"),eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"),:class=>"btn btn-primary pull-right"%>
</div> </div>

View File

@ -12,10 +12,13 @@
</div> </div>
</div> </div>
<div class="add-attributes form-actions pagination-right">
<%= link_to content_tag(:i,t(:add_attribute_field),:class=>"icon-plus icon-white"),admin_role_add_attribute_field_path(@sub_attribute, :sub_role => {:id => @sub_attribute }),:class=>"btn btn-primary",:remote => true%>
</div>
</div> </div>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i,t(:add_attribute_field),:class=>"icon-plus icon-white"),admin_role_add_attribute_field_path(@sub_attribute, :sub_role => {:id => @sub_attribute }),:class=>"btn btn-primary",:remote => true%>
<%#= f.hidden_field :id, :value => params[:role_id] if !params[:role_id].blank? %> <%#= f.hidden_field :id, :value => params[:role_id] if !params[:role_id].blank? %>
<%= hidden_field_tag 'sub_role[id]', params[:role_id] if !params[:role_id].blank? %> <%= hidden_field_tag 'sub_role[id]', params[:role_id] if !params[:role_id].blank? %>
<%= f.submit t(:save),:class=>"btn btn-primary"%> <%= f.submit t(:save),:class=>"btn btn-primary"%>

View File

@ -1,7 +1,14 @@
<div class="groups map-block back">
<h4><span><%= role.title %></span></h4>
<div class="form-horizontal">
<% role_disable = @user.roles.include?(role) ? false : true %>
<div class="groups map-block back <%= role_disable ? 'disabled' : '' %>">
<h4>
<button for=<%=@form_index%> class="onoff pull-right"><%= role_disable ? 'OFF' : 'ON' %></button><span><%= role.title %></span>
<%= hidden_field_tag("user[disable_role][id][#{role.id}]",role_disable,:for=>@form_index,:class=>"subrole_disable_field",:value=>role_disable)%>
</h4>
<div class="form-horizontal <%= role_disable ? 'hide' : '' %>">
<% role.attribute_fields.each do |rf|%> <% role.attribute_fields.each do |rf|%>
@ -10,6 +17,8 @@
<% end %> <% end %>
<% @form_index = @form_index +1 %>
<% role.sub_roles.where(:disabled=>false).each do |sub_role| %> <% role.sub_roles.where(:disabled=>false).each do |sub_role| %>
<% sub_role_disable = @user.sub_roles.include?(sub_role) ? false : true %> <% sub_role_disable = @user.sub_roles.include?(sub_role) ? false : true %>
<%# sub_role_disable = !sub_role.disabled ? false : true %> <%# sub_role_disable = !sub_role.disabled ? false : true %>

View File

@ -4,7 +4,7 @@
<%= content_tag :li, link_to((t(:all_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, admin_users_new_interface_index_path), :class => active_for_action('users_new_interface', 'index') %> <%= content_tag :li, link_to((t(:all_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, admin_users_new_interface_index_path), :class => active_for_action('users_new_interface', 'index') %>
<%= content_tag :li, link_to((t(:add_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t(:add_member) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((t(:roles) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_roles_path ), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t(:roles) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_roles_path ), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((t(:info) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, edit_admin_info_path('4f45f3b9e9d02c5db900002c')), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t(:info) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((t(:authorigation) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t(:authorigation) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((t(:registrant) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((t(:registrant) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
<% end -%> <% end -%>

View File

@ -2,14 +2,25 @@
<% <%
attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter
%> %>
<%= @af_counter %> <%= @af_counter + 1 %>
<%#= attribute_field_counter %> <%#= attribute_field_counter %>
<legend> <legend>
<button class="onoff pull-right <%= attribute_field.disabled ? 'disabled' : ''%>">ON</button> <button class="onoff pull-right <%= attribute_field.disabled ? 'disabled' : ''%>">ON</button>
<%= hidden_field "info[attribute_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"attribute_field_disabled"%> <%= hidden_field "info[attribute_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"attribute_field_disabled"%>
<%= hidden_field "info[attribute_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%> <%= hidden_field "info[attribute_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%>
<a class="btn btn-small pull-right btn-danger remove_attribute" href="#"><i class="icon-trash icon-large"></i> <%= t(:delete_)%></a> <a class="btn btn-small pull-right btn-danger remove_attribute"><i class="icon-trash icon-large"></i> <%= t(:delete_)%></a>
<div class="clear"> <div class="clear">
<div class="control-group">
<label class="control-label" for="key"><%= t(:to_search) %></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("info[attribute_fields][#{@af_counter}]", "to_search", "true",:checked => (attribute_field.to_search == true ? true : false)) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("info[attribute_fields][#{@af_counter}]", "to_search", "false",:checked => (attribute_field.to_search == false ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
<div class="control-group pull-left"> <div class="control-group pull-left">
<label class="control-label" for="key"><%= t(:key) %></label> <label class="control-label" for="key"><%= t(:key) %></label>
<div class="multipleInput"> <div class="multipleInput">

View File

@ -1,13 +1,13 @@
module Announcement # module Announcement
OrbitApp.registration "Announcement",:type=> 'ModuleApp' do # OrbitApp.registration "Announcement",:type=> 'ModuleApp' do
base_url File.expand_path File.dirname(__FILE__) # base_url File.expand_path File.dirname(__FILE__)
personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile" # personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile"
end # end
end # end
# OrbitApp.backend_side_bar 'News' do # OrbitApp.backend_side_bar 'News' do