";
+ dom.html(dhtml);
+ if(typeof callbackFn=="function")
+ callbackFn.call(this,dhtml);
+ },
+makeDraggable : function(handler,dom){
+ handler.css("position","absolute");
+ dom.css("position","absolute");
+ var puranix=0;
+ var nayeex=0;
+ var puraniy=0;
+ var nayeey=0;
+ var offset="";
+ var zIndex=dom.css("z-index");
+ handler.mousedown(function(e){
+ puranix=e.clientX;
+ puraniy=e.clientY;
+ offset=dom.offset();
+ $rss(this).mousemove(function(e){
+ nayeex=e.clientX-puranix;
+ nayeex+=offset.left;
+ nayeey=e.clientY-puraniy;
+ nayeey+=offset.top;
+ dom.css({"left":nayeex+"px","top":nayeey+"px","z-index":"9999"});
+ })
+ }).mouseup(function(){
+ $rss(this).unbind("mousemove");
+ dom.css("z-index",zIndex);
+ })
+ },
+
+//automatically scrolls to the bottom of the div
+scrollToBottom : function(dom){
+ var domId = dom.attr("id");
+// var domScrollHeight = document.getElementById(domId).scrollHeight;
+ var obj = document.getElementById(domId);
+
+ if((obj.scrollTop+100) >= (obj.scrollHeight - obj.offsetHeight))
+ dom.scrollTop(obj.scrollHeight);
+ },
+
+/*ajax loading of images... needs following settings
+dom:in which images ve to be loaded
+url:the server url for making ajax calls
+limit:how many images to load
+divClass:the class of div surrounding each image
+nameClass:class for span showing name
+fn:function to be called in on the server
+imageSrc:the image source of all the images.
+bindTo:to bind images to a onclick function or else will be binded to normal a tag.
+urlKey:to specify the key of the value.. if bindTo is used, this will be neglected..
+returns json;
+*/
+loadImages : function(settings,callbackFn){
+
+ var dom = settings.dom;
+ var domid= dom.attr("id");
+ var temp_array=Array();
+ var starting = $rss("#"+domid+" img:last").attr("id");
+ if(typeof starting != 'undefined'){
+ starting = starting.substr(4,starting.length-1);
+ }else{starting = 0};
+ var temp_var="";
+ var json = "";
+ var dhtml="";
+ var extraparam="";
+ if(typeof settings.extraParam != "undefined"){
+ extraparam = settings.extraParam;
+ }
+ $rss.getJSON(settings.url,{fn:settings.fn,id:settings.whereId,limit:settings.limit,start:starting,extra:extraparam},function(images){
+ json = eval(images);
+ $rss.each(images,function(i,pic){
+ var temp_array=Array();
+ var a_var=Array();
+ var name_var="";
+ var title="";
+ $rss.each(pic,function(i,value){
+ temp_array.push(value);
+ })
+ if(temp_array.length>=4){
+ name_var=""+temp_array[3]+""
+ }
+ if(temp_array[2]==null)
+ title = "";
+ else
+ title = temp_array[2];
+ if(typeof settings.bindTo!="undefined"){
+ a_var[1]="onclick='"+settings.bindTo+"("+temp_array[0]+");return false;'";
+ a_var[0]="";
+ }else{a_var[0]='?'+settings.urlKey+'='+temp_array[0];a_var[1]="";}
+ dhtml="
"+name_var;
+ dom.delay(100).append(dhtml);
+ $rss("#pic_"+pic.id).delay(100).fadeIn(200);
+
+ })
+ if(typeof callbackFn=="function")
+ callbackFn.call(this,json);
+ })
+
+
+ },
+
+//function to get url variables...
+getUrlVars : function(){
+ var vars = [], hash;
+ var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
+ for(var i = 0; i < hashes.length; i++){
+ hash = hashes[i].split('=');
+ vars.push(hash[0]);
+ vars[hash[0]] = hash[1];
+ }
+ return vars;
+},
+/*function to open a modalwindow on a page.. self reliant no images, no css needed.
+settings
+
+width:in percentage or pixcel
+height:in percentage or pixcel
+closeBtn:true or false
+envClose:closing through background click, true or flase
+loadDiv:load html from a div
+loadPage:load a page
+loadHtml: load html
+
+*/
+modalWindow : function(settings,callbackFn){
+
+ var envClose = settings.envClose;
+ var dhtml="";
+ if(typeof envClose == "undefined")
+ envClose = true;
+ var closeBtn = settings.closeBtn;
+ if(typeof closeBtn == "undefined")
+ closeBtn = true;
+
+ var rgmaskHeight = $rss(window).height();
+ var rgmaskWidth = $rss(window).width();
+ var tempheight = settings.height;
+ var tempwidth = settings.width;
+
+ if(typeof tempheight!="undefined"){
+ if(tempheight.charAt(tempheight.length-1)=='%')
+ tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100;
+ }else{tempheight="auto";}
+
+ if(typeof tempwidth!="undefined"){
+ if(tempwidth.charAt(tempwidth.length-1)=='%')
+ tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100;
+ }else{tempwidth="auto";}
+
+ $rss("body").append('');
+ $rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.9,'z-index':199});
+ $rss("body").append('');
+ $rss("#rgWindow").css({"position": "fixed", "z-index": "999", "background": "#fff", "border": "solid 3px #ccc", "padding": "20px", "overflow": "hidden", "border-radius": "12px", "-webkit-border-radius": "12px", "-moz-border-radius": "12px", "-ms-border-radius": "12px", "box-shadow": "0 0 20px rgba(0,0,0,0.9)","-webkit-box-shadow": "0 0 20px rgba(0,0,0,0.9)","-moz-box-shadow": "0 0 20px rgba(0,0,0,0.9)","-ms-box-shadow": "0 0 20px rgba(0,0,0,0.9)"});
+ var rgWTop = (rgmaskHeight-20)/2;
+ var rgWLeft = (rgmaskWidth-20)/2;
+ $rss("#rgWindow").css({top:rgWTop+"px", left:rgWLeft+"px"});
+ if(typeof settings.loadDiv!="undefined"){
+ dhtml = $rss("#"+settings.loadDiv).html();
+ $rss("#rgWindow").html(dhtml).hide();
+ prepareWindow();
+ }
+ if(typeof settings.loadHtml!="undefined"){
+ dhtml = settings.loadHtml;
+ $rss("#rgWindow").html(dhtml).hide();
+ prepareWindow();
+ }
+ if(typeof settings.loadPage!="undefined"){
+ $rss("#rgWindow").load(settings.loadPage,function(){$rss(this).hide();dhtml=$rss(this).html();prepareWindow();});
+ }
+ function prepareWindow(){
+ if(tempheight!="auto")
+ rgWTop = (rgmaskHeight-tempheight)/2;
+ else{
+ tempheight=$rss("#rgWindow").height();
+ rgWTop=(rgmaskHeight-tempheight)/2;
+ }
+ if(tempwidth!="auto")
+ rgWLeft = (rgmaskWidth-tempwidth)/2;
+ else{
+ tempwidth=$rss("#rgWindow").width();
+ rgWLeft=(rgmaskWidth-tempwidth)/2;
+ }
+ $rss("#rgWindow").empty().show();
+ var closebtn = "";
+ if(closeBtn)
+ closebtn='X';
+ $rss("#rgWindow").animate({"width":tempwidth+"px","height":tempheight+"px",top:rgWTop+"px", left:rgWLeft+"px"},500,function(){$rss("#rgWindow").html(closebtn+"
"+dhtml+"
");
+ $rss("#close_modal").mouseover(function(){$rss(this).css("color","#999");}).mouseout(function(){$rss(this).css("color","#666");})
+ $rss("#close_modal").click(function(){
+ $rss("#rgWindow").empty();
+ var x = (rgmaskHeight-20)/2;
+ var y = (rgmaskWidth-20)/2;
+ $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();});
+ return false;
+ })
+ if(envClose)
+ $rss("#rgsheath").click(function(){
+ $rss("#rgWindow").empty();
+ var x = (rgmaskHeight-20)/2;
+ var y = (rgmaskWidth-20)/2;
+ $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();});})
+
+ if(typeof callbackFn=="function")
+ callbackFn.call(this,dhtml);
+ });
+ }
+},
+modalWindowClose : function(callbackFn){
+ if($rss("#rgWindow").length>0){
+ $rss("#rgWindow").empty();
+ var rgmaskHeight = $rss(window).height();
+ var rgmaskWidth = $rss(window).width();
+ var x = (rgmaskHeight-20)/2;
+ var y = (rgmaskWidth-20)/2
+ $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();})
+ }
+ if(typeof callbackFn=="function")
+ callbackFn.call(this,"harry");
+},
+bindDomToHead : function(dom){
+ var gc = dom.css("background");
+ var t = dom.offset();
+ var gw = dom.width();
+ $rss(window).scroll(function(){
+ var wt = $rss(window).scrollTop();
+ if ( wt > t.top ) {
+ var cssObj = {
+ 'position':'fixed',
+ 'top':0,
+ 'width':gw,
+ 'background':gc,
+ 'box-shadow':'0 1px 0 rgba(0,0,0,0.2)',
+ 'z-index':99
+ }
+ dom.css(cssObj);
+ } else {
+ dom.attr('style',"");
+ }
+ });
+},
+progressBar : function(dom,settings){
+ var domid = dom.prop("id");
+ if($rss("#rss_progressbar_div_"+domid).length==0){
+ if(typeof settings.top == "undefined")
+ settings.value = 1;
+ if(typeof settings.top == "undefined")
+ settings.top = (dom.height()-12)/2;
+ dom.append("
");
+ $rss("#rss_progressbar_div_"+domid).fadeIn(500);
+ }
+},
+progressBarValue : function(dom,value){
+ var domid = dom.prop("id");
+ if($rss("#rss_progressbar_div_"+domid).length==1){
+ $rss("#rss_progressbar_"+domid).animate({"width":value+"%"},100);
+
+ }
+},
+progressBarClose : function(dom){
+ var domid = dom.prop("id");
+ $rss("#rss_progressbar_div_"+domid).fadeOut(500,function(){$(this).remove();});
+},
+getInternetExplorerVersion: function(){
+ var rv = -1; // Return value assumes failure.
+ if (navigator.appName == 'Microsoft Internet Explorer')
+ {
+ var ua = navigator.userAgent;
+ var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
+ if (re.exec(ua) != null)
+ rv = parseFloat( RegExp.$1 );
+ }
+ return rv;
+ }
+}
+$ = jQuery.noConflict();
\ No newline at end of file
diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js
index 835884d0..98405564 100644
--- a/app/assets/javascripts/site_editor.js
+++ b/app/assets/javascripts/site_editor.js
@@ -6,4 +6,5 @@
//
//= require jquery
//= require jquery_ujs
+//= require page_edit
//= require side_bar_history
\ No newline at end of file
diff --git a/app/assets/javascripts/user_attribute_form.js b/app/assets/javascripts/user_attribute_form.js
deleted file mode 100644
index 3af8dc01..00000000
--- a/app/assets/javascripts/user_attribute_form.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var new_one = $('fieldset #new_one').clone();
-$('fieldset #new_one').remove();
-
-$('fieldset a.remove').live( "click", function(){
- $(this).parent().remove();
-});
-
-$('fieldset a.add').click(function(){
- new_one.clone().appendTo( $('fieldset') );
-})
\ No newline at end of file
diff --git a/app/assets/javascripts/user_attribute_model_form.js b/app/assets/javascripts/user_attribute_model_form.js
deleted file mode 100644
index 1e1e2ef5..00000000
--- a/app/assets/javascripts/user_attribute_model_form.js
+++ /dev/null
@@ -1,33 +0,0 @@
-$('#attributes_block a.delete').live('click', function(){
- $(this).parent().parent().parent().remove();
-});
-
-$('#attributes_block a.add').click(function(){
- $('#attributes').append("<%= escape_javascript(render(:partial => 'admin/user_attribute_models/attribute_model', :object => @user_attribute_model.attribute_models.build)) %>");
-});
-
-$('#attributes_block a.remove_existing_record').click(function(){
- $(this).next('.should_destroy').attr('value', 1);
- $(this).parent().parent().hide();
-});
-
-$('#attributes_block a.change_built_in').click(function(){
- $(this).parent().toggleClass('disable');
- var $am = $(this).next('.built_in_state')
- $am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
-});
-
-$('.select_mulitlingual input').live('click', function(){
- $(this).next().attr('value', this.checked);
-});
-
-$('.select_type select').live('change', function(){
- if(this.value == 'select')
- {
- $(this).next().show();
- }
- else
- {
- $(this).next().hide();
- }
-});
\ No newline at end of file
diff --git a/app/assets/javascripts/user_form.js b/app/assets/javascripts/user_form.js
index 21a4b454..183d8270 100644
--- a/app/assets/javascripts/user_form.js
+++ b/app/assets/javascripts/user_form.js
@@ -1,6 +1,10 @@
$(document).ready(function(){
- $('#user_active_role').change(function(){
- $('#role_models .roles_block').hide();
+ $('#user_role_id').change(function(){
+ $('#roles .attributes_block').hide();
$('#'+this.value+'_block').toggle();
});
+
+ $('.sub_role_select').change(function(){
+ $('#sub_role_' + this.value).toggle();
+ });
});
\ No newline at end of file
diff --git a/app/assets/stylesheets/admin_back_end.css.erb b/app/assets/stylesheets/admin_back_end.css.erb
index a350fc21..f5ba3ccc 100644
--- a/app/assets/stylesheets/admin_back_end.css.erb
+++ b/app/assets/stylesheets/admin_back_end.css.erb
@@ -224,7 +224,7 @@ body{
.main_list ul {
clear:both;
}
-#porfile {
+#profile {
padding-top: 100px;
}
/*add_buttom*/
diff --git a/vendor/built_in_modules/blog/lib/tasks/.gitkeep b/app/assets/stylesheets/feile.css.erb
similarity index 100%
rename from vendor/built_in_modules/blog/lib/tasks/.gitkeep
rename to app/assets/stylesheets/feile.css.erb
diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb
new file mode 100644
index 00000000..6f3f1c3d
--- /dev/null
+++ b/app/controllers/admin/app_auths_controller.rb
@@ -0,0 +1,17 @@
+class Admin::AppAuthsController < ApplicationController
+ layout "admin"
+ before_filter :authenticate_user!
+ before_filter :is_admin?
+
+ def index
+ @user_roles = UserRole.all.entries
+ apps = Purchase.where(:type =>"App")
+ @app_auth_data = apps.entries.map do |app|
+ app_c = eval(app.app_controller)
+ obj = app_c.new
+ obj_auth = obj.send "auth"
+ [:app_obj => app,:auth_field => obj_auth]
+ end
+ end
+
+end
\ No newline at end of file
diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb
new file mode 100644
index 00000000..bc86b662
--- /dev/null
+++ b/app/controllers/admin/infos_controller.rb
@@ -0,0 +1,63 @@
+class Admin::InfosController < ApplicationController
+
+ layout "admin"
+ before_filter :authenticate_user!
+ before_filter :is_admin?
+ before_filter :set_attribute, :only => [:index, :show, :new, :edit]
+
+ def index
+ @attributes = Info.all.entries
+ render :template => 'admin/attributes/index'
+ end
+
+ def show
+
+ end
+
+ def new
+ @attribute = Info.new
+ render :template => 'admin/attributes/new'
+ end
+
+ def edit
+ @attribute = Info.find(params[:id])
+ @i18n_variable = @attribute.i18n_variable
+ render :template => 'admin/attributes/edit'
+ end
+
+ def create
+ @attribute = Info.new(params[:info])
+ @attribute.save
+ redirect_to :action => :index
+ end
+
+ def update
+ @attribute = Info.find(params[:id])
+ @attribute.update_attributes(params[:info])
+ respond_to do |format|
+ format.html { redirect_to :action => :index }
+ format.js { render 'admin/attributes/toggle_enable' }
+ end
+ end
+
+ def destroy
+ @attribute = Info.find(params[:id])
+ @attribute.destroy
+ redirect_to :action => :index
+ end
+
+ def add_attribute_field
+ @attribute = Info.find(params[:id]) rescue nil
+ if !@attribute
+ @attribute = Info.new
+ end
+ end
+
+ protected
+
+ def set_attribute
+ @attribute_type = 'info'
+ @class = 'infos'
+ end
+
+end
diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb
new file mode 100644
index 00000000..55be4135
--- /dev/null
+++ b/app/controllers/admin/module_apps_controller.rb
@@ -0,0 +1,9 @@
+class Admin::ModuleAppsController < ApplicationController
+
+def reload_frontend_pages
+ @module_app = ModuleApp.find(params[:id])
+ respond_to do |format|
+ format.js {}
+ end
+end
+end
\ No newline at end of file
diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb
index 224113c3..23f58444 100644
--- a/app/controllers/admin/pages_controller.rb
+++ b/app/controllers/admin/pages_controller.rb
@@ -19,6 +19,7 @@ class Admin::PagesController < ApplicationController
def new
@item = Page.new
+ @apps = ModuleApp.all
@item.is_published = true
@item.parent_id = @parent_item.id rescue nil
@designs = Design.all.entries
@@ -27,6 +28,7 @@ class Admin::PagesController < ApplicationController
def edit
@item = Page.find(params[:id])
+ @apps = ModuleApp.all
@i18n_variable = @item.i18n_variable
@designs = Design.all.entries
@design = @item.design
diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb
new file mode 100644
index 00000000..65c86f36
--- /dev/null
+++ b/app/controllers/admin/roles_controller.rb
@@ -0,0 +1,56 @@
+class Admin::RolesController < ApplicationController
+
+ layout "admin"
+ before_filter :authenticate_user!
+ before_filter :is_admin?
+ before_filter :set_attribute, :only => [:index, :show, :new, :edit]
+
+ def index
+ @attributes = Role.all.entries
+ render :template => 'admin/attributes/index'
+ end
+
+ def show
+
+ end
+
+ def new
+ @attribute = Role.new
+ render :template => 'admin/attributes/new'
+ end
+
+ def edit
+ @attribute = Role.find(params[:id])
+ @i18n_variable = @attribute.i18n_variable
+ render :template => 'admin/attributes/edit'
+ end
+
+ def create
+ @attribute = Role.new(params[:role])
+ @attribute.save
+ redirect_to :action => :index
+ end
+
+ def update
+ @attribute = Role.find(params[:id])
+ @attribute.update_attributes(params[:role])
+ respond_to do |format|
+ format.html { redirect_to :action => :index }
+ format.js { render 'admin/attributes/toggle_enable' }
+ end
+ end
+
+ def destroy
+ @attribute = Role.find(params[:id])
+ @attribute.destroy
+ redirect_to :action => :index
+ end
+
+ protected
+
+ def set_attribute
+ @attribute_type = 'role'
+ @class = 'roles'
+ end
+
+end
diff --git a/app/controllers/admin/translations_controller.rb b/app/controllers/admin/translations_controller.rb
index 590ad556..54da8762 100644
--- a/app/controllers/admin/translations_controller.rb
+++ b/app/controllers/admin/translations_controller.rb
@@ -68,11 +68,11 @@ class Admin::TranslationsController < ApplicationController
result << var if var.document_class.eql?('language')
result
end
- @user_role_model_i18n_variables = @i18n_variables.inject([]) do |result, var|
- result << var if var.document_class.eql?('UserRoleModel')
+ @role_i18n_variables = @i18n_variables.inject([]) do |result, var|
+ result << var if var.document_class.eql?('Role')
result
end
- @user_info_model_i18n_variables = @i18n_variables.inject([]) do |result, var|
+ @info_i18n_variables = @i18n_variables.inject([]) do |result, var|
result << var if var.document_class.eql?('UserInfoModel')
result
end
diff --git a/app/controllers/admin/user_attributes_controller.rb b/app/controllers/admin/user_attributes_controller.rb
deleted file mode 100644
index c7021c74..00000000
--- a/app/controllers/admin/user_attributes_controller.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-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/controllers/admin/user_info_models_controller.rb b/app/controllers/admin/user_info_models_controller.rb
deleted file mode 100644
index 60360463..00000000
--- a/app/controllers/admin/user_info_models_controller.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-class Admin::UserInfoModelsController < ApplicationController
-
- layout "admin"
- before_filter :authenticate_user!
- before_filter :is_admin?
- before_filter :set_attribute, :only => [:index, :show, :new, :edit]
-
- def index
- @user_attribute_models = UserInfoModel.all.entries
- render :template => 'admin/user_attribute_models/index'
- end
-
- def show
- #@user_attribute_model = UserInfoModel.find(params[:id])
- end
-
- def new
- @user_attribute_model = UserInfoModel.new
- render :template => 'admin/user_attribute_models/new'
- end
-
- def edit
- @user_attribute_model = UserInfoModel.find(params[:id])
- @i18n_variable = @user_attribute_model.i18n_variable
- render :template => 'admin/user_attribute_models/edit'
- end
-
- def create
- @user_attribute_model = UserInfoModel.new(params[:user_info_model])
- @user_attribute_model.save
- redirect_to :action => :index
- end
-
- def update
- @user_attribute_model = UserInfoModel.find(params[:id])
- @user_attribute_model.update_attributes(params[:user_info_model])
- respond_to do |format|
- format.html { redirect_to :action => :index }
- format.js { render 'admin/user_attribute_models/toggle_enable' }
- end
- end
-
- def destroy
- @user_attribute_model = UserInfoModel.find(params[:id])
- @user_attribute_model.destroy
-
- @user_attribute_model.destroy_i18n_variables
-
- redirect_to :action => :index
- end
-
- protected
-
- def set_attribute
- @attribute = 'info'
- @class = 'infos'
- end
-
-end
diff --git a/app/controllers/admin/user_role_models_controller.rb b/app/controllers/admin/user_role_models_controller.rb
deleted file mode 100644
index bfdf5428..00000000
--- a/app/controllers/admin/user_role_models_controller.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-class Admin::UserRoleModelsController < ApplicationController
-
- layout "admin"
- before_filter :authenticate_user!
- before_filter :is_admin?
- before_filter :set_attribute, :only => [:index, :show, :new, :edit]
-
- def index
- @user_attribute_models = UserRoleModel.all.entries
- render :template => 'admin/user_attribute_models/index'
- end
-
- def show
- #@user_attribute_model = UserRoleModel.find(params[:id])
- end
-
- def new
- @user_attribute_model = UserRoleModel.new
- render :template => 'admin/user_attribute_models/new'
- end
-
- def edit
- @user_attribute_model = UserRoleModel.find(params[:id])
- @i18n_variable = @user_attribute_model.i18n_variable
- render :template => 'admin/user_attribute_models/edit'
- end
-
- def create
- @user_attribute_model = UserRoleModel.new(params[:user_role_model])
- @user_attribute_model.save
- redirect_to :action => :index
- end
-
- def update
- @user_attribute_model = UserRoleModel.find(params[:id])
- @user_attribute_model.update_attributes(params[:user_role_model])
-
- respond_to do |format|
- format.html { redirect_to :action => :index }
- format.js { render 'admin/user_attribute_models/toggle_enable' }
- end
- end
-
- def destroy
- @user_attribute_model = UserRoleModel.find(params[:id])
- @user_attribute_model.destroy
-
- @user_attribute_model.destroy_i18n_variables
-
- redirect_to :action => :index
- end
-
- protected
-
- def set_attribute
- @attribute = 'role'
- @class = 'roles'
- end
-
-end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 62e957ba..ef44cfc1 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -10,25 +10,18 @@ class Admin::UsersController < ApplicationController
def show
@user = User.find(params[:id])
- get_info_role_models
+ get_info_and_roles
end
def new
@user = User.new
- get_info_role_models
+ get_info_and_roles
end
def create
+ puts params.to_yaml
@user = User.new(params[:user])
if @user.save
- @user.user_infos.each do |user_info|
- user_info.save
- user_info.attribute_values.each(&:save)
- end
- @user.user_roles.each do |user_role|
- user_role.save
- user_role.attribute_values.each(&:save)
- end
flash[:notice] = t('admin.create_success_user')
redirect_to :action => :index
else
@@ -38,7 +31,7 @@ class Admin::UsersController < ApplicationController
def edit
@user = User.find(params[:id])
- get_info_role_models
+ get_info_and_roles
end
def update
@@ -55,7 +48,7 @@ class Admin::UsersController < ApplicationController
flash[:notice] = t('admin.update_success_user')
redirect_to :action => :index
else
- get_info_role_models
+ get_info_and_roles
render :action => :edit
end
end
@@ -66,10 +59,6 @@ class Admin::UsersController < ApplicationController
else
@user = User.find(params[:id])
@user.destroy
- @user.user_attributes.each do |ua|
- ua.attribute_values.each(&:destroy)
- ua.destroy
- end
end
redirect_to :action => :index
@@ -77,11 +66,11 @@ class Admin::UsersController < ApplicationController
protected
- def get_info_role_models
- @user_info_models = UserInfoModel.excludes('disabled' => true)
- @user_role_models = UserRoleModel.excludes('disabled' => true)
+ def get_info_and_roles
+ @infos = Info.excludes('disabled' => true)
+ @roles = Role.excludes('disabled' => true)
end
-
+
def set_attribute
@class = 'users'
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 68b32238..cc64e130 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
protect_from_forgery
- include Parser
+ include ParserFrontEnd, ParserBackEnd
helper :all
before_filter :set_locale, :set_site
@@ -36,9 +36,9 @@ class ApplicationController < ActionController::Base
end
# Render the page
- def render_page
+ def render_page(url = nil)
if @item
- render :text => parse_page(@item)
+ render :text => parse_page(@item,url)
else
render :text => '404 Not Found'
end
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 710c7e47..693243c2 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -9,19 +9,28 @@ class PagesController < ApplicationController
end
end
- def show
- begin
- item = Item.first(:conditions => {:full_name => params[:page_name]})
- case item._type
- when 'Page'
- @item = item
- render_page
- when 'Link'
- redirect_to "http://#{item[:url]}"
- end
- rescue
- render :file => "#{Rails.root}/public/404.html", :status => :not_found
- end
+ def appfront
+
+ pre_uri = URI.split request.env['HTTP_REFERER']
+ pre_item_fullname = pre_uri[5][1..-1]
+ @item = Item.first(:conditions => {:full_name => pre_item_fullname})
+ redirect_to (request.env['HTTP_REFERER'].partition("?")[0]+"?app_url=#{request.fullpath}")
+
end
+ def show
+ begin
+ item = Item.first(:conditions => {:full_name => params[:page_name]})
+ case item._type
+ when 'Page'
+ @item = item
+ render_page ((params[:app_url]+'?inner='+"true" if params[:app_url]))
+ when 'Link'
+ redirect_to "http://#{item[:url]}"
+ end
+ rescue
+ render :file => "#{Rails.root}/public/404.html", :status => :not_found
+ end
+ end
+
end
diff --git a/app/helpers/admin/user_helper.rb b/app/helpers/admin/user_helper.rb
index 6ebd056f..22da150e 100644
--- a/app/helpers/admin/user_helper.rb
+++ b/app/helpers/admin/user_helper.rb
@@ -1,7 +1,7 @@
module Admin::UserHelper
- def show_user_attribute(object, key, locale = '')
- attribute = object.attribute_values.detect {|av| av.key.to_s.eql?(key.to_s) || av[locale.to_s].eql?(locale.to_s) } rescue nil
+ def show_attribute(object, field_id, locale = '')
+ attribute = object.attribute_values.detect {|av| av.attribute_field_id.eql?(field_id) || av[locale.to_s].eql?(locale.to_s) } rescue nil
if attribute
if locale.to_s.blank?
attribute['key']
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index b8a9c49e..c8754b31 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -48,5 +48,12 @@ module ApplicationHelper
message % item
end
end
+
+ def add_attribute(partial, f, attribute)
+ new_object = f.object.send(attribute).build
+ fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f|
+ render :partial => partial, :object => new_object, :locals => {:f => f}
+ end
+ end
end
diff --git a/app/models/app_auth.rb b/app/models/app_auth.rb
new file mode 100644
index 00000000..9602fda0
--- /dev/null
+++ b/app/models/app_auth.rb
@@ -0,0 +1,77 @@
+class AppAuth
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ # after_save :update_block_list,:update_privilage_list
+
+ field :title
+ field :token
+ field :all ,type: Boolean,default: false
+ belongs_to :module_app
+
+ belongs_to :users
+ # belongs_to :users,as: :block_users, :inverse_of => :privilege_apps
+ has_and_belongs_to_many :blocked_users, :inverse_of => nil, :class_name => "User"
+ has_and_belongs_to_many :privilege_users, :inverse_of => nil, :class_name => "User"
+
+
+ has_and_belongs_to_many :roles
+
+ def add_user_to_black_list user
+ unless self.blocked_users.include?(user)
+ self.blocked_users << user
+ self.save!
+ else
+ false #should put error message for user existed in list already
+ end
+ end
+
+
+ def remove_user_from_black_list user
+ if self.blocked_users.include? user
+ self.blocked_users.delete user
+ self.save!
+ else
+ false #should put error message for user not existed in list
+ end
+ end
+
+
+ def add_user_to_privilege_list user
+ unless self.privilege_users.include? user
+ self.privilege_users << user
+ self.save!
+ else
+ false #should put error message for user existed in list already
+ end
+ end
+
+
+ def remove_user_from_privilege_list user
+ if self.privilege_users.include? user
+ self.privilege_users.delete user
+ self.save!
+ else
+ false #should put error message for user not existed in list
+ end
+ end
+
+ def auth_users
+ if self.all?
+ User.all.entries
+ else
+ ary= self.roles.collect do |role|
+ role.users
+ end
+ ary << self.privilege_users
+ ary.flatten!
+ end
+ end
+
+ def auth_users_after_block_list
+ auth_users - self.blocked_users
+ end
+
+ # protected
+
+
+end
\ No newline at end of file
diff --git a/app/models/design/design.rb b/app/models/design/design.rb
index f1f676b6..e77f7f0f 100644
--- a/app/models/design/design.rb
+++ b/app/models/design/design.rb
@@ -24,6 +24,35 @@ class Design
after_save :procs_embedded_objects
# after_destroy :del_embedded_objects
+ # validate do
+ # errors.add('atttribute1', 'error for 1') if files_with_duplicate?
+ # errors.add('atttribute2', 'error for 1') if files_with_noname?
+ # end
+
+ def files_with_duplicate?
+ [self.javascripts, self.images,self.themes].each do |objects_hash|
+ ary = objects_hash.collect{ |k| k.file_filename}
+ ary.compact!
+ # debugger
+ return true if(ary.count!=ary.uniq.count)
+ end
+ false
+ end
+
+ def files_with_noname?
+ [self.javascripts, self.images,self.themes].each do |objects_hash|
+ objects_hash.each{ |k|
+ return true if(k.file_filename.nil? && !k.to_save?)
+ }
+ end
+ false
+ end
+ def new_files=(*attrs)
+ attrs[0].map do |key,items_ary| #Loop by JSs,Themes,Imgs
+ self.files=([items_ary, key])
+ end
+ end
+
def javascripts=(*attrs)
self.files = (attrs << 'javascripts')
end
@@ -36,7 +65,7 @@ class Design
self.files = (attrs << 'images')
end
- # Update or create the attribute_model records
+ # Update or create the attribute records
def files=(attrs)
case attrs.last
when 'layout'
@@ -45,6 +74,7 @@ class Design
files = eval(attrs.last)
end
attrs[0].each do |a|
+
if a[:id].blank? && !a[:file].blank?
files.build(:file => a[:file], :to_save => true)
else
@@ -86,12 +116,14 @@ class Design
end
end
end
+ self.valid?
end
def process_object(object)
if object.to_save
if object.file_filename.nil?
- new_object = self.send(object._type.downcase.pluralize).build(object)
+ new_object = self.send(object._type.downcase.pluralize).build(object.attributes)
+ new_object.file = object.file
object.destroy
new_object.to_save = false
new_object.save
diff --git a/app/models/design/layout.rb b/app/models/design/layout.rb
index 7ae4ceef..0b3bf7d9 100644
--- a/app/models/design/layout.rb
+++ b/app/models/design/layout.rb
@@ -1,5 +1,5 @@
class Layout < DesignFile
- include Parser
+ include ParserLayout
attr_reader :content
diff --git a/app/models/i18n_variable.rb b/app/models/i18n_variable.rb
index e6835347..b5983d35 100644
--- a/app/models/i18n_variable.rb
+++ b/app/models/i18n_variable.rb
@@ -7,6 +7,8 @@ class I18nVariable
field :document_class, :type => String
field :parent_id, :type => BSON::ObjectId, :index => true
+ belongs_to :language_value, polymorphic: true
+
def method_missing(field)
self[field]
end
diff --git a/app/models/module_app.rb b/app/models/module_app.rb
index f692fb21..31a02025 100644
--- a/app/models/module_app.rb
+++ b/app/models/module_app.rb
@@ -2,7 +2,7 @@ class ModuleApp
include Mongoid::Document
include Mongoid::Timestamps
- field :name_of_app
+ field :title
field :version
field :organization
field :author
@@ -10,4 +10,8 @@ class ModuleApp
field :update_info
field :create_date
+ field :app_pages ,type: Array
+
+ has_one :app_auth,dependent: :delete
+
end
diff --git a/app/models/page.rb b/app/models/page.rb
index dad89219..1e716d4d 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -1,10 +1,12 @@
class Page < Item
field :content
+ field :app_frontend_url
field :theme_id, :type => BSON::ObjectId, :default => nil
belongs_to :design
has_many :page_parts
+ belongs_to :module_app
embeds_many :custom_images, as: :design_image
diff --git a/app/models/purchase/purchase.rb b/app/models/purchase/purchase.rb
index a8a9bcfd..104e3a8e 100644
--- a/app/models/purchase/purchase.rb
+++ b/app/models/purchase/purchase.rb
@@ -9,4 +9,8 @@ class Purchase
field :downloaded, :type => Boolean
field :download_date, :type => Date
+ field :type
+ field :app_controller
+ has_many :app_auths
+
end
diff --git a/app/models/user/attribute.rb b/app/models/user/attribute.rb
new file mode 100644
index 00000000..af8a1106
--- /dev/null
+++ b/app/models/user/attribute.rb
@@ -0,0 +1,26 @@
+class Attribute
+
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :key
+ field :built_in, :type => Boolean, :default => false
+ field :disabled, :type => Boolean, :default => false
+
+ has_many :attribute_fields, :autosave => true, :dependent => :destroy
+ has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+ accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
+
+ def is_built_in?
+ self.built_in
+ end
+
+ def is_disabled?
+ self.disabled
+ end
+
+ def get_enabled_attribute_fields
+ self.attribute_fields.excludes('disabled' => true)
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/user/attribute_field.rb b/app/models/user/attribute_field.rb
new file mode 100644
index 00000000..42bbf910
--- /dev/null
+++ b/app/models/user/attribute_field.rb
@@ -0,0 +1,37 @@
+class AttributeField
+
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :key
+ field :markup
+ field :locale, :type => Boolean, :default => true
+ field :list_options, :type => Array
+ field :built_in, :type => Boolean, :default => false
+ field :disabled, :type => Boolean, :default => false
+
+ belongs_to :attribute
+ has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+ has_many :attribute_values
+
+ # validates_uniqueness_of :key
+
+ # Convert the string list_options into an array
+ def select_list_options=(var)
+ self.list_options = var.gsub(' ', '').split(',')
+ end
+
+ # Convert the array list_options into a string
+ def select_list_options
+ self.list_options.to_a.join(', ')
+ end
+
+ def is_built_in?
+ self.built_in
+ end
+
+ def is_disabled?
+ self.disabled
+ end
+
+end
diff --git a/app/models/user/attribute_model.rb b/app/models/user/attribute_model.rb
deleted file mode 100644
index d2cb8a1a..00000000
--- a/app/models/user/attribute_model.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-class AttributeModel
-
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field :key
- field :i18n_variable_id, :type => BSON::ObjectId, :index => true
- field :markup
- field :locale, :type => Boolean
- field :list_options, :type => Array
- field :built_in, :type => Boolean, :default => false
- field :disabled, :type => Boolean, :default => false
-
- embedded_in :user_attribute_model
- validates_uniqueness_of :key
-
- # Destroy the i18n_variable
- def destroy_i18n_variable
- self.i18n_variable.destroy rescue nil
- end
-
- # Get the i18n_variable
- def i18n_variable
- @i18n_variable ||= I18nVariable.find(self.i18n_variable_id) rescue nil
- end
-
- # Update or create the i18n_variable record
- def i18n_variable=(attr)
- if self.i18n_variable_id
- self.i18n_variable.update_attributes(attr)
- else
- # var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class, :parent_id => self.user_attribute_model.i18n_variable_id}))
- var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class}))
- var.save
- self.i18n_variable_id = var.id
- end
- end
-
- # Convert the string list_options into an array
- def select_list_options=(var)
- self.list_options = var.gsub(' ', '').split(',')
- end
-
- # Convert the array list_options into a string
- def select_list_options
- self.list_options.to_a.join(', ')
- end
-
- # Check if the attribute is set to be destroyed
- def should_destroy?
- should_destroy.to_i == 1 rescue nil
- end
-
- def is_built_in?
- self.built_in
- end
-
- def is_disabled?
- self.disabled
- end
-
-end
diff --git a/app/models/user/attribute_value.rb b/app/models/user/attribute_value.rb
index 877431f0..47c84085 100644
--- a/app/models/user/attribute_value.rb
+++ b/app/models/user/attribute_value.rb
@@ -5,6 +5,11 @@ class AttributeValue
field :key
- belongs_to :user_attribute
+ belongs_to :attribute_field
+ belongs_to :user
+
+ def method_missing(field)
+ self[field]
+ end
end
diff --git a/app/models/user/info.rb b/app/models/user/info.rb
new file mode 100644
index 00000000..e55fa6f2
--- /dev/null
+++ b/app/models/user/info.rb
@@ -0,0 +1,3 @@
+class Info < Attribute
+
+end
diff --git a/app/models/user/role.rb b/app/models/user/role.rb
new file mode 100644
index 00000000..86f7266f
--- /dev/null
+++ b/app/models/user/role.rb
@@ -0,0 +1,29 @@
+class Role
+
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :key
+ field :built_in, :type => Boolean, :default => false
+ field :disabled, :type => Boolean, :default => false
+
+ has_many :sub_roles, :autosave => true, :dependent => :destroy
+ has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+ has_many :users
+ accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
+ accepts_nested_attributes_for :sub_roles, :allow_destroy => true
+
+ def is_built_in?
+ self.built_in
+ end
+
+ def is_disabled?
+ self.disabled
+ end
+
+ # Get an role from key
+ def self.get_role_from_key(key)
+ self.first(:conditions => {:key => key})
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/user/sub_role.rb b/app/models/user/sub_role.rb
new file mode 100644
index 00000000..cdefb5f5
--- /dev/null
+++ b/app/models/user/sub_role.rb
@@ -0,0 +1,11 @@
+class SubRole < Attribute
+
+ belongs_to :role
+ has_and_belongs_to_many :users
+
+ # Get an sub_role from key
+ def self.get_sub_role_from_key(key)
+ self.first(:conditions => {:key => key})
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/user/user.rb b/app/models/user/user.rb
index f582dc04..1e956b80 100644
--- a/app/models/user/user.rb
+++ b/app/models/user/user.rb
@@ -10,53 +10,37 @@ class User
field :admin, :type => Boolean, :default => true
field :active_role
- has_many :user_attributes
- has_many :user_roles
- has_many :user_infos
+ has_many :attribute_values, :autosave => true, :dependent => :destroy
+ has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists
+ has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth"
+ has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth"
+ belongs_to :role
+ has_and_belongs_to_many :sub_roles
+ accepts_nested_attributes_for :attribute_values, :allow_destroy => true
- # Update or create the user_role records
- def user_roles=(*attrs)
- attrs[0].each do |roles|
- if roles[:id].blank?
- user_roles.build(roles)
- else
- user_role = user_roles.detect {|a| a.id.to_s == roles[:id].to_s }
- user_role.update_attributes(roles)
- end
- end
- end
-
- # Update or create the user_info records
- def user_infos=(*attrs)
- attrs[0].each do |infos|
- if infos[:id].blank?
- user_infos.build(infos)
- else
- user_info = user_infos.detect {|a| a.id.to_s == infos[:id].to_s }
- user_info.update_attributes(infos)
- end
- end
- end
-
- # Get an user_info from model key
- def get_info_from_model_key(key)
- self.user_infos.detect {|a| a.key.to_s == key.to_s }
- end
-
- # Get an user_role from model key
- def get_role_from_model_key(key)
- self.user_roles.detect {|a| a.key.to_s == key.to_s }
+ def avb_apps
+ query = AppAuth.any_of({all: true},{privilege_user_ids: self.id},{roles: self.role.id}).excludes(blocked_user_ids: self.id)
end
def name
- infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') }
- if infos
- first_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
- last_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
+ info = Class::Info.first(:conditions => {:key => 'profile'})
+ if info
+ first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
+ last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
return "#{first_name} #{last_name}"
else
return nil
end
end
+ def get_attribute_values
+ @attribute_values ||= self.attribute_values
+ end
+
+ def get_value_from_field_id(field_id)
+ values = get_attribute_values
+ value = values.detect {|value| value.attribute_field_id == field_id} rescue nil
+ value ? value : self.attribute_values.build
+ end
+
end
diff --git a/app/models/user/user_attribute.rb b/app/models/user/user_attribute.rb
deleted file mode 100644
index ddf04cc1..00000000
--- a/app/models/user/user_attribute.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class UserAttribute
-
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field :key
- has_many :attribute_values
-
- # Update or create the attribute_value records
- def attribute_values=(*args)
- args[0].each do |value|
- if value[:id].blank?
- attribute_values.build(value)
- else
- attribute_value = attribute_values.detect {|a| a.id.to_s == value[:id].to_s }
- attribute_value.update_attributes(value)
- end
- end
- end
-
-end
diff --git a/app/models/user/user_attribute_model.rb b/app/models/user/user_attribute_model.rb
deleted file mode 100644
index c8aea4b2..00000000
--- a/app/models/user/user_attribute_model.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-class UserAttributeModel
-
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field :key
- field :i18n_variable_id, :type => BSON::ObjectId, :index => true
- field :built_in, :type => Boolean, :default => false
- field :disabled, :type => Boolean, :default => false
-
- embeds_many :attribute_models
-
- after_update :destroy_attrs
-
- # Update or create the attribute_model records
- def attribute_models=(*attrs)
- attrs[0].each do |attributes|
- if attributes[:id].blank?
- attribute_models.build(attributes)
- else
- attribute_model = attribute_models.detect {|a| a.id.to_s == attributes[:id].to_s }
- attribute_model.update_attributes(attributes)
- end
- end
- end
-
- # Destroy the i18n_variables
- def destroy_i18n_variables
- self.i18n_variable.destroy rescue nil
- self.attribute_models.each do |attr|
- attr.destroy_i18n_variable
- end
- end
-
- # Update or create the i18n_variable record
- def i18n_variable=(attr)
- if self.i18n_variable_id
- self.i18n_variable.update_attributes(attr) rescue nil
- else
- var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class}))
- var.save
- self.i18n_variable_id = var.id
- end
- end
-
- # Get the i18n_variable
- def i18n_variable
- @i18n_variable ||= I18nVariable.find(self.i18n_variable_id) rescue nil
- end
-
- def is_built_in?
- self.built_in
- end
-
- def is_disabled?
- self.disabled.blank? ? false : self.disabled
- end
-
- def get_enabled_attribute_models
- self.attribute_models.excludes('disabled' => true)
- end
-
- protected
-
- # Destroy the i18n_variable for each attribute_models if marked to destroy
- def destroy_attrs
- attribute_models.each do |a|
- if a.should_destroy?
- a.destroy_i18n_variable
- end
- end
- end
-
-end
diff --git a/app/models/user/user_info.rb b/app/models/user/user_info.rb
deleted file mode 100644
index f216c83a..00000000
--- a/app/models/user/user_info.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class UserInfo < UserAttribute
-
- belongs_to :user
-
-end
diff --git a/app/models/user/user_info_model.rb b/app/models/user/user_info_model.rb
deleted file mode 100644
index cacf2a55..00000000
--- a/app/models/user/user_info_model.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class UserInfoModel < UserAttributeModel
-
-end
diff --git a/app/models/user/user_role.rb b/app/models/user/user_role.rb
deleted file mode 100644
index 1bc23e93..00000000
--- a/app/models/user/user_role.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class UserRole < UserAttribute
-
- belongs_to :user
-
-end
diff --git a/app/models/user/user_role_model.rb b/app/models/user/user_role_model.rb
deleted file mode 100644
index d5271edd..00000000
--- a/app/models/user/user_role_model.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class UserRoleModel < UserAttributeModel
-
- # Get an user_role_model from key
- def self.get_role_model_from_key(key)
- self.first(:conditions => {:key => key})
- end
-
-end
diff --git a/app/views/admin/app_auths/_auth_unit.html.erb b/app/views/admin/app_auths/_auth_unit.html.erb
new file mode 100644
index 00000000..5a246fc3
--- /dev/null
+++ b/app/views/admin/app_auths/_auth_unit.html.erb
@@ -0,0 +1,3 @@
+
+ <%= unit%>
+
\ No newline at end of file
diff --git a/app/views/admin/app_auths/index.html.erb b/app/views/admin/app_auths/index.html.erb
new file mode 100644
index 00000000..0d804b2b
--- /dev/null
+++ b/app/views/admin/app_auths/index.html.erb
@@ -0,0 +1,32 @@
+<% content_for :secondary do %>
+
\ No newline at end of file
diff --git a/app/views/admin/attributes/edit.html.erb b/app/views/admin/attributes/edit.html.erb
new file mode 100644
index 00000000..d45382f6
--- /dev/null
+++ b/app/views/admin/attributes/edit.html.erb
@@ -0,0 +1,14 @@
+<% content_for :secondary do %>
+ <%= render 'admin/users/side_bar' %>
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/admin/attributes/index.html.erb b/app/views/admin/attributes/index.html.erb
new file mode 100644
index 00000000..71ec1699
--- /dev/null
+++ b/app/views/admin/attributes/index.html.erb
@@ -0,0 +1,39 @@
+<% content_for :secondary do %>
+ <%= render 'admin/users/side_bar' %>
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/admin/attributes/toggle_enable.js.erb b/app/views/admin/attributes/toggle_enable.js.erb
new file mode 100644
index 00000000..c42c4744
--- /dev/null
+++ b/app/views/admin/attributes/toggle_enable.js.erb
@@ -0,0 +1,3 @@
+$("#enable_<%= @attribute.id %>").toggle();
+$("#disable_<%= @attribute.id %>").toggle();
+$("#attribute_<%= @attribute.id %>").toggleClass('disable');
\ No newline at end of file
diff --git a/app/views/admin/designs/_design_file.html.erb b/app/views/admin/designs/_design_file.html.erb
index 205b5350..c2945069 100644
--- a/app/views/admin/designs/_design_file.html.erb
+++ b/app/views/admin/designs/_design_file.html.erb
@@ -18,7 +18,7 @@
<% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/admin/designs/_new.html.erb b/app/views/admin/designs/_new.html.erb
new file mode 100644
index 00000000..ded2237a
--- /dev/null
+++ b/app/views/admin/designs/_new.html.erb
@@ -0,0 +1,10 @@
+
-<% end %>
\ No newline at end of file
diff --git a/app/views/admin/user_attribute_models/_form.html.erb b/app/views/admin/user_attribute_models/_form.html.erb
deleted file mode 100644
index edbcae39..00000000
--- a/app/views/admin/user_attribute_models/_form.html.erb
+++ /dev/null
@@ -1,57 +0,0 @@
-
\ No newline at end of file
diff --git a/app/views/admin/users/_show_attribute.html.erb b/app/views/admin/users/_show_attribute.html.erb
new file mode 100644
index 00000000..ec33f84b
--- /dev/null
+++ b/app/views/admin/users/_show_attribute.html.erb
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/app/views/admin/users/_show_sub_role.html.erb b/app/views/admin/users/_show_sub_role.html.erb
new file mode 100644
index 00000000..22d8b758
--- /dev/null
+++ b/app/views/admin/users/_show_sub_role.html.erb
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/app/views/admin/users/_side_bar.html.erb b/app/views/admin/users/_side_bar.html.erb
index 11d4e238..ce0e1296 100644
--- a/app/views/admin/users/_side_bar.html.erb
+++ b/app/views/admin/users/_side_bar.html.erb
@@ -2,10 +2,10 @@
\ No newline at end of file
diff --git a/app/views/admin/users/_sub_role.html.erb b/app/views/admin/users/_sub_role.html.erb
new file mode 100644
index 00000000..f55b8b48
--- /dev/null
+++ b/app/views/admin/users/_sub_role.html.erb
@@ -0,0 +1,37 @@
+