Ray's changes for page_edit

This commit is contained in:
Christophe Vilayphiou 2012-05-13 19:36:04 +08:00
parent ef49df448d
commit ef2d416c70
6 changed files with 121 additions and 55 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -11,6 +11,7 @@
} }
.nav-list ol li { .nav-list ol li {
padding: 5px 0; padding: 5px 0;
list-style: none;
} }
.nav-list ol li a { .nav-list ol li a {
font-size: 13px; font-size: 13px;

View File

@ -110,10 +110,8 @@
padding:6px; padding:6px;
} }
#orbit-bar .nav > li.search { #orbit-bar .nav > li.search {
background-image: none;
overflow: hidden; overflow: hidden;
width: 28px; width: 28px;
margin-bottom: 0;
position: relative; position: relative;
} }
#orbit-bar .nav > li > a.orbit-bar-home { #orbit-bar .nav > li > a.orbit-bar-home {
@ -686,6 +684,32 @@
z-index: 2 !important; z-index: 2 !important;
} }
#back_main .editable {
position: relative;
}
#back_main .editable:after {
content: '';
clear: both;
display: block;
visibility: hidden;
height: 0;
}
#back_main .edit_link a {
position: absolute;
z-index: 10;
width: 100%;
height: 100%;
top: 0;
left: 0;
text-indent: -9999px;
background: url(<%= asset_path 'editicon.png' %>) no-repeat center center rgba(255,255,255,.8);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1);
}
[class^="icons-"] { [class^="icons-"] {
display: inline-block; display: inline-block;
width: 16px; width: 16px;

View File

@ -1,10 +1,11 @@
<%= flash_messages %> <%= flash_messages %>
<div id="poststuff">
<h1><%= t('admin.editing_page') %></h1> <h1><%= t('admin.editing_page') %></h1>
<%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form-horizontal edit_page' } do |f| %>
<%= form_for @item, :url => admin_page_path(@item) do |f| %>
<%= render :partial => "form", :locals => { :f => f } %> <%= render :partial => "form", :locals => { :f => f } %>
<p> <div class="form-actions">
<%= f.submit t('update') %> <%= link_back %> <%= f.submit t('update'), :class => 'btn btn-primary' %>
</p> <%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</div>
<% end %> <% end %>

View File

@ -1,52 +1,92 @@
<%= f.error_messages %> <%= f.error_messages %>
<%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %> <%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %>
<p> <div class="control-group">
<%= f.label :name, t('admin.name') %> <%= f.label :name, t('admin.name'), :class => 'control-label' %>
<%= f.text_field :name, :class => 'text' %> <div class="controls">
</p> <%= f.text_field :name, :class => 'text input-xlarge' %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</div>
<%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %> <%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %> <% @site_valid_locales.each do |locale| %>
<p> <div class="control-group">
<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %> <%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<%= f.text_field locale %> <div class="controls">
</p> <%= f.text_field locale, :class => 'text input-xlarge' %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</div>
<% end %> <% end %>
<% end %> <% end %>
<p> <div class="control-group">
<%= t('admin.design_name') %> <%= f.label :name, t('admin.design_name'), :class => 'control-label' %>
<div class="controls">
<%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => admin_pages_path} %> <%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => admin_pages_path} %>
</p> <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<p> </div>
<%= t('admin.theme') %> </div>
<div class="control-group">
<%= f.label :name, t('admin.theme'), :class => 'control-label' %>
<div class="controls">
<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %> <%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %>
</p> <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<p> </div>
<%= t('admin.module_app') %> </div>
<div class="control-group">
<%= f.label :name, t('admin.module_app'), :class => 'control-label' %>
<div class="controls">
<%= render :partial => "app_selector", :locals => { :f => f } %> <%= render :partial => "app_selector", :locals => { :f => f } %>
<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span> <span id="app_page_url">
<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> </span> <%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%>
</p> </span>
<p> <span id="app_page_category">
<%= f.label :is_published, "#{t('admin.is_published')} ?" %> <%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No </span>
</p> <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<p> </div>
<%= f.label :menu_enabled_for, "#{t('admin.menu_enabled_for')}:" %> </div>
<div class="control-group">
<%= f.label :is_published, "#{t('admin.is_published')} ?", :class => 'control-label' %>
<div class="controls">
<label class="radio">
<%= f.radio_button :is_published, true %>
Yes
</label>
<label class="radio">
<%= f.radio_button :is_published, false %>
No
</label>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</div>
<div class="control-group">
<%= f.label :menu_enabled_for, "#{t('admin.menu_enabled_for')}:", :class => 'control-label' %>
<div class="controls">
<% @site_valid_locales.each do |valid_locale| %> <% @site_valid_locales.each do |valid_locale| %>
<label class="checkbox">
<%= check_box_tag 'page[menu_enabled_for][]', valid_locale, (@item.menu_enabled_for.nil? ? true : @item.menu_enabled_for.include?(valid_locale)) %> <%= check_box_tag 'page[menu_enabled_for][]', valid_locale, (@item.menu_enabled_for.nil? ? true : @item.menu_enabled_for.include?(valid_locale)) %>
<%= I18nVariable.from_locale(valid_locale) %> <%= I18nVariable.from_locale(valid_locale) %>
</label>
<% end %> <% end %>
<%= hidden_field_tag 'page[menu_enabled_for][]', '' %> <%= hidden_field_tag 'page[menu_enabled_for][]', '' %>
</p> <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<p> </div>
<%= f.label :enabled_for, "#{t('admin.enabled_for')}:" %> </div>
<div class="control-group">
<%= f.label :enabled_for, "#{t('admin.enabled_for')}:", :class => 'control-label' %>
<div class="controls">
<% @site_valid_locales.each do |valid_locale| %> <% @site_valid_locales.each do |valid_locale| %>
<label class="checkbox">
<%= check_box_tag 'page[enabled_for][]', valid_locale, (@item.enabled_for.nil? ? true : @item.enabled_for.include?(valid_locale)) %> <%= check_box_tag 'page[enabled_for][]', valid_locale, (@item.enabled_for.nil? ? true : @item.enabled_for.include?(valid_locale)) %>
<%= I18nVariable.from_locale(valid_locale) %> <%= I18nVariable.from_locale(valid_locale) %>
</label>
<% end %> <% end %>
<%= hidden_field_tag 'page[enabled_for][]', '' %> <%= hidden_field_tag 'page[enabled_for][]', '' %>
</p> <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
</div>
</div>

View File

@ -50,7 +50,7 @@ module ParserBackEnd
ret << "'></div>" ret << "'></div>"
else else
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable'>" if part
ret << "<div class='edit_link' style='display:none'>" ret << "<div class='edit_link' style='display:none'>"
ret << " <a href='#{edit_admin_page_part_path(part.id)}' class='nav'>#{t(:edit)}</a>" if part ret << " <a href='#{edit_admin_page_part_path(part.id)}' class='nav'>#{t(:edit)}</a>" if part
ret << '</div>' ret << '</div>'