member role edit
This commit is contained in:
		
							parent
							
								
									9c8bf1ffab
								
							
						
					
					
						commit
						6a5c1d9007
					
				|  | @ -40,9 +40,10 @@ class Admin::InfosController < ApplicationController | |||
|     @attribute.update_attributes(params[:info]) | ||||
|     @attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} | ||||
|     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' } | ||||
|     end | ||||
| 	   | ||||
|   end | ||||
|    | ||||
|   def destroy | ||||
|  |  | |||
|  | @ -6,7 +6,9 @@ class Attribute | |||
|   field :key | ||||
|   field :built_in, :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 | ||||
|   accepts_nested_attributes_for :attribute_fields, :allow_destroy => true | ||||
|  |  | |||
|  | @ -7,8 +7,6 @@ class Role < Attribute | |||
|   field :built_in, :type => Boolean, :default => false | ||||
|   field :disabled, :type => Boolean, :default => false | ||||
|    | ||||
|   field :to_search, :type => Boolean, :default => false | ||||
|    | ||||
|   field :title, localize: true | ||||
|    | ||||
|   has_many :sub_roles, :autosave => true, :dependent => :destroy | ||||
|  |  | |||
|  | @ -72,14 +72,32 @@ class User | |||
|     sub_roles.where(role_id: role.id) | ||||
|   end | ||||
| 
 | ||||
|   def disable_sub_role=(var) | ||||
|   def disable_role=(var) | ||||
|     var[:id].each do |id,val|   | ||||
|       # binding.pry if id == '5052c5b22b5c49ab02000004' | ||||
|       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} | ||||
|       elsif(val=="false") | ||||
|         self.sub_roles << SubRole.find(id) | ||||
|       end | ||||
| 	   | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|  | @ -189,7 +207,8 @@ class User | |||
|    | ||||
|   protected | ||||
|     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 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
|                     <h4><span><%= t(eval(":#{@attribute_type}"))%></span></h4> | ||||
|                                         <div class="form-horizontal"> | ||||
|                         <div class="clear"> | ||||
| 							<% if @attribute._type == "Role" %> | ||||
| 						 | ||||
|                             <div class="control-group pull-left"> | ||||
|                                 <label class="control-label" for="key"><%= t(:to_search) %></label> | ||||
|                                 <div class="controls"> | ||||
|  | @ -22,7 +22,6 @@ | |||
| 									</label>  | ||||
|                                 </div> | ||||
|                             </div> | ||||
| 							<% end %> | ||||
| 							 | ||||
|                             <div class="control-group pull-left"> | ||||
|                                 <label class="control-label" for="key"><%= t(:key) %></label> | ||||
|  | @ -47,11 +46,14 @@ | |||
| 							</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 %> | ||||
| 						 | ||||
|                     </div> | ||||
|             <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"%> | ||||
| 				<%= link_to t('cancel'), get_go_back, :class=>"btn" %>	                 | ||||
|             </div> | ||||
|  | @ -63,15 +65,11 @@ | |||
| 
 | ||||
| <% content_for :page_specific_javascript do -%> | ||||
|     <script>      | ||||
|                 var CloneTarget ; | ||||
| 
 | ||||
| 		$(document).ready(function(){ | ||||
|             // function mas(){ | ||||
|             //     $('.site-map').masonry({ | ||||
|             //         itemSelector: '.map-block', | ||||
|             //         columnWidth: 450, | ||||
|             //         isAnimated: true | ||||
|             //     }); | ||||
|             // } | ||||
|                 var NewNode; | ||||
|                  | ||||
|         $(document).ready(function(){ | ||||
|             function checkSwitch() { | ||||
|                 $(".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") | ||||
|                 }); | ||||
|             } | ||||
|             function removeInput() { | ||||
|                 $(".removeInput").click(function (){ | ||||
|             function removeInput(){ | ||||
|                 $(".removeInput").live('click',function (){ | ||||
|                     $(this).parents(".controls").remove(); | ||||
|                     checkMultipleInput(); | ||||
|                     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(); | ||||
|                     return!1 | ||||
|                 }); | ||||
|                 // $('.onoff').click(function () { | ||||
|                 //     // if($(this).parents("h4").length==1) { | ||||
|                 //     //     $(this).parents(".map-block").toggleClass("disabled"); | ||||
|                 //     //     $(this).parents(".map-block").find(".form-horizontal").toggleClass("hide"); | ||||
|                 //     //     if($(this).parents(".map-block").hasClass("disabled")){ | ||||
|                 //     //         $(this).text("OFF"); | ||||
|                 //     //     }else{ | ||||
|                 //     //         $(this).text("ON"); | ||||
|                 //     //     } | ||||
|                 //     // } | ||||
|                 //     // if($(this).parents("legend").length==1) { | ||||
|                 //         $(this).toggleClass("disabled"); | ||||
|                 //         $(this).parents("legend").next("div").toggleClass("disabled"); | ||||
|                 //         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(); | ||||
|                 //     // } | ||||
|                 //    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(""); | ||||
|                     removeInput(); | ||||
|                     checkMultipleInput(); | ||||
|                     return false; | ||||
|                 }) | ||||
|             } | ||||
|             checkSwitch(); | ||||
|             checkMultipleInput(); | ||||
|             removeInput(); | ||||
|             DataType(); | ||||
|             CloneDataType(); | ||||
|             $(".remove_attribute").live('click',function(){ | ||||
|                 $(this).siblings(".attribute_field_to_delete").val("true"); | ||||
|                 $(this).parents(".form-horizontal").fadeOut("slow", function () { $(this).hide(); }); | ||||
|             }); | ||||
| 
 | ||||
|             $(".help-block a").live('click',function (){ | ||||
|                 CloneTarget = $(this).parents(".controls").prev(".multipleInput").find('.controls:last'); | ||||
|                 NewNode = CloneTarget.clone(); | ||||
|                 var index; | ||||
|                 NewNode.find("input").each(function(k,v){  | ||||
|                   index = CloneTarget.parents("div.control-group").find(".list_count").val() | ||||
|                   field_name = CloneTarget.parents("div.control-group").find(".field_name").val() | ||||
|                   ori_str = $(v).attr("name").replace(field_name,""); | ||||
|                   lang = ori_str.match(/\[\D*\]/); | ||||
|                   new_field_name = (field_name+"[" + (parseInt(index)+1) + "]" + lang); | ||||
|                   $(v).attr("name",new_field_name); | ||||
|                   }) | ||||
| 
 | ||||
|                 $(this).parents("div.control-group").find(".list_count").val(parseInt(index)+1) | ||||
|                 $(this).parents(".controls").prev(".multipleInput").append(NewNode); | ||||
|                 $(this).parents(".controls").prev(".multipleInput").find('.controls:last input').val(""); | ||||
|                 removeInput(); | ||||
|                 checkMultipleInput(); | ||||
|                 return false; | ||||
|             }) | ||||
|             $(".status select").each(function (i) { | ||||
|                 $(this).change(function () { | ||||
|                     $(".status option:selected").eq(i).each(function () { | ||||
|  | @ -196,40 +125,35 @@ | |||
|                         } | ||||
|                     }); | ||||
|                 }) | ||||
|             }); | ||||
|             $(".form-horizontal").delegate(".onoff","click",function(){ | ||||
|                 $(this).toggleClass("disabled"); | ||||
|                 $(this).parent("legend").parent(".form-horizontal").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(); | ||||
|                 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; | ||||
|             }) | ||||
|             $('.onoff').live('click',function () { | ||||
|                 if($(this).parents("h4").length==1) { | ||||
|                     $(this).parents(".map-block").toggleClass("disabled"); | ||||
|                     $(this).parents(".map-block").find(".form-horizontal").toggleClass("hide"); | ||||
|                     if($(this).parents(".map-block").hasClass("disabled")){ | ||||
|                         $(this).text("OFF"); | ||||
|                     }else{ | ||||
|                         $(this).text("ON"); | ||||
|                     } | ||||
|                 } | ||||
|                 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(); | ||||
|                 } | ||||
|                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> | ||||
| <% end -%> | ||||
|  |  | |||
|  | @ -1,5 +1,3 @@ | |||
| <% # encoding: utf-8 %> | ||||
| 
 | ||||
| <% 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'} %> | ||||
| <% end %> | ||||
|  | @ -56,17 +54,5 @@ | |||
| </table> | ||||
| <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"%> | ||||
| 	<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> | ||||
| 		 | ||||
|  | @ -5,7 +5,6 @@ | |||
|                                         <div class="form-horizontal"> | ||||
|                         <div class="clear"> | ||||
| 						 | ||||
| 							<% if @attribute._type == "Role" %> | ||||
|                             <div class="control-group pull-left"> | ||||
|                                 <label class="control-label" for="key"><%= t(:to_search) %></label> | ||||
|                                 <div class="controls"> | ||||
|  | @ -19,7 +18,6 @@ | |||
| 									</label>  | ||||
|                                 </div> | ||||
|                             </div> | ||||
| 							<% end %> | ||||
| 							 | ||||
|                             <div class="control-group pull-left"> | ||||
|                                 <label class="control-label" for="key"><%= t(:key) %></label> | ||||
|  |  | |||
|  | @ -2,13 +2,13 @@ | |||
|   <% | ||||
| 	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 %> | ||||
|       <legend> | ||||
|           <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}]","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="control-group"> | ||||
| 					<label class="control-label" for="key"><%= t(:to_search) %></label> | ||||
|  |  | |||
|  | @ -4,6 +4,21 @@ | |||
|                     <h4><span><%= t(eval(":#{@attribute_type}"))%>:<%= @attribute.title %></span></h4> | ||||
|                                         <div class="form-horizontal"> | ||||
|                         <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"> | ||||
|                                 <label class="control-label" for="key"><%= t(:key) %></label> | ||||
|                                 <div class="controls"> | ||||
|  |  | |||
|  | @ -4,6 +4,21 @@ | |||
|                     <h4><span><%= t(eval(":#{@attribute_type}"))%>:<%= @attribute.title %></span></h4> | ||||
|                                         <div class="form-horizontal"> | ||||
|                         <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"> | ||||
|                                 <label class="control-label" for="key"><%= t(:key) %></label> | ||||
|                                 <div class="controls"> | ||||
|  |  | |||
|  | @ -1,41 +1,60 @@ | |||
| <% # encoding: utf-8 %> | ||||
| 
 | ||||
| <% 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'} %> | ||||
| <% end %> | ||||
| 
 | ||||
| <div class="main_list"> | ||||
| 	<div class="button_bar up"> | ||||
| 		<%= link_to t(:new_sub_role), eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"), :class => 'new' %> | ||||
| 	</div> | ||||
| 	<table> | ||||
| 		<thead> | ||||
| 		<tr> | ||||
| 			<td class="<%= @attribute_type %>s"><%= t("#{@attribute_type}") %>:<%= @attribute.title %></td> | ||||
| 			<td class="action"><%= t(:action) %></td> | ||||
| 		</tr> | ||||
| 		</thead> | ||||
| 		<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' %> | ||||
| 				<%= link_to t(:sub_role_field), eval("admin_#{@attribute_type}_sub_role_field_path(attribute)"), :class => 'edit' %>				 | ||||
| 				<%= 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' %> | ||||
| 				<%= 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' %> | ||||
| 				 | ||||
| 				<% 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 %> | ||||
| 				<% end %> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr> | ||||
| 		<td colspan="5"></td> | ||||
| 		</tr> | ||||
| 		<% end %>			 | ||||
| 		</tbody>	 | ||||
| 	</table> | ||||
| 	<div class="button_bar"> | ||||
| 		<%= link_to t(:new_sub_role), eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"), :class => 'new' %> | ||||
| 
 | ||||
| <div class="subnav"> | ||||
| 	<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> | ||||
| 	</div> | ||||
| </div> | ||||
| <table class="table main-list member-list"> | ||||
| 	<thead> | ||||
| 		<tr> | ||||
| 			<th class="span1-2"></th> | ||||
| 		</tr> | ||||
| 	</thead> | ||||
| 	<tbody>	 | ||||
| 		 | ||||
| 		<% @attribute_fields_upper_object.each do |attribute| %> | ||||
| 		<tr class="with_action"> | ||||
| 			<td class="span1-2"> | ||||
| 				<%= 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? %> | ||||
| 						<li><%= link_to t(:delete_), eval("admin_#{@attribute_type}_path(attribute, :sub_role => {:id => attribute })"), :class => 'delete', :confirm => t('sure?'), :method => :delete %></li> | ||||
| 						<% end %> | ||||
| 					</ul> | ||||
| 				</div> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<% end %> | ||||
| 		 | ||||
| 	</tbody> | ||||
| </table> | ||||
| 
 | ||||
| <div class="form-actions form-fixed pagination-right"> | ||||
| 	<%= 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> | ||||
|  | @ -11,11 +11,14 @@ | |||
| 					<%= render :partial=>"attribute_field",:collection=>@sub_attribute.attribute_fields%> | ||||
| 					</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 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? %> | ||||
| 				<%= hidden_field_tag 'sub_role[id]', params[:role_id] if !params[:role_id].blank? %> | ||||
|                 <%= f.submit t(:save),:class=>"btn btn-primary"%>   | ||||
|  |  | |||
|  | @ -1,14 +1,23 @@ | |||
| <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|%> | ||||
|    | ||||
| 	<%= rf.block_helper(@user,@form_index)%> | ||||
| 	<% @form_index = @form_index +1 %> | ||||
|    | ||||
|   <% end %> | ||||
|    | ||||
| <% @form_index = @form_index +1 %> | ||||
| 
 | ||||
|   <% role.sub_roles.where(:disabled=>false).each do |sub_role| %>  | ||||
|       <% sub_role_disable = @user.sub_roles.include?(sub_role) ?   false : true    %>  | ||||
|  |  | |||
|  | @ -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(: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(: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(: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 -%> | ||||
|  |  | |||
|  | @ -2,14 +2,25 @@ | |||
|   <% | ||||
| 	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 %> | ||||
|       <legend> | ||||
|           <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}]","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="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"> | ||||
|                   <label class="control-label" for="key"><%= t(:key) %></label> | ||||
|                   <div class="multipleInput"> | ||||
|  |  | |||
|  | @ -1,13 +1,13 @@ | |||
| module Announcement | ||||
|   OrbitApp.registration "Announcement",:type=> 'ModuleApp' do | ||||
| # module Announcement | ||||
|   # OrbitApp.registration "Announcement",:type=> 'ModuleApp' do | ||||
| 
 | ||||
|     base_url File.expand_path File.dirname(__FILE__)     | ||||
|     personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile" | ||||
|     # base_url File.expand_path File.dirname(__FILE__)     | ||||
|     # personal_plugin :enable => true,:path=>"panel/announcement/plugin/profile" | ||||
|      | ||||
| 
 | ||||
|   end | ||||
|   # end | ||||
| 
 | ||||
| end | ||||
| # end | ||||
| 
 | ||||
| 
 | ||||
| # OrbitApp.backend_side_bar 'News' do | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue