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 self.is_top
end end
def title
self.page.title
end
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">
<div id="post-body"> <!-- Language Tabs -->
<div id="post-body-content"> <div class="nav-name"><strong><%= t(:language) %></strong></div>
<div class="title"> <ul class="nav nav-pills language-nav">
<%= f.label :name, t(:name) %>
<%= @page_context.page.title %>
</div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @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> <li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% end %> <% end %>
</ul> </ul>
<div class="tab-content"> <!-- Language -->
<div class="tab-content language-area">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>"> <!-- Title-->
<div class="control-group input-title">
<div class="title"> <label class="control-label muted"><%= t(:title) %></label>
<%= f.label :context, t(:content) %> <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.fields_for :context_translations do |f| %>
<%= I18nVariable.from_locale(locale) %> <%= f.cktext_area locale, rows: 5, class: "input-block-level", id: "content_#{locale}", name: "content_#{locale}", :value => (@page_context.context_translations[locale] rescue nil) %>
<%= f.text_area locale, :style => "width:100%;", :class => 'tinymce_textarea', :value => (@page_context.context_translations[locale] rescue nil) %>
<% end %> <% end %>
</div> </div>
</div>
</div>
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
</div> <!-- Form Actions -->
<div class="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 'page', params[:page] if !params[:page].blank? %>
<%= hidden_field_tag 'sort', params[:sort] if !params[:sort].blank? %> <%= hidden_field_tag 'sort', params[:sort] if !params[:sort].blank? %>
<%= hidden_field_tag 'direction', params[:direction] if !params[:direction].blank? %> <%= hidden_field_tag 'direction', params[:direction] if !params[:direction].blank? %>
<%= hidden_field_tag 'sort_options', params[:sort_options] if !params[:sort_options].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> </div>
</fieldset>

View File

@ -1,8 +1,3 @@
<div id="poststuff"> <%= form_for @page_context, :url => panel_page_content_back_end_page_context_path(@page_context), :html => {:class => 'form-horizontal main-forms'} do |f| %>
<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| %>
<%= render :partial => 'form', :locals => {:f => f} %> <%= render :partial => 'form', :locals => {:f => f} %>
<% end %> <% 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"> <%= render 'admin/default_index/index' %>
<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>

View File

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