Changes for sub_roles
Issues: update doesn't create new i18n_variables, role form has bugs
This commit is contained in:
parent
d23cf152da
commit
d27d7a623c
|
@ -1,278 +0,0 @@
|
||||||
html, body{
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
html{
|
|
||||||
background: url(<%= asset_path "body.jpg" %>) no-repeat scroll 0 0 transparent;
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
body{
|
|
||||||
color: #000000;
|
|
||||||
font-family: Helvetica, '微軟正黑體';
|
|
||||||
}
|
|
||||||
|
|
||||||
#panel_banner_link{
|
|
||||||
background: url(<%= asset_path "orbitbar1.png" %>) repeat-x scroll 0 0;
|
|
||||||
height: 50px;
|
|
||||||
left: 0;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 5;
|
|
||||||
}
|
|
||||||
.hmenu{
|
|
||||||
height: 40px;
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: 1px;
|
|
||||||
width: 250px;
|
|
||||||
}
|
|
||||||
#orbit{
|
|
||||||
background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent;
|
|
||||||
cursor:pointer;
|
|
||||||
height: 43px;
|
|
||||||
left: 10px;
|
|
||||||
position: relative;
|
|
||||||
width: 41px;
|
|
||||||
}
|
|
||||||
#orbit:hover{
|
|
||||||
background-position:0 -43px;
|
|
||||||
box-shadow: 0 3px 3px #000000;
|
|
||||||
}
|
|
||||||
#orbit:hover #orblist{
|
|
||||||
display:block;
|
|
||||||
}
|
|
||||||
#orblist{
|
|
||||||
background: none repeat scroll 0 0 #FFFFFF;
|
|
||||||
border-radius: 0 3px 3px 3px;
|
|
||||||
box-shadow: 0 3px 3px #000000;
|
|
||||||
display: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px;
|
|
||||||
position: absolute;
|
|
||||||
top: 43px;
|
|
||||||
width: 130px;
|
|
||||||
}
|
|
||||||
#orblist li{
|
|
||||||
border-bottom:1px solid #aaa;
|
|
||||||
list-style:none;
|
|
||||||
}
|
|
||||||
.orblink{
|
|
||||||
color: #333333;
|
|
||||||
display: block;
|
|
||||||
font: 12px/100% arial,sans-serif;
|
|
||||||
padding: 5px;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.orblink:hover{
|
|
||||||
background:#eee;
|
|
||||||
color:#333;
|
|
||||||
}
|
|
||||||
|
|
||||||
#log_out a{
|
|
||||||
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent;
|
|
||||||
border: medium none !important;
|
|
||||||
display: block !important;
|
|
||||||
height: 40px !important;
|
|
||||||
line-height: normal !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
position: absolute;
|
|
||||||
right: 0px;
|
|
||||||
text-indent: -10000px;
|
|
||||||
top: 0px;
|
|
||||||
width: 43px !important;
|
|
||||||
}
|
|
||||||
#log_out a:hover{
|
|
||||||
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important;
|
|
||||||
}
|
|
||||||
.lang{
|
|
||||||
color: #FFFFFF;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 40px;
|
|
||||||
position: absolute;
|
|
||||||
right: 55px;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lang a{
|
|
||||||
color:#fff;
|
|
||||||
text-decoration:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lang a:hover{
|
|
||||||
text-decoration:underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
#content{
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
#sidebar {
|
|
||||||
background: url(<%= asset_path "75.png" %>) repeat scroll left top transparent;
|
|
||||||
box-shadow: 3px 0 4px #472A12;
|
|
||||||
border-right: 1px solid #121212;
|
|
||||||
height: 100%;
|
|
||||||
left: 0;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
width: 220px;
|
|
||||||
}
|
|
||||||
#search {
|
|
||||||
background: url(<%= asset_path "search_block_bg.jpg" %>) repeat-x scroll left top transparent;
|
|
||||||
height: 20px;
|
|
||||||
margin-top: 43px;
|
|
||||||
padding: 15px 12px;
|
|
||||||
}
|
|
||||||
#search input {
|
|
||||||
background: url(<%= asset_path "search_bg.png" %>) no-repeat scroll left top transparent;
|
|
||||||
border: medium none;
|
|
||||||
font-family: Helvetica;
|
|
||||||
height: 20px;
|
|
||||||
padding: 0 20px;
|
|
||||||
width: 154px;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
background: url(<%= asset_path "h1_bg.png" %>) repeat-x scroll left top transparent;
|
|
||||||
border-bottom: 1px solid #1B1B1B;
|
|
||||||
border-top: 1px solid #424344;
|
|
||||||
color: #FFFFFF;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
height: 21px;
|
|
||||||
line-height: 21px;
|
|
||||||
margin: 0;
|
|
||||||
padding-left: 10px;
|
|
||||||
text-shadow: 0 -1px 0 #000000;
|
|
||||||
}
|
|
||||||
.member_setup .list {
|
|
||||||
color:#fff;
|
|
||||||
font-size:12px;
|
|
||||||
background:url(<%= asset_path "line.png" %>) repeat-x left bottom;
|
|
||||||
}
|
|
||||||
.member_setup .list li {
|
|
||||||
background:url(<%= asset_path "sidebar_li.jpg" %>) repeat-x left top;
|
|
||||||
border-top:1px solid #424344;
|
|
||||||
border-bottom:1px solid #000000;
|
|
||||||
}
|
|
||||||
.member_setup .list li:hover {
|
|
||||||
background-position:left bottom;
|
|
||||||
border-top:1px solid #406cc3;
|
|
||||||
border-bottom:1px solid #242628;
|
|
||||||
}
|
|
||||||
.member_setup .list li a {
|
|
||||||
display: block;
|
|
||||||
padding: 7px 0 6px 12px;
|
|
||||||
color:#c4c4c4;
|
|
||||||
}
|
|
||||||
.member_setup .list li a span {
|
|
||||||
background:url(<%= asset_path "add_mamber.png" %>) left top no-repeat;
|
|
||||||
text-shadow: 0px 1px 0px #000;
|
|
||||||
line-height: 18px;
|
|
||||||
padding: 2px 0 1px 35px;
|
|
||||||
}
|
|
||||||
.member_setup .list li a:hover span {
|
|
||||||
background-position:left bottom;
|
|
||||||
color:#eeeeee;
|
|
||||||
}
|
|
||||||
.users .list .set_1 {
|
|
||||||
background-position:left bottom;
|
|
||||||
border-top:1px solid #406cc3;
|
|
||||||
border-bottom:1px solid #242628;
|
|
||||||
}
|
|
||||||
.users .list .set_1 a span {
|
|
||||||
background-position:left bottom;
|
|
||||||
color:#eeeeee;
|
|
||||||
}
|
|
||||||
.user_role_models .list .set_2 {
|
|
||||||
background-position:left bottom;
|
|
||||||
border-top:1px solid #406cc3;
|
|
||||||
border-bottom:1px solid #242628;
|
|
||||||
}
|
|
||||||
.user_role_models .list .set_2 a span {
|
|
||||||
background-position:left bottom;
|
|
||||||
color:#eeeeee;
|
|
||||||
}
|
|
||||||
.user_info_models .list .set_3 {
|
|
||||||
background-position:left bottom;
|
|
||||||
border-top:1px solid #406cc3;
|
|
||||||
border-bottom:1px solid #242628;
|
|
||||||
}
|
|
||||||
.user_info_models .list .set_3 a span {
|
|
||||||
background-position:left bottom;
|
|
||||||
color:#eeeeee;
|
|
||||||
}
|
|
||||||
.main {
|
|
||||||
height: 100%;
|
|
||||||
margin-left: 260px;
|
|
||||||
padding-right: 40px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.main_list {
|
|
||||||
padding-top: 70px;
|
|
||||||
}
|
|
||||||
.main_list ul {
|
|
||||||
clear:both;
|
|
||||||
}
|
|
||||||
#porfile {
|
|
||||||
padding-top: 100px;
|
|
||||||
}
|
|
||||||
/*add_buttom*/
|
|
||||||
.button_bar {
|
|
||||||
float: right;
|
|
||||||
-moz-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
|
|
||||||
-webkit-box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
|
|
||||||
box-shadow:inset 0px 1px 0px 0px #666, 0px 0px 3px black;
|
|
||||||
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #4f4f4f), color-stop(1, #000000) );
|
|
||||||
background:-moz-linear-gradient( center top, #4f4f4f 5%, #000000 100% );
|
|
||||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#4f4f4f', endColorstr='#000000');
|
|
||||||
background-color:#4f4f4f;
|
|
||||||
-moz-border-radius:5px;
|
|
||||||
-webkit-border-radius:5px;
|
|
||||||
border-radius:5px;
|
|
||||||
display:inline-block;
|
|
||||||
padding:0;
|
|
||||||
margin:10px 0;
|
|
||||||
}
|
|
||||||
.button_bar a {
|
|
||||||
text-decoration:none;
|
|
||||||
text-shadow:0px -1px 0px #000000;
|
|
||||||
font-size:12px;
|
|
||||||
color:#EDEDED;
|
|
||||||
border-right:1px solid #555;
|
|
||||||
-moz-box-shadow:1px 0px 0px black;
|
|
||||||
-webkit-box-shadow:1px 0px 0px black;
|
|
||||||
box-shadow:1px 0px 0px black;
|
|
||||||
padding: 6px 10px 4px;
|
|
||||||
display: inline-block;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
.button_bar a:active {
|
|
||||||
padding: 7px 10px 3px;
|
|
||||||
text-shadow:0px 1px 0px #000000;
|
|
||||||
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #000000), color-stop(1, #4f4f4f) );
|
|
||||||
background:-moz-linear-gradient( center top, #000000 5%, #4f4f4f 100% );
|
|
||||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#4f4f4f');
|
|
||||||
}
|
|
||||||
.button_bar a:last-child {
|
|
||||||
border-right:none;
|
|
||||||
-moz-box-shadow:none;
|
|
||||||
-webkit-box-shadow:none;
|
|
||||||
box-shadow:none;
|
|
||||||
-moz-border-radius:0px 5px 5px 0px;
|
|
||||||
-webkit-border-radius:0px 5px 5px 0px;
|
|
||||||
border-radius:0px 5px 5px 0px;
|
|
||||||
}
|
|
||||||
.button_bar a:first-child {
|
|
||||||
-moz-border-radius:5px 0px 0px 5px;
|
|
||||||
-webkit-border-radius:5px 0px 0px 5px;
|
|
||||||
border-radius:5px 0px 0px 5px;
|
|
||||||
}
|
|
||||||
.button_bar a.new {
|
|
||||||
-moz-border-radius:5px;
|
|
||||||
-webkit-border-radius:5px;
|
|
||||||
border-radius:5px;
|
|
||||||
}
|
|
||||||
.button_bar a:hover {
|
|
||||||
color:#FFFFFF;
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
$('.attributes_block a.delete').live('click', function(){
|
||||||
|
$(this).parents('.list_item').remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#attributes a.remove_existing_record').live('click', function(){
|
||||||
|
$(this).next('.should_destroy').attr('value', 1);
|
||||||
|
$("#attribute_" + $(this).prev().attr('value')).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#attributes_block 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,7 @@
|
||||||
$("div.editable").live("mouseenter mouseleave",
|
$("div.editable").live("mouseenter mouseleave", function (event) {
|
||||||
function (event) {
|
$(this).children('.edit_link').toggle();
|
||||||
$(this).children('.edit_link').toggle();
|
});
|
||||||
});
|
|
||||||
|
$("#page_design_id").live('change', function() {
|
||||||
|
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
|
||||||
|
});
|
|
@ -6,4 +6,5 @@
|
||||||
//
|
//
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
|
//= require page_edit
|
||||||
//= require side_bar_history
|
//= require side_bar_history
|
|
@ -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,6 @@
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#user_active_role').change(function(){
|
$('#active_role').change(function(){
|
||||||
$('#role_models .roles_block').hide();
|
$('#roles .attributes_block').hide();
|
||||||
$('#'+this.value+'_block').toggle();
|
$('#'+this.value+'_block').toggle();
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -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 -%>
|
|
|
@ -222,7 +222,7 @@ h1 {
|
||||||
.main_list ul {
|
.main_list ul {
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
#porfile {
|
#profile {
|
||||||
padding-top: 100px;
|
padding-top: 100px;
|
||||||
}
|
}
|
||||||
/*add_buttom*/
|
/*add_buttom*/
|
||||||
|
@ -336,10 +336,10 @@ h1 {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 140px;
|
width: 140px;
|
||||||
}
|
}
|
||||||
#porfile .users{
|
#profile .users{
|
||||||
margin-left: 180px;
|
margin-left: 180px;
|
||||||
}
|
}
|
||||||
.roles_block {
|
.attributes_block {
|
||||||
background: url(<%= asset_path "75.png" %>) repeat left top;
|
background: url(<%= asset_path "75.png" %>) repeat left top;
|
||||||
min-width:710px;
|
min-width:710px;
|
||||||
margin-bottom:50px;
|
margin-bottom:50px;
|
||||||
|
@ -352,7 +352,7 @@ h1 {
|
||||||
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
|
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
|
||||||
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
|
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
|
||||||
}
|
}
|
||||||
.roles_block h2 {
|
.attributes_block h2 {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -11,16 +11,18 @@ class Admin::InfosController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
#@attribute = Info.find(params[:id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@attribute = Info.new
|
@attribute = Info.new
|
||||||
|
render :template => 'admin/attributes/new'
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@attribute = Info.find(params[:id])
|
@attribute = Info.find(params[:id])
|
||||||
@i18n_variable = @attribute.i18n_variable
|
@i18n_variable = @attribute.i18n_variable
|
||||||
|
render :template => 'admin/attributes/edit'
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -32,6 +34,10 @@ class Admin::InfosController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@attribute = Info.find(params[:id])
|
@attribute = Info.find(params[:id])
|
||||||
@attribute.update_attributes(params[:info])
|
@attribute.update_attributes(params[:info])
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to :action => :index }
|
||||||
|
format.js { render 'admin/attributes/toggle_enable' }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
@ -40,10 +46,18 @@ class Admin::InfosController < ApplicationController
|
||||||
redirect_to :action => :index
|
redirect_to :action => :index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_attribute_field
|
||||||
|
@attribute = Info.find(params[:id]) rescue nil
|
||||||
|
if !@attribute
|
||||||
|
@attribute = Info.new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def set_attribute
|
def set_attribute
|
||||||
@attribute_type = 'info'
|
@attribute_type = 'info'
|
||||||
|
@class = 'infos'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,16 +11,18 @@ class Admin::RolesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
#@attribute = Role.find(params[:id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@attribute = Role.new
|
@attribute = Role.new
|
||||||
|
render :template => 'admin/attributes/new'
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@attribute = Role.find(params[:id])
|
@attribute = Role.find(params[:id])
|
||||||
@i18n_variable = @attribute.i18n_variable
|
@i18n_variable = @attribute.i18n_variable
|
||||||
|
render :template => 'admin/attributes/edit'
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -32,7 +34,6 @@ class Admin::RolesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@attribute = Role.find(params[:id])
|
@attribute = Role.find(params[:id])
|
||||||
@attribute.update_attributes(params[:role])
|
@attribute.update_attributes(params[:role])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to :action => :index }
|
format.html { redirect_to :action => :index }
|
||||||
format.js { render 'admin/attributes/toggle_enable' }
|
format.js { render 'admin/attributes/toggle_enable' }
|
||||||
|
@ -49,6 +50,7 @@ class Admin::RolesController < ApplicationController
|
||||||
|
|
||||||
def set_attribute
|
def set_attribute
|
||||||
@attribute_type = 'role'
|
@attribute_type = 'role'
|
||||||
|
@class = 'roles'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -68,11 +68,11 @@ class Admin::TranslationsController < ApplicationController
|
||||||
result << var if var.document_class.eql?('language')
|
result << var if var.document_class.eql?('language')
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
@user_role_model_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
@role_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
||||||
result << var if var.document_class.eql?('UserRoleModel')
|
result << var if var.document_class.eql?('Role')
|
||||||
result
|
result
|
||||||
end
|
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 << var if var.document_class.eql?('UserInfoModel')
|
||||||
result
|
result
|
||||||
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,18 +10,18 @@ class Admin::UsersController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
get_info_role_models
|
get_info_and_roles
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@user = User.new
|
@user = User.new
|
||||||
get_info_role_models
|
get_info_and_roles
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@user = User.new(params[:user])
|
@user = User.new(params[:user])
|
||||||
if @user.save
|
if @user.save
|
||||||
@user.user_infos.each do |info|
|
@user.infos.each do |info|
|
||||||
info.save
|
info.save
|
||||||
info.attribute_values.each(&:save)
|
info.attribute_values.each(&:save)
|
||||||
end
|
end
|
||||||
|
@ -38,7 +38,7 @@ class Admin::UsersController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
get_info_role_models
|
get_info_and_roles
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
@ -55,7 +55,7 @@ class Admin::UsersController < ApplicationController
|
||||||
flash[:notice] = t('admin.update_success_user')
|
flash[:notice] = t('admin.update_success_user')
|
||||||
redirect_to :action => :index
|
redirect_to :action => :index
|
||||||
else
|
else
|
||||||
get_info_role_models
|
get_info_and_roles
|
||||||
render :action => :edit
|
render :action => :edit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -66,7 +66,7 @@ class Admin::UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
@user.destroy
|
@user.destroy
|
||||||
@user.user_attributes.each do |ua|
|
@user.attributes.each do |ua|
|
||||||
ua.attribute_values.each(&:destroy)
|
ua.attribute_values.each(&:destroy)
|
||||||
ua.destroy
|
ua.destroy
|
||||||
end
|
end
|
||||||
|
@ -77,9 +77,9 @@ class Admin::UsersController < ApplicationController
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def get_info_role_models
|
def get_info_and_roles
|
||||||
@roles = Info.excludes('disabled' => true)
|
@infos = Info.excludes('disabled' => true)
|
||||||
@infos = Role.excludes('disabled' => true)
|
@roles = Role.excludes('disabled' => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_attribute
|
def set_attribute
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Admin::UserHelper
|
module Admin::UserHelper
|
||||||
|
|
||||||
def show_user_attribute(object, key, locale = '')
|
def show_attribute(object, field_id, 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
|
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 attribute
|
||||||
if locale.to_s.blank?
|
if locale.to_s.blank?
|
||||||
attribute['key']
|
attribute['key']
|
||||||
|
|
|
@ -49,4 +49,11 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Design
|
||||||
self.files = (attrs << 'images')
|
self.files = (attrs << 'images')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Update or create the attribute_model records
|
# Update or create the attribute records
|
||||||
def files=(attrs)
|
def files=(attrs)
|
||||||
case attrs.last
|
case attrs.last
|
||||||
when 'layout'
|
when 'layout'
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Attribute
|
||||||
field :built_in, :type => Boolean, :default => false
|
field :built_in, :type => Boolean, :default => false
|
||||||
field :disabled, :type => Boolean, :default => false
|
field :disabled, :type => Boolean, :default => false
|
||||||
|
|
||||||
embeds_many :attribute_fields
|
has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
|
accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
||||||
|
|
|
@ -5,12 +5,12 @@ class AttributeField
|
||||||
|
|
||||||
field :key
|
field :key
|
||||||
field :markup
|
field :markup
|
||||||
field :locale, :type => Boolean
|
field :locale, :type => Boolean, :default => true
|
||||||
field :list_options, :type => Array
|
field :list_options, :type => Array
|
||||||
field :built_in, :type => Boolean, :default => false
|
field :built_in, :type => Boolean, :default => false
|
||||||
field :disabled, :type => Boolean, :default => false
|
field :disabled, :type => Boolean, :default => false
|
||||||
|
|
||||||
embedded_in :attribute
|
belongs_to :attribute
|
||||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_many :attribute_values
|
has_many :attribute_values
|
||||||
validates_uniqueness_of :key
|
validates_uniqueness_of :key
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Role
|
||||||
field :built_in, :type => Boolean, :default => false
|
field :built_in, :type => Boolean, :default => false
|
||||||
field :disabled, :type => Boolean, :default => false
|
field :disabled, :type => Boolean, :default => false
|
||||||
|
|
||||||
embeds_many :sub_roles
|
has_many :sub_roles, :autosave => true, :dependent => :destroy
|
||||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_many :users
|
has_many :users
|
||||||
accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
|
accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class SubRole < Attribute
|
class SubRole < Attribute
|
||||||
|
|
||||||
|
belongs_to :role
|
||||||
has_many :users
|
has_many :users
|
||||||
|
|
||||||
# Get an sub_role from key
|
# Get an sub_role from key
|
||||||
|
|
|
@ -16,14 +16,18 @@ class User
|
||||||
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
|
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
|
||||||
|
|
||||||
def name
|
def name
|
||||||
infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') }
|
info = Class::Info.first(:conditions => {:key => 'profile'})
|
||||||
if infos
|
if info
|
||||||
first_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
|
first_name = get_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
|
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}"
|
return "#{first_name} #{last_name}"
|
||||||
else
|
else
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_attribute_values
|
||||||
|
@attribute_values ||= self.attribute_values.to_a
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<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.i18n_variable.nil? ? 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 %>
|
||||||
|
<%= f.hidden_field :id %>
|
||||||
|
<% 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>
|
|
@ -1,36 +0,0 @@
|
||||||
<%= fields_for "user_#{@attribute_type}_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_type}_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_type}_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_type}_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_type}_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_type}_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">
|
|
||||||
<h2><%= t("admin.user_#{@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 style="color:<%= colorize_in_use_locale(locale) %>"><%= 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>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<td>
|
|
||||||
<%= text_field_tag "user_#{@attribute_type}_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">
|
|
||||||
<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 style="color:<%= colorize_in_use_locale(locale) %>"><%= 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/attributes/attribute_model', :collection => @attribute.attribute_models %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "attribute_form" %>
|
|
||||||
<% end -%>
|
|
|
@ -2,15 +2,13 @@
|
||||||
<%= render 'admin/users/side_bar' %>
|
<%= render 'admin/users/side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id="porfile">
|
<div id="profile">
|
||||||
<%= form_for @attribute, :url => eval("admin_user_#{@attribute_type}_model_path(@user_role_model)") do |f| %>
|
<%= form_for @attribute, :url => eval("admin_#{@attribute_type}_path(@attribute)") do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
<%= render :partial => "admin/attributes/form", :locals => { :f => f, :is_new => false } %>
|
<%= render :partial => "admin/#{@attribute_type}s/form", :locals => { :f => f, :is_new => false } %>
|
||||||
<div id="update" class='buttom clear'>
|
<div class='button_bar'>
|
||||||
<%= link_to t('update'), "#", :onclick=>"$('#edit_user_role_model_#{@attribute.id}').submit()" %>
|
|
||||||
</div>
|
|
||||||
<div id="back" class='buttom clear'>
|
|
||||||
<%= link_back %>
|
<%= link_back %>
|
||||||
|
<%= link_to t('update'), "#", :onclick=>"$('#edit_#{@attribute_type}_#{@attribute.id}').submit()" %>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end %>
|
||||||
</div>
|
</div>
|
|
@ -3,32 +3,37 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="main_list">
|
<div class="main_list">
|
||||||
<div id="add_new" class="buttom clear">
|
<div class="button_bar up">
|
||||||
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path") %>
|
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<table>
|
||||||
<li class="list_head clear">
|
<thead>
|
||||||
<span class="<%= @attribute_type %>s"><%= t("admin.#{@attribute_type}") %></span>
|
<tr>
|
||||||
<span class="action"><%= t('admin.action') %></span>
|
<td class="<%= @attribute_type %>s"><%= t("admin.#{@attribute_type}") %></td>
|
||||||
</li>
|
<td class="action"><%= t('admin.action') %></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<% @attributes.each do |attribute| %>
|
<% @attributes.each do |attribute| %>
|
||||||
<li id="attribute_<%= attribute.id %>" class="list_item <%= "#{attribute.is_disabled? ? 'disable' : ''}" %> clear">
|
<tr id="attribute_<%= attribute.id %>" class="have <%= "#{attribute.is_disabled? ? 'disable' : ''}" %>">
|
||||||
<span class="<%= @attribute_type %>s <%= attribute.i18n_variable[:key].downcase %>"><%= attribute.i18n_variable[I18n.locale] %></span>
|
<td class="<%= @attribute_type %>s <%= attribute.key.downcase %>"><%= attribute.i18n_variable[I18n.locale] %></span>
|
||||||
<span class="action">
|
<td class="action">
|
||||||
|
|
||||||
<%= link_to t(:edit), eval("edit_admin_#{@attribute_type}_path(attribute)"), :class => 'edit' %>
|
<%= link_to t(:edit), eval("edit_admin_#{@attribute_type}_path(attribute)"), :class => 'edit' %>
|
||||||
<% if attribute.is_built_in? %>
|
<%= 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(: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' %>
|
||||||
<%= 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? %>
|
||||||
<% else %>
|
|
||||||
<%= link_to t(:delete), eval("admin_#{@attribute_type}_path(attribute)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
|
<%= link_to t(:delete), eval("admin_#{@attribute_type}_path(attribute)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</td>
|
||||||
</span>
|
</tr>
|
||||||
</li>
|
<tr>
|
||||||
|
<td colspan="5"></td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</tbody>
|
||||||
<div id="add_new" class="buttom clear">
|
</table>
|
||||||
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path") %>
|
<div class="button_bar">
|
||||||
|
<%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path"), :class => 'new' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
<%= render 'admin/users/side_bar' %>
|
<%= render 'admin/users/side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id="porfile">
|
<div id="profile">
|
||||||
<%= form_for @attribute, :url => eval("admin_infos_path") do |f| %>
|
<%= form_for @attribute, :url => eval("admin_#{@attribute_type}s_path") do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
<%= render :partial => "admin/infos/form", :locals => { :f => f, :is_new => true } %>
|
<%= render :partial => "admin/#{@attribute_type}s/form", :locals => { :f => f, :is_new => true } %>
|
||||||
<div id="create" class='buttom clear'>
|
<div class="button_bar">
|
||||||
<%= link_to t('create'), "#", :onclick=>"$('#new_attribute').submit()" %>
|
|
||||||
</div>
|
|
||||||
<div id="back" class='buttom clear'>
|
|
||||||
<%= link_back %>
|
<%= link_back %>
|
||||||
|
<%= link_to t('create'), "#", :onclick=>"$('#new_#{@attribute_type}').submit()" %>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<td>
|
||||||
|
<%= text_field_tag "#{@attribute_type}[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:150px" %>
|
||||||
|
</td>
|
||||||
|
<% 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 %>
|
|
@ -1,16 +0,0 @@
|
||||||
<% content_for :secondary do %>
|
|
||||||
<%= render 'admin/users/side_bar' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div id="porfile">
|
|
||||||
<%= form_for @attribute, :url => eval("admin_user_#{@attribute_type}_model_path(@user_role_model)") do |f| %>
|
|
||||||
<%= f.error_messages %>
|
|
||||||
<%= render :partial => "admin/attributes/form", :locals => { :f => f, :is_new => false } %>
|
|
||||||
<div id="update" class='buttom clear'>
|
|
||||||
<%= link_to t('update'), "#", :onclick=>"$('#edit_user_role_model_#{@attribute.id}').submit()" %>
|
|
||||||
</div>
|
|
||||||
<div id="back" class='buttom clear'>
|
|
||||||
<%= link_back %>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
|
@ -1,7 +1,3 @@
|
||||||
<%= flash_messages %>
|
<%= flash_messages %>
|
||||||
|
|
||||||
<%= parse_page_edit(@item).html_safe %>
|
<%= 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>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<td>
|
||||||
|
<%= text_field_tag "#{@attribute_type}[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:150px" %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id='sub_roles' class="attributes_block <%= @class %>">
|
||||||
|
<h2>Sub roles</h2>
|
||||||
|
<% @attribute.sub_roles.each do |sub_role| %>
|
||||||
|
<%= render :partial => 'form_sub', :object => sub_role, :locals => {:f => f} %>
|
||||||
|
<% 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 %>
|
||||||
|
<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_role_temp_id').attr('value', new_id);
|
||||||
|
$('#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} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,70 @@
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<td>
|
||||||
|
<%= f.text_field "i18n_variable[#{locale}]", :value => (@i18n_variable[locale] if @i18n_variable), :style => "width:150px" %>
|
||||||
|
</td>
|
||||||
|
<% 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 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', '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 %>
|
||||||
|
<%= javascript_include_tag "attribute_form" %>
|
||||||
|
<script>
|
||||||
|
$('.attributes_block 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).next().attr('value', parseInt(new_parent_id) + 1);
|
||||||
|
$(this).parents('.sub_role_attributes').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 %>
|
|
@ -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 '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">
|
|
||||||
<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">
|
|
||||||
<%= 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,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,27 +16,27 @@
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<span><%= t('admin.role') %>:</span>
|
<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 :active_role, @roles.sort_by{|role| role.key }.collect {|role| [ role.i18n_variable[I18n.locale], role.key ]}, :selected => (@user.active_role || 'student') %>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% @user_info_models.each do |ua| %>
|
<% @infos.each do |ua| %>
|
||||||
<div id="basic_block" class="roles_block <%= @class %>">
|
<div id="basic_block" class="attributes_block <%= @class %>">
|
||||||
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
||||||
<hr>
|
<hr>
|
||||||
<%= render :partial => 'user_attribute',
|
<%= render :partial => 'attribute',
|
||||||
:object => (@user.user_infos.detect {|u| u.key == ua.key } || @user.user_infos.build),
|
:object => (@user.infos.detect {|u| u.key == ua.key } || @user.infos.build),
|
||||||
:locals => {:ua => ua, :type => 'info'} %>
|
:locals => {:ua => ua, :type => 'info'} %>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<div id='role_models'>
|
<div id='roles'>
|
||||||
<% @user_role_models.each do |ua| %>
|
<% @roles.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?)) %>>
|
<div id="<%= ua.key %>_block" class="attributes_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>
|
<h2><%= ua.i18n_variable[I18n.locale] %></h2>
|
||||||
<hr>
|
<hr>
|
||||||
<%= render :partial => 'user_attribute',
|
<%= render :partial => 'attribute',
|
||||||
:object => (@user.user_roles.detect {|u| u.key == ua.key } || @user.user_roles.build),
|
:object => (@user.roles.detect {|u| u.key == ua.key } || @user.roles.build),
|
||||||
:locals => {:ua => ua, :type => 'role'} %>
|
:locals => {:ua => ua, :type => 'role'} %>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -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>
|
||||||
|
<% a.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>
|
|
@ -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>
|
|
|
@ -1,6 +1,6 @@
|
||||||
<%= fields_for "user[user_#{type}s]", user_attribute, :index => nil do |f| %>
|
<%= fields_for "user[#{type}s]", attribute, :index => nil do |f| %>
|
||||||
<%= f.hidden_field :key, :value => ua.key %>
|
<%= f.hidden_field :key, :value => ua.key %>
|
||||||
<%= f.hidden_field :id unless user_attribute.new_record? %>
|
<%= f.hidden_field :id unless attribute.new_record? %>
|
||||||
|
|
||||||
<div class="info_input">
|
<div class="info_input">
|
||||||
<table border="0" cellspacing="0" cellpadding="0">
|
<table border="0" cellspacing="0" cellpadding="0">
|
||||||
|
@ -13,25 +13,25 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% ua.get_enabled_attribute_models.each do |attr| %>
|
<% ua.get_enabled_attribute_fields.each do |attr| %>
|
||||||
<% value = user_attribute.attribute_values.detect{|v| v.key == attr.key } %>
|
<% value = 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[#{type}s][][attribute_values][][id]", value.id rescue nil %>
|
||||||
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][key]", attr.key %>
|
<%= hidden_field_tag "user[#{type}s][][attribute_values][][key]", attr.key %>
|
||||||
<tr class="list_item">
|
<tr class="list_item">
|
||||||
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
||||||
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
||||||
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", nil %>
|
<%= hidden_field_tag "user[#{type}s][][attribute_values][][non_locale]", nil %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<td>
|
<td>
|
||||||
<%= text_field_tag "user[user_#{type}s][][attribute_values][][#{locale}]", (value[locale] rescue nil) %>
|
<%= text_field_tag "user[#{type}s][][attribute_values][][#{locale}]", (value[locale] rescue nil) %>
|
||||||
</td>
|
</td>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% else %>
|
<% else %>
|
||||||
<td colspan=<%= @site_valid_locales.size %>>
|
<td colspan=<%= @site_valid_locales.size %>>
|
||||||
<% if attr["markup"] == "text_field" %>
|
<% if attr["markup"] == "text_field" %>
|
||||||
<%= text_field_tag "user[user_#{type}s][][attribute_values][][non_locale]", (value['non_locale'] rescue nil) %>
|
<%= text_field_tag "user[#{type}s][][attribute_values][][non_locale]", (value['non_locale'] rescue nil) %>
|
||||||
<% elsif attr["markup"] == "select" %>
|
<% elsif attr["markup"] == "select" %>
|
||||||
<%= select_tag "user[user_#{type}s][][attribute_values][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
|
<%= select_tag "user[#{type}s][][attribute_values][][non_locale]", options_for_select(attr["options"], value['non_locale']) %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</td>
|
</td>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%= render 'side_bar' %>
|
<%= render 'side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id="porfile">
|
<div id="profile">
|
||||||
<%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %>
|
<%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||||
|
|
|
@ -19,9 +19,8 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @users.each do |user| %>
|
<% @users.each do |user| %>
|
||||||
<% active_role = UserRoleModel.get_role_model_from_key(user.active_role) %>
|
|
||||||
<tr class="have">
|
<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="name"><%= user.name ? user.name : 'bob' %></td>
|
||||||
<td class="email"><%= user.email %></td>
|
<td class="email"><%= user.email %></td>
|
||||||
<td class="admin"><%= user.admin ? t(:yes_) : t(:no_) %></td>
|
<td class="admin"><%= user.admin ? t(:yes_) : t(:no_) %></td>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%= render 'side_bar' %>
|
<%= render 'side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id="porfile">
|
<div id="profile">
|
||||||
<%= form_for @user, :url => admin_users_path, :html => { :multipart => true } do |f| %>
|
<%= form_for @user, :url => admin_users_path, :html => { :multipart => true } do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%= render 'side_bar' %>
|
<%= render 'side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div id="porfile">
|
<div id="profile" class="clear">
|
||||||
|
|
||||||
<div id="person">
|
<div id="person">
|
||||||
<% if @user.avatar? %>
|
<% if @user.avatar? %>
|
||||||
|
@ -11,20 +11,18 @@
|
||||||
<%= image_tag "person.png" %>
|
<%= image_tag "person.png" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<% @infos.each do |a| %>
|
||||||
<% @user_info_models.each do |am| %>
|
<div id="basic_block" class="attributes_block <%= @class %>">
|
||||||
<div id="basic_block" class="roles_block <%= @class %>">
|
<h2><%= a.i18n_variable[I18n.locale] %></h2>
|
||||||
<h2><%= am.i18n_variable[I18n.locale] %></h2>
|
|
||||||
<hr>
|
<hr>
|
||||||
<%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_info_from_model_key(am.key)} %>
|
<%= render :partial => 'show_attribute', :locals => {:a => a} %>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<div id="<%= @user.active_role %>_block" class="roles_block <%= @class %>">
|
<div id="<%= @user.role.key %>_block" class="attributes_block <%= @class %>">
|
||||||
<% active_role = UserRoleModel.get_role_model_from_key(@user.active_role) %>
|
<h2><%= @user.role.i18n_variable[I18n.locale] %></h2>
|
||||||
<h2><%= active_role.i18n_variable[I18n.locale] %></h2>
|
|
||||||
<hr>
|
<hr>
|
||||||
<%= render :partial => 'show_user_attribute', :locals => {:am => active_role, :object => @user.get_role_from_model_key(active_role.key)} %>
|
<%#= render :partial => 'show_attribute', :locals => {:a => active_role, :object => @user.get_role_from_key(active_role.key)} %>
|
||||||
</div>
|
</div>
|
||||||
<div class="button_bar">
|
<div class="button_bar">
|
||||||
<%= link_to t(:edit), edit_admin_user_path(@user) %>
|
<%= link_to t(:edit), edit_admin_user_path(@user) %>
|
||||||
|
|
|
@ -1,36 +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="panel_container">
|
|
||||||
<div id="panel_content">
|
|
||||||
<div class="secondary">
|
|
||||||
<div class="secondary2"><%= yield :secondary %></div>
|
|
||||||
</div>
|
|
||||||
<div class="main">
|
|
||||||
<div class="main2"><%= yield %></div>
|
|
||||||
</div>
|
|
||||||
<div class="tertiary"><%= yield :tertiary %></div>
|
|
||||||
</div>
|
|
||||||
<div id="panel_footer"><p><%= APP_CONFIG['ruling_digital'] %></p></div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -26,7 +26,7 @@ module PrototypeR4
|
||||||
# Custom directories with classes and modules you want to be autoloadable.
|
# Custom directories with classes and modules you want to be autoloadable.
|
||||||
# config.autoload_paths += %W(#{config.root}/extras)
|
# config.autoload_paths += %W(#{config.root}/extras)
|
||||||
config.autoload_paths += %W(#{config.root}/lib)
|
config.autoload_paths += %W(#{config.root}/lib)
|
||||||
config.autoload_paths += %W( #{config.root}/app/models/ckeditor )
|
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/design)
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/purchase)
|
config.autoload_paths += %W(#{config.root}/app/models/purchase)
|
||||||
config.autoload_paths += %W(#{config.root}/app/models/user)
|
config.autoload_paths += %W(#{config.root}/app/models/user)
|
||||||
|
|
|
@ -55,8 +55,8 @@ en:
|
||||||
editing_link: Editing link
|
editing_link: Editing link
|
||||||
editing_page: Editing page
|
editing_page: Editing page
|
||||||
editing_snippet: Editing snippet
|
editing_snippet: Editing snippet
|
||||||
editing_user_info: Editing user information
|
editing_info: Editing user information
|
||||||
editing_user_role: Editing user role
|
editing_role: Editing user role
|
||||||
email: Email
|
email: Email
|
||||||
enable_language: Enable language
|
enable_language: Enable language
|
||||||
file_name: Filename
|
file_name: Filename
|
||||||
|
@ -78,8 +78,8 @@ en:
|
||||||
list_puchases: Purchases list
|
list_puchases: Purchases list
|
||||||
list_snippets: Snippets list
|
list_snippets: Snippets list
|
||||||
list_users: Users list
|
list_users: Users list
|
||||||
list_user_infos: User information list
|
list_infos: User information list
|
||||||
list_user_roles: User roles list
|
list_roles: User roles list
|
||||||
member: Member
|
member: Member
|
||||||
move_down: Move down
|
move_down: Move down
|
||||||
move_up: Move up
|
move_up: Move up
|
||||||
|
@ -97,8 +97,8 @@ en:
|
||||||
new_page: New page
|
new_page: New page
|
||||||
new_snippet: New snippet
|
new_snippet: New snippet
|
||||||
new_user: New user
|
new_user: New user
|
||||||
new_user_info: New user information
|
new_info: New user information
|
||||||
new_user_role: New user role
|
new_role: New user role
|
||||||
non_multilingual: Non multilingual
|
non_multilingual: Non multilingual
|
||||||
options: Options
|
options: Options
|
||||||
orig_upload_file: Original filename
|
orig_upload_file: Original filename
|
||||||
|
@ -126,8 +126,8 @@ en:
|
||||||
upload_design: Upload design
|
upload_design: Upload design
|
||||||
url: URL
|
url: URL
|
||||||
user: User
|
user: User
|
||||||
user_info: User information
|
info: User information
|
||||||
user_panel: User panel
|
panel: User panel
|
||||||
user_role: User role
|
role: User role
|
||||||
|
|
||||||
panel:
|
panel:
|
||||||
|
|
|
@ -50,8 +50,8 @@ zh_tw:
|
||||||
editing_link: 編輯連結
|
editing_link: 編輯連結
|
||||||
editing_page: 編輯頁面
|
editing_page: 編輯頁面
|
||||||
editing_snippet: 編輯片段
|
editing_snippet: 編輯片段
|
||||||
editing_user_info: 編輯用戶資料
|
editing_info: 編輯用戶資料
|
||||||
editing_user_role: 編輯用戶角色
|
editing_role: 編輯用戶角色
|
||||||
email: Email
|
email: Email
|
||||||
enable_language: 啟用語言
|
enable_language: 啟用語言
|
||||||
file_name: 檔名
|
file_name: 檔名
|
||||||
|
@ -73,8 +73,8 @@ zh_tw:
|
||||||
list_layouts: 佈局列表
|
list_layouts: 佈局列表
|
||||||
list_snippets: 斷片列表
|
list_snippets: 斷片列表
|
||||||
list_users: 使用列表
|
list_users: 使用列表
|
||||||
list_user_infos: 用戶資料列表
|
list_infos: 用戶資料列表
|
||||||
list_user_roles: 用戶角色列表
|
list_roles: 用戶角色列表
|
||||||
member: 會員
|
member: 會員
|
||||||
move_down: 往下移
|
move_down: 往下移
|
||||||
move_up: 往上移
|
move_up: 往上移
|
||||||
|
@ -92,8 +92,8 @@ zh_tw:
|
||||||
new_page: 新增頁面
|
new_page: 新增頁面
|
||||||
new_snippet: 新增片段
|
new_snippet: 新增片段
|
||||||
new_user: 新增使用
|
new_user: 新增使用
|
||||||
new_user_info: 新增用戶資料
|
new_info: 新增用戶資料
|
||||||
new_user_role: 新增用戶角色
|
new_role: 新增用戶角色
|
||||||
non_multilingual: 非多種語言
|
non_multilingual: 非多種語言
|
||||||
options: 選項
|
options: 選項
|
||||||
orig_upload_file: 原上傳檔名
|
orig_upload_file: 原上傳檔名
|
||||||
|
@ -119,9 +119,9 @@ zh_tw:
|
||||||
upload_design: 上傳設計
|
upload_design: 上傳設計
|
||||||
url: URL
|
url: URL
|
||||||
user: 用戶
|
user: 用戶
|
||||||
user_info: 用戶資料
|
info: 用戶資料
|
||||||
user_panel: 用戶面板
|
panel: 用戶面板
|
||||||
user_role: 用戶角色
|
role: 用戶角色
|
||||||
|
|
||||||
panel:
|
panel:
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,9 @@ PrototypeR4::Application.routes.draw do
|
||||||
post 'edit_file' => 'designs#edit_file'
|
post 'edit_file' => 'designs#edit_file'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :infos
|
resources :infos do
|
||||||
|
get 'add_attribute_field'
|
||||||
|
end
|
||||||
resources :items
|
resources :items
|
||||||
resources :links do
|
resources :links do
|
||||||
member do
|
member do
|
||||||
|
@ -44,7 +46,10 @@ PrototypeR4::Application.routes.draw do
|
||||||
get 'download'
|
get 'download'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :roles
|
resources :roles do
|
||||||
|
get 'add_sub_role'
|
||||||
|
get 'add_attribute_field'
|
||||||
|
end
|
||||||
resources :sites
|
resources :sites
|
||||||
resources :snippets
|
resources :snippets
|
||||||
resources :translations
|
resources :translations
|
||||||
|
|
|
@ -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_to t('update'), "#", :onclick=>"$('#edit_user_#{@user.id}').submit()" %>
|
|
||||||
<%= link_back %>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
|
@ -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>
|
|
|
@ -13,55 +13,61 @@ namespace :dev do
|
||||||
|
|
||||||
Site.create( :school => 'RulingDigital Universitry', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
Site.create( :school => 'RulingDigital Universitry', :department => 'Computer Science', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
||||||
|
|
||||||
|
# I18n_variables
|
||||||
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
|
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
|
||||||
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
|
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
|
||||||
var_1 = I18nVariable.create!( :document_class => 'Role', :key => 'teacher', :en => 'Teacher', :zh_tw => '老師' )
|
var_1 = I18nVariable.create!( :document_class => 'Role', :key => 'teacher', :en => 'Teacher', :zh_tw => '老師' )
|
||||||
var_2 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'discipline', :en => 'Discipline', :zh_tw => '學科', :parent_id => var_1.id )
|
var_1_1 = I18nVariable.create!( :document_class => 'SubRole', :key => 'good_teacher', :en => 'Good teacher', :zh_tw => '好老師', :parent_id => var_1.id )
|
||||||
var_3 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_1.id )
|
var_1_1_1 = I18nVariable.create!( :document_class => 'Attribute', :key => 'field', :en => 'Field', :zh_tw => '領域', :parent_id => var_1_1.id )
|
||||||
var_4 = I18nVariable.create!( :document_class => 'Role', :key => 'student', :en => 'Student', :zh_tw => '學生' )
|
var_1_1_2 = I18nVariable.create!( :document_class => 'Attribute', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_1_1.id )
|
||||||
var_5 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_4.id )
|
var_1_2 = I18nVariable.create!( :document_class => 'SubRole', :key => 'bad_teacher', :en => 'Bad teacher', :zh_tw => '壞老師', :parent_id => var_1.id )
|
||||||
var_6 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'major', :en => 'Major', :zh_tw => '主修', :parent_id => var_4.id )
|
var_1_2_1 = I18nVariable.create!( :document_class => 'Attribute', :key => 'field', :en => 'Field', :zh_tw => '領域', :parent_id => var_1_2.id )
|
||||||
|
var_1_2_2 = I18nVariable.create!( :document_class => 'Attribute', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_1_2.id )
|
||||||
|
var_1_2_3 = I18nVariable.create!( :document_class => 'Attribute', :key => 'speciality', :en => 'Speciality', :zh_tw => '專業', :parent_id => var_1_2.id )
|
||||||
|
var_2 = I18nVariable.create!( :document_class => 'Role', :key => 'student', :en => 'Student', :zh_tw => '學生' )
|
||||||
|
var_2_1 = I18nVariable.create!( :document_class => 'SubRole', :key => 'undergraduate', :en => 'Undergraduate', :zh_tw => '大學部學生', :parent_id => var_2.id )
|
||||||
|
var_2_1_1 = I18nVariable.create!( :document_class => 'Attribute', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_2_1.id )
|
||||||
|
var_2_1_2 = I18nVariable.create!( :document_class => 'Attribute', :key => 'major', :en => 'Major', :zh_tw => '主修', :parent_id => var_2_1.id )
|
||||||
|
var_2_2 = I18nVariable.create!( :document_class => 'SubRole', :key => 'graduate', :en => 'Graduate', :zh_tw => '研究生', :parent_id => var_2.id )
|
||||||
|
var_2_2_1 = I18nVariable.create!( :document_class => 'Attribute', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_2_2.id )
|
||||||
|
var_2_2_2 = I18nVariable.create!( :document_class => 'Attribute', :key => 'major', :en => 'Major', :zh_tw => '主修', :parent_id => var_2_2.id )
|
||||||
|
var_2_2_3 = I18nVariable.create!( :document_class => 'Attribute', :key => 'thesis_subject', :en => 'Thesis subject', :zh_tw => '論文題目', :parent_id => var_2_2.id )
|
||||||
var_7 = I18nVariable.create!( :document_class => 'Info', :key => 'profile', :en => 'Profile', :zh_tw => '個人檔案' )
|
var_7 = I18nVariable.create!( :document_class => 'Info', :key => 'profile', :en => 'Profile', :zh_tw => '個人檔案' )
|
||||||
var_8 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'last_name', :en => 'Last name', :zh_tw => '姓氏', :parent_id => var_7.id )
|
var_8 = I18nVariable.create!( :document_class => 'Attribute', :key => 'last_name', :en => 'Last name', :zh_tw => '姓氏', :parent_id => var_7.id )
|
||||||
var_9 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'first_name', :en => 'First name', :zh_tw => '名字', :parent_id => var_7.id )
|
var_9 = I18nVariable.create!( :document_class => 'Attribute', :key => 'first_name', :en => 'First name', :zh_tw => '名字', :parent_id => var_7.id )
|
||||||
var_10 = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
var_10 = I18nVariable.create!( :document_class => 'Home', :key => 'home', :en => 'Homepage', :zh_tw => '首頁')
|
||||||
var_11 = I18nVariable.create!( :document_class => 'Page', :key => 'about', :en => 'About', :zh_tw => '關於我們' )
|
var_11 = I18nVariable.create!( :document_class => 'Page', :key => 'about', :en => 'About', :zh_tw => '關於我們' )
|
||||||
var_12 = I18nVariable.create!( :document_class => 'Link', :key => 'google', :en => 'Google', :zh_tw => 'Google' )
|
var_12 = I18nVariable.create!( :document_class => 'Link', :key => 'google', :en => 'Google', :zh_tw => 'Google' )
|
||||||
var_13 = I18nVariable.create!( :document_class => 'PagePart', :key => 'main_content', :en => 'This is the homepage', :zh_tw => '這是首頁', :parent_id => var_10.id )
|
var_13 = I18nVariable.create!( :document_class => 'PagePart', :key => 'main_content', :en => 'This is the homepage', :zh_tw => '這是首頁', :parent_id => var_10.id )
|
||||||
var_14 = I18nVariable.create!( :document_class => 'PagePart', :key => 'main_content', :en => 'This is about', :zh_tw => '這是關於', :parent_id => var_11.id )
|
var_14 = I18nVariable.create!( :document_class => 'PagePart', :key => 'main_content', :en => 'This is about', :zh_tw => '這是關於', :parent_id => var_11.id )
|
||||||
|
|
||||||
|
# User roles
|
||||||
|
r_1 = Role.new( :key => 'teacher', :i18n_variable => var_1, :built_in => true )
|
||||||
|
sr_1_1 = r_1.sub_roles.build( :key => 'good_teacher', :i18n_variable => var_1_1, :built_in => true )
|
||||||
|
sr_1_1.attribute_fields.build( :key => 'field', :locale => true, :i18n_variable => var_1_1_1, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||||
|
sr_1_1.attribute_fields.build( :key => 'department', :locale => true, :i18n_variable => var_1_1_2, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||||
|
sr_1_2 = r_1.sub_roles.build( :key => 'bad_teacher', :i18n_variable => var_1_1 )
|
||||||
|
sr_1_2.attribute_fields.build( :key => 'field', :locale => true, :i18n_variable => var_1_2_1, :markup => 'text_field', :list_options => [] )
|
||||||
|
sr_1_2.attribute_fields.build( :key => 'department', :locale => true, :i18n_variable => var_1_2_2, :markup => 'text_field', :list_options => [] )
|
||||||
|
sr_1_2.attribute_fields.build( :key => 'speciality', :locale => true, :i18n_variable => var_1_2_3, :markup => 'text_field', :list_options => [] )
|
||||||
|
r_1.save!
|
||||||
|
r_2 = Role.new( :key => 'student', :i18n_variable => var_2 )
|
||||||
|
sr_2_1 = r_2.sub_roles.build( :key => 'undergraduate', :i18n_variable => var_2_1 )
|
||||||
|
sr_2_1.attribute_fields.build( :key => 'department', :locale => true, :i18n_variable => var_2_1_1, :markup => 'text_field', :list_options => [] )
|
||||||
|
sr_2_1.attribute_fields.build( :key => 'major', :locale => true, :i18n_variable => var_2_1_2, :markup => 'text_field', :list_options => [] )
|
||||||
|
sr_2_2 = r_2.sub_roles.build( :key => 'graduate', :i18n_variable => var_2_2 )
|
||||||
|
sr_2_2.attribute_fields.build( :key => 'department', :locale => true, :i18n_variable => var_2_2_1, :markup => 'text_field', :list_options => [] )
|
||||||
|
sr_2_2.attribute_fields.build( :key => 'major', :locale => true, :i18n_variable => var_2_2_2, :markup => 'text_field', :list_options => [] )
|
||||||
|
sr_2_2.attribute_fields.build( :key => 'thesis_subject', :locale => true, :i18n_variable => var_2_2_3, :markup => 'text_field', :list_options => [] )
|
||||||
|
r_2.save!
|
||||||
|
|
||||||
# TODO: modify for the new model
|
# User info
|
||||||
urm_1 = Role.new( :key => 'teacher', :i18n_variable_id => var_1.id, :built_in => true )
|
i_1 = Info.new( :key => 'profile', :i18n_variable => var_7, :built_in => true )
|
||||||
urm_1.attributes.build( :key => 'discipline', :locale => true, :i18n_variable_id => var_2.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
i_1.attribute_fields.build( :key => 'last_name', :locale => true, :i18n_variable => var_8, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||||
urm_1.attributes.build( :key => 'department', :locale => true, :i18n_variable_id => var_3.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
i_1.attribute_fields.build( :key => 'first_name', :locale => true, :i18n_variable => var_9, :markup => 'text_field', :list_options => [], :built_in => true )
|
||||||
urm_1.save!
|
i_1.save!
|
||||||
urm_2 = Role.new( :key => 'student', :i18n_variable_id => var_4.id )
|
|
||||||
urm_2.attributes.build( :key => 'department', :locale => true, :i18n_variable_id => var_5.id, :markup => 'text_field', :list_options => [] )
|
|
||||||
urm_2.attributes.build( :key => 'major', :locale => true, :i18n_variable_id => var_6.id, :markup => 'text_field', :list_options => [] )
|
|
||||||
urm_2.save!
|
|
||||||
uim_1 = Info.new( :key => 'profile', :i18n_variable_id => var_7.id, :built_in => true )
|
|
||||||
uim_1.attributes.build( :key => 'last_name', :locale => true, :i18n_variable_id => var_8.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
|
||||||
uim_1.attributes.build( :key => 'first_name', :locale => true, :i18n_variable_id => var_9.id, :markup => 'text_field', :list_options => [], :built_in => true )
|
|
||||||
uim_1.save!
|
|
||||||
|
|
||||||
|
|
||||||
# layout = Layout.create!( :name => 'root', :description => 'root', :content => File.open("#{Rails.root}/lib/template/root.layout").read )
|
|
||||||
# layout.layout_parts.create!( :name => 'header', :content => File.open("#{Rails.root}/lib/template/nav.snippet").read )
|
|
||||||
# layout.layout_parts.create!( :name => 'main_content', :editable => true )
|
|
||||||
# layout.layout_parts.create!( :name => 'footer', :content => File.open("#{Rails.root}/lib/template/footer.snippet").read )
|
|
||||||
#
|
|
||||||
# home = Page.create!( :i18n_variable_id => var_10.id, :layout_id => layout.id, :name => 'home', :is_published => true )
|
|
||||||
# home.page_parts.create!( :name => 'main_content', :content => File.open("#{Rails.root}/lib/template/home.page").read, :kind => 'text', :i18n_variable_id => var_13.id )
|
|
||||||
#
|
|
||||||
# about = Page.create!( :i18n_variable_id => var_11.id, :layout_id => layout.id, :name => 'about', :is_published => true, :parent_id => home.id )
|
|
||||||
# about.page_parts.create!( :name => 'main_content', :content => File.open("#{Rails.root}/lib/template/about.page").read, :kind => 'text', :i18n_variable_id => var_14.id )
|
|
||||||
|
|
||||||
# Link.create!( :i18n_variable_id => var_12.id, :name => 'google', :is_published => true, :parent_id => home.id, :url => 'www.google.com' )
|
|
||||||
#
|
|
||||||
# ["nav", "footer"].each do |page_name|
|
|
||||||
# Snippet.create!( :name => page_name, :parent_id => home.id, :content => File.open("#{Rails.root}/lib/template/#{page_name}.snippet").read )
|
|
||||||
# end
|
|
||||||
|
|
||||||
design = Design.new(:title => "Fraisier", :author => "Paul", :intro => "Strawberry cake")
|
design = Design.new(:title => "Fraisier", :author => "Paul", :intro => "Strawberry cake")
|
||||||
|
|
||||||
|
@ -118,18 +124,19 @@ namespace :dev do
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
user = User.create( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => urm_1.id )
|
user = User.create( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => r_1.id, :sub_role_id => sr_1_2.id )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'first_name', :en => 'Christophe', :zh_tw => '順發' )
|
AttributeValue.create( :user => user, :attribute_field => i_1.attribute_fields[0], :key => 'first_name', :en => 'Christophe', :zh_tw => '順發' )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'last_name', :en => 'Vilayphiou', :zh_tw => '林' )
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[1].id, :key => 'last_name', :en => 'Vilayphiou', :zh_tw => '林' )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'discipline', :en => 'Computer Architecture', :zh_tw => '計算機系統結構' )
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_1_2.attribute_fields[0].id, :key => 'field', :en => 'Computer Architecture', :zh_tw => '計算機系統結構' )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_1_2.attribute_fields[1].id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
||||||
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_1_2.attribute_fields[2].id, :key => 'speciality', :en => 'HSR', :zh_tw => '高鐵' )
|
||||||
|
|
||||||
|
|
||||||
user = User.create( :email => 'matt@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => urm_2.id )
|
user = User.create( :email => 'matt@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => r_2.id, :sub_role_id => sr_2_1.id )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'first_name', :en => 'Matt', :zh_tw => '儒淵' )
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[0].id, :key => 'first_name', :en => 'Matt', :zh_tw => '儒淵' )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'last_name', :en => 'Fu', :zh_tw => '傅' )
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => i_1.attribute_fields[1].id, :key => 'last_name', :en => 'Fu', :zh_tw => '傅' )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[0].id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
|
||||||
AttributeValue.create( :user_id => user.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
AttributeValue.create( :user_id => user.id, :attribute_field_id => sr_2_1.attribute_fields[1].id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe Role do
|
||||||
@role = Role.create(:key => 'teacher',
|
@role = Role.create(:key => 'teacher',
|
||||||
:i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'},
|
:i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'},
|
||||||
:sub_roles => [{:key => 'undergrad',
|
:sub_roles => [{:key => 'undergrad',
|
||||||
|
:i18n_variable => {:key => 'yeah', :en => 'Yeah', :zh_tw => 'Yeah', :document_class => 'Role'},
|
||||||
:attribute_fields => [{:key => 'department'},
|
:attribute_fields => [{:key => 'department'},
|
||||||
{:key => 'room'}]},
|
{:key => 'room'}]},
|
||||||
{:key => 'master',
|
{:key => 'master',
|
||||||
|
@ -35,6 +36,9 @@ describe Role do
|
||||||
it 'should have :disabled false' do
|
it 'should have :disabled false' do
|
||||||
@role.sub_roles[0].disabled.should be false
|
@role.sub_roles[0].disabled.should be false
|
||||||
end
|
end
|
||||||
|
it 'should have a i18n_variable' do
|
||||||
|
@role.sub_roles[0].i18n_variable.should be_an_instance_of I18nVariable
|
||||||
|
end
|
||||||
end
|
end
|
||||||
describe '#AttributeField' do
|
describe '#AttributeField' do
|
||||||
it 'should have :built_in false' do
|
it 'should have :built_in false' do
|
||||||
|
|
Reference in New Issue