Merge with sub_roles
This commit is contained in:
parent
fc591ee308
commit
62aaf79491
7
Gemfile
7
Gemfile
|
@ -10,13 +10,15 @@ gem 'mini_magick'
|
|||
gem 'rubyzip'
|
||||
gem 'sinatra'
|
||||
gem 'execjs'
|
||||
gem 'mongoid'
|
||||
gem 'mongoid', :git => 'git://github.com/mongoid/mongoid.git', :ref => '7a915395db50e2bc6071a503a11530e644879e49'
|
||||
|
||||
gem 'rake'
|
||||
gem 'jquery-rails'
|
||||
|
||||
gem 'sprockets'
|
||||
|
||||
gem 'radius'
|
||||
|
||||
# For linux
|
||||
gem 'therubyracer'
|
||||
|
||||
|
@ -33,6 +35,8 @@ end
|
|||
gem 'ruby-debug19'
|
||||
|
||||
group :test, :development do
|
||||
gem 'spork'
|
||||
gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing.
|
||||
gem "rspec", "~> 2.0"
|
||||
gem "rspec-rails", "~> 2.0"
|
||||
gem "factory_girl_rails"
|
||||
|
@ -40,6 +44,7 @@ group :test, :development do
|
|||
gem "rcov"
|
||||
gem "delorean"
|
||||
gem "watchr"
|
||||
gem "spork"
|
||||
# gem "capybara"
|
||||
# gem 'yard'
|
||||
# gem "bluecloth"
|
||||
|
|
31
Gemfile.lock
31
Gemfile.lock
|
@ -1,3 +1,13 @@
|
|||
GIT
|
||||
remote: git://github.com/mongoid/mongoid.git
|
||||
revision: 7a915395db50e2bc6071a503a11530e644879e49
|
||||
ref: 7a915395db50e2bc6071a503a11530e644879e49
|
||||
specs:
|
||||
mongoid (2.4.0)
|
||||
activemodel (~> 3.1)
|
||||
mongo (~> 1.3)
|
||||
tzinfo (~> 0.3.22)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
|
@ -32,8 +42,9 @@ GEM
|
|||
archive-tar-minitar (0.5.2)
|
||||
arel (2.2.1)
|
||||
bcrypt-ruby (3.0.1)
|
||||
bson (1.5.1)
|
||||
bson_ext (1.5.1)
|
||||
bson (1.5.2)
|
||||
bson_ext (1.5.2)
|
||||
bson (= 1.5.2)
|
||||
builder (3.0.0)
|
||||
carrierwave (0.5.4)
|
||||
activesupport (~> 3.0)
|
||||
|
@ -49,6 +60,7 @@ GEM
|
|||
execjs
|
||||
coffee-script-source (1.1.3)
|
||||
columnize (0.3.5)
|
||||
database_cleaner (0.7.0)
|
||||
delorean (1.1.1)
|
||||
chronic
|
||||
devise (1.5.2)
|
||||
|
@ -80,12 +92,8 @@ GEM
|
|||
mime-types (1.17.2)
|
||||
mini_magick (3.3)
|
||||
subexec (~> 0.1.0)
|
||||
mongo (1.5.1)
|
||||
bson (= 1.5.1)
|
||||
mongoid (2.3.4)
|
||||
activemodel (~> 3.1)
|
||||
mongo (~> 1.3)
|
||||
tzinfo (~> 0.3.22)
|
||||
mongo (1.5.2)
|
||||
bson (= 1.5.2)
|
||||
multi_json (1.0.4)
|
||||
orm_adapter (0.0.5)
|
||||
polyglot (0.3.3)
|
||||
|
@ -100,6 +108,7 @@ GEM
|
|||
rack
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
radius (0.7.1)
|
||||
rails (3.1.3)
|
||||
actionmailer (= 3.1.3)
|
||||
actionpack (= 3.1.3)
|
||||
|
@ -154,6 +163,7 @@ GEM
|
|||
rack (~> 1.3, >= 1.3.4)
|
||||
rack-protection (~> 1.1, >= 1.1.2)
|
||||
tilt (~> 1.3, >= 1.3.3)
|
||||
spork (0.8.5)
|
||||
sprockets (2.0.3)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
|
@ -183,13 +193,15 @@ DEPENDENCIES
|
|||
carrierwave (= 0.5.4)
|
||||
ckeditor
|
||||
coffee-rails
|
||||
database_cleaner
|
||||
delorean
|
||||
devise
|
||||
execjs
|
||||
factory_girl_rails
|
||||
jquery-rails
|
||||
mini_magick
|
||||
mongoid
|
||||
mongoid!
|
||||
radius
|
||||
rails
|
||||
rake
|
||||
rcov
|
||||
|
@ -200,6 +212,7 @@ DEPENDENCIES
|
|||
sass-rails
|
||||
shoulda-matchers
|
||||
sinatra
|
||||
spork
|
||||
sprockets
|
||||
therubyracer
|
||||
uglifier
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
$('.attributes_block a.delete').live('click', function(){
|
||||
$(this).parents('.list_item').remove();
|
||||
});
|
||||
|
||||
$('.action a.remove_existing_record').live('click', function(){
|
||||
$(this).next('.should_destroy').attr('value', 1);
|
||||
$("#attribute_" + $(this).prev().attr('value')).hide();
|
||||
});
|
||||
|
||||
$('.action a.switch').live('click', function(){
|
||||
$(this).parent().toggleClass('disable');
|
||||
var $am = $(this).next('.built_in_state')
|
||||
$am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
|
||||
});
|
||||
|
||||
$('.select_type select').live('change', function(){
|
||||
if(this.value == 'select')
|
||||
{
|
||||
$(this).next().show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).next().hide();
|
||||
}
|
||||
});
|
|
@ -1,4 +1,21 @@
|
|||
$("div.editable").live("mouseenter mouseleave",
|
||||
function (event) {
|
||||
$("div.editable").live("mouseenter mouseleave", function (event) {
|
||||
$(this).children('.edit_link').toggle();
|
||||
});
|
||||
|
||||
$("#page_design_id").live('change', function() {
|
||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
|
||||
});
|
||||
|
||||
$("#page_module_app").live('change', function() {
|
||||
var app_id = $(this).val();
|
||||
if(app_id!=''){
|
||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_frontend_pages',function(data, textStatus){
|
||||
if(textStatus == 'success'){
|
||||
$(this).after(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#app_page_url").remove();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,513 @@
|
|||
//Created by Harry Bomrah on Sep 21 2011
|
||||
$rss = jQuery.noConflict();
|
||||
var rcom={
|
||||
//Pass dom and will return binded dom with starting year till current
|
||||
insertDatePanel : function(dom,year){
|
||||
if(!year)year=1901;
|
||||
if(dom=="")return false;
|
||||
domid=dom.attr("id");
|
||||
var dt = new Date();
|
||||
current_year=dt.getFullYear();
|
||||
var dthtml="Year: <select name='"+domid+"_year'>";
|
||||
for(i=current_year;i>=year;i--){
|
||||
dthtml+="<option value='"+i+"'>"+i+"</option>";
|
||||
}
|
||||
dthtml+="</select> Date: <select name='"+domid+"_date'>";
|
||||
for(i=1;i<=31;i++){
|
||||
if(i<10)
|
||||
dthtml+="<option value='0"+i+"'>"+i+"</option>";
|
||||
else
|
||||
dthtml+="<option value='"+i+"'>"+i+"</option>";
|
||||
}
|
||||
dthtml+="</select> Month: <select name='"+domid+"_month'>";
|
||||
var months= Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
||||
for(i=1;i<12;i++){
|
||||
if(i<10)
|
||||
dthtml+="<option value='0"+i+"'>"+months[i]+"</option>";
|
||||
else
|
||||
dthtml+="<option value='"+i+"'>"+months[i]+"</option>";
|
||||
}
|
||||
dthtml+="</select>";
|
||||
dom.html(dthtml);
|
||||
},
|
||||
|
||||
//loading overlay around a dom...
|
||||
loadingWrapper : function(dom, display){
|
||||
if(display){
|
||||
dom.prepend("<div id='loading_wrapper' class='loading'></div>");
|
||||
$rss("#loading_wrapper").height(dom.height());
|
||||
$rss("#loading_wrapper").width(dom.width());
|
||||
}else{
|
||||
domId=dom.attr("id");
|
||||
$rss("#"+domId+" #loading_wrapper").remove();
|
||||
}
|
||||
},
|
||||
|
||||
//validating a dom....
|
||||
validate : function(dom, validation, errormsg){
|
||||
var domValue = dom.val();
|
||||
var error = false;
|
||||
var regex="";
|
||||
var msg = "";
|
||||
switch(validation){
|
||||
case "required":
|
||||
if(domValue=="")error=true;
|
||||
msg="Cannot be empty.";
|
||||
break;
|
||||
case "email":
|
||||
regex=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
||||
msg="Invalid Email Address.";
|
||||
break;
|
||||
case "number":
|
||||
regex=/^\d*[0-9](|.\d*[0-9]|,\d*[0-9])?$/;
|
||||
msg = "Only numbers are accepted.";
|
||||
break;
|
||||
case "alphanumeric":
|
||||
regex=/^\s*[a-zA-Z0-9,\s]+\s*$/;
|
||||
msg="Only numbers, alphabets and spaces are allowed.";
|
||||
break;
|
||||
}
|
||||
domId=dom.attr("name");
|
||||
if(errormsg=="")errormsg=msg;
|
||||
if(regex!="")if(!regex.test(domValue))error=true;
|
||||
if(error){$rss("#"+domId+"_error").remove();dom.after("<span id='"+domId+"_error' class='error'>"+errormsg+"</span>");return false;} else{ $rss("#"+domId+"_error").remove();return true;}
|
||||
},
|
||||
|
||||
bindToSpinner : function(dom,data,callbackFn){
|
||||
var domId = dom.attr("id");
|
||||
var dhtml="";
|
||||
var spinnerValue=Array();
|
||||
var spinnerDisplay=Array();
|
||||
$rss.each(data,function(i,it){
|
||||
$rss.each(data[i],function(key,it){
|
||||
spinnerValue.push(it);
|
||||
});
|
||||
});
|
||||
dhtml="<select name='"+domId+"'>";
|
||||
for(i=0,y=1,z=0;i<spinnerValue.length/2;i++,y+=2,z+=2){
|
||||
dhtml+="<option value='"+spinnerValue[z]+"'>"+spinnerValue[y]+"</option>";
|
||||
}
|
||||
dhtml+="</select>";
|
||||
dom.html(dhtml);
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this, dhtml);
|
||||
},
|
||||
|
||||
//binds the recieved json to a table
|
||||
bindToTable : function(dom,data,headers,actions,css_class,callbackFn){
|
||||
if(!css_class)css_class="";
|
||||
var dhtml="<table width='100%' cellpadding='5' cellspacing='5' class='"+css_class+"' ><thead><tr>";
|
||||
var domId = dom.attr("id");
|
||||
if(actions){
|
||||
var btnTitles=Array();
|
||||
var btnFunctions=Array();
|
||||
$rss.each(actions,function(title,func){
|
||||
btnTitles.push(title);
|
||||
btnFunctions.push(func);
|
||||
});
|
||||
rcom.translate(btnTitles,function(convertedData){
|
||||
btnTitles=convertedData.slice();
|
||||
|
||||
rcom.translate(headers,function(convertedData){
|
||||
headers=convertedData;
|
||||
if(!data)return;
|
||||
$rss.each(headers,function(i,head){
|
||||
dhtml+="<th>"+head+"</th>";
|
||||
});
|
||||
dhtml+="</thead></tr>";
|
||||
if(data.length==0)dhtml+="<tr><td colspan='"+headers.length+"' align='center'>No Data</td></tr>";
|
||||
$rss.each(data,function(i,item){
|
||||
var cl="";
|
||||
if(i%2!=0)cl="even";
|
||||
dhtml+="<tr id='"+domId+"_"+item.id+"' class='"+cl+"'>";
|
||||
$rss.each(item,function(i,it){
|
||||
if(i!="id"){
|
||||
if(it==null)it="Not Set";
|
||||
dhtml+="<td align='center'>"+it+"</td>";
|
||||
}
|
||||
})
|
||||
dhtml+="<td align='center'>";
|
||||
for(x=0;x<btnTitles.length;x++){
|
||||
dhtml+="<button onclick='"+btnFunctions[x]+"("+item.id+")'>"+btnTitles[x]+"</button>";
|
||||
}
|
||||
dhtml+="</td>";
|
||||
dhtml+="</tr>";
|
||||
});
|
||||
dhtml+="</table>";
|
||||
dom.html(dhtml);
|
||||
});
|
||||
});
|
||||
}else{
|
||||
rcom.translate(headers,function(convertedData){
|
||||
headers=convertedData;
|
||||
if(!data)return;
|
||||
if(headers.length>0){
|
||||
$rss.each(headers,function(i,head){
|
||||
dhtml+="<th>"+head+"</th>";
|
||||
});
|
||||
}
|
||||
dhtml+="</thead></tr>";
|
||||
if(data.length==0)dhtml+="<tr><td colspan='"+headers.length+"' align='center'>No Data</td></tr>";
|
||||
|
||||
$rss.each(data,function(i,item){
|
||||
var cl="";
|
||||
if(i%2!=0)cl="even";
|
||||
dhtml+="<tr id='"+domId+"_"+item.id+"' class='"+cl+"'>";
|
||||
$rss.each(item,function(i,it){
|
||||
if(i!="id"){
|
||||
if(it==null)it="Not Set";
|
||||
dhtml+="<td align='center'>"+it+"</td>";
|
||||
}
|
||||
})
|
||||
dhtml+="</tr>";
|
||||
});
|
||||
dhtml+="</table>";
|
||||
dom.html(dhtml);
|
||||
});
|
||||
}
|
||||
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this, dhtml);
|
||||
},
|
||||
//convert to date string which can be directly inserted in database or according to any format.
|
||||
convertToInsertableDate : function(y,m,d,format){
|
||||
var dt="";
|
||||
if(m<10)m="0"+m;
|
||||
if(d<10)d="0"+d;
|
||||
switch(format){
|
||||
case "yyyy-mm-dd":
|
||||
dt= y+"-"+m+"-"+d;
|
||||
break;
|
||||
case "dd-mm-yyyy":
|
||||
dt= d+"-"+m+"-"+y;
|
||||
break;
|
||||
case "mm-dd-yyyy":
|
||||
dt= m+"-"+d+"-"+y;
|
||||
break;
|
||||
default:
|
||||
dt= y+"-"+m+"-"+d;
|
||||
break;
|
||||
}
|
||||
return dt;
|
||||
},
|
||||
//a fucntion to show specific divs and hide all other
|
||||
showDoms : function(doms){
|
||||
$rss("body").find("div").each(function(){$rss(this).hide();});
|
||||
$rss.each(doms,function(i,dom){
|
||||
dom.show();
|
||||
});
|
||||
},
|
||||
|
||||
//a function to translate the word or array..
|
||||
translate : function(data,callbackFn){
|
||||
var cdata="";
|
||||
var status =true;
|
||||
if(!data){
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,cdata);
|
||||
status=false;
|
||||
}
|
||||
if(data==""){
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,cdata);
|
||||
status=false;
|
||||
}
|
||||
if(status){
|
||||
$rss.getJSON("../../classes/translate.php", {fn:"translateThis",tData:data},function(convertedData){
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this, convertedData);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// a function to bind JSON to list
|
||||
bindToList : function(dom,data,callbackFn){
|
||||
var domId = dom.attr("id");
|
||||
var dhtml="";
|
||||
var listValue=Array();
|
||||
var listDisplay=Array();
|
||||
$rss.each(data,function(i,it){
|
||||
$rss.each(data[i],function(key,it){
|
||||
listValue.push(it);
|
||||
});
|
||||
});
|
||||
dhtml="<ul id='"+domId+"_list'>";
|
||||
for(i=0,y=1,z=0;i<listValue.length/2;i++,y+=2,z+=2){
|
||||
dhtml+="<li id='li_"+listValue[z]+"'>"+listValue[y]+"</li>";
|
||||
}
|
||||
dhtml+="</ul>";
|
||||
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="<span class='"+settings.nameClass+"'>"+temp_array[3]+"</span></div>"
|
||||
}
|
||||
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="<div class='"+settings.divClass+"' id='img_holder_"+temp_array[0]+"' ><a href='"+a_var[0]+"' "+a_var[1]+" title='"+title+"'><img id='pic_"+temp_array[0]+"' style='display:none' src='"+settings.imageSrc+temp_array[1]+"' /></a>"+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('<div class="rgmask" id="rgsheath" style="height:'+rgmaskHeight+'px"></div>');
|
||||
$rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.9,'z-index':199});
|
||||
$rss("body").append('<div id="rgWindow"></div>');
|
||||
$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='<a href="" style="display:block; width:28px; height:28px; line-height:28px; text-align:center; position:absolute; right:6px; top: 6px; font-family:Tahoma; font-weight:bold; border:solid 1px #ccc; border-radius: 15px;text-shadow:1px 1px 0 #fff; background:#f6f6f6; font-size:14px; text-decoration:none; color:#666" id="close_modal">X</a>';
|
||||
$rss("#rgWindow").animate({"width":tempwidth+"px","height":tempheight+"px",top:rgWTop+"px", left:rgWLeft+"px"},500,function(){$rss("#rgWindow").html(closebtn+"<div id='rgContent' style='overflow:auto; overflow-x:none; height:"+tempheight+"px;'>"+dhtml+"</div>");
|
||||
$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("<div id='rss_progressbar_div_"+domid+"' style='display:none;padding: 2px;background: #333;background: -webkit-linear-gradient(#111, #333);background: -moz-linear-gradient(#111, #333);background: -ms-linear-gradient(#111, #333);position: absolute;top: "+settings.top+"px;left: 50%;margin-left: -45%;width: 84%;box-shadow: inset 0 0 2px #000;border-radius: 4px;'><div id='rss_progressbar_"+domid+"' style='height: 8px; background: #36c;background: -webkit-linear-gradient(#7A98E7, #36c);background: -moz-linear-gradient(#7A98E7, #36c);background: -ms-linear-gradient(#7A98E7, #36c);border-radius: 2px; width: "+settings.value+"%;'></div></div>");
|
||||
$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();
|
|
@ -6,4 +6,5 @@
|
|||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require page_edit
|
||||
//= require side_bar_history
|
|
@ -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') );
|
||||
})
|
|
@ -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();
|
||||
}
|
||||
});
|
|
@ -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();
|
||||
});
|
||||
});
|
|
@ -224,7 +224,7 @@ body{
|
|||
.main_list ul {
|
||||
clear:both;
|
||||
}
|
||||
#porfile {
|
||||
#profile {
|
||||
padding-top: 100px;
|
||||
}
|
||||
/*add_buttom*/
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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,9 +66,9 @@ 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -9,13 +9,22 @@ class PagesController < ApplicationController
|
|||
end
|
||||
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
|
||||
render_page ((params[:app_url]+'?inner='+"true" if params[:app_url]))
|
||||
when 'Link'
|
||||
redirect_to "http://#{item[:url]}"
|
||||
end
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -49,4 +49,11 @@ module ApplicationHelper
|
|||
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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Layout < DesignFile
|
||||
include Parser
|
||||
include ParserLayout
|
||||
|
||||
attr_reader :content
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class Info < Attribute
|
||||
|
||||
end
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -1,5 +0,0 @@
|
|||
class UserInfo < UserAttribute
|
||||
|
||||
belongs_to :user
|
||||
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
class UserInfoModel < UserAttributeModel
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
class UserRole < UserAttribute
|
||||
|
||||
belongs_to :user
|
||||
|
||||
end
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
<div class="auth_unit">
|
||||
<%= unit%>
|
||||
<div>
|
|
@ -0,0 +1,32 @@
|
|||
<% content_for :secondary do %>
|
||||
<div id='user_list'>
|
||||
<div class="role_list">
|
||||
<h1>User Role</h1>
|
||||
<ul class="list">
|
||||
<% @roles.each do |role| %>
|
||||
<li class="set_1"><%= link_to content_tag(:span, "Role") %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<h1><%= t('admin.list_app_auths') %></h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('admin.app.name') %></th>
|
||||
<th><%= t('admin.description') %></th>
|
||||
</tr>
|
||||
|
||||
<% @app_auth_data.each do |app| %>
|
||||
<tr>
|
||||
<td><%= app[0][:app_obj].title %></td>
|
||||
<% app[0][:auth_field].each do |unit| %>
|
||||
<td>
|
||||
<%= render :partial => "auth_unit",:locals => {:unit => unit } %>
|
||||
</td>
|
||||
<%end%>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
|
@ -0,0 +1,34 @@
|
|||
<tr id="<%= "attribute_#{attribute_field.id}" if !attribute_field.new_record? %>" class="list_item">
|
||||
<td><%= attribute_field.new_record? ? (f.text_field :key) : attribute_field.key %></td>
|
||||
<td class='select_mulitlingual' style='text-align:center'>
|
||||
<%= f.check_box :locale %>
|
||||
</td>
|
||||
<%= f.fields_for :i18n_variable, (attribute_field.new_record? ? attribute_field.build_i18n_variable : attribute_field.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_field locale, :style => "width:130px" %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<td class='select_type'>
|
||||
<%= f.select :markup, LIST[:markups], {}, {:style => "width:90px"} %>
|
||||
<div <%= attribute_field[:markup].eql?('select') ? nil : "style='display:none'"%>>
|
||||
<%= t('admin.options') %>:
|
||||
<%= f.select "select_list_options", attribute_field.select_list_options, :style => "width:130px" %>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if attribute_field.new_record? %>
|
||||
<a href="#" class="delete"><%= t(:delete) %></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<% if attribute_field.is_built_in? %>
|
||||
<a href="#" class="switch" id="<%= attribute_field.id %>"></a>
|
||||
<%= f.hidden_field :disabled, :value => attribute_field.is_disabled? , :class => 'built_in_state' %>
|
||||
<% else %>
|
||||
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
|
||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
|
@ -0,0 +1,14 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'admin/users/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="profile">
|
||||
<%= form_for @attribute, :url => eval("admin_#{@attribute_type}_path(@attribute)") do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "admin/#{@attribute_type}s/form", :locals => { :f => f, :is_new => false } %>
|
||||
<div class='button_bar'>
|
||||
<%= link_back %>
|
||||
<%= link_to t('update'), "#", :onclick=>"$('#edit_#{@attribute_type}_#{@attribute.id}').submit()" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,39 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'admin/users/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="main_list">
|
||||
<div class="button_bar up">
|
||||
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="<%= @attribute_type %>s"><%= t("admin.#{@attribute_type}") %></td>
|
||||
<td class="action"><%= t('admin.action') %></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @attributes.each do |attribute| %>
|
||||
<tr id="attribute_<%= attribute.id %>" class="have <%= "#{attribute.is_disabled? ? 'disable' : ''}" %>">
|
||||
<td class="<%= @attribute_type %>s <%= attribute.key.downcase %>"><%= attribute.i18n_variable[I18n.locale] %></span>
|
||||
<td class="action">
|
||||
|
||||
<%= link_to t(:edit), eval("edit_admin_#{@attribute_type}_path(attribute)"), :class => 'edit' %>
|
||||
<%= link_to t(:enable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => true})"), :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, :#{@attribute_type} => {:disabled => false})"), :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)"), :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("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,14 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'admin/users/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="profile">
|
||||
<%= form_for @attribute, :url => eval("admin_#{@attribute_type}s_path") do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "admin/#{@attribute_type}s/form", :locals => { :f => f, :is_new => true } %>
|
||||
<div class="button_bar">
|
||||
<%= link_back %>
|
||||
<%= link_to t('create'), "#", :onclick=>"$('#new_#{@attribute_type}').submit()" %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
$("#enable_<%= @attribute.id %>").toggle();
|
||||
$("#disable_<%= @attribute.id %>").toggle();
|
||||
$("#attribute_<%= @attribute.id %>").toggleClass('disable');
|
|
@ -18,7 +18,7 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
<p class="new_file">
|
||||
<%= fields_for "design[" + field_name + "][]", object.send(field_name).build, :index => nil do |f| %>
|
||||
<%= fields_for "design[new_files][" + field_name + "][]", object.send(field_name).build, :index => nil do |f| %>
|
||||
<%= f.file_field :file, :class => "multi_files" %>
|
||||
</p>
|
||||
<% end %>
|
|
@ -0,0 +1,10 @@
|
|||
<h1><%= t('admin.new_design') %></h1>
|
||||
|
||||
<%= form_for :design, :url => admin_designs_path do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
|
||||
<p>
|
||||
<%= f.submit t('create') %> <%= link_back %>
|
||||
</p>
|
||||
<% end %>
|
|
@ -1,6 +1,6 @@
|
|||
<h1><%= t('admin.editing_design') %></h1>
|
||||
|
||||
<%= form_for @design, :url => admin_design_path(@design) do |f| %>
|
||||
<%= form_for @design, :url => admin_design_path(@design),:html => {:multipart => true} do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
<p>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="main2">
|
||||
<h1><%= t('admin.new_design') %></h1>
|
||||
|
||||
<%= form_for :design, :url => admin_designs_path do |f| %>
|
||||
<%= form_for :design, :url => admin_designs_path, :html => {:multipart => true} do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
rcom.modalWindow({loadHtml:"<%= escape_javascript(render(:partial => 'new')) %>"});
|
|
@ -0,0 +1,3 @@
|
|||
<%= f.fields_for :attribute_fields, attribute_field do |f| %>
|
||||
<%= render :partial => 'admin/attributes/attribute_field', :object => attribute_field, :locals => {:f => f} %>
|
||||
<% end %>
|
|
@ -0,0 +1,70 @@
|
|||
<div class="attributes_block <%= @class %>">
|
||||
<h2><%= t("admin.#{@attribute_type}") %></h2>
|
||||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="list_item">
|
||||
<td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %></td>
|
||||
<%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_field locale, :style => "width:150px" %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="attributes_block <%= @class %>">
|
||||
<h2>Attributes</h2>
|
||||
<div class="info_input">
|
||||
<table id='attributes' border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<td><%= t('admin.multilingual') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
<td><%= t('admin.type')%></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<%= hidden_field_tag 'attribute_field_count', @attribute.attribute_fields.count %>
|
||||
<a href="#" class="add"><%= t(:add) %></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<% @attribute.attribute_fields.each do |attribute_field| %>
|
||||
<%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "attribute_form" %>
|
||||
<script>
|
||||
$('.attributes_block a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_attribute_fields", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$('#attributes').append(("<%= escape_javascript(add_attribute 'admin/attributes/attribute_field', f, :attribute_fields) %>").replace(old_id, new_id));
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
|
@ -0,0 +1 @@
|
|||
<%= f.select :module_app, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>
|
|
@ -0,0 +1 @@
|
|||
$('#app_page_url').html("<%= escape_javascript(select 'page','app_frontend_url', @module_app.app_pages) %>");
|
|
@ -30,8 +30,13 @@
|
|||
<%= f.select :theme_id, @default_design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= t('admin.module_app') %>
|
||||
<%= render :partial => "admin/module_apps/app_selector", :locals => { :f => f } %>
|
||||
<span id="app_page_url"></span>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
|
||||
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
|
||||
</p>
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
<%= flash_messages %>
|
||||
|
||||
<%= parse_page_edit(@item).html_safe %>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "page_edit" %>
|
||||
<% end -%>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<%= f.fields_for :attribute_fields, attribute_field do |f| %>
|
||||
<%= render :partial => 'admin/attributes/attribute_field', :object => attribute_field, :locals => {:f => f} %>
|
||||
<% end %>
|
|
@ -0,0 +1,50 @@
|
|||
<div class="attributes_block <%= @class %>">
|
||||
<h2><%= t("admin.#{@attribute_type}") %></h2>
|
||||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="list_item">
|
||||
<td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %></td>
|
||||
<%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_field locale, :style => "width:150px" %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id='sub_roles' class="attributes_block <%= @class %>">
|
||||
<h2>Sub roles</h2>
|
||||
<% @attribute.sub_roles.each_with_index do |sub_role, i| %>
|
||||
<%= render :partial => 'form_sub', :object => sub_role, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id='add_sub_role' class="info_input attributes_block">
|
||||
<%= hidden_field_tag 'attribute_field_count', @attribute.sub_roles.count %>
|
||||
<a href="#" class="add"><%= t(:add) %></a>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "attribute_form" %>
|
||||
<script>
|
||||
$('#add_sub_role a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_sub_roles", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$('#sub_roles').append(("<%= escape_javascript(add_attribute 'admin/roles/sub_role', f, :sub_roles) %>").replace(old_id, new_id));
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
|
@ -0,0 +1,3 @@
|
|||
<%= f.fields_for :sub_roles, form_sub do |f| %>
|
||||
<%= render :partial => 'sub_role', :object => form_sub, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
|
@ -0,0 +1,68 @@
|
|||
|
||||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="list_item">
|
||||
<td><%= sub_role.new_record? ? (f.text_field :key, {:style => "width:150px"}) : sub_role.key %></td>
|
||||
<%= f.fields_for :i18n_variable, (sub_role.new_record? ? sub_role.build_i18n_variable : sub_role.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_field locale, :style => "width:150px" %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="attributes_block <%= @class %>">
|
||||
<h2>Attributes</h2>
|
||||
<div class="info_input">
|
||||
<table class="sub_role_attributes" border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<td><%= t('admin.multilingual') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
<td><%= t('admin.type')%></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td id='add_attribute' colspan="5">
|
||||
<%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %>
|
||||
<a href="#" class="add"><%= t(:add) %></a>
|
||||
<%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<% sub_role.attribute_fields.each do |attribute_field| %>
|
||||
<%= render :partial => 'attribute_field', :object => attribute_field, :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script>
|
||||
$('#add_attribute a.add').live('click', function(){
|
||||
var new_parent_id = $(this).next().attr('value');
|
||||
var old_parent_id = new RegExp("new_sub_roles", "g");
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_attribute_fields", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'admin/attributes/attribute_field', f, :attribute_fields) %>").replace(old_id, new_id).replace(old_parent_id, new_parent_id));
|
||||
});
|
||||
</script>
|
||||
<% end unless !sub_role.new_record? %>
|
|
@ -1,36 +0,0 @@
|
|||
<%= fields_for "user_#{@attribute}_model[attribute_models][]", attribute_model, :index => nil do |f| %>
|
||||
<tr class="list_item">
|
||||
<td><%= attribute_model.new_record? ? (f.text_field :key) : attribute_model.key %></td>
|
||||
<td class='select_mulitlingual' style='text-align:center'>
|
||||
<%= check_box_tag "locale[]", value = '', attribute_model.locale.nil? ? true : attribute_model.locale %>
|
||||
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][locale]", attribute_model.locale.nil? ? true : attribute_model.locale %>
|
||||
</td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= text_field_tag "user_#{@attribute}_model[attribute_models][][i18n_variable][#{locale}]", (attribute_model.i18n_variable[locale] rescue nil), :style => "width:130px" %></td>
|
||||
<% end %>
|
||||
<td class='select_type'>
|
||||
<%= f.select :markup, LIST[:markups], {}, {:style => "width:90px"} %>
|
||||
<div <%= attribute_model[:markup].eql?('select') ? nil : "style='display:none'"%>>
|
||||
<%= t('admin.options') %>:
|
||||
<%= text_field_tag "user_#{@attribute}_model[attribute_models][][select_list_options]", attribute_model.select_list_options, :style => "width:130px" %>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if attribute_model.new_record? %>
|
||||
<a href="#" class="delete"><%= t(:delete) %></a>
|
||||
<% else %>
|
||||
<% if attribute_model.is_built_in? %>
|
||||
<a href="#" class="change_built_in switch" id="<%= attribute_model.id %>"></a>
|
||||
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][disabled]", attribute_model.is_disabled? , :class => 'built_in_state' %>
|
||||
<% else %>
|
||||
<a href="#" class="remove_existing_record delete"><%= t(:delete) %></a>
|
||||
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][should_destroy]", nil , :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= f.hidden_field :key %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
|
@ -1,57 +0,0 @@
|
|||
<div id="UserRole_block" class="roles_block <%= @class %>">
|
||||
<h2><%= t("admin.user_#{@attribute}") %></h2>
|
||||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="list_item">
|
||||
<td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @user_attribute_model.key %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<%= text_field_tag "user_#{@attribute}_model[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:150px" %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="attributes_block" class="roles_block <%= @class %>">
|
||||
<h2>Attributes</h2>
|
||||
<div class="info_input">
|
||||
<table id='attributes' border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t('admin.key') %></td>
|
||||
<td><%= t('admin.multilingual') %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
<td><%= t('admin.type')%></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5"><a href="#" class="add"><%= t(:add) %></a></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<%= render :partial => 'admin/user_attribute_models/attribute_model', :collection => @user_attribute_model.attribute_models %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "user_attribute_model_form" %>
|
||||
<% end -%>
|
|
@ -1,31 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title><%= @title || APP_CONFIG['orbit'] %></title>
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<%= stylesheet_link_tag "admin" %>
|
||||
<%= javascript_include_tag "admin" %>
|
||||
<%= yield :page_specific_css %>
|
||||
<%= yield :page_specific_javascript %>
|
||||
<%= csrf_meta_tag %>
|
||||
</head>
|
||||
<body>
|
||||
<div id="panel_banner_link" >
|
||||
<div id="orbit"><%= render 'layouts/drop_down_menu' %></div>
|
||||
<div class="hmenu">
|
||||
<div class="lang"><%= render 'layouts/lang_menu' %></div>
|
||||
<%= render 'devise/menu/login_items' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<div id="sidebar"><%= yield :secondary %></div>
|
||||
<div class="main">
|
||||
<%= yield %>
|
||||
</div>
|
||||
<div class="tertiary"><%= yield :tertiary %></div>
|
||||
<div id="panel_footer"><p><%= APP_CONFIG['ruling_digital'] %></p></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,14 +0,0 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'admin/users/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="porfile" class="clear">
|
||||
<%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_model_path(@user_role_model)") do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => false } %>
|
||||
<div class="button_bar">
|
||||
<%= link_to t('update'), "#", :onclick=>"$('#edit_user_role_model_#{@user_attribute_model.id}').submit()" %>
|
||||
<%= link_back %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
|
@ -1,14 +0,0 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="porfile">
|
||||
<%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<div class="button_bar">
|
||||
<%= link_back %>
|
||||
<%= link_to t('update'), "#", :onclick=>"$('#edit_user_#{@user.id}').submit()" %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
|
@ -1,41 +0,0 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'admin/users/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="main_list clear">
|
||||
<div class="button_bar up">
|
||||
<%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path"), :class => 'new' %>
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="<%= @attribute %>s"><%= t("admin.#{@attribute}") %></td>
|
||||
<td class="action"><%= t('admin.action') %></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @user_attribute_models.each do |user_attribute_model| %>
|
||||
<tr id="attribute_<%= user_attribute_model.id %>" class="have <%= "#{user_attribute_model.is_disabled? ? 'disable' : ''}" %>">
|
||||
<td class="<%= @attribute %>s <%= user_attribute_model.i18n_variable[:key].downcase %>"><%= user_attribute_model.i18n_variable[I18n.locale] %></td>
|
||||
<td class="action">
|
||||
<%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'edit' %>
|
||||
<% if user_attribute_model.is_built_in? %>
|
||||
<%= link_to t(:enable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'none' : ''}", :class => 'switch' %>
|
||||
<%= link_to t(:disable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? '' : 'none'}", :class => 'switch' %>
|
||||
<% else %>
|
||||
<%= link_to t(:enable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'none' : ''}", :class => 'switch' %>
|
||||
<%= link_to t(:disable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? '' : 'none'}", :class => 'switch' %>
|
||||
<%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :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("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path"), :class => 'new' %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,18 +0,0 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'admin/users/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="porfile" class="clear">
|
||||
<%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_models_path") do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => true } %>
|
||||
<div class="button_bar">
|
||||
<%= link_back %>
|
||||
<%= link_to t('create'), "#", :onclick=>"$('#new_user_attribute_model').submit()" %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
$("#enable_<%= @user_attribute_model.id %>").toggle();
|
||||
$("#disable_<%= @user_attribute_model.id %>").toggle();
|
||||
$("#attribute_<%= @user_attribute_model.id %>").toggleClass('disable');
|
|
@ -1,32 +0,0 @@
|
|||
<p>
|
||||
<%= f.label :name %>
|
||||
<%= f.text_field :name %>
|
||||
</p>
|
||||
|
||||
<fieldset>
|
||||
<% @user_attribute.attrs.each_with_index do |attr, i| %>
|
||||
<p>
|
||||
<label><%= attr["key"] %></label>
|
||||
<%= hidden_field_tag "user_attribute[attrs][][key]", attr["key"] %>
|
||||
<%= text_field_tag "user_attribute[attrs][][name]", attr["name"] %>
|
||||
<%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field", "select"], attr["type"]) %>
|
||||
<a href="#" class="remove">(remove)</a>
|
||||
</p>
|
||||
<% end -%>
|
||||
|
||||
<p id="newone">
|
||||
<label>Key</label>
|
||||
<%= text_field_tag "user_attribute[attrs][][key]", "" %>
|
||||
<label>Name</label>
|
||||
<%= text_field_tag "user_attribute[attrs][][name]", "" %>
|
||||
<%= select_tag "user_attribute[attrs][][type]", options_for_select(["text_field"], "") %>
|
||||
<a href="#" class="remove">(remove)</a>
|
||||
</p>
|
||||
|
||||
<a href="#" class="add">(add)</a>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "user_attribute_form" %>
|
||||
<% end -%>
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
<h1>Editing user attribute: <%= @user_attribute.key %></h1>
|
||||
|
||||
<% form_for @user_attribute, :url => admin_user_attribute_path(@user_attribute) do |f| %>
|
||||
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
|
||||
<p>
|
||||
<%= f.submit %>
|
||||
</p>
|
||||
|
||||
<% end -%>
|
|
@ -1,34 +0,0 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render 'admin/users/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="main_list">
|
||||
<div id="add_new" class="buttom clear">
|
||||
<%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path") %>
|
||||
</div>
|
||||
<ul>
|
||||
<li class="list_head clear">
|
||||
<span class="<%= @attribute %>s"><%= t("admin.#{@attribute}") %></span>
|
||||
<span class="action"><%= t('admin.action') %></span>
|
||||
</li>
|
||||
<% @user_attribute_models.each do |user_attribute_model| %>
|
||||
<li id="attribute_<%= user_attribute_model.id %>" class="list_item <%= "#{user_attribute_model.is_disabled? ? 'disable' : ''}" %> clear">
|
||||
<span class="<%= @attribute %>s <%= user_attribute_model.i18n_variable[:key].downcase %>"><%= user_attribute_model.i18n_variable[I18n.locale] %></span>
|
||||
<span class="action">
|
||||
|
||||
<%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'edit' %>
|
||||
<% if user_attribute_model.is_built_in? %>
|
||||
<%= link_to t(:enable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'none' : ''}", :class => 'switch' %>
|
||||
<%= link_to t(:disable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? '' : 'none'}", :class => 'switch' %>
|
||||
<% else %>
|
||||
<%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
|
||||
<% end %>
|
||||
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div id="add_new" class="buttom clear">
|
||||
<%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path") %>
|
||||
</div>
|
||||
</div>
|
|
@ -1,16 +0,0 @@
|
|||
<h1>New user attribute: <%= @user_attribute.key %></h1>
|
||||
|
||||
<% form_for @user_attribute, :url => admin_user_attributes_path do |f| %>
|
||||
|
||||
<p>
|
||||
<%= f.label :key, "Key" %>
|
||||
<%= f.text_field :key %>
|
||||
</p>
|
||||
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
|
||||
<p>
|
||||
<%= f.submit %>
|
||||
</p>
|
||||
|
||||
<% end -%>
|
|
@ -16,28 +16,21 @@
|
|||
</label>
|
||||
<label>
|
||||
<span><%= t('admin.role') %>:</span>
|
||||
<%= f.select :active_role, @user_role_models.sort_by{|role| role.key }.collect {|role| [ role.i18n_variable[I18n.locale], role.key ]}, :selected => (@user.active_role || 'student') %>
|
||||
<%= f.select :role_id, @roles.sort_by{|role| role.key }.collect {|role| [ role.i18n_variable[I18n.locale], role.id ]}, :selected => (@user.role_id || Role.get_role_from_key('student')) %>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<% @user_info_models.each do |ua| %>
|
||||
<div id="basic_block" class="roles_block <%= @class %>">
|
||||
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
||||
<hr>
|
||||
<%= render :partial => 'user_attribute',
|
||||
:object => (@user.user_infos.detect {|u| u.key == ua.key } || @user.user_infos.build),
|
||||
:locals => {:ua => ua, :type => 'info'} %>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<div id='role_models'>
|
||||
<% @user_role_models.each do |ua| %>
|
||||
<div id="<%= ua.key %>_block" class="roles_block <%= @class %>" <%= raw(' style="display: none;"') unless ((@user.active_role.eql?(ua.key) rescue nil) || (ua.key.eql?('student') && @user.new_record?)) %>>
|
||||
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
||||
<%= render :partial => 'info', :collection => @infos, :locals => {:f => f} %>
|
||||
|
||||
|
||||
<div id='roles'>
|
||||
<% @roles.each do |role| %>
|
||||
<div id="<%= role.id %>_block" class="attributes_block <%= @class %>" <%= raw(' style="display: none;"') unless ((@user.role.id.eql?(role.id) rescue nil) || (role.key.eql?('student') && @user.new_record?)) %>>
|
||||
<h2><%= role.i18n_variable[I18n.locale] %></h2>
|
||||
<hr>
|
||||
<%= render :partial => 'user_attribute',
|
||||
:object => (@user.user_roles.detect {|u| u.key == ua.key } || @user.user_roles.build),
|
||||
:locals => {:ua => ua, :type => 'role'} %>
|
||||
<%= render :partial => 'sub_role_selector', :locals => {:f => f, :role => role} %>
|
||||
<%= render :partial => 'sub_role', :collection => role.sub_roles, :locals => {:f => f, :role => role} %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<div id="basic_block" class="attributes_block <%= @class %>">
|
||||
<h2><%= info.i18n_variable[I18n.locale] %></h2>
|
||||
<hr>
|
||||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t("admin.key") %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% info.get_enabled_attribute_fields.each do |attr| %>
|
||||
<%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %>
|
||||
<tr class="list_item">
|
||||
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
||||
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_field locale %></td>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<td colspan=<%= @site_valid_locales.size %>>
|
||||
<% if attr["markup"] == "text_field" %>
|
||||
<%= f.text_field :non_locale %>
|
||||
<% elsif attr["markup"] == "select" %>
|
||||
<%= f.select :non_locale, options_for_select(attr["options"], value['non_locale']) %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<% end -%>
|
||||
<%= f.hidden_field :attribute_field_id, :value => attr.id %>
|
||||
<%= f.hidden_field :key, :value => attr.key %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,26 @@
|
|||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<td><%= t("admin.key") %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% show_attribute.get_enabled_attribute_fields.each do |attr| %>
|
||||
<tr class="list_item">
|
||||
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
||||
<%= show_attribute(@user, attr.id, locale) %>
|
||||
<% else %>
|
||||
<%= show_attribute(@user, attr.id) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<div id="sub_role_<%= show_sub_role.id %>" class="info_input">
|
||||
<h2><%= show_sub_role.i18n_variable[I18n.locale] %></h2>
|
||||
<%= render :partial => 'show_attribute', :object => show_sub_role %>
|
||||
</div>
|
|
@ -1,27 +0,0 @@
|
|||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<td><%= t("admin.key") %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% am.get_enabled_attribute_models.each do |attr| %>
|
||||
<tr class="list_item">
|
||||
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
||||
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
||||
<%= show_user_attribute(object, attr.key, locale) %>
|
||||
<% else %>
|
||||
<%= show_user_attribute(object, attr.key) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -2,10 +2,10 @@
|
|||
<input id="user_search" name="user[username]" size="30" type="text" />
|
||||
</div>
|
||||
<div class="member_setup <%= @class %>">
|
||||
<h1><%= t('admin.setup_member') %></h1>
|
||||
<ul class="list">
|
||||
<h1><%= t('admin.setup_member') %></h1>
|
||||
<ul class="list">
|
||||
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
|
||||
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||
<li class="set_3"><%= link_to content_tag(:span, t('admin.list_user_infos')), admin_user_info_models_path %></li>
|
||||
</ul>
|
||||
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_roles')), admin_roles_path %></li>
|
||||
<li class="set_3"><%= link_to content_tag(:span, t('admin.list_infos')), admin_infos_path %></li>
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,37 @@
|
|||
<div id="sub_role_<%= sub_role.id %>" class="info_input" <%= raw(' style="display: none;"') unless @user.sub_role_ids.include?(sub_role.id) %>>
|
||||
<h2><%= sub_role.i18n_variable[I18n.locale] %></h2>
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t("admin.key") %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% sub_role.get_enabled_attribute_fields.each do |attr| %>
|
||||
<%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %>
|
||||
<tr class="list_item">
|
||||
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
||||
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= f.text_field locale %></td>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<td colspan=<%= @site_valid_locales.size %>>
|
||||
<% if attr["markup"] == "text_field" %>
|
||||
<%= f.text_field :non_locale %>
|
||||
<% elsif attr["markup"] == "select" %>
|
||||
<%= f.select :non_locale, options_for_select(attr["options"], value['non_locale']) %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<% end -%>
|
||||
<%= f.hidden_field :attribute_field_id, :value => attr.id %>
|
||||
<%= f.hidden_field :key, :value => attr.key %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<% role.sub_roles.each do |sub_role| %>
|
||||
<%= sub_role.i18n_variable[I18n.locale] %>
|
||||
<%= check_box_tag "user[sub_role_ids][]", sub_role.id, @user.sub_role_ids.include?(sub_role.id), :class => 'sub_role_select' %>
|
||||
<% end %>
|
|
@ -1,44 +0,0 @@
|
|||
<%= fields_for "user[user_#{type}s]", user_attribute, :index => nil do |f| %>
|
||||
<%= f.hidden_field :key, :value => ua.key %>
|
||||
<%= f.hidden_field :id unless user_attribute.new_record? %>
|
||||
|
||||
<div class="info_input">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<thead class="list_head">
|
||||
<tr>
|
||||
<td><%= t("admin.key") %></td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% ua.get_enabled_attribute_models.each do |attr| %>
|
||||
<% value = user_attribute.attribute_values.detect{|v| v.key == attr.key } %>
|
||||
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][id]", value.id rescue nil %>
|
||||
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][key]", attr.key %>
|
||||
<tr class="list_item">
|
||||
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
||||
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
||||
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", nil %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<%= text_field_tag "user[user_#{type}s][][attribute_values][][#{locale}]", (value[locale] rescue nil) %>
|
||||
</td>
|
||||
<% end -%>
|
||||
<% else %>
|
||||
<td colspan=<%= @site_valid_locales.size %>>
|
||||
<% if attr["markup"] == "text_field" %>
|
||||
<%= text_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", (value['non_locale'] rescue nil) %>
|
||||
<% elsif attr["markup"] == "select" %>
|
||||
<%= select_tag "user[user_#{type}s][][attribute_values][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<% end -%>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% end %>
|
|
@ -2,7 +2,7 @@
|
|||
<%= render 'side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="porfile" class="clear">
|
||||
<div id="profile" class="clear">>
|
||||
<%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<% @users.each do |user| %>
|
||||
<% active_role = UserRoleModel.get_role_model_from_key(user.active_role) %>
|
||||
<tr class="have">
|
||||
<td class="roles <%= active_role.key.downcase rescue nil %>"><%= active_role.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td class="roles <%= user.role.key.downcase rescue nil %>"><%= user.role.i18n_variable[I18n.locale] rescue nil %></td>
|
||||
<td class="name"><%= user.name ? user.name : 'bob' %></td>
|
||||
<td class="email"><%= user.email %></td>
|
||||
<td class="admin"><%= user.admin ? t(:yes_) : t(:no_) %></td>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<%= render 'side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="porfile" class="clear">
|
||||
<div id="profile" class="clear">
|
||||
<%= form_for @user, :url => admin_users_path, :html => { :multipart => true } do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<%= render 'side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<div id="porfile" class="clear">
|
||||
<div id="profile" class="clear">
|
||||
|
||||
<div id="person">
|
||||
<% if @user.avatar? %>
|
||||
|
@ -10,21 +10,20 @@
|
|||
<% else %>
|
||||
<%= image_tag "person.png" %>
|
||||
<% end %>
|
||||
<label><span><%= @user.email %></span></label>
|
||||
</div>
|
||||
|
||||
<% @user_info_models.each do |am| %>
|
||||
<% @infos.each do |a| %>
|
||||
<div id="basic_block" class="roles_block <%= @class %>">
|
||||
<h2><%= am.i18n_variable[I18n.locale] %></h2>
|
||||
<h2><%= a.i18n_variable[I18n.locale] %></h2>
|
||||
<hr>
|
||||
<%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_info_from_model_key(am.key)} %>
|
||||
<%= render :partial => 'show_attribute', :object => a %>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<div id="<%= @user.active_role %>_block" class="roles_block <%= @class %>">
|
||||
<% active_role = UserRoleModel.get_role_model_from_key(@user.active_role) %>
|
||||
<h2><%= active_role.i18n_variable[I18n.locale] %></h2>
|
||||
<div id="<%= @user.role.key %>_block" class="roles_block <%= @class %>">
|
||||
<h2><%= @user.role.i18n_variable[I18n.locale] %></h2>
|
||||
<hr>
|
||||
<%= render :partial => 'show_user_attribute', :locals => {:am => active_role, :object => @user.get_role_from_model_key(active_role.key)} %>
|
||||
<%= render :partial => 'show_sub_role', :collection => @user.sub_roles %>
|
||||
</div>
|
||||
<div class="button_bar">
|
||||
<%= link_to t(:edit), edit_admin_user_path(@user) %>
|
||||
|
|
|
@ -15,9 +15,10 @@ Bundler.require *Rails.groups(:assets) if defined?(Bundler)
|
|||
module PrototypeR4
|
||||
class Application < Rails::Application
|
||||
|
||||
# config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/built_in_modules"])
|
||||
# config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/downloaded_modules"])
|
||||
# config.paths.vendor.plugins.instance_variable_set("@paths", config.paths.vendor.plugins.instance_variable_get("@paths") + ["#{config.root}/vendor/radius"])
|
||||
# Add directories for plugins
|
||||
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
|
||||
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules)
|
||||
|
||||
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
|
@ -26,7 +27,8 @@ module PrototypeR4
|
|||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
# config.autoload_paths += %W(#{config.root}/extras)
|
||||
config.autoload_paths += %W(#{config.root}/lib)
|
||||
config.autoload_paths += %W( #{config.root}/app/models/ckeditor )
|
||||
config.autoload_paths += %W(#{config.root}/lib/parsers)
|
||||
config.autoload_paths += %W(#{config.root}/app/models/ckeditor )
|
||||
config.autoload_paths += %W(#{config.root}/app/models/design)
|
||||
config.autoload_paths += %W(#{config.root}/app/models/purchase)
|
||||
config.autoload_paths += %W(#{config.root}/app/models/user)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
Module.instance_eval do
|
||||
def using_object_ids?
|
||||
false
|
||||
end
|
||||
end
|
|
@ -1,6 +1,7 @@
|
|||
forbidden_item_names:
|
||||
- admin
|
||||
- panel
|
||||
- appfront
|
||||
|
||||
markups:
|
||||
- text_field
|
||||
|
|
|
@ -55,8 +55,8 @@ en:
|
|||
editing_link: Editing link
|
||||
editing_page: Editing page
|
||||
editing_snippet: Editing snippet
|
||||
editing_user_info: Editing user information
|
||||
editing_user_role: Editing user role
|
||||
editing_info: Editing user information
|
||||
editing_role: Editing user role
|
||||
email: Email
|
||||
enable_language: Enable language
|
||||
file_name: Filename
|
||||
|
@ -78,8 +78,8 @@ en:
|
|||
list_puchases: Purchases list
|
||||
list_snippets: Snippets list
|
||||
list_users: Users list
|
||||
list_user_infos: User information list
|
||||
list_user_roles: User roles list
|
||||
list_infos: User information list
|
||||
list_roles: User roles list
|
||||
member: Member
|
||||
move_down: Move down
|
||||
move_up: Move up
|
||||
|
@ -97,8 +97,8 @@ en:
|
|||
new_page: New page
|
||||
new_snippet: New snippet
|
||||
new_user: New user
|
||||
new_user_info: New user information
|
||||
new_user_role: New user role
|
||||
new_info: New user information
|
||||
new_role: New user role
|
||||
non_multilingual: Non multilingual
|
||||
options: Options
|
||||
orig_upload_file: Original filename
|
||||
|
@ -128,8 +128,8 @@ en:
|
|||
upload_design: Upload design
|
||||
url: URL
|
||||
user: User
|
||||
user_info: User information
|
||||
user_panel: User panel
|
||||
user_role: User role
|
||||
info: User information
|
||||
panel: User panel
|
||||
role: User role
|
||||
|
||||
panel:
|
||||
|
|
|
@ -50,8 +50,8 @@ zh_tw:
|
|||
editing_link: 編輯連結
|
||||
editing_page: 編輯頁面
|
||||
editing_snippet: 編輯片段
|
||||
editing_user_info: 編輯用戶資料
|
||||
editing_user_role: 編輯用戶角色
|
||||
editing_info: 編輯用戶資料
|
||||
editing_role: 編輯用戶角色
|
||||
email: Email
|
||||
enable_language: 啟用語言
|
||||
file_name: 檔名
|
||||
|
@ -73,8 +73,8 @@ zh_tw:
|
|||
list_layouts: 佈局列表
|
||||
list_snippets: 斷片列表
|
||||
list_users: 使用列表
|
||||
list_user_infos: 用戶資料列表
|
||||
list_user_roles: 用戶角色列表
|
||||
list_infos: 用戶資料列表
|
||||
list_roles: 用戶角色列表
|
||||
member: 會員
|
||||
move_down: 往下移
|
||||
move_up: 往上移
|
||||
|
@ -92,8 +92,8 @@ zh_tw:
|
|||
new_page: 新增頁面
|
||||
new_snippet: 新增片段
|
||||
new_user: 新增使用
|
||||
new_user_info: 新增用戶資料
|
||||
new_user_role: 新增用戶角色
|
||||
new_info: 新增用戶資料
|
||||
new_role: 新增用戶角色
|
||||
non_multilingual: 非多種語言
|
||||
options: 選項
|
||||
orig_upload_file: 原上傳檔名
|
||||
|
@ -121,9 +121,9 @@ zh_tw:
|
|||
upload_design: 上傳設計
|
||||
url: URL
|
||||
user: 用戶
|
||||
user_info: 用戶資料
|
||||
user_panel: 用戶面板
|
||||
user_role: 用戶角色
|
||||
info: 用戶資料
|
||||
panel: 用戶面板
|
||||
role: 用戶角色
|
||||
|
||||
panel:
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue