diff --git a/.rspec b/.rspec
index 53607ea52..61f260b71 100644
--- a/.rspec
+++ b/.rspec
@@ -1 +1,2 @@
--colour
+--drb
diff --git a/Gemfile b/Gemfile
index 2732e1233..45b8257e1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -40,6 +40,7 @@ group :test, :development do
gem "rcov"
gem "delorean"
gem "watchr"
+ gem "spork"
# gem "capybara"
# gem 'yard'
# gem "bluecloth"
diff --git a/Gemfile.lock b/Gemfile.lock
index 6c1a1ae3d..86b786e59 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -154,6 +154,7 @@ GEM
rack (~> 1.3, >= 1.3.4)
rack-protection (~> 1.1, >= 1.1.2)
tilt (~> 1.3, >= 1.3.3)
+ spork (0.8.5)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
@@ -200,6 +201,7 @@ DEPENDENCIES
sass-rails
shoulda-matchers
sinatra
+ spork
sprockets
therubyracer
uglifier
diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb
new file mode 100644
index 000000000..a00bd94e6
--- /dev/null
+++ b/app/controllers/admin/infos_controller.rb
@@ -0,0 +1,49 @@
+class Admin::InfosController < ApplicationController
+
+ layout "admin"
+ before_filter :authenticate_user!
+ before_filter :is_admin?
+ before_filter :set_attribute, :only => [:index, :show, :new, :edit]
+
+ def index
+ @attributes = Info.all.entries
+ render :template => 'admin/attributes/index'
+ end
+
+ def show
+ #@attribute = Info.find(params[:id])
+ end
+
+ def new
+ @attribute = Info.new
+ end
+
+ def edit
+ @attribute = Info.find(params[:id])
+ @i18n_variable = @attribute.i18n_variable
+ end
+
+ def create
+ @attribute = Info.new(params[:info])
+ @attribute.save
+ redirect_to :action => :index
+ end
+
+ def update
+ @attribute = Info.find(params[:id])
+ @attribute.update_attributes(params[:info])
+ end
+
+ def destroy
+ @attribute = Info.find(params[:id])
+ @attribute.destroy
+ redirect_to :action => :index
+ end
+
+ protected
+
+ def set_attribute
+ @attribute_type = 'info'
+ end
+
+end
diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb
new file mode 100644
index 000000000..f3a17dd78
--- /dev/null
+++ b/app/controllers/admin/roles_controller.rb
@@ -0,0 +1,54 @@
+class Admin::RolesController < ApplicationController
+
+ layout "admin"
+ before_filter :authenticate_user!
+ before_filter :is_admin?
+ before_filter :set_attribute, :only => [:index, :show, :new, :edit]
+
+ def index
+ @attributes = Role.all.entries
+ render :template => 'admin/attributes/index'
+ end
+
+ def show
+ #@attribute = Role.find(params[:id])
+ end
+
+ def new
+ @attribute = Role.new
+ end
+
+ def edit
+ @attribute = Role.find(params[:id])
+ @i18n_variable = @attribute.i18n_variable
+ end
+
+ def create
+ @attribute = Role.new(params[:role])
+ @attribute.save
+ redirect_to :action => :index
+ end
+
+ def update
+ @attribute = Role.find(params[:id])
+ @attribute.update_attributes(params[:role])
+
+ respond_to do |format|
+ format.html { redirect_to :action => :index }
+ format.js { render 'admin/attributes/toggle_enable' }
+ end
+ end
+
+ def destroy
+ @attribute = Role.find(params[:id])
+ @attribute.destroy
+ redirect_to :action => :index
+ end
+
+ protected
+
+ def set_attribute
+ @attribute_type = 'role'
+ end
+
+end
diff --git a/app/controllers/admin/user_info_models_controller.rb b/app/controllers/admin/user_info_models_controller.rb
deleted file mode 100644
index 7660d699f..000000000
--- a/app/controllers/admin/user_info_models_controller.rb
+++ /dev/null
@@ -1,58 +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'
- end
-
-end
diff --git a/app/controllers/admin/user_role_models_controller.rb b/app/controllers/admin/user_role_models_controller.rb
deleted file mode 100644
index b4145a8f5..000000000
--- a/app/controllers/admin/user_role_models_controller.rb
+++ /dev/null
@@ -1,59 +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'
- end
-
-end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 79df2f2a3..77cada1b3 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -20,13 +20,13 @@ class Admin::UsersController < ApplicationController
def create
@user = User.new(params[:user])
if @user.save
- @user.user_infos.each do |user_info|
- user_info.save
- user_info.attribute_values.each(&:save)
+ @user.user_infos.each do |info|
+ info.save
+ info.attribute_values.each(&:save)
end
- @user.user_roles.each do |user_role|
- user_role.save
- user_role.attribute_values.each(&:save)
+ @user.roles.each do |role|
+ role.save
+ role.attribute_values.each(&:save)
end
flash[:notice] = t('admin.create_success_user')
redirect_to :action => :index
@@ -77,8 +77,8 @@ class Admin::UsersController < ApplicationController
protected
def get_info_role_models
- @user_info_models = UserInfoModel.excludes('disabled' => true)
- @user_role_models = UserRoleModel.excludes('disabled' => true)
+ @roles = Info.excludes('disabled' => true)
+ @infos = Role.excludes('disabled' => true)
end
end
diff --git a/app/models/i18n_variable.rb b/app/models/i18n_variable.rb
index e68353479..b5983d353 100644
--- a/app/models/i18n_variable.rb
+++ b/app/models/i18n_variable.rb
@@ -7,6 +7,8 @@ class I18nVariable
field :document_class, :type => String
field :parent_id, :type => BSON::ObjectId, :index => true
+ belongs_to :language_value, polymorphic: true
+
def method_missing(field)
self[field]
end
diff --git a/app/models/user/attribute.rb b/app/models/user/attribute.rb
new file mode 100644
index 000000000..aee7c36c5
--- /dev/null
+++ b/app/models/user/attribute.rb
@@ -0,0 +1,27 @@
+class Attribute
+
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :key
+ field :built_in, :type => Boolean, :default => false
+ field :disabled, :type => Boolean, :default => false
+
+ embeds_many :attribute_fields
+ has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+ accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
+ accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
+
+ def is_built_in?
+ self.built_in
+ end
+
+ def is_disabled?
+ self.disabled
+ end
+
+ def get_enabled_attribute_fields
+ self.attribute_fields.excludes('disabled' => true)
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/user/attribute_field.rb b/app/models/user/attribute_field.rb
new file mode 100644
index 000000000..56bb02b7b
--- /dev/null
+++ b/app/models/user/attribute_field.rb
@@ -0,0 +1,37 @@
+class AttributeField
+
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :key
+ field :markup
+ field :locale, :type => Boolean
+ field :list_options, :type => Array
+ field :built_in, :type => Boolean, :default => false
+ field :disabled, :type => Boolean, :default => false
+
+ embedded_in :attribute
+ has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+ has_many :attribute_values
+ validates_uniqueness_of :key
+ accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
+
+ # Convert the string list_options into an array
+ def select_list_options=(var)
+ self.list_options = var.gsub(' ', '').split(',')
+ end
+
+ # Convert the array list_options into a string
+ def select_list_options
+ self.list_options.to_a.join(', ')
+ end
+
+ def is_built_in?
+ self.built_in
+ end
+
+ def is_disabled?
+ self.disabled
+ end
+
+end
diff --git a/app/models/user/attribute_model.rb b/app/models/user/attribute_model.rb
deleted file mode 100644
index d2cb8a1a8..000000000
--- a/app/models/user/attribute_model.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-class AttributeModel
-
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field :key
- field :i18n_variable_id, :type => BSON::ObjectId, :index => true
- field :markup
- field :locale, :type => Boolean
- field :list_options, :type => Array
- field :built_in, :type => Boolean, :default => false
- field :disabled, :type => Boolean, :default => false
-
- embedded_in :user_attribute_model
- validates_uniqueness_of :key
-
- # Destroy the i18n_variable
- def destroy_i18n_variable
- self.i18n_variable.destroy rescue nil
- end
-
- # Get the i18n_variable
- def i18n_variable
- @i18n_variable ||= I18nVariable.find(self.i18n_variable_id) rescue nil
- end
-
- # Update or create the i18n_variable record
- def i18n_variable=(attr)
- if self.i18n_variable_id
- self.i18n_variable.update_attributes(attr)
- else
- # var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class, :parent_id => self.user_attribute_model.i18n_variable_id}))
- var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class}))
- var.save
- self.i18n_variable_id = var.id
- end
- end
-
- # Convert the string list_options into an array
- def select_list_options=(var)
- self.list_options = var.gsub(' ', '').split(',')
- end
-
- # Convert the array list_options into a string
- def select_list_options
- self.list_options.to_a.join(', ')
- end
-
- # Check if the attribute is set to be destroyed
- def should_destroy?
- should_destroy.to_i == 1 rescue nil
- end
-
- def is_built_in?
- self.built_in
- end
-
- def is_disabled?
- self.disabled
- end
-
-end
diff --git a/app/models/user/attribute_value.rb b/app/models/user/attribute_value.rb
index 877431f04..8b15bf3df 100644
--- a/app/models/user/attribute_value.rb
+++ b/app/models/user/attribute_value.rb
@@ -5,6 +5,7 @@ class AttributeValue
field :key
- belongs_to :user_attribute
+ belongs_to :attribute_field
+ belongs_to :user
end
diff --git a/app/models/user/info.rb b/app/models/user/info.rb
new file mode 100644
index 000000000..e55fa6f2b
--- /dev/null
+++ b/app/models/user/info.rb
@@ -0,0 +1,3 @@
+class Info < Attribute
+
+end
diff --git a/app/models/user/role.rb b/app/models/user/role.rb
new file mode 100644
index 000000000..90294f584
--- /dev/null
+++ b/app/models/user/role.rb
@@ -0,0 +1,29 @@
+class Role
+
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :key
+ field :built_in, :type => Boolean, :default => false
+ field :disabled, :type => Boolean, :default => false
+
+ embeds_many :sub_roles
+ has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+ has_many :users
+ accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
+ accepts_nested_attributes_for :sub_roles, :allow_destroy => true
+
+ def is_built_in?
+ self.built_in
+ end
+
+ def is_disabled?
+ self.disabled
+ end
+
+ # Get an role from key
+ def self.get_role_from_key(key)
+ self.first(:conditions => {:key => key})
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/user/sub_role.rb b/app/models/user/sub_role.rb
new file mode 100644
index 000000000..496055c2a
--- /dev/null
+++ b/app/models/user/sub_role.rb
@@ -0,0 +1,10 @@
+class SubRole < Attribute
+
+ has_many :users
+
+ # Get an sub_role from key
+ def self.get_sub_role_from_key(key)
+ self.first(:conditions => {:key => key})
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/user/user.rb b/app/models/user/user.rb
index f582dc04e..2eca43ddf 100644
--- a/app/models/user/user.rb
+++ b/app/models/user/user.rb
@@ -10,43 +10,10 @@ class User
field :admin, :type => Boolean, :default => true
field :active_role
- has_many :user_attributes
- has_many :user_roles
- has_many :user_infos
-
- # Update or create the user_role records
- def user_roles=(*attrs)
- attrs[0].each do |roles|
- if roles[:id].blank?
- user_roles.build(roles)
- else
- user_role = user_roles.detect {|a| a.id.to_s == roles[:id].to_s }
- user_role.update_attributes(roles)
- end
- end
- end
-
- # Update or create the user_info records
- def user_infos=(*attrs)
- attrs[0].each do |infos|
- if infos[:id].blank?
- user_infos.build(infos)
- else
- user_info = user_infos.detect {|a| a.id.to_s == infos[:id].to_s }
- user_info.update_attributes(infos)
- end
- end
- end
-
- # Get an user_info from model key
- def get_info_from_model_key(key)
- self.user_infos.detect {|a| a.key.to_s == key.to_s }
- end
-
- # Get an user_role from model key
- def get_role_from_model_key(key)
- self.user_roles.detect {|a| a.key.to_s == key.to_s }
- end
+ has_many :attribute_values, :autosave => true, :dependent => :destroy
+ belongs_to :role
+ belongs_to :sub_role
+ accepts_nested_attributes_for :attribute_values, :allow_destroy => true
def name
infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') }
diff --git a/app/models/user/user_attribute.rb b/app/models/user/user_attribute.rb
deleted file mode 100644
index ddf04cc10..000000000
--- a/app/models/user/user_attribute.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class UserAttribute
-
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field :key
- has_many :attribute_values
-
- # Update or create the attribute_value records
- def attribute_values=(*args)
- args[0].each do |value|
- if value[:id].blank?
- attribute_values.build(value)
- else
- attribute_value = attribute_values.detect {|a| a.id.to_s == value[:id].to_s }
- attribute_value.update_attributes(value)
- end
- end
- end
-
-end
diff --git a/app/models/user/user_attribute_model.rb b/app/models/user/user_attribute_model.rb
deleted file mode 100644
index c8aea4b2e..000000000
--- a/app/models/user/user_attribute_model.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-class UserAttributeModel
-
- include Mongoid::Document
- include Mongoid::Timestamps
-
- field :key
- field :i18n_variable_id, :type => BSON::ObjectId, :index => true
- field :built_in, :type => Boolean, :default => false
- field :disabled, :type => Boolean, :default => false
-
- embeds_many :attribute_models
-
- after_update :destroy_attrs
-
- # Update or create the attribute_model records
- def attribute_models=(*attrs)
- attrs[0].each do |attributes|
- if attributes[:id].blank?
- attribute_models.build(attributes)
- else
- attribute_model = attribute_models.detect {|a| a.id.to_s == attributes[:id].to_s }
- attribute_model.update_attributes(attributes)
- end
- end
- end
-
- # Destroy the i18n_variables
- def destroy_i18n_variables
- self.i18n_variable.destroy rescue nil
- self.attribute_models.each do |attr|
- attr.destroy_i18n_variable
- end
- end
-
- # Update or create the i18n_variable record
- def i18n_variable=(attr)
- if self.i18n_variable_id
- self.i18n_variable.update_attributes(attr) rescue nil
- else
- var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class}))
- var.save
- self.i18n_variable_id = var.id
- end
- end
-
- # Get the i18n_variable
- def i18n_variable
- @i18n_variable ||= I18nVariable.find(self.i18n_variable_id) rescue nil
- end
-
- def is_built_in?
- self.built_in
- end
-
- def is_disabled?
- self.disabled.blank? ? false : self.disabled
- end
-
- def get_enabled_attribute_models
- self.attribute_models.excludes('disabled' => true)
- end
-
- protected
-
- # Destroy the i18n_variable for each attribute_models if marked to destroy
- def destroy_attrs
- attribute_models.each do |a|
- if a.should_destroy?
- a.destroy_i18n_variable
- end
- end
- end
-
-end
diff --git a/app/models/user/user_info.rb b/app/models/user/user_info.rb
deleted file mode 100644
index f216c83af..000000000
--- a/app/models/user/user_info.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class UserInfo < UserAttribute
-
- belongs_to :user
-
-end
diff --git a/app/models/user/user_info_model.rb b/app/models/user/user_info_model.rb
deleted file mode 100644
index cacf2a55e..000000000
--- a/app/models/user/user_info_model.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class UserInfoModel < UserAttributeModel
-
-end
diff --git a/app/models/user/user_role.rb b/app/models/user/user_role.rb
deleted file mode 100644
index 1bc23e930..000000000
--- a/app/models/user/user_role.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class UserRole < UserAttribute
-
- belongs_to :user
-
-end
diff --git a/app/models/user/user_role_model.rb b/app/models/user/user_role_model.rb
deleted file mode 100644
index d5271edd1..000000000
--- a/app/models/user/user_role_model.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class UserRoleModel < UserAttributeModel
-
- # Get an user_role_model from key
- def self.get_role_model_from_key(key)
- self.first(:conditions => {:key => key})
- end
-
-end
diff --git a/app/views/admin/attributes/_attribute_model.html.erb b/app/views/admin/attributes/_attribute_model.html.erb
new file mode 100644
index 000000000..89c1ef890
--- /dev/null
+++ b/app/views/admin/attributes/_attribute_model.html.erb
@@ -0,0 +1,36 @@
+<%= fields_for "user_#{@attribute_type}_model[attribute_models][]", attribute_model, :index => nil do |f| %>
+
+ <%= attribute_model.new_record? ? (f.text_field :key) : attribute_model.key %>
+
+ <%= 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 %>
+
+ <% @site_valid_locales.each do |locale| %>
+ <%= text_field_tag "user_#{@attribute_type}_model[attribute_models][][i18n_variable][#{locale}]", (attribute_model.i18n_variable[locale] rescue nil), :style => "width:130px" %>
+ <% end %>
+
+ <%= f.select :markup, LIST[:markups], {}, {:style => "width:90px"} %>
+ >
+ <%= t('admin.options') %>:
+ <%= text_field_tag "user_#{@attribute_type}_model[attribute_models][][select_list_options]", attribute_model.select_list_options, :style => "width:130px" %>
+
+
+
+
+ <% if attribute_model.new_record? %>
+ <%= t(:delete) %>
+ <% else %>
+ <% if attribute_model.is_built_in? %>
+
+ <%= hidden_field_tag "user_#{@attribute_type}_model[attribute_models][][disabled]", attribute_model.is_disabled? , :class => 'built_in_state' %>
+ <% else %>
+ <%= t(:delete) %>
+ <%= 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 %>
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/attributes/_form.html.erb b/app/views/admin/attributes/_form.html.erb
new file mode 100644
index 000000000..5d66152c9
--- /dev/null
+++ b/app/views/admin/attributes/_form.html.erb
@@ -0,0 +1,57 @@
+
+
<%= t("admin.user_#{@attribute_type}") %>
+
+
+
+
+
+
+<% content_for :page_specific_javascript do %>
+ <%= javascript_include_tag "attribute_form" %>
+<% end -%>
diff --git a/app/views/admin/attributes/edit.html.erb b/app/views/admin/attributes/edit.html.erb
new file mode 100644
index 000000000..e0f75789a
--- /dev/null
+++ b/app/views/admin/attributes/edit.html.erb
@@ -0,0 +1,16 @@
+<% content_for :secondary do %>
+ <%= render 'admin/users/side_bar' %>
+<% end %>
+
+
+ <%= 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 } %>
+
+ <%= link_to t('update'), "#", :onclick=>"$('#edit_user_role_model_#{@attribute.id}').submit()" %>
+
+
+ <%= link_back %>
+
+ <% end -%>
+
\ No newline at end of file
diff --git a/app/views/admin/attributes/index.html.erb b/app/views/admin/attributes/index.html.erb
new file mode 100644
index 000000000..efd8c7756
--- /dev/null
+++ b/app/views/admin/attributes/index.html.erb
@@ -0,0 +1,34 @@
+<% content_for :secondary do %>
+ <%= render 'admin/users/side_bar' %>
+<% end %>
+
+
+
+ <%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path") %>
+
+
+
+ <%= t("admin.#{@attribute_type}") %>
+ <%= t('admin.action') %>
+
+ <% @attributes.each do |attribute| %>
+ clear">
+ <%= attribute.i18n_variable[I18n.locale] %>
+
+
+ <%= 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(: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' %>
+ <% else %>
+ <%= link_to t(:delete), eval("admin_#{@attribute_type}_path(attribute)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
+ <% end %>
+
+
+
+ <% end %>
+
+
+ <%= link_to t("admin.new_#{@attribute_type}"), eval("new_admin_#{@attribute_type}_path") %>
+
+
diff --git a/app/views/admin/attributes/new.html.erb b/app/views/admin/attributes/new.html.erb
new file mode 100644
index 000000000..431814d19
--- /dev/null
+++ b/app/views/admin/attributes/new.html.erb
@@ -0,0 +1,20 @@
+<% content_for :secondary do %>
+ <%= render 'admin/users/side_bar' %>
+<% end %>
+
+
+ <%= form_for @attribute, :url => eval("admin_infos_path") do |f| %>
+ <%= f.error_messages %>
+ <%= render :partial => "admin/infos/form", :locals => { :f => f, :is_new => true } %>
+
+ <%= link_to t('create'), "#", :onclick=>"$('#new_attribute').submit()" %>
+
+
+ <%= link_back %>
+
+ <% end -%>
+
+
+
+
+
diff --git a/app/views/admin/attributes/toggle_enable.js.erb b/app/views/admin/attributes/toggle_enable.js.erb
new file mode 100644
index 000000000..c42c47447
--- /dev/null
+++ b/app/views/admin/attributes/toggle_enable.js.erb
@@ -0,0 +1,3 @@
+$("#enable_<%= @attribute.id %>").toggle();
+$("#disable_<%= @attribute.id %>").toggle();
+$("#attribute_<%= @attribute.id %>").toggleClass('disable');
\ No newline at end of file
diff --git a/app/views/admin/infos/edit.html.erb b/app/views/admin/infos/edit.html.erb
new file mode 100644
index 000000000..e0f75789a
--- /dev/null
+++ b/app/views/admin/infos/edit.html.erb
@@ -0,0 +1,16 @@
+<% content_for :secondary do %>
+ <%= render 'admin/users/side_bar' %>
+<% end %>
+
+
+ <%= 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 } %>
+
+ <%= link_to t('update'), "#", :onclick=>"$('#edit_user_role_model_#{@attribute.id}').submit()" %>
+
+
+ <%= link_back %>
+
+ <% end -%>
+
\ No newline at end of file
diff --git a/app/views/admin/users/_side_bar.html.erb b/app/views/admin/users/_side_bar.html.erb
new file mode 100644
index 000000000..8b8393db9
--- /dev/null
+++ b/app/views/admin/users/_side_bar.html.erb
@@ -0,0 +1,11 @@
+
+
+
+
+
<%= t('admin.setup_member') %>
+
+ <%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %>
+ <%= link_to content_tag(:span, t('admin.list_roles')), admin_roles_path %>
+ <%= link_to content_tag(:span, t('admin.list_infos')), admin_infos_path %>
+
+
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index fba21f022..69a554d1a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -22,6 +22,7 @@ PrototypeR4::Application.routes.draw do
post 'edit_file' => 'designs#edit_file'
end
end
+ resources :infos
resources :items
resources :links do
member do
@@ -43,12 +44,11 @@ PrototypeR4::Application.routes.draw do
get 'download'
end
end
+ resources :roles
resources :sites
resources :snippets
resources :translations
resources :users
- resources :user_info_models
- resources :user_role_models
end
# end admin
diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake
index 2ab64d6d9..60dcdbe07 100644
--- a/lib/tasks/dev.rake
+++ b/lib/tasks/dev.rake
@@ -15,13 +15,13 @@ namespace :dev do
I18nVariable.create!( :document_class => 'language', :key => 'en', :en => 'English', :zh_tw => '英文' )
I18nVariable.create!( :document_class => 'language', :key => 'zh_tw', :en => 'Chinese', :zh_tw => '中文' )
- var_1 = I18nVariable.create!( :document_class => 'UserRoleModel', :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_3 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_1.id )
- var_4 = I18nVariable.create!( :document_class => 'UserRoleModel', :key => 'student', :en => 'Student', :zh_tw => '學生' )
+ var_4 = I18nVariable.create!( :document_class => 'Role', :key => 'student', :en => 'Student', :zh_tw => '學生' )
var_5 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_4.id )
var_6 = I18nVariable.create!( :document_class => 'AttributeModel', :key => 'major', :en => 'Major', :zh_tw => '主修', :parent_id => var_4.id )
- var_7 = I18nVariable.create!( :document_class => 'UserInfoModel', :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_9 = I18nVariable.create!( :document_class => 'AttributeModel', :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 => '首頁')
@@ -32,17 +32,17 @@ namespace :dev do
# TODO: modify for the new model
- urm_1 = UserRoleModel.new( :key => 'teacher', :i18n_variable_id => var_1.id, :built_in => true )
- urm_1.attribute_models.build( :key => 'discipline', :locale => true, :i18n_variable_id => var_2.id, :markup => 'text_field', :list_options => [], :built_in => true )
- urm_1.attribute_models.build( :key => 'department', :locale => true, :i18n_variable_id => var_3.id, :markup => 'text_field', :list_options => [], :built_in => true )
+ urm_1 = Role.new( :key => 'teacher', :i18n_variable_id => var_1.id, :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 )
+ urm_1.attributes.build( :key => 'department', :locale => true, :i18n_variable_id => var_3.id, :markup => 'text_field', :list_options => [], :built_in => true )
urm_1.save!
- urm_2 = UserRoleModel.new( :key => 'student', :i18n_variable_id => var_4.id )
- urm_2.attribute_models.build( :key => 'department', :locale => true, :i18n_variable_id => var_5.id, :markup => 'text_field', :list_options => [] )
- urm_2.attribute_models.build( :key => 'major', :locale => true, :i18n_variable_id => var_6.id, :markup => 'text_field', :list_options => [] )
+ 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 = UserInfoModel.new( :key => 'profile', :i18n_variable_id => var_7.id, :built_in => true )
- uim_1.attribute_models.build( :key => 'last_name', :locale => true, :i18n_variable_id => var_8.id, :markup => 'text_field', :list_options => [], :built_in => true )
- uim_1.attribute_models.build( :key => 'first_name', :locale => true, :i18n_variable_id => var_9.id, :markup => 'text_field', :list_options => [], :built_in => true )
+ 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!
@@ -118,22 +118,18 @@ namespace :dev do
- user = User.create( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :active_role => 'teacher' )
- user_info = UserInfo.create( :user_id => user.id, :key => 'profile' )
- user_role = UserRole.create( :user_id => user.id, :key => 'teacher' )
- AttributeValue.create( :user_attribute_id => user_info.id, :key => 'first_name', :en => 'Christophe', :zh_tw => '順發' )
- AttributeValue.create( :user_attribute_id => user_info.id, :key => 'last_name', :en => 'Vilayphiou', :zh_tw => '林' )
- AttributeValue.create( :user_attribute_id => user_role.id, :key => 'discipline', :en => 'Computer Architecture', :zh_tw => '計算機系統結構' )
- AttributeValue.create( :user_attribute_id => user_role.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
+ user = User.create( :email => 'chris@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => urm_1.id )
+ AttributeValue.create( :user_id => user.id, :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, :key => 'discipline', :en => 'Computer Architecture', :zh_tw => '計算機系統結構' )
+ AttributeValue.create( :user_id => user.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
- user = User.create( :email => 'matt@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :active_role => 'student' )
- user_info = UserInfo.create( :user_id => user.id, :key => 'profile' )
- user_role = UserRole.create( :user_id => user.id, :key => 'student' )
- AttributeValue.create( :user_attribute_id => user_info.id, :key => 'first_name', :en => 'Matt', :zh_tw => '儒淵' )
- AttributeValue.create( :user_attribute_id => user_info.id, :key => 'last_name', :en => 'Fu', :zh_tw => '傅' )
- AttributeValue.create( :user_attribute_id => user_role.id, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
- AttributeValue.create( :user_attribute_id => user_role.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
+ user = User.create( :email => 'matt@rulingcom.com', :password => 'password', :password_confirmation => 'password', :admin => true, :role_id => urm_2.id )
+ AttributeValue.create( :user_id => user.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, :key => 'major', :en => 'Information management', :zh_tw => '信息化管理' )
+ AttributeValue.create( :user_id => user.id, :key => 'department', :en => 'Computer Science', :zh_tw => '計算機科學' )
diff --git a/spec/controllers/design_controller_spec.rb b/spec/controllers/design_controller_spec.rb
deleted file mode 100644
index dd02b1cdc..000000000
--- a/spec/controllers/design_controller_spec.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'spec_helper'
-
-describe DesignController do
-
- describe "GET 'index'" do
- it "should be successful" do
- get 'index'
- response.should be_success
- end
- end
-
- describe "GET 'new'" do
- it "should be successful" do
- get 'new'
- response.should be_success
- end
- end
-
- describe "GET 'update'" do
- it "should be successful" do
- get 'update'
- response.should be_success
- end
- end
-
- describe "GET 'edit'" do
- it "should be successful" do
- get 'edit'
- response.should be_success
- end
- end
-
- describe "GET 'destroy'" do
- it "should be successful" do
- get 'destroy'
- response.should be_success
- end
- end
-
- describe "GET 'create'" do
- it "should be successful" do
- get 'create'
- response.should be_success
- end
- end
-
-end
diff --git a/spec/helpers/design_helper_spec.rb b/spec/helpers/design_helper_spec.rb
deleted file mode 100644
index dcebcb47f..000000000
--- a/spec/helpers/design_helper_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'spec_helper'
-
-# Specs in this file have access to a helper object that includes
-# the DesignHelper. For example:
-#
-# describe DesignHelper do
-# describe "string concat" do
-# it "concats two strings with spaces" do
-# helper.concat_strings("this","that").should == "this that"
-# end
-# end
-# end
-describe DesignHelper do
- pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/models/design_spec.rb b/spec/models/design_spec.rb
deleted file mode 100644
index 704b1d252..000000000
--- a/spec/models/design_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe Design do
- pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb
new file mode 100644
index 000000000..d75877925
--- /dev/null
+++ b/spec/models/role_spec.rb
@@ -0,0 +1,109 @@
+require 'spec_helper'
+
+describe Role do
+ before do
+ @role = Role.create(:key => 'teacher',
+ :i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'},
+ :sub_roles => [{:key => 'undergrad',
+ :attribute_fields => [{:key => 'department'},
+ {:key => 'room'}]},
+ {:key => 'master',
+ :attribute_fields => [{:key => 'department'}]}])
+ end
+ describe 'New role' do
+ describe '#Role' do
+ it 'should have :built_in false' do
+ @role.built_in.should be false
+ end
+ it 'should have :disabled false' do
+ @role.disabled.should be false
+ end
+ it 'should have a i18n_variable' do
+ @role.i18n_variable.should be_an_instance_of I18nVariable
+ end
+ it 'should create sub_roles' do
+ @role.should have(2).sub_roles
+ end
+ it 'should create attribute_fields' do
+ @role.sub_roles[1].should have(1).attribute_fields
+ end
+ end
+ describe '#SubRole' do
+ it 'should have :built_in false' do
+ @role.sub_roles[0].built_in.should be false
+ end
+ it 'should have :disabled false' do
+ @role.sub_roles[0].disabled.should be false
+ end
+ end
+ describe '#AttributeField' do
+ it 'should have :built_in false' do
+ @role.sub_roles[0].attribute_fields[0].built_in.should be false
+ end
+ it 'should have :disabled false' do
+ @role.sub_roles[0].attribute_fields[0].disabled.should be false
+ end
+ end
+ end
+ describe 'Edit role' do
+ describe '#Role' do
+ before do
+ @role.update_attributes({:key => 'student', :i18n_variable => {:en => 'Student'},
+ :sub_roles => [{:key => 'new',
+ :attribute_fields => [{:key => 'bob'},
+ {:key => 'great'}]},
+ {:id => @role.sub_roles[0].id},
+ {:id => @role.sub_roles[1].id}]})
+ end
+ it 'should not be the old :key' do
+ @role.key.should_not == 'teacher'
+ end
+ it 'should be the new :key' do
+ @role.key.should == 'student'
+ end
+ it 'should not be the old :i18n_variable[:en]' do
+ @role.i18n_variable[:en].should_not == 'Teacher'
+ end
+ it 'should be the new :i18n_variable[:en]' do
+ @role.i18n_variable[:en].should == 'Student'
+ end
+ it 'should have one more SubRole' do
+ @role.should have(3).sub_roles
+ end
+ end
+ end
+ describe 'Destroy' do
+ describe '#AttributeField' do
+ before do
+ @role.update_attributes(:key => 'teacher',
+ :i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'},
+ :sub_roles_attributes => {'0' => {:id => @role.sub_roles[0].id,
+ :key => 'undergrad',
+ :attribute_fields_attributes => {'0' => {:id => @role.sub_roles[0].attribute_fields[0].id,
+ :key => 'department'},
+ '1' => {:id => @role.sub_roles[0].attribute_fields[1].id,
+ :key => 'room', :_destroy => true}}}})
+ end
+ it 'should have only one AttributeField for the first SubRole' do
+ @role.sub_roles[0].should have(1).attribute_fields
+ end
+ end
+ describe '#I18nVariable' do
+ before do
+ @role.update_attributes(:key => 'teacher',
+ :i18n_variable_attributes => {:id => @role.i18n_variable.id, :key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role', :_destroy => true})
+ end
+ it 'should not have a I18nVariable' do
+ @role.i18n_variable.should_not be_an_instance_of I18nVariable
+ end
+ end
+ describe '#Role' do
+ it 'should destroy the I18nVariable' do
+ id = @role.i18n_variable.id
+ @role.destroy
+ lambda {I18nVariable.find(id)}.should raise_error
+ end
+ end
+ end
+
+end
\ No newline at end of file
diff --git a/spec/spec.opts b/spec/spec.opts
deleted file mode 100644
index 391705bf8..000000000
--- a/spec/spec.opts
+++ /dev/null
@@ -1,4 +0,0 @@
---colour
---format progress
---loadby mtime
---reverse
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 9b8b02c8f..a4b16f6c2 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,27 +1,58 @@
-# This file is copied to spec/ when you run 'rails generate rspec:install'
-ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../../config/environment", __FILE__)
-require 'rspec/rails'
+require 'rubygems'
+require 'spork'
-# Requires supporting ruby files with custom matchers and macros, etc,
-# in spec/support/ and its subdirectories.
-Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+Spork.prefork do
+ # Loading more in this block will cause your tests to run faster. However,
+ # if you change any configuration or code from libraries loaded here, you'll
+ # need to restart spork for it take effect.
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
+ ENV["RAILS_ENV"] ||= 'test'
+ require File.expand_path("../../config/environment", __FILE__)
+ require 'rspec/rails'
+ require 'rspec/autorun'
-RSpec.configure do |config|
- # == Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
- config.mock_with :rspec
+ # Requires supporting ruby files with custom matchers and macros, etc,
+ # in spec/support/ and its subdirectories.
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ RSpec.configure do |config|
+ # == Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, remove the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = true
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ # config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ # config.use_transactional_fixtures = true
+
+ # If true, the base class of anonymous controllers will be inferred
+ # automatically. This will be the default behavior in future versions of
+ # rspec-rails.
+ config.infer_base_class_for_anonymous_controllers = false
+ end
end
+
+Spork.each_run do
+ # This code will be run each time you run your specs.
+ load "#{Rails.root}/config/routes.rb"
+ Dir["#{Rails.root}/app/**/*.rb"].each { |f| load f }
+end
+
+# --- Instructions ---
+# - Sort through your spec_helper file. Place as much environment loading
+# code that you don't normally modify during development in the
+# Spork.prefork block.
+# - Place the rest under Spork.each_run block
+# - Any code that is left outside of the blocks will be ran during preforking
+# and during each_run!
+# - These instructions should self-destruct in 10 seconds. If they don't,
+# feel free to delete them.
+#
\ No newline at end of file
diff --git a/spec/views/design/create.html.erb_spec.rb b/spec/views/design/create.html.erb_spec.rb
deleted file mode 100644
index aa2aa68ba..000000000
--- a/spec/views/design/create.html.erb_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "design/create.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/views/design/destroy.html.erb_spec.rb b/spec/views/design/destroy.html.erb_spec.rb
deleted file mode 100644
index 4944b52a5..000000000
--- a/spec/views/design/destroy.html.erb_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "design/destroy.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/views/design/edit.html.erb_spec.rb b/spec/views/design/edit.html.erb_spec.rb
deleted file mode 100644
index beb152f78..000000000
--- a/spec/views/design/edit.html.erb_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "design/edit.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/views/design/index.html.erb_spec.rb b/spec/views/design/index.html.erb_spec.rb
deleted file mode 100644
index 6ef1761eb..000000000
--- a/spec/views/design/index.html.erb_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "design/index.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/views/design/new.html.erb_spec.rb b/spec/views/design/new.html.erb_spec.rb
deleted file mode 100644
index 3af6c8888..000000000
--- a/spec/views/design/new.html.erb_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "design/new.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/spec/views/design/update.html.erb_spec.rb b/spec/views/design/update.html.erb_spec.rb
deleted file mode 100644
index bf4335775..000000000
--- a/spec/views/design/update.html.erb_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'spec_helper'
-
-describe "design/update.html.erb" do
- pending "add some examples to (or delete) #{__FILE__}"
-end