break down Ray's HTML

This commit is contained in:
Matthew K. Fu JuYuan authored and Christophe Vilayphiou committed 2012-09-14 00:02:22 +08:00
1 parent 3e5978c8fd
commit 5fb94f644d
11 files changed
+260 -131

No files matched your search

+36 -2
View File
@@ -9,13 +9,47 @@ class AttributeField
field :list_options, :type => Array
field :built_in, :type => Boolean, :default => false
field :disabled, :type => Boolean, :default => false
field :title, localize: true
#field :title, localize: true
field :locale_title, localize: true
field :neutral_title
belongs_to :attribute
belongs_to :role
has_many :attribute_values
# validates_uniqueness_of :key
def title_translations
if locale
return locale_title_translations
else
return Hash[VALID_LOCALES.map{|d| [d,neutral_title]}]
end
end
def title_translations=(var)
if locale
self.locale_title = var
end
end
def title
if locale
return self.locale_title
else
return self.neutral_title
end
end
def title=(var)
binding.pry
if locale
self.locale_title = var
else
self.neutral_title = var
end
end
# Convert the string list_options into an array
def select_list_options=(var)
self.list_options = var.gsub(' ', '').split(',')
+2
View File
@@ -10,6 +10,8 @@ class Role
has_many :sub_roles, :autosave => true, :dependent => :destroy
has_many :users
has_many :statuses, :autosave => true, :dependent => :destroy
has_many :attribute_fields, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :sub_roles, :allow_destroy => true
def is_built_in?
+11
View File
@@ -0,0 +1,11 @@
class Status
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :role
has_and_belongs_to_many :sub_roles
field :title, localize: true
end
+1 -1
View File
@@ -2,7 +2,7 @@ class SubRole < Attribute
belongs_to :role
has_and_belongs_to_many :users
has_and_belongs_to_many :statuses, :autosave => true, :dependent => :destroy
# Get an sub_role from key
def self.get_sub_role_from_key(key)
self.first(:conditions => {:key => key})
@@ -9,10 +9,13 @@
<% end %>
<% end %>
<td class='select_type'>
<%= f.select :markup, LIST[:markups], {}, {:style => "width:90px"} %>
<div <%= attribute_field[:markup].eql?('select') ? nil : "style='display:none'"%>>
<%= t('admin.options') %>:
<%= f.select "select_list_options", attribute_field.select_list_options, :style => "width:130px" %>
<%= f.select "select_list_options", {'1'=>"A",'2'=>"B",'3'=>"C"}, :style => "width:130px" %>
<%#= collection_select(:select_list_options, method, collection, value_method, text_method, options = {}, html_options = {}) %>
</div>
</td>
<td class="action">
@@ -0,0 +1,46 @@
<div class="item element">
<h3><i class="icons-content"></i>Module Name</h3>
<div class="detail w-a h-a">
<table class="table table-striped">
<thead>
<tr>
<th>模組</th>
<th class="span2">數量</th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td class="span2">2,304</td>
</tr>
<tr>
<td>Master</td>
<td class="span2">783</td>
</tr>
<tr>
<td>Doctor</td>
<td class="span2">45</td>
</tr>
<tr>
<td>Staff</td>
<td class="span2">62</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,16 @@
<div class="roles <%= role_class %>">
<div class="label-line">
<hr />
<span><%= t(i18n)%></span>
</div>
<table class="table">
<tbody>
<% items.each do |item| %>
<tr>
<td class="span1"><%= item[:name] %></td>
<td><%= item[:value] %></td>
</tr>
<% end -%>
</tbody>
</table>
</div>
+49 -126
View File
@@ -1,135 +1,58 @@
<div class="user-info clear">
<div class="user-avatar pull-left">
<p class="reflective"></p>
<%= image_tag(@user.avatar.url) %>
<div id="isotope" class="user-data">
<div id="module-nav">
<div class="arrow_next pull-right"><i class="icon-chevron-right"></i></div>
<div class="arrow_prev pull-left"><i class="icon-chevron-left"></i></div>
<div class="module-nav-view">
<ul class="nav nav-pills">
<li class="active">
<a href="#"><%= t("admin.new_admin.users.all_plugin_summary")%></a>
</li>
<li><a href="#">學歷</a></li>
<li><a href="#">學歷</a></li>
<li><a href="#">學歷</a></li>
<li><a href="#">學歷</a></li>
</ul>
</div>
</div>
<div class="user-info-basic clear">
<div class="member-plugin">
<% binding.pry%>
<%= render :partial=> 'plugin_summary'%>
<%= render :partial=> 'plugin_summary'%>
<%= render :partial=> 'plugin_summary'%>
</div>
</div>
<div class="user-info">
<div id="brand" class="clear">
<p class="gender male"></p>
<a class="btn pull-right" href="#"><i class="icon-edit"></i> <%= t("admin.new_admin.action.edit")%></a>
<div class="user-avatar pull-left">
<p class="reflective"></p>
<img src="images/menber-pic.png">
</div>
<p class="user-name">
<%= @user.name %>
<%= @user.name%>
</p>
<p class="user-mail">
<%= @user.email %>
</p>
<hr />
<button class="btn btn-small"><i class="icon-pencil"></i> <%= t("admin.edit")%></button>
</div>
<div class="user-roles my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<% test_items = [ {:name=> "1",:value =>"Matt"},{:name=> "2",:value =>"Mark"},{:name=> "3",:value =>"Luke"},{:name=> "4",:value =>"John"} ]%>
<%= render :partial=> "user_role",:locals=>{:role_class=>"basic",:i18n=>"admin.new_admin.users.profile",:items=>test_items} %>
<%= render :partial=> "user_role",:locals=>{:role_class=>"teacher",:i18n=>"admin.new_admin.users.roles.teacher",:items=>test_items} %>
<%= render :partial=> "user_role",:locals=>{:role_class=>"student",:i18n=>"admin.new_admin.users.roles.student",:items=>test_items}%>
<%= render :partial=> "user_role",:locals=>{:role_class=>"staff",:i18n=>"admin.new_admin.users.roles.staff",:items=>test_items} %>
</div>
<div>
</div>
</div>
<div class="user-data">
<ul class="roles-nav">
<li class="teacher active">
<a href="#teacher" data-toggle="tab">
Teacher
</a>
</li>
<li class="student">
<a href="#student" data-toggle="tab">
Student
</a>
</li>
<li class="staff">
<a href="#staff" data-toggle="tab">
Staff
</a>
</li>
<li class="data">
<a href="#data" data-toggle="tab">
Data
</a>
</li>
</ul>
<div class="tab-content user-info-roles">
<div class="tab-pane fade in active teacher" id="teacher">
<p>講師</p>
</div>
<div class="tab-pane fade staff" id="staff">
staff
</div>
<div class="tab-pane fade student" id="student">
student
</div>
<div class="tab-pane fade data" id="data">
<div class="data-block information">
<h2>Information</h2>
<hr>
<div class="info_input">
<table>
<thead class="list_head">
<tr>
<td>Key</td>
<td>English</td>
<td>Chinese</td>
</tr>
</thead>
<tbody>
<tr class="list_item">
<td>Last Name</td>
<td>Last Name</td>
<td>姓</td>
</tr>
<tr class="list_item">
<td>First Name</td>
<td>First Name</td>
<td>名</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="data-block teacher">
<h2>Teacher</h2>
<hr>
<div class="info_input">
<table>
<thead class="list_head">
<tr>
<td>Key</td>
<td>English</td>
<td>Chinese</td>
</tr>
</thead>
<tbody>
<tr class="list_item">
<td>Last Name</td>
<td>Last Name</td>
<td>姓</td>
</tr>
<tr class="list_item">
<td>First Name</td>
<td>First Name</td>
<td>名</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="data-block student">
<h2>Student</h2>
<hr>
<div class="info_input">
<table>
<thead class="list_head">
<tr>
<td>Key</td>
<td>English</td>
<td>Chinese</td>
</tr>
</thead>
<tbody>
<tr class="list_item">
<td>Last Name</td>
<td>Last Name</td>
<td>姓</td>
</tr>
<tr class="list_item">
<td>First Name</td>
<td>First Name</td>
<td>名</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>