Ray's modifications
After Width: | Height: | Size: 923 B |
After Width: | Height: | Size: 964 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 1010 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 963 B |
|
@ -16,7 +16,7 @@ body{
|
||||||
}
|
}
|
||||||
|
|
||||||
#panel_banner_link{
|
#panel_banner_link{
|
||||||
background: url(<%= asset_path "orbitbar.png" %>) repeat-x scroll 0 0;
|
background: url(<%= asset_path "orbitbar1.png" %>) repeat-x scroll 0 0;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
left: 0;
|
left: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -16,7 +16,7 @@ body{
|
||||||
}
|
}
|
||||||
|
|
||||||
#panel_banner_link{
|
#panel_banner_link{
|
||||||
background: url(<%= asset_path "orbitbar.png" %>) repeat-x scroll 0 0;
|
background: url(<%= asset_path "orbitbar1.png" %>) repeat-x scroll 0 0;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
left: 0;
|
left: 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -13,6 +13,7 @@ html,body {
|
||||||
height:100%;
|
height:100%;
|
||||||
margin:0;
|
margin:0;
|
||||||
font-family: Helvetica, '微軟正黑體';
|
font-family: Helvetica, '微軟正黑體';
|
||||||
|
overflow-x:hidden
|
||||||
}
|
}
|
||||||
ul {
|
ul {
|
||||||
list-style:none;
|
list-style:none;
|
||||||
|
@ -20,6 +21,17 @@ ul {
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
}
|
}
|
||||||
|
input{
|
||||||
|
border:none;
|
||||||
|
padding:5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
}
|
||||||
|
input:focus, select:focus, textarea:focus {
|
||||||
|
outline:none;
|
||||||
|
-moz-outline-radius: 0;
|
||||||
|
}
|
||||||
.clear:after {
|
.clear:after {
|
||||||
content:".";
|
content:".";
|
||||||
clear:both;
|
clear:both;
|
||||||
|
@ -37,7 +49,7 @@ ul {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width:220px;
|
width:220px;
|
||||||
/*background-color:rgba(245,245,245,1);*/
|
/*background-color:rgba(245,245,245,1);*/
|
||||||
background-color:rgba(0,0,0,0.75);
|
background:url(<%= asset_path '75.png' %>) repeat left top;
|
||||||
-moz-box-shadow: 3px 0px 4px #472a12; /* Firefox */
|
-moz-box-shadow: 3px 0px 4px #472a12; /* Firefox */
|
||||||
-webkit-box-shadow: 3px 0px 4px #472a12;/* Safari 和 Chrome */
|
-webkit-box-shadow: 3px 0px 4px #472a12;/* Safari 和 Chrome */
|
||||||
box-shadow: 3px 0px 4px #472a12; /* Opera 10.5 + */
|
box-shadow: 3px 0px 4px #472a12; /* Opera 10.5 + */
|
||||||
|
@ -51,9 +63,10 @@ ul {
|
||||||
#search input {
|
#search input {
|
||||||
background:url(<%= asset_path 'search_bg.png' %>) no-repeat left top;
|
background:url(<%= asset_path 'search_bg.png' %>) no-repeat left top;
|
||||||
border:none;
|
border:none;
|
||||||
width:174px;
|
width:154px;
|
||||||
height:20px;
|
height:20px;
|
||||||
padding-left:20px;
|
padding: 0 20px;
|
||||||
|
font-family:Helvetica;
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
background:url(<%= asset_path 'h1_bg.png' %>) repeat-x left top;
|
background:url(<%= asset_path 'h1_bg.png' %>) repeat-x left top;
|
||||||
|
@ -127,7 +140,7 @@ h1 {
|
||||||
padding-top:70px;
|
padding-top:70px;
|
||||||
}
|
}
|
||||||
.main_list li {
|
.main_list li {
|
||||||
background-color:rgba(0,0,0,0.75);
|
background:url(<%= asset_path '75.png' %>) repeat left top;
|
||||||
margin-bottom:20px;
|
margin-bottom:20px;
|
||||||
}
|
}
|
||||||
.main_list li span {
|
.main_list li span {
|
||||||
|
@ -140,7 +153,7 @@ h1 {
|
||||||
width:18%;
|
width:18%;
|
||||||
}
|
}
|
||||||
.main_list li.list_head {
|
.main_list li.list_head {
|
||||||
background-color:inherit;
|
background:none;
|
||||||
margin-bottom:10px;
|
margin-bottom:10px;
|
||||||
}
|
}
|
||||||
.main_list li.list_head span {
|
.main_list li.list_head span {
|
||||||
|
@ -175,7 +188,7 @@ h1 {
|
||||||
float: right;
|
float: right;
|
||||||
width:10%;
|
width:10%;
|
||||||
}
|
}
|
||||||
.main_list li .action a{
|
#main .action a{
|
||||||
background-image:url(<%= asset_path 'icon.png' %>);
|
background-image:url(<%= asset_path 'icon.png' %>);
|
||||||
text-indent:-9999px;
|
text-indent:-9999px;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
|
@ -184,43 +197,56 @@ h1 {
|
||||||
margin-top:8px;
|
margin-top:8px;
|
||||||
margin-right:10px;
|
margin-right:10px;
|
||||||
}
|
}
|
||||||
.main_list li .action a.show{
|
#main .action a.show{
|
||||||
background-position:left top;
|
background-position:left top;
|
||||||
}
|
}
|
||||||
.main_list li .action a.edit{
|
#main .action a.edit{
|
||||||
background-position:-19px top;
|
background-position:-19px top;
|
||||||
}
|
}
|
||||||
.main_list li .action a.delete{
|
#main .action a.delete{
|
||||||
background-position:-38px top;
|
background-position:-38px top;
|
||||||
}
|
}
|
||||||
.main_list li .action a.show:hover{
|
#main .action a.show:hover{
|
||||||
background-position:left bottom;
|
background-position:left -19px;
|
||||||
}
|
}
|
||||||
.main_list li .action a.edit:hover{
|
#main .action a.edit:hover{
|
||||||
background-position:-19px bottom;
|
background-position:-19px -19px;
|
||||||
}
|
}
|
||||||
.main_list li .action a.delete:hover{
|
#main .action a.delete:hover{
|
||||||
background-position:-38px bottom;
|
background-position:-38px -19px;
|
||||||
}
|
}
|
||||||
.main_list li.list_item .roles {
|
#main .list_item .roles {
|
||||||
background-image:url(<%= asset_path 'roles_type.jpg' %>);
|
background-image:url(<%= asset_path 'roles_type.jpg' %>);
|
||||||
background-repeat:repeat-x;
|
background-repeat:repeat-x;
|
||||||
border-radius: 5px 0 0 5px;
|
border-radius: 5px 0 0 5px;
|
||||||
-moz-border-radius: 5px 0 0 5px;
|
-moz-border-radius: 5px 0 0 5px;
|
||||||
-webkit-border-radius: 5px 0 0 5px;
|
-webkit-border-radius: 5px 0 0 5px;
|
||||||
}
|
}
|
||||||
|
#roles_list .roles_block .action a{
|
||||||
|
margin-top:0;
|
||||||
|
margin-right:0;
|
||||||
|
}
|
||||||
.student {
|
.student {
|
||||||
background-position:0 -5px;
|
background-position:0 -5px;
|
||||||
}
|
}
|
||||||
.teacher {
|
.teacher {
|
||||||
background-position:0 -54px;
|
background-position:0 -54px;
|
||||||
}
|
}
|
||||||
#add_new {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
#add_new a {
|
#add_new a {
|
||||||
background-image:url(<%= asset_path 'icon.png' %>);
|
|
||||||
background-position:-54px -17px;
|
background-position:-54px -17px;
|
||||||
|
}
|
||||||
|
#add_new a:hover {
|
||||||
|
background-position: -54px 3px;
|
||||||
|
}
|
||||||
|
#confirm a{
|
||||||
|
background-position:4px -70px;
|
||||||
|
}
|
||||||
|
#confirm a:hover{
|
||||||
|
background-position: 4px -51px;
|
||||||
|
}
|
||||||
|
.buttom a {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
background-image:url(<%= asset_path 'icon.png' %>);
|
||||||
background-repeat:no-repeat;
|
background-repeat:no-repeat;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
|
@ -236,9 +262,185 @@ h1 {
|
||||||
-webkit-box-shadow: 3px 0px 4px #180902;/* Safari 和 Chrome */
|
-webkit-box-shadow: 3px 0px 4px #180902;/* Safari 和 Chrome */
|
||||||
box-shadow: 3px 0px 4px #180902; /* Opera 10.5 + */
|
box-shadow: 3px 0px 4px #180902; /* Opera 10.5 + */
|
||||||
}
|
}
|
||||||
#add_new a:hover {
|
.buttom a:hover {
|
||||||
background-position: -54px 3px;
|
|
||||||
color:#000;
|
color:#000;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
background-color: rgba(255, 255, 255, 1);
|
background-color: rgba(255, 255, 255, 1);
|
||||||
}
|
}
|
||||||
|
#porfile{
|
||||||
|
padding-top:100px;
|
||||||
|
}
|
||||||
|
#porfile h2 {
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
text-shadow: 0 3px 2px #000000;
|
||||||
|
position:absolute;
|
||||||
|
top:-30px;
|
||||||
|
}
|
||||||
|
#porfile label {
|
||||||
|
display:block;
|
||||||
|
text-shadow: 0 1px 0 #FFFFFF;
|
||||||
|
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
|
||||||
|
height: 25px;
|
||||||
|
width:110px;
|
||||||
|
padding: 0 0 0 18px;
|
||||||
|
border:1px solid #d8d8d8;
|
||||||
|
margin-top:10px;
|
||||||
|
color:#666666;
|
||||||
|
border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
}
|
||||||
|
#porfile label:hover{
|
||||||
|
background-position:left bottom;
|
||||||
|
color:#000;
|
||||||
|
border:1px solid #a6a6a6;
|
||||||
|
}
|
||||||
|
#porfile label input {
|
||||||
|
border:none;
|
||||||
|
margin: 6px 15px 0 0;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
#porfile label span {
|
||||||
|
display:block;
|
||||||
|
float:left;
|
||||||
|
line-height:27px;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
.roles_block {
|
||||||
|
min-width:710px;
|
||||||
|
margin-bottom:50px;
|
||||||
|
position:relative;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
background:url(<%= asset_path '75.png' %>) repeat left top;
|
||||||
|
border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
|
||||||
|
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
|
||||||
|
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
|
||||||
|
}
|
||||||
|
#user_list .roles_block {
|
||||||
|
margin-left:180px;
|
||||||
|
}
|
||||||
|
#person {
|
||||||
|
left: 265px;
|
||||||
|
position: fixed;
|
||||||
|
top: 75px;
|
||||||
|
}
|
||||||
|
#person img {
|
||||||
|
background-color:#FFF;
|
||||||
|
padding:5px;
|
||||||
|
border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
|
||||||
|
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
|
||||||
|
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
|
||||||
|
}
|
||||||
|
#upload, #edit{
|
||||||
|
display:block;
|
||||||
|
text-shadow: 0 1px 0 #FFFFFF;
|
||||||
|
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
|
||||||
|
height: 25px;
|
||||||
|
line-height:27px;
|
||||||
|
color:#666666;
|
||||||
|
width:128px;
|
||||||
|
text-align:center;
|
||||||
|
font-size:12px;
|
||||||
|
border:1px solid #d8d8d8;
|
||||||
|
margin-top:10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
}
|
||||||
|
#upload:hover{
|
||||||
|
background-position:left bottom;
|
||||||
|
color:#000;
|
||||||
|
border:1px solid #a6a6a6;
|
||||||
|
}
|
||||||
|
#main hr{
|
||||||
|
height:8px;
|
||||||
|
border:none;
|
||||||
|
margin:0;
|
||||||
|
border-radius: 5px 5px 0px 0px;
|
||||||
|
-moz-border-radius: 5px 5px 0px 0px;
|
||||||
|
-webkit-border-radius: 5px 5px 0px 0px;
|
||||||
|
border-bottom:1px solid #000;
|
||||||
|
}
|
||||||
|
#basic_block hr{
|
||||||
|
background-color:#666666;
|
||||||
|
}
|
||||||
|
#teacher_block hr{
|
||||||
|
background-color:#0071a9;
|
||||||
|
}
|
||||||
|
#student_block hr{
|
||||||
|
background-color:#af0045;
|
||||||
|
}
|
||||||
|
.info_input {
|
||||||
|
padding:10px 20px;
|
||||||
|
}
|
||||||
|
.info_input table {
|
||||||
|
color:#fff;
|
||||||
|
width:100%;
|
||||||
|
font-size:14px;
|
||||||
|
}
|
||||||
|
.info_input table td {
|
||||||
|
padding:5px 10px 5px 0;
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
.info_input .list_head {
|
||||||
|
background:url(<%= asset_path 'line.png' %>) left bottom repeat-x;
|
||||||
|
}
|
||||||
|
.info_input .list_head td {
|
||||||
|
}
|
||||||
|
.info_input .list_item {
|
||||||
|
color:#AEAEAE;
|
||||||
|
}
|
||||||
|
.info_input .add {
|
||||||
|
display:block;
|
||||||
|
padding-left:22px;
|
||||||
|
font-size:12px;
|
||||||
|
line-height:21px;
|
||||||
|
height:19px;
|
||||||
|
background:url(<%= asset_path 'icon.png' %>) no-repeat -59px 0;
|
||||||
|
margin-top: 10px;
|
||||||
|
color: #DDDDDD;
|
||||||
|
}
|
||||||
|
.info_input .add:hover {
|
||||||
|
color:#FFF;
|
||||||
|
background-position:-59px -19px;
|
||||||
|
}
|
||||||
|
.info_input li {
|
||||||
|
height:30px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.info_input li span {
|
||||||
|
display:inline-block;
|
||||||
|
float:left;
|
||||||
|
color:#fff;
|
||||||
|
font-size:14px;
|
||||||
|
line-height:30px;
|
||||||
|
margin-right:10px;
|
||||||
|
}
|
||||||
|
#user_list .info_input li span {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
#roles_list .info_input li span {
|
||||||
|
width:15%;
|
||||||
|
}
|
||||||
|
.info_input li span:last-child {
|
||||||
|
}
|
||||||
|
#person select {
|
||||||
|
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
|
||||||
|
border:1px solid #d8d8d8;
|
||||||
|
margin-top: 10px;
|
||||||
|
width: 130px;
|
||||||
|
padding:3px 6px 3px 14px;
|
||||||
|
border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
border:none;
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ body{
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
#hmenu{
|
#hmenu{
|
||||||
background:url(<%= asset_path 'orbitbar.png' %>) repeat-x 0 0;
|
background:url(<%= asset_path 'orbitbar1.png' %>) repeat-x 0 0;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
top:0;
|
top:0;
|
||||||
|
|
|
@ -29,7 +29,8 @@ class AttributeModel
|
||||||
if self.i18n_variable_id
|
if self.i18n_variable_id
|
||||||
self.i18n_variable.update_attributes(attr)
|
self.i18n_variable.update_attributes(attr)
|
||||||
else
|
else
|
||||||
var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class, :parent_id => self.user_attribute_model.i18n_variable_id}))
|
# var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class, :parent_id => self.user_attribute_model.i18n_variable_id}))
|
||||||
|
var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class}))
|
||||||
var.save
|
var.save
|
||||||
self.i18n_variable_id = var.id
|
self.i18n_variable_id = var.id
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,12 +8,11 @@ class User
|
||||||
mount_uploader :avatar, AvatarUploader
|
mount_uploader :avatar, AvatarUploader
|
||||||
|
|
||||||
field :admin, :type => Boolean, :default => true
|
field :admin, :type => Boolean, :default => true
|
||||||
field :active_roles, :type => Array
|
field :active_role
|
||||||
|
|
||||||
has_many :user_attributes
|
has_many :user_attributes
|
||||||
has_many :user_roles
|
has_many :user_roles
|
||||||
has_many :user_infos
|
has_many :user_infos
|
||||||
before_save :clean_active_roles
|
|
||||||
|
|
||||||
# Update or create the user_role records
|
# Update or create the user_role records
|
||||||
def user_roles=(*attrs)
|
def user_roles=(*attrs)
|
||||||
|
@ -49,21 +48,6 @@ class User
|
||||||
self.user_roles.detect {|a| a.key.to_s == key.to_s }
|
self.user_roles.detect {|a| a.key.to_s == key.to_s }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get the active user_role_models
|
|
||||||
def get_active_role_models
|
|
||||||
self.active_roles.map{ |role| get_role_model(role) } rescue []
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get an user_role_model from key
|
|
||||||
def get_role_model(key)
|
|
||||||
UserRoleModel.first(:conditions => {:key => key})
|
|
||||||
end
|
|
||||||
|
|
||||||
# Get the active roles names or default to '-'
|
|
||||||
def get_roles
|
|
||||||
(self.active_roles.nil? || self.active_roles.empty?) ? '-' : self.active_roles.map{|role| I18nVariable.first(:conditions => {:key => role})[I18n.locale] rescue role}.join(' / ')
|
|
||||||
end
|
|
||||||
|
|
||||||
def name
|
def name
|
||||||
infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') }
|
infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') }
|
||||||
if infos
|
if infos
|
||||||
|
@ -75,11 +59,4 @@ class User
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
# Remove empty values
|
|
||||||
def clean_active_roles
|
|
||||||
self.active_roles.delete('') if self.active_roles
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
class UserRoleModel < UserAttributeModel
|
class UserRoleModel < UserAttributeModel
|
||||||
|
|
||||||
|
# Get an user_role_model from key
|
||||||
|
def self.get_role_model_from_key(key)
|
||||||
|
self.first(:conditions => {:key => key})
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<%= fields_for "user_#{@attribute}_model[attribute_models][]", attribute_model, :index => nil do |f| %>
|
<%= fields_for "user_#{@attribute}_model[attribute_models][]", attribute_model, :index => nil do |f| %>
|
||||||
|
<tr class="list_item">
|
||||||
<tr>
|
<td><%= attribute_model.new_record? ? (f.text_field :key) : attribute_model.key %></td>
|
||||||
<td><%= attribute_model.new_record? ? (f.text_field :key, {:style => "width:130px"}) : attribute_model.key %></td>
|
|
||||||
<td class='select_mulitlingual' style='text-align:center'>
|
<td class='select_mulitlingual' style='text-align:center'>
|
||||||
<%= check_box_tag "locale[]", value = '', attribute_model.locale.nil? ? true : attribute_model.locale %>
|
<%= 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 %>
|
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][locale]", attribute_model.locale.nil? ? true : attribute_model.locale %>
|
||||||
|
@ -17,8 +16,9 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<span class="action">
|
||||||
<% if attribute_model.new_record? %>
|
<% if attribute_model.new_record? %>
|
||||||
<a href="#" class="remove">(<%= t(:delete) %>)</a>
|
<a href="#" class="delete"><%= t(:delete) %></a>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<% if attribute_model.is_built_in? %>
|
<% if attribute_model.is_built_in? %>
|
||||||
|
@ -28,13 +28,13 @@
|
||||||
</a>
|
</a>
|
||||||
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][disabled]", attribute_model.is_disabled? , :class => 'built_in_state' %>
|
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][disabled]", attribute_model.is_disabled? , :class => 'built_in_state' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="#" class="remove_existing_record">(<%= t(:delete) %>)</a>
|
<a href="#" class="remove_existing_record delete"><%= t(:delete) %></a>
|
||||||
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][should_destroy]", nil , :class => 'should_destroy' %>
|
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][should_destroy]", nil , :class => 'should_destroy' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= f.hidden_field :id %>
|
<%= f.hidden_field :id %>
|
||||||
<%= f.hidden_field :key %>
|
<%= f.hidden_field :key %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
|
@ -1,59 +1,73 @@
|
||||||
<table>
|
<div id="UserRole_block" class="roles_block">
|
||||||
|
<h2>User Role</h2>
|
||||||
|
<div class="info_input">
|
||||||
|
<table border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<thead class="list_head">
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t('admin.key') %></th>
|
<td><%= t('admin.key') %></td>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
|
<td style="color:<%= colorize_in_use_locale(locale) %>"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
</thead>
|
||||||
<td><%= is_new ? (f.text_field :key, {:style => "width:130px"}) : @user_attribute_model.key %></td>
|
<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| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<td>
|
<td>
|
||||||
<%= text_field_tag "user_#{@attribute}_model[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:130px" %>
|
<%= text_field_tag "user_#{@attribute}_model[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:150px" %>
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<fieldset id='field_set_attributes'>
|
|
||||||
<legend>
|
|
||||||
<%= t('admin.attributes')%>
|
|
||||||
</legend>
|
|
||||||
|
|
||||||
<table id='attributes'>
|
<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>
|
<tr>
|
||||||
<th><%= t('admin.key') %></th>
|
<td><%= t('admin.key') %></td>
|
||||||
<th><%= t('admin.multilingual') %></th>
|
<td><%= t('admin.multilingual') %></td>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
|
<td style="color:<%= colorize_in_use_locale(locale) %>"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<th><%= t('admin.type')%></th>
|
<td><%= t('admin.type')%></td>
|
||||||
<th></th>
|
<td> </td>
|
||||||
</tr>
|
</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 %>
|
<%= render :partial => 'admin/user_attribute_models/attribute_model', :collection => @user_attribute_model.attribute_models %>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
<a href="#" class="add">(<%= t(:add) %>)</a>
|
</div>
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$('#field_set_attributes a.remove').live('click', function(){
|
$('#attributes_block a.delete').live('click', function(){
|
||||||
$(this).parent().parent().remove();
|
$(this).parent().parent().parent().remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#field_set_attributes a.add').click(function(){
|
$('#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').append("<%= escape_javascript(render(:partial => 'admin/user_attribute_models/attribute_model', :object => @user_attribute_model.attribute_models.build)) %>");
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#field_set_attributes a.remove_existing_record').click(function(){
|
$('#attributes_block a.remove_existing_record').click(function(){
|
||||||
$(this).next('.should_destroy').attr('value', 1);
|
$(this).next('.should_destroy').attr('value', 1);
|
||||||
$(this).parent().parent().hide();
|
$(this).parent().parent().hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#field_set_attributes a.change_built_in').click(function(){
|
$('#attributes_block a.change_built_in').click(function(){
|
||||||
$(this).children().toggle();
|
$(this).children().toggle();
|
||||||
var $am = $(this).next('.built_in_state')
|
var $am = $(this).next('.built_in_state')
|
||||||
$am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
|
$am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
<h1><%= t("admin.editing_user_#{@attribute}") %>: <%= @user_attribute_model.key %></h1>
|
<% content_for :body_id do %>roles_list<% end -%>
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>
|
|
||||||
<%= t("admin.user_#{@attribute}")%>
|
|
||||||
</legend>
|
|
||||||
|
|
||||||
<%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_model_path(@user_role_model)") do |f| %>
|
|
||||||
<%= f.error_messages %>
|
|
||||||
|
|
||||||
<%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => false } %>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.submit t('update') %> <%= link_back %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
<% content_for :secondary do %>
|
||||||
|
<div class="member_setup">
|
||||||
|
<h1>Member Setup</h1>
|
||||||
|
<ul class="list">
|
||||||
|
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
|
||||||
|
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
</fieldset>
|
<div id="porfile">
|
||||||
|
<%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_model_path(@user_role_model)") do |f| %>
|
||||||
|
<%= f.error_messages %>
|
||||||
|
<%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => false } %>
|
||||||
|
<div class='buttom clear'>
|
||||||
|
<%= f.submit t('update') %> <%= link_back %>
|
||||||
|
</div>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
|
@ -1,5 +1,6 @@
|
||||||
|
<% content_for :body_id do %>roles_list<% end -%>
|
||||||
|
|
||||||
<% content_for :secondary do %>
|
<% content_for :secondary do %>
|
||||||
<div id='roles_list'>
|
|
||||||
<div class="member_setup">
|
<div class="member_setup">
|
||||||
<h1>Member Setup</h1>
|
<h1>Member Setup</h1>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
|
@ -7,7 +8,6 @@
|
||||||
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<!-- <table>
|
<!-- <table>
|
||||||
|
@ -35,7 +35,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</table> -->
|
</table> -->
|
||||||
|
|
||||||
<div id="add_new" class="clear">
|
<div class="main_list">
|
||||||
|
<div id="add_new" class="buttom clear">
|
||||||
<%= link_to t('admin.new_user_role'), new_admin_user_role_model_path %>
|
<%= link_to t('admin.new_user_role'), new_admin_user_role_model_path %>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -45,7 +46,7 @@
|
||||||
</li>
|
</li>
|
||||||
<% @user_attribute_models.each do |user_attribute_model| %>
|
<% @user_attribute_models.each do |user_attribute_model| %>
|
||||||
<li class="list_item clear">
|
<li class="list_item clear">
|
||||||
<span class="roles <%= user_attribute_model.i18n_variable[I18n.locale].downcase %>"><%= user_attribute_model.i18n_variable[I18n.locale] %></span>
|
<span class="roles <%= user_attribute_model.i18n_variable[:key].downcase %>"><%= user_attribute_model.i18n_variable[I18n.locale] %></span>
|
||||||
<span class="action">
|
<span class="action">
|
||||||
<%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'edit' %>
|
<%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'edit' %>
|
||||||
<%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'delete', :confirm => t('sure?'), :method => :delete unless user_attribute_model.is_built_in? %>
|
<%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'delete', :confirm => t('sure?'), :method => :delete unless user_attribute_model.is_built_in? %>
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="add_new" class="clear">
|
<div id="add_new" class="buttom clear">
|
||||||
<%= link_to t('admin.new_user_role'), new_admin_user_role_model_path %>
|
<%= link_to t('admin.new_user_role'), new_admin_user_role_model_path %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
<h1><%= t("admin.new_user_#{@attribute}") %></h1>
|
<% content_for :body_id do %>roles_list<% end -%>
|
||||||
|
|
||||||
<fieldset id='field_set_attributes'>
|
|
||||||
<legend>
|
|
||||||
<%= t("admin.user_#{@attribute}")%>
|
|
||||||
</legend>
|
|
||||||
|
|
||||||
<%= 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 } %>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.submit t('create') %> <%= link_back %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
<% content_for :secondary do %>
|
||||||
|
<div class="member_setup">
|
||||||
|
<h1>Member Setup</h1>
|
||||||
|
<ul class="list">
|
||||||
|
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
|
||||||
|
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
</fieldset>
|
<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='buttom clear'>
|
||||||
|
<%= f.submit t('create') %> <%= link_back %>
|
||||||
|
</div>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,63 +1,47 @@
|
||||||
<div id="select_user_roles">
|
<div id="person">
|
||||||
<% @user_role_models.each do |ua| %>
|
<% if @user.avatar? %>
|
||||||
<%= check_box_tag "user[active_roles][]", ua.key, (@user.active_roles.include?(ua.key) rescue false) %> <%= ua.i18n_variable[locale] %>
|
<%= image_tag(@user.avatar.thumb.url) %>
|
||||||
<% end -%>
|
<% else %>
|
||||||
<%= hidden_field_tag 'user[active_roles][]', '' %>
|
<%= image_tag "person.png" %>
|
||||||
</div>
|
<% end %>
|
||||||
|
<%#= file_field_tag 'file' %>
|
||||||
<div>
|
<%#= hidden_field_tag :avatar_cache %>
|
||||||
<label><%= t('admin.my_avatar') %></label>
|
<a id="upload" href="#"> Choose a file... </a>
|
||||||
<%= image_tag(@user.avatar.thumb.url) if @user.avatar? %>
|
|
||||||
<%= file_field_tag 'file' %>
|
|
||||||
<%= hidden_field_tag :avatar_cache %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
<%= f.label :email %>
|
|
||||||
<%= f.text_field :email %>
|
<%= f.text_field :email %>
|
||||||
</p>
|
<label>
|
||||||
<p>
|
<%= f.check_box :admin %><span>Admin</span>
|
||||||
<%= t('admin.admin') %>
|
</label>
|
||||||
<%= f.check_box :admin %>
|
<%= f.select :active_role, @user_role_models.sort_by{|role| role.key }.collect {|role| [ role.key.capitalize, role.key ]}, :selected => (@user.active_role || 'student') %>
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @user_info_models %>
|
|
||||||
<fieldset>
|
|
||||||
<legend><%= t('admin.info') %></legend>
|
|
||||||
<% @user_info_models.each do |ua| %>
|
<% @user_info_models.each do |ua| %>
|
||||||
<fieldset>
|
<div id="basic_block" class="roles_block">
|
||||||
|
<h2><%= ua.key.capitalize %></h2>
|
||||||
|
<hr>
|
||||||
<%= render :partial => 'user_attribute',
|
<%= render :partial => 'user_attribute',
|
||||||
:object => (@user.user_infos.detect {|u| u.key == ua.key } || @user.user_infos.build),
|
:object => (@user.user_infos.detect {|u| u.key == ua.key } || @user.user_infos.build),
|
||||||
:locals => {:ua => ua, :type => 'info'} %>
|
:locals => {:ua => ua, :type => 'info'} %>
|
||||||
</fieldset>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</fieldset>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @user_role_models %>
|
<div id='role_models'>
|
||||||
<fieldset id="roles" <%= raw(' style="display: none;"') unless (@user.active_roles.size > 0 rescue nil) %>>
|
|
||||||
<legend><%= t('admin.roles') %></legend>
|
|
||||||
<% @user_role_models.each do |ua| %>
|
<% @user_role_models.each do |ua| %>
|
||||||
<fieldset id="role_<%= ua.key %>" <%= raw(' style="display: none;"') unless (@user.active_roles.include?(ua.key) rescue nil) %>>
|
<div id="<%= ua.key %>_block" class="roles_block" <%= raw(' style="display: none;"') unless ((@user.active_role.eql?(ua.key) rescue nil) || (ua.key.eql?('student') && @user.new_record?)) %>>
|
||||||
|
<h2><%= ua.key.capitalize %></h2>
|
||||||
|
<hr>
|
||||||
<%= render :partial => 'user_attribute',
|
<%= render :partial => 'user_attribute',
|
||||||
:object => (@user.user_roles.detect {|u| u.key == ua.key } || @user.user_roles.build),
|
:object => (@user.user_roles.detect {|u| u.key == ua.key } || @user.user_roles.build),
|
||||||
:locals => {:ua => ua, :type => 'role'} %>
|
:locals => {:ua => ua, :type => 'role'} %>
|
||||||
</fieldset>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</fieldset>
|
</div>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#select_user_roles input').click(function(){
|
$('#user_active_role').change(function(){
|
||||||
$('#role_'+this.value).toggle();
|
$('#role_models .roles_block').hide();
|
||||||
if($("#select_user_roles input:checked").length > 0)
|
$('#'+this.value+'_block').toggle();
|
||||||
{ $('#roles').show(); }
|
|
||||||
else
|
|
||||||
{ $('#roles').hide(); }
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
<fieldset>
|
<div class="info_input">
|
||||||
<legend><%= am.i18n_variable[I18n.locale] %></legend>
|
<table border="0" cellspacing="0" cellpadding="0">
|
||||||
<table>
|
<thead class="list_head">
|
||||||
|
<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 %>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<% am.get_enabled_attribute_models.each do |attr| %>
|
<% am.get_enabled_attribute_models.each do |attr| %>
|
||||||
<tr>
|
<tr class="list_item">
|
||||||
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
<td><%= attr.i18n_variable[I18n.locale] %></td>
|
||||||
|
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<td>
|
<td>
|
||||||
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
<% if attr["locale"] && attr["markup"] == 'text_field' %>
|
||||||
<%= show_user_attribute(object, attr.key, I18n.locale) %>
|
<%= show_user_attribute(object, attr.key, locale) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= show_user_attribute(object, attr.key) %>
|
<%= show_user_attribute(object, attr.key) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</div>
|
|
@ -1,22 +1,23 @@
|
||||||
<%= fields_for "user[user_#{type}s]", user_attribute, :index => nil do |f| %>
|
<%= fields_for "user[user_#{type}s]", user_attribute, :index => nil do |f| %>
|
||||||
<legend><%= ua.i18n_variable[I18n.locale] %></legend>
|
|
||||||
<%= 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 user_attribute.new_record? %>
|
||||||
|
|
||||||
<table>
|
<div class="info_input">
|
||||||
|
<table border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<thead class="list_head">
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t("admin.key") %></th>
|
<td><%= t("admin.key") %></td>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
|
<td style="color:<%= colorize_in_use_locale(locale) %>"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<% ua.get_enabled_attribute_models.each do |attr| %>
|
<% ua.get_enabled_attribute_models.each do |attr| %>
|
||||||
<% value = user_attribute.attribute_values.detect{|v| v.key == attr.key } %>
|
<% value = user_attribute.attribute_values.detect{|v| v.key == attr.key } %>
|
||||||
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][id]", value.id rescue nil %>
|
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][id]", value.id rescue nil %>
|
||||||
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][key]", attr.key %>
|
<%= hidden_field_tag "user[user_#{type}s][][attribute_values][][key]", attr.key %>
|
||||||
<tr>
|
<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[user_#{type}s][][attribute_values][][non_locale]", nil %>
|
||||||
|
@ -36,7 +37,8 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
|
<% content_for :body_id do %>user_list<% end -%>
|
||||||
|
|
||||||
<% content_for :secondary do %>
|
<% content_for :secondary do %>
|
||||||
|
<div class="member_setup">
|
||||||
|
<h1>Member Setup</h1>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><%= link_to t('admin.new_user'), new_admin_user_path, :class => 'button positive' %></li>
|
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
|
||||||
|
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= flash_messages %>
|
<div id="porfile">
|
||||||
|
|
||||||
<h1><%= t('admin.user_panel') %></h1>
|
|
||||||
|
|
||||||
<%= 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 } %>
|
||||||
|
<div class='buttom clear'>
|
||||||
<p>
|
<%= f.submit t('update') %> <%= link_back %>
|
||||||
<%= f.submit t(:update) %> <%= link_back %>
|
</div>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
</div>
|
|
@ -1,5 +1,6 @@
|
||||||
|
<% content_for :body_id do %>user_list<% end -%>
|
||||||
|
|
||||||
<% content_for :secondary do %>
|
<% content_for :secondary do %>
|
||||||
<div id='user_list'>
|
|
||||||
<div class="member_setup">
|
<div class="member_setup">
|
||||||
<h1>Member Setup</h1>
|
<h1>Member Setup</h1>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
|
@ -7,12 +8,13 @@
|
||||||
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= flash_messages %>
|
|
||||||
|
|
||||||
<div id="add_new" class="clear">
|
|
||||||
|
<div class="main_list">
|
||||||
|
<%= flash_messages %>
|
||||||
|
<div id="add_new" class="buttom clear">
|
||||||
<%= link_to t('admin.new_user'), new_admin_user_path %>
|
<%= link_to t('admin.new_user'), new_admin_user_path %>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -25,7 +27,8 @@
|
||||||
</li>
|
</li>
|
||||||
<% @users.each do |user| %>
|
<% @users.each do |user| %>
|
||||||
<li class="list_item clear">
|
<li class="list_item clear">
|
||||||
<span class="roles <%= user.get_roles.downcase %>"><%= user.get_roles %></span>
|
<% active_role = UserRoleModel.get_role_model_from_key(user.active_role) %>
|
||||||
|
<span class="roles <%= active_role.key.downcase rescue nil %>"><%= active_role.i18n_variable[I18n.locale] rescue nil %></span>
|
||||||
<span class="name"><%= user.name ? user.name : 'bob' %></span>
|
<span class="name"><%= user.name ? user.name : 'bob' %></span>
|
||||||
<span class="email"><%= user.email %></span>
|
<span class="email"><%= user.email %></span>
|
||||||
<span class="admin"><%= user.admin ? t(:yes_) : t(:no_) %></span>
|
<span class="admin"><%= user.admin ? t(:yes_) : t(:no_) %></span>
|
||||||
|
@ -37,6 +40,7 @@
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="add_new" class="clear">
|
<div id="add_new" class="buttom clear">
|
||||||
<%= link_to t('admin.new_user'), new_admin_user_path %>
|
<%= link_to t('admin.new_user'), new_admin_user_path %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
|
<% content_for :body_id do %>user_list<% end -%>
|
||||||
|
|
||||||
<% content_for :secondary do %>
|
<% content_for :secondary do %>
|
||||||
|
<div class="member_setup">
|
||||||
|
<h1>Member Setup</h1>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><%= link_to t('admin.new_user'), new_admin_user_path, :class => 'button positive' %></li>
|
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
|
||||||
|
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<h1><%= t('admin.user_panel') %></h1>
|
<div id="porfile">
|
||||||
|
|
||||||
<%= 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 } %>
|
||||||
|
<div id="confirm" class='buttom clear'>
|
||||||
<p>
|
<%= f.submit t('create') %> <%= link_back %>
|
||||||
<%= f.submit t(:create) %> <%= link_back %>
|
</div>
|
||||||
</p>
|
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,40 @@
|
||||||
|
<% content_for :body_id do %>user_list<% end -%>
|
||||||
|
|
||||||
<% content_for :secondary do %>
|
<% content_for :secondary do %>
|
||||||
|
<div class="member_setup">
|
||||||
|
<h1>Member Setup</h1>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><%= link_to t('admin.new_user'), new_admin_user_path, :class => 'button positive' %></li>
|
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
|
||||||
|
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<h1><%= t('admin.user_panel') %></h1>
|
<div id="porfile">
|
||||||
|
|
||||||
<%= image_tag(@user.avatar.thumb.url) rescue nil %>
|
<div id="person">
|
||||||
|
<% if @user.avatar? %>
|
||||||
|
<%= image_tag(@user.avatar.thumb.url) %>
|
||||||
|
<% else %>
|
||||||
|
<%= image_tag "person.png" %>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to t(:edit), edit_admin_user_path(@user), :id => 'edit' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<%= @user.email %>
|
|
||||||
|
|
||||||
<% if @user_info_models %>
|
|
||||||
<fieldset>
|
|
||||||
<legend><%= t('admin.info') %></legend>
|
|
||||||
<% @user_info_models.each do |am| %>
|
<% @user_info_models.each do |am| %>
|
||||||
|
<div id="basic_block" class="roles_block">
|
||||||
|
<h2><%= am.i18n_variable[I18n.locale] %></h2>
|
||||||
|
<hr>
|
||||||
<%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_info_from_model_key(am.key)} %>
|
<%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_info_from_model_key(am.key)} %>
|
||||||
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</fieldset>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @user.active_roles.size > 0 %>
|
<div id="<%= @user.active_role %>_block" class="roles_block">
|
||||||
<fieldset>
|
<% active_role = UserRoleModel.get_role_model_from_key(@user.active_role) %>
|
||||||
<legend><%= t('admin.roles') %></legend>
|
<h2><%= active_role.i18n_variable[I18n.locale] %></h2>
|
||||||
<% @user.get_active_role_models.each do |am| %>
|
<hr>
|
||||||
<%= render :partial => 'show_user_attribute', :locals => {:am => am, :object => @user.get_role_from_model_key(am.key)} %>
|
<%= render :partial => 'show_user_attribute', :locals => {:am => active_role, :object => @user.get_role_from_model_key(active_role.key)} %>
|
||||||
<% end -%>
|
</div>
|
||||||
</fieldset>
|
|
||||||
<% end %>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<%= csrf_meta_tag %>
|
<%= csrf_meta_tag %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body id="<%= yield :body_id %>">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="hmenu">
|
<div id="hmenu">
|
||||||
<div id="orbit">
|
<div id="orbit">
|
||||||
|
@ -35,7 +35,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<div class="main_list">
|
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace :dev do
|
||||||
|
|
||||||
Site.create( :school => 'The Best School', :department => 'Awesome', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
Site.create( :school => 'The Best School', :department => 'Awesome', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
||||||
|
|
||||||
user = User.new( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :active_roles => ['teacher'])
|
user = User.new( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :active_role => 'teacher')
|
||||||
user.user_roles.build(:key => 'teacher', :discipline_en => 'Database', :discipline_zh_tw => '資料庫' )
|
user.user_roles.build(:key => 'teacher', :discipline_en => 'Database', :discipline_zh_tw => '資料庫' )
|
||||||
user.save!
|
user.save!
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
.bundle/
|
||||||
|
log/*.log
|
||||||
|
pkg/
|
||||||
|
test/dummy/db/*.sqlite3
|
||||||
|
test/dummy/log/*.log
|
||||||
|
test/dummy/tmp/
|
|
@ -0,0 +1,16 @@
|
||||||
|
source "http://rubygems.org"
|
||||||
|
|
||||||
|
# Declare your gem's dependencies in NewBlog.gemspec.
|
||||||
|
# Bundler will treat runtime dependencies like base dependencies, and
|
||||||
|
# development dependencies will be added by default to the :development group.
|
||||||
|
|
||||||
|
gem "mongoid"
|
||||||
|
gemspec
|
||||||
|
|
||||||
|
# Declare any dependencies that are still in development here instead of in
|
||||||
|
# your gemspec. These might include edge Rails or gems from your path or
|
||||||
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||||
|
# your gem to rubygems.org.
|
||||||
|
|
||||||
|
# To use debugger
|
||||||
|
# gem 'ruby-debug19', :require => 'ruby-debug'
|
|
@ -0,0 +1,101 @@
|
||||||
|
PATH
|
||||||
|
remote: .
|
||||||
|
specs:
|
||||||
|
NewBlog (0.0.1)
|
||||||
|
rails (~> 3.1.0.rc6)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: http://rubygems.org/
|
||||||
|
specs:
|
||||||
|
actionmailer (3.1.0)
|
||||||
|
actionpack (= 3.1.0)
|
||||||
|
mail (~> 2.3.0)
|
||||||
|
actionpack (3.1.0)
|
||||||
|
activemodel (= 3.1.0)
|
||||||
|
activesupport (= 3.1.0)
|
||||||
|
builder (~> 3.0.0)
|
||||||
|
erubis (~> 2.7.0)
|
||||||
|
i18n (~> 0.6)
|
||||||
|
rack (~> 1.3.2)
|
||||||
|
rack-cache (~> 1.0.3)
|
||||||
|
rack-mount (~> 0.8.2)
|
||||||
|
rack-test (~> 0.6.1)
|
||||||
|
sprockets (~> 2.0.0)
|
||||||
|
activemodel (3.1.0)
|
||||||
|
activesupport (= 3.1.0)
|
||||||
|
bcrypt-ruby (~> 3.0.0)
|
||||||
|
builder (~> 3.0.0)
|
||||||
|
i18n (~> 0.6)
|
||||||
|
activerecord (3.1.0)
|
||||||
|
activemodel (= 3.1.0)
|
||||||
|
activesupport (= 3.1.0)
|
||||||
|
arel (~> 2.2.1)
|
||||||
|
tzinfo (~> 0.3.29)
|
||||||
|
activeresource (3.1.0)
|
||||||
|
activemodel (= 3.1.0)
|
||||||
|
activesupport (= 3.1.0)
|
||||||
|
activesupport (3.1.0)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
arel (2.2.1)
|
||||||
|
bcrypt-ruby (3.0.0)
|
||||||
|
bson (1.3.1)
|
||||||
|
builder (3.0.0)
|
||||||
|
erubis (2.7.0)
|
||||||
|
hike (1.2.1)
|
||||||
|
i18n (0.6.0)
|
||||||
|
mail (2.3.0)
|
||||||
|
i18n (>= 0.4.0)
|
||||||
|
mime-types (~> 1.16)
|
||||||
|
treetop (~> 1.4.8)
|
||||||
|
mime-types (1.16)
|
||||||
|
mongo (1.3.1)
|
||||||
|
bson (>= 1.3.1)
|
||||||
|
mongoid (2.1.9)
|
||||||
|
activemodel (~> 3.0)
|
||||||
|
mongo (~> 1.3)
|
||||||
|
tzinfo (~> 0.3.22)
|
||||||
|
multi_json (1.0.3)
|
||||||
|
polyglot (0.3.2)
|
||||||
|
rack (1.3.2)
|
||||||
|
rack-cache (1.0.3)
|
||||||
|
rack (>= 0.4)
|
||||||
|
rack-mount (0.8.3)
|
||||||
|
rack (>= 1.0.0)
|
||||||
|
rack-ssl (1.3.2)
|
||||||
|
rack
|
||||||
|
rack-test (0.6.1)
|
||||||
|
rack (>= 1.0)
|
||||||
|
rails (3.1.0)
|
||||||
|
actionmailer (= 3.1.0)
|
||||||
|
actionpack (= 3.1.0)
|
||||||
|
activerecord (= 3.1.0)
|
||||||
|
activeresource (= 3.1.0)
|
||||||
|
activesupport (= 3.1.0)
|
||||||
|
bundler (~> 1.0)
|
||||||
|
railties (= 3.1.0)
|
||||||
|
railties (3.1.0)
|
||||||
|
actionpack (= 3.1.0)
|
||||||
|
activesupport (= 3.1.0)
|
||||||
|
rack-ssl (~> 1.3.2)
|
||||||
|
rake (>= 0.8.7)
|
||||||
|
rdoc (~> 3.4)
|
||||||
|
thor (~> 0.14.6)
|
||||||
|
rake (0.9.2)
|
||||||
|
rdoc (3.9.4)
|
||||||
|
sprockets (2.0.0)
|
||||||
|
hike (~> 1.2)
|
||||||
|
rack (~> 1.0)
|
||||||
|
tilt (!= 1.3.0, ~> 1.1)
|
||||||
|
thor (0.14.6)
|
||||||
|
tilt (1.3.3)
|
||||||
|
treetop (1.4.10)
|
||||||
|
polyglot
|
||||||
|
polyglot (>= 0.3.1)
|
||||||
|
tzinfo (0.3.29)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
NewBlog!
|
||||||
|
mongoid
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright 2011 YOURNAME
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,23 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "NewBlog/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "NewBlog"
|
||||||
|
s.version = NewBlog::VERSION
|
||||||
|
s.authors = ["TODO: Your name"]
|
||||||
|
s.email = ["TODO: Your email"]
|
||||||
|
s.homepage = "TODO"
|
||||||
|
s.summary = "TODO: Summary of NewBlog."
|
||||||
|
s.description = "TODO: Description of NewBlog."
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
s.add_dependency "rails", "~> 3.1.0.rc6"
|
||||||
|
# s.add_dependency "jquery-rails"
|
||||||
|
|
||||||
|
#s.add_development_dependency "sqlite3"
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name_of_app": "NewBlog",
|
||||||
|
"version": "0.1",
|
||||||
|
"organization": "Rulingcom",
|
||||||
|
"author": "RD dep",
|
||||||
|
"intro": "A simple blog……",
|
||||||
|
"update_info": "Some info",
|
||||||
|
"create_date": "11-11-2011"
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
= NewBlog
|
||||||
|
|
||||||
|
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env rake
|
||||||
|
begin
|
||||||
|
require 'bundler/setup'
|
||||||
|
rescue LoadError
|
||||||
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
require 'rdoc/task'
|
||||||
|
rescue LoadError
|
||||||
|
require 'rdoc/rdoc'
|
||||||
|
require 'rake/rdoctask'
|
||||||
|
RDoc::Task = Rake::RDocTask
|
||||||
|
end
|
||||||
|
|
||||||
|
RDoc::Task.new(:rdoc) do |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = 'NewBlog'
|
||||||
|
rdoc.options << '--line-numbers'
|
||||||
|
rdoc.rdoc_files.include('README.rdoc')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
|
end
|
||||||
|
|
||||||
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||||
|
load 'rails/tasks/engine.rake'
|
||||||
|
|
||||||
|
|
||||||
|
Bundler::GemHelper.install_tasks
|
||||||
|
|
||||||
|
require 'rake/testtask'
|
||||||
|
|
||||||
|
Rake::TestTask.new(:test) do |t|
|
||||||
|
t.libs << 'lib'
|
||||||
|
t.libs << 'test'
|
||||||
|
t.pattern = 'test/**/*_test.rb'
|
||||||
|
t.verbose = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task :default => :test
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
*This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||||
|
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||||
|
*the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||||
|
*= require_self
|
||||||
|
*= require_tree .
|
||||||
|
*/
|
|
@ -0,0 +1,21 @@
|
||||||
|
.preview h2 {
|
||||||
|
font-size: large;
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.production h2 {
|
||||||
|
font-size: large;
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.widget_index {
|
||||||
|
width: 200px;
|
||||||
|
height: 120px;
|
||||||
|
border: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.widget_latest_post{
|
||||||
|
width: 200px;
|
||||||
|
height: 120px;
|
||||||
|
border: solid;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
protect_from_forgery
|
||||||
|
before_filter :set_locale
|
||||||
|
|
||||||
|
# Set I18n.locale
|
||||||
|
def set_locale
|
||||||
|
# update session if passed
|
||||||
|
session[:locale] = params[:locale] if params[:locale]
|
||||||
|
|
||||||
|
# set locale based on session or default
|
||||||
|
begin
|
||||||
|
# check if locale is valid for non site pages
|
||||||
|
if !VALID_LOCALES.include?(session[:locale])
|
||||||
|
I18n.locale = I18n.default_locale
|
||||||
|
else
|
||||||
|
I18n.locale = session[:locale]
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
I18n.locale = I18n.default_locale
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
class Panel::Blog::CommentsController < ApplicationController
|
||||||
|
def create
|
||||||
|
@post = Post.find(params[:post_id])
|
||||||
|
@comment = @post.comments.create!(params[:comment])
|
||||||
|
redirect_to panel_blog_post_url(@post)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,111 @@
|
||||||
|
class Panel::Blog::PostsController < ApplicationController
|
||||||
|
|
||||||
|
layout 'admin'
|
||||||
|
|
||||||
|
# GET /posts
|
||||||
|
# GET /posts.xml
|
||||||
|
def widget_index
|
||||||
|
@posts = Post.all
|
||||||
|
widget_default_layout
|
||||||
|
end
|
||||||
|
def widget_latest_post
|
||||||
|
@post = Post.all.last
|
||||||
|
widget_default_layout
|
||||||
|
end
|
||||||
|
def index
|
||||||
|
@posts = Post.all
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.xml { render :xml => @posts }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /posts/1
|
||||||
|
# GET /posts/1.xml
|
||||||
|
def show
|
||||||
|
@post = Post.find(params[:id])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # show.html.erb
|
||||||
|
format.xml { render :xml => @post }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /posts/new
|
||||||
|
# GET /posts/new.xml
|
||||||
|
def new
|
||||||
|
@post = Post.new
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.xml { render :xml => @post }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /posts/1/edit
|
||||||
|
def edit
|
||||||
|
@post = Post.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /posts
|
||||||
|
# POST /posts.xml
|
||||||
|
def create
|
||||||
|
@post = Post.new(params[:post])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @post.save
|
||||||
|
format.html { redirect_to(panel_blog_post_url(@post), :notice => t('blog.create_post_success')) }
|
||||||
|
format.xml { render :xml => @post, :status => :created, :location => @post }
|
||||||
|
else
|
||||||
|
format.html { render :action => "new" }
|
||||||
|
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PUT /posts/1
|
||||||
|
# PUT /posts/1.xml
|
||||||
|
def update
|
||||||
|
@post = Post.find(params[:id])
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @post.update_attributes(params[:post])
|
||||||
|
format.html { redirect_to(panel_blog_post_url(@post), :notice => t('blog.update_post_success')) }
|
||||||
|
format.xml { head :ok }
|
||||||
|
else
|
||||||
|
format.html { render :action => "edit" }
|
||||||
|
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /posts/1
|
||||||
|
# DELETE /posts/1.xml
|
||||||
|
def destroy
|
||||||
|
@post = Post.find(params[:id])
|
||||||
|
@post.destroy
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to(panel_blog_posts_url) }
|
||||||
|
format.xml { head :ok }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def widget_default_layout
|
||||||
|
respond_to do |format|
|
||||||
|
format.html {
|
||||||
|
if params[:edit_view]
|
||||||
|
#in the case of editing,should be displayed in modal window and
|
||||||
|
#be restricted by the border developer sat.
|
||||||
|
render :layout => 'admin'
|
||||||
|
else
|
||||||
|
#in the case of fetching data for ajax display,should
|
||||||
|
render :layout => 'production'
|
||||||
|
end
|
||||||
|
}
|
||||||
|
format.xml { render :xml => @posts }
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
class Comment
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
field :name, :type => String
|
||||||
|
field :body, :type => String
|
||||||
|
embedded_in :post, :inverse_of => :comments
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
class Post
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
field :title, :type => String
|
||||||
|
field :body, :type => String
|
||||||
|
embeds_many :comments
|
||||||
|
validates_presence_of :title, :body
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Blog</title>
|
||||||
|
<%= stylesheet_link_tag :all %>
|
||||||
|
<%= javascript_include_tag :defaults %>
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Blog</title>
|
||||||
|
<%= stylesheet_link_tag :all %>
|
||||||
|
<%= javascript_include_tag :defaults %>
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
</head>
|
||||||
|
<body class="edit preview">
|
||||||
|
<div class="wapper">
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="production">
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
<%= f.error_messages %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :title %><br />
|
||||||
|
<%= f.text_field :title %>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :body %><br />
|
||||||
|
<%= f.text_area :body %>
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit %>
|
||||||
|
</div>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<h1><%= t('blog.editing_post') %></h1>
|
||||||
|
|
||||||
|
<%= form_for @post, :url => panel_blog_post_path(@post) do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= link_to t('blog.show'), panel_blog_post_path(@post) %> |
|
||||||
|
<%= link_back %>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<h1><%= t('blog.list_post') %></h1>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th><%= t('blog.title') %></th>
|
||||||
|
<th><%= t('blog.body') %></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% @posts.each do |post| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= post.title %></td>
|
||||||
|
<td><%= post.body %></td>
|
||||||
|
<td><%= link_to t('blog.show'), panel_blog_post_path(post) %></td>
|
||||||
|
<td><%= link_to t('blog.edit'), edit_panel_blog_post_path(post) %></td>
|
||||||
|
<td><%= link_to t('blog.delete'), panel_blog_post_path(post), :confirm => t('blog.sure?'), :method => :delete %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<%= link_to t('blog.new_post'), new_panel_blog_post_path %>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||||
|
<h2><%=@post.title%></h2>
|
||||||
|
<p>
|
||||||
|
<%= @post.body%>
|
||||||
|
</p>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<h1><%= t('blog.new_post') %></h1>
|
||||||
|
<%= form_for @post, :url => panel_blog_posts_path do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= link_back %>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<p id="notice"><%= flash_messages %></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b><%= t('blog.body') %></b>
|
||||||
|
<%=h @post.body %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2><%= t('blog.comments') %></h2>
|
||||||
|
|
||||||
|
<% @post.comments.each do |c| %>
|
||||||
|
<p>
|
||||||
|
<b><%=h c.name %> said:</b><br />
|
||||||
|
<%= time_ago_in_words(c.created_at) %> ago
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%=h c.body %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= form_for Comment.new, :url => panel_blog_comments_path do |f| %>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<%= f.label :name, "Author" %><br />
|
||||||
|
<%= f.text_field :name %><br />
|
||||||
|
<%= f.label :body, "Comment Description" %><br />
|
||||||
|
<%= f.text_area :body %>
|
||||||
|
<%= hidden_field_tag :post_id, @post.id %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%= f.submit "Add Comment" %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<%= link_to t('blog.edit'), edit_panel_blog_post_path(@post) %> |
|
||||||
|
<%= link_back %>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||||
|
<div class="widget_index">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th><%= t('blog.title') %></th>
|
||||||
|
<th><%= t('blog.body') %></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% @posts.each do |post| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= link_to post.title,panel_blog_post_path(post) %></td>
|
||||||
|
<td><%= post.body.truncate(14) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
7
vendor/plugins/NewBlog/app/views/panel/blog/posts/widget_latest_post.html.erb
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<%=stylesheet_link_tag "NewBlog/application"%>
|
||||||
|
<div class="widget_latest_post">
|
||||||
|
<h2><%= @post.title %> </h2>
|
||||||
|
<p>
|
||||||
|
<%= @post.body %>
|
||||||
|
</p>
|
||||||
|
</div>
|
|
@ -0,0 +1,13 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
namespace :panel do
|
||||||
|
namespace :blog do
|
||||||
|
root :to => "posts#index"
|
||||||
|
resources :posts
|
||||||
|
resources :comments
|
||||||
|
match "widget_latest_post" => "posts#widget_latest_post"
|
||||||
|
match "widget_index" => "posts#widget_index"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
require "NewBlog/engine"
|
||||||
|
|
||||||
|
|
||||||
|
module NewBlog
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
module NewBlog
|
||||||
|
class Engine < Rails::Engine
|
||||||
|
isolate_namespace NewBlog
|
||||||
|
PrototypeR4::Application::Orbit_Apps << "NewBlog"
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module NewBlog
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# desc "Explaining what the task does"
|
||||||
|
# task :NewBlog do
|
||||||
|
# # Task goes here
|
||||||
|
# end
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||||
|
|
||||||
|
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
||||||
|
load File.expand_path('../../test/dummy/script/rails', __FILE__)
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class NewBlogTest < ActiveSupport::TestCase
|
||||||
|
test "truth" do
|
||||||
|
assert_kind_of Module, NewBlog
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env rake
|
||||||
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
|
require File.expand_path('../config/application', __FILE__)
|
||||||
|
|
||||||
|
Dummy::Application.load_tasks
|
|
@ -0,0 +1,9 @@
|
||||||
|
// This is a manifest file that'll be compiled into including all the files listed below.
|
||||||
|
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
||||||
|
// be included in the compiled file accessible from http://example.com/assets/application.js
|
||||||
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||||
|
// the compiled file.
|
||||||
|
//
|
||||||
|
//= require jquery
|
||||||
|
//= require jquery_ujs
|
||||||
|
//= require_tree .
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||||
|
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||||
|
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||||
|
*= require_self
|
||||||
|
*= require_tree .
|
||||||
|
*/
|
|
@ -0,0 +1,3 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
protect_from_forgery
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dummy</title>
|
||||||
|
<%= stylesheet_link_tag "application" %>
|
||||||
|
<%= javascript_include_tag "application" %>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,4 @@
|
||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
run Dummy::Application
|
|
@ -0,0 +1,46 @@
|
||||||
|
require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
|
require "action_controller/railtie"
|
||||||
|
require "action_mailer/railtie"
|
||||||
|
require "active_resource/railtie"
|
||||||
|
require "rails/test_unit/railtie"
|
||||||
|
require "sprockets/railtie" # Uncomment this line for Rails 3.1+
|
||||||
|
|
||||||
|
Bundler.require
|
||||||
|
require "NewBlog"
|
||||||
|
|
||||||
|
module Dummy
|
||||||
|
class Application < Rails::Application
|
||||||
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
|
# Application configuration should go into files in config/initializers
|
||||||
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
||||||
|
# Custom directories with classes and modules you want to be autoloadable.
|
||||||
|
# config.autoload_paths += %W(#{config.root}/extras)
|
||||||
|
|
||||||
|
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||||
|
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||||
|
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||||
|
|
||||||
|
# Activate observers that should always be running.
|
||||||
|
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
||||||
|
|
||||||
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
|
# config.time_zone = 'Central Time (US & Canada)'
|
||||||
|
|
||||||
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||||
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
|
# config.i18n.default_locale = :de
|
||||||
|
|
||||||
|
# Configure the default encoding used in templates for Ruby 1.9.
|
||||||
|
config.encoding = "utf-8"
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
config.filter_parameters += [:password]
|
||||||
|
|
||||||
|
# Enable the asset pipeline
|
||||||
|
config.assets.enabled = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
require 'rubygems'
|
||||||
|
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
|
||||||
|
|
||||||
|
if File.exist?(gemfile)
|
||||||
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
||||||
|
require 'bundler'
|
||||||
|
Bundler.setup
|
||||||
|
end
|
||||||
|
|
||||||
|
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@ -0,0 +1,25 @@
|
||||||
|
# SQLite version 3.x
|
||||||
|
# gem install sqlite3
|
||||||
|
#
|
||||||
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||||
|
# gem 'sqlite3'
|
||||||
|
development:
|
||||||
|
adapter: sqlite3
|
||||||
|
database: db/development.sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test:
|
||||||
|
adapter: sqlite3
|
||||||
|
database: db/test.sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
||||||
|
|
||||||
|
production:
|
||||||
|
adapter: sqlite3
|
||||||
|
database: db/production.sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Load the rails application
|
||||||
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
|
# Initialize the rails application
|
||||||
|
Dummy::Application.initialize!
|
|
@ -0,0 +1,27 @@
|
||||||
|
Dummy::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb
|
||||||
|
|
||||||
|
# In the development environment your application's code is reloaded on
|
||||||
|
# every request. This slows down response time but is perfect for development
|
||||||
|
# since you don't have to restart the web server when you make code changes.
|
||||||
|
config.cache_classes = false
|
||||||
|
|
||||||
|
# Log error messages when you accidentally call methods on nil.
|
||||||
|
config.whiny_nils = true
|
||||||
|
|
||||||
|
# Show full error reports and disable caching
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Don't care if the mailer can't send
|
||||||
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Print deprecation notices to the Rails logger
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Only use best-standards-support built into browsers
|
||||||
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
|
||||||
|
# Do not compress assets
|
||||||
|
config.assets.compress = false
|
||||||
|
end
|
|
@ -0,0 +1,51 @@
|
||||||
|
Dummy::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb
|
||||||
|
|
||||||
|
# Code is not reloaded between requests
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Full error reports are disabled and caching is turned on
|
||||||
|
config.consider_all_requests_local = false
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||||
|
config.serve_static_assets = false
|
||||||
|
|
||||||
|
# Compress JavaScripts and CSS
|
||||||
|
config.assets.compress = true
|
||||||
|
|
||||||
|
# Specifies the header that your server uses for sending files
|
||||||
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||||
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||||
|
|
||||||
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
|
# config.force_ssl = true
|
||||||
|
|
||||||
|
# See everything in the log (default is :info)
|
||||||
|
# config.log_level = :debug
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups
|
||||||
|
# config.logger = SyslogLogger.new
|
||||||
|
|
||||||
|
# Use a different cache store in production
|
||||||
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
||||||
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
|
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||||
|
# config.assets.precompile += %w( search.js )
|
||||||
|
|
||||||
|
# Disable delivery errors, bad email addresses will be ignored
|
||||||
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Enable threaded mode
|
||||||
|
# config.threadsafe!
|
||||||
|
|
||||||
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
|
# the I18n.default_locale when a translation can not be found)
|
||||||
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
|
# Send deprecation notices to registered listeners
|
||||||
|
config.active_support.deprecation = :notify
|
||||||
|
end
|
|
@ -0,0 +1,39 @@
|
||||||
|
Dummy::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb
|
||||||
|
|
||||||
|
# The test environment is used exclusively to run your application's
|
||||||
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Configure static asset server for tests with Cache-Control for performance
|
||||||
|
config.serve_static_assets = true
|
||||||
|
config.static_cache_control = "public, max-age=3600"
|
||||||
|
|
||||||
|
# Log error messages when you accidentally call methods on nil
|
||||||
|
config.whiny_nils = true
|
||||||
|
|
||||||
|
# Show full error reports and disable caching
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Raise exceptions instead of rendering exception templates
|
||||||
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
|
# Disable request forgery protection in test environment
|
||||||
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
|
# The :test delivery method accumulates sent emails in the
|
||||||
|
# ActionMailer::Base.deliveries array.
|
||||||
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
||||||
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||||
|
# like if you have constraints or database-specific column types
|
||||||
|
# config.active_record.schema_format = :sql
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr
|
||||||
|
config.active_support.deprecation = :stderr
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||||
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||||
|
|
||||||
|
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||||
|
# Rails.backtrace_cleaner.remove_silencers!
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new inflection rules using the following format
|
||||||
|
# (all these examples are active by default):
|
||||||
|
# ActiveSupport::Inflector.inflections do |inflect|
|
||||||
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
|
# inflect.irregular 'person', 'people'
|
||||||
|
# inflect.uncountable %w( fish sheep )
|
||||||
|
# end
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new mime types for use in respond_to blocks:
|
||||||
|
# Mime::Type.register "text/richtext", :rtf
|
||||||
|
# Mime::Type.register_alias "text/html", :iphone
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Your secret key for verifying the integrity of signed cookies.
|
||||||
|
# If you change this key, all old signed cookies will become invalid!
|
||||||
|
# Make sure the secret is at least 30 characters and all random,
|
||||||
|
# no regular words or you'll be exposed to dictionary attacks.
|
||||||
|
Dummy::Application.config.secret_token = 'd50c02c22eac460faa82296161da6222762a7baff08669429b7b14b1e80b33f14cf1e1f8daf99486dda3b4d281c73b835169269a121027552299286a818c7d03'
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
||||||
|
|
||||||
|
# Use the database for sessions instead of the cookie-based default,
|
||||||
|
# which shouldn't be used to store highly confidential information
|
||||||
|
# (create the session table with "rails generate session_migration")
|
||||||
|
# Dummy::Application.config.session_store :active_record_store
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file contains settings for ActionController::ParamsWrapper which
|
||||||
|
# is enabled by default.
|
||||||
|
|
||||||
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
wrap_parameters format: [:json]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Disable root element in JSON by default.
|
||||||
|
ActiveSupport.on_load(:active_record) do
|
||||||
|
self.include_root_in_json = false
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Sample localization file for English. Add more files in this directory for other locales.
|
||||||
|
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
||||||
|
|
||||||
|
en:
|
||||||
|
hello: "Hello world"
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../../../../orbit/config/mongoid.yml
|
|
@ -0,0 +1,58 @@
|
||||||
|
Dummy::Application.routes.draw do
|
||||||
|
# The priority is based upon order of creation:
|
||||||
|
# first created -> highest priority.
|
||||||
|
|
||||||
|
# Sample of regular route:
|
||||||
|
# match 'products/:id' => 'catalog#view'
|
||||||
|
# Keep in mind you can assign values other than :controller and :action
|
||||||
|
|
||||||
|
# Sample of named route:
|
||||||
|
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
||||||
|
# This route can be invoked with purchase_url(:id => product.id)
|
||||||
|
|
||||||
|
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
||||||
|
# resources :products
|
||||||
|
|
||||||
|
# Sample resource route with options:
|
||||||
|
# resources :products do
|
||||||
|
# member do
|
||||||
|
# get 'short'
|
||||||
|
# post 'toggle'
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# collection do
|
||||||
|
# get 'sold'
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Sample resource route with sub-resources:
|
||||||
|
# resources :products do
|
||||||
|
# resources :comments, :sales
|
||||||
|
# resource :seller
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Sample resource route with more complex sub-resources
|
||||||
|
# resources :products do
|
||||||
|
# resources :comments
|
||||||
|
# resources :sales do
|
||||||
|
# get 'recent', :on => :collection
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Sample resource route within a namespace:
|
||||||
|
# namespace :admin do
|
||||||
|
# # Directs /admin/products/* to Admin::ProductsController
|
||||||
|
# # (app/controllers/admin/products_controller.rb)
|
||||||
|
# resources :products
|
||||||
|
# end
|
||||||
|
|
||||||
|
# You can have the root of your site routed with "root"
|
||||||
|
# just remember to delete public/index.html.
|
||||||
|
# root :to => 'welcome#index'
|
||||||
|
|
||||||
|
# See how all your routes lay out with "rake routes"
|
||||||
|
|
||||||
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
||||||
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
||||||
|
# match ':controller(/:action(/:id(.:format)))'
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The page you were looking for doesn't exist (404)</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
||||||
|
div.dialog {
|
||||||
|
width: 25em;
|
||||||
|
padding: 0 4em;
|
||||||
|
margin: 4em auto 0 auto;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
}
|
||||||
|
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/404.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<h1>The page you were looking for doesn't exist.</h1>
|
||||||
|
<p>You may have mistyped the address or the page may have moved.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The change you wanted was rejected (422)</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
||||||
|
div.dialog {
|
||||||
|
width: 25em;
|
||||||
|
padding: 0 4em;
|
||||||
|
margin: 4em auto 0 auto;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
}
|
||||||
|
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/422.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<h1>The change you wanted was rejected.</h1>
|
||||||
|
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|