Page module new UI

This commit is contained in:
chris 2013-07-25 17:37:11 +08:00
parent da1d70efcb
commit f60c190a11
5 changed files with 102 additions and 73 deletions

View File

@ -33,4 +33,8 @@ class PageContext
self.is_top
end
def title
self.page.title
end
end

View File

@ -1,46 +1,54 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<% end %>
<%= f.error_messages %>
<fieldset>
<div class="input-area">
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %>
</ul>
<div id="post-body">
<div id="post-body-content">
<div class="title">
<%= f.label :name, t(:name) %>
<%= @page_context.page.title %>
</div>
<ul class="nav nav-tabs">
<!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :context, t(:content) %>
<%= f.fields_for :context_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style => "width:100%;", :class => 'tinymce_textarea', :value => (@page_context.context_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<% end %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- Title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t(:title) %></label>
<div class="controls">
<h5><%= @page_context.page.title %></h5>
</div>
</div>
<!-- Content-->
<div class="control-group input-content">
<label class="control-label muted"><%= t(:content) %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :context_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", id: "content_#{locale}", name: "content_#{locale}", :value => (@page_context.context_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.submit t(:submit), class: 'btn btn-primary' %>
<%#= button_tag t("preview"), id: "button_for_preview", name: "commit", class: 'btn post_preview', type: :button, url: preview_panel_announcement_back_end_bulletins_path %>
<%= link_to t(:cancel), get_go_back, class: "btn" %>
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
<%= hidden_field_tag 'sort', params[:sort] if !params[:sort].blank? %>
<%= hidden_field_tag 'direction', params[:direction] if !params[:direction].blank? %>
<%= hidden_field_tag 'sort_options', params[:sort_options] if !params[:sort_options].blank? %>
</div>
<div class="form-actions">
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
<%= hidden_field_tag 'sort', params[:sort] if !params[:sort].blank? %>
<%= hidden_field_tag 'direction', params[:direction] if !params[:direction].blank? %>
<%= hidden_field_tag 'sort_options', params[:sort_options] if !params[:sort_options].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>

View File

@ -1,8 +1,3 @@
<div id="poststuff">
<h1><%= t('page_content.editing_page_content') %></h1>
<%= form_for @page_context, :url => panel_page_content_back_end_page_context_path(@page_context), :html => {:class => 'clear'} do |f| %>
<%= form_for @page_context, :url => panel_page_content_back_end_page_context_path(@page_context), :html => {:class => 'form-horizontal main-forms'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
</div>
<%#= link_back %>

View File

@ -1,21 +1,41 @@
<%= render 'filter' %>
<% set_default_index do
objects @page_contexts
quick_edit_link type: 'edit',
link: 'edit_panel_page_content_back_end_page_context_path'
quick_edit_link type: 'authorization',
link: "admin_authorizations_path(@module_app.key, 'page_context', object.id)"
field type: 'associated',
db_field: 'page',
model_field: 'path',
translation: 'path',
hide: 'phone',
sort: 'path'
field type: 'associated',
db_field: 'page',
model_field: 'title',
translation: 'name',
quick_edit: true,
header_class: 'span5',
hide: 'phone',
sort: 'name'
field db_field: 'version',
translation: 'version',
display_option: 'link_to value, panel_page_content_back_end_view_path(object.page_id)',
sort: 'version',
hide: 'phone'
field db_field: 'updated_at',
translation: 'update_at',
display_option: 'display_date_time(value)',
hide: 'phone',
sort: 'update_at'
field type: 'id',
db_field: 'update_user_id',
model: User,
model_field: 'name',
translation: 'last_modified',
hide: 'phone',
sort: 'last_modified'
footer
end %>
<table class="table main-list">
<thead>
<tr>
<th class="span7"></th>
<th class="span2"></th>
<th class="span2"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="tbody_page_contexts" class="sort-holder">
<%= render :partial => 'page_context', :collection => @page_contexts %>
</tbody>
</table>
<div id="page_context_pagination" class="paginationFixed">
<%= paginate @page_contexts, :params => {:direction => params[:direction], :sort => params[:sort]} %>
</div>
<%= render 'admin/default_index/index' %>

View File

@ -11,7 +11,9 @@ module PageContent
intro "I am intro"
update_info 'some update_info'
authorizable
authorizable do
authorizable_on('PageContext')
end
front_end do
app_page 'page_contexts' do
@ -27,11 +29,11 @@ module PageContent
head_link_path "panel_page_content_back_end_page_contexts_path"
context_link 'module_authorization',
:link_path=>"admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: 'PageContent'}))",
:priority=>1,
:active_for_app_auth => 'PageContext',
:available_for => [:admin]
context_link 'all',
:link_path => "panel_page_content_back_end_page_contexts_path",
:priority => 1,
:active_for_action => {:page_contexts => :index},
:available_for => [:all]
end
end
end