Chris's first commit at Fri Jan 28 2011 10:14:32 GMT+0800 (CST)

This commit is contained in:
ihower committed 2011-04-13 18:19:51 +08:00
1 parent 554aa0a95d
commit 19a7d51e60
145 files changed
+12742 -893

No files matched your search

+3 -5
View File
@@ -1,16 +1,14 @@
<%= f.error_messages %>
<p>
<%= f.label :filename, "FileName" %>
<%= f.label :filename, t('admin.file_name') %>
<%= f.text_field :filename, :class => 'text' %>
</p>
<p>
<%= f.label :description, "Description" %>
<%= f.label :description, t('admin.description') %>
<%= f.text_field :description, :class => 'text' %>
</p>
<p>
<%= f.label :data, "Data" %>
<%= f.label :data, t('admin.data') %>
<%= f.file_field :data %>
</p>
+3 -5
View File
@@ -1,12 +1,10 @@
<h1>Editing assets</h1>
<h1><%= t('editing_asset') %></h1>
<% form_for @asset, :url => admin_asset_path(@asset), :html => { :multipart => true } do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
<%= f.submit t('update') %> <%= link_back %>
</p>
<% end %>
<%= link_to 'Back', admin_assets_path %>
+21 -20
View File
@@ -1,31 +1,32 @@
<h1>Listing assets</h1>
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t(:new_asset, :scope => :admin), new_admin_asset_path, :class => 'button positive' %></li>
</ul>
<% end -%>
<h1><%= t('admin.list_assets') %></h1>
<table>
<tr>
<th>檔案</th>
<th>描述</th>
<th>格式</th>
<th>原上傳檔名</th>
<th>檔案大小</th>
<th></th>
<th></th>
<th><%= t('admin.file_name') %></th>
<th><%= t('admin.description') %></th>
<th><%= t('admin.format') %></th>
<th><%= t('admin.orig_upload_file') %></th>
<th><%= t('admin.file_name') %></th>
<th><%= t('admin.action') %></th>
</tr>
<% @assets.each do |asset| %>
<tr>
<td><%#= link_to asset.filename, admin_asset_path(asset) %>
<%= link_to asset.url, asset.url %>
</td>
<td><%= link_to asset.filename, asset.data.url, :target => '_blank' %></td>
<td><%= asset.description %></td>
<td><%= asset.data.content_type %></td>
<td><%= asset.data.file_name %></td>
<td><%= number_to_human_size(asset.data.file_size) %></td>
<td><%= link_to t(:edit), edit_admin_asset_path(asset) %></td>
<td><%= link_to t(:delete), admin_asset_path(asset), :confirm => 'Are you sure?', :method => :delete %></td>
<td><%= asset.data.file.content_type %></td>
<td><%= asset.data_filename %></td>
<td><%= number_to_human_size(asset.data.file.file_length) %></td>
<td>
<%= link_to t(:edit), edit_admin_asset_path(asset) %> |
<%= link_to t(:delete), admin_asset_path(asset), :confirm => t('sure?'), :method => :delete %>
</td>
</tr>
<% end %>
</table>
<br />
<%= link_to t(:new_asset, :scope => :admin), new_admin_asset_path, :class => 'button positive' %>
+4 -5
View File
@@ -1,11 +1,10 @@
<h1>New Asset</h1>
<h1><%= t('admin.new_asset') %></h1>
<% form_for :asset, :url => admin_assets_path, :html => { :multipart => true } do |f| %>
<%= form_for :asset, :url => admin_assets_path, :html => { :multipart => true } do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end %>
<% end %>
+30
View File
@@ -0,0 +1,30 @@
<%= f.hidden_field :parent_id %>
<p>
<%= f.label :name, t('admin.name') %>
<%= f.text_field :name, :class => 'text', :value => 'home', :disabled => true %>
<%= f.hidden_field :name, :value => 'home' %>
</p>
<% @site_valid_locales.each do |locale| %>
<p>
<%= label_tag "#{f}[title]", "#{t('admin.title')} #{locale}" %>
<%= text_field_tag "#{f}[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :class => 'text' %>
</p>
<% end %>
<p>
<%= f.label :layout_name, t('admin.layout_name') %>
<%= f.select :layout_name, Layout.all.map{ |l| [l.description, l.name] } %>
</p>
<p>
<%= f.label "content", t('admin.content') %>
<%= f.text_area "content", :size => '100x30' %>
</p>
<p>
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
+10
View File
@@ -0,0 +1,10 @@
<h1><%= t('admin.editing_home') %></h1>
<%= form_for @home, :url => admin_home_path(@home) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit t('update') %> <%= link_back %>
</p>
<% end %>
+11
View File
@@ -0,0 +1,11 @@
<h1><%= t('admin.new_home') %></h1>
<%= form_for :home, :url => admin_homes_path do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end %>
+1 -1
View File
@@ -7,5 +7,5 @@
<td>
<%= link_to t(:show), item.url %> |
<%= link_to t(:edit), edit_admin_component_path(item) %> |
<%= link_to t(:delete), admin_component_path(item), :confirm => 'Are you sure?', :method => :delete %>
<%= link_to t(:delete), admin_component_path(item), :confirm => t('sure?'), :method => :delete %>
</td>
+10
View File
@@ -0,0 +1,10 @@
<td><%= item.class %></td>
<td><%= link_to item.name, admin_items_path(:parent_id => item.id) %></td>
<td><%= item.i18n_variable[I18n.locale] rescue nil %>
<td><%= item.position %></td>
<td><%= item.is_published.to_s %></td>
<td>
<%= link_to t(:show), item.url %> |
<%= link_to t(:edit), edit_admin_home_path(item) %> |
<%= link_to t(:delete), admin_home_path(item), :confirm => t('sure?'), :method => :delete %>
</td>
+10 -11
View File
@@ -1,11 +1,10 @@
<td><%= item.class %></td>
<td><%= link_to item.name, admin_items_path(:parent_name => item.name) %></td>
<td><%=h item.title %>
<td><%= item.position %></td>
<td><%= item.is_published.to_s %></td>
<td>
<%= link_to t(:show), item.url %> |
<%= link_to t(:edit), edit_admin_link_path(item) %> |
<%= link_to t(:delete), admin_link_path(item), :confirm => 'Are you sure?', :method => :delete %>
</td>
<td><%= item.class %></td>
<td><%= item.name %></td>
<td><%= item.i18n_variable[I18n.locale] rescue nil %>
<td><%= item.position %></td>
<td><%= item.is_published.to_s %></td>
<td>
<%= link_to t(:show), item.url %> |
<%= link_to t(:edit), edit_admin_link_path(item) %> |
<%= link_to t(:delete), admin_link_path(item), :confirm => t('sure?'), :method => :delete %>
</td>
+4 -4
View File
@@ -1,11 +1,11 @@
<td><%= item.class %></td>
<td><%= link_to item.name, admin_items_path(:parent_name => item.name) %></td>
<td><%=h item.title %>
<td><%= link_to item.name, admin_items_path(:parent_id => item.id) %></td>
<td><%= item.i18n_variable[I18n.locale] rescue nil %>
<td><%= item.position %></td>
<td><%= item.is_published.to_s %></td>
<td>
<%= link_to t(:show), item.url %> |
<%= link_to t(:edit), edit_admin_page_path(item) %> |
<%= link_to t(:delete), admin_page_path(item), :confirm => 'Are you sure?', :method => :delete %>
</td>
<%= link_to t(:delete), admin_page_path(item), :confirm => t('sure?'), :method => :delete %>
</td>
+3 -3
View File
@@ -1,4 +1,4 @@
<h1>Listing snippets</h1>
<h1><%= t('admin.list_snippets') %></h1>
<table>
<tr>
@@ -9,7 +9,7 @@
<td><%= snippet.name %></td>
<td><%= link_to t(:show), admin_snippet_path(snippet) %>
<td><%= link_to t(:edit), edit_admin_snippet_path(snippet) %></td>
<td><%= link_to t(:delete), admin_snippet_path(snippet), :confirm => 'Are you sure?', :method => :delete %></td>
<td><%= link_to t(:delete), admin_snippet_path(snippet), :confirm => t('sure?'), :method => :delete %></td>
</tr>
<% end %>
<% end if snippets%>
</table>
+37 -25
View File
@@ -1,32 +1,44 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t(:new_page, :scope => :admin), new_admin_page_path( :parent_name => @parent_item.name ), :class => 'button positive' %></li>
<li><%= link_to t(:new_link, :scope => :admin), new_admin_link_path( :parent_name => @parent_item.name ) %>
<li><%= link_to t(:new_snippet, :scope => :admin ), new_admin_snippet_path( :parent_name => @parent_item.name ), :class => 'button positive' %></li>
</ul>
<ul class="list">
<% if (@items.empty? && !@parent_item ) || (!@items.empty? && @items[0].is_home?) %>
<li><%= t('admin.new_page') %></li>
<li><%= t('admin.new_link') %></li>
<li><%= t('admin.new_snippet') %></li>
<% else %>
<li><%= link_to t('admin.new_page'), new_admin_page_path( :parent_id => @parent_item.id ), :class => 'button positive' %></li>
<li><%= link_to t('admin.new_link'), new_admin_link_path( :parent_id => @parent_item.id ) %>
<li><%= link_to t('admin.new_snippet'), new_admin_snippet_path( :parent_id => @parent_item.id ), :class => 'button positive' %></li>
<% end %>
</ul>
<% end -%>
<h1>Listing items: <%= show_parent_items_link(@parent_item) %></h1>
<h1><%= t('admin.list_items') %>: <%= show_parent_items_link unless @parent_item.nil? %></h1>
<table>
<tr>
<th>Class</th>
<th>Name</th>
<th>Title</th>
<th>Position</th>
<th>Published?</th>
<th>Action</th>
<th></th>
</tr>
<% @items.each do |item| %>
<tr>
<%= render :partial => item.class.to_s.downcase, :locals => { :item => item } %>
<!--<td><%= link_to t(:move_up, :scope => :admin), up_admin_item_path(item), :method => :put %> |
<%= link_to t(:move_down, :scope => :admin), down_admin_item_path(item), :method => :put %></td>-->
</tr>
<% if !Layout.exist_one? %>
<div style='color:red'><%= t('admin.no_layout') %>: <%= link_to t('create').downcase, new_admin_layout_path %></div>
<br/>
<% elsif (@items.empty? && !@parent_item ) %>
<div style='color:red'><%= t('admin.no_home_page') %>: <%= link_to t('create').downcase, new_admin_home_path(:parent_id => nil) %></div>
<br/>
<% else %>
<table>
<tr>
<th><%= t('admin.class') %></th>
<th><%= t('admin.name') %></th>
<th><%= t('admin.title') %></th>
<th><%= t('admin.position') %></th>
<th><%= t('admin.published?') %></th>
<th><%= t('admin.action') %></th>
<th></th>
</tr>
<% @items.each do |item| %>
<tr>
<%= render :partial => item.class.to_s.downcase, :locals => { :item => item } %>
<!--<td><%= link_to t(:move_up, :scope => :admin), up_admin_item_path(item), :method => :put %> |
<%= link_to t(:move_down, :scope => :admin), down_admin_item_path(item), :method => :put %></td>-->
</tr>
<% end if @items %>
</table>
<% end %>
</table>
<%= render :partial => "snippets", :locals => { :snippets => @snippets } %>
+5 -21
View File
@@ -1,30 +1,14 @@
<p>
<%= f.label :name, "Name" %>
<%= f.label :name, t('admin.name') %>
<%= f.text_field :name, :class => 'text' %>
</p>
<p>
<%= f.label :description, "Description" %>
<%= f.label :description, t('admin.description') %>
<%= f.text_field :description, :class => 'text' %>
</p>
<p id="content_zh_tw_block">
<%= f.label "content_zh_tw", "Content (zh_tw)" %>
<%= f.text_area "content_zh_tw", :size => '100x30' %>
<p>
<%= f.label "content", t('admin.content') %>
<%= f.text_area :content, :size => '100x30' %>
</p>
<p><a href="#" id="toggle_content_en_block">Edit english</a></p>
<p id="content_en_block">
<%= f.label "content_en", "Content (en)" %>
<%= f.text_area "content_en", :size => '100x30' %>
</p>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('#content_en_block').hide();
$('#toggle_content_en_block').click(function(){
$('#content_en_block').toggle();
});
</script>
<% end -%>
+3 -6
View File
@@ -1,12 +1,9 @@
<h1>Editing layouts</h1>
<h1><%= t('admin.editing_layout') %></h1>
<% form_for @layout, :url => admin_layout_path(@layout) do |f| %>
<%= form_for @layout, :url => admin_layout_path(@layout) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
<%= f.submit t('update') %> <%= link_back %>
</p>
<% end %>
<%= link_to 'Back', admin_layouts_path %>
+14 -7
View File
@@ -1,19 +1,26 @@
<h1>Listing layouts</h1>
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t(:new_layout, :scope => :admin), new_admin_layout_path, :class => 'button positive' %></li>
</ul>
<% end -%>
<h1><%= t('admin.list_layouts') %></h1>
<table>
<tr>
<th><%= t('admin.name') %></th>
<th><%= t('admin.description') %></th>
<th><%= t('admin.action') %></th>
</tr>
<% @layouts.each do |layout| %>
<tr>
<td><%= layout.name %></td>
<td><%= layout.description %></td>
<td><%= link_to t(:edit), edit_admin_layout_path(layout) %></td>
<td><%= link_to t(:delete), admin_layout_path(layout), :confirm => 'Are you sure?', :method => :delete %></td>
<td>
<%= link_to t(:edit), edit_admin_layout_path(layout) %> |
<%= link_to t(:delete), admin_layout_path(layout), :confirm => t('sure?'), :method => :delete %>
</td>
</tr>
<% end %>
</table>
<br />
<%= link_to t(:new_layout, :scope => :admin), new_admin_layout_path, :class => 'button positive' %>
+3 -6
View File
@@ -1,13 +1,10 @@
<h1>New layouts</h1>
<h1><%= t('admin.new_layout') %></h1>
<% form_for :layout, :url => admin_layouts_path do |f| %>
<%= form_for :layout, :url => admin_layouts_path do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end %>
<%= link_to 'Back', admin_layouts_path %>
+9 -13
View File
@@ -1,28 +1,24 @@
<%= f.error_messages %>
<%= f.hidden_field :parent_name %>
<%= f.hidden_field :parent_id %>
<p>
<%= f.label :name, "Name" %>
<%= f.text_field :name, :class => 'text' %>
</p>
<p>
<%= f.label :title, "Title en" %>
<%= f.text_field :title_en, :class => 'text' %>
</p>
<% @site_valid_locales.each do |locale| %>
<p>
<%= label_tag "link[title]", "#{t('admin.title')} #{locale}" %>
<%= text_field_tag "link[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :class => 'text' %>
</p>
<% end %>
<p>
<%= f.label :title, "Title zh_tw" %>
<%= f.text_field :title_zh_tw, :class => 'text' %>
</p>
<p>
<%= f.label :is_published, "Is Published" %>
<%= f.label :is_published, t('admin.is_published') %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
<p>
<%= f.label :url, "URL" %>
<%= f.text_field :url %>
</p>
</p>
+4 -4
View File
@@ -1,10 +1,10 @@
<h1>Editing pages</h1>
<h1><%= t('admin.editing_link') %></h1>
<% form_for @link, :url => admin_link_path(@link) do |f| %>
<%= form_for @link, :url => admin_link_path(@link) do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
<%= f.submit t(:update) %> <%= link_back %>
</p>
<% end %>
<% end %>
+4 -4
View File
@@ -1,11 +1,11 @@
<h1><%= t(:new_link, :scope => :admin) %></h1>
<h1><%= t('admin.new_link') %></h1>
<% form_for @link, :url => admin_links_path do |f| %>
<%= form_for @link, :url => admin_links_path do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
<%= f.submit t(:create) %> <%= link_back %>
</p>
<% end %>
<% end %>
+19 -34
View File
@@ -1,49 +1,34 @@
<%= f.error_messages %>
<%= f.hidden_field :parent_name %>
<%= f.hidden_field :parent_id %>
<p>
<%= f.label :name, "Name" %>
<%= f.text_field :name, :class => 'text' %>
</p>
<p>
<%= f.label :title, "Title en" %>
<%= f.text_field :title_en, :class => 'text' %>
<%= f.label :name, t('admin.name') %>
<% if @page.parent_id.nil? %>
<%= f.text_field :name, :class => 'text', :value => 'home', :disabled => true %>
<%= f.hidden_field :name, :value => 'home' %>
<% else %>
<%= f.text_field :name, :class => 'text' %>
<% end %>
</p>
<p>
<%= f.label :title, "Title zh_tw" %>
<%= f.text_field :title_zh_tw, :class => 'text' %>
</p>
<% @site_valid_locales.each do |locale| %>
<p>
<%= label_tag "#{f}[title]", "#{t('admin.title')} #{locale}" %>
<%= text_field_tag "#{f}[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :class => 'text' %>
</p>
<% end %>
<p>
<%= f.label :layout_name, "Layout Name" %>
<%= f.label :layout_name, t('admin.layout_name') %>
<%= f.select :layout_name, Layout.all.map{ |l| [l.description, l.name] } %>
</p>
<p id="content_zh_tw_block">
<%= f.label "content_zh_tw", "Content (zh_tw)" %>
<%= f.text_area "content_zh_tw", :size => '100x30' %>
</p>
<p><a href="#" id="toggle_content_en_block">Edit english</a></p>
<p id="content_en_block">
<%= f.label "content_en", "Content (en)" %>
<%= f.text_area "content_en", :size => '100x30' %>
<p>
<%= f.label "content", t('admin.content') %>
<%= f.text_area "content", :size => '100x30' %>
</p>
<p>
<%= f.label :is_published, "Is Published" %>
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('#content_en_block').hide();
$('#toggle_content_en_block').click(function(){
$('#content_en_block').toggle();
});
</script>
<% end -%>
+6 -5
View File
@@ -1,10 +1,11 @@
<h1>Editing pages</h1>
<% form_for @page, :url => admin_page_path(@page) do |f| %>
<h1><%= t('admin.editing_page') %></h1>
<%= form_for @page, :url => admin_page_path(@page) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
<%= f.submit t('update') %> <%= link_back %>
</p>
<% end %>
<% end %>
+4 -4
View File
@@ -1,11 +1,11 @@
<h1>New pages</h1>
<% form_for :page, :url => admin_pages_path do |f| %>
<h1><%= t('admin.new_page') %></h1>
<%= form_for :page, :url => admin_pages_path do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end %>
+5 -22
View File
@@ -1,28 +1,11 @@
<%= f.error_messages %>
<%= f.hidden_field :parent_name %>
<%= f.hidden_field :parent_id %>
<p>
<%= f.label :name, "Name" %>
<%= f.label :name, t('admin.name') %>
<%= f.text_field :name, :class => 'text' %>
</p>
<p id="content_zh_tw_block">
<%= f.label "content_zh_tw", "Content (zh_tw)" %>
<%= f.text_area "content_zh_tw", :size => '100x30' %>
<p>
<%= f.label "content", t('admin.content') %>
<%= f.text_area "content", :size => '100x30' %>
</p>
<p><a href="#" id="toggle_content_en_block">Edit english</a></p>
<p id="content_en_block">
<%= f.label "content_en", "Content (en)" %>
<%= f.text_area "content_en", :size => '100x30' %>
</p>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('#content_en_block').hide();
$('#toggle_content_en_block').click(function(){
$('#content_en_block').toggle();
});
</script>
<% end -%>
+4 -4
View File
@@ -1,11 +1,11 @@
<h1>Editing snippets</h1>
<h1><%= t('admin.editing_snippet') %></h1>
<% form_for @snippet, :url => admin_snippet_path(@snippet) do |f| %>
<%= form_for @snippet, :url => admin_snippet_path(@snippet) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>
<%= f.submit 'Update' %> <%= link_back %>
</p>
<% end %>
<% end %>
+3 -3
View File
@@ -1,4 +1,4 @@
<h1>New snippets</h1>
<h1><%= t('admin.new_snippet') %></h1>
<% form_for :snippet, :url => admin_snippets_path do |f| %>
<%= f.error_messages %>
@@ -6,6 +6,6 @@
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end %>
<% end %>
@@ -0,0 +1 @@
<a href="#" class="edit"><%= t(:edit) %></a> | <a href="#" class="hide"><%= t(:hide) %></a>
@@ -0,0 +1,16 @@
<table>
<tr>
<th><%= t('admin.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
</tr>
<% @language_i18n_variables.each do |var| %>
<tr>
<td><%= var.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= text_field_tag "i18n_variables[#{var.id}][#{locale}]", var[locale] %></td>
<% end %>
</tr>
<% end %>
</table>
@@ -0,0 +1,34 @@
<% @vars = @i18n_variables.inject([]) do |result, var|
result << var if var.parent_id.to_s.eql?(edit_user_attribute_model.id.to_s)
result
end %>
<fieldset>
<legend>
<%= edit_user_attribute_model.key %>
<%#= render :partial => 'action_bar' %>
</legend>
<table>
<tr>
<th><%= t('admin.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
</tr>
<tr>
<td><%= edit_user_attribute_model.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= text_field_tag "i18n_variables[#{edit_user_attribute_model.id}][#{locale}]", edit_user_attribute_model[locale] %></td>
<% end %>
</tr>
<% @vars.each do |var| %>
<tr>
<td><%= var.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= text_field_tag "i18n_variables[#{var.id}][#{locale}]", var[locale] %></td>
<% end %>
</tr>
<% end %>
</table>
</fieldset>
@@ -0,0 +1,16 @@
<table>
<tr>
<th><%= t('admin.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
</tr>
<% @language_i18n_variables.each do |var| %>
<tr>
<td><%= var.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= var[locale] %></td>
<% end %>
</tr>
<% end %>
</table>
@@ -0,0 +1,34 @@
<% @vars = @i18n_variables.inject([]) do |result, var|
result << var if var.parent_id.to_s.eql?(user_attribute_model.id.to_s)
result
end %>
<fieldset>
<legend>
<%= user_attribute_model.key %>
<%#= render :partial => 'action_bar' %>
</legend>
<table>
<tr>
<th><%= t('admin.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
</tr>
<tr>
<td><%= user_attribute_model.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= user_attribute_model[locale] %></td>
<% end %>
</tr>
<% @vars.each do |var| %>
<tr>
<td><%= var.key %></td>
<% @site_valid_locales.each do |locale| %>
<td><%= var[locale] %></td>
<% end %>
</tr>
<% end %>
</table>
</fieldset>
@@ -0,0 +1,25 @@
<%= form_tag admin_translation_path('all'), :method => :put do %>
<% if @language_i18n_variables.size > 0 %>
<fieldset>
<legend>
<%= t('admin.language') %>
<%#= render :partial => 'action_bar' %>
</legend>
<div><%= render :partial => 'edit_language' %></div>
</fieldset>
<% end %>
<% if @user_attribute_model_i18n_variables.size > 0 %>
<fieldset>
<legend>
<%= t('admin.user_attribute') %>
<%#= render :partial => 'action_bar' %>
</legend>
<div><%= render :partial => 'edit_user_attribute_model', :collection => @user_attribute_model_i18n_variables %></div>
</fieldset>
<% end %>
<%= submit_tag t('update') %> <%= link_back %>
<% end %>
@@ -0,0 +1,69 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t(:edit), edit_admin_translation_path('all'), :class => 'button positive' %></li>
<li>
<%= t('admin.add_language') %>:
<%= form_tag admin_translation_path('add'), :method => :put do %>
<%= text_field_tag 'language', '', :style => "width:100px" %>
<%= submit_tag t(:add) %>
<% end %>
</li>
<li>
<%= t('admin.enable_language') %>:
<%= form_tag admin_translation_path('enable'), :method => :put do %>
<%= select_tag 'enable_language', options_for_select(@site_valid_locales - @site_in_use_locales), :style => "width:100px" %>
<%= submit_tag t(:enable) %>
<% end %>
</li>
<li>
<%= t('admin.disable_language') %>:
<%= form_tag admin_translation_path('disable'), :method => :put do %>
<%= select_tag 'disable_language', options_for_select(@site_in_use_locales), :style => "width:100px" %>
<%= submit_tag t(:disable) %>
<% end %>
</li>
<li>
<%= t('admin.delete_language') %>:
<%= form_tag admin_translation_path('delete'), :method => :put do %>
<%= select_tag 'delete_language', options_for_select(@site_valid_locales), :style => "width:100px" %>
<%= submit_tag t(:delete), :confirm => t('sure?') %>
<% end %>
</li>
</ul>
<% end -%>
<% if @language_i18n_variables.size > 0 %>
<fieldset>
<legend>
<%= t('admin.language') %>
<%#= render :partial => 'action_bar' %>
</legend>
<div><%= render :partial => 'language' %></div>
</fieldset>
<% end %>
<% if @user_attribute_model_i18n_variables.size > 0 %>
<fieldset>
<legend>
<%= t('admin.user_attribute') %>
<%#= render :partial => 'action_bar' %>
</legend>
<div><%= render :partial => 'user_attribute_model', :collection => @user_attribute_model_i18n_variables %></div>
</fieldset>
<% end %>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('div a.hide').live( "click", function(){
$(this).parent().next().hide();
$(this).replaceWith("<a href='#' class='show'><%= t(:show) %></a>");
});
$('div a.show').live( "click", function(){
$(this).parent().next().show();
$(this).replaceWith("<a href='#' class='hide'><%= t(:hide) %></a>");
});
</script>
<% end -%>
@@ -0,0 +1,30 @@
<%= fields_for 'user_attribute_model[attribute_attr_models][]', attribute_attr_model, :index => nil do |f| %>
<tr>
<td><%= attribute_attr_model.new_record? ? (f.text_field :key, {:style => "width:130px"}) : attribute_attr_model.key %></td>
<td class='select_mulitlingual' style='text-align:center'>
<%= check_box_tag "locale[]", value = '', attribute_attr_model.locale.nil? ? true : attribute_attr_model.locale %>
<%= hidden_field_tag "user_attribute_model[attribute_attr_models][][locale]", attribute_attr_model.locale.nil? ? true : attribute_attr_model.locale %>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= text_field_tag "user_attribute_model[attribute_attr_models][][i18n_variable][#{locale}]", (attribute_attr_model.i18n_variable[locale] rescue nil), :style => "width:130px" %></td>
<% end %>
<td class='select_type'>
<%= f.select :markup, LIST[:markups], {}, {:style => "width:90px"} %>
<div <%= attribute_attr_model[:markup].eql?('select') ? nil : "style='display:none'"%>>
<%= t('admin.options') %>:
<%= text_field_tag "user_attribute_model[attribute_attr_models][][select_options]", attribute_attr_model.select_options, :style => "width:130px" %>
</div>
</td>
<td>
<% if attribute_attr_model.new_record? %>
<a href="#" class="remove">(<%= t(:delete) %>)</a>
<% else %>
<a href="#" class="remove_existing_record">(<%= t(:delete) %>)</a>
<%= hidden_field_tag "user_attribute_model[attribute_attr_models][][should_destroy]", nil , :class => 'should_destroy' %>
<%= f.hidden_field :id %>
<% end %>
</td>
</tr>
<% end %>
@@ -0,0 +1,73 @@
<table>
<tr>
<th><%= t('admin.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
</tr>
<tr>
<td><%= is_new ? (f.text_field :key, {:style => "width:130px"}) : @user_attribute_model.key %></td>
<% @site_valid_locales.each do |locale| %>
<td>
<%= text_field_tag "user_attribute_model[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :style => "width:130px" %>
</td>
<% end %>
</tr>
</table>
<fieldset id='field_set_attribute_attrs'>
<legend>
<%= t('admin.attributes')%>
</legend>
<table id='attribute_attrs'>
<tr>
<th><%= t('admin.key') %></th>
<th><%= t('admin.multilingual') %></th>
<% @site_valid_locales.each do |locale| %>
<th style="color:<%= colorize_in_use_locale(locale) %>"><%= locale %></th>
<% end %>
<th><%= t('admin.type')%></th>
<th></th>
</tr>
<%= render :partial => 'attribute_attr_model', :collection => @user_attribute_model.attribute_attr_models %>
</table>
<a href="#" class="add">(<%= t(:add) %>)</a>
</fieldset>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('#field_set_attribute_attrs a.remove').live('click', function(){
$(this).parent().parent().remove();
});
$('#field_set_attribute_attrs a.add').click(function(){
$('#attribute_attrs').append("<%= escape_javascript(render(:partial => 'attribute_attr_model', :object => @user_attribute_model.attribute_attr_models.build)) %>");
});
$('#field_set_attribute_attrs a.remove_existing_record').click(function(){
$(this).next('.should_destroy').attr('value', 1);
$(this).parent().parent().hide();
});
$('.select_mulitlingual input').live('click', function(){
$(this).next().attr('value', this.checked);
});
$('.select_type select').live('change', function(){
if(this.value == 'select')
{
$(this).next().show();
}
else
{
$(this).next().hide();
}
});
</script>
<% end -%>
@@ -0,0 +1,19 @@
<h1><%= t('admin.editing_user_attribute') %>: <%= @user_attribute_model.key %></h1>
<fieldset>
<legend>
<%= t('admin.user_attribute')%>
</legend>
<%= form_for @user_attribute_model, :url => admin_user_attribute_model_path(@user_attribute_model) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f, :is_new => false } %>
<p>
<%= f.submit t('update') %> <%= link_back %>
</p>
<% end -%>
</fieldset>
@@ -0,0 +1,26 @@
<% content_for :secondary do %>
<ul class="list">
<li><%= link_to t('admin.new_user_attribute'), new_admin_user_attribute_model_path, :class => 'button positive' %></li>
</ul>
<% end -%>
<h1><%= t('admin.list_user_attributes') %></h1>
<table>
<tr>
<th><%= t('admin.attribute') %></th>
<th><%= t('admin.key') %></th>
<th><%= t('admin.action') %></th>
</tr>
<% @user_attribute_models.each do |user_attribute_model| %>
<tr>
<td><%= user_attribute_model.i18n_variable[I18n.locale] %></td>
<td><%= user_attribute_model.key %></td>
<td>
<%= link_to t(:edit), edit_admin_user_attribute_model_path(user_attribute_model) %> |
<%= link_to t(:delete), admin_user_attribute_model_path(user_attribute_model), :confirm => t('sure?'), :method => :delete %>
</td>
</tr>
<% end %>
</table>
@@ -0,0 +1,19 @@
<h1><%= t('admin.new_user_attribute') %></h1>
<fieldset id='field_set_attribute_attrs'>
<legend>
<%= t('admin.user_attribute')%>
</legend>
<%= form_for @user_attribute_model, :url => admin_user_attribute_models_path do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f, :is_new => true } %>
<p>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end -%>
</fieldset>